:root {
  --primary:        #5B5BD6;
  --primary-soft:   #EEEEFB;
  --bg:             #F4F4F8;
  --surface:        #FFFFFF;
  --text:           #11181C;
  --muted:          #687076;
  --border:         #E8E8EF;
  --done:           #30A46C;
  --high:           #E5484D;
  --medium:         #C2410C;
  --low:            #0070D8;
  --radius:         12px;
  --radius-sm:      8px;
  --shadow:         0 1px 2px rgba(0,0,0,.06), 0 3px 10px rgba(0,0,0,.04);
  --header-h:       56px;
  --tab-h:          62px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* ── Header ──────────────────────────────────── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 10px;
  z-index: 100;
}

.header-logo-mark {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.header-logo-text {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.header-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 2px 8px;
  border-radius: 10px;
}

.header-spacer { flex: 1; }

.header-date {
  font-size: 13px;
  color: var(--muted);
  display: none;
}

.header-sync {
  display: none;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}

.sync-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--done);
}

/* ── Layout ──────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 3fr 2fr;
  height: 100vh;
  padding-top: var(--header-h);
}

.left-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
  height: calc(100vh - var(--header-h));
}

.panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.panel-tasks { background: var(--bg); display: none; }
.panel-notes { background: var(--bg); display: none; }
.panel-tasks.active,
.panel-notes.active { display: flex; }
.panel-chat  { background: var(--surface); height: calc(100vh - var(--header-h)); }

/* ── Desktop left-panel tabs ─────────────────── */
.left-tabs {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.left-tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.left-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Panel headers ───────────────────────────── */
.panel-head {
  padding: 16px 20px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.panel-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-head-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.panel-head-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.panel-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-add-task {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}

.btn-add-task:hover { opacity: .85; }

.btn-ghost {
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  transition: color .15s;
}

.btn-ghost:hover { color: var(--text); }

.online-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}

.online-dot::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--done);
}

/* ── Task scroll ─────────────────────────────── */
.task-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 14px 80px;
}

.task-group-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 14px 4px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.task-group-label.overdue-label { color: var(--high); }
.task-group-label.done-label    { color: var(--done); }

.btn-clear-done {
  font-size: 11px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px 8px;
  cursor: pointer;
  font-weight: 500;
  transition: color .15s, border-color .15s;
}

.btn-clear-done:hover { color: var(--high); border-color: var(--high); }

/* ── Task card ───────────────────────────────── */
.task-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 12px 12px 14px;
  margin-bottom: 6px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 11px;
  align-items: flex-start;
  transition: opacity .2s;
}

.task-card.done { opacity: .38; }

/* ── Checkbox ────────────────────────────────── */
.task-check {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, background .15s;
  margin-top: 1px;
}

.task-check.priority-high  { border-color: var(--high); }
.task-check.priority-low   { border-color: var(--low); }
.task-check:hover          { border-color: var(--done); }

.task-check.checked {
  background: var(--done);
  border-color: var(--done);
}

.task-check.checked::after {
  content: '';
  display: block;
  width: 5px; height: 9px;
  border: 2px solid #fff;
  border-top: none; border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
}

/* ── Task body ───────────────────────────────── */
.task-body { flex: 1; min-width: 0; }

.task-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  word-break: break-word;
  color: var(--text);
}

.task-title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.task-countdown {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.task-countdown.urgent {
  color: var(--high);
}

.task-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-card.done .task-title { text-decoration: line-through; color: var(--muted); }

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
  align-items: center;
}

/* ── Badges ──────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 500;
  line-height: 1.5;
}

.badge-time         { background: #F0F0F5; color: var(--muted); }
.badge-overdue      { background: #FFEFEF; color: var(--high); }
.badge-person       { background: #F0F0F5; color: var(--muted); }
.badge-cal-pending  { background: none; color: var(--primary); border: none; padding: 0; font-size: 11px; font-weight: 600; cursor: pointer; }
.badge-cal-done     { background: var(--primary-soft); color: var(--primary); }
.badge-high         { background: #FFEFEF; color: var(--high); }
.badge-medium       { background: #FFF3EE; color: var(--medium); }
.badge-low          { background: #EEF5FF; color: var(--low); }
.badge-done-tag     { background: #EDFBF3; color: var(--done); }

/* ── Task delete ─────────────────────────────── */
.task-delete {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border: none;
  background: none;
  color: var(--border);
  font-size: 12px;
  cursor: pointer;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s, background .15s;
}

.task-delete:hover { color: var(--high); background: #FFEFEF; }

/* ── FAB ─────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: 28px;
  right: calc(40% + 20px);
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 22px;
  font-weight: 300;
  border: none;
  box-shadow: 0 4px 16px rgba(91,91,214,.4);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s, box-shadow .15s;
  z-index: 50;
}

.fab:hover  { transform: scale(1.06); box-shadow: 0 6px 22px rgba(91,91,214,.48); }
.fab:active { transform: scale(.94); }

/* ── Chat ────────────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-welcome {
  margin: auto;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
  padding: 40px 20px;
}

.chat-welcome strong {
  display: block;
  font-size: 16px;
  color: var(--text);
  margin-bottom: 8px;
}

.chat-welcome .hint {
  font-size: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 14px;
  text-align: left;
  line-height: 1.7;
  color: var(--muted);
}

/* ── Message row ─────────────────────────────── */
.msg-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.msg-row.user { justify-content: flex-end; }
.msg-row.ai   { justify-content: flex-start; }

.msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.msg-col { display: flex; flex-direction: column; gap: 3px; max-width: 78%; }
.msg-row.user .msg-col { align-items: flex-end; }
.msg-row.ai   .msg-col { align-items: flex-start; }

.bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-line;
}

.bubble-user {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bubble-ai {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.bubble-ai.loading { color: var(--muted); font-style: italic; }

/* ── Task summary card (AI response) ─────────── */
.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  overflow: hidden;
  min-width: 200px;
}

.summary-card-header {
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  gap: 5px;
}

.summary-card-body { padding: 4px 0; }

.summary-task-row {
  display: flex;
  flex-direction: column;
  padding: 7px 14px;
  gap: 2px;
  border-bottom: 1px solid var(--bg);
}

.summary-task-row:last-child { border-bottom: none; }

.summary-task-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 5px;
}

.summary-task-title::before {
  content: '✓';
  color: var(--done);
  font-size: 11px;
  font-weight: 700;
}

.summary-task-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 8px;
}

.msg-time {
  font-size: 10px;
  color: var(--muted);
  padding: 0 2px;
}

/* ── Chat input ──────────────────────────────── */
.chat-input-bar {
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  background: var(--surface);
}

.chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 40px 9px 13px;
  font-size: 16px;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 40px;
  max-height: 120px;
  line-height: 1.5;
  background: var(--bg);
  transition: border-color .15s;
  position: relative;
}

.chat-input:focus { border-color: var(--primary); background: #fff; }

.input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: flex-end;
}

.btn-mic {
  position: absolute;
  right: 9px;
  bottom: 9px;
  width: 22px; height: 22px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: color .15s;
}

.btn-mic:hover { color: var(--primary); }

.btn-send {
  flex-shrink: 0;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  width: 40px; height: 40px;
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .15s;
}

.btn-send:hover    { opacity: .85; }
.btn-send:disabled { opacity: .35; cursor: default; }

/* ── Modal ───────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.36);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
}

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 16px 20px calc(28px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 560px;
  animation: slide-up .22s ease;
}

@keyframes slide-up {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-drag {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 14px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--muted);
}

.form-group { margin-bottom: 12px; }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.form-input, .form-select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  background: var(--bg);
  transition: border-color .15s;
  color: var(--text);
}

.form-input:focus, .form-select:focus { border-color: var(--primary); background: #fff; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity .15s;
  border-radius: 12px;
}

.btn-primary:hover { opacity: .88; }

.btn-cancel {
  width: 100%;
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 10px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 2px;
}

/* ── Toast ───────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--tab-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17,24,28,.9);
  color: #fff;
  padding: 9px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: opacity .22s;
  z-index: 300;
  white-space: nowrap;
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.show { opacity: 1; }

.toast-undo {
  color: #A5B4FC;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 13px;
  padding: 0;
}

/* ── Empty state ─────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  line-height: 1.7;
}

.empty-icon { font-size: 36px; opacity: .3; }

/* ── Scrollbar ───────────────────────────────── */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Mobile ──────────────────────────────────── */
@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
    padding-bottom: var(--tab-h);
  }

  .left-panel {
    height: calc(100vh - var(--header-h) - var(--tab-h));
    border-right: none;
    display: contents;
  }

  .left-tabs { display: none; }

  .panel {
    height: calc(100vh - var(--header-h) - var(--tab-h));
    flex: unset;
  }

  .panel-tasks,
  .panel-notes,
  .panel-chat { display: none; }

  .panel-tasks.active,
  .panel-notes.active,
  .panel-chat.active { display: flex; }

  .panel-head-actions .btn-add-task { display: none; }

  .fab {
    bottom: calc(var(--tab-h) + 16px);
    right: 18px;
  }

  .panel-chat.active ~ .fab,
  body.tab-chat .fab { display: none; }

  .tab-bar {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--tab-h);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 100;
  }

  .tab {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    transition: color .15s;
    position: relative;
    padding-top: 10px;
  }

  .tab::after {
    content: '';
    position: absolute;
    bottom: 0; left: 25%; right: 25%;
    height: 2px;
    border-radius: 1px;
    background: var(--primary);
    opacity: 0;
    transition: opacity .15s;
  }

  .tab.active { color: var(--primary); }
  .tab.active::after { opacity: 1; }

  .tab-icon { font-size: 20px; }

  .tab-badge {
    position: absolute;
    top: 7px; right: calc(50% - 16px);
    background: var(--high);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px; height: 16px;
    border-radius: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
  }

  .toast { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 12px); }
}

@media (min-width: 769px) {
  .tab-bar    { display: none; }
  .panel-chat { display: flex !important; }
  .fab        { display: none; }
  .toast      { bottom: 24px; }
  .header-date  { display: block; }
  .header-sync  { display: flex; }
}

/* ── Notes panel ─────────────────────────────── */
.note-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 14px 8px;
}

.note-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 6px;
  box-shadow: var(--shadow);
}

.note-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  word-break: break-word;
  white-space: pre-wrap;
}

.note-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.note-loc-badge {
  font-size: 11px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}

.note-date {
  font-size: 11px;
  color: var(--muted);
  flex: 1;
}

.note-delete {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border: none;
  background: none;
  color: var(--border);
  font-size: 11px;
  cursor: pointer;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s, background .15s;
}

.note-delete:hover { color: var(--high); background: #FFEFEF; }

/* ── Note input bar ──────────────────────────── */
.note-input-bar {
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  font-size: 16px;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 60px;
  max-height: 140px;
  line-height: 1.5;
  background: var(--bg);
  transition: border-color .15s;
  color: var(--text);
}

.note-input:focus { border-color: var(--primary); background: #fff; }

.note-input-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.btn-note-loc {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  color: var(--muted);
}

.btn-note-loc.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

.btn-note-save {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}

.btn-note-save:hover { opacity: .85; }

.nearby-banner {
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.nearby-banner button {
  border: none;
  background: none;
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
}

/* ── Quota chip ──────────────────────────────── */
.quota-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  white-space: nowrap;
  display: none;
}
.quota-chip.warn  { background: #FFF3EE; color: var(--medium); }
.quota-chip.empty { background: #FFEFEF; color: var(--high); cursor: pointer; }

/* ── Activate mask ───────────────────────────── */
.activate-mask {
  position: fixed; inset: 0;
  background: rgba(17,24,28,.55);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
}
.activate-mask.hidden { display: none; }

.activate-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 36px 28px 28px;
  width: min(360px, 90vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.activate-logo { font-size: 48px; }

.activate-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.activate-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

.activate-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 2px;
  text-align: center;
  outline: none;
  background: var(--bg);
  transition: border-color .15s;
  color: var(--text);
}
.activate-input:focus { border-color: var(--primary); background: #fff; }

.activate-btn {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 12px;
  transition: opacity .15s;
  margin-top: 4px;
}
.activate-btn:hover { opacity: .88; }

.activate-hint {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
  margin-top: 4px;
}

/* ── 分享面板 ───────────────────────────────── */
.btn-share-header {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: background .15s;
  margin-left: 4px;
}
.btn-share-header:hover { background: var(--primary-soft); }

.share-link-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}
.share-link-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.share-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.share-link-input {
  flex: 1;
  border: none;
  background: none;
  font-size: 13px;
  color: var(--text);
  outline: none;
  min-width: 0;
}
.btn-copy-link {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-copy-link:hover { opacity: .88; }

/* ── 分享卡片 ─────────────────────── */
.share-card {
  margin: 12px 0;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(135deg, #5B5BD6 0%, #7B7BE6 100%);
  box-shadow: 0 4px 20px rgba(91,91,214,.25);
  cursor: pointer;
  user-select: none;
  transition: transform .15s;
}
.share-card:active { transform: scale(.98); }
.share-card-inner { padding: 20px; text-align: center; color: #fff; }
.share-card-logo { font-size: 36px; margin-bottom: 6px; }
.share-card-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.share-card-desc { font-size: 12px; opacity: .85; margin-bottom: 12px; line-height: 1.6; }
.share-card-link {
  display: inline-block;
  background: rgba(255,255,255,.2);
  border-radius: 99px;
  padding: 5px 14px;
  font-size: 11px;
  letter-spacing: .3px;
  margin-bottom: 8px;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-card-tip { font-size: 11px; opacity: .6; }

.share-rules {
  margin-bottom: 14px;
}
.share-rule-title {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.share-rule-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.share-rule-row:last-child { border-bottom: none; }
.share-rule-label { color: var(--muted); }
.share-rule-val strong { color: var(--primary); }

.share-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.share-stat-item {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
}
.share-stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}
.share-stat-desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── 提现区域 ─────────────────────── */
.withdraw-section {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.withdraw-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.withdraw-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.withdraw-input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--card-bg);
  color: var(--text);
  outline: none;
}
.withdraw-input:focus { border-color: var(--primary); }
.btn-withdraw {
  padding: 8px 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-withdraw:disabled { opacity: 0.5; cursor: not-allowed; }
.withdraw-note {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

/* ── 提现记录 ─────────────────────── */
.withdraw-history {
  margin-top: 12px;
}
.withdraw-history-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.withdraw-record {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.withdraw-record:last-child { border-bottom: none; }
.withdraw-record-pts { font-weight: 600; }
.withdraw-record-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 500;
}
.withdraw-status-pending  { background: #FFF3CD; color: #856404; }
.withdraw-status-approved { background: #D1ECF1; color: #0C5460; }
.withdraw-status-paid     { background: #D4EDDA; color: #155724; }
.withdraw-status-rejected { background: #F8D7DA; color: #721C24; }

/* ── 使用攻略 ─────────────────────────────── */
.guide-steps { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.guide-step { display: flex; gap: 12px; align-items: flex-start; }
.guide-step-num {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.guide-step-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.guide-step-desc  { font-size: 13px; color: var(--muted); line-height: 1.6; }

.share-card-btn {
  margin-top: 14px;
  padding: 8px 24px;
  background: rgba(255,255,255,0.95);
  color: #5B5BD6;
  border: none;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: .02em;
}
.share-card-btn:active { opacity: .8; }
