/* Agency OS dashboard — design tokens first, then layout, components and pages.
   Light and dark are each selected (not inverted). Dark applies via prefers-color-scheme unless the toggle stamped
   data-theme="light", and always under data-theme="dark". */

:root {
  color-scheme: light;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 24px; --fs-3xl: 30px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-pill: 999px;
  --sidebar: 248px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f2f1ed;
  --surface-3: #e9e8e3;
  --border: #e3e2dc;
  --border-strong: #cdcbc3;
  --control: #85837b; /* form-control and switch outlines: >= 3:1 (WCAG 1.4.11) */
  --on-crit: #ffffff;
  --text: #16181d;
  --text-2: #484b53;
  --text-3: #686b73;
  --accent: #2456c7;
  --accent-hover: #1c46a6;
  --accent-soft: #e8eefb;
  --accent-ink: #1d4bb0;
  --on-accent: #ffffff;
  --focus: #2456c7;
  --ok: #17733a; --ok-soft: #e4f3e9; --ok-mark: #0ca30c;
  --warn: #855600; --warn-soft: #fdf2d8; --warn-mark: #fab219;
  --serious: #a3421b; --serious-soft: #fcebe2; --serious-mark: #ec835a;
  --crit: #b42323; --crit-soft: #fbe7e7; --crit-mark: #d03b3b;
  --shadow: 0 1px 2px rgba(16, 18, 24, .05), 0 1px 1px rgba(16, 18, 24, .03);
  --shadow-lg: 0 12px 32px rgba(16, 18, 24, .16);
  /* charts (dataviz reference palette, light steps) */
  --series-1: #2a78d6; --series-1-wash: rgba(42, 120, 214, .10);
  --grid: #e7e6e0; --axis: #c3c2b7; --tick: #6b6a64; --chart-surface: #ffffff;
  /* categorical identity (clients), fixed order, validated reference palette */
  --cat-1: #2a78d6; --cat-2: #eb6834; --cat-3: #1baf7a; --cat-4: #eda100; --cat-5: #e87ba4; --cat-6: #008300; --cat-7: #4a3aa7; --cat-8: #e34948;
  /* Ambient atmospheric background & guide variables */
  --ambient-glow-1: rgba(36, 86, 199, .06);
  --ambient-glow-2: rgba(24, 75, 176, .03);
  --ambient-dots: rgba(0, 0, 0, .04);
  --guide-bg: rgba(255, 255, 255, .88);
  --guide-border: rgba(36, 86, 199, .18);
  --watermark-opacity: .09;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1012; --surface: #17181b; --surface-2: #1e1f23; --surface-3: #27282d;
    --border: #2a2b30; --border-strong: #3b3c42; --control: #74757c; --on-crit: #1a0b0b;
    --text: #f2f2ef; --text-2: #c7c6bd; --text-3: #9d9c96;
    --accent: #7ea6ff; --accent-hover: #a1bdff; --accent-soft: #1b2745; --accent-ink: #a9c3ff; --on-accent: #0b1020;
    --focus: #8fb2ff;
    --ok: #5bd07c; --ok-soft: #13301d; --warn: #f3c453; --warn-soft: #362b0e;
    --serious: #f3a07a; --serious-soft: #3b2216; --crit: #ff8a8a; --crit-soft: #3d1818;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
    --series-1: #3987e5; --series-1-wash: rgba(57, 135, 229, .16);
    --grid: #2a2a2c; --axis: #3b3b3d; --tick: #9d9c96; --chart-surface: #17181b;
    --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --cat-4: #c98500; --cat-5: #d55181; --cat-6: #008300; --cat-7: #9085e9; --cat-8: #e66767;
    --ambient-glow-1: rgba(57, 135, 229, .15);
    --ambient-glow-2: rgba(126, 166, 255, .08);
    --ambient-dots: rgba(255, 255, 255, .06);
    --guide-bg: rgba(23, 24, 27, .90);
    --guide-border: rgba(126, 166, 255, .24);
    --watermark-opacity: .14;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1012; --surface: #17181b; --surface-2: #1e1f23; --surface-3: #27282d;
  --border: #2a2b30; --border-strong: #3b3c42; --control: #74757c; --on-crit: #1a0b0b;
  --text: #f2f2ef; --text-2: #c7c6bd; --text-3: #9d9c96;
  --accent: #7ea6ff; --accent-hover: #a1bdff; --accent-soft: #1b2745; --accent-ink: #a9c3ff; --on-accent: #0b1020;
  --focus: #8fb2ff;
  --ok: #5bd07c; --ok-soft: #13301d; --warn: #f3c453; --warn-soft: #362b0e;
  --serious: #f3a07a; --serious-soft: #3b2216; --crit: #ff8a8a; --crit-soft: #3d1818;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
  --series-1: #3987e5; --series-1-wash: rgba(57, 135, 229, .16);
  --grid: #2a2a2c; --axis: #3b3b3d; --tick: #9d9c96; --chart-surface: #17181b;
  --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --cat-4: #c98500; --cat-5: #d55181; --cat-6: #008300; --cat-7: #9085e9; --cat-8: #e66767;
  --ambient-glow-1: rgba(57, 135, 229, .15);
  --ambient-glow-2: rgba(126, 166, 255, .08);
  --ambient-dots: rgba(255, 255, 255, .06);
  --guide-bg: rgba(23, 24, 27, .90);
  --guide-border: rgba(126, 166, 255, .24);
  --watermark-opacity: .14;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: var(--fs-md)/1.5 var(--font); }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent-ink); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
img, video, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: var(--mono); font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: var(--r-sm); }
.skip:focus { left: 8px; }
.icon { flex: none; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------------ layout */
.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(to right, var(--surface) calc(var(--sidebar) - 1px), var(--border) 0 var(--sidebar), transparent 0); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface);
  border-right: 1px solid var(--border); overflow-y: auto; z-index: 40; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-4) var(--sp-4) var(--sp-2); }
.brand { display: flex; gap: var(--sp-3); align-items: center; text-decoration: none; color: var(--text); min-width: 0; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; font-weight: 700; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { font-size: var(--fs-xs); color: var(--text-3); }
.nav { padding: var(--sp-2) var(--sp-3) var(--sp-4); flex: 1; }
.nav-group + .nav-group { margin-top: var(--sp-3); }
.nav-heading { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3);
  padding: 0 var(--sp-3) var(--sp-1); }
.nav-link { display: flex; align-items: center; gap: var(--sp-3); padding: 6px var(--sp-3); border-radius: var(--r-sm);
  color: var(--text-2); text-decoration: none; font-weight: 500; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-ink); }
.nav-count { margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: var(--r-pill); background: var(--accent);
  color: var(--on-accent); font-size: var(--fs-xs); font-weight: 600; text-align: center; line-height: 20px; }
.sidebar-foot { display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-4); border-top: 1px solid var(--border); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center;
  font-size: var(--fs-xs); font-weight: 600; flex: none; }
.who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.who strong { font-size: var(--fs-sm); }
.who span { font-size: var(--fs-xs); color: var(--text-3); }
.content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(ellipse 700px 420px at 15% 0%, var(--ambient-glow-1) 0%, transparent 70%),
    radial-gradient(ellipse 800px 450px at 85% 100%, var(--ambient-glow-2) 0%, transparent 70%),
    radial-gradient(var(--ambient-dots) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 26px 26px;
  background-position: 0 0, 0 0, 0 0;
  background-repeat: no-repeat, no-repeat, repeat;
}
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: var(--sp-3); height: 56px;
  padding: 0 var(--sp-8); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent; }
.topbar-title { font-weight: 600; color: var(--text-2); display: none; }
.topbar-actions { margin-left: auto; display: flex; gap: var(--sp-2); }
.main {
  padding: var(--sp-2) var(--sp-8) var(--sp-8);
  max-width: 1320px;
  width: 100%;
  outline: none;
  animation: pageEnter 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.main.refreshing { opacity: .6; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, color .15s ease; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.menu-btn, .sidebar-close { display: none; }
.scrim { display: none; }

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; background: none; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-102%);
    transition: transform .22s var(--ease); box-shadow: var(--shadow-lg); visibility: hidden; }
  .menu-open .sidebar { transform: none; visibility: visible; }
  .menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 35; }
  .menu-btn, .sidebar-close { display: inline-grid; }
  .topbar { padding: 0 var(--sp-4); border-bottom-color: var(--border); background: var(--surface); }
  .topbar-title { display: block; }
  .main { padding: var(--sp-4); }
}

/* ------------------------------------------------------------------ Module Guide & Metadata Banner */
.page-header-container {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}
.page-header-container .page-head {
  margin: var(--sp-4) 0 var(--sp-2);
}

.module-guide-card {
  position: relative;
  border-radius: var(--r-lg);
  border: 1px solid var(--guide-border);
  background-color: var(--guide-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 14px 18px;
  box-shadow: 0 4px 20px -2px rgba(16, 18, 24, .05), var(--shadow);
  overflow: hidden;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.module-guide-card:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
  box-shadow: 0 6px 24px -2px rgba(16, 18, 24, .08), var(--shadow);
}

.module-guide-card.is-collapsed {
  padding: 9px 16px;
  background-color: var(--surface);
}

.guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.guide-head-left {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  min-width: 0;
}
.guide-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--r-pill);
}
.guide-title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.guide-collapsed-snippet {
  font-size: var(--fs-xs);
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 480px;
}
.guide-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
  margin-left: auto;
}
.guide-toggle-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.guide-summary {
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: 1.5;
  margin: 10px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.guide-body-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1.2fr);
  gap: var(--sp-5);
  animation: guideUnfold 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.guide-col {
  display: flex;
  flex-direction: column;
}
.guide-col-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  margin-bottom: 8px;
}
.guide-col-title strong {
  color: var(--text-2);
  font-weight: 600;
}

.guide-steps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.guide-step-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.guide-step-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.guide-step-number {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: none;
}
.guide-step-heading {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}
.guide-step-desc {
  font-size: var(--fs-xs);
  color: var(--text-2);
  line-height: 1.45;
  margin: 0;
}

.guide-expect-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0;
  padding: 0;
}
.guide-expect-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: var(--fs-xs);
  color: var(--text-2);
  line-height: 1.4;
}
.guide-expect-item .icon {
  color: var(--ok);
  margin-top: 2px;
  flex: none;
}

.guide-protip {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  font-size: var(--fs-xs);
  color: var(--text-2);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.45;
}
.guide-protip .icon {
  color: var(--accent-ink);
  margin-top: 1px;
  flex: none;
}
.guide-protip strong {
  color: var(--accent-ink);
}

/* ------------------------------------------------------------------ Thematic Module SVG Patterns */
.pattern-dashboard {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200' fill='none' stroke='%232456c7' stroke-width='1.5' stroke-opacity='0.12'%3E%3Ccircle cx='230' cy='60' r='90'/%3E%3Ccircle cx='230' cy='60' r='60'/%3E%3Ccircle cx='230' cy='60' r='30'/%3E%3Cpath d='M140 60h180M230-30v180M166 124l128-128M166-4l128 128' stroke-dasharray='4 4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right -20px top -20px; background-size: 260px auto;
}
.pattern-approvals {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200' fill='none' stroke='%2317733a' stroke-width='1.5' stroke-opacity='0.12'%3E%3Cpath d='M230 10l50 20v60c0 40-50 70-50 70s-50-30-50-70V30z'/%3E%3Cpath d='M210 75l15 15 30-30' stroke-width='2.5'/%3E%3Ccircle cx='230' cy='75' r='55' stroke-dasharray='5 5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right -15px top -15px; background-size: 250px auto;
}
.pattern-content {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200' fill='none' stroke='%232456c7' stroke-width='1.5' stroke-opacity='0.12'%3E%3Crect x='160' y='20' width='100' height='70' rx='8'/%3E%3Crect x='190' y='50' width='100' height='70' rx='8'/%3E%3Cpath d='M175 45h60M175 60h40M205 75h60M205 90h45'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right -15px top -10px; background-size: 240px auto;
}
.pattern-studio {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200' fill='none' stroke='%232456c7' stroke-width='1.5' stroke-opacity='0.12'%3E%3Crect x='160' y='20' width='120' height='80' rx='10'/%3E%3Ccircle cx='220' cy='60' r='24'/%3E%3Cpath d='M215 50l15 10-15 10z' fill='%232456c7' fill-opacity='0.15'/%3E%3Cpath d='M140 120h140M150 115v10M170 110v20M190 105v30M210 112v16M230 108v24M250 114v12M270 118v4' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right -10px top -10px; background-size: 250px auto;
}
.pattern-comments {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200' fill='none' stroke='%232456c7' stroke-width='1.5' stroke-opacity='0.12'%3E%3Cpath d='M240 30h-70a20 20 0 0 0-20 20v40a20 20 0 0 0 20 20h40l30 20v-20h0a20 20 0 0 0 20-20V50a20 20 0 0 0-20-20z'/%3E%3Ccircle cx='185' cy='70' r='4' fill='%232456c7' fill-opacity='0.3'/%3E%3Ccircle cx='205' cy='70' r='4' fill='%232456c7' fill-opacity='0.3'/%3E%3Ccircle cx='225' cy='70' r='4' fill='%232456c7' fill-opacity='0.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right -15px top -10px; background-size: 240px auto;
}
.pattern-clients {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200' fill='none' stroke='%232456c7' stroke-width='1.5' stroke-opacity='0.12'%3E%3Ccircle cx='220' cy='50' r='20'/%3E%3Cpath d='M190 100c0-20 15-30 30-30s30 10 30 30z'/%3E%3Ccircle cx='170' cy='65' r='14'/%3E%3Cpath d='M150 105c0-14 10-20 20-20s20 6 20 20z'/%3E%3Ccircle cx='270' cy='65' r='14'/%3E%3Cpath d='M250 105c0-14 10-20 20-20s20 6 20 20z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right -10px top -10px; background-size: 240px auto;
}
.pattern-campaigns {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200' fill='none' stroke='%232456c7' stroke-width='1.5' stroke-opacity='0.12'%3E%3Cpath d='M180 120V30l70 20-70 25z'/%3E%3Cpath d='M150 120h90M180 80l40 30' stroke-dasharray='4 4'/%3E%3Ccircle cx='250' cy='50' r='18' stroke-dasharray='3 3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right -15px top -15px; background-size: 240px auto;
}
.pattern-knowledge {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200' fill='none' stroke='%232456c7' stroke-width='1.5' stroke-opacity='0.12'%3E%3Cpath d='M170 120c15-10 35-10 50 0 15-10 35-10 50 0V40c-15-10-35-10-50 0-15-10-35-10-50 0z'/%3E%3Cpath d='M220 40v80M185 60h25M185 80h25M230 60h25M230 80h25'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right -10px top -10px; background-size: 240px auto;
}
.pattern-assets {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200' fill='none' stroke='%232456c7' stroke-width='1.5' stroke-opacity='0.12'%3E%3Crect x='160' y='25' width='110' height='80' rx='10'/%3E%3Ccircle cx='195' cy='55' r='12'/%3E%3Cpath d='M160 90l35-30 45 40 30-20'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right -15px top -15px; background-size: 240px auto;
}
.pattern-analytics {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200' fill='none' stroke='%232456c7' stroke-width='1.5' stroke-opacity='0.12'%3E%3Cpath d='M150 110h120M165 110V80M190 110V50M215 110V70M240 110V30' stroke-width='4'/%3E%3Cpath d='M165 80l25-30 25 20 25-40' stroke-width='2' stroke='%2317733a'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right -15px top -15px; background-size: 240px auto;
}
.pattern-costs {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200' fill='none' stroke='%232456c7' stroke-width='1.5' stroke-opacity='0.12'%3E%3Ccircle cx='220' cy='65' r='45'/%3E%3Ccircle cx='220' cy='65' r='30'/%3E%3Cpath d='M220 30v70M235 45h-25a12 12 0 0 0 0 24h18a12 12 0 0 1 0 24h-28' stroke-width='2'/%3E%3Cpath d='M140 110l40-20 40 10 50-40' stroke-dasharray='4 4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right -15px top -15px; background-size: 250px auto;
}
.pattern-agents {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200' fill='none' stroke='%232456c7' stroke-width='1.5' stroke-opacity='0.12'%3E%3Ccircle cx='220' cy='65' r='18'/%3E%3Ccircle cx='160' cy='35' r='10'/%3E%3Ccircle cx='160' cy='95' r='10'/%3E%3Ccircle cx='275' cy='40' r='10'/%3E%3Ccircle cx='275' cy='90' r='10'/%3E%3Cpath d='M169 41l35 16M169 89l35-16M236 57l30-12M236 73l30 12M160 45v40M275 50v30'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right -15px top -15px; background-size: 250px auto;
}
.pattern-automations {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200' fill='none' stroke='%232456c7' stroke-width='1.5' stroke-opacity='0.12'%3E%3Ccircle cx='220' cy='65' r='45'/%3E%3Cpath d='M220 35v30l20 15' stroke-width='2.5'/%3E%3Cpath d='M220 15v10M220 105v10M170 65h10M260 65h10' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right -15px top -15px; background-size: 240px auto;
}
.pattern-policies {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200' fill='none' stroke='%232456c7' stroke-width='1.5' stroke-opacity='0.12'%3E%3Cpath d='M220 20l45 18v35c0 30-35 50-45 55-10-5-45-25-45-55V38z'/%3E%3Cpath d='M210 65l10 10 20-20' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right -15px top -15px; background-size: 230px auto;
}
.pattern-health {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200' fill='none' stroke='%2317733a' stroke-width='2' stroke-opacity='0.12'%3E%3Cpath d='M140 70h30l10-25 15 50 15-40 10 25 10-15 10 5h30'/%3E%3Ccircle cx='220' cy='70' r='55' stroke-width='1' stroke-dasharray='4 4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right -15px top -15px; background-size: 240px auto;
}
.pattern-settings {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200' fill='none' stroke='%232456c7' stroke-width='1.5' stroke-opacity='0.12'%3E%3Ccircle cx='225' cy='65' r='20'/%3E%3Cpath d='M225 35v8M225 87v8M195 65h8M247 65h8M204 44l6 6M240 80l6 6M204 86l6-6M240 50l6-6' stroke-width='3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right -15px top -15px; background-size: 240px auto;
}
.pattern-calendar {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200' fill='none' stroke='%232456c7' stroke-width='1.5' stroke-opacity='0.12'%3E%3Crect x='160' y='25' width='110' height='85' rx='8'/%3E%3Cpath d='M160 50h110M190 18v14M240 18v14M185 70h15M220 70h15M185 90h15M220 90h15'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right -15px top -15px; background-size: 240px auto;
}
.pattern-research {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200' fill='none' stroke='%232456c7' stroke-width='1.5' stroke-opacity='0.12'%3E%3Ccircle cx='215' cy='60' r='35'/%3E%3Cpath d='M242 87l35 35M195 60h40M215 40v40'/%3E%3Ccircle cx='215' cy='60' r='55' stroke-dasharray='5 5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right -15px top -15px; background-size: 240px auto;
}
.pattern-competitors {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200' fill='none' stroke='%232456c7' stroke-width='1.5' stroke-opacity='0.12'%3E%3Cpath d='M170 65s25-35 55-35 55 35 55 35-25 35-55 35-55-35-55-35z'/%3E%3Ccircle cx='225' cy='65' r='18'/%3E%3Ccircle cx='225' cy='65' r='8' fill='%232456c7' fill-opacity='0.2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right -15px top -15px; background-size: 240px auto;
}

@media (max-width: 960px) {
  .guide-body-grid { grid-template-columns: 1fr; }
  .guide-steps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-collapsed-snippet { display: none; }
}
@media (max-width: 640px) {
  .guide-steps-grid { grid-template-columns: 1fr; }
  .module-guide-card { padding: 12px; }
  .guide-head { flex-direction: column; align-items: stretch; }
  .guide-toggle-btn { margin-left: 0; justify-content: center; }
}

/* ------------------------------------------------------------------ page head & grid */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap;
  margin: var(--sp-4) 0 var(--sp-5); }
.page-title { font-size: var(--fs-2xl); line-height: 1.25; letter-spacing: -.01em; outline: none; }
.page-sub { color: var(--text-3); margin-top: 2px; }
.page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.grid { display: grid; gap: var(--sp-4); align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.stack > * + * { margin-top: var(--sp-4); }
.row { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }

/* ------------------------------------------------------------------ cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow);
  min-width: 0; transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease); }
.card:hover { border-color: var(--border-strong); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5) 0; flex-wrap: wrap; }
.card-title { font-size: var(--fs-lg); font-weight: 600; }
.card-sub { font-size: var(--fs-sm); color: var(--text-3); }
.card-actions { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.card-body { padding: var(--sp-4) var(--sp-5) var(--sp-5); }
.card-body > .table-wrap { margin: 0 calc(-1 * var(--sp-5)); width: calc(100% + 2 * var(--sp-5)); border-radius: 0; border-left: 0; border-right: 0; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1240px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 620px) { .kpis, .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-4);
  box-shadow: var(--shadow); text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 6px; min-width: 0;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease); }
a.kpi:hover, .kpi:hover { border-color: var(--border-strong); color: var(--text); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(16, 18, 24, .06), var(--shadow); }
.kpi-label { font-size: var(--fs-sm); color: var(--text-2); }
.kpi-value { font-size: var(--fs-3xl); font-weight: 600; line-height: 1.1; letter-spacing: -.01em; }
.kpi-value small { font-size: var(--fs-md); font-weight: 500; color: var(--text-3); margin-left: 4px; }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-xs);
  color: var(--text-3); min-height: 28px; }
.kpi.is-warn { border-color: color-mix(in srgb, var(--warn-mark) 55%, var(--border)); }

/* ------------------------------------------------------------------ buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: var(--r-sm); border: 1px solid transparent; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s; }
.btn-sm { height: 30px; padding: 0 10px; font-size: var(--fs-sm); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); border-color: var(--control); color: var(--text); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--crit); color: var(--on-crit); }
.btn-danger-ghost { background: transparent; color: var(--crit); border-color: color-mix(in srgb, var(--crit) 40%, transparent); }
.btn-danger-ghost:hover { background: var(--crit-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-ink); cursor: pointer; font-size: var(--fs-sm); text-decoration: underline; text-underline-offset: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field .label-text { font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); }
.hint { font-size: var(--fs-xs); color: var(--text-3); }
.input, textarea.input { width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid var(--control);
  border-radius: var(--r-sm); background: var(--surface); color: var(--text); }
textarea.input { min-height: 88px; resize: vertical; line-height: 1.45; }
.input:hover { border-color: var(--text-3); }
.filters { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: flex-end; margin-bottom: var(--sp-4); }
.filters .field { width: 200px; }
.filters .field.grow { flex: 1; min-width: 200px; width: auto; }
.filters .field.auto { width: auto; }
@media (max-width: 620px) { .filters .field { width: calc(50% - var(--sp-2)); } .filters .field.grow, .filters .field.auto { width: 100%; } }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
@media (max-width: 620px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.switch { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; position: relative; }
.switch input { position: absolute; opacity: 0; width: 40px; height: 22px; margin: 0; cursor: pointer; }
.switch-track { width: 40px; height: 22px; border-radius: var(--r-pill); background: var(--surface-3); border: 1px solid var(--control);
  position: relative; transition: background .15s; flex: none; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s var(--ease); }
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch.is-disabled { opacity: .55; cursor: not-allowed; }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.seg { white-space: nowrap; border: 0; background: transparent; padding: 6px 12px; cursor: pointer; color: var(--text-2); font-size: var(--fs-sm); }
.seg + .seg { border-left: 1px solid var(--border); }
.seg[aria-checked="true"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.chip { border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--r-pill); padding: 4px 12px;
  font-size: var(--fs-sm); cursor: pointer; color: var(--text-2); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tag { display: inline-block; padding: 1px 8px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-2);
  font-size: var(--fs-xs); border: 1px solid var(--border); }

/* ------------------------------------------------------------------ badges, dots, notices */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; line-height: 20px; }
.badge-neutral { background: var(--surface-2); color: var(--text-2); }
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-serious { background: var(--serious-soft); color: var(--serious); }
.badge-crit { background: var(--crit-soft); color: var(--crit); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px var(--surface); }
.notice { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  background: var(--accent-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.notice .icon { color: var(--accent-ink); margin-top: 2px; }
.notice-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn-mark) 45%, transparent); }
.notice-warn .icon { color: var(--warn); }
.notice-crit { background: var(--crit-soft); border-color: color-mix(in srgb, var(--crit) 35%, transparent); }
.notice-crit .icon { color: var(--crit); }

/* ------------------------------------------------------------------ states */
.state { display: flex; gap: var(--sp-3); align-items: center; justify-content: center; flex-direction: column; text-align: center;
  padding: var(--sp-8) var(--sp-4); color: var(--text-2); }
.state-title { font-weight: 600; color: var(--text); }
.state-text { color: var(--text-3); max-width: 46ch; }
.state-loading { flex-direction: row; color: var(--text-3); }
.state-error { flex-direction: row; text-align: left; justify-content: flex-start; align-items: flex-start; background: var(--crit-soft);
  border-radius: var(--r-md); padding: var(--sp-4); }
.state-error .icon { color: var(--crit); margin-top: 2px; }
.state-error .btn { margin-top: var(--sp-2); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes guideUnfold {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulseBeacon {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.55; }
}
@keyframes shimmerWave {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 20%, var(--surface-3) 45%, var(--surface-2) 70%);
  background-size: 250% 100%;
  animation: shimmerWave 2s infinite linear;
  margin: 10px 0;
}
.dot-live {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
  animation: pulseBeacon 2.2s infinite ease-in-out;
}

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; font-weight: 600; color: var(--text-3); font-size: var(--fs-xs); text-transform: uppercase;
  letter-spacing: .04em; padding: 10px var(--sp-4); border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); }
.table td { padding: 10px var(--sp-4); border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .wrap { min-width: 220px; }
.cell-main { font-weight: 500; color: var(--text); }
.cell-sub { font-size: var(--fs-xs); color: var(--text-3); }
@media (max-width: 760px) {
  .table.stacked thead { display: none; }
  .table.stacked tr { display: block; padding: var(--sp-2) 0; border-bottom: 1px solid var(--border); }
  .table.stacked td { display: flex; justify-content: space-between; gap: var(--sp-3); border: 0; padding: 4px var(--sp-4); text-align: right; }
  .table.stacked td::before { content: attr(data-label); color: var(--text-3); font-size: var(--fs-xs); text-align: left;
    flex: none; max-width: 40%; }
  .table.stacked td > .cell-v { min-width: 0; flex: 1; overflow-wrap: anywhere; }
  .table.stacked .cell-v .input { min-width: 0; max-width: 100%; }
  .table.stacked td.wrap { display: block; text-align: left; min-width: 0; }
  .table.stacked td.wrap::before { display: block; max-width: none; margin-bottom: 2px; }
  .table.stacked .row { justify-content: flex-end; }
  .table-wrap { overflow-x: visible; }
}
.pager { display: flex; justify-content: center; align-items: center; gap: var(--sp-3); margin-top: var(--sp-4); font-size: var(--fs-sm); }

/* ------------------------------------------------------------------ lists */
.list > li { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; padding-bottom: 0; }
.list > li:first-child { padding-top: 0; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
a.list-title { color: var(--accent-ink); text-decoration: underline; text-decoration-thickness: 1px; }
a.list-title:hover { color: var(--accent-hover); }
a.btn, a.btn:hover { text-decoration: none; }
a.btn-primary, a.btn-primary:hover { color: var(--on-accent); }
a.btn-secondary, a.btn-secondary:hover { color: var(--text); }
.list-meta { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; overflow-wrap: anywhere; }
.list-meta .badge { vertical-align: middle; }
.att-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.att-critical { background: var(--crit-soft); color: var(--crit); }
.att-serious { background: var(--serious-soft); color: var(--serious); }
.att-warning { background: var(--warn-soft); color: var(--warn); }
.feed > li { align-items: center; }
.feed-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.feed-succeeded { background: var(--ok-soft); color: var(--ok); }
.feed-failed { background: var(--crit-soft); color: var(--crit); }
.feed-running { background: var(--accent-soft); color: var(--accent-ink); }
.feed-time { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-3); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok-mark); box-shadow: 0 0 0 3px var(--ok-soft); }
.live.paused::before { background: var(--text-3); box-shadow: none; }
.thumb { width: 52px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--surface-2); flex: none; border: 1px solid var(--border); }
.thumb-empty { display: grid; place-items: center; color: var(--text-3); }

/* ------------------------------------------------------------------ approvals & media */
.approval { display: grid; grid-template-columns: minmax(220px, 340px) minmax(0, 1fr); gap: 0; overflow: hidden; }
.approval + .approval { margin-top: var(--sp-4); }
@media (max-width: 760px) { .approval { grid-template-columns: minmax(0, 1fr); } }
.approval-media { background: var(--surface-2); border-right: 1px solid var(--border); padding: var(--sp-4); }
@media (max-width: 760px) { .approval-media { border-right: 0; border-bottom: 1px solid var(--border); } }
.approval-body { padding: var(--sp-4) var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.approval-title { font-size: var(--fs-lg); font-weight: 600; overflow-wrap: anywhere; }
.caption { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.hook { font-weight: 600; }
.qa-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
@media (max-width: 520px) { .qa-list { grid-template-columns: minmax(0, 1fr); } }
.qa-item { border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); min-width: 0; }
.qa-item p { color: var(--text-3); font-size: var(--fs-xs); margin-top: 2px; overflow-wrap: anywhere; }
.actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; padding-top: var(--sp-3); border-top: 1px solid var(--border); margin-top: auto; }
.media-viewer { position: relative; }
.media-frame { background: var(--surface-3); border-radius: var(--r-md); overflow: hidden; display: grid; place-items: center; }
.media-frame img, .media-frame video { width: 100%; height: auto; max-height: 420px; object-fit: contain; }
.media-nav { display: flex; justify-content: space-between; align-items: center; margin-top: var(--sp-2); font-size: var(--fs-xs); color: var(--text-3); }
.media-strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px; }
.media-strip button { border: 2px solid transparent; border-radius: 6px; padding: 0; background: none; cursor: pointer; flex: none; }
.media-strip button[aria-current="true"] { border-color: var(--accent); }
.media-strip img { width: 40px; height: 50px; object-fit: cover; border-radius: 4px; }
.vtag { position: absolute; top: 8px; left: 8px; }

/* ------------------------------------------------------------------ gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--sp-3); }
.tile { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; cursor: pointer;
  text-align: left; padding: 0; display: flex; flex-direction: column; color: var(--text); }
.tile:hover { border-color: var(--border-strong); }
.tile-img { aspect-ratio: 4 / 5; background: var(--surface-2); width: 100%; object-fit: cover; }
.tile-body { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); min-width: 0; }
.tile-body strong { display: block; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; background: var(--border); gap: 1px; }
.cal-head { background: var(--surface-2); padding: 8px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.cal-day { background: var(--surface); min-height: 120px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-week .cal-day { min-height: 360px; }
.cal-day.other { background: var(--surface-2); }
.cal-day.today .cal-num { background: var(--accent); color: var(--on-accent); }
.cal-num { font-size: var(--fs-xs); font-weight: 600; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); }
.cal-item { display: block; border-radius: 6px; padding: 4px 6px; background: var(--surface-2); border-left: 3px solid var(--c, var(--accent));
  text-decoration: none; color: var(--text); font-size: var(--fs-xs); line-height: 1.35; min-width: 0; }
.cal-item:hover { background: var(--surface-3); color: var(--text); }
.cal-item .t { color: var(--text-3); font-variant-numeric: tabular-nums; }
.cal-item .n { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item .n { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.cal-month .cal-item .n { -webkit-line-clamp: 1; }
.cal-item .who { font-weight: 600; color: var(--text-2); }
.cal-item .done { display: inline-flex; vertical-align: -2px; color: var(--ok); }
.cal-more { border: 0; background: none; cursor: pointer; text-align: left; text-decoration: underline; color: var(--accent-ink); }
.cal-count { display: none; }
@media (max-width: 760px) {
  .cal-month .cal-item, .cal-month .cal-more { display: none; }
  .cal-month .cal-day { min-height: 64px; padding: 4px; }
  .cal-count { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px;
    border: 1px solid var(--control); background: var(--accent-soft); color: var(--accent-ink); border-radius: 8px;
    font-weight: 600; font-size: var(--fs-sm); cursor: pointer; padding: 0; }
}
.cal-more { font-size: var(--fs-xs); color: var(--text-3); padding-left: 6px; }
.cal-legend { display: flex; gap: var(--sp-4); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-2); margin-top: var(--sp-3); }
.cal-legend span { display: inline-flex; gap: 6px; align-items: center; }

/* Enhanced Marketing Calendar */
.cal-day { position: relative; transition: background 0.15s ease; }
.cal-day:hover { background: var(--surface-hover, var(--surface-2)); }
.cal-day-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.cal-add-btn { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 4px; border: 1px dashed var(--border); background: transparent; color: var(--text-3); cursor: pointer; opacity: 0.35; transition: all 0.15s ease; padding: 0; }
.cal-day:hover .cal-add-btn { opacity: 1; border-color: var(--accent); color: var(--accent); background: var(--accent-soft, rgba(99, 102, 241, 0.08)); }
.cal-day-empty-hint { display: none; margin-top: auto; padding: 4px; border-radius: 4px; border: 1px dashed var(--border); background: var(--surface); color: var(--text-3); font-size: 11px; text-align: center; cursor: pointer; transition: all 0.15s ease; }
.cal-day:hover .cal-day-empty-hint { display: block; }
.cal-day-empty-hint:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft, rgba(99, 102, 241, 0.1)); }

.cal-item { position: relative; cursor: pointer; transition: transform 0.12s ease, box-shadow 0.12s ease; }
.cal-item:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,0.12); }
.cal-item-media-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; padding: 1px 4px; border-radius: 3px; background: rgba(0,0,0,0.3); color: #fff; margin-left: 4px; }

/* Calendar Hover Popover */
.cal-popover { position: fixed; z-index: 1050; width: 340px; max-width: calc(100vw - 24px); max-height: calc(100vh - 24px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: 0 16px 36px rgba(0,0,0,0.32); padding: var(--sp-3); pointer-events: auto; animation: calPopIn 0.15s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes calPopIn { from { opacity: 0; transform: scale(0.96) translateY(4px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.cal-popover-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: var(--sp-2); }
.cal-popover-media { width: 100%; max-height: 190px; border-radius: var(--r-md); overflow: hidden; background: #000; margin-bottom: var(--sp-2); display: flex; align-items: center; justify-content: center; }
.cal-popover-media img, .cal-popover-media video { width: 100%; max-height: 190px; object-fit: contain; }
.cal-popover-no-media { width: 100%; padding: var(--sp-3); border-radius: var(--r-md); background: var(--surface-2); border: 1px dashed var(--border); color: var(--text-3); font-size: var(--fs-xs); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: var(--sp-2); }
.cal-popover-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text); margin: 0 0 4px 0; line-height: 1.3; }
.cal-popover-hook { font-size: var(--fs-xs); color: var(--text-2); margin-bottom: 4px; }
.cal-popover-caption { font-size: var(--fs-xs); color: var(--text-3); line-height: 1.35; margin-bottom: var(--sp-3); max-height: 60px; overflow-y: auto; }
.cal-popover-actions { display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: var(--sp-2); }
.cal-modal-preview-box { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-3); background: var(--surface-2); margin-bottom: var(--sp-3); }
.agenda .agenda-day { padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
.agenda h3 { font-size: var(--fs-sm); color: var(--text-2); margin-bottom: var(--sp-2); }
.agenda .cal-item { margin-bottom: 4px; font-size: var(--fs-sm); }

/* ------------------------------------------------------------------ detail */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: var(--sp-4); overflow-x: auto; }
.tab { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--text-3); font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px var(--sp-4); font-size: var(--fs-sm); }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.diff ins { background: var(--ok-soft); color: var(--ok); text-decoration: none; border-radius: 3px; padding: 0 2px; }
.diff del { background: var(--crit-soft); color: var(--crit); border-radius: 3px; padding: 0 2px; }
.version { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-4); }
.version + .version { margin-top: var(--sp-3); }
.timeline > li { position: relative; padding: 0 0 var(--sp-4) var(--sp-5); border-left: 2px solid var(--border); margin-left: 6px; }
.timeline > li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent); }
.timeline > li:last-child { border-left-color: transparent; }
.swatches { display: flex; gap: 6px; }
.swatch { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border); }
.client-card { display: flex; flex-direction: column; gap: var(--sp-3); text-decoration: none; color: var(--text); padding: var(--sp-4) var(--sp-5); }
a.client-card:hover { color: var(--text); }
.card:has(> .client-card:hover) { border-color: var(--border-strong); }
.stat-row { display: flex; gap: var(--sp-5); flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-2); }
.stat-row strong { display: block; font-size: var(--fs-xl); color: var(--text); font-weight: 600; }

/* ------------------------------------------------------------------ charts */
.chart { width: 100%; position: relative; }
.chart-svg { overflow: visible; outline: none; }
.chart-svg:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.chart-svg .grid { stroke: var(--grid); stroke-width: 1; }
.chart-svg .axis { stroke: var(--axis); stroke-width: 1; }
.chart-svg .limit { stroke: var(--crit-mark); stroke-width: 1; }
.chart-svg .tick { fill: var(--tick); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-svg .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .area { fill: var(--series-1-wash); }
.chart-svg .end-dot { fill: var(--series-1); stroke: var(--chart-surface); stroke-width: 2; }
.chart-svg .crosshair { stroke: var(--axis); stroke-width: 1; }
.chart-svg .bar { fill: var(--series-1); }
.chart-svg .hit { fill: transparent; }
.chart-svg .col:hover .bar { fill: color-mix(in srgb, var(--series-1) 80%, var(--chart-surface)); }
.chart-tip { position: fixed; z-index: 90; pointer-events: none; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); border-radius: 8px; padding: 6px 10px; display: flex; flex-direction: column; font-size: var(--fs-xs); color: var(--text-2); }
.chart-tip strong { font-size: var(--fs-md); color: var(--text); }
.chart-foot { display: flex; justify-content: flex-end; margin-top: var(--sp-2); }
.spark-line { fill: none; stroke: var(--series-1); stroke-width: 1.5; }
.spark-dot { fill: var(--series-1); }
.barlist { display: flex; flex-direction: column; gap: 10px; }
.barlist-row { display: grid; grid-template-columns: minmax(80px, 30%) minmax(0, 1fr) auto; gap: var(--sp-3); align-items: center;
  font-size: var(--fs-sm); border-radius: 4px; }
.barlist-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.barlist-track { height: 10px; }
.barlist-bar { display: block; height: 10px; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.barlist-row:hover .barlist-bar, .barlist-row:focus-visible .barlist-bar { background: color-mix(in srgb, var(--series-1) 80%, var(--surface)); }
.barlist-value { font-variant-numeric: tabular-nums; text-align: right; color: var(--text); min-width: 56px; }
.meter { height: 8px; border-radius: var(--r-pill); overflow: hidden; }
/* fills use the text-strength step so fill vs track stays >= 3:1 in both themes */
.meter { border: 1px solid var(--control); }
.meter-ok { background: var(--ok-soft); } .meter-ok .meter-fill { background: var(--ok); }
.meter-warn { background: var(--warn-soft); } .meter-warn .meter-fill { background: var(--warn); }
.meter-crit { background: var(--crit-soft); } .meter-crit .meter-fill { background: var(--crit); }
.meter-fill { display: block; height: 100%; border-radius: var(--r-pill); }

/* ------------------------------------------------------------------ dialogs & toasts */
.dialog { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 0; width: min(520px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.dialog-wide { width: min(900px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(10, 12, 16, .5); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-4) var(--sp-5) 0; }
.dialog-head h2 { font-size: var(--fs-lg); }
.dialog-body { padding: var(--sp-4) var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); }
.dialog-foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: 0 var(--sp-5) var(--sp-5); flex-wrap: wrap; }
.toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: calc(100vw - 32px); }
.toast { display: flex; gap: 8px; align-items: center; background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); font-size: var(--fs-sm); transition: opacity .3s, transform .3s; }
.toast-crit { background: var(--crit); color: var(--on-crit); }
.toast-close { margin-left: 4px; border: 0; background: transparent; color: inherit; cursor: pointer; display: grid;
  place-items: center; width: 28px; height: 28px; border-radius: 6px; }
.toast-close:hover { background: rgba(255, 255, 255, .15); }
.field-error { font-size: var(--fs-sm); color: var(--crit); }
.field-error:empty { display: none; }
[aria-invalid="true"] { border-color: var(--crit) !important; }
.toast.out { opacity: 0; transform: translateY(6px); }
.copy-box { display: flex; gap: var(--sp-2); }
.copy-box .input { font-family: var(--mono); font-size: var(--fs-xs); }

/* ------------------------------------------------------------------ sign in */
.signin {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  position: relative;
  overflow: hidden;
  background-color: var(--bg);
  background-image: 
    radial-gradient(ellipse 800px 500px at 50% 12%, var(--ambient-glow-1) 0%, transparent 75%),
    radial-gradient(ellipse 700px 450px at 80% 90%, var(--ambient-glow-2) 0%, transparent 75%),
    radial-gradient(var(--ambient-dots) 1.2px, transparent 1.2px);
  background-size: 100% 100%, 100% 100%, 28px 28px;
}
.signin::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100' fill='none' stroke='%232456c7' stroke-width='0.5' stroke-opacity='0.12'%3E%3Cpath d='M0 50h100M50 0v100M25 0l50 100M75 0L25 100M0 25l100 50M0 75l100-50'/%3E%3Ccircle cx='50' cy='50' r='2.5' fill='%232456c7' fill-opacity='0.25'/%3E%3C/svg%3E");
  opacity: 0.7;
  pointer-events: none;
}
.signin-card {
  position: relative;
  z-index: 2;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: var(--sp-8);
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg), 0 0 50px rgba(36, 86, 199, .12);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  animation: pageEnter 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.signin-card h1 { font-size: var(--fs-xl); }
.signin-card ol { list-style: decimal; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; color: var(--text-2); }
.passage { border-left: 3px solid var(--accent); padding: var(--sp-2) var(--sp-3); background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.passage + .passage { margin-top: var(--sp-3); }
.comment { padding: var(--sp-4) var(--sp-5); }
.comment + .comment { border-top: 1px solid var(--border); }
.comment-text { margin: var(--sp-2) 0; overflow-wrap: anywhere; }
.source-list { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); }
.ext { display: inline-flex; gap: 4px; align-items: center; overflow-wrap: anywhere; }
.ext .icon { flex: none; }
.scores { display: flex; gap: var(--sp-4); font-size: var(--fs-xs); color: var(--text-3); flex-wrap: wrap; }
.scores strong { color: var(--text); font-size: var(--fs-sm); }
.card-body > .table-wrap:last-child { margin-bottom: calc(-1 * var(--sp-5)); border-bottom: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card-body > div > .table-wrap:only-child { margin: 0; }
.table .input { min-width: 150px; width: auto; }

/* touch targets on phones and touch screens (WCAG 2.5.5 guidance: 44px) */
@media (max-width: 760px), (pointer: coarse) {
  .btn, .icon-btn { min-height: 44px; }
  .icon-btn { min-width: 44px; }
  .btn-sm { min-height: 44px; }
  .input { min-height: 44px; }
  .nav-link { padding-top: 11px; padding-bottom: 11px; }
  .chip, .seg { min-height: 44px; }
  .switch { min-height: 44px; }
  .media-strip button { min-width: 44px; min-height: 54px; }
  .link-btn { min-height: 44px; }
}

/* ------------------------------------------------------------------ review round */
.feed-summary { font-size: var(--fs-sm); color: var(--text-2); overflow-wrap: anywhere; }
.feed-summary.is-problem, .feed-summary.is-problem a { color: var(--crit); }
.qa-ok { display: flex; gap: 6px; align-items: center; color: var(--ok); font-weight: 600; font-size: var(--fs-sm); }
.qa-block > * + * { margin-top: var(--sp-2); }
@media (max-width: 760px) {
  .approval-body .actions { order: 1; margin-top: 0; }
  .approval-body .qa-block { order: 2; }
}
.inline-review { margin-bottom: var(--sp-5); }
.section-title { font-size: var(--fs-lg); margin-bottom: var(--sp-3); }
details.tech { margin-top: 6px; font-size: var(--fs-sm); }
details.tech summary { cursor: pointer; color: var(--accent-ink); min-height: 24px; }
details.tech[open] summary { margin-bottom: 6px; }
code.detail { display: block; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-xs); padding: 6px 8px; }
.bullets { list-style: disc; padding-left: 18px; }
.bullets li + li { margin-top: 2px; }
.agenda .cal-item { margin-bottom: 6px; }

/* ------------------------------------------------------------------ client form */
.cf-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--sp-6); align-items: start; margin-top: var(--sp-4); }
.cf-steps { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 2px; }
.cf-step { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); text-align: left; border: 0;
  background: transparent; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; color: var(--text-2); font-size: var(--fs-sm); }
.cf-step:hover { background: var(--surface-2); }
.cf-step[aria-current="step"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.cf-step-select { display: none; }
.cf-sections > * + * { margin-top: var(--sp-5); }
.cf-section { scroll-margin-top: 72px; }
.cf-section > h2 { font-size: var(--fs-lg); margin-bottom: 2px; }
.cf-why { color: var(--text-3); font-size: var(--fs-sm); margin-bottom: var(--sp-3); }
.cf-fields > * + * { margin-top: var(--sp-4); }
.cf-row { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); background: var(--surface-2); }
.cf-row + .cf-row { margin-top: var(--sp-3); }
.cf-row-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.cf-row-title { font-weight: 600; font-size: var(--fs-sm); }
.cf-removed { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); flex-wrap: wrap; border: 1px dashed var(--border-strong);
  border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); color: var(--text-2); font-size: var(--fs-sm); }
.cf-yaml { white-space: pre; overflow: auto; max-height: 420px; font-family: var(--mono); font-size: var(--fs-xs); padding: var(--sp-3);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); tab-size: 2; }
.cf-errors { border: 1px solid color-mix(in srgb, var(--crit) 35%, transparent); background: var(--crit-soft); border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4); }
.cf-errors ul { margin: 6px 0 0; padding-left: 18px; }
.cf-errors a { color: var(--crit); }
.cf-badge { min-width: 18px; text-align: center; background: var(--crit); color: var(--on-crit); border-radius: var(--r-pill); font-size: 11px;
  padding: 0 6px; line-height: 18px; }
@media (max-width: 700px) {
  .cf-layout { grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
  .cf-steps { display: none; }
  .cf-step-select { display: block; position: sticky; top: 60px; z-index: 5; }
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 38px; padding: 5px 8px; border: 1px solid var(--control);
  border-radius: var(--r-sm); background: var(--surface); cursor: text; }
.tags:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.tag-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 10px; border-radius: var(--r-pill); background: var(--surface-2);
  border: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text); }
.tag-x { display: inline-flex; border: 0; background: transparent; cursor: pointer; color: var(--text-3); padding: 3px; border-radius: 50%; }
.tag-x:hover { color: var(--crit); background: var(--crit-soft); }
.tags-input { flex: 1; min-width: 140px; border: 0; outline: 0; background: transparent; color: var(--text); padding: 4px 2px; font: inherit; }
.tags-field .field-error { margin-top: 4px; }
.color-add { display: flex; gap: var(--sp-2); align-items: center; margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--text-2); }
.color-add input[type="color"] { width: 40px; height: 32px; padding: 0; border: 1px solid var(--control); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; }
.chip-swatch { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--border-strong); display: inline-block; }
.hours-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.hour-chip { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); border-radius: var(--r-sm); padding: 6px 0;
  font-size: var(--fs-sm); cursor: pointer; }
.hour-chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.cf-savebar { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- video studio */
.studio-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-4); }
.studio-card { display: flex; gap: var(--sp-3); padding: var(--sp-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.studio-card:hover { border-color: var(--accent); }
.studio-card img, .studio-card-empty { width: 68px; height: 120px; object-fit: cover; border-radius: var(--r-sm); background: var(--surface-3); flex: none; }
.studio-card-empty { display: grid; place-items: center; color: var(--text-3); font-size: var(--fs-xs); }
.studio-card-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.studio-card-body strong { overflow-wrap: anywhere; }
.studio-layout { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr) minmax(280px, 360px); gap: var(--sp-4); align-items: start; }
@media (max-width: 1200px) { .studio-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .studio-right { grid-column: 1 / -1; } }
@media (max-width: 760px) { .studio-layout { grid-template-columns: minmax(0, 1fr); } }
.studio-right > * + *, .studio-left > * + * { margin-top: var(--sp-4); }
.studio-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: var(--sp-4); cursor: pointer;
  border: 2px dashed var(--border-strong); border-radius: var(--r-md); color: var(--text-2); }
.studio-drop:hover, .studio-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.sr-only:focus + .studio-drop, #studio-file:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 2px; }
.studio-clips, .studio-cuts, .studio-highlights, .studio-renders, .studio-versions { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.studio-clip { display: flex; gap: var(--sp-2); align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: var(--r-md); }
.studio-clip img, .studio-clip-ph { width: 36px; height: 64px; object-fit: cover; border-radius: 4px; background: var(--surface-3); flex: none; display: grid; place-items: center; }
.studio-clip-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.studio-clip-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.studio-clip progress, .studio-render progress { width: 100%; }
.studio-clip[data-status="failed"] .muted { color: var(--crit); }
.studio-highlights li, .studio-render { padding: 10px; border: 1px solid var(--border); border-radius: var(--r-md); }
.studio-player { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); }
.studio-stage { position: relative; width: min(100%, 300px); aspect-ratio: 9 / 16; background: #000; border-radius: var(--r-md); overflow: hidden; }
.studio-video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.studio-caps { position: absolute; left: 6%; right: 6%; bottom: 18%; text-align: center; color: #fff; font-weight: 800; font-size: clamp(14px, 4.2vw, 20px);
  text-shadow: 0 0 3px #000, 0 0 3px #000, 1px 1px 2px #000; pointer-events: none; line-height: 1.25; }
.cap-on { color: #ffd23f; }
.studio-transport { display: flex; align-items: center; gap: var(--sp-2); width: 100%; }
.studio-transport input[type="range"] { flex: 1; min-width: 0; }
.tl-track { position: relative; display: flex; gap: 2px; width: 100%; min-height: 56px; margin-top: var(--sp-3); padding: 4px 0; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.tl-seg { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 4px 6px; border: 0; border-radius: 4px; cursor: pointer;
  background: var(--accent-soft); color: var(--accent-ink); font-size: var(--fs-xs); text-align: left; overflow: hidden; }
.tl-seg span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-seg.sel { outline: 2px solid var(--accent); background: var(--accent); color: var(--on-accent); }
.tl-seg.muted-seg { opacity: .55; }
.tl-playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--crit); pointer-events: none; }
.studio-right > div > * + * { margin-top: var(--sp-4); }

/* ---------------------------------------------------------------- brand kit (client form) and knowledge guide */
.bk-intro > * + * { margin-top: var(--sp-3); }
.bk-block { border-top: 1px solid var(--border); padding-top: var(--sp-4); scroll-margin-top: 72px; }
.bk-block:first-of-type { border-top: 0; padding-top: 0; }
.bk-block > h3 { font-size: var(--fs-md); margin: 0 0 4px; }
.bk-block > * + * { margin-top: var(--sp-3); }
.bk-summary { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); background: var(--surface-2); }
.bk-summary-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); }
.bk-bar { height: 8px; border-radius: var(--r-pill); background: var(--surface-3); margin: var(--sp-2) 0 var(--sp-3); overflow: hidden; }
.bk-bar > span { display: block; height: 100%; background: var(--ok-mark); border-radius: var(--r-pill); transition: width .25s var(--ease); }
.bk-parts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px var(--sp-4); font-size: var(--fs-sm); }
.bk-parts li { display: flex; gap: 6px; align-items: flex-start; color: var(--text-2); }
.bk-parts li svg { flex: none; margin-top: 2px; color: var(--warn); }
.bk-parts li.is-done svg { color: var(--ok); }
.bk-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--sp-3); }
.bk-slot { display: flex; gap: var(--sp-3); padding: var(--sp-3); border: 1px dashed var(--border-strong); border-radius: var(--r-md); background: var(--surface); }
.bk-slot.is-over { border-color: var(--accent); background: var(--accent-soft); }
.bk-slot-body { min-width: 0; flex: 1; }
.bk-slot-body > * + * { margin-top: 6px; }
.bk-thumb { width: 96px; height: 96px; flex: none; display: grid; place-items: center; border-radius: var(--r-sm); overflow: hidden;
  border: 1px solid var(--border); background: repeating-conic-gradient(#8d8d8d 0 25%, #a4a4a4 0 50%) 0 0 / 16px 16px; }
.bk-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.bk-thumb .muted { color: #fff; }
.bk-pick { position: relative; cursor: pointer; }
.bk-pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.bk-pick:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.bk-pick:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.bk-status:empty { display: none; }
.bk-warn { color: var(--warn); font-size: var(--fs-sm); }
.chip-swatch-font { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: var(--r-sm); background: var(--surface-3); font-weight: 700; }
.bk-colours { display: grid; gap: var(--sp-3); }
.bk-colour { display: grid; grid-template-columns: 140px 44px 120px auto; gap: var(--sp-2); align-items: center; }
.bk-colour > .hint, .bk-colour > .field-error { grid-column: 1 / -1; margin: -2px 0 0; }
.bk-colour label { font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); }
.bk-color { width: 44px; height: 34px; padding: 0; border: 1px solid var(--control); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; }
.bk-hex { font-family: var(--mono); text-transform: uppercase; }
.bk-offer { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; padding: var(--sp-3); border-radius: var(--r-md); background: var(--accent-soft); font-size: var(--fs-sm); }
.bk-offer-chip { display: inline-flex; gap: 6px; align-items: center; padding: 2px 8px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border); }
.bk-styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--sp-3); }
.bk-style { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: var(--sp-2); border: 2px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer; color: var(--text); font: inherit; }
.bk-style:hover { border-color: var(--border-strong); }
.bk-style[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.bk-style img, .bk-style-noimg { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--r-sm); background: var(--surface-3); display: block; }
.bk-style-name { font-weight: 600; }
.bk-mood { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3); }
.bk-pic { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.bk-pic img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-3); }
.bk-voice { display: flex; gap: var(--sp-2); align-items: flex-start; margin-bottom: var(--sp-2); }
.bk-voice textarea { flex: 1; }
@media (max-width: 620px) {
  .bk-colour { grid-template-columns: 1fr 44px minmax(0, 1fr); }
  .bk-colour > button { grid-column: 1 / -1; justify-self: start; }
  .bk-slot { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { .bk-bar > span { transition: none; } }

/* Knowledge page: the "what to add" checklist */
.kb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.kb-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: var(--sp-3); align-items: start; padding: var(--sp-2) 0; border-top: 1px solid var(--border); }
.kb-row:first-child { border-top: 0; }
.kb-mark { padding-top: 2px; color: var(--muted, inherit); }
.kb-have .kb-mark { color: var(--ok); }
.kb-missing .kb-mark { color: var(--warn); }
.kb-more > summary { cursor: pointer; padding: var(--sp-2) 0; font-weight: 600; }
.kb-more[open] > summary { margin-bottom: var(--sp-2); }
.kb-help { display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-2) var(--sp-3); background: var(--surface-2); border-radius: var(--r-md, 8px); }
.kb-help:empty { display: none; }
.kb-gaps { margin: 0; padding-left: 1.1em; }
@media (max-width: 520px) { .kb-row { grid-template-columns: 20px minmax(0, 1fr); } .kb-row .btn { grid-column: 2; justify-self: start; } }

/* ------------------------------------------------------------------ topbar additions */
.topbar-search-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  height: 36px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-3);
  cursor: pointer;
  font-size: var(--fs-sm);
  transition: border-color .15s, background .15s;
  min-width: 220px;
}
.topbar-search-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-2);
  background: var(--surface-2);
}
.topbar-search-text {
  flex: 1;
  text-align: left;
}
.topbar-search-kbd {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-3);
  border-radius: 4px;
  padding: 1px 6px;
  line-height: 1.2;
}
.topbar-create-btn {
  margin-left: 2px;
}
@media (max-width: 760px) {
  .topbar-search-pill {
    min-width: 0;
    width: 36px;
    padding: 0;
    justify-content: center;
    border-radius: var(--r-sm);
  }
  .topbar-search-text, .topbar-search-kbd {
    display: none;
  }
}

/* ------------------------------------------------------------------ command palette */
.cmd-dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 0;
  width: min(640px, calc(100vw - 32px));
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 48px rgba(0, 0, 0, .28);
  overflow: hidden;
}
.cmd-dialog::backdrop {
  background: rgba(10, 12, 16, .65);
  backdrop-filter: blur(4px);
}
.cmd-container {
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}
.cmd-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.cmd-head .icon {
  color: var(--text-3);
  flex: none;
}
.cmd-input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--fs-md);
  padding: 6px 0;
}
.cmd-kbd {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-3);
  border-radius: 4px;
  padding: 2px 6px;
}
.cmd-results {
  overflow-y: auto;
  padding: var(--sp-2) var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 200px;
  max-height: 420px;
}
.cmd-group-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 8px 10px 4px;
}
.cmd-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .1s;
}
.cmd-item:hover, .cmd-item.is-selected {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.cmd-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  flex: none;
  color: var(--text-2);
}
.cmd-item.is-selected .cmd-item-icon {
  background: var(--accent);
  color: var(--on-accent);
}
.cmd-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.cmd-item-label {
  font-size: var(--fs-sm);
  font-weight: 500;
}
.cmd-item-sub {
  font-size: var(--fs-xs);
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmd-item.is-selected .cmd-item-sub {
  color: var(--accent-ink);
  opacity: .85;
}
.cmd-empty {
  padding: var(--sp-8) var(--sp-4);
  text-align: center;
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.cmd-foot {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 8px var(--sp-4);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.cmd-foot kbd {
  font-family: var(--mono);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 10px;
  margin-right: 2px;
}

/* ------------------------------------------------------------------ social platform mockups */
.social-mockup {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  max-width: 440px;
  margin: 0 auto;
}
.mockup-copy-bar {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
/* Instagram */
.mockup-ig {
  border-radius: var(--r-lg);
}
.ig-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px 14px;
}
.ig-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 11px;
}
.ig-handle {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.ig-more {
  color: var(--text-3);
}
.ig-media {
  background: #000;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.ig-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ig-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  color: #8e8e8e;
  font-size: var(--fs-sm);
}
.ig-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px 6px;
  color: var(--text);
}
.ig-actions-left {
  display: flex;
  gap: 14px;
  align-items: center;
}
.ig-body {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--fs-sm);
}
.ig-likes {
  font-weight: 600;
  font-size: var(--fs-xs);
  color: var(--text);
}
.ig-caption {
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.ig-handle-inline {
  font-weight: 600;
}
.ig-hook {
  font-weight: 600;
}
.ig-cta {
  color: var(--text-2);
  font-size: var(--fs-xs);
  margin-top: 2px;
}
.ig-hashtags {
  color: var(--accent-ink);
  font-size: var(--fs-xs);
}
.ig-comments-prompt {
  color: var(--text-3);
  font-size: var(--fs-xs);
  margin-top: 4px;
  cursor: pointer;
}
/* LinkedIn */
.mockup-li {
  padding: 0;
}
.li-header {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  padding: 12px 16px;
}
.li-avatar {
  width: 42px;
  height: 42px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--on-accent);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex: none;
}
.li-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.li-name {
  font-size: var(--fs-sm);
  color: var(--text);
}
.li-sub {
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.li-content {
  padding: 0 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--fs-sm);
  line-height: 1.45;
}
.li-hook {
  font-weight: 600;
  font-size: var(--fs-md);
}
.li-caption {
  white-space: pre-wrap;
}
.li-tags {
  color: var(--accent-ink);
  font-size: var(--fs-xs);
}
.li-asset {
  background: var(--surface-2);
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.li-asset img, .li-asset video {
  width: 100%;
  display: block;
  object-fit: cover;
}
.li-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  font-size: var(--fs-xs);
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}
.li-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 4px 8px;
}
.li-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 4px;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
}
.li-action-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ------------------------------------------------------------------ batch action toolbar */
.batch-toolbar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 85;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 8px 16px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  animation: floatUp .2s var(--ease);
}
@keyframes floatUp {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.batch-info {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
}
.batch-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ------------------------------------------------------------------ dashboard quick actions */
.hero-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
@media (max-width: 900px) {
  .hero-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .hero-actions { grid-template-columns: 1fr; }
}
.hero-action-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.hero-action-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.hero-action-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-ink);
  flex: none;
}
.hero-action-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.hero-action-text strong {
  font-size: var(--fs-sm);
}
.hero-action-text span {
  font-size: var(--fs-xs);
  color: var(--text-3);
}

/* ------------------------------------------------------------------ agent fleet grid */
.agent-fleet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}
.agent-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: var(--fs-xs);
  font-weight: 500;
}
.agent-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok-mark);
  box-shadow: 0 0 0 2px var(--ok-soft);
  flex: none;
}
.agent-pulse.is-idle {
  background: var(--text-3);
  box-shadow: none;
}
.agent-pulse.is-error {
  background: var(--crit-mark);
  box-shadow: 0 0 0 2px var(--crit-soft);
}

/* ------------------------------------------------------------------ keyboard shortcuts modal */
.kbd-row {
  display: flex;
  gap: 4px;
  align-items: center;
}
.kbd-badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 2px 7px;
  color: var(--text);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
}

/* ------------------------------------------------------------------ round screen guide button */
.btn-round-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s var(--ease);
  padding: 0;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
.btn-round-help:hover {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: var(--accent);
  transform: scale(1.1);
}

/* ------------------------------------------------------------------ Photoshop-Grade Responsive Design Lab */
.dl-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

.dl-workspace {
  display: grid;
  grid-template-columns: 56px 1fr 380px;
  gap: 16px;
  align-items: stretch;
  min-height: 720px;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 1180px) {
  .dl-workspace {
    grid-template-columns: 56px 1fr 320px;
    gap: 12px;
  }
}

@media (max-width: 960px) {
  .dl-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 14px;
  }
}

/* Tool Rail */
.dl-tool-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 10px 6px;
  box-sizing: border-box;
}

@media (max-width: 960px) {
  .dl-tool-rail {
    flex-direction: row;
    overflow-x: auto;
    padding: 8px 10px;
    width: 100%;
    justify-content: flex-start;
  }
}

.dl-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: all .15s var(--ease);
  position: relative;
  flex-shrink: 0;
}

.dl-tool-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.dl-tool-btn.is-active {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}

.dl-tool-btn .dl-tool-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* Center Stage Viewport */
.dl-stage-viewport {
  display: flex;
  flex-direction: column;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
  min-height: 580px;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, .4);
}

.dl-stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(15, 23, 42, .85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  z-index: 5;
  flex-wrap: wrap;
  gap: 8px;
}

.dl-stage-canvas-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow: auto;
  position: relative;
  background-image: 
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .06) 1px, transparent 0);
  background-size: 20px 20px;
}

/* Interactive Element Outlines */
.dl-interactive-el {
  cursor: pointer;
  transition: outline .15s ease, transform .12s ease;
  outline: 1px dashed transparent;
  outline-offset: 3px;
  border-radius: 4px;
}

.dl-interactive-el:hover {
  outline: 1px dashed rgba(59, 130, 246, 0.8) !important;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.25);
}

.dl-interactive-el.is-selected {
  outline: 2px solid var(--accent) !important;
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.4);
}

/* Right Inspector Panel */
.dl-inspector {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  max-height: 820px;
  overflow-y: auto;
  box-sizing: border-box;
}

@media (max-width: 960px) {
  .dl-inspector {
    max-height: none;
  }
}

/* AI Info Box */
.dl-ai-card {
  background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.12), transparent 70%), var(--surface-2);
  border: 1px solid color-mix(in srgb, #6366f1 35%, var(--border));
  border-radius: var(--r-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px -2px rgba(99, 102, 241, 0.08);
}

.dl-ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(99, 102, 241, 0.18);
  color: #818cf8;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 8px;
  border-radius: var(--r-pill);
}

.dl-chip-btn {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}

.dl-chip-btn:hover {
  background: var(--surface-2);
  color: var(--accent);
  border-color: var(--accent);
}

/* ------------------------------------------------------------------ SEO Tooltips & Metadata Inspector */
.seo-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong, rgba(255, 255, 255, 0.15));
  border-radius: var(--r-md, 10px);
  padding: 10px 14px;
  max-width: 340px;
  width: max-content;
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--fs-xs, 12px);
  line-height: 1.4;
  backdrop-filter: blur(12px);
  animation: seoTipIn 0.12s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes seoTipIn {
  from { opacity: 0; transform: translateY(4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.seo-tip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
  margin-bottom: 2px;
}

.seo-tip-title {
  font-weight: 700;
  color: var(--text);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.seo-tip-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: var(--r-pill, 999px);
  background: rgba(99, 102, 241, 0.18);
  color: var(--accent, #6366f1);
}

.seo-tip-what {
  color: var(--text-2, #cbd5e1);
  margin: 0;
}

.seo-tip-click {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  background: var(--surface-2);
  padding: 6px 8px;
  border-radius: var(--r-sm, 6px);
  border-left: 3px solid var(--accent, #6366f1);
  font-size: 11px;
  color: var(--text);
  margin-top: 2px;
}

.seo-tip-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 10px;
  color: var(--text-3);
  font-family: monospace;
  margin-top: 2px;
}

.seo-tip-meta-item {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Google SERP Preview Card */
.serp-preview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md, 10px);
  padding: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.serp-result-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md, 8px);
  padding: 14px 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  max-width: 640px;
}

.serp-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.serp-favicon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
}

.serp-domain-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.serp-site-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.serp-breadcrumb {
  font-size: 11px;
  color: var(--text-3);
}

.serp-title {
  font-size: 17px;
  font-weight: 500;
  color: #8ab4f8; /* Dark mode Google link blue */
  text-decoration: none;
  cursor: pointer;
  margin: 4px 0;
  display: block;
  line-height: 1.3;
}

[data-theme="light"] .serp-title {
  color: #1a0dab; /* Light mode Google link blue */
}

.serp-title:hover {
  text-decoration: underline;
}

.serp-snippet {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
  margin: 4px 0 0;
}

.serp-counter-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-pill, 999px);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.serp-counter-ok {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.serp-counter-warn {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.serp-counter-crit {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Page Meta Tags Grid */
.meta-inspector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.meta-field-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md, 8px);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s ease;
}

.meta-field-card:hover {
  border-color: var(--accent);
}

.meta-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.meta-field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 5px;
}

.meta-field-val {
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
  line-height: 1.4;
  margin: 0;
}

.meta-field-val-empty {
  color: var(--crit);
  font-style: italic;
  font-size: 12px;
}

.meta-field-hint {
  font-size: 10px;
  color: var(--text-3);
  margin: 0;
}
/* ==========================================================================
   Omnipresent Assistant Copilot Drawer & Trigger
   ========================================================================== */

.assistant-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #ffffff;
  border: none;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.assistant-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45), 0 3px 8px rgba(0, 0, 0, 0.25);
}

.assistant-fab-text {
  letter-spacing: 0.02em;
}

.topbar-assistant-btn {
  font-weight: 600;
  border-radius: 6px;
  padding: 4px 10px;
}

.assistant-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.assistant-drawer.open {
  transform: translateX(0);
}

.assistant-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
}

.assistant-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--text);
}

.assistant-context-bar {
  padding: 8px 16px;
  background: var(--surface-3);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}

.context-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.context-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 8px;
  color: var(--text);
  font-weight: 500;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.assistant-msg {
  display: flex;
  gap: 10px;
  max-width: 90%;
}

.msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-user .msg-bubble {
  background: var(--primary, #2563eb);
  color: #ffffff;
  border-radius: 14px 14px 2px 14px;
}

.msg-assistant {
  align-self: flex-start;
}

.msg-assistant .msg-bubble {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px 14px 14px 2px;
}

.assistant-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.msg-bubble {
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.45;
}

.msg-bubble p {
  margin: 0;
}

.msg-action-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(34, 197, 94, 0.15);
  color: var(--ok, #10b981);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
  text-transform: capitalize;
}

.msg-thought {
  margin-top: 8px;
  font-size: 11.5px;
  border-top: 1px dashed var(--border);
  padding-top: 6px;
}

.msg-thought summary {
  cursor: pointer;
  color: var(--text-3);
}

.msg-thinking {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
  font-style: italic;
  padding: 4px 8px;
}

.assistant-input-area {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.assistant-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.assistant-chip-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
}

.assistant-chip-btn:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--primary, #2563eb);
}

.assistant-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.assistant-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  resize: none;
  font-family: inherit;
  outline: none;
}

.assistant-input:focus {
  border-color: var(--primary, #2563eb);
}

.assistant-send-btn {
  height: 36px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.assistant-hint {
  margin: 0;
  font-size: 11px;
}

/* ---------------------------------------------------------------- video studio professional timeline & captions */
.tl-track-overlays { display: flex; height: 28px; position: relative; background: var(--surface-3, #1e293b); border-radius: 4px; margin-top: 6px; overflow: hidden; border: 1px dashed var(--border, #334155); }
.tl-overlay-block { position: absolute; height: 100%; border-radius: 3px; font-size: 11px; font-weight: 600; display: flex; align-items: center; padding: 0 8px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; cursor: pointer; transition: all 0.15s ease; }
.tl-overlay-block:hover { filter: brightness(1.15); transform: translateY(-1px); }
.tl-overlay-component { background: rgba(14, 165, 233, 0.28); border: 1px solid #0ea5e9; color: #38bdf8; }
.tl-overlay-title { background: rgba(168, 85, 247, 0.28); border: 1px solid #a855f7; color: #c084fc; }
.tl-seg-badge { font-size: 9px; padding: 1px 4px; border-radius: 3px; background: rgba(0,0,0,0.4); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; display: inline-block; width: fit-content; }
.cap-word-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 6px; background: var(--surface-2, #1e293b); border: 1px solid var(--border, #334155); font-size: 13px; margin: 3px; cursor: pointer; transition: border-color 0.15s; }
.cap-word-pill:hover { border-color: var(--accent, #6366f1); }
.cap-word-pill.accented { border-color: var(--accent, #ffd60a); background: rgba(255, 214, 10, 0.15); font-weight: 700; color: #ffd60a; }
.cap-word-pill.editing { outline: 2px solid var(--accent, #6366f1); }
.studio-meta-badge { font-size: 10px; font-family: monospace; padding: 2px 5px; border-radius: 3px; background: var(--surface-3); color: var(--muted); margin-left: 4px; }


.tile.is-selected { outline: 2px solid var(--accent); border-color: var(--accent); box-shadow: 0 0 12px rgba(99, 102, 241, 0.35); }
.tile-check-badge { position: absolute; top: 8px; left: 8px; z-index: 5; width: 24px; height: 24px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, 0.4); background: rgba(15, 23, 42, 0.75); display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); cursor: pointer; transition: all 0.15s ease; }
.tile-check-badge:hover { transform: scale(1.1); background: rgba(15, 23, 42, 0.95); }
.tile-check-badge.active { background: var(--accent, #6366f1); border-color: var(--accent, #6366f1); color: #fff; }
.bulk-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 10px 16px; margin-bottom: 14px; background: var(--surface-2); border: 1px solid var(--accent); border-radius: var(--r-md); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15); animation: fadeIn 0.2s ease-out; }
