/* Frame Studio — design tokens ------------------------------------------------ */
:root {
  --bg: #0b0d12;
  --bg-elev: #10131a;
  --panel: #151922;
  --panel-2: #1b202b;
  --border: #262c39;
  --border-strong: #343b4b;
  --text: #e9ebf1;
  --muted: #a0a7b8;
  --faint: #6d7486;
  --accent: #f5a524;
  --accent-hover: #ffb43d;
  --accent-ink: #1d1404;
  --accent-soft: rgba(245, 165, 36, 0.13);
  --ok: #3ecf8e;
  --ok-soft: rgba(62, 207, 142, 0.13);
  --info: #6ea8ff;
  --info-soft: rgba(110, 168, 255, 0.13);
  --danger: #f2555a;
  --danger-soft: rgba(242, 85, 90, 0.13);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f7fa;
  --bg-elev: #ffffff;
  --panel: #ffffff;
  --panel-2: #f1f3f7;
  --border: #e3e6ed;
  --border-strong: #cfd4de;
  --text: #151821;
  --muted: #5b6273;
  --faint: #8a91a1;
  --accent: #d98a06;
  --accent-hover: #c27a00;
  --accent-ink: #ffffff;
  --accent-soft: rgba(217, 138, 6, 0.12);
  --ok: #129a62;
  --ok-soft: rgba(18, 154, 98, 0.1);
  --info: #2f6fdc;
  --info-soft: rgba(47, 111, 220, 0.1);
  --danger: #d23a3f;
  --danger-soft: rgba(210, 58, 63, 0.1);
  --shadow: 0 10px 30px rgba(20, 24, 33, 0.1);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f7fa; --bg-elev: #ffffff; --panel: #ffffff; --panel-2: #f1f3f7; --border: #e3e6ed;
    --border-strong: #cfd4de; --text: #151821; --muted: #5b6273; --faint: #8a91a1; --accent: #d98a06;
    --accent-hover: #c27a00; --accent-ink: #ffffff; --accent-soft: rgba(217, 138, 6, 0.12); --ok: #129a62;
    --ok-soft: rgba(18, 154, 98, 0.1); --info: #2f6fdc; --info-soft: rgba(47, 111, 220, 0.1); --danger: #d23a3f;
    --danger-soft: rgba(210, 58, 63, 0.1); --shadow: 0 10px 30px rgba(20, 24, 33, 0.1); color-scheme: light;
  }
}

/* Base -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 620; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.icon { display: inline-flex; width: 18px; height: 18px; flex: none; }
.icon svg { width: 100%; height: 100%; }

/* Layout -------------------------------------------------------------------------- */
.layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px; background: var(--bg-elev); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 680; font-size: 15px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #ff6a3d); color: #fff;
}
.brand-mark .icon { width: 17px; height: 17px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); padding: 12px 10px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 520; transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--text); }
.nav-item.active .icon { color: var(--accent); }
.nav-item .count { margin-left: auto; font-size: 11px; background: var(--panel-2); border-radius: 999px; padding: 1px 7px; color: var(--muted); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--panel); cursor: pointer; width: 100%; text-align: left;
}
.user-chip:hover { border-color: var(--border-strong); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--panel-2); color: var(--accent); font-weight: 650; font-size: 12px; text-transform: uppercase;
}
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 18px 32px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.topbar .titles { min-width: 0; }
.topbar .actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.content { padding: 28px 32px 64px; max-width: 1320px; width: 100%; }
.mobile-nav { display: none; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-nav {
    display: flex; gap: 4px; overflow-x: auto; padding: 10px 16px; border-bottom: 1px solid var(--border);
    background: var(--bg-elev); position: sticky; top: 0; z-index: 6;
  }
  .mobile-nav .nav-item { white-space: nowrap; }
  .topbar { padding: 14px 16px; position: static; flex-direction: column; align-items: stretch; gap: 12px; }
  .topbar .actions { margin-left: 0; flex-wrap: wrap; }
  .kv { grid-template-columns: 96px 1fr; }
  .content { padding: 20px 16px 48px; }
}

/* Buttons -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--panel);
  font-weight: 560; cursor: pointer; white-space: nowrap; transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}
.btn:hover { background: var(--panel-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 34px; padding: 0; }
.btn-block { width: 100%; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Forms -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 14px; }
.label { font-weight: 560; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.label .opt { color: var(--faint); font-weight: 450; }
.hint { color: var(--faint); font-size: 12.5px; }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--border-strong); background: var(--bg-elev); border-radius: var(--radius-sm);
  padding: 9px 11px; transition: border-color 0.12s, box-shadow 0.12s;
}
.textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check.field { flex-direction: row; }
.check > span { display: flex; flex-direction: column; gap: 2px; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }
.range { width: 100%; accent-color: var(--accent); }
.range-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--faint); }
.error-text { color: var(--danger); font-size: 13px; }

.segmented { display: inline-flex; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 540;
}
.segmented button[aria-pressed="true"] { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }

/* Cards & panels -------------------------------------------------------------------------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.card-pad { padding: 20px; }
.section { padding: 20px; }
.section + .section { border-top: 1px solid var(--border); }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.step {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 650;
  background: var(--accent-soft); color: var(--accent); flex: none;
}
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 1250px) and (min-width: 901px) { .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* Home -------------------------------------------------------------------------- */
.hero {
  position: relative; overflow: hidden; padding: 28px; border-radius: 16px; border: 1px solid var(--border);
  background:
    radial-gradient(600px 220px at 85% -10%, rgba(255, 106, 61, 0.18), transparent 60%),
    radial-gradient(500px 240px at 10% 120%, rgba(245, 165, 36, 0.14), transparent 60%),
    var(--panel);
}
.hero h1 { font-size: 26px; }
.hero p { color: var(--muted); max-width: 640px; margin-top: 8px; font-size: 15px; }
.tool-card {
  display: flex; flex-direction: column; gap: 12px; padding: 22px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--panel); transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s; cursor: pointer; text-align: left;
}
.tool-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.tool-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tool-icon .icon { width: 22px; height: 22px; }
.tool-card .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

/* Badges & progress -------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 560;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.badge-info { color: var(--info); background: var(--info-soft); border-color: transparent; }
.badge-warn { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.badge-danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.badge-running .dot { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.progress { height: 6px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), #ff7a45); border-radius: 999px; transition: width 0.6s ease; }
.progress.indeterminate > div { width: 35% !important; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* Tool page -------------------------------------------------------------------------- */
.tool-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .tool-layout { grid-template-columns: 1fr; } }
.sticky-col { position: sticky; top: 92px; }
@media (max-width: 1100px) { .sticky-col { position: static; } }
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 36px 20px; text-align: center; cursor: pointer;
  background: var(--bg-elev); transition: border-color 0.15s, background 0.15s; display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .icon { width: 30px; height: 30px; color: var(--accent); }
.dropzone.compact { padding: 18px; flex-direction: row; justify-content: center; }
.dropzone.compact .icon { width: 20px; height: 20px; }

.editor { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; user-select: none; touch-action: none; }
/* No object-fit: the element box must equal the drawn image so subject boxes line up. */
.editor img { display: block; max-width: 100%; max-height: 68vh; width: auto; height: auto; margin: 0 auto; }
.editor .overlay { position: absolute; inset: 0; }
.editor.drawing .overlay { cursor: crosshair; }
.editor .box {
  position: absolute; border: 2px solid var(--c); border-radius: 6px; background: color-mix(in srgb, var(--c) 14%, transparent);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.editor .box.selected { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 45%, transparent); }
.editor .box .tag {
  position: absolute; left: -2px; top: -24px; background: var(--c); color: #111; font-size: 12px; font-weight: 650;
  padding: 1px 7px; border-radius: 5px 5px 5px 0; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}
.editor .box.top .tag { top: auto; bottom: -24px; border-radius: 0 5px 5px 5px; }
.editor-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.editor-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); background: rgba(0, 0, 0, 0.72); color: #fff;
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; pointer-events: none; white-space: nowrap;
}

.subject {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; padding: 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg-elev);
}
.subject.selected { border-color: var(--c); }
.subject .num {
  width: 26px; height: 26px; border-radius: 7px; background: var(--c); color: #111; display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
.subject .fields { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.subject .textarea { min-height: 56px; }

.style-option {
  display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 10px; border: 1.5px solid var(--border);
  background: var(--bg-elev); cursor: pointer; text-align: left; width: 100%;
}
.style-option[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.style-swatch { width: 44px; height: 44px; border-radius: 10px; flex: none; background: linear-gradient(135deg, var(--sw), #ff6a3d); display: grid; place-items: center; color: #fff; }
.style-option.disabled { opacity: 0.55; cursor: default; border-style: dashed; }
.limits-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; align-items: end; }
.limits-grid .field { margin: 0; }
.admin-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 1100px) { .admin-grid { grid-template-columns: 1fr; } }
.engine-switch { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.engine-switch .segmented { width: 100%; }
.engine-switch .segmented button { flex: 1; }
.engine-label { margin-bottom: 8px; }
.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.style-grid .style-option { align-items: flex-start; }
.style-grid .style-swatch { width: 36px; height: 36px; }

.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.char-pick {
  display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 10px; border: 1.5px solid var(--border);
  background: var(--bg-elev); cursor: pointer; text-align: left; color: var(--text); font: inherit; font-size: 13px; font-weight: 560;
}
.char-pick img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 7px; background: var(--panel-2); }
.char-pick > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.char-pick[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }

.quality-option {
  flex: 1; min-width: 150px; padding: 12px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--bg-elev);
  cursor: pointer; text-align: left;
}
.quality-option[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.quality-option:disabled { opacity: 0.5; cursor: not-allowed; }
.row > .quality-option { align-self: stretch; }
.quality-option .eta { font-size: 12px; color: var(--muted); margin-top: 4px; }

.summary { padding: 18px 20px; border-top: 1px solid var(--border); background: var(--panel-2); border-radius: 0 0 var(--radius) var(--radius); }
.summary .eta-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.note {
  display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--info-soft); color: var(--text); font-size: 13px;
}
.note .icon { color: var(--info); width: 16px; height: 16px; margin-top: 2px; }
.note.warn { background: var(--accent-soft); }
.note.warn .icon { color: var(--accent); }
.note.guide .disclosure { color: var(--text); }
.tips { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.chip {
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text); border-radius: 999px; padding: 5px 11px;
  font: inherit; font-size: 12.5px; cursor: pointer; text-align: left;
}
.chip:hover { border-color: var(--accent); }
.disclosure { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; display: inline-flex; gap: 6px; align-items: center; font-weight: 540; }
.disclosure:hover { color: var(--text); }
.thumb-row { display: flex; gap: 10px; align-items: center; }
.thumb-row img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

/* Library -------------------------------------------------------------------------- */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.job-card { overflow: hidden; display: flex; flex-direction: column; cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.job-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.job-thumb { position: relative; aspect-ratio: 4 / 5; background: var(--panel-2); display: grid; place-items: center; overflow: hidden; }
.job-thumb img { width: 100%; height: 100%; object-fit: cover; }
.job-thumb .kind { position: absolute; top: 10px; left: 10px; }
.job-thumb .placeholder { color: var(--faint); display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12.5px; }
.job-thumb .placeholder .icon { width: 28px; height: 28px; }
.job-thumb .play {
  position: absolute; inset: auto 10px 10px auto; width: 34px; height: 34px; border-radius: 50%; background: rgba(0, 0, 0, 0.6);
  color: #fff; display: grid; place-items: center;
}
.job-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.job-title { font-weight: 580; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.job-meta { display: flex; gap: 8px; align-items: center; color: var(--faint); font-size: 12.5px; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }

.empty { text-align: center; padding: 64px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty .icon { width: 40px; height: 40px; color: var(--faint); }

/* Job detail -------------------------------------------------------------------------- */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .detail-layout { grid-template-columns: 1fr; } }
.media-frame { background: #000; border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; min-height: 320px; }
.media-frame video, .media-frame img { width: 100%; max-height: 74vh; object-fit: contain; display: block; }
.media-wait { padding: 48px 24px; text-align: center; color: #d6d9e0; display: flex; flex-direction: column; gap: 14px; align-items: center; width: 100%; max-width: 440px; }
.media-wait .progress { width: 100%; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; word-break: break-word; }
.prompt-box { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; color: var(--muted); white-space: pre-wrap; }
.downloads { display: flex; flex-direction: column; gap: 8px; }

/* Tables -------------------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; color: var(--faint); font-weight: 560; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }

/* Login -------------------------------------------------------------------------- */
.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(700px 360px at 80% 0%, rgba(255, 106, 61, 0.16), transparent 60%),
    radial-gradient(600px 300px at 0% 100%, rgba(245, 165, 36, 0.13), transparent 60%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 400px; padding: 32px; box-shadow: var(--shadow); }
.auth-card .brand { padding: 0 0 20px; font-size: 17px; }
.auth-card h1 { font-size: 21px; margin-bottom: 4px; }

/* Overlays -------------------------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(5, 7, 12, 0.62); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade 0.12s ease; }
.modal {
  width: 100%; max-width: 440px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto;
  overscroll-behavior: contain; padding: 24px 24px 0; box-shadow: var(--shadow); animation: rise 0.16s ease;
}
.modal h2 { margin-bottom: 8px; }
/* Buttons stay visible at the bottom while a long dialog scrolls. */
.modal .actions {
  display: flex; justify-content: flex-end; gap: 10px; margin: 22px -24px 0; padding: 14px 24px 18px;
  position: sticky; bottom: 0; background: var(--panel); border-top: 1px solid var(--border);
}
.modal:has(.limits-grid) { max-width: 560px; }
.modal .limits-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 520px) { .modal .limits-grid { grid-template-columns: 1fr; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.menu {
  position: absolute; bottom: 64px; left: 14px; right: 14px; padding: 6px; z-index: 20; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.menu button { display: flex; gap: 10px; align-items: center; border: 0; background: none; padding: 9px 10px; border-radius: 7px; cursor: pointer; text-align: left; color: var(--text); }
.menu button:hover { background: var(--panel-2); }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 60; max-width: min(380px, calc(100vw - 40px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border);
  box-shadow: var(--shadow); animation: rise 0.16s ease; font-size: 13.5px;
}
.toast .icon { width: 18px; height: 18px; margin-top: 1px; }
.toast.ok .icon { color: var(--ok); }
.toast.error .icon { color: var(--danger); }
.banner { display: flex; gap: 10px; align-items: center; padding: 10px 32px; background: var(--danger-soft); color: var(--text); font-size: 13px; border-bottom: 1px solid var(--border); }
.banner .icon { color: var(--danger); width: 16px; height: 16px; }
@media (max-width: 900px) { .banner { padding: 10px 16px; } }
.skeleton { background: linear-gradient(90deg, var(--panel-2), var(--panel), var(--panel-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
