/* ============================================================
   Solitaire — shared design system (web/shared/theme.css)
   Light theme by default + prefers-color-scheme dark tweaks.
   Category colors: H green #16a34a · C blue #2563eb ·
                    G orange #ea580c · MC red #dc2626
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
  /* surfaces & text */
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --surface-3: #eceff5;
  --border: #e3e8f0;
  --border-strong: #cbd5e1;
  --text: #16233f;
  --text-2: #475569;
  --muted: #6b7a90;

  /* brand */
  --primary: #2456d6;
  --primary-strong: #1c46b5;
  --primary-soft: #e8eefc;
  --primary-soft-2: #cddcf9;
  --on-primary: #ffffff;
  --navy: #14295e;

  /* semantic */
  --danger: #dc2626;   --danger-soft: #fdecec;
  --success: #16a34a;  --success-soft: #e7f6ec;
  --warning: #d97706;  --warning-soft: #fdf3e3;

  /* category chips (fixed across themes) */
  --cat-h: #16a34a;
  --cat-c: #2563eb;
  --cat-g: #ea580c;
  --cat-mc: #dc2626;
  --gold: #b45309;
  --gold-soft: #fdf3d7;

  /* chat bubbles */
  --bubble-in: #ffffff;
  --bubble-in-border: #e3e8f0;
  --bubble-out: #dce8fd;
  --bubble-out-border: #c3d6f8;

  /* type */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
          'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: 11px;
  --fs-sm: 12.5px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 19px;
  --fs-2xl: 24px;
  --fs-3xl: 30px;

  /* spacing scale (4px base) */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-7: 32px; --sp-8: 40px; --sp-9: 48px; --sp-10: 64px;

  /* radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 999px;

  /* elevation */
  --shadow-1: 0 1px 2px rgba(22, 35, 63, 0.06);
  --shadow-2: 0 4px 14px rgba(22, 35, 63, 0.10);
  --shadow-3: 0 12px 36px rgba(22, 35, 63, 0.18);

  /* z-index */
  --z-sticky: 100;
  --z-modal: 1000;
  --z-toast: 1100;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e131d;
    --surface: #171e2b;
    --surface-2: #1d2534;
    --surface-3: #242e40;
    --border: #2a3448;
    --border-strong: #39455c;
    --text: #e7ecf5;
    --text-2: #b7c1d1;
    --muted: #8593a8;

    --primary: #4f7df1;
    --primary-strong: #6b93f4;
    --primary-soft: #1e2c4e;
    --primary-soft-2: #2a4173;
    --navy: #dbe4f7;

    --danger: #f87171;   --danger-soft: #3a1d20;
    --success: #4ade80;  --success-soft: #15321f;
    --warning: #fbbf24;  --warning-soft: #372a10;

    --gold: #f5c84c;
    --gold-soft: #3a2f10;

    --bubble-in: #1d2534;
    --bubble-in-border: #2a3448;
    --bubble-out: #223c6c;
    --bubble-out-border: #2f5093;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-2: 0 4px 14px rgba(0, 0, 0, 0.45);
    --shadow-3: 0 12px 36px rgba(0, 0, 0, 0.6);

    color-scheme: dark;
  }
}

/* ---------- 2. Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}
#app { min-height: 100dvh; }
img, svg, video { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0 0 var(--sp-2); line-height: 1.25; color: var(--text); }
h1 { font-size: var(--fs-2xl); font-weight: 800; }
h2 { font-size: var(--fs-xl);  font-weight: 700; }
h3 { font-size: var(--fs-lg);  font-weight: 700; }
p  { margin: 0 0 var(--sp-3); }
a  { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--primary-soft-2); }

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
*::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- 3. Layout utilities ---------- */
.row    { display: flex; align-items: center; gap: var(--sp-2); }
.stack  { display: flex; flex-direction: column; gap: var(--sp-2); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.grow   { flex: 1 1 auto; min-width: 0; }
.muted  { color: var(--muted); }
.small  { font-size: var(--fs-sm); }
.center { text-align: center; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hidden { display: none !important; }

/* ---------- 4. Buttons ---------- */
.btn {
  appearance: none; -webkit-appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--r-full);
  font-size: var(--fs-md); font-weight: 600; line-height: 1.2;
  padding: 9px 18px; cursor: pointer; user-select: none; text-decoration: none;
  color: var(--text); background: var(--surface-3);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-strong); }
.btn-outline { background: var(--surface); border-color: var(--primary); color: var(--primary); }
.btn-outline:hover:not(:disabled) { background: var(--primary-soft); }
.btn-soft    { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover:not(:disabled) { background: var(--primary-soft-2); }
.btn-ghost   { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.92); }

.btn-sm    { padding: 5px 12px; font-size: var(--fs-sm); }
.btn-lg    { padding: 12px 22px; font-size: var(--fs-lg); }
.btn-block { display: flex; width: 100%; }
.btn-icon  { padding: 0; width: 38px; height: 38px; border-radius: 50%; flex: none; }
.btn-icon.btn-sm { width: 30px; height: 30px; }

/* ---------- 5. Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-4); }
.label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.hint  { font-size: var(--fs-xs); color: var(--muted); }
.error-text { font-size: var(--fs-sm); color: var(--danger); }
.error-text:empty { display: none; }

.input, .select, .textarea {
  width: 100%; font-size: var(--fs-md); color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); padding: 10px 13px; min-height: 42px;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { resize: vertical; min-height: 84px; }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft-2);
}
.input-invalid, .input-invalid:focus {
  border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft);
}

.input-group { display: flex; align-items: stretch; }
.input-group .input-prefix {
  display: flex; align-items: center; padding: 0 13px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-right: none;
  border-radius: var(--r-md) 0 0 var(--r-md); font-weight: 600; color: var(--text-2);
  white-space: nowrap;
}
.input-group .input { border-radius: 0 var(--r-md) var(--r-md) 0; }

/* search input with icon slot */
.search-box { position: relative; }
.search-box .input { padding-left: 36px; border-radius: var(--r-full); }
.search-box .search-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; font-size: 14px;
}

/* ---------- 6. Cards, lists, dividers ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
}
.card-pad { padding: var(--sp-5); }
.divider { height: 1px; background: var(--border); border: none; margin: var(--sp-3) 0; }

.list-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); cursor: pointer;
  transition: background .12s;
}
.list-item:hover { background: var(--surface-2); }
.list-item.active { background: var(--primary-soft); }
.list-item + .list-item { border-top: 1px solid var(--border); }

/* unread count badge */
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-full);
  background: var(--primary); color: #fff; font-size: var(--fs-xs); font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.badge-dot { min-width: 10px; width: 10px; height: 10px; padding: 0; }

/* ---------- 7. Chips, tags, avatars ---------- */
/* square lettered category chip (H / C / G / MC) */
.chip-cat {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; padding: 0 5px; border-radius: var(--r-sm);
  font-size: 12px; font-weight: 800; letter-spacing: .02em; color: #fff; flex: none;
}
.chip-cat-h  { background: var(--cat-h); }
.chip-cat-c  { background: var(--cat-c); }
.chip-cat-g  { background: var(--cat-g); }
.chip-cat-mc { background: var(--cat-mc); }
.chip-cat-unknown { background: var(--muted); }
.chip-cat-lg { min-width: 44px; height: 44px; border-radius: var(--r-md); font-size: 16px; }

/* filter pills (All / Unread / Favorites / …) */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px;
  border-radius: var(--r-full); border: 1px solid var(--border-strong);
  background: var(--surface); font-size: var(--fs-sm); font-weight: 600;
  color: var(--text-2); cursor: pointer; user-select: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.pill:hover { border-color: var(--primary); color: var(--primary); }
.pill-active, .pill[aria-pressed="true"] {
  background: var(--primary); border-color: var(--primary); color: #fff;
}

/* status tags */
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
  border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: .01em; white-space: nowrap;
}
.tag-green { background: var(--success-soft); color: var(--success); }
.tag-amber { background: var(--warning-soft); color: var(--warning); }
.tag-blue  { background: var(--primary-soft); color: var(--primary); }
.tag-red   { background: var(--danger-soft); color: var(--danger); }
.tag-gray  { background: var(--surface-3); color: var(--muted); }
.tag-vip   { background: var(--gold-soft); color: var(--gold); }

/* product availability pills (dot + label) */
.avail {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: 700;
  white-space: nowrap;
}
.avail-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.avail-in      { background: var(--success-soft); color: var(--success); }
.avail-low     { background: var(--warning-soft); color: var(--warning); }
.avail-out     { background: var(--danger-soft);  color: var(--danger); }
.avail-unknown { background: var(--surface-3);    color: var(--muted); }

/* avatars */
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none; position: relative;
  background: var(--surface-3); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; user-select: none;
}
.avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-xl { width: 84px; height: 84px; font-size: 30px; }
.avatar-dot {
  position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--success); border: 2px solid var(--surface);
}

/* ---------- 8. Chat ---------- */
.msg-row { display: flex; align-items: flex-end; gap: 8px; padding: 2px 14px; }
.msg-row.out { flex-direction: row-reverse; }
.msg-col { display: flex; flex-direction: column; gap: 2px; max-width: min(72%, 520px); min-width: 0; }
.msg-row.out .msg-col { align-items: flex-end; }
.msg-sender { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); margin: 6px 4px 0; }

.bubble {
  position: relative; padding: 9px 13px; border-radius: var(--r-lg);
  font-size: var(--fs-md); line-height: 1.45;
  overflow-wrap: break-word; word-break: break-word; white-space: pre-wrap;
  box-shadow: var(--shadow-1);
}
.bubble-in {
  background: var(--bubble-in); border: 1px solid var(--bubble-in-border);
  border-bottom-left-radius: 6px; color: var(--text);
}
.bubble-out {
  background: var(--bubble-out); border: 1px solid var(--bubble-out-border);
  border-bottom-right-radius: 6px; color: var(--text);
}
.msg-meta {
  display: flex; align-items: center; gap: 4px;
  font-size: var(--fs-xs); color: var(--muted); margin: 1px 4px;
}

/* delivery ticks on own bubbles: ✓ sent · ✓✓ delivered (grey) · ✓✓ read (blue) */
.msg-tick {
  font-size: var(--fs-xs); line-height: 1; letter-spacing: -2px;
  color: var(--muted); cursor: pointer; user-select: none;
}
.msg-tick.read { color: #2563eb; }
.msg-tick:empty { display: none; }

/* "Message info" — who received/read a message */
.receipts-info { display: flex; flex-direction: column; gap: 14px; min-width: 220px; }
.receipt-section { display: flex; flex-direction: column; gap: 4px; }
.receipt-head { font-weight: 700; font-size: var(--fs-sm); display: flex; align-items: center; gap: 6px; }
.receipt-head.read { color: #2563eb; }
.receipt-head.delivered, .receipt-head.sent { color: var(--muted); }
.receipt-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 2px 0; }
.receipt-time { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }

/* centered system / event messages & day dividers */
.msg-system, .day-divider { display: flex; justify-content: center; padding: 10px 14px; }
.msg-system > span, .day-divider > span {
  font-size: var(--fs-xs); font-weight: 500; color: var(--muted);
  background: var(--surface-3); padding: 4px 12px; border-radius: var(--r-full);
  text-align: center; max-width: 82%;
}

/* image bubble */
.bubble-image { padding: 4px; white-space: normal; }
.bubble-image img {
  display: block; width: 100%; max-width: 260px; max-height: 320px;
  border-radius: 12px; object-fit: cover; cursor: zoom-in;
}
.bubble-image .msg-caption { padding: 6px 9px 3px; }

/* file bubble */
.bubble-file { display: flex; align-items: center; gap: 10px; min-width: 200px; white-space: normal; }
.file-icon {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.bubble-out .file-icon { background: rgba(255, 255, 255, .6); }
@media (prefers-color-scheme: dark) { .bubble-out .file-icon { background: rgba(255, 255, 255, .12); } }
.file-name { font-weight: 600; font-size: var(--fs-sm); word-break: break-all; }
.file-size { font-size: var(--fs-xs); color: var(--muted); }

/* voice-note bubble */
.bubble-voice { display: flex; align-items: center; gap: 10px; min-width: 190px; white-space: normal; }
.voice-play {
  width: 34px; height: 34px; border-radius: 50%; border: none; flex: none;
  background: var(--primary); color: #fff; font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.voice-track {
  flex: 1; min-width: 80px; height: 4px; border-radius: 2px;
  background: var(--border-strong); position: relative; overflow: hidden;
}
.voice-track-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: var(--primary); border-radius: 2px; transition: width .2s linear;
}
.voice-duration { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }

/* quoted reply preview inside a bubble */
.bubble-reply {
  border-left: 3px solid var(--primary); background: rgba(36, 86, 214, .07);
  padding: 5px 9px; border-radius: var(--r-sm); margin-bottom: 6px;
  font-size: var(--fs-sm); white-space: normal; cursor: pointer;
}
@media (prefers-color-scheme: dark) { .bubble-reply { background: rgba(112, 150, 240, .12); } }
.bubble-reply-name { font-weight: 700; color: var(--primary); font-size: var(--fs-xs); }
.bubble-reply-text {
  color: var(--text-2); overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* pin marker on a pinned bubble */
.bubble-pin { position: absolute; top: -7px; font-size: 11px; }
.bubble-in  .bubble-pin { right: -4px; }
.bubble-out .bubble-pin { left: -4px; }

/* pinned strip (top of chat) */
.pinned-strip {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  background: var(--primary-soft); border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; user-select: none;
}
.pinned-strip-thumb { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; flex: none; }
.pinned-strip-text { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pinned-strip-count {
  background: var(--primary); color: #fff; border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: 700; padding: 1px 8px; flex: none;
}

/* typing indicator */
.typing-dots { display: inline-flex; gap: 4px; align-items: center; padding: 11px 14px; }
.typing-dots i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--muted);
  animation: typing 1.2s infinite;
}
.typing-dots i:nth-child(2) { animation-delay: .18s; }
.typing-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes typing { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* message composer bar */
.composer {
  display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px;
  background: var(--surface); border-top: 1px solid var(--border);
}
.composer-input {
  flex: 1; min-width: 0; border: 1px solid var(--border-strong);
  background: var(--surface-2); border-radius: var(--r-xl);
  padding: 9px 15px; max-height: 120px; overflow-y: auto; resize: none;
}
.composer-input:focus { outline: none; border-color: var(--primary); }

/* ---------- 9. Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgba(10, 18, 35, .5); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade-in .15s ease;
}
.modal {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-3);
  width: min(440px, 100%); max-height: min(86vh, 720px);
  display: flex; flex-direction: column; animation: pop-in .18s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.modal-title { margin: 0; font-size: var(--fs-lg); font-weight: 700; }
.modal-x { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; }
.modal-x:hover { color: var(--text); }
.modal-body { padding: 14px 20px; overflow-y: auto; color: var(--text-2); font-size: var(--fs-md); line-height: 1.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 4px 20px 18px; flex-wrap: wrap; }
.modal-closing { opacity: 0; transition: opacity .18s; }
@keyframes pop-in { from { transform: scale(.96); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- 10. Toast ---------- */
.toast-wrap {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: var(--z-toast); display: flex; flex-direction: column; align-items: center;
  gap: 8px; pointer-events: none;
}
.toast {
  pointer-events: auto; cursor: pointer;
  background: #1e293b; color: #fff; padding: 10px 18px;
  border-radius: var(--r-full); font-size: var(--fs-sm); font-weight: 500;
  box-shadow: var(--shadow-3); max-width: min(480px, calc(100vw - 40px));
  animation: toast-in .22s ease;
}
.toast-success { background: #15803d; }
.toast-error   { background: #b91c1c; }
.toast-out { opacity: 0; transform: translateY(8px); transition: all .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- 11. Skeletons, spinner, empty state ---------- */
.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: var(--r-sm); }
.skeleton::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  animation: skeleton-shimmer 1.4s infinite;
}
@media (prefers-color-scheme: dark) {
  .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent); }
}
@keyframes skeleton-shimmer { 100% { transform: translateX(100%); } }
.skeleton-text   { height: 12px; margin: 6px 0; }
.skeleton-title  { height: 16px; width: 42%; margin: 8px 0; }
.skeleton-avatar { width: 38px; height: 38px; border-radius: 50%; flex: none; }
.skeleton-thumb  { width: 64px; height: 64px; border-radius: var(--r-md); flex: none; }

.spinner {
  display: inline-block; flex: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: var(--sp-9) var(--sp-5); color: var(--muted); text-align: center;
}
.empty-icon { font-size: 40px; opacity: .85; }
.empty-text { font-size: var(--fs-md); max-width: 300px; }

/* ---------- 12. Auth / login screens ---------- */
.auth-page {
  min-height: 100dvh; display: grid; place-items: center;
  padding: var(--sp-6); gap: var(--sp-4);
  background:
    radial-gradient(1000px 500px at 50% -10%, var(--primary-soft) 0%, transparent 65%),
    var(--bg);
  align-content: center;
}
.auth-card {
  width: min(420px, 100%); padding: var(--sp-7) var(--sp-6);
  border-radius: var(--r-xl); box-shadow: var(--shadow-2);
}
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: var(--sp-6); }
.auth-logo svg { width: 46px; height: 46px; display: block; }
.auth-brand-title {
  font-size: 26px; font-weight: 800; letter-spacing: .14em; color: var(--navy);
}
.auth-brand-sub { font-size: var(--fs-sm); color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.auth-title { font-size: var(--fs-xl); font-weight: 700; text-align: center; margin-bottom: 4px; }
.auth-sub { font-size: var(--fs-md); color: var(--text-2); text-align: center; margin-bottom: var(--sp-5); }
.auth-note { font-size: var(--fs-sm); color: var(--muted); text-align: center; margin: var(--sp-4) 0 0; }
.auth-foot { font-size: var(--fs-sm); color: var(--muted); text-align: center; margin: 0; }
.auth-back { align-self: flex-start; margin-bottom: var(--sp-2); }

.otp-boxes { display: flex; gap: 8px; justify-content: center; margin: var(--sp-4) 0; }
.otp-box {
  width: 46px; height: 54px; text-align: center; font-size: 22px; font-weight: 700;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  transition: border-color .15s, box-shadow .15s;
  padding: 0;
}
.otp-box:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft-2); }
.otp-box:disabled { background: var(--surface-3); opacity: .6; }
@media (max-width: 380px) { .otp-box { width: 40px; height: 48px; font-size: 19px; } }

.dev-code {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
  background: var(--warning-soft); color: var(--warning);
  border: 1px dashed var(--warning); border-radius: var(--r-md);
  font-family: var(--font-mono); font-size: var(--fs-sm);
  padding: 8px 12px; margin-bottom: var(--sp-2); cursor: pointer;
}
.dev-code b { font-size: var(--fs-lg); letter-spacing: .2em; }

.callout {
  border-radius: var(--r-md); padding: 12px 14px; font-size: var(--fs-sm);
  line-height: 1.5; margin: var(--sp-3) 0;
}
.callout-error { background: var(--danger-soft); color: var(--danger); }
.callout-info  { background: var(--primary-soft); color: var(--primary); }
.callout-link  { display: inline-block; margin-top: 6px; font-weight: 700; }

.auth-resend { text-align: center; font-size: var(--fs-sm); color: var(--muted); margin-top: var(--sp-4); }
