/* ============================================================
   AERO // RECONSTRUCT — styles
   Dark operations UI, amber accent, 8px rhythm.
   ============================================================ */

:root {
  --bg: #070b11;
  --bg-2: #0a0f16;
  --panel: #0e1622;
  --panel-2: #111a26;
  --panel-3: #0d1420;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);

  --text: #f8fafc;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --muted-2: #64748b;

  --accent: #fbbf24;
  --accent-ink: #10151c;
  --accent-soft: rgba(251, 191, 36, 0.12);
  --accent-line: rgba(251, 191, 36, 0.38);
  --accent-text: #fbbf24;

  --red: #f87171;
  --blue: #60a5fa;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);

  --sans: "Inter", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --sidebar: 236px;
  --topbar: 56px;

  --sidebar-bg: linear-gradient(180deg, #0a1018 0%, #080d14 100%);
  --topbar-bg: rgba(7, 11, 17, 0.82);
  --toast-bg: rgba(14, 22, 34, 0.96);
  --placeholder: #4b5b6e;
  --alert-text: #fecaca;
  --hover: rgba(255, 255, 255, 0.06);
  --hover-soft: rgba(255, 255, 255, 0.04);
  --promo-bg: linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012));
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f5f7fb;
  --bg-2: #eef2f7;
  --panel: #ffffff;
  --panel-2: #ffffff;
  --panel-3: #f1f4fa;
  --line: rgba(15, 23, 42, 0.10);
  --line-strong: rgba(15, 23, 42, 0.17);

  --text: #0f172a;
  --text-2: #33415a;
  --muted: #5b6b80;
  --muted-2: #78879b;

  --accent: #f0a200;
  --accent-ink: #14161a;
  --accent-soft: rgba(240, 162, 0, 0.14);
  --accent-line: rgba(240, 162, 0, 0.45);
  --accent-text: #a45f00;

  --shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
  --sidebar-bg: linear-gradient(180deg, #ffffff 0%, #eff3f9 100%);
  --topbar-bg: rgba(255, 255, 255, 0.88);
  --toast-bg: rgba(255, 255, 255, 0.98);
  --placeholder: #8595a8;
  --alert-text: #b3261e;
  --hover: rgba(15, 23, 42, 0.06);
  --hover-soft: rgba(15, 23, 42, 0.035);
  --promo-bg: linear-gradient(160deg, rgba(15, 23, 42, 0.035), rgba(15, 23, 42, 0.012));
  color-scheme: light;
}

html[data-accent="cyan"] {
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --accent-line: rgba(56, 189, 248, 0.38);
}
html[data-accent="green"] {
  --accent: #34d399;
  --accent-soft: rgba(52, 211, 153, 0.12);
  --accent-line: rgba(52, 211, 153, 0.38);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }

svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ============================ SHELL ============================ */

.app {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------------- sidebar ---------------- */

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 14px 16px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  z-index: 40;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  font-size: 13.5px;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 14px;
  transform: rotate(-8deg);
}

.logo-text { white-space: nowrap; }
.logo-slash { color: var(--accent); margin: 0 3px; font-weight: 900; }
.logo-rest { color: var(--text); font-weight: 700; letter-spacing: 0.3px; }

.side-nav { display: flex; flex-direction: column; gap: 3px; }

.side-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.side-link svg { width: 17px; height: 17px; flex: none; opacity: 0.9; }

.side-link:hover { background: var(--hover-soft); color: var(--text); }

.side-link.is-active {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
}

.side-link.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.side-link.is-active svg { color: var(--accent); opacity: 1; }

.side-count {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-2);
}

.promo {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--promo-bg);
}

.promo-bolt {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  margin-bottom: 9px;
}

.promo-title {
  margin: 0 0 6px;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.4;
  color: var(--text);
}

.promo-body {
  margin: 0 0 10px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

.promo-link {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
}
.promo-link:hover { text-decoration: underline; }

.side-foot {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 8px 0;
  border-top: 1px solid var(--line);
  margin-top: auto;
}

.side-foot-brand {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1.1px;
  color: var(--muted-2);
}

.side-foot-ver { font-family: var(--mono); font-size: 9.5px; color: var(--muted-2); }

/* ---------------- main + topbar ---------------- */

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 20px;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-spacer { flex: 1; }

.top-links { display: flex; align-items: center; gap: 4px; }

.top-actions { display: flex; align-items: center; gap: 3px; }

.top-icon {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--text-2);
}
.top-icon svg { width: 17px; height: 17px; }
.top-icon:hover { background: var(--hover); border-color: var(--line); color: var(--text); }
.top-icon.is-active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

.ico-sun { display: none; }
html[data-theme="light"] .ico-moon { display: none; }
html[data-theme="light"] .ico-sun { display: block; }

.top-link {
  background: none;
  border: 0;
  padding: 7px 11px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.top-link:hover { background: var(--hover); color: var(--text); }

.help-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: none;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.15s, color 0.15s;
}
.help-btn:hover { border-color: var(--accent-line); color: var(--accent); }

.top-divider { width: 1px; height: 22px; background: var(--line-strong); margin: 0 6px; }

.account { position: relative; }

.account-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px 4px 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.account-btn:hover { border-color: var(--line-strong); background: var(--hover-soft); }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.avatar.lg { width: 38px; height: 38px; font-size: 13px; }

.chev { width: 14px; height: 14px; color: var(--muted); }

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 250px;
  padding: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 50;
}

.menu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 11px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 5px;
}
.menu-head strong { display: block; font-size: 12.5px; }
.menu-head small { color: var(--muted); font-size: 11px; }

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
}
.menu-item:hover { background: var(--hover); color: var(--text); }

/* ============================ VIEWS ============================ */

.view { flex: 1; min-width: 0; }
.view-section[hidden] { display: none !important; }

/* ---------------- hero ---------------- */

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #05080d;
}

.hero-bg { position: absolute; inset: 0; z-index: 0; }
.hero-bg img { width: 100%; height: 100%; object-fit: cover; object-position: center 62%; opacity: 1; }

.hero-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(100deg, rgba(6, 10, 16, 0.97) 0%, rgba(6, 10, 16, 0.93) 32%, rgba(6, 10, 16, 0.66) 62%, rgba(6, 10, 16, 0.26) 100%),
    linear-gradient(180deg, rgba(7, 11, 17, 0.4) 0%, rgba(7, 11, 17, 0.6) 52%, rgba(7, 11, 17, 0.95) 90%, #070b11 100%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 40px 34px 42px;
}

.hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 30px;
}

.pill {
  display: inline-block;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(147, 197, 253, 0.35);
  background: rgba(147, 197, 253, 0.07);
  color: #93c5fd;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.hero-title {
  margin: 0 0 12px;
  font-size: clamp(30px, 3.4vw, 46px);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.8px;
  max-width: 20ch;
}
.hero-title em { font-style: normal; color: var(--accent-text); }

.hero-sub {
  margin: 0;
  max-width: 52ch;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-2);
}

.hero-tagline {
  flex: none;
  padding-left: 22px;
  border-left: 1px solid var(--line-strong);
  text-align: right;
  font-family: var(--mono);
  padding-top: 6px;
}

.tagline-main {
  margin: 0 0 7px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.6px;
  color: var(--text);
}
.tagline-sub {
  margin: 0 0 0 auto;
  font-size: 9.5px;
  letter-spacing: 1.5px;
  line-height: 1.7;
  color: var(--muted);
  max-width: 26ch;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

/* ---------------- composer ---------------- */

.composer {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(13, 20, 31, 0.82);
  backdrop-filter: blur(10px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.composer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 0;
  border-bottom: 1px solid var(--line);
}

.tabs { display: flex; gap: 4px; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: -1px;
  transition: background 0.15s, color 0.15s;
}
.tab svg { width: 14px; height: 14px; }
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.text-btn svg { width: 13px; height: 13px; }
.text-btn:hover { color: var(--accent); }

.composer-body { padding: 14px 14px 0; }

.pane { position: relative; }

.seq {
  width: 100%;
  height: 168px;
  resize: vertical;
  min-height: 120px;
  padding: 14px 14px 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-3);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.75;
  outline: none;
  transition: border-color 0.15s;
}
.seq::placeholder { color: var(--placeholder); }
.seq:focus { border-color: var(--accent-line); }

.char-count {
  position: absolute;
  right: 12px;
  bottom: 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted-2);
  background: var(--panel-3);
  padding-left: 6px;
}
.char-count.is-full { color: var(--red); }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 168px;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel-3);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone svg { width: 22px; height: 22px; color: var(--muted); margin-bottom: 2px; }
.dropzone strong { color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.dropzone:hover, .dropzone.is-over { border-color: var(--accent-line); background: var(--accent-soft); }
.dropzone-browse {
  margin-top: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  font-size: 11.5px;
}

.file-note { margin: 10px 2px 0; font-size: 11.5px; color: var(--muted); }

.composer-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px 14px;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  transition: filter 0.15s, transform 0.08s;
}
.btn-primary svg { width: 15px; height: 15px; stroke-width: 1.9; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary.sm { padding: 9px 15px; font-size: 12.5px; }

.helper {
  margin: 0;
  flex: 1;
  min-width: 220px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------------- quick access ---------------- */

.quick {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(13, 20, 31, 0.72);
  backdrop-filter: blur(10px);
}

.quick-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 14px 10px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  font-size: 11.5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.quick-item svg { width: 19px; height: 19px; color: var(--text); }
.quick-item:hover { background: var(--accent-soft); color: var(--text); }
.quick-item:hover svg { color: var(--accent); }

.quick-note {
  margin: 0;
  padding: 10px 12px;
  font-size: 10px;
  line-height: 1.5;
  color: var(--muted-2);
}

/* ---------------- cases section ---------------- */

.cases-section {
  max-width: 1320px;
  margin: 0 auto;
  padding: 34px 34px 56px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.section-head h2, .page-head h2 {
  margin: 0 0 5px;
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.3px;
}

.section-head p, .page-head p { margin: 0; font-size: 12.5px; color: var(--muted); }

.section-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.section-tools.wide { margin-bottom: 20px; }

.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search svg {
  position: absolute;
  left: 11px;
  width: 14px;
  height: 14px;
  color: var(--muted-2);
  pointer-events: none;
}
.search input {
  width: 210px;
  padding: 9px 12px 9px 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.15s;
}
.search input::placeholder { color: var(--muted-2); }
.search input:focus { border-color: var(--accent-line); }

.select-wrap { position: relative; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.6px solid var(--muted);
  border-bottom: 1.6px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.select-wrap select {
  appearance: none;
  padding: 9px 30px 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
  outline: none;
}
.select-wrap select:focus { border-color: var(--accent-line); }
.select-wrap option { background: var(--panel-2); color: var(--text); }

.view-toggle {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { color: var(--text); background: var(--hover); }
.icon-btn.is-active { background: var(--accent-soft); color: var(--accent); }

/* ---------------- case cards ---------------- */

.case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.case-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  overflow: hidden;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.case-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.4);
}

.thumb {
  position: relative;
  height: 138px;
  background: #0b131c;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.thumb svg { width: 100%; height: 100%; stroke: none; }

.thumb-menu {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 12, 18, 0.7);
  color: var(--text-2);
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.thumb-menu svg { width: 14px; height: 14px; }
.thumb-menu:hover { color: var(--accent); border-color: var(--accent-line); }

.card-menu {
  position: absolute;
  top: 40px;
  right: 8px;
  z-index: 5;
  width: 168px;
  padding: 5px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  box-shadow: var(--shadow);
}
.card-menu button {
  display: block;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-2);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.card-menu button:hover { background: var(--hover); color: var(--text); }

.card-body { padding: 12px 13px 13px; display: flex; flex-direction: column; gap: 7px; flex: 1; }

.card-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}
.card-meta .sep { color: var(--muted-2); }

.card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 3px; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.tag[data-tone="red"] { border-color: rgba(248, 113, 113, 0.4); color: #fca5a5; background: rgba(248, 113, 113, 0.08); }
.tag[data-tone="amber"] { border-color: rgba(250, 204, 21, 0.4); color: #fde047; background: rgba(250, 204, 21, 0.07); }
.tag[data-tone="blue"] { border-color: rgba(96, 165, 250, 0.4); color: #93c5fd; background: rgba(96, 165, 250, 0.08); }
.tag[data-tone="grey"] { color: var(--text-2); background: var(--hover-soft); }
.tag[data-tone="live"] { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }

.view-all {
  display: block;
  margin-top: 16px;
  padding: 11px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.view-all:hover { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); }

/* list mode */
.case-grid.as-list { grid-template-columns: 1fr; }
.case-grid.as-list .case-card { flex-direction: row; align-items: stretch; }
.case-grid.as-list .thumb { width: 220px; height: auto; min-height: 118px; border-bottom: 0; border-right: 1px solid var(--line); flex: none; }
.case-grid.as-list .card-title { -webkit-line-clamp: 2; }

.empty {
  margin: 8px 0 0;
  padding: 26px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

/* ============================ PAGES ============================ */

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 30px 34px 64px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 12.5px;
  color: var(--muted);
}
.back-link:hover { color: var(--accent); }

/* case detail */
.detail {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  overflow: hidden;
}

.detail-hero { position: relative; height: 220px; border-bottom: 1px solid var(--line); background: #0b131c; }
.detail-hero svg { width: 100%; height: 100%; stroke: none; }

.detail-body { padding: 22px 24px 24px; }

.detail-title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.3px;
  line-height: 1.25;
}

.detail-meta {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
}

.detail-summary {
  margin: 0 0 18px;
  max-width: 78ch;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-2);
}

.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--hover-soft);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn-ghost:hover { border-color: var(--accent-line); color: var(--text); background: var(--accent-soft); }
.btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }

.pending {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--accent-line);
  background: var(--accent-soft);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 20px;
}
.pending code { font-family: var(--mono); font-size: 11px; color: var(--accent); }

.sub-head {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
}

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; }

.tl-item {
  display: grid;
  grid-template-columns: 92px 14px minmax(0, 1fr);
  gap: 12px;
  padding: 0 0 16px;
  position: relative;
}

.tl-item::before {
  content: "";
  position: absolute;
  left: 98px;
  top: 16px;
  bottom: -2px;
  width: 1px;
  background: var(--line-strong);
}
.tl-item:last-child::before { display: none; }

.tl-time {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent-text);
  padding-top: 1px;
  text-align: right;
}

.tl-dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.16);
}

.tl-text { font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--text-2); }
.tl-text b { color: var(--text); font-weight: 700; }

.tl-item.is-alert .tl-dot { background: var(--red); box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.16); }
.tl-item.is-alert .tl-text { color: var(--alert-text); }

/* stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

.stat {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
}
.stat span { display: block; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted-2); margin-bottom: 5px; }
.stat strong { font-size: 18px; font-weight: 750; letter-spacing: -0.3px; }

/* scatter/schematic */
.diagram {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #0a1119;
  overflow: hidden;
  margin-bottom: 22px;
}
.diagram svg { width: 100%; height: auto; display: block; stroke: none; }

/* exports */
.export-list { display: flex; flex-direction: column; gap: 10px; }

.export-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  flex-wrap: wrap;
}
.export-row strong { font-size: 13px; }
.export-row small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.export-actions { margin-left: auto; display: flex; gap: 7px; flex-wrap: wrap; }

/* settings */
.settings {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  overflow: hidden;
  max-width: 780px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.setting-row:last-child { border-bottom: 0; }
.setting-row strong { display: block; font-size: 13px; font-weight: 650; }
.setting-row small { color: var(--muted); font-size: 11.5px; }

.swatches { display: flex; gap: 7px; }
.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  background: #fbbf24;
}
.swatch[data-accent-opt="cyan"] { background: #38bdf8; }
.swatch[data-accent-opt="green"] { background: #34d399; }
.swatch.is-on { border-color: var(--text); }

.text-input {
  width: 130px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  outline: none;
  text-transform: uppercase;
}
.text-input:focus { border-color: var(--accent-line); }

.switch { position: relative; display: inline-block; width: 40px; height: 23px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute;
  inset: 0;
  background: var(--panel-3);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}
.switch span::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s, background 0.15s;
}
.switch input:checked + span { background: var(--accent-soft); border-color: var(--accent-line); }
.switch input:checked + span::after { transform: translateX(17px); background: var(--accent); }

/* ============================ DRAWER ============================ */

.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(3, 6, 10, 0.6);
  backdrop-filter: blur(2px);
}

.drawer[hidden], .drawer-scrim[hidden] { display: none !important; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  width: min(430px, 92vw);
  display: flex;
  flex-direction: column;
  background: var(--panel-2);
  border-left: 1px solid var(--line-strong);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h3 { margin: 0; font-size: 14px; font-weight: 700; }

.drawer-body { padding: 18px; overflow-y: auto; font-size: 13px; line-height: 1.65; color: var(--text-2); }
.drawer-body h4 { margin: 18px 0 8px; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.drawer-body h4:first-child { margin-top: 0; }
.drawer-body p { margin: 0 0 12px; }
.drawer-body ul { margin: 0 0 14px; padding-left: 18px; }
.drawer-body li { margin-bottom: 7px; }
.drawer-body code {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--hover);
  color: var(--accent);
}
.drawer-body pre {
  margin: 0 0 14px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--panel-3);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-2);
  overflow-x: auto;
  white-space: pre;
}
.drawer-body textarea {
  width: 100%;
  height: 130px;
  padding: 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-3);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}
.drawer-body textarea:focus { border-color: var(--accent-line); }

.example-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--panel);
}
.example-item div { min-width: 0; }
.example-item strong { display: block; font-size: 12.5px; color: var(--text); }
.example-item small { color: var(--muted); font-size: 11px; }

.kbd {
  display: inline-block;
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: var(--hover);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text);
  text-align: center;
}

/* ============================ TOAST ============================ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 18px);
  z-index: 200;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--accent-line);
  background: var(--toast-bg);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ============================ LIGHT THEME DETAILS ============================ */

html[data-theme="light"] .hero { background: #eef2f8; }
html[data-theme="light"] .hero-bg img { opacity: 0.3; }
html[data-theme="light"] .hero-veil {
  background:
    linear-gradient(100deg, rgba(248, 250, 253, 0.97) 0%, rgba(248, 250, 253, 0.92) 38%, rgba(248, 250, 253, 0.86) 100%),
    linear-gradient(180deg, rgba(248, 250, 253, 0.55) 0%, #f5f7fb 86%, #f5f7fb 100%);
}
html[data-theme="light"] .pill { color: #1d4ed8; border-color: rgba(29, 78, 216, 0.28); background: rgba(29, 78, 216, 0.07); }
html[data-theme="light"] .tag[data-tone="red"] { color: #b3261e; border-color: rgba(179, 38, 30, 0.32); background: rgba(179, 38, 30, 0.07); }
html[data-theme="light"] .tag[data-tone="amber"] { color: #8a5a00; border-color: rgba(138, 90, 0, 0.30); background: rgba(240, 162, 0, 0.10); }
html[data-theme="light"] .tag[data-tone="blue"] { color: #1d4ed8; border-color: rgba(29, 78, 216, 0.28); background: rgba(29, 78, 216, 0.07); }
html[data-theme="light"] .tag[data-tone="live"] { color: #8a5a00; }
html[data-theme="light"] .composer { background: rgba(255, 255, 255, 0.94); box-shadow: 0 18px 40px rgba(15, 23, 42, 0.10); }
html[data-theme="light"] .case-card { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05); }
html[data-theme="light"] .case-card:hover { box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12); }
html[data-theme="light"] .thumb-menu { background: rgba(255, 255, 255, 0.88); color: #33415a; border-color: rgba(15, 23, 42, 0.16); }
html[data-theme="light"] .menu,
html[data-theme="light"] .card-menu { background: #ffffff; }
html[data-theme="light"] .drawer { box-shadow: -24px 0 60px rgba(15, 23, 42, 0.18); }
html[data-theme="light"] .switch span { background: #e3e9f2; }
html[data-theme="light"] .detail,
html[data-theme="light"] .settings,
html[data-theme="light"] .export-row { background: #ffffff; }
html[data-theme="light"] .btn-ghost { background: #ffffff; border-color: rgba(15, 23, 42, 0.20); color: #26334a; }
html[data-theme="light"] .btn-ghost:hover { background: var(--accent-soft); color: #0f172a; }
html[data-theme="light"] .kbd { background: #eef2f8; color: #0f172a; }
html[data-theme="light"] .detail-hero,
html[data-theme="light"] .thumb,
html[data-theme="light"] .diagram { background: #0b131c; }

/* ============================ CASE STATES ============================ */

.case-card.is-soon .thumb svg { filter: grayscale(1) brightness(1.05); opacity: 0.62; }
.case-card.is-soon .thumb { background: #12161c; }
.case-card.is-soon .thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 16, 0.22);
}
.case-card.is-soon .card-title { color: var(--text-2); }

.case-card.is-soon .thumb::after {
  content: "Animation pending";
  position: absolute;
  left: 10px;
  bottom: 9px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 12, 18, 0.72);
  color: #cbd5e1;
  font-size: 9.5px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  white-space: nowrap;
  backdrop-filter: blur(3px);
}

.case-card.is-live .thumb::before {
  content: "▶";
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 8.5px;
  padding-left: 1px;
}

/* ============================ ANIMATION VIEWER ============================ */

.view-watch { max-width: none; padding: 16px 22px 34px; }

.watch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.watch-head .back-link { margin-bottom: 0; }
.watch-title { font-size: 12.5px; color: var(--muted); }

.watch-frame {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 190px);
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel-2);
}

.watch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
}
.watch-bar .watch-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.watch-frame iframe { flex: 1; width: 100%; border: 0; background: #0b1118; display: block; }

.watch-note {
  padding: 7px 12px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  background: var(--panel-3);
}

.watch-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex: 1;
  padding: 30px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.watch-player { position: relative; flex: 1; display: grid; place-items: center; overflow: hidden; background: #0b1118; }

.watch-player-art { position: absolute; inset: 0; opacity: 0.45; }
.watch-player-art svg { width: 100%; height: 100%; stroke: none; }
.watch-player-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 60% at 50% 50%, rgba(8, 12, 18, 0.55), rgba(8, 12, 18, 0.92));
}

.watch-player-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 26px 30px;
  text-align: center;
  border-radius: var(--radius);
  background: rgba(8, 12, 18, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(2px);
}

.play-btn {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  padding-left: 4px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 22px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.play-btn:hover { transform: scale(1.05); filter: brightness(1.06); }

.watch-player-title { margin: 10px 0 0; font-size: 14.5px; font-weight: 650; color: #f8fafc; max-width: 46ch; }
.watch-player-sub { margin: 0; font-size: 12px; color: #a9b6c7; }

@media (max-width: 620px) {
  .view-watch { padding: 12px 12px 28px; }
  .watch-frame { height: calc(100vh - 150px); min-height: 420px; }
}


/* ============================ LITE PREVIEW ============================ */

.lite {
  margin: 4px 0 22px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--accent-soft), transparent 70%);
  overflow: hidden;
}

.lite-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.lite-head p { margin: 0; font-size: 11.5px; color: var(--muted); line-height: 1.45; flex: 1 1 260px; }
.lite-head a { color: var(--accent-text); text-decoration: none; border-bottom: 1px solid var(--accent-line); }

.lite-frame { height: 460px; background: #070b11; }
.lite-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

.lite.is-muted {
  border-color: var(--line);
  background: var(--panel-2);
  padding: 12px 14px;
}
.lite.is-muted p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.lite.is-muted a { color: var(--accent-text); text-decoration: none; }

.btn-note { font-size: 11px; color: var(--muted-2); align-self: center; }

.docs-warn {
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.07);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-2);
}
.docs-warn b { color: #fca5a5; }
html[data-theme="light"] .docs-warn { background: rgba(185, 28, 28, 0.06); border-color: rgba(185, 28, 28, 0.25); }
html[data-theme="light"] .docs-warn b { color: #b3261e; }

@media (max-width: 720px) {
  .lite-frame { height: 380px; }
}

/* ============================ RESPONSIVE ============================ */

.only-mobile { display: none; }

@media (max-width: 1120px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .quick { flex-direction: row; }
  .quick-item { border-bottom: 0; border-right: 1px solid var(--line); }
  .quick-note { display: none; }
  .hero-tagline { display: none; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.5);
  }
  .sidebar.is-open { transform: translateX(0); }

  .only-mobile { display: grid; }

  .hero-inner { padding: 26px 18px 30px; }
  .cases-section, .page { padding-left: 18px; padding-right: 18px; }

  .top-links .top-link { padding: 7px 8px; font-size: 12px; }
  .search input { width: 160px; }
  .section-tools { width: 100%; }
  .search { flex: 1; }
  .search input { width: 100%; }
}

@media (max-width: 620px) {
  .hero-title { font-size: 30px; }
  .hero-head { margin-bottom: 22px; }
  .composer-head { padding: 8px 10px 0; gap: 6px; }
  .tab { padding: 7px 10px; font-size: 11.5px; white-space: nowrap; }
  .tab svg { display: none; }
  .text-btn { font-size: 11px; padding: 6px 4px; }
  .text-btn svg { display: none; }
  .seq { height: 188px; padding-bottom: 34px; }
  .composer-foot { flex-direction: column; align-items: stretch; }
  .btn-primary { justify-content: center; }
  .helper { min-width: 0; }
  .case-grid { grid-template-columns: 1fr; }
  .case-grid.as-list .thumb { width: 130px; }
  .top-links { display: none; }
  .tl-item { grid-template-columns: 66px 12px minmax(0, 1fr); }
  .tl-item::before { left: 72px; }
  .detail-body { padding: 18px; }
  .section-head { align-items: flex-start; }
  .section-tools { gap: 6px; flex-wrap: wrap; }
  .section-tools .search { flex: 1 1 100%; }
  .section-tools .select-wrap { flex: 1 1 auto; }
  .select-wrap select { width: 100%; font-size: 12px; padding: 8px 26px 8px 10px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
