/* ---------- Tokens ---------- */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f3f4f7;
  --surface-3: #e9ebf0;
  --border: #e6e8ee;
  --border-strong: #d5d8e0;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0ff;
  --accent-text: #4338ca;
  --accent-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --ok: #059669;   --ok-soft: #e6f6ef;
  --info: #2563eb; --info-soft: #e8effd;
  --warn: #b45309; --warn-soft: #fdf2e1;
  --err: #dc2626;  --err-soft: #fdeaea;
  --toner-k: #1f2937; --toner-c: #06b6d4; --toner-m: #d946ef; --toner-y: #eab308;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .16);
  --radius: 16px;
  --radius-sm: 10px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e13;
    --surface: #14171e;
    --surface-2: #1b1f28;
    --surface-3: #262b37;
    --border: #232835;
    --border-strong: #323949;
    --text: #eef0f4;
    --text-2: #c9cdd6;
    --muted: #8a92a3;
    --accent: #6366f1;
    --accent-hover: #7577f5;
    --accent-soft: rgba(99, 102, 241, .16);
    --accent-text: #a5b4fc;
    --ok: #34d399;   --ok-soft: rgba(52, 211, 153, .12);
    --info: #60a5fa; --info-soft: rgba(96, 165, 250, .13);
    --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .12);
    --err: #f87171;  --err-soft: rgba(248, 113, 113, .13);
    --toner-k: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
svg { display: block; width: 100%; height: 100%; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13.5px; letter-spacing: -.01em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; }

[data-icon] { display: inline-flex; flex: none; width: 18px; height: 18px; }

/* ---------- Boot ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  animation: spin .7s linear infinite;
}
.boot .spinner { color: var(--accent); width: 28px; height: 28px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  font-weight: 500; font-size: 14px; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, opacity .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn [data-icon] { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.lg { height: 46px; padding: 0 24px; border-radius: 12px; font-size: 15px; }
.btn.block { width: 100%; height: 44px; }
.btn.danger { color: var(--err); }
.btn.danger:hover { background: var(--err-soft); border-color: transparent; }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.loading > :not(.spinner) { opacity: 0; }
.btn.loading { position: relative; }
.btn.loading .spinner { position: absolute; width: 18px; height: 18px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 7px;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--err-soft); color: var(--err); }

.input {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input:disabled { background: var(--surface-2); color: var(--muted); }
select.input { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px;
  background-size: 5px 5px; background-repeat: no-repeat; }

.label { font-size: 13.5px; color: var(--muted); }
.hint { font-size: 12.5px; color: var(--muted); }
.form-error { color: var(--err); font-size: 13.5px; }

/* Segmented control */
.segmented {
  display: inline-flex; padding: 3px; gap: 2px; max-width: 100%;
  border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border);
}
.segmented label { position: relative; flex: 1 1 auto; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block; padding: 6px 14px; border-radius: 8px; text-align: center;
  font-size: 13.5px; color: var(--muted); white-space: nowrap; cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.segmented span:hover { color: var(--text); }
.segmented input:checked + span { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.segmented input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.segmented input:disabled + span { opacity: .4; cursor: not-allowed; }

/* Stepper */
.stepper {
  display: inline-flex; align-items: stretch; height: 38px; width: max-content;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface);
}
.stepper button { width: 38px; border: 0; background: transparent; font-size: 18px; color: var(--muted); }
.stepper button:hover { background: var(--surface-2); color: var(--text); }
.stepper input {
  width: 52px; border: 0; border-inline: 1px solid var(--border); text-align: center;
  background: transparent; outline: none; font-variant-numeric: tabular-nums; -moz-appearance: textfield;
}
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  position: relative; width: 38px; height: 22px; flex: none; border-radius: 999px;
  background: var(--surface-3); transition: background .2s;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .2s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; }

/* Chips & pills */
.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-2); white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.pill.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.pill.info .dot { background: var(--info); animation: pulse 1.4s ease-in-out infinite; }
.pill.warn .dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.pill.err .dot { background: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--info-soft); } 50% { box-shadow: 0 0 0 5px var(--info-soft); } }

.chip {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted);
}
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.err { background: var(--err-soft); color: var(--err); }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(700px 400px at 15% 0%, color-mix(in srgb, #6366f1 14%, transparent), transparent 70%),
    radial-gradient(600px 400px at 100% 100%, color-mix(in srgb, #8b5cf6 12%, transparent), transparent 70%),
    var(--bg);
}
.login-card {
  width: min(380px, 100%); display: grid; gap: 14px; justify-items: center; text-align: center;
  padding: 36px 28px 28px; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.login-card h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin-top: 4px; }
.login-card > p.muted { margin-top: -8px; margin-bottom: 6px; }
.login-card .input { height: 44px; text-align: center; }
.fineprint { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.fineprint [data-icon] { width: 13px; height: 13px; }

/* ---------- Top bar ---------- */
.brand-mark {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 8px; border-radius: 10px;
  background: var(--accent-grad); color: #fff; box-shadow: 0 4px 12px rgba(99, 102, 241, .3);
}
.brand-mark.lg { width: 56px; height: 56px; padding: 14px; border-radius: 16px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; height: 60px; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-text { display: grid; line-height: 1.2; }
.brand-text strong { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.brand-text small { font-size: 12px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.user-menu { position: relative; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 4px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
}
.user-chip:hover { background: var(--surface-2); }
.avatar {
  display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 700;
}
.user-name { font-size: 14px; font-weight: 500; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.popover {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: 6px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  animation: pop .14s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.pop-head { display: grid; gap: 2px; padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.pop-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px;
  border: 0; border-radius: 9px; background: transparent; font-size: 14px; text-align: left;
}
.pop-item:hover { background: var(--surface-2); }
.pop-item [data-icon] { width: 16px; height: 16px; color: var(--muted); }

/* ---------- Layout ---------- */
.container { max-width: 1120px; margin: 0 auto; padding: 24px 20px 48px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.col-main, .col-side { display: grid; gap: 20px; min-width: 0; }
.col-side { position: sticky; top: 84px; }

.tabs {
  display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 20px;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border);
}
.tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 16px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font-size: 14px; font-weight: 500;
}
.tab [data-icon] { width: 16px; height: 16px; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm); min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head .card-title { margin: 0; }
.card-title { font-size: 15px; font-weight: 650; letter-spacing: -.005em; margin-bottom: 16px; }
.card-sub { margin: -10px 0 16px; }

/* ---------- Upload ---------- */
.dropzone {
  display: grid; justify-items: center; gap: 6px; padding: 34px 20px; text-align: center;
  border: 1.5px dashed var(--border-strong); border-radius: 14px; background: var(--surface-2);
  cursor: pointer; transition: border-color .15s, background .15s, transform .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.drag { transform: scale(1.01); }
.dropzone strong { font-size: 15px; font-weight: 600; }
.dropzone em { font-style: normal; color: var(--accent-text); }
.dz-icon {
  width: 48px; height: 48px; padding: 12px; margin-bottom: 6px; border-radius: 14px;
  background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
}

.file-list { display: grid; gap: 8px; }
.file-list:not(:empty) { margin-top: 14px; }
.file-item {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 10px 8px 10px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  animation: rise .2s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
.file-item.error { border-color: color-mix(in srgb, var(--err) 35%, var(--border)); }
.thumb {
  position: relative; width: 44px; height: 58px; border-radius: 6px; overflow: hidden;
  display: grid; place-items: center; background: var(--surface-2); color: var(--muted);
  box-shadow: 0 0 0 1px var(--border), var(--shadow-sm);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.thumb [data-icon] { width: 20px; height: 20px; }
.file-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 12.5px; color: var(--muted); margin-top: 1px; display: flex; align-items: center; gap: 6px; }
.file-meta.err { color: var(--err); }
.file-meta [data-icon] { width: 14px; height: 14px; }
.file-meta .ok-mark { color: var(--ok); }
.bar { height: 4px; margin-top: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .2s; }
.bar.indeterminate > i { width: 35%; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* ---------- Settings ---------- */
.settings { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 16px 14px; }
.settings .control { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.settings .control .input { max-width: 260px; }

/* ---------- Submit bar ---------- */
.submit-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 14px 14px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.summary { display: grid; gap: 1px; min-width: 0; }
.summary strong { font-size: 15.5px; font-weight: 650; }
.summary .err { color: var(--err); }

/* ---------- Printer ---------- */
.printer-hero { display: flex; align-items: center; gap: 14px; }
.printer-illus {
  width: 48px; height: 48px; padding: 12px; border-radius: 13px;
  background: var(--surface-2); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border);
}
.printer-state { font-size: 17px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.printer-state .dot { width: 9px; height: 9px; }
.printer-state.ok .dot { background: var(--ok); }
.printer-state.info .dot { background: var(--info); }
.printer-state.warn .dot { background: var(--warn); }
.printer-state.err .dot { background: var(--err); }
.toner { display: grid; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.toner:empty { display: none; }
.toner-row { display: grid; gap: 6px; }
.toner-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); }
.toner-label b { font-weight: 600; font-variant-numeric: tabular-nums; }
.toner-label .low { color: var(--warn); }
.toner .bar { margin: 0; height: 6px; }
.toner-k > i { background: var(--toner-k); }
.toner-c > i { background: var(--toner-c); }
.toner-m > i { background: var(--toner-m); }
.toner-y > i { background: var(--toner-y); }

/* ---------- Jobs ---------- */
.job-list > li { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 0; }
.job-list > li + li { border-top: 1px solid var(--border); }
.job-icon {
  width: 36px; height: 36px; padding: 9px; border-radius: 10px; background: var(--surface-2); color: var(--muted);
}
.job-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-meta { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-side { display: flex; align-items: center; gap: 4px; }
.empty { display: grid; justify-items: center; gap: 8px; padding: 22px 8px; color: var(--muted); font-size: 13.5px; text-align: center; }
.empty [data-icon] { width: 28px; height: 28px; opacity: .55; }
.job-list > li.empty { display: grid; grid-template-columns: none; }

/* ---------- Admin ---------- */
.admin { display: grid; gap: 20px; }
.token-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: end; }
.field { display: grid; gap: 6px; min-width: 0; }
.token-form-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.token-form-row .btn { margin-left: auto; }

.token-list > li { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 0; }
.token-list > li + li { border-top: 1px solid var(--border); }
.token-list > li.dim { opacity: .55; }
.token-list .avatar { width: 36px; height: 36px; font-size: 14px; }
.token-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 600; font-size: 14.5px; }
.token-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 4px 12px; flex-wrap: wrap; margin-top: 2px; }
.token-meta .mono { font-size: 12px; }
.token-actions { display: flex; align-items: center; gap: 4px; }

/* ---------- Dialog ---------- */
.dialog {
  width: min(440px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 20px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgba(10, 12, 18, .45); backdrop-filter: blur(3px); }
.dialog[open] { animation: pop .18s ease-out; }
.dialog form { display: grid; gap: 16px; padding: 24px; }
.dialog-head { display: flex; gap: 14px; align-items: flex-start; }
.dialog-head h2 { font-size: 17px; font-weight: 700; margin-bottom: 2px; }
.dialog-icon { width: 36px; height: 36px; padding: 8px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.qr {
  width: 196px; height: 196px; margin: 4px auto; padding: 10px; border-radius: 14px;
  background: #fff; box-shadow: 0 0 0 1px var(--border);
}
.copy-row { display: flex; gap: 8px; }
.copy-row .input { flex: 1; min-width: 0; }
.dialog-actions { display: flex; justify-content: flex-end; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translateX(-50%);
  display: grid; gap: 8px; justify-items: center; width: max-content; max-width: calc(100vw - 32px); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 12px; border-radius: 12px;
  background: #111827; color: #f9fafb; font-size: 14px; box-shadow: var(--shadow-lg);
  animation: toast-in .2s ease-out; pointer-events: auto;
}
@media (prefers-color-scheme: dark) { .toast { background: #2a2f3c; } }
.toast [data-icon] { width: 18px; height: 18px; }
.toast.success [data-icon] { color: #34d399; }
.toast.error [data-icon] { color: #f87171; }
.toast.info [data-icon] { color: #a5b4fc; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .col-side { position: static; }
  .submit-bar {
    position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 10;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  }
  .toasts { bottom: calc(96px + env(safe-area-inset-bottom)); }
}

@media (max-width: 600px) {
  .container { padding: 16px 16px 32px; }
  .topbar-inner { padding: 0 16px; }
  .brand-text small, .user-name { display: none; }
  .user-chip { padding: 0 4px; }
  .card { padding: 16px; }
  .layout, .col-main, .col-side, .admin { gap: 14px; }
  .dropzone { padding: 26px 16px; }
  .settings { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .settings > .label { margin-top: 10px; }
  .settings > .label:first-child { margin-top: 0; }
  .settings .segmented { display: flex; width: 100%; }
  .settings .segmented span { padding: 7px 6px; }
  .settings .control .input { max-width: none; }
  .settings .control { display: grid; gap: 6px; }
  .submit-bar { padding: 12px 12px 12px 16px; }
  .btn.lg { padding: 0 18px; }
  .token-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .token-form .field.grow { grid-column: 1 / -1; }
  .token-form-row .btn { margin-left: 0; width: 100%; }
  .token-list > li { grid-template-columns: 36px minmax(0, 1fr); }
  .token-actions { grid-column: 2; }
  .tabs { display: flex; }
  .tab { flex: 1; justify-content: center; }
}

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