:root {
  color-scheme: dark;
  --bg:          #08090c;
  --bg-2:        #0c0d12;
  --surface:     rgba(255,255,255,0.025);
  --surface-1:   rgba(255,255,255,0.04);
  --surface-2:   rgba(255,255,255,0.06);
  --surface-3:   rgba(255,255,255,0.09);
  --border:      rgba(255,255,255,0.06);
  --border-1:    rgba(255,255,255,0.10);
  --border-2:    rgba(255,255,255,0.16);
  --text:        #f4f4f6;
  --text-muted:  #a1a1ab;
  --text-faint:  #71717a;
  --accent:      #6c8fff;
  --accent-2:    #8b5cf6;
  --accent-glow: color-mix(in srgb, var(--accent) 24%, transparent);
  --gold:        #fbbf24;
  --gold-2:      #f59e0b;
  --gold-glow:   color-mix(in srgb, var(--gold) 18%, transparent);
  --success:     #34d399;
  --danger:      #f87171;
  --warn:        #fbbf24;
  --r-xs: 6px; --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.18);
  --shadow:    0 4px 16px rgba(0,0,0,.28), 0 1px 2px rgba(0,0,0,.18);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.36);
  --shadow-xl: 0 20px 48px rgba(0,0,0,.44);
  --d-fast: 120ms; --d: 180ms; --d-slow: 320ms;
  --ease: cubic-bezier(.2,0,0,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --sidebar-w: 240px;
  --topbar-h:  64px;
  --content-max: 1100px;
  --font:      'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 400 14px/1.55 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: -1;
  background:
    radial-gradient(800px 400px at 80% -10%, rgba(108,143,255,.08), transparent 70%),
    radial-gradient(600px 300px at -10% 80%, rgba(139,92,246,.06), transparent 70%);
}
h1,h2,h3,h4 { margin: 0; font-weight: 650; letter-spacing: -0.018em; line-height: 1.25; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
h4 { font-size: 0.9375rem; }
p  { margin: 0; color: var(--text-muted); }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: color-mix(in srgb, var(--accent) 36%, transparent); color: var(--text); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--surface-3); }

.app { min-height: 100vh; }
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: block;
}

.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: linear-gradient(180deg, rgba(255,255,255,0.022), rgba(255,255,255,0.005));
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 50;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: conic-gradient(from 220deg at 50% 50%, var(--accent), var(--accent-2), var(--accent));
  display: grid; place-items: center;
  font-weight: 800; font-size: 13px; color: white;
  box-shadow: 0 0 0 1px var(--border-2) inset, 0 6px 16px var(--accent-glow);
}
.brand-text strong { font-size: 13.5px; font-weight: 700; letter-spacing: -0.01em; display: block; line-height: 1.1; }
.brand-text small { font-size: 11px; color: var(--text-faint); font-weight: 500; }

.nav { padding: 10px 10px; flex: 1; overflow-y: auto; }
.nav-section { margin-bottom: 14px; }
.nav-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em;
  color: var(--text-faint); text-transform: uppercase;
  padding: 6px 10px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  margin: 1px 0;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-weight: 500; font-size: 13px;
  transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease);
  position: relative;
}
.nav-link svg { width: 16px; height: 16px; flex: 0 0 16px; opacity: .8; }
.nav-link:hover { background: var(--surface-1); color: var(--text); }
.nav-link.is-active {
  color: var(--text);
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
  box-shadow: 0 0 0 1px var(--border-1) inset;
}
.nav-link.is-active::before {
  content: '';
  position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 12px var(--accent-glow);
}
.sidebar-footer { padding: 10px; border-top: 1px solid var(--border); }
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: var(--r-sm);
  background: var(--surface-1);
  border: 1px solid var(--border);
}
.user-card:hover { background: var(--surface-2); }
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  font-weight: 700; color: white;
  font-size: 12px;
  flex: 0 0 30px;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.user-meta strong { font-size: 12.5px; font-weight: 600; }
.user-meta small {
  font-size: 11px; color: var(--text-faint);
  font-family: var(--font-mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.welcome-block { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 0 1 auto; overflow: hidden; }
.welcome-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.welcome-text strong { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.welcome-text small {
  font-size: 11.5px; color: var(--text-faint);
  font-family: var(--font-mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-spacer { flex: 1 1 auto; min-width: 0; }

.membership-pill {
  display: flex; flex-direction: column;
  padding: 6px 12px;
  background: color-mix(in srgb, var(--gold) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--gold) 24%, transparent);
  border-radius: var(--r-sm);
  line-height: 1.15;
  cursor: default;
}
.membership-pill .lbl { font-size: 10px; color: var(--gold); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.membership-pill .val { font-size: 12.5px; font-weight: 600; color: var(--gold); }

.membership-pill.is-normal {
  background: color-mix(in srgb, var(--text-faint) 8%, transparent);
  border-color: color-mix(in srgb, var(--text-faint) 24%, transparent);
}
.membership-pill.is-normal .lbl,
.membership-pill.is-normal .val { color: var(--text-muted); }

.shards-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 14%, transparent), color-mix(in srgb, var(--gold) 6%, transparent));
  border: 1px solid color-mix(in srgb, var(--gold) 28%, transparent);
  color: var(--gold);
  font-weight: 600; font-size: 13px;
  box-shadow: 0 0 24px var(--gold-glow);
  cursor: pointer;
  transition: filter var(--d-fast) var(--ease), transform var(--d-fast) var(--ease);
}
.shards-pill:hover { filter: brightness(1.08); transform: translateY(-1px); }
.shards-pill .shard-icon {
  width: 16px; height: 16px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.2));
}
.shards-pill .num { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

.icon-btn {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--text-muted);
  background: var(--surface-1);
  border: 1px solid var(--border);
  transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 15px; height: 15px; }

.content {
  padding: 24px;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}
.panel { display: none; }
.panel.is-active { display: block; animation: panelIn 240ms var(--ease) both; }
@keyframes panelIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 14px;
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.card-head h3 { flex: 1 1 auto; font-size: 14.5px; min-width: 120px; }
.card-head .head-actions { display: flex; gap: 8px; flex-wrap: wrap; max-width: 100%; }
.card-body { padding: 18px; }
@media (max-width: 480px) {
  .card { margin-bottom: 12px; border-radius: 12px; }
  .card-head { padding: 12px 14px; }
  .card-body { padding: 14px; }
}
.card-foot {
  display: flex; gap: 8px; align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}
.card-foot > * { min-width: 0; }
.card-foot .end { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 480px) {
  .card-foot { padding: 10px 14px; }
  .card-foot .end { margin-left: 0; width: 100%; justify-content: stretch; }
  .card-foot .end .btn { flex: 1 1 auto; }
}

.section-h {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--text-faint); text-transform: uppercase;
  margin: 18px 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.section-h:first-child { margin-top: 0; }
.section-h::after {
  content: ''; flex: 1; height: 1px;
  background: var(--border);
}

.subtabs {
  display: flex; gap: 4px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 3px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex-wrap: nowrap;
}
.subtabs::-webkit-scrollbar { display: none; }
.subtab { flex: 0 0 auto; }
.subtab {
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12.5px; font-weight: 500;
  transition: all var(--d-fast) var(--ease);
  cursor: pointer;
}
.subtab:hover { color: var(--text); }
.subtab.is-active {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.subpanel { display: none; }
.subpanel.is-active { display: block; animation: panelIn 220ms var(--ease) both; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-grid > * { min-width: 0; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1024px) {
  .form-grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .form-grid.cols-3, .form-grid.cols-4, .form-grid.cols-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 480px) {
  .form-grid, .form-grid.cols-3, .form-grid.cols-4, .form-grid.cols-5 {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.field input, .field select, .field textarea {
  padding: 9px 11px;
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  background: var(--bg-2);
  color: var(--text);
  font-size: 13.5px;
  width: 100%;
  transition: border-color var(--d-fast) var(--ease), box-shadow var(--d-fast) var(--ease), background var(--d-fast) var(--ease);
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--border-2); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg);
}
.field input[readonly], .field input:disabled {
  color: var(--text-muted); cursor: default; background: var(--surface);
}
.field textarea { resize: vertical; min-height: 80px; }
.field .hint { font-size: 11.5px; color: var(--text-faint); }

.switch {
  --w: 34px; --h: 20px;
  position: relative;
  width: var(--w); height: var(--h);
  background: var(--surface-2);
  border-radius: 999px;
  border: 1px solid var(--border-1);
  cursor: pointer;
  transition: background var(--d) var(--ease), border-color var(--d) var(--ease);
  flex: 0 0 auto;
}
.switch::after {
  content: '';
  position: absolute;
  left: 1px; top: 0;
  width: calc(var(--h) - 2px); height: calc(var(--h) - 2px);
  background: white;
  border-radius: 50%;
  transition: transform var(--d) var(--ease-spring);
  box-shadow: var(--shadow-sm);
}
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(calc(var(--w) - var(--h))); }

.switch-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}
.switch-row + .switch-row { margin-top: 6px; }
.switch-row .meta { flex: 1; min-width: 0; }
.switch-row .meta strong { font-size: 13px; font-weight: 600; display: block; }
.switch-row .meta small { font-size: 11.5px; color: var(--text-faint); }

.check {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
  font-size: 13px; color: var(--text-muted);
}
.check input { display: none; }
.check .box {
  width: 18px; height: 18px;
  border: 1px solid var(--border-2);
  border-radius: 5px;
  background: var(--surface-1);
  display: grid; place-items: center;
  transition: background var(--d-fast) var(--ease), border-color var(--d-fast) var(--ease);
  flex: 0 0 18px;
}
.check .box svg { width: 12px; height: 12px; opacity: 0; transform: scale(.6); transition: all var(--d-fast) var(--ease-spring); color: white; }
.check input:checked + .box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .box svg { opacity: 1; transform: scale(1); }
.check:hover .box { border-color: var(--accent); }

.locked-overlay {
  position: relative;
  border: 1px dashed var(--border-2);
  border-radius: var(--r);
  padding: 18px;
  background: var(--surface);
  margin-top: 8px;
  text-align: center;
}
.locked-overlay .icon {
  width: 36px; height: 36px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  display: grid; place-items: center;
  margin: 0 auto 8px;
}
.locked-overlay strong { font-size: 13px; display: block; margin-bottom: 4px; }
.locked-overlay p { font-size: 12px; margin-bottom: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
  transition: background var(--d-fast) var(--ease), border-color var(--d-fast) var(--ease), color var(--d-fast) var(--ease), filter var(--d-fast) var(--ease), transform var(--d-fast) var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 14px; height: 14px; }
.btn-primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 96%, white), var(--accent));
  color: white;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 60%, white) inset, 0 8px 16px -8px var(--accent-glow);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-success {
  background: linear-gradient(180deg, color-mix(in srgb, var(--success) 96%, white), var(--success));
  color: #052e1e;
  box-shadow: 0 8px 16px -8px color-mix(in srgb, var(--success) 28%, transparent);
}
.btn-success:hover { filter: brightness(1.06); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border-1); }
.btn-secondary:hover { background: var(--surface-3); border-color: var(--border-2); }
.btn-soft { background: var(--surface-1); color: var(--text-muted); border-color: var(--border); }
.btn-soft:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost { color: var(--text-muted); background: transparent; }
.btn-ghost:hover { background: var(--surface-1); color: var(--text); }
.btn-danger {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 28%, transparent);
}
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 24%, transparent); }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 11px 18px; font-size: 14px; }

.cost-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--gold) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--gold) 24%, transparent);
  color: var(--gold);
  font-size: 11.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.cost-chip .shard-icon {
  width: 12px; height: 12px;
}
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11px; font-weight: 500;
  color: var(--text-muted);
}
.tag.gold { color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); border-color: color-mix(in srgb, var(--gold) 26%, transparent); }
.tag.success { color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); border-color: color-mix(in srgb, var(--success) 26%, transparent); }
.tag.accent { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: color-mix(in srgb, var(--accent) 26%, transparent); }

.table-wrap {
  border-radius: var(--r);
  border: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
.table-wrap::after {
  content: '';
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 24px;
  background: linear-gradient(to right, transparent, color-mix(in srgb, var(--bg) 80%, transparent));
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms;
}
.table-wrap.has-overflow::after { opacity: 1; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 480px; }
.table th {
  text-align: left; font-weight: 600;
  color: var(--text-muted);
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
@media (max-width: 480px) {
  .table th, .table td { padding: 9px 10px; font-size: 12.5px; }
}
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--surface); }
.table .id-cell { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); }

.toolbar-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.toolbar-row > input, .toolbar-row > select {
  padding: 8px 11px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 13px;
}
.toolbar-row > input { flex: 1; min-width: 180px; }

.prime-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.prime-grid > * { min-width: 0; }
@media (max-width: 720px) { .prime-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.prime-slot {
  background: var(--surface);
  border: 1px dashed var(--border-1);
  border-radius: var(--r);
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  text-align: center;
  min-height: 130px;
}
.prime-slot.filled {
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
  border-style: solid;
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.prime-slot h5 {
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--text-faint); text-transform: uppercase;
  margin: 0;
}
.prime-slot-thumb {
  flex: 1;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--surface-3), var(--surface-1));
  display: grid; place-items: center;
  color: var(--text-faint);
  min-height: 56px;
}
.prime-slot.filled .prime-slot-thumb { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 20%, transparent), color-mix(in srgb, var(--accent-2) 20%, transparent)); color: var(--text); }
.prime-slot-name { font-size: 11.5px; font-weight: 500; line-height: 1.3; }
.prime-slot-price { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.prime-slot.filled .prime-slot-price { color: var(--gold); font-weight: 600; }

.toast-root {
  position: fixed;
  right: 14px; left: 14px; bottom: 14px;
  display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 8px;
  z-index: 80;
  pointer-events: none;
}
@media (max-width: 880px) {
  .toast-root { bottom: 80px; align-items: stretch; }
  .toast { min-width: 0; max-width: none; }
}

.unsaved-bar {
  position: fixed;
  right: 14px; bottom: 14px;
  z-index: 75;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  min-width: 260px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-2) 96%, transparent), color-mix(in srgb, var(--bg) 96%, transparent));
  border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--border-1));
  border-radius: var(--r);
  box-shadow: var(--shadow-lg), 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent);
  backdrop-filter: blur(16px) saturate(160%);
  transform: translateY(150%);
  opacity: 0;
  transition: transform 320ms var(--ease-spring), opacity 200ms var(--ease);
  pointer-events: none;
}
.unsaved-bar.is-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.unsaved-bar .pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  position: relative;
  flex: 0 0 8px;
}
.unsaved-bar .pulse::after {
  content: '';
  position: absolute; inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: pulseRing 1.4s var(--ease) infinite;
}
@keyframes pulseRing {
  0%   { transform: scale(.8); opacity: .9; }
  100% { transform: scale(1.6); opacity: 0; }
}
.unsaved-bar .meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; }
.unsaved-bar .meta strong { font-size: 13px; font-weight: 600; color: var(--text); }
.unsaved-bar .meta small { font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.unsaved-bar .actions { display: flex; gap: 6px; }
@media (max-width: 880px) {
  .unsaved-bar { left: 14px; bottom: 80px; }
}
@media (max-width: 480px) {
  .unsaved-bar { padding: 9px 11px; min-width: 0; }
  .unsaved-bar .meta small { display: none; }
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 14px;
  min-width: 260px; max-width: 360px;
  background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  border: 1px solid var(--border-1);
  border-radius: var(--r);
  backdrop-filter: blur(16px) saturate(160%);
  box-shadow: var(--shadow-lg);
  animation: toastIn 280ms var(--ease-spring) both;
}
.toast.is-out { animation: toastOut 220ms var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }
.toast .ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 22px; }
.toast.success .ic { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.toast.error   .ic { background: color-mix(in srgb, var(--danger) 18%, transparent);  color: var(--danger); }
.toast.warn    .ic { background: color-mix(in srgb, var(--warn) 18%, transparent);   color: var(--warn); }
.toast.info    .ic { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.toast .ic svg { width: 12px; height: 12px; }
.toast .body { flex: 1; min-width: 0; }
.toast .body strong { font-size: 13px; display: block; line-height: 1.3; }
.toast .body small  { font-size: 12px; color: var(--text-muted); }
.toast .close { width: 22px; height: 22px; border-radius: 5px; color: var(--text-faint); display: grid; place-items: center; }
.toast .close:hover { background: var(--surface-1); color: var(--text); }
.toast .close svg { width: 11px; height: 11px; }

.modal-root {
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  padding: 14px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(8px);
  z-index: 70;
}
.modal-root.is-open { display: flex; animation: modalBgIn 200ms var(--ease) both; }
@keyframes modalBgIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  width: 100%; max-width: 460px;
  overflow: hidden;
  animation: modalIn 280ms var(--ease-spring) both;
  display: flex; flex-direction: column;
  max-height: 92dvh;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal.lg { max-width: 720px; }
.modal.xl { max-width: 920px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { flex: 1; font-size: 15px; }
.modal-body { padding: 18px; overflow: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }

.fs-steps { display: flex; flex-direction: column; gap: 6px; }
.fs-step {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text-muted);
}
.fs-step .fs-num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  flex: 0 0 24px;
}
.fs-step.is-done { color: var(--success); border-color: color-mix(in srgb, var(--success) 28%, transparent); background: color-mix(in srgb, var(--success) 8%, transparent); }
.fs-step.is-done .fs-num { background: var(--success); border-color: var(--success); color: #052e1e; }
.fs-step.is-active { color: var(--text); border-color: color-mix(in srgb, var(--accent) 36%, transparent); background: color-mix(in srgb, var(--accent) 8%, transparent); box-shadow: 0 0 0 3px var(--accent-glow); }
.fs-step.is-active .fs-num { background: var(--accent); border-color: var(--accent); color: white; }

.picker-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 0 0 12px;
}
.pill {
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: all var(--d-fast) var(--ease);
}
.pill:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-1); }
.pill.is-active {
  background: var(--accent); color: white;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.grid-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
@media (max-width: 480px) {
  .grid-items { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
}
.item {
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  transition: all var(--d-fast) var(--ease);
  position: relative;
}
.item:hover { border-color: var(--accent); transform: translateY(-2px); }
.item.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.item.selected::after {
  content: '✓';
  position: absolute; top: 4px; right: 4px;
  width: 18px; height: 18px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  box-shadow: 0 0 0 2px var(--bg);
}
.item .thumb {
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--surface-3), var(--surface-1));
  display: grid; place-items: center;
  color: var(--text-faint);
}
.item .name {
  font-size: 11.5px; font-weight: 500; line-height: 1.3;
  color: var(--text);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word;
}
.item .id { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); }

.mobile-bar { display: none; }
.menu-btn { display: none; }

@media (max-width: 1100px) {
  .content { padding: 20px; }
  .topbar { padding: 0 18px; }
  .welcome-text small { display: none; }
}
@media (max-width: 980px) {
  .membership-pill { display: none; }
}

@media (max-width: 880px) {
  .main { margin-left: 0; }
  .sidebar {
    width: min(280px, 86vw);
    transform: translateX(-100%);
    transition: transform var(--d-slow) var(--ease);
    z-index: 60;
  }
  .sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow-xl); }
  .sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none;
    transition: opacity var(--d) var(--ease);
    z-index: 55;
  }
  .sidebar-overlay.is-on { opacity: 1; pointer-events: auto; }
  .topbar { padding: 0 14px; gap: 8px; height: 56px; }
  .menu-btn { display: grid; }
  .content { padding: 14px; padding-bottom: 96px; }
  .welcome-text strong { font-size: 13px; }
  .icon-btn { width: 32px; height: 32px; }
  .shards-pill { padding: 6px 11px; font-size: 12px; gap: 6px; }
  .mobile-bar {
    position: fixed; left: 0; right: 0; bottom: 0;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(20px) saturate(160%);
    border-top: 1px solid var(--border);
    z-index: 50;
  }
  .mobile-bar .mb-link {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 4px;
    border-radius: var(--r-sm);
    color: var(--text-faint);
    font-size: 10.5px; font-weight: 500;
  }
  .mobile-bar .mb-link svg { width: 17px; height: 17px; }
  .mobile-bar .mb-link.is-active { color: var(--accent); }
}

@media (max-width: 380px) {
  .content { padding: 12px; }
  .topbar { padding: 0 10px; gap: 6px; }
  .welcome-text strong { font-size: 12.5px; }
  .icon-btn { width: 30px; height: 30px; }
  .shards-pill { padding: 5px 10px; font-size: 11.5px; }
  .shards-pill .num { font-size: 11.5px; }
  .modal { max-width: 100%; border-radius: 14px; }
  .modal-foot, .modal-head, .modal-body { padding-left: 14px; padding-right: 14px; }
}

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

.progress {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.progress > span {
  display: block;
  height: 100%;
  width: var(--p, 0%);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: inherit;
  box-shadow: 0 0 12px var(--accent-glow);
  transition: width 320ms var(--ease);
}

.login-overlay {
  position: fixed; inset: 0;
  display: none;
  place-items: center;
  z-index: 1200;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  padding: 20px;
  animation: panelIn 280ms var(--ease) both;
}
.login-overlay.is-on { display: grid; }
.login-card {
  max-width: 380px; width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-xl);
}
.login-card .logo {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: conic-gradient(from 220deg at 50% 50%, var(--accent), var(--accent-2), var(--accent));
  margin: 0 auto 14px;
  display: grid; place-items: center;
  font-weight: 800; color: white;
  box-shadow: 0 0 0 1px var(--border-2) inset, 0 8px 24px var(--accent-glow);
}
.login-card h2 { font-size: 18px; margin-bottom: 6px; }
.login-card p { color: var(--text-muted); font-size: 13px; margin-bottom: 18px; }
.login-card .login-actions { display: flex; flex-direction: column; gap: 8px; }
.login-card .login-actions a {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  font-weight: 600; font-size: 13px;
  color: var(--text);
  transition: background var(--d-fast) var(--ease);
}
.login-card .login-actions a:hover { background: var(--surface-3); }
.login-card .login-actions a svg { width: 18px; height: 18px; }

.cf-turnstile-host {
  display: flex; justify-content: center;
  min-height: 65px;
  padding: 6px;
  border: 1px dashed var(--border-1);
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--bg-2) 60%, transparent);
}
.cf-turnstile-host:empty::before {
  content: 'Loading verification…';
  display: grid; place-items: center;
  width: 100%; height: 65px;
  font-size: 12px; color: var(--text-faint);
}

.empty-row td {
  text-align: center;
  padding: 18px 14px !important;
  color: var(--text-faint);
  font-size: 12.5px;
  font-style: italic;
}
