/* Dewey's World — shared design system (2026 redesign)
   Used by: 404, auth/*, cloud, credits, qr. The homepage keeps its own inline copy of these tokens. */

:root {
  --bg: #f2f7f5;
  --surface: #ffffff;
  --surface-2: #e7f0ed;
  --surface-3: #f2f7f5;
  --ink: #0f1f1c;
  --ink-2: #3d4d4a;
  --muted: #52635f;
  --faint: #6b7c78;
  --line: #d3e1dd;
  --line-2: #e3ece9;
  --field: #c4d5d0;
  --teal: #0ca68a;
  --teal-ink: #07725f;
  --teal-soft: #e3f4ef;
  --sky: #0ea5e9;
  --sky-ink: #0284c7;
  --sky-soft: #e7eef4;
  --coral: #ef5f3a;
  --amber-ink: #7a4d00;
  --amber-soft: #fff4d6;
  --warn-bg: #fff7e8;
  --warn-line: #f5d9a6;
  --warn-ink: #6b4a12;
  --warn-strong: #3f2a06;
  --warn-dot: #d97706;
  --danger: #c8341f;
  --danger-ink: #b42318;
  --danger-line: #f1c4c4;
  --danger-soft: #fff4f2;
  --ok: #10b981;
  --deep: #16302a;
  --deep-ink: #e6f2ee;
  --deep-muted: #b5c8c3;
  --deep-accent: #6fe3c8;
  --dot: rgba(12, 166, 138, .14);
  --scrim: rgba(9, 19, 15, .55);
  --shadow: 0 1px 0 rgba(15,31,28,.04), 0 18px 40px -18px rgba(15,31,28,.22);
  --shadow-lg: 0 30px 60px -30px rgba(15, 31, 28, .3);

  --display: "Bricolage Grotesque", "IBM Plex Sans Thai", system-ui, sans-serif;
  --body: "IBM Plex Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #09130f; --surface: #101d1a; --surface-2: #162724; --surface-3: #0d1916; --ink: #e5f0ec; --ink-2: #c3d3cf; --muted: #94a8a3; --faint: #7f938e;
    --line: #233833; --line-2: #1c2f2b; --field: #2e4741; --teal: #2bc7a6; --teal-ink: #6fe3c8; --teal-soft: #13352d; --sky: #3bb9f2; --sky-ink: #6cc9f5; --sky-soft: #12293a;
    --coral: #f57a58; --amber-ink: #fcd679; --amber-soft: #2e2509; --warn-bg: #241c0b; --warn-line: #4a3a17; --warn-ink: #e8cf9a; --warn-strong: #fbe7bd; --warn-dot: #f5a524;
    --danger: #e5533b; --danger-ink: #ff8a78; --danger-line: #5a2620; --danger-soft: #2a1512; --ok: #34d399;
    --deep: #0f2420; --dot: rgba(43, 199, 166, .12); --scrim: rgba(0, 0, 0, .65);
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 18px 40px -18px rgba(0,0,0,.6); --shadow-lg: 0 30px 60px -30px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #09130f; --surface: #101d1a; --surface-2: #162724; --surface-3: #0d1916; --ink: #e5f0ec; --ink-2: #c3d3cf; --muted: #94a8a3; --faint: #7f938e;
  --line: #233833; --line-2: #1c2f2b; --field: #2e4741; --teal: #2bc7a6; --teal-ink: #6fe3c8; --teal-soft: #13352d; --sky: #3bb9f2; --sky-ink: #6cc9f5; --sky-soft: #12293a;
  --coral: #f57a58; --amber-ink: #fcd679; --amber-soft: #2e2509; --warn-bg: #241c0b; --warn-line: #4a3a17; --warn-ink: #e8cf9a; --warn-strong: #fbe7bd; --warn-dot: #f5a524;
  --danger: #e5533b; --danger-ink: #ff8a78; --danger-line: #5a2620; --danger-soft: #2a1512; --ok: #34d399;
  --deep: #0f2420; --dot: rgba(43, 199, 166, .12); --scrim: rgba(0, 0, 0, .65);
  --shadow: 0 1px 0 rgba(0,0,0,.3), 0 18px 40px -18px rgba(0,0,0,.6); --shadow-lg: 0 30px 60px -30px rgba(0,0,0,.7);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--teal-ink); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.08; margin: 0; letter-spacing: -.02em; text-wrap: balance; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--teal); outline-offset: 3px; border-radius: 6px; }
svg.i { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mono { font-family: var(--mono); letter-spacing: 0; }
.eyebrow { font-family: var(--mono); font-size: .76rem; text-transform: uppercase; letter-spacing: .12em; color: var(--teal-ink); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .8125rem; color: var(--faint); }
.center { text-align: center; }
.wrap { width: 100%; max-width: 1160px; margin-inline: auto; padding-inline: 16px; }
.dotted { background-image: radial-gradient(var(--dot) 1.3px, transparent 1.5px); background-size: 22px 22px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.spin { animation: dw-spin 1s linear infinite; }
@keyframes dw-spin { to { transform: rotate(360deg); } }

/* ---------- Brand + nav ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; white-space: nowrap; }
.brand img { width: 34px; height: 34px; border-radius: 50%; }
.brand:hover { color: var(--ink); }

.nav {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-2);
}
.nav .wrap { display: flex; align-items: center; gap: 28px; padding-block: 14px; }
.nav-links { display: flex; gap: 22px; margin-left: 4px; }
.nav-links a { text-decoration: none; color: var(--muted); font-weight: 500; font-size: .95rem; padding-block: 4px; }
.nav-links a:hover { color: var(--ink); }
.nav-links a[aria-current="page"] { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--teal); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-plain { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 20px; }
.back-link { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--muted); font-weight: 500; font-size: .95rem; }
.back-link:hover { color: var(--ink); }

.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); display: inline-grid; place-items: center; cursor: pointer; font-size: 19px; padding: 0; flex: none; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.credits-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 999px;
  background: var(--amber-soft); color: var(--amber-ink); text-decoration: none; font-weight: 600; font-size: .875rem; white-space: nowrap;
}
.credits-pill:hover { color: var(--amber-ink); filter: brightness(.97); }
.credits-pill .mono { font-weight: 500; }

.user { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 600; font-size: .9rem; max-width: 220px; min-height: 42px;
}
.user-btn img, .avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar { display: inline-grid; place-items: center; background: linear-gradient(140deg, var(--teal), var(--sky)); color: #fff; font-family: var(--display); font-weight: 700; }
.user-btn .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: 6px; z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); display: grid; gap: 2px;
}
.user-menu a, .user-menu button {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; border: 0; background: none;
  font-size: .92rem; font-weight: 500; color: var(--ink); text-decoration: none; text-align: left; cursor: pointer; width: 100%;
}
.user-menu a:hover, .user-menu button:hover, .user-menu a:focus-visible, .user-menu button:focus-visible { background: var(--surface-2); color: var(--ink); }
.user-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
.user-menu .danger { color: var(--danger-ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; cursor: pointer;
  font-weight: 600; font-size: 1rem; line-height: 1; min-height: 52px; padding: 0 22px; border-radius: 12px; border: 1px solid transparent;
  transition: transform .15s ease, background .15s ease, opacity .15s; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled, .btn[aria-disabled="true"] { cursor: not-allowed; transform: none; }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { color: var(--bg); }
.btn-primary:disabled { background: var(--line); color: var(--faint); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn-teal { background: var(--teal); color: #fff; }
.btn-teal:hover { color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { color: #fff; }
.btn-danger-ghost { background: var(--surface); color: var(--danger-ink); border-color: var(--danger-line); }
.btn-danger-ghost:hover { color: var(--danger-ink); background: var(--danger-soft); }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: .875rem; border-radius: 10px; gap: 8px; }
.btn-md { min-height: 46px; padding: 0 18px; font-size: .94rem; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; color: var(--teal-ink); font-weight: 600; cursor: pointer; padding: 10px; }
.btn-google { background: var(--surface); color: var(--ink); border-color: var(--field); }
.btn-google:hover { background: var(--surface-2); color: var(--ink); }
.btn-google:disabled { background: var(--warn-bg); border: 1px dashed var(--warn-line); color: var(--faint); }
.btn-google:disabled .g-logo { filter: grayscale(1); opacity: .5; }
.g-logo { width: 20px; height: 20px; flex: none; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label, .label { font-size: .875rem; font-weight: 600; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.label-row a { font-size: .875rem; font-weight: 500; }
.input {
  width: 100%; min-height: 50px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--field); background: var(--surface);
  font-size: 1rem; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--faint); opacity: .8; }
.input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 18%, transparent); }
.input.mono { font-size: 1.05rem; letter-spacing: .1em; }
.field.is-invalid .input { border: 1.5px solid var(--danger); background: var(--danger-soft); }
.field.is-valid .input { border-color: var(--teal); }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 54px; }
.input-wrap .in-btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; background: none;
  color: var(--muted); display: grid; place-items: center; cursor: pointer; font-size: 20px; border-radius: 10px;
}
.input-wrap .in-icon { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--teal); font-size: 20px; pointer-events: none; }
.field-error { display: flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 500; color: var(--danger-ink); }
.field-hint { font-size: .8125rem; color: var(--muted); }
.row-input { display: flex; gap: 8px; }
.row-input .input { flex: 1; min-width: 0; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: .875rem; line-height: 1.5; color: var(--ink-2); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--teal); flex: none; }
.divider { display: flex; align-items: center; gap: 14px; font-size: .8125rem; color: var(--faint); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.meter { display: flex; align-items: center; gap: 10px; }
.meter-bars { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.meter-bars span { height: 5px; border-radius: 3px; background: var(--line); transition: background .2s; }
.meter[data-level="1"] .meter-bars span:nth-child(-n+1) { background: var(--danger); }
.meter[data-level="2"] .meter-bars span:nth-child(-n+2) { background: var(--warn-dot); }
.meter[data-level="3"] .meter-bars span:nth-child(-n+3) { background: var(--teal); }
.meter[data-level="4"] .meter-bars span { background: var(--teal); }
.meter-label { font-size: .8125rem; font-weight: 600; color: var(--muted); min-width: 52px; text-align: right; }

.rules { margin: 0; padding: 14px 16px; list-style: none; display: grid; gap: 8px; font-size: .875rem; border-radius: 12px; background: var(--surface-3); }
.rules li { display: flex; align-items: center; gap: 10px; color: var(--faint); }
.rules li.ok { color: var(--teal-ink); }
.rules li .i { font-size: 17px; }

/* switch (button role=switch) */
.switch { width: 52px; height: 30px; border-radius: 999px; border: 0; background: var(--line); padding: 3px; display: flex; justify-content: flex-start; cursor: pointer; flex: none; transition: background .2s; }
.switch::after { content: ""; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch[aria-checked="true"] { background: var(--teal); justify-content: flex-end; }

/* segmented control */
.segment { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.segment button { min-height: 42px; padding: 0 18px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: .94rem; cursor: pointer; }
.segment button[aria-selected="true"], .segment button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: .875rem; cursor: pointer; }
.chip-btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; }
.card-pad { padding: 24px; }
.card-lift { box-shadow: var(--shadow); }
.card h2 { font-size: 1.25rem; font-weight: 700; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 20px 0 12px; }
.list-card { padding: 4px 24px 12px; }
.row { display: grid; grid-template-columns: 180px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line-2); }
.row > :first-child { font-size: .875rem; color: var(--muted); }
.row .val { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.deep { background: var(--deep); color: var(--deep-ink); }
.deep h1, .deep h2, .deep h3 { color: #fff; }

.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; font-size: .875rem; line-height: 1.5; }
.callout > .i { font-size: 19px; margin-top: 1px; }
.callout.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); }
.callout.warn strong { color: var(--warn-strong); }
.callout.warn > .i { color: var(--warn-dot); }
.callout.info { background: var(--surface-2); color: var(--ink-2); }
.callout.info > .i { color: var(--teal-ink); }
.callout.ok { background: var(--teal-soft); color: var(--teal-ink); font-weight: 500; }
.callout.danger { background: var(--danger-soft); border: 1px solid var(--danger-line); color: var(--danger-ink); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.teal { background: var(--teal-soft); color: var(--teal-ink); }
.badge.warn { background: var(--amber-soft); color: var(--amber-ink); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent); flex: none; }
.status-dot.warn { background: var(--warn-dot); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn-dot) 22%, transparent); }

.status-icon { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, color-mix(in srgb, var(--teal) 22%, transparent) 0%, var(--teal-soft) 70%); }
.status-icon > span { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: var(--teal); color: #fff; font-size: 34px; box-shadow: 0 14px 28px -14px color-mix(in srgb, var(--teal) 80%, transparent); }
.status-icon.info { background: radial-gradient(circle, color-mix(in srgb, var(--sky) 22%, transparent) 0%, var(--sky-soft) 70%); }
.status-icon.info > span { background: var(--sky-ink); }
.status-icon.danger { background: radial-gradient(circle, color-mix(in srgb, var(--danger) 22%, transparent) 0%, var(--danger-soft) 70%); }
.status-icon.danger > span { background: var(--danger); }
.status-icon.neutral { background: var(--surface-2); }
.status-icon.neutral > span { background: transparent; color: var(--teal-ink); box-shadow: none; font-size: 54px; }

/* app icon tiles */
.ai { display: inline-grid; place-items: center; color: #fff; border-radius: 16px; width: 54px; height: 54px; font-size: 24px; flex: none; box-shadow: 0 10px 22px -12px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.25); }
.ai-cloud { background: linear-gradient(150deg, #38bdf8, #0284c7); }
.ai-qr { background: linear-gradient(150deg, #3b524d, #14211e); }
.ai-credits { background: linear-gradient(150deg, #fbbf24, #e08a00); }
.ai-drop { background: linear-gradient(150deg, #2dd4b0, #078a72); }
.ai-study { background: linear-gradient(150deg, #ff8a5c, #e2482a); }
.ai-heart { background: linear-gradient(150deg, #f6739a, #d23358); }

.page-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.page-head .ai { width: 64px; height: 64px; border-radius: 19px; font-size: 30px; }
.page-head h1 { font-size: clamp(2rem, 4vw, 2.5rem); font-weight: 800; line-height: 1; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-head .grow { flex: 1; min-width: 220px; }

/* ---------- Auth layouts ---------- */
.auth-split { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; padding: 20px; }
.auth-aside {
  border-radius: 28px; padding: 48px 56px; display: flex; flex-direction: column; gap: 28px;
  background: radial-gradient(rgba(111, 227, 200, .16) 1.3px, transparent 1.5px) 0 0 / 20px 20px, var(--deep); color: var(--deep-ink);
}
.auth-aside .brand { color: #fff; }
.auth-aside h2 { font-size: clamp(2.4rem, 4vw, 3.4rem); font-weight: 800; line-height: 1.02; letter-spacing: -.03em; color: #fff; }
.auth-aside p { color: var(--deep-muted); font-size: 1.06rem; max-width: 30em; }
.auth-aside .eyebrow { color: var(--deep-accent); }
.aside-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); }
.aside-item .ai { width: 40px; height: 40px; border-radius: 12px; font-size: 20px; }
.aside-item strong { color: #fff; display: block; font-size: .95rem; }
.aside-item span { color: var(--deep-muted); font-size: .875rem; }
.aside-step { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); font-size: .95rem; }
.aside-step b { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 600 .8rem var(--mono); background: rgba(255,255,255,.14); color: #fff; flex: none; }
.aside-step:first-child b { background: var(--deep-accent); color: #0f1f1c; }
.auth-main { display: flex; flex-direction: column; padding: 28px 40px; min-width: 0; }
.auth-form { margin: auto; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 18px; padding-block: 32px; }
.auth-form h1 { font-size: 2.5rem; font-weight: 800; }
.auth-sub { color: var(--muted); }
.desk-head { display: flex; flex-direction: column; gap: 6px; }
.auth-mobile-head { display: none; }
.legal { text-align: center; font-size: .8125rem; color: var(--faint); }

.center-page { min-height: 100vh; display: flex; flex-direction: column; }
.center-page main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 0 16px 48px; }
.panel { width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: 40px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 20px; }
.panel h1 { font-size: 2.25rem; font-weight: 800; }
.panel .lede { color: var(--muted); }
.panel.state { align-items: center; text-align: center; }
.panel-actions { display: grid; gap: 10px; width: 100%; }
.panel-actions.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.key-tile { width: 60px; height: 60px; border-radius: 18px; background: var(--teal-soft); color: var(--teal-ink); display: grid; place-items: center; font-size: 28px; }

/* ---------- Overlays ---------- */
.dw-alert { position: fixed; inset: 0; z-index: 200; background: var(--scrim); display: none; align-items: center; justify-content: center; padding: 16px; }
.dw-alert .box { position: relative; width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: var(--shadow-lg); }
.dw-alert h3 { font-size: 1.3rem; padding-right: 40px; }
.dw-alert p { color: var(--muted); margin-top: 10px; white-space: pre-line; }
.dw-alert .icon-btn { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; font-size: 16px; }

.dw-modal { position: fixed; inset: 0; z-index: 190; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dw-modal .box { position: relative; width: min(420px, 100%); background: var(--surface); border-radius: 22px; padding: 28px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.dw-modal .icon-btn { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; font-size: 16px; }

.dw-cookie {
  position: fixed; z-index: 90; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  max-width: 560px; margin-inline: auto; display: flex; align-items: center; gap: 16px;
  padding: 14px 14px 14px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: .9rem;
}
.dw-cookie p { flex: 1; min-width: 0; color: var(--muted); }
.dw-cookie b { color: var(--ink); }

.dw-toasts { position: fixed; z-index: 300; top: calc(16px + env(safe-area-inset-top, 0px)); right: 16px; left: 16px; display: grid; justify-items: end; gap: 8px; pointer-events: none; }
.dw-toast { pointer-events: auto; max-width: min(380px, 100%); padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: .92rem; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: flex-start; animation: dw-toast-in .25s ease; }
.dw-toast .i { font-size: 18px; margin-top: 2px; }
.dw-toast.ok .i { color: var(--teal); }
.dw-toast.error { background: var(--danger); color: #fff; }
.dw-toast.warn .i { color: var(--warn-dot); }
.dw-toast b { display: block; }
@keyframes dw-toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* SweetAlert2 restyle so its dialogs match */
.swal2-popup { border-radius: 22px !important; background: var(--surface) !important; color: var(--ink) !important; font-family: var(--body) !important; padding: 28px !important; }
.swal2-title { font-family: var(--display) !important; color: var(--ink) !important; font-weight: 800 !important; letter-spacing: -.02em; }
.swal2-html-container, .swal2-input-label { color: var(--muted) !important; }
.swal2-input { border-radius: 12px !important; border: 1px solid var(--field) !important; background: var(--surface) !important; color: var(--ink) !important; box-shadow: none !important; font-size: 1rem !important; height: 50px !important; }
.swal2-input:focus { border-color: var(--teal) !important; }
.swal2-actions { gap: 8px; }
.swal2-styled { border-radius: 12px !important; font-weight: 600 !important; min-height: 48px; padding: 0 20px !important; }
.swal2-styled.swal2-confirm { background: var(--ink) !important; color: var(--bg) !important; }
.swal2-styled.swal2-cancel { background: var(--surface-2) !important; color: var(--ink) !important; }
.swal2-styled.swal2-deny { background: var(--danger) !important; }
.swal2-validation-message { background: var(--danger-soft) !important; color: var(--danger-ink) !important; }

/* ad slot */
.ad-slot { border-radius: 18px; border: 1px dashed var(--field); padding: 12px; min-height: 100px; display: grid; gap: 6px; }
.ad-slot > span { font-family: var(--mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }

/* ---------- Footer ---------- */
.site-foot { border-top: 1px solid var(--line); margin-top: 48px; }
.site-foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; padding-block: 28px 36px; font-size: .875rem; color: var(--muted); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 18px; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--ink); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .nav-links { display: none; }
  .auth-split { grid-template-columns: 1fr; padding: 0; gap: 0; }
  .auth-aside { display: none; }
  .auth-mobile-head {
    display: flex; flex-direction: column; gap: 22px; padding: 16px 20px 30px; border-radius: 0 0 26px 26px;
    background: radial-gradient(rgba(111, 227, 200, .16) 1.3px, transparent 1.5px) 0 0 / 18px 18px, var(--deep); color: var(--deep-ink);
  }
  .auth-mobile-head .top { display: flex; align-items: center; justify-content: space-between; }
  .auth-mobile-head .brand { color: #fff; font-size: 1.05rem; }
  .auth-mobile-head .icon-btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); color: #fff; }
  .auth-mobile-head h1 { font-size: 2.1rem; font-weight: 800; color: #fff; }
  .auth-mobile-head p { color: var(--deep-muted); font-size: .95rem; margin-top: 6px; }
  .auth-main { padding: 0 20px 24px; }
  .auth-main > .back-link { display: none; }
  .auth-form { margin: 0 auto; padding-top: 24px; }
  .auth-form .desk-head { display: none; }
}
@media (max-width: 600px) {
  .panel { padding: 24px 20px; border-radius: 22px; }
  .panel h1 { font-size: 1.9rem; }
  .row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .row > :first-child { grid-column: 1 / -1; }
  .card-pad { padding: 18px; }
  .list-card { padding: 4px 18px 10px; }
  .dw-cookie { flex-direction: column; align-items: stretch; }
  .nav .wrap { gap: 10px; }
  .brand-text-hide { display: none; }
  .user-btn .name { display: none; }
  .user-btn { padding: 4px; }
  .panel-actions.two { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
