/* ==========================================================================
   Ayaka Sync API — global design system (monochrome)
   ========================================================================== */
:root {
  --bg: #080808;
  --bg-sidebar: #0d0d0d;
  --card: #121212;
  --elevated: #181818;
  --hover: #1d1d1d;
  --border: #262626;
  --border-strong: #333333;
  --text: #f5f5f5;
  --text-2: #a1a1a1;
  --muted: #707070;
  --white: #ffffff;

  --success: #6fae8a;
  --success-bg: rgba(111, 174, 138, 0.1);
  --error: #d27575;
  --error-bg: rgba(210, 117, 117, 0.1);
  --warning: #cfa660;
  --warning-bg: rgba(207, 166, 96, 0.1);

  --font: "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;

  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
  --glass: rgba(18, 18, 18, 0.72);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t: 160ms var(--ease);
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 60px;

  /* semantic tokens (dark) */
  --on-accent: #000000;
  --accent-hover: #e6e6e6;
  --row-hover: #151515;
  --feature-hover: #0e0e0e;
  --divider: #1c1c1c;
  --faint: #555555;
  --faint-2: #3a3a3a;
  --placeholder: #5a5a5a;
  --track: #2a2a2a;
  --track-2: #1d1d1d;
  --knob: #8a8a8a;
  --focus-border: #8a8a8a;
  --focus-ring: rgba(255, 255, 255, 0.06);
  --nav-glass: rgba(8, 8, 8, 0.78);
  --scrim: rgba(0, 0, 0, 0.66);
  --skeleton: #171717;
  --shimmer: rgba(255, 255, 255, 0.04);
  --toast-bg: rgba(24, 24, 24, 0.94);
  --tooltip-bg: #f5f5f5;
  --tooltip-text: #0a0a0a;
  --selection-bg: rgba(255, 255, 255, 0.85);
  --success-border: rgba(111, 174, 138, 0.3);
  --error-border: rgba(210, 117, 117, 0.3);
  --error-border-soft: rgba(210, 117, 117, 0.2);
  --error-border-strong: rgba(210, 117, 117, 0.65);
  --warning-border: rgba(207, 166, 96, 0.3);
  --success-text: #a3d1b6;
  --error-text: #e6a3a3;
  --warning-text: #e3c58e;
  --on-error: #140808;
  --error-hover: #dc8a8a;
  --strength-3: #c9c9c9;
  --hero-grid: #161616;
  --code-bg: #0b0b0b;
  --code-head: #0f0f0f;
  --code-text: #d6d6d6;
  --code-comment: #6a6a6a;
  --code-string: #e8e8e8;
  --code-key: #ffffff;
  --code-meta: #9a9a9a;

  /* chart colours (read by charts.js) */
  --chart-primary: #f5f5f5;
  --chart-secondary: #d4d4d4;
  --chart-grey: #707070;
  --chart-grid: #1c1c1c;
  --chart-tick: #8a8a8a;
  --chart-title: #5a5a5a;
  --chart-fill: #ffffff;
  color-scheme: dark;
}

/* ---------------------------------------------------------- light theme */
:root[data-theme="light"] {
  --bg: #fafafa;
  --bg-sidebar: #f4f4f4;
  --card: #ffffff;
  --elevated: #f2f2f2;
  --hover: #ebebeb;
  --border: #e4e4e4;
  --border-strong: #d2d2d2;
  --text: #0a0a0a;
  --text-2: #525252;
  --muted: #6e6e6e;
  --white: #0a0a0a;

  --success: #2f7a52;
  --success-bg: rgba(47, 122, 82, 0.08);
  --error: #b5403f;
  --error-bg: rgba(181, 64, 63, 0.07);
  --warning: #93640c;
  --warning-bg: rgba(147, 100, 12, 0.08);

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
  --glass: rgba(255, 255, 255, 0.78);

  --on-accent: #ffffff;
  --accent-hover: #2b2b2b;
  --row-hover: #f3f3f3;
  --feature-hover: #f6f6f6;
  --divider: #ededed;
  --faint: #8f8f8f;
  --faint-2: #bdbdbd;
  --placeholder: #a3a3a3;
  --track: #dcdcdc;
  --track-2: #ececec;
  --knob: #ffffff;
  --focus-border: #8f8f8f;
  --focus-ring: rgba(0, 0, 0, 0.06);
  --nav-glass: rgba(250, 250, 250, 0.82);
  --scrim: rgba(10, 10, 10, 0.32);
  --skeleton: #ededed;
  --shimmer: rgba(255, 255, 255, 0.7);
  --toast-bg: rgba(255, 255, 255, 0.96);
  --tooltip-bg: #171717;
  --tooltip-text: #fafafa;
  --selection-bg: rgba(10, 10, 10, 0.85);
  --success-border: rgba(47, 122, 82, 0.28);
  --error-border: rgba(181, 64, 63, 0.28);
  --error-border-soft: rgba(181, 64, 63, 0.18);
  --error-border-strong: rgba(181, 64, 63, 0.6);
  --warning-border: rgba(147, 100, 12, 0.28);
  --success-text: #23603f;
  --error-text: #9a3433;
  --warning-text: #7a520a;
  --on-error: #ffffff;
  --error-hover: #9a3433;
  --strength-3: #6e6e6e;
  --hero-grid: #ececec;
  --code-bg: #f6f6f6;
  --code-head: #efefef;
  --code-text: #262626;
  --code-comment: #8a8a8a;
  --code-string: #0a0a0a;
  --code-key: #000000;
  --code-meta: #5e5e5e;

  --chart-primary: #171717;
  --chart-secondary: #c4c4c4;
  --chart-grey: #8f8f8f;
  --chart-grid: #ececec;
  --chart-tick: #6e6e6e;
  --chart-title: #8f8f8f;
  --chart-fill: #171717;
  color-scheme: light;
}
:root[data-theme="light"] .switch input:not(:checked) + span::after { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18); }
:root.theme-switching *, :root.theme-switching *::before, :root.theme-switching *::after {
  transition: background-color 200ms var(--ease), border-color 200ms var(--ease), color 200ms var(--ease), fill 200ms var(--ease) !important;
}

/* ---------------------------------------------------------- theme toggle */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }
.theme-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
.theme-option { display: flex; flex-direction: column; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--card); text-align: left; transition: border-color var(--t), background var(--t); }
.theme-option:hover { border-color: var(--border-strong); }
.theme-option.is-active { border-color: var(--white); box-shadow: inset 0 0 0 1px var(--white); }
.theme-option .t { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); font-weight: 500; }
.theme-preview { height: 72px; border-radius: 8px; border: 1px solid var(--border); overflow: hidden; display: grid; grid-template-columns: 28% 1fr; }
.theme-preview i, .theme-preview b { display: block; }
.theme-preview .pv-side { border-right: 1px solid; }
.theme-preview .pv-main { padding: 8px; display: flex; flex-direction: column; gap: 5px; }
.theme-preview .pv-main b { height: 6px; border-radius: 3px; }
.pv-dark { background: #080808; } .pv-dark .pv-side { background: #0d0d0d; border-color: #262626; } .pv-dark b { background: #262626; } .pv-dark b:first-child { background: #f5f5f5; width: 45%; }
.pv-light { background: #fafafa; } .pv-light .pv-side { background: #f1f1f1; border-color: #e4e4e4; } .pv-light b { background: #e4e4e4; } .pv-light b:first-child { background: #0a0a0a; width: 45%; }
.pv-system { background: linear-gradient(90deg, #080808 50%, #fafafa 50%); }
.pv-system .pv-side { background: #0d0d0d; border-color: #262626; } .pv-system b { background: #8a8a8a; } .pv-system b:first-child { width: 45%; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; border-radius: var(--r-sm); }
::selection { background: var(--selection-bg); color: var(--on-accent); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
p { margin: 0; }
code, pre, kbd, .mono { font-family: var(--mono); font-size: 0.92em; }
.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; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.text-success { color: var(--success); }
.text-danger { color: var(--error); }
.text-warning { color: var(--warning); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--track); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 20px; height: 20px; }

/* ----------------------------------------------------------------- logo */
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--white); color: var(--on-accent); display: grid; place-items: center; flex: none; }
.logo-mark svg { width: 16px; height: 16px; }
.logo-text { display: flex; flex-direction: column; line-height: 1.05; }
.logo-text strong { font-size: 13px; letter-spacing: 0.18em; font-weight: 700; }
.logo-text span { font-size: 10px; letter-spacing: 0.22em; color: var(--text-2); font-weight: 500; }

/* -------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--r);
  font-size: var(--text-sm); font-weight: 500; white-space: nowrap;
  border: 1px solid var(--border); background: var(--elevated); color: var(--text);
  transition: background var(--t), border-color var(--t), color var(--t), transform var(--t), opacity var(--t);
  user-select: none;
}
.btn:hover { background: var(--hover); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-loading { opacity: 0.55; pointer-events: none; }
.btn-primary { background: var(--white); color: var(--on-accent); border-color: var(--white); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--elevated); color: var(--text); border-color: transparent; }
.btn-danger { background: transparent; color: var(--error); border-color: var(--error-border); }
.btn-danger:hover { background: var(--error-bg); border-color: var(--error-border-strong); }
.btn-danger-solid { background: var(--error); border-color: var(--error); color: var(--on-error); }
.btn-danger-solid:hover { background: var(--error-hover); border-color: var(--error-hover); }
.btn-sm { height: 30px; padding: 0 10px; font-size: var(--text-xs); }
.btn-lg { height: 44px; padding: 0 20px; font-size: var(--text-base); }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn-block { width: 100%; }
.btn .spinner { width: 14px; height: 14px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------- inputs */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.label { font-size: var(--text-sm); font-weight: 500; color: var(--text); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.label .optional { color: var(--muted); font-weight: 400; font-size: var(--text-xs); }
.hint { font-size: var(--text-xs); color: var(--muted); }
.field-error { font-size: var(--text-xs); color: var(--error); min-height: 0; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--r);
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  font-size: var(--text-base); transition: border-color var(--t), background var(--t), box-shadow var(--t);
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--placeholder); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus-border); box-shadow: 0 0 0 3px var(--focus-ring); }
.input.is-invalid, .select.is-invalid { border-color: var(--error-border-strong); }
.input[readonly] { color: var(--text-2); }
.select {
  appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1a1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.select-sm, .input-sm { height: 34px; font-size: var(--text-sm); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 42px; }
.input-group .input-addon { position: absolute; right: 4px; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 34px; }
input[type="date"].input, input[type="datetime-local"].input { color-scheme: dark; }

.checkbox { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--text-sm); color: var(--text-2); user-select: none; }
.checkbox input { appearance: none; width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--border-strong); background: var(--bg); display: grid; place-items: center; margin: 0; cursor: pointer; transition: background var(--t), border-color var(--t); flex: none; }
.checkbox input:checked { background: var(--white); border-color: var(--white); }
.checkbox input:checked::after { content: ""; width: 9px; height: 5px; border-left: 2px solid var(--on-accent); border-bottom: 2px solid var(--on-accent); transform: rotate(-45deg) translate(1px, -1px); }
.checkbox input:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }

.switch { position: relative; display: inline-flex; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--track); border-radius: 20px; transition: background var(--t); cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--knob); transition: transform var(--t), background var(--t); }
.switch input:checked + span { background: var(--white); }
.switch input:checked + span::after { transform: translateX(16px); background: var(--on-accent); }
.switch input:focus-visible + span { outline: 2px solid var(--white); outline-offset: 2px; }

.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); font-size: var(--text-sm); cursor: pointer; transition: all var(--t); user-select: none; }
.chip-check span:hover { border-color: var(--border-strong); color: var(--text); }
.chip-check input:checked + span { background: var(--white); color: var(--on-accent); border-color: var(--white); }
.chip-check input:focus-visible + span { outline: 2px solid var(--white); outline-offset: 2px; }

.segmented { display: inline-flex; padding: 3px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r); gap: 2px; }
.segmented button { height: 28px; padding: 0 12px; border-radius: 6px; font-size: var(--text-sm); color: var(--text-2); transition: background var(--t), color var(--t); white-space: nowrap; }
.segmented button:hover { color: var(--text); }
.segmented button.is-active { background: var(--elevated); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }

/* ---------------------------------------------------------------- cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-title { font-size: var(--text-base); font-weight: 600; }
.card-sub { font-size: var(--text-xs); color: var(--muted); margin-top: 2px; }
.card-body { padding: var(--s-5); }
.card-footer { padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }

/* --------------------------------------------------------------- badges */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500; border: 1px solid var(--border); color: var(--text-2); background: transparent; white-space: nowrap; }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { color: var(--success); border-color: var(--success-border); background: var(--success-bg); }
.badge-error { color: var(--error); border-color: var(--error-border); background: var(--error-bg); }
.badge-warning { color: var(--warning); border-color: var(--warning-border); background: var(--warning-bg); }
.badge-solid { background: var(--white); color: var(--on-accent); border-color: var(--white); }
.badge-mono { font-family: var(--mono); font-size: 11px; }
.method { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.02em; color: var(--text); }

/* ---------------------------------------------------------------- table */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; padding: 10px var(--s-5); border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--card); }
.table td { padding: 12px var(--s-5); border-bottom: 1px solid var(--divider); vertical-align: middle; white-space: nowrap; }
.table tbody tr { transition: background var(--t); }
.table tbody tr:hover { background: var(--row-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .cell-main { color: var(--text); font-weight: 500; }
.table .cell-sub { color: var(--muted); font-size: var(--text-xs); }
.table .actions { text-align: right; }
.table tr.is-clickable { cursor: pointer; }

/* --------------------------------------------------------- pagination */
.pagination { display: flex; align-items: center; gap: var(--s-2); }
.pagination-info { font-size: var(--text-xs); color: var(--muted); }

/* ------------------------------------------------------------ toolbar */
.toolbar { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.toolbar .input-icon { flex: 1 1 220px; min-width: 180px; max-width: 320px; }
.toolbar .select { width: auto; min-width: 140px; }

/* ------------------------------------------------------- empty / error */
.empty { padding: var(--s-12) var(--s-6); text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--s-2); }
.empty-icon { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-2); margin-bottom: var(--s-2); background: var(--elevated); }
.empty h3 { font-size: var(--text-base); }
.empty p { color: var(--muted); font-size: var(--text-sm); max-width: 380px; }
.empty .btn { margin-top: var(--s-3); }
.empty.is-error .empty-icon { color: var(--error); border-color: var(--error-border); }

/* -------------------------------------------------------- skeleton */
.skeleton { position: relative; overflow: hidden; background: var(--skeleton); border-radius: 6px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, var(--shimmer), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 12px; }
.sk-num { height: 28px; width: 60%; }

/* ------------------------------------------------------------ modal */
.modal-root { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: var(--s-4); }
.modal-backdrop { position: absolute; inset: 0; background: var(--scrim); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade 180ms var(--ease); }
.modal { position: relative; width: 100%; max-width: 520px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); animation: pop 200ms var(--ease); }
.modal-lg { max-width: 680px; }
.modal-sm { max-width: 420px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); padding: var(--s-5) var(--s-6) var(--s-4); }
.modal-title { font-size: var(--text-lg); }
.modal-desc { color: var(--text-2); font-size: var(--text-sm); margin-top: 4px; }
.modal-body { padding: 0 var(--s-6) var(--s-5); overflow-y: auto; display: flex; flex-direction: column; gap: var(--s-4); }
.modal-footer { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-4) var(--s-6); border-top: 1px solid var(--border); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
body.modal-open { overflow: hidden; }

/* -------------------------------------------------------- dropdown */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; z-index: 60; padding: 6px; background: var(--elevated); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow); opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity var(--t), transform var(--t); }
.dropdown.is-open .dropdown-menu { opacity: 1; transform: none; pointer-events: auto; }
.dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 6px; font-size: var(--text-sm); color: var(--text-2); text-align: left; transition: background var(--t), color var(--t); }
.dropdown-item:hover { background: var(--hover); color: var(--text); }
.dropdown-item.is-danger { color: var(--error); }
.dropdown-sep { height: 1px; background: var(--border); margin: 6px 0; }
.dropdown-head { padding: 8px 10px 10px; }

/* ----------------------------------------------------------- toast */
.toast-stack { position: fixed; right: var(--s-5); bottom: var(--s-5); z-index: 200; display: flex; flex-direction: column; gap: var(--s-2); width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-lg); background: var(--toast-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--border-strong); box-shadow: var(--shadow); animation: toast-in 220ms var(--ease); font-size: var(--text-sm); }
.toast.is-leaving { animation: toast-out 180ms var(--ease) forwards; }
.toast-icon { margin-top: 2px; }
.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--error); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 500; }
.toast-msg { color: var(--text-2); font-size: var(--text-xs); margin-top: 2px; word-break: break-word; }
.toast-close { color: var(--muted); }
.toast-close:hover { color: var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* --------------------------------------------------------- tooltip */
[data-tooltip] { position: relative; }
.tooltip-bubble { position: fixed; z-index: 300; max-width: 260px; padding: 6px 9px; border-radius: 6px; background: var(--tooltip-bg); color: var(--tooltip-text); font-size: 11.5px; line-height: 1.4; pointer-events: none; box-shadow: var(--shadow); animation: fade 120ms var(--ease); }

/* ------------------------------------------------------- code block */
.code { position: relative; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--border); background: var(--code-head); }
.code-lang { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-size: 12.5px; line-height: 1.7; color: var(--code-text); }
.code .tk-c { color: var(--code-comment); }
.code .tk-s { color: var(--code-string); }
.code .tk-k { color: var(--code-key); font-weight: 600; }
.code .tk-m { color: var(--code-meta); }

.secret-box { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--r); }
.secret-box code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 12.5px; color: var(--white); }

.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--border); background: var(--elevated); font-size: var(--text-sm); color: var(--text-2); }
.callout .icon { margin-top: 2px; }
.callout-warning { border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning-text); }
.callout-error { border-color: var(--error-border); background: var(--error-bg); color: var(--error-text); }
.callout-success { border-color: var(--success-border); background: var(--success-bg); color: var(--success-text); }

.divider { height: 1px; background: var(--border); border: 0; margin: 0; }
.kbd { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 4px; font-size: 11px; color: var(--muted); font-family: var(--mono); }

.fade-in { animation: rise 320ms var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.dl { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px 16px; font-size: var(--text-sm); }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

.config-banner { position: sticky; top: 0; z-index: 90; display: flex; gap: 10px; align-items: center; justify-content: center; padding: 8px 16px; background: var(--warning-bg); border-bottom: 1px solid var(--warning-border); color: var(--warning-text); font-size: var(--text-sm); text-align: center; }

/* --------------------------------------------------------- scroll reveal
   States are set by assets/js/reveal.js. Animations (not transitions) are
   used so components keep their own hover transitions/transforms. */
[data-reveal="below"], [data-reveal="above"] { opacity: 0; }
[data-reveal="in-up"] { animation: reveal-up 720ms cubic-bezier(0.2, 0.7, 0.2, 1) var(--reveal-delay, 0ms) both; }
[data-reveal="in-down"] { animation: reveal-down 720ms cubic-bezier(0.2, 0.7, 0.2, 1) var(--reveal-delay, 0ms) both; }
@keyframes reveal-up { from { opacity: 0; translate: 0 32px; scale: 0.985; } to { opacity: 1; translate: 0 0; scale: 1; } }
@keyframes reveal-down { from { opacity: 0; translate: 0 -32px; scale: 0.985; } to { opacity: 1; translate: 0 0; scale: 1; } }

/* Hero entrance on first load (pure CSS, so it never flashes before JS runs). */
.hero .container > div:first-child > *:is(:not([data-reveal]), [data-reveal="shown"]),
.hero .terminal:is(:not([data-reveal]), [data-reveal="shown"]) { animation: reveal-up 800ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.hero .container > div:first-child > :nth-child(2) { animation-delay: 70ms; }
.hero .container > div:first-child > :nth-child(3) { animation-delay: 140ms; }
.hero .container > div:first-child > :nth-child(4) { animation-delay: 210ms; }
.hero .container > div:first-child > :nth-child(5) { animation-delay: 280ms; }
.hero .terminal { animation-delay: 200ms; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1 !important; animation: none !important; }
}
/* "Scroll animations" switched off in Settings → Appearance. */
.no-scroll-anim [data-reveal], .no-scroll-anim .hero .container > div:first-child > *, .no-scroll-anim .hero .terminal { opacity: 1 !important; animation: none !important; }
