/* Content OS — SPECIMEN-LIGHT design system (CustomWorks AI brand kit). Same token NAMES as the
   prior warm-paper/Inter system; values swapped to specimen-light. See
   brand-assets/specimen-light/specimen.css (canonical) + README.md. */

@font-face { font-family:'Cabinet Grotesk'; src:url('./fonts/cabinet-grotesk-300.woff2') format('woff2'); font-weight:300; font-display:swap; }
@font-face { font-family:'Cabinet Grotesk'; src:url('./fonts/cabinet-grotesk-500.woff2') format('woff2'); font-weight:500; font-display:swap; }
@font-face { font-family:'Cabinet Grotesk'; src:url('./fonts/cabinet-grotesk-700.woff2') format('woff2'); font-weight:700; font-display:swap; }
@font-face { font-family:'Switzer'; src:url('./fonts/switzer-400.woff2') format('woff2'); font-weight:400; font-display:swap; }
@font-face { font-family:'Switzer'; src:url('./fonts/switzer-500.woff2') format('woff2'); font-weight:500; font-display:swap; }
@font-face { font-family:'Fragment Mono'; src:url('./fonts/fragment-mono-400.woff2') format('woff2'); font-weight:400; font-display:swap; }

:root {
  --paper:   #F2F1F4;   /* specimen --bg: paper, half-degree violet cast */
  --paper-2: #E9E8EC;   /* specimen --bg-2: alternate paper band */
  --card:    #FFFFFF;
  --ink:     #0C0C0F;   /* specimen --ink */
  --text:    #3A3A42;   /* specimen --body */
  --muted:   #5E5E68;   /* specimen --muted */
  --steel:   #666670;   /* specimen --steel: dimmest legal text, indices/labels only */
  --line:    #DFDEE4;
  --line-2:  #C9C8D1;
  --violet:  #6D28D9;   /* text-accent usages (links, active nav) keep this name; = specimen --acc */
  --violet-d:#4C1D95;   /* specimen --violet-deep */
  --violet-fill: #7C3AED;  /* specimen --violet: solid FILLS only (buttons, active bg, brand mark) */
  --violet-fill-hover: #8B52F0;
  --violet-soft: #EFE9FC;
  --reach:   #2F8F6B;   /* track: reach (green) — kept, adequate contrast on new paper */
  --reach-soft: #E3F0EA;
  --icp:     #6D28D9;   /* track: icp — mapped to violet text-accent */
  --icp-soft: #EFE9FC;
  --amber:   #9A6A16;
  --amber-soft: #F7EDD9;
  --info:    #2563B9;
  --info-line: rgba(37,99,185,.30);
  --danger:  #B23A2C;
  --ok:      #2F8F6B;
  --shadow:  none;
  --shadow-lg: 0 12px 40px rgba(12,12,15,.14);
  --r-sm: 8px;
  --r:    16px;
  --r-lg: 16px;
  --rail-w: 232px;
  --sans: "Switzer", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Cabinet Grotesk", var(--sans);
  --mono: "Fragment Mono", ui-monospace, Menlo, monospace;
  --danger-soft: #FBE7E4;
  --danger-soft-2: #FDF2F0;
  --amber-line: rgba(154,106,22,.28);
  --danger-line: rgba(178,58,44,.28);
  --scrim: rgba(12,12,15,.45);
  --glass: rgba(242,241,244,.86);
  --media-bg: #0C0C0F;   /* letterbox behind media — constant in both themes */
  --solid: #0C0C0F;      /* ink-on-paper solid chips (fab, toast) */
  --solid-fg: #FFFFFF;
  color-scheme: light;
}

/* Dark theme — SPECIMEN-LIGHT's graphite re-scope (brand-assets/specimen-light/specimen.css .band-dark),
   same token names re-valued. Violet FILLS stay; text accents go lilac. theme.js sets data-theme. */
:root[data-theme="dark"] {
  --paper:   #0C0C0F;
  --paper-2: #131318;
  --card:    #17171C;
  --ink:     #F5F5F7;
  --text:    #C9C9D0;
  --muted:   #9C9CA6;
  --steel:   #86868F;
  --line:    rgba(255,255,255,.08);
  --line-2:  rgba(255,255,255,.16);
  --violet:  #C7B9FD;
  --violet-d:#A78BFA;
  --violet-soft: rgba(124,58,237,.18);
  --reach:   #5BBE93;
  --reach-soft: rgba(47,143,107,.16);
  --icp:     #C7B9FD;
  --icp-soft: rgba(124,58,237,.18);
  --amber:   #D9A554;
  --amber-soft: rgba(154,106,22,.18);
  --info:    #7DB4FF;
  --info-line: rgba(125,180,255,.35);
  --danger:  #E5786A;
  --danger-soft: rgba(178,58,44,.18);
  --danger-soft-2: rgba(178,58,44,.10);
  --amber-line: rgba(217,165,84,.35);
  --danger-line: rgba(229,120,106,.35);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.5);
  --scrim: rgba(0,0,0,.62);
  --glass: rgba(12,12,15,.72);
  --solid: #F5F5F7;
  --solid-fg: #0C0C0F;
  --ok: #5BBE93;
  color-scheme: dark;
}
/* the paper grain survives dark: same diagonal strokes, white at whisper opacity */
:root[data-theme="dark"] body,
:root[data-theme="dark"] html { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath d='M-2 10 10 -2M-2 2 2 -2M6 10 10 6' stroke='%23FFFFFF' stroke-opacity='.03' stroke-width='1'/%3E%3C/svg%3E"); }

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath d='M-2 10 10 -2M-2 2 2 -2M6 10 10 6' stroke='%230C0C0F' stroke-opacity='.045' stroke-width='1'/%3E%3C/svg%3E");
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 95; pointer-events: none; opacity: .02;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}
::selection { background: #4C1D95; color: #fff; }

h1, h2, h3, h4 { font-family: var(--display); color: var(--ink); font-weight: 500; margin: 0; letter-spacing: -.01em; }
a { color: var(--violet); text-decoration: none; }
.hidden { display: none !important; }

/* --- buttons ---------------------------------------------------------------------------------- */
.btn {
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
  padding: 9px 16px; border-radius: 999px; cursor: pointer;
  transition: all .16s ease; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.btn:hover { border-color: var(--violet); color: var(--violet); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--violet-fill); border-color: var(--violet-fill); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.22); }
.btn-primary:hover { background: var(--violet-fill-hover); border-color: var(--violet-fill-hover); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 8px 10px; }
.btn-ghost:hover { color: var(--violet); background: var(--violet-soft); transform: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-sm { padding: 6px 13px; font-size: 13px; }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; font-family: var(--sans); padding: 2px 4px; }
.link-btn:hover { color: var(--violet); }
/* form fields must flip with the theme too — in light this equals today's UA white, unchanged */
input, textarea, select { background-color: var(--card); color: var(--ink); }

/* --- login ------------------------------------------------------------------------------------ */
.login { position: fixed; inset: 0; background: var(--paper); display: flex; align-items: center; justify-content: center; z-index: 100; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 40px 36px; width: 340px; box-shadow: var(--shadow-lg); text-align: center; display: flex; flex-direction: column; gap: 14px; }
.login-mark { font-family: var(--display); font-weight: 300; font-size: 26px; color: var(--ink); letter-spacing: -.02em; }
.login-mark b { font-weight: 700; }
.login-sub { margin: -8px 0 6px; color: var(--steel); font-family: var(--mono); font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; }
.login-input { padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--r-sm); font-size: 15px; font-family: var(--sans); outline: none; transition: border .15s; }
.login-input:focus { border-color: var(--violet); }
.login-btn { justify-content: center; }
.login-err { color: var(--danger); font-size: 13px; min-height: 18px; }

/* --- app shell -------------------------------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--rail-w) 1fr; height: 100vh; overflow: hidden; }

.rail { background: #0C0C0F; border-right: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; padding: 22px 16px; gap: 10px; min-height: 0; overflow: hidden; }
.rail :focus-visible { outline-color: #C7B9FD; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; display: block; }
.brand-textwrap { display: flex; flex-direction: column; gap: 1px; }
.brand-text { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; color: #F5F5F7; }
.brand-text .ai { color: #C7B9FD; }
.login-mark .ai { color: #6D28D9; }
.brand-sub { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #86868F; }

.nav {
  display: flex; flex-direction: column; gap: 3px;
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent;
}
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 999px; }
.nav-group { display: flex; flex-direction: column; gap: 3px; }
.nav-group + .nav-group { margin-top: 14px; }
.nav-group-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .18em; color: #86868F; font-family: var(--mono); font-weight: 400; padding: 6px 12px 2px; }
.nav-module-label { color: #F5F5F7; font-family: var(--display); font-size: 15px; font-weight: 650; letter-spacing: -.01em; padding: 7px 12px 2px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border: none; background: none; border-radius: 6px; font-family: var(--sans); font-size: 14px; font-weight: 500; color: #C9C9D0; cursor: pointer; text-align: left; text-decoration: none; transition: all .14s; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #F5F5F7; }
.nav-item.active { background: rgba(255,255,255,.07); color: #FFFFFF; box-shadow: inset 2px 0 0 #7C3AED; }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.streak-chip { display: flex; align-items: center; gap: 8px; background: #17171C; border: 1px solid rgba(255,255,255,.08); border-radius: var(--r); padding: 11px 14px; }
.streak-flame { font-size: 17px; }
.streak-chip:not(.lit) .streak-flame { display: none; } /* a grayscale emoji reads as a smudge on the dark rail */
.streak-num { font-family: var(--display); font-weight: 600; font-size: 20px; color: #F5F5F7; }
.streak-label { font-size: 12px; color: #9C9CA6; }
.rail-meta { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.perm-chip { font-family: var(--mono); font-size: 10.5px; color: #86868F; text-transform: uppercase; letter-spacing: .08em; }
.rail .link-btn { color: #9C9CA6; }
.rail .link-btn:hover { color: #C7B9FD; }

/* --- main ------------------------------------------------------------------------------------- */
.main { overflow-y: auto; height: 100%; }
.topbar { position: sticky; top: 0; z-index: 10; background: var(--glass); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding: 20px 34px; display: flex; align-items: center; justify-content: space-between; }
.page-title { font-size: 27px; font-weight: 300; letter-spacing: -.02em; }
.page-sub { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.week-badge { font-family: var(--mono); font-size: 12px; color: var(--muted); background: transparent; border: 1px solid var(--line-2); padding: 5px 11px; border-radius: 20px; }

.view { padding: 28px 34px 80px; max-width: 1180px; }

/* --- generic cards & layout ------------------------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.row { display: flex; gap: 14px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .18em; color: var(--steel); font-family: var(--mono); font-weight: 400; margin: 26px 0 14px; }
.section-title:first-child { margin-top: 0; }

/* --- skill run cards (the buttons that do the work) ------------------------------------------- */
.skill-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; transition: border .15s, transform .15s; }
.skill-card:hover { border-color: var(--line-2); }
.skill-card.hero { border-left: 3px solid var(--violet); }
.skill-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.skill-title { font-family: var(--display); font-size: 18px; font-weight: 500; color: var(--ink); }
.skill-eta { font-family: var(--mono); font-size: 11px; color: var(--muted); background: var(--paper-2); padding: 3px 8px; border-radius: 12px; white-space: nowrap; }
.skill-blurb { font-size: 13.5px; color: var(--text); line-height: 1.55; }
.skill-writes { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.skill-writes b { color: var(--text); font-weight: 500; }
.skill-arg { width: 100%; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 10px 12px; font-family: var(--sans); font-size: 13.5px; resize: vertical; min-height: 0; outline: none; transition: border .15s; }
.skill-arg:focus { border-color: var(--violet); }
.skill-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; }

/* --- pills / tags ----------------------------------------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; padding: 3px 9px; border-radius: 20px; background: var(--paper-2); color: var(--text); border: 1px solid var(--line); }
.pill.reach { background: var(--reach-soft); color: var(--reach); border-color: transparent; }
.pill.icp { background: var(--icp-soft); color: var(--icp); border-color: transparent; }
.pill.proven { background: var(--reach-soft); color: var(--reach); border-color: transparent; }
.pill.variation { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.pill.new { background: var(--violet-soft); color: var(--violet); border-color: transparent; }
.pill.ghost { background: transparent; }

/* --- hook browser ----------------------------------------------------------------------------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filter-search { flex: 1; min-width: 200px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 9px 13px; font-family: var(--sans); font-size: 14px; outline: none; }
.filter-search:focus { border-color: var(--violet); }
.seg { display: inline-flex; background: var(--paper-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: none; background: none; padding: 6px 12px; border-radius: 999px; font-family: var(--sans); font-size: 13px; color: var(--muted); cursor: pointer; transition: all .14s; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.hook-list { display: flex; flex-direction: column; gap: 10px; }
.hook { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 15px 18px; display: flex; flex-direction: column; gap: 9px; transition: border .15s; }
.hook:hover { border-color: var(--line-2); }
.hook-text { font-size: 14.5px; color: var(--ink); line-height: 1.5; }
.hook-meta { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.hook-src { font-size: 11.5px; color: var(--muted); font-style: italic; }
.count-note { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

/* --- pipeline / packet stages ----------------------------------------------------------------- */
.stages { display: flex; align-items: center; gap: 0; flex-wrap: wrap; }
.stage { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.stage .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); }
.stage.done { color: var(--ink); }
.stage.done .dot { background: var(--reach); }
.stage-sep { width: 22px; height: 1px; background: var(--line-2); margin: 0 8px; }

/* --- library board ---------------------------------------------------------------------------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: 220px; gap: 14px; overflow-x: auto; padding-bottom: 16px; }
.col { background: var(--paper-2); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 120px; }
.col-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 2px 4px; }
.col-count { background: var(--card); border-radius: 10px; padding: 1px 7px; font-size: 11px; }
.vcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; cursor: pointer; box-shadow: var(--shadow); transition: transform .14s, border .14s; display: flex; flex-direction: column; gap: 8px; }
.vcard:hover { border-color: var(--line-2); }
.vcard-title { font-size: 13.5px; color: var(--ink); font-weight: 500; line-height: 1.35; }
.vcard-meta { display: flex; gap: 6px; flex-wrap: wrap; }

/* --- metrics / analytics ---------------------------------------------------------------------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); }
.kpi-num { font-family: var(--display); font-size: 30px; font-weight: 300; color: var(--ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--steel); margin-top: 4px; }
.track-panel { border-top: 3px solid var(--line-2); }
.track-panel.reach { border-top-color: var(--reach); }
.track-panel.icp { border-top-color: var(--icp); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 12px; border-bottom: 1px solid var(--line); }
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); }

/* --- empty states ----------------------------------------------------------------------------- */
.empty { text-align: center; padding: 46px 24px; color: var(--muted); background: var(--card); border: 1px dashed var(--line-2); border-radius: var(--r); }
.empty-ico { font-size: 30px; opacity: .4; margin-bottom: 10px; }
.empty h3 { color: var(--text); font-weight: 500; margin-bottom: 6px; }
.empty p { font-size: 13.5px; max-width: 420px; margin: 0 auto 14px; }

/* --- markdown render -------------------------------------------------------------------------- */
.md { font-size: 14.5px; line-height: 1.65; color: var(--text); }
.md h1, .md h2, .md h3 { margin: 20px 0 10px; }
.md h1 { font-size: 21px; } .md h2 { font-size: 18px; } .md h3 { font-size: 15.5px; }
.md p { margin: 10px 0; }
.md ul, .md ol { margin: 10px 0; padding-left: 22px; }
.md li { margin: 4px 0; }
.md code { font-family: var(--mono); font-size: 12.5px; background: var(--paper-2); padding: 2px 5px; border-radius: 4px; }
.md pre { background: var(--paper-2); padding: 14px; border-radius: var(--r-sm); overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 13px; }
.md th, .md td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.md blockquote { border-left: 3px solid var(--violet); margin: 12px 0; padding: 2px 14px; color: var(--muted); }
.md hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }

/* --- run console ------------------------------------------------------------------------------ */
.console-fab { position: fixed; right: 26px; bottom: 26px; z-index: 40; background: var(--solid); color: var(--solid-fg); border: none; border-radius: 24px; padding: 12px 20px; font-family: var(--sans); font-weight: 500; font-size: 14px; cursor: pointer; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 9px; transition: transform .15s; }
.console-fab-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.console-fab-dot.live { background: #4ADE80; box-shadow: 0 0 0 0 rgba(74,222,128,.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(74,222,128,.5);} 70% { box-shadow: 0 0 0 8px rgba(74,222,128,0);} 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0);} }
.console { position: fixed; right: 0; top: 0; bottom: 0; width: 420px; max-width: 92vw; background: var(--card); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); z-index: 50; transform: translateX(105%); transition: transform .26s cubic-bezier(.4,0,.2,1); display: flex; flex-direction: column; }
.console.open { transform: translateX(0); }
.console-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.console-body { overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 16px; }
.console-empty { color: var(--muted); font-size: 13.5px; text-align: center; padding: 40px 0; }
.run { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.run-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: var(--paper-2); cursor: pointer; }
.run-name { font-family: var(--display); font-size: 14.5px; color: var(--ink); font-weight: 500; }
.run-status { font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-radius: 12px; text-transform: uppercase; letter-spacing: .05em; }
.run-status.running { background: var(--violet-soft); color: var(--violet); }
.run-status.done { background: var(--reach-soft); color: var(--reach); }
.run-status.failed { background: var(--danger-soft); color: var(--danger); }
.run-log { max-height: 240px; overflow-y: auto; padding: 10px 14px; font-size: 12.5px; display: flex; flex-direction: column; gap: 6px; }
.ev { display: flex; gap: 8px; align-items: baseline; }
.ev-ico { font-family: var(--mono); color: var(--violet); font-size: 11px; flex-shrink: 0; }
.ev-text { color: var(--text); }
.ev-detail { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.ev.tool .ev-text { color: var(--ink); }
.ev.error .ev-text { color: var(--danger); }
.run-result { padding: 12px 14px; border-top: 1px solid var(--line); background: var(--paper); font-size: 13px; }
.run-result .md { font-size: 13px; }

/* --- modal ------------------------------------------------------------------------------------ */
.modal { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 24px; }
.modal-card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); width: 540px; max-width: 100%; max-height: 88vh; overflow-y: auto; padding: 26px 28px; }
.modal-card h2 { font-size: 20px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.field input, .field select, .field textarea { border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 9px 12px; font-family: var(--sans); font-size: 14px; outline: none; transition: border .15s; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--violet); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }

/* --- toasts ----------------------------------------------------------------------------------- */
.toasts { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--solid); color: var(--solid-fg); padding: 11px 18px; border-radius: var(--r-sm); font-size: 13.5px; box-shadow: var(--shadow-lg); animation: drop .25s ease; }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* --- responsive (narrow GHL iframe panel) ----------------------------------------------------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; overflow: visible; height: auto; }
  .rail { flex-direction: row; align-items: center; height: auto; position: sticky; top: 0; z-index: 20; padding: 10px 14px; gap: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .brand { padding: 0; flex-shrink: 0; } .brand-textwrap { display: none; }
  .nav { flex-direction: row; flex-shrink: 0; overflow: visible; min-height: auto; flex: 0 0 auto; }
  .nav-group { flex-direction: row; flex-shrink: 0; }
  .nav-group + .nav-group { margin-top: 0; }
  .nav-group-label { display: none; }
  .nav-module-label { display: none; }
  .nav-item { flex-shrink: 0; white-space: nowrap; }
  .rail-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; gap: 10px; flex-shrink: 0; }
  .streak-label { display: none; }
  .main { height: auto; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .view { padding: 20px 18px 116px; }
  .topbar { padding: 16px 18px; }
}

/* ============================================================================================== */
/* Marketing department (Ad Spy · Creative Studio · Funnels · Ads Manager).                        */
/* Nathan Bentley's information architecture and density, our SPECIMEN-LIGHT palette. Everything   */
/* below is additive: no rule above this line is touched. Owned by modules/ads.js.                 */
/* ============================================================================================== */

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.mkt-na { color: var(--steel); font-size: 12.5px; }
.mkt-note { font-size: 13px; color: var(--muted); background: var(--paper-2); border-radius: var(--r-sm); padding: 10px 13px; margin: 0 0 12px; }
.mkt-caveat { font-size: 13px; color: var(--text); background: var(--amber-soft); border: 1px solid var(--amber-line); border-radius: var(--r-sm); padding: 10px 13px; margin: 0 0 12px; }
.mkt-caveat b { color: var(--amber); }
.mkt-caveat.err { background: var(--danger-soft); border-color: var(--danger-line); }
.mkt-caveat.err b { color: var(--danger); }
.mkt-tally { font-family: var(--mono); font-size: 11.5px; color: var(--steel); letter-spacing: .02em; }
.mkt-tally .num { color: var(--ink); }
.mkt-count { color: var(--steel); font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 12px; }

/* --- filter chips ------------------------------------------------------------------------------ */
.mkt-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.mkt-chip { border: 1px solid var(--line-2); background: var(--card); color: var(--muted); font-family: var(--sans); font-size: 12.5px; font-weight: 500; padding: 5px 12px; border-radius: 20px; cursor: pointer; transition: all .14s; white-space: nowrap; }
.mkt-chip:hover { border-color: var(--violet); color: var(--violet); }
.mkt-chip.on { background: var(--violet-fill); border-color: var(--violet-fill); color: #fff; }

/* --- the winner signal -------------------------------------------------------------------------- */
.mkt-days { font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-radius: 20px; background: var(--paper-2); color: var(--muted); white-space: nowrap; border: 1px solid var(--line); }
.mkt-days.gold { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); font-weight: 500; }
.mkt-live-pill { font-size: 11px; padding: 3px 8px; border-radius: 20px; background: var(--reach-soft); color: var(--reach); font-weight: 500; white-space: nowrap; }
.mkt-off-pill { font-size: 11px; padding: 3px 8px; border-radius: 20px; background: var(--paper-2); color: var(--steel); white-space: nowrap; }

/* --- Ad Spy: brand cards ------------------------------------------------------------------------ */
.mkt-brands { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 14px; }
.mkt-brand { position: relative; text-align: left; font-family: var(--sans); background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 18px; cursor: default; display: flex; flex-direction: column; gap: 9px; transition: transform .14s, border-color .14s, box-shadow .14s; }
.mkt-brand:hover { border-color: var(--violet); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.mkt-brand:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.mkt-brand.dragging { opacity: .5; }
.mkt-brand.broken, .mkt-brand.broken:hover { border-color: var(--danger-line); }
.mkt-brand-top { display: block; min-width: 0; padding-right: 64px; }
.mkt-brand-name { display: block; width: 100%; font-family: var(--display); font-size: 16.5px; font-weight: 500; color: var(--ink); letter-spacing: -.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mkt-brand-acts { position: absolute; top: 11px; right: 12px; display: flex; gap: 3px; opacity: 0; pointer-events: none; transform: translateY(-2px); transition: opacity .14s, transform .14s; }
.mkt-brand:hover .mkt-brand-acts, .mkt-brand:focus-within .mkt-brand-acts { opacity: 1; pointer-events: auto; transform: translateY(0); }
.mkt-brand-act { width: 27px; height: 27px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); font-family: var(--sans); font-size: 13px; cursor: pointer; }
.mkt-brand-act:hover, .mkt-brand-act:focus-visible { border-color: var(--violet); color: var(--violet); background: var(--paper-2); outline: none; }
.mkt-brand-act.danger:hover, .mkt-brand-act.danger:focus-visible { border-color: var(--danger-line); color: var(--danger); background: var(--danger-soft); }
.mkt-brand-shots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.mkt-brand-shots img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 6px; background: var(--paper-2); display: block; }
.mkt-brand-shot-skel { width: 100%; aspect-ratio: 1 / 1; border-radius: 6px; background: var(--paper-2); border: 1px solid var(--line); animation: mkt-shot-pulse 1.1s ease-in-out infinite alternate; }
@keyframes mkt-shot-pulse { from { opacity: .45; } to { opacity: 1; } }
.mkt-brand-err { font-size: 12px; line-height: 1.45; color: var(--danger); background: var(--danger-soft); border: 1px solid var(--danger-line); border-radius: 6px; padding: 9px 10px; }
.mkt-brand-warning { padding: 7px 9px; border: 1px solid var(--amber-line); border-radius: 6px; background: var(--amber-soft); color: var(--amber); font-size: 11px; line-height: 1.4; }
.mkt-brand-stats { display: flex; gap: 12px; font-size: 12.5px; color: var(--muted); }
.mkt-brand-stats b { color: var(--ink); font-weight: 600; }
.mkt-brand-days { display: flex; align-items: center; min-height: 22px; }
.mkt-brand-src { font-family: var(--mono); font-size: 10.5px; color: var(--steel); letter-spacing: .01em; }
.mkt-brand-primary-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; margin-top: auto; padding-top: 2px; }
.mkt-brand-primary-actions .btn { justify-content: center; }
.mkt-history-pulls { display: flex; flex-direction: column; gap: 8px; }
.mkt-history-pulls > div { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper-2); }
.mkt-history-pulls span { color: var(--muted); font-size: 12px; }
.mkt-history-pulls b { display: block; margin-bottom: 2px; color: var(--ink); }
.mkt-archived { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper-2); font-size: 12px; color: var(--muted); }
.mkt-archived-label { font-family: var(--mono); color: var(--steel); }
.mkt-archived-item { display: inline-flex; align-items: center; gap: 3px; }
.mkt-archived-item .link-btn { color: var(--violet); font-size: 12px; }
.mkt-cost-lines li .mkt-delete-path { max-width: 300px; font-family: var(--mono); font-size: 11px; overflow-wrap: anywhere; text-align: right; }
.mkt-danger-btn { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-line); }
.mkt-danger-btn:hover { color: var(--danger); background: var(--danger-soft); border-color: var(--danger); }
@media (hover: none) { .mkt-brand-acts { opacity: 1; pointer-events: auto; transform: none; } }

/* --- Ad Spy: the ad card (inside the brand modal) ------------------------------------------------ */
.mkt-ads { display: flex; flex-direction: column; gap: 12px; }
.mkt-ad { display: grid; grid-template-columns: 108px 1fr; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); transition: border-color .14s; }
.mkt-ad:hover { border-color: var(--line-2); }
.mkt-ad-thumb { width: 108px; height: 108px; object-fit: cover; border-radius: var(--r-sm); background: var(--paper-2); }
.mkt-ad-thumb.none { display: flex; align-items: center; justify-content: center; text-align: center; font-family: var(--mono); font-size: 10px; color: var(--steel); border: 1px dashed var(--line-2); background: var(--paper); line-height: 1.5; }
.mkt-ad-body { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.mkt-ad-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.mkt-ad-head b { font-size: 14px; color: var(--ink); }
.mkt-plats { display: flex; gap: 5px; flex-wrap: wrap; }
.mkt-plat { font-family: var(--mono); font-size: 10px; text-transform: lowercase; color: var(--muted); background: var(--paper-2); border-radius: 4px; padding: 2px 6px; }
.mkt-ad-copy { font-size: 13.5px; line-height: 1.55; color: var(--text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mkt-funnel { display: flex; align-items: center; gap: 8px; min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 9px; }
.mkt-funnel-tag { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--violet); flex: 0 0 auto; }
.mkt-funnel-url { font-family: var(--mono); font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mkt-cta { font-size: 11.5px; font-weight: 500; color: var(--violet); background: var(--violet-soft); border-radius: 20px; padding: 3px 9px; white-space: nowrap; flex: 0 0 auto; margin-left: auto; }
.mkt-ad-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.mkt-spy-save { gap: 6px; }
.mkt-spy-save-ico { display: inline-flex; width: 14px; height: 14px; }
.mkt-spy-save-ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.mkt-spy-save.saved { color: #fff; background: var(--violet-fill); border-color: var(--violet-fill); box-shadow: inset 0 1px 0 rgba(255,255,255,.22); }
.mkt-spy-save.saved:hover { color: #fff; background: var(--violet-fill-hover); border-color: var(--violet-fill-hover); }
.mkt-spy-save.busy { opacity: .65; cursor: wait; }
.mkt-why { font-size: 11.5px; color: var(--amber); }

/* --- Ad Spy: the ad card's media column (playable video, render-source tag, retry-render) --------- */
.mkt-ad-media { position: relative; display: flex; flex-direction: column; gap: 6px; }
.mkt-ad-video { width: 108px; height: 108px; object-fit: cover; border-radius: var(--r-sm); background: var(--media-bg); display: block; }
.mkt-dl-video { font-family: var(--mono); font-size: 10px; color: var(--muted); text-align: center; }
.mkt-dl-video:hover { color: var(--violet); }
.mkt-snap-tag { font-family: var(--mono); font-size: 9.5px; line-height: 1.35; color: var(--steel); text-align: center; }
.mkt-ad-thumb.none.has-try { flex-direction: column; gap: 7px; padding: 8px; }
.mkt-thumb-try-btn { font-size: 10.5px; padding: 4px 8px; }

/* --- modal: wide enough for a library ------------------------------------------------------------ */
#modal-card:has(.ads-modal) { width: 900px; }
.mkt-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.mkt-modal-head h2 { margin: 0 0 3px; }
.mkt-sub { font-size: 12.5px; color: var(--muted); }
.mkt-modal-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

/* --- Creative Studio: the client bar (the swap-in primitive) --------------------------------------- */
.mkt-clientbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--violet); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 18px; }
.mkt-cb-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.mkt-cb-field label { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.mkt-req { color: var(--danger); }
.mkt-cb-field input { border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 9px 12px; font-family: var(--sans); font-size: 14px; color: var(--ink); outline: none; transition: border-color .15s; background: var(--card); }
.mkt-cb-field input:focus { border-color: var(--violet); }

/* --- Creative Studio: source grid ----------------------------------------------------------------- */
.mkt-src-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; }
.mkt-src-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: transform .14s, border-color .14s; }
.mkt-src-card:hover { border-color: var(--line-2); }
.mkt-src-card.selected { border-color: var(--violet); box-shadow: 0 0 0 2px var(--violet-soft), var(--shadow); }
/* aspect-ratio alone loses to a portrait <img>'s intrinsic height inside a column flex item, which
   made every tall creative stretch its row. Pin the image out of flow: the tile is always square. */
.mkt-src-shot { position: relative; width: 100%; aspect-ratio: 1 / 1; flex: 0 0 auto; overflow: hidden; background: var(--paper-2); }
.mkt-src-shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.mkt-src-shot video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: var(--media-bg); }
.mkt-angle { position: absolute; top: 8px; left: 8px; font-size: 10.5px; font-weight: 500; padding: 3px 8px; border-radius: 20px; background: rgba(255,255,255,.94); color: var(--violet); box-shadow: 0 1px 4px rgba(12,12,15,.18); }
.mkt-angle.untagged { color: var(--steel); font-family: var(--mono); font-size: 9.5px; letter-spacing: .02em; }
.mkt-src-days { position: absolute; top: 8px; right: 8px; font-family: var(--mono); font-size: 10.5px; padding: 3px 7px; border-radius: 20px; background: rgba(255,255,255,.94); color: var(--muted); box-shadow: 0 1px 4px rgba(12,12,15,.18); }
.mkt-src-days.gold { background: var(--amber-soft); color: var(--amber); font-weight: 500; }
.mkt-src-meta { padding: 12px 13px 10px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.mkt-src-brand { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--steel); }
.mkt-src-copy { font-size: 12.5px; line-height: 1.5; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mkt-src-btn { margin: 0 13px 13px; justify-content: center; }
/* The Library rebuild's short ALL-CAPS descriptor line (brand + body snippet, or a filename for an
   upload) — CSS does the casing, not JS, so the raw string stays normal-case for search/esc(). */
.mkt-src-desc { font-size: 11.5px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--text); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mkt-src-acts { display: flex; gap: 8px; margin: 0 13px 13px; }
.mkt-src-acts button.btn { flex: 1; justify-content: center; }
.mkt-src-dl { flex: 0 0 auto; justify-content: center; padding-left: 12px; padding-right: 12px; }
.mkt-source-pick { width: 100%; margin-top: 7px; padding: 7px 9px; border: 1px dashed var(--line-2); border-radius: 7px; background: var(--paper-2); color: var(--muted); font-family: var(--sans); font-size: 11px; font-weight: 600; cursor: pointer; }
.mkt-source-pick:hover:not(:disabled), .mkt-source-pick:focus-visible:not(:disabled) { border-color: var(--violet); color: var(--violet); outline: none; }
.mkt-source-pick.on { border-style: solid; border-color: var(--violet); background: var(--violet-soft); color: var(--violet); }
.mkt-source-pick:disabled { cursor: not-allowed; opacity: .58; }

/* --- Creative Studio: sub-tabs + the shared filter row (angle chips · type toggle · search) -------- */
.mkt-studio-filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 16px 0 18px; }
.mkt-studio-filters .mkt-chips { margin: 0; }
.mkt-studio-filters .filter-search { flex: 1; min-width: 180px; }
.mkt-studio-selection { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 14px 0 0; padding: 13px 14px; border: 1px solid var(--line); border-left: 3px solid var(--violet); border-radius: var(--r-sm); background: var(--card); }
.mkt-studio-selection > div:first-child { min-width: 0; }
.mkt-studio-selection b { display: block; color: var(--ink); font-size: 13px; }
.mkt-studio-selection > div > span { color: var(--muted); font-size: 11.5px; }
.mkt-selection-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.mkt-selection-chips span { max-width: 180px; overflow: hidden; padding: 3px 7px; border-radius: 999px; background: var(--paper-2); color: var(--muted); font-family: var(--mono); font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; }
.mkt-studio-selection-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.mkt-empty-action .btn { margin-top: 14px; }

/* --- Creative Studio: My Library grid (grouped per batch) ------------------------------------------- */
.mkt-lib-batches { display: flex; flex-direction: column; gap: 22px; }
.mkt-lib-batch { display: flex; flex-direction: column; gap: 12px; }
.mkt-lib-batch-head { display: flex; align-items: baseline; gap: 12px; padding: 10px 14px; background: var(--paper-2); border-radius: var(--r-sm); }
.mkt-lib-batch-slug { font-family: var(--display); font-size: 14.5px; font-weight: 500; color: var(--ink); }
.mkt-lib-batch-date { font-family: var(--mono); font-size: 11px; color: var(--steel); }
.mkt-lib-batch-links { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.mkt-lib-batch-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; min-width: 0; }
.mkt-lib-batch-summary b { color: var(--ink); font-size: 13px; }
.mkt-lib-batch-summary span { color: var(--steel); font-family: var(--mono); font-size: 10.5px; }
.mkt-lib-status { padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; font-family: var(--mono); font-size: 9.5px; white-space: nowrap; cursor: help; }
.mkt-lib-status.complete { border-color: var(--reach); background: var(--reach-soft); color: var(--reach); }
.mkt-lib-status.legacy { background: var(--paper); color: var(--muted); }
.mkt-lib-status.incomplete { border-color: var(--danger-line); background: var(--danger-soft); color: var(--danger); }
/* Truthful "this run never finished" flag on a My Library batch header — see adsBatchCompleteness
   (modules/ads.js) for the legacy-vs-incomplete rule. Reuses the same danger palette as .mkt-flagpill. */
.mkt-lib-incomplete-chip { font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .03em; color: var(--danger); background: var(--danger-soft); border: 1px solid var(--danger-line); border-radius: 20px; padding: 3px 10px; cursor: help; white-space: nowrap; }
.mkt-lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.mkt-lib-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: transform .14s, border-color .14s; }
.mkt-lib-card:hover { border-color: var(--line-2); }
.mkt-lib-shot { position: relative; width: 100%; aspect-ratio: 1 / 1; flex: 0 0 auto; overflow: hidden; background: var(--paper-2); }
.mkt-lib-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: var(--media-bg); }
.mkt-lib-shot-none { display: flex; align-items: center; justify-content: center; height: 100%; font-family: var(--mono); font-size: 10.5px; color: var(--steel); text-align: center; padding: 10px; }
.mkt-aspect-toggle { position: absolute; bottom: 8px; right: 8px; display: flex; background: rgba(255,255,255,.94); border-radius: 20px; padding: 2px; box-shadow: 0 1px 4px rgba(12,12,15,.18); }
.mkt-aspect-toggle button { border: none; background: none; font-family: var(--mono); font-size: 10px; padding: 3px 8px; border-radius: 16px; cursor: pointer; color: var(--muted); }
.mkt-aspect-toggle button.on { background: var(--violet-fill); color: #fff; }
.mkt-lib-meta { padding: 12px 13px 6px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.mkt-lib-desc { font-size: 11.5px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--text); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mkt-lib-client { font-family: var(--mono); font-size: 10.5px; color: var(--steel); }
.mkt-lib-acts { display: flex; gap: 8px; align-items: center; padding: 0 13px 13px; }

/* Regenerate: the card goes busy for the whole round trip (real fal credits, real spawn time) — dimmed
   + a small corner spinner, never a silent freeze. Reuses the same @keyframes mkt-spin the Ad Remix
   Results modal's slot spinner uses (defined once, below). */
.mkt-lib-busy { position: relative; opacity: .6; pointer-events: none; }
.mkt-lib-busy::after { content: ""; position: absolute; top: 10px; right: 10px; width: 18px; height: 18px; border: 2.5px solid var(--line-2); border-top-color: var(--violet); border-radius: 50%; animation: mkt-spin .8s linear infinite; }

/* --- Creative Studio: the upload dropzone (always the first cell of the source grid) --------------- */
.mkt-upload { border: 1.5px dashed var(--line-2); border-radius: var(--r); background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 260px; cursor: pointer; text-align: center; padding: 20px; transition: border-color .14s, background .14s; }
.mkt-upload:hover, .mkt-upload.drag { border-color: var(--violet); background: var(--violet-soft); }
.mkt-upload.busy { opacity: .6; cursor: default; }
.mkt-upload-ico { font-size: 26px; color: var(--violet); }
.mkt-upload-title { font-family: var(--display); color: var(--ink); font-size: 15px; }
.mkt-upload-sub { font-size: 12px; color: var(--muted); max-width: 180px; }
.mkt-src-uploaded { position: absolute; top: 8px; right: 8px; font-family: var(--mono); font-size: 10.5px; padding: 3px 7px; border-radius: 20px; background: rgba(255,255,255,.94); color: var(--muted); box-shadow: 0 1px 4px rgba(12,12,15,.18); }

/* --- Creative Studio: batches shelf ---------------------------------------------------------------- */
.mkt-batch { display: flex; flex-direction: column; gap: 11px; }
.mkt-batch-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.mkt-batch-name { font-family: var(--display); font-size: 15.5px; font-weight: 500; color: var(--ink); }
.mkt-batch-n { font-family: var(--mono); font-size: 11px; color: var(--steel); }
.mkt-batch-shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mkt-batch-shots img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--r-sm); background: var(--paper-2); }
.mkt-batch-acts { display: flex; gap: 8px; align-items: center; }

/* --- Funnels: the row list -------------------------------------------------------------------------- */
.mkt-fn-list { display: flex; flex-direction: column; gap: 8px; }
.mkt-fn { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 18px; transition: border-color .14s; }
.mkt-fn:hover { border-color: var(--line-2); }
.mkt-fn-main { flex: 1; min-width: 0; }
.mkt-fn-name { font-family: var(--display); font-size: 15.5px; font-weight: 500; color: var(--ink); }
.mkt-fn-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.mkt-fn-sub code { font-family: var(--mono); font-size: 11.5px; background: var(--paper-2); padding: 2px 6px; border-radius: 4px; color: var(--text); }
.mkt-fn-status { font-size: 11.5px; font-weight: 500; padding: 4px 10px; border-radius: 20px; white-space: nowrap; background: var(--paper-2); color: var(--steel); }
.mkt-fn-status.built { background: var(--violet-soft); color: var(--violet); }
.mkt-fn-acts { display: flex; gap: 8px; align-items: center; }
.mkt-fn-variant { padding: 6px 9px; font-size: 12px; color: var(--muted); }
.mkt-path { background: var(--paper-2); border-radius: var(--r-sm); padding: 11px 13px; margin: 12px 0; overflow-x: auto; }
.mkt-path code { font-family: var(--mono); font-size: 12.5px; color: var(--ink); white-space: nowrap; }

/* --- Ads Manager: controls + KPI tiles ----------------------------------------------------------------- */
.mkt-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px 16px; margin-bottom: 16px; }
.mkt-acct { font-family: var(--mono); font-size: 12px; color: var(--ink); background: var(--paper-2); border-radius: var(--r-sm); padding: 5px 10px; }
.mkt-window { font-size: 13px; color: var(--muted); }
.mkt-refreshed { font-family: var(--mono); font-size: 11px; color: var(--steel); margin-left: auto; }
.mkt-flagpill { font-size: 12px; font-weight: 500; color: var(--danger); background: var(--danger-soft); border-radius: 20px; padding: 4px 11px; white-space: nowrap; }
.mkt-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(122px, 1fr)); gap: 12px; margin-bottom: 4px; }
.mkt-kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 16px; }
.mkt-kpi-label { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--steel); margin-bottom: 6px; }
.mkt-kpi-num { font-family: var(--display); font-size: 24px; font-weight: 300; color: var(--ink); letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.mkt-nospend { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 5px; }
.mkt-nospend b { font-family: var(--display); font-size: 16px; font-weight: 500; color: var(--ink); }
.mkt-nospend span { font-size: 13.5px; color: var(--muted); line-height: 1.55; }

/* --- Ads Manager: the three tables ---------------------------------------------------------------------- */
.mkt-tbl-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow-x: auto; }
.mkt-tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
.mkt-tbl th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--steel); padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--paper-2); cursor: pointer; user-select: none; white-space: nowrap; transition: color .12s; }
.mkt-tbl th:hover { color: var(--violet); }
.mkt-tbl th.on { color: var(--violet); }
.mkt-tbl th.l, .mkt-tbl td.l { text-align: left; }
.mkt-tbl th.r, .mkt-tbl td.r { text-align: right; }
.mkt-caret { font-size: 8px; opacity: .8; }
.mkt-tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--text); white-space: nowrap; }
.mkt-tbl tbody tr:last-child td { border-bottom: none; }
.mkt-tbl tbody tr:hover td { background: var(--paper); }
.mkt-tbl tbody tr.click { cursor: pointer; }
.mkt-tbl tbody tr.flagged td { background: var(--danger-soft-2); } /* --danger-soft-2: a lighter step of --danger-soft, for the flagged-row base state */
.mkt-tbl tbody tr.flagged:hover td { background: var(--danger-soft); }
.mkt-more { display: block; width: 100%; border: none; border-top: 1px solid var(--line); background: var(--paper-2); color: var(--muted); font-family: var(--sans); font-size: 12.5px; font-weight: 500; padding: 11px; cursor: pointer; transition: color .14s, background .14s; }
.mkt-more:hover { color: var(--violet); background: var(--violet-soft); }
.mkt-rowname { display: inline-block; vertical-align: middle; color: var(--ink); font-weight: 500; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mkt-flag { color: var(--danger); font-size: 12px; margin-right: 6px; }
.mkt-dim { color: var(--muted); max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.mkt-status { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; padding: 3px 8px; border-radius: 4px; background: var(--paper-2); color: var(--steel); }
.mkt-status.live { background: var(--reach-soft); color: var(--reach); }
.mkt-status.paused { background: var(--paper-2); color: var(--muted); }

/* --- Ads Manager: the per-ad drawer ---------------------------------------------------------------------- */
.mkt-drawer-shot { width: 100%; max-height: 340px; object-fit: contain; border-radius: var(--r-sm); background: var(--paper-2); margin-bottom: 16px; display: block; }
.mkt-drawer-shot.none { display: flex; align-items: center; justify-content: center; height: 120px; border: 1px dashed var(--line-2); background: var(--paper); color: var(--steel); font-size: 13px; text-align: center; padding: 0 20px; }
.mkt-drawer-field { margin-bottom: 13px; }
.mkt-drawer-field label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--steel); margin-bottom: 4px; }
.mkt-drawer-val { font-size: 14px; line-height: 1.55; color: var(--ink); }
.mkt-drawer-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }

/* --- scan bar (Ad Spy · Funnels heros; replaces the old skill-run card) ----------------------------------- */
.mkt-scan { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--violet); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 22px; }
.mkt-scan-row { display: flex; gap: 10px; align-items: center; }
.mkt-scan-input { flex: 1; min-width: 0; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 11px 14px; font-family: var(--sans); font-size: 14.5px; color: var(--ink); background: var(--card); outline: none; transition: border-color .15s; }
.mkt-scan-input:focus { border-color: var(--violet); }
.mkt-scan-btn { flex: 0 0 auto; }
.mkt-scan-sub { font-family: var(--mono); font-size: 11.5px; color: var(--steel); letter-spacing: .02em; margin-top: 10px; }
.mkt-scan-hint { font-size: 12.5px; color: var(--amber); margin-top: 8px; }

/* --- the Remix sheet (the one composer for every remix path) --------------------------------------------- */
#modal-card:has(.mkt-sheet) { width: 560px; }
.mkt-sheet-src { display: flex; align-items: center; gap: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; }
.mkt-sheet-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: var(--r-sm); background: var(--paper-2); flex: 0 0 auto; }
.mkt-sheet-thumb.none { display: block; }
.mkt-sheet-src-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.mkt-sheet-src-brand { font-family: var(--display); font-size: 15.5px; font-weight: 500; color: var(--ink); }
.mkt-sheet-src-label { font-size: 13px; color: var(--muted); }
.mkt-sheet-thumbs { display: flex; gap: 6px; align-items: center; }
.mkt-sheet-thumbs img { width: 54px; height: 54px; object-fit: cover; border-radius: var(--r-sm); background: var(--paper-2); }
.mkt-sheet-more { font-family: var(--mono); font-size: 11.5px; color: var(--steel); }
.mkt-sheet-src.pathmode { flex-direction: column; align-items: stretch; gap: 6px; }
.mkt-sheet-pathinput { border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 9px 12px; font-family: var(--mono); font-size: 12.5px; color: var(--ink); background: var(--card); outline: none; transition: border-color .15s; }
.mkt-sheet-pathinput:focus { border-color: var(--violet); }
.mkt-cb-field-label { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.mkt-sheet-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mkt-sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.mkt-sheet-hint { font-size: 12.5px; color: var(--muted); }
.mkt-sheet-actions { display: flex; gap: 10px; margin-left: auto; }
.mkt-aspect-choice { margin: 17px 0 0; padding: 0; border: 0; }
.mkt-aspect-choice legend { margin-bottom: 8px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.mkt-aspect-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.mkt-aspect-options button { display: flex; align-items: baseline; justify-content: center; gap: 7px; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--card); color: var(--muted); cursor: pointer; }
.mkt-aspect-options button b { color: var(--ink); font-family: var(--display); font-size: 16px; font-weight: 600; }
.mkt-aspect-options button span { font-size: 12px; }
.mkt-aspect-options button:hover { border-color: var(--violet); }
.mkt-aspect-options button.on { border-color: var(--violet); background: var(--violet-soft); color: var(--violet); box-shadow: 0 0 0 1px var(--violet); }
.mkt-aspect-choice .mkt-sheet-hint { margin-top: 7px; }

/* the remix sheet's video-variants checkbox ("Also animate each variant into a 5s 9:16 video") */
.mkt-sheet-video-opt { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text); margin-top: 14px; cursor: pointer; }
.mkt-sheet-video-opt input { accent-color: var(--violet-fill); width: 15px; height: 15px; cursor: pointer; flex: 0 0 auto; }

/* Full-screen media viewer. It is separate from #modal so Details/Results can remain underneath. */
.mkt-media-expand { position: absolute; left: 8px; bottom: 8px; z-index: 6; width: 31px; height: 31px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.42); border-radius: 50%; background: rgba(12,12,15,.78); color: #fff; font-size: 15px; cursor: zoom-in; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.mkt-media-expand:hover { background: rgba(12,12,15,.94); }
.adspy-media .mkt-media-expand { left: auto; right: 41px; bottom: 7px; width: 27px; height: 27px; font-size: 13px; }
.adspy-media.detail .mkt-media-expand { right: 7px; bottom: 41px; }
.mkt-rr-video-wrap, .mkt-drawer-media { position: relative; }
.mkt-drawer-media .mkt-media-expand { bottom: 25px; }
body.mkt-media-viewer-open { overflow: hidden; }
.mkt-media-viewer { position: fixed; inset: 0; z-index: 200; display: grid; grid-template-rows: auto minmax(0, 1fr); padding: 14px; background: rgba(5,5,8,.96); color: #fff; }
.mkt-media-viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; padding: 0 0 12px; }
.mkt-media-viewer-bar > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgba(255,255,255,.72); font-size: 12px; }
.mkt-media-viewer-bar > div { display: flex; gap: 8px; }
.mkt-media-viewer-bar a, .mkt-media-viewer-bar button { width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; background: rgba(255,255,255,.08); color: #fff; font-size: 17px; cursor: pointer; }
.mkt-media-viewer-stage { min-height: 0; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.mkt-media-viewer-stage img, .mkt-media-viewer-stage video { max-width: 94vw; max-height: calc(100vh - 78px); width: auto; height: auto; object-fit: contain; background: #09090c; box-shadow: 0 20px 70px rgba(0,0,0,.5); cursor: default; }
@media (max-width: 700px) {
  .mkt-media-viewer { padding: 8px; }
  .mkt-media-viewer-bar { padding-bottom: 8px; }
  .mkt-media-viewer-bar a, .mkt-media-viewer-bar button { width: 42px; height: 42px; }
  .mkt-media-viewer-stage img, .mkt-media-viewer-stage video { max-width: calc(100vw - 16px); max-height: calc(100dvh - 66px); }
}

/* remix cost confirm — the spend gate shown before any fal generation (also reused, minimally, by the
   Regenerate confirm — same .mkt-costconfirm/.mkt-cost-note classes, no cost-lines list needed there) */
.mkt-cost-lines { list-style: none; margin: 4px 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.mkt-cost-lines li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; background: var(--paper); }
.mkt-cost-lines li + li { border-top: 1px solid var(--line); }
.mkt-cost-lines li span { font-size: 13px; color: var(--muted); }
.mkt-cost-lines li b { font-family: var(--display); font-size: 15px; font-weight: 500; color: var(--ink); }
.mkt-cost-note { font-size: 12.5px; line-height: 1.5; color: var(--muted); margin-top: 12px; }

/* --- the Ad Remix Results modal (the live generation grid — Nathan-parity centerpiece) --------------------- */
#modal-card:has(.mkt-rr) { width: 920px; }
.mkt-rr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.mkt-rr-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.mkt-rr-shot { position: relative; width: 100%; aspect-ratio: 1 / 1; flex: 0 0 auto; overflow: hidden; background: var(--paper-2); display: flex; align-items: center; justify-content: center; }
.mkt-rr-shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.mkt-rr-original .mkt-rr-shot { background: var(--media-bg); }
.mkt-rr-shot.none { font-family: var(--mono); font-size: 10.5px; color: var(--steel); text-align: center; padding: 10px; }
.mkt-rr-shot.err { flex-direction: column; gap: 8px; padding: 16px; text-align: center; background: var(--danger-soft-2); }
.mkt-rr-err-ico { font-size: 20px; color: var(--danger); }
.mkt-rr-err-text { font-size: 11px; line-height: 1.5; color: var(--danger); word-break: break-word; }
/* Run-ended-but-not-actually-done state (adsRemixResultsFinishIncomplete) and the plain run-failed
   state both drive this on #mkt-rr-subtitle — loud red instead of the quiet default .mkt-sub grey. */
.mkt-rr-sub-err { color: var(--danger); font-weight: 500; }
.mkt-rr-status { font-family: var(--mono); font-size: 11px; color: var(--steel); padding: 10px 12px 0; }
.mkt-rr-label { position: absolute; top: 8px; left: 8px; font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .08em; padding: 3px 8px; border-radius: 20px; background: rgba(255,255,255,.94); color: var(--violet); box-shadow: 0 1px 4px rgba(12,12,15,.18); text-transform: uppercase; }
.mkt-rr-hook { padding: 10px 12px 4px; font-size: 11.5px; font-weight: 500; letter-spacing: .03em; color: var(--text); line-height: 1.4; }
.mkt-rr-video-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-top: auto; border-top: 1px solid var(--line); }
.mkt-rr-video-tag { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--violet); }
.mkt-rr-video-status { font-family: var(--mono); font-size: 10.5px; color: var(--steel); }
.mkt-rr-video { width: 100%; max-height: 150px; border-radius: var(--r-sm); background: var(--media-bg); display: block; }
.mkt-rr-foot { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }

/* the slot spinner — a real eased CSS animation, not a static icon */
.mkt-rr-spin { width: 26px; height: 26px; border: 3px solid var(--line-2); border-top-color: var(--violet); border-radius: 50%; animation: mkt-spin .8s linear infinite; }
@keyframes mkt-spin { to { transform: rotate(360deg); } }

/* --- narrow ---------------------------------------------------------------------------------------------- */
@media (max-width: 860px) {
  .mkt-clientbar { grid-template-columns: 1fr; }
  .mkt-ad { grid-template-columns: 1fr; }
  .mkt-ad-media { width: 100%; }
  .mkt-ad-thumb, .mkt-ad-thumb.none, .mkt-ad-video { width: 100%; height: 160px; }
  .mkt-refreshed { margin-left: 0; }
  #modal-card:has(.ads-modal) { width: 100%; }
  #modal-card:has(.mkt-sheet) { width: 100%; }
  #modal-card:has(.mkt-rr) { width: 100%; }
  .mkt-sheet-fields { grid-template-columns: 1fr; }
  .mkt-scan-row { flex-direction: column; align-items: stretch; }
  /* Funnels row: stack on narrow screens so a hyphenated slug doesn't break character-by-character
     and the action buttons wrap inside the card instead of overflowing it. */
  .mkt-fn { flex-direction: column; align-items: flex-start; gap: 10px; }
  .mkt-fn-main { width: 100%; }
  .mkt-fn-name { overflow-wrap: anywhere; }
  .mkt-fn-acts { flex-wrap: wrap; width: 100%; }
  /* Creative Studio rebuild: the filter row and batch headers stack instead of overflowing a narrow
     (e.g. GHL iframe) viewport. */
  .mkt-studio-filters { flex-direction: column; align-items: stretch; }
  .mkt-studio-filters .filter-search { width: 100%; }
  .mkt-lib-batch-head { flex-wrap: wrap; }
  .mkt-lib-batch-links { margin-left: 0; width: 100%; }
}

/* ============================================================================================== */
/* Copy module (Copywriter — Copy Hub). Owned by modules/copy.js. Everything below is additive; no  */
/* rule above this line is touched. The module reuses .card/.grid/.pill/.field/.skill-card/.empty/  */
/* .mkt-note/.mkt-caveat/.mkt-req/.mkt-modal-head from elsewhere in this file — these two rules are  */
/* the only pieces genuinely missing: a "failed" status pill color, and a doc-modal width.           */
/* ============================================================================================== */
.pill.failed { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
#modal-card:has(.copy-doc) { width: 760px; }
@media (max-width: 860px) {
  #modal-card:has(.copy-doc) { width: 100%; }
}

/* ============================================================================================== */
/* Client Fulfillment (Fulfillment dept). Owned by modules/fulfillment.js. Additive only; no rule    */
/* above this line is touched. Reuses .card/.btn/.pill/.field-row/.seg/.empty/@keyframes pulse.      */
/* ============================================================================================== */
.ful-layout { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; }
.ful-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.ful-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--violet-fill); animation: pulse 1.6s infinite; }
.ful-ok { color: var(--ok); }
.ful-fail { color: var(--danger); }
.ful-miss { color: var(--amber); }
.ful-pend { color: var(--line-2); }
.ful-cb-row { display: flex; align-items: flex-start; gap: 9px; padding: 8px 0; }
.ful-cb-row input[type="checkbox"] { margin-top: 3px; accent-color: var(--violet-fill); }
@media (max-width: 860px) {
  .ful-layout { grid-template-columns: 1fr; }
  .ful-layout > * { min-width: 0; } /* grid children default to min-width:auto and overflow a 390px viewport */
  .ful-layout .field-row { grid-template-columns: 1fr; }
  .ful-grid4 { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================================================== */
/* Sales Agent (Sales Agent dept). Owned by modules/sales.js. Additive only; no rule above this      */
/* line is touched. Reuses .card/.empty/.mkt-kpis/.mkt-kpi/.mkt-tbl-wrap/.mkt-tbl/.mkt-status/       */
/* .mkt-caveat/.mkt-note/.mkt-plat/.mkt-na/.mkt-dim/.mkt-modal-head/.mkt-sub from the Marketing dept  */
/* (same cross-department reuse the Copy Hub already does off ads.js's classes) — chat bubbles and   */
/* the HALT signal color are the only pieces genuinely missing.                                      */
/* ============================================================================================== */
#modal-card:has(.sales-modal) { width: 640px; }
.mkt-status.halt { background: var(--danger-soft); color: var(--danger); }
.sales-modal-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.sales-msgs { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.sales-msg { max-width: 78%; padding: 9px 13px; border-radius: var(--r-sm); font-size: 13.5px; line-height: 1.5; }
.sales-msg.in { align-self: flex-start; background: var(--paper-2); color: var(--text); }
.sales-msg.out { align-self: flex-end; background: var(--violet-soft); color: var(--ink); }
.sales-msg-meta { font-size: 11px; color: var(--muted); margin-bottom: 3px; font-family: var(--mono); }
.sales-msg-body { white-space: pre-wrap; word-break: break-word; }
.sales-modal-head-acts { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
@media (max-width: 860px) {
  #modal-card:has(.sales-modal) { width: 100%; }
}

/* ---- Overview tab: 14-day trend mini chart ------------------------------------------------- */
.sales-chart { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px 14px; }
.sales-chart-bars { display: flex; align-items: flex-end; gap: 5px; height: 110px; }
.sales-chart-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.sales-chart-bargroup { display: flex; align-items: flex-end; gap: 2px; height: 92px; }
.sales-chart-bar { width: 6px; border-radius: 2px 2px 0 0; min-height: 1px; }
.sales-chart-bar.replies { background: var(--violet-fill); }
.sales-chart-bar.halts { background: var(--danger); }
.sales-chart-bar.newleads { background: var(--reach); }
.sales-chart-bar.gap { height: 100% !important; width: 4px; border-radius: 0; background: transparent; border-left: 1px dashed var(--line-2); }
.sales-chart-daylabel { font-family: var(--mono); font-size: 9px; color: var(--steel); white-space: nowrap; height: 12px; }
.sales-chart-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.sales-chart-legenditem { display: inline-flex; align-items: center; gap: 6px; }
.sales-chart-legenditem i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.sales-chart-legenditem i.replies { background: var(--violet-fill); }
.sales-chart-legenditem i.halts { background: var(--danger); }
.sales-chart-legenditem i.newleads { background: var(--reach); }

/* ---- Conversations tab: needs-human queue + search row ------------------------------------- */
.sales-nh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 4px; }
.sales-nh-card { text-align: left; font-family: var(--sans); background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; transition: transform .14s, border-color .14s; }
.sales-nh-card:hover { transform: translateY(-2px); border-color: var(--violet); }
.sales-nh-name { font-family: var(--display); font-size: 15px; font-weight: 500; color: var(--ink); }
.sales-nh-meta { font-size: 12.5px; color: var(--muted); font-family: var(--mono); }
.sales-nh-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.sales-nh-added { font-size: 11px; color: var(--steel); font-family: var(--mono); }
.sales-search-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.sales-search-hint { font-size: 12px; color: var(--amber); margin: 0 0 10px; }

/* ---- Conversations tab: awaiting-approval queue ---------------------------------------------- */
.sales-approvals-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 4px; }
.sales-approval-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.sales-approval-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sales-approval-name { font-family: var(--display); font-size: 14.5px; font-weight: 500; color: var(--ink); }
.sales-approval-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sales-approval-subject { font-size: 12.5px; color: var(--muted); font-style: italic; }
.sales-approval-reply { font-size: 13.5px; color: var(--text); white-space: pre-wrap; word-break: break-word; background: var(--paper-2); border-radius: var(--r-sm); padding: 10px 12px; }
.sales-approval-foot { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--steel); }
.sales-approval-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---- Simulator tab -------------------------------------------------------------------------- */
.sales-sim-controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; }
.sales-sim-controls select { border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 9px 12px; font-family: var(--sans); font-size: 13.5px; color: var(--ink); background: var(--card); outline: none; transition: border-color .15s; }
.sales-sim-controls select:focus { border-color: var(--violet); }
.sales-sim-log { max-height: 440px; overflow-y: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.sales-sim-composer { display: flex; gap: 10px; align-items: flex-end; }
.sales-sim-input { flex: 1; min-height: 56px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 10px 12px; font-family: var(--sans); font-size: 13.5px; resize: vertical; outline: none; transition: border-color .15s; }
.sales-sim-input:focus { border-color: var(--violet); }
.sales-sim-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.sales-sim-compliance-detail { font-size: 11.5px; color: var(--danger); margin-top: 4px; }

/* ---- Knowledge + Docs & SOPs tabs ------------------------------------------------------------ */
#modal-card:has(.sales-kb-modal) { width: 760px; }
.sales-kb-sha { font-family: var(--mono); font-size: 11.5px; color: var(--steel); margin-bottom: 16px; }
.sales-kb-group { margin-bottom: 22px; }
.sales-kb-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sales-kb-group-title { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.sales-kb-group-count { font-family: var(--mono); font-size: 11px; color: var(--steel); }
.sales-kb-list { display: flex; flex-direction: column; gap: 6px; }
.sales-kb-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 14px; cursor: pointer; font-family: var(--sans); transition: border-color .14s; }
.sales-kb-row:hover { border-color: var(--violet); }
.sales-kb-row-name { font-size: 13.5px; color: var(--ink); }
.sales-kb-row-meta { font-family: var(--mono); font-size: 11px; color: var(--steel); white-space: nowrap; }
.sales-kb-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.sales-kb-chip { font-family: var(--mono); }
.sales-kb-view { max-height: 60vh; overflow-y: auto; }
.sales-kb-editor { width: 100%; min-height: 440px; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; padding: 14px; border: 1px solid var(--line-2); border-radius: var(--r-sm); resize: vertical; outline: none; transition: border-color .15s; }
.sales-kb-editor:focus { border-color: var(--violet); }
.sales-kb-diff { max-height: 360px; overflow-y: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 4px; margin: 12px 0; font-family: var(--mono); font-size: 12px; }
.sales-diff-line { display: flex; gap: 8px; padding: 1px 12px; white-space: pre-wrap; word-break: break-word; }
.sales-diff-line.add { background: var(--reach-soft); color: var(--reach); }
.sales-diff-line.del { background: var(--danger-soft); color: var(--danger); }
.sales-diff-line.ctx { color: var(--muted); }
.sales-diff-sign { flex: 0 0 auto; font-weight: 700; }
.sales-diff-skip { padding: 4px 12px; color: var(--steel); font-style: italic; }
.sales-kb-proof-input { margin-top: 8px; width: 100%; max-width: 240px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 8px 10px; font-family: var(--mono); font-size: 13px; outline: none; }
.sales-kb-proof-input:focus { border-color: var(--violet); }

/* ---- Agent Ops tab ---------------------------------------------------------------------------- */
.sales-kv { display: flex; flex-direction: column; gap: 7px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 16px; }
.sales-kv-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.sales-kv-k { color: var(--muted); }
.sales-kv-v { color: var(--ink); font-weight: 500; }
.sales-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--text); }

/* ---- Agent Ops tab: master switch / trust ladder / service health ----------------------------- */
.sales-master-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 4px; }
.sales-master-status { display: flex; align-items: center; gap: 10px; }
.sales-master-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--steel); flex: 0 0 auto; }
.sales-master-dot.live { background: var(--reach); box-shadow: 0 0 0 4px var(--reach-soft); }
.sales-master-dot.halt { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.sales-master-label { font-family: var(--display); font-size: 18px; font-weight: 500; color: var(--ink); letter-spacing: -.01em; }
.sales-trust-ladder { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 18px; }
.sales-trust-opt { flex: 1; min-width: 180px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); opacity: .55; transition: opacity .14s, border-color .14s, background .14s; }
.sales-trust-opt.on { opacity: 1; border-color: var(--violet); background: var(--violet-soft); }
.sales-trust-opt-title { font-family: var(--display); font-size: 14px; font-weight: 500; color: var(--ink); }
.sales-trust-opt-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sales-health-kpis .mkt-kpi-num { font-size: 14px; word-break: break-word; line-height: 1.3; }

@media (max-width: 860px) {
  #modal-card:has(.sales-kb-modal) { width: 100%; }
  .sales-sim-controls { flex-direction: column; align-items: stretch; }
  .sales-sim-composer { flex-direction: column; align-items: stretch; }
  .sales-master-card { flex-direction: column; align-items: stretch; text-align: center; }
  .sales-trust-ladder { flex-direction: column; align-items: stretch; }
}

/* ---- Build Map tab ----------------------------------------------------------------------------- */
.sales-map-diagram { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 22px 20px; margin-bottom: 4px; }
.sales-map-flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; }
.sales-map-box { flex: 0 1 150px; min-width: 140px; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; font-family: var(--display); font-size: 13.5px; font-weight: 500; color: var(--ink); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 4px; }
.sales-map-box.accent { background: var(--violet-soft); border-color: var(--violet); }
.sales-map-box.halt { background: var(--danger-soft); border-color: var(--danger-line); }
.sales-map-box.lane { background: var(--reach-soft); border-color: var(--reach); }
.sales-map-box-sub { font-family: var(--mono); font-size: 10.5px; font-weight: 400; color: var(--muted); }
.sales-map-arrow { display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--steel); flex: 0 0 auto; padding: 0 2px; }
.sales-map-branch { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 14px 0; max-width: 260px; }
.sales-map-branch-arrow { font-size: 18px; color: var(--steel); }
.sales-map-loop { font-family: var(--mono); font-size: 11.5px; color: var(--muted); background: var(--paper); border: 1px dashed var(--line-2); border-radius: var(--r-sm); padding: 10px 14px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sales-map-loop-arrow { font-size: 15px; color: var(--violet); }
@media (max-width: 860px) {
  .sales-map-box { flex-basis: 100%; }
  .sales-map-arrow { transform: rotate(90deg); }
}

/* ---- Start Here tab ---------------------------------------------------------------------------- */
.sales-setup-list { display: flex; flex-direction: column; gap: 10px; }
.sales-setup-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 13px 16px; }
.sales-setup-row-main { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.sales-setup-icon { font-family: var(--mono); font-size: 15px; line-height: 1.4; flex: 0 0 auto; width: 20px; text-align: center; }
.sales-setup-icon.ok { color: var(--reach); }
.sales-setup-icon.warn { color: var(--amber); }
.sales-setup-icon.unknown { color: var(--steel); }
.sales-setup-row-label { font-family: var(--display); font-size: 14px; font-weight: 500; color: var(--ink); }
.sales-setup-row-detail { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Amber toast — the one non-.sales-scoped hook this build needs (verified:false on an approved send) */
/* is kept sales-namespaced ("sales-warn", not a new global "warn" toast type) per the file's scope.   */
.toast.sales-warn { background: var(--amber); }

/* ============================================================================================== */
/* Ask (chat). Owned by modules/ask.js. Additive only; no rule above this line is touched. Reuses    */
/* .card/.btn/.btn-primary/.pill/.pill.ghost/.md/mdToHtml() and .mkt-note (the Loading… note, cross- */
/* department reuse same as Copy Hub/Sales Agent do off the Marketing dept) — the two-column layout, */
/* hero cards, starter chips, bubbles, and the pill-shaped composer are the only pieces missing.      */
/* ============================================================================================== */
/* Bounded height (not min-height): the thread must be its own scroll container so the composer
   stays on screen and ask.js's scrollTop auto-follow works — with an unbounded wrap the outer
   .main pane scrolls instead and long answers push the composer out of view. 145px ≈ topbar + the
   .view top padding. */
.ask-wrap { display: grid; grid-template-columns: 230px 1fr; gap: 18px; height: calc(100vh - 145px); min-height: 480px; }

/* --- saved-chats rail -------------------------------------------------------------------------- */
.ask-hist { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.ask-new-btn { width: 100%; justify-content: center; }
.ask-hist-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.ask-hist-item { position: relative; display: flex; align-items: center; gap: 6px; padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer; transition: background .14s; }
.ask-hist-item:hover { background: var(--paper-2); }
.ask-hist-item:hover .ask-hist-del { opacity: 1; }
.ask-hist-item.active { background: var(--violet-soft); }
.ask-hist-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ask-hist-title { font-size: 13.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ask-hist-time { font-family: var(--mono); font-size: 10.5px; color: var(--steel); }
.ask-hist-del { flex: 0 0 auto; opacity: 0; transition: opacity .14s, color .14s, background .14s; border: none; background: none; color: var(--muted); cursor: pointer; font-size: 12px; width: 22px; height: 22px; border-radius: 50%; }
.ask-hist-del:hover { color: var(--danger); background: var(--danger-soft); }
.ask-hist-empty, .ask-hist-error { font-size: 12.5px; color: var(--muted); padding: 10px 6px; }
.ask-hist-error { color: var(--danger); }

/* --- chat column shell --------------------------------------------------------------------------- */
.ask-col { display: flex; flex-direction: column; min-height: 0; gap: 14px; }
.ask-col-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* --- empty-thread hero ----------------------------------------------------------------------------- */
.ask-empty-wrap { flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 10px 8px; }
.ask-hero { text-align: center; }
.ask-hero h1 { font-size: 34px; font-weight: 300; letter-spacing: -.02em; }
.ask-hero h1 b { font-weight: 700; }
.ask-hero-sub { margin: 10px 0 0; color: var(--muted); font-size: 14.5px; }
.ask-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; max-width: 720px; }
.ask-card { border-radius: var(--r-lg); padding: 20px 22px; }
.ask-card-left { background: var(--violet-soft); border: 1px solid rgba(124,58,237,.25); }
.ask-card-right { background: var(--card); border: 1px solid var(--line); }
.ask-card-title { font-family: var(--display); font-size: 15.5px; font-weight: 500; color: var(--ink); margin-bottom: 10px; }
.ask-card-blurb { font-size: 13px; line-height: 1.55; color: var(--text); }
.ask-card-accent { margin-top: 12px; font-size: 13px; font-weight: 500; color: var(--violet); }
.ask-track-row { display: flex; align-items: baseline; gap: 9px; padding: 10px 0; font-size: 13px; color: var(--text); border-top: 1px solid var(--line); }
.ask-track-row:first-of-type { border-top: none; padding-top: 0; }
.ask-foot { color: var(--muted); font-size: 12.5px; text-align: center; }
.ask-chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 720px; }
.ask-chip { border: 1px solid rgba(124,58,237,.35); background: transparent; color: var(--violet); font-family: var(--sans); font-size: 13px; padding: 8px 15px; border-radius: 999px; cursor: pointer; transition: background .14s; }
.ask-chip:hover { background: var(--violet-soft); }

/* --- thread + bubbles ------------------------------------------------------------------------------- */
.ask-thread { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 6px 4px 10px; }
.ask-msg-user { align-self: flex-end; max-width: 74%; background: var(--violet-fill); color: #fff; padding: 11px 16px; border-radius: 18px 18px 4px 18px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.ask-msg-assistant { align-self: flex-start; max-width: 84%; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 14px 16px; }
.ask-avatar { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--violet-soft); font-size: 12px; margin-bottom: 8px; }
.ask-evt-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.ask-evt-pill { font-family: var(--mono); font-size: 11px; }
.pill.ask-fail { color: var(--danger); border-color: var(--danger); }
.ask-dots { display: inline-flex; gap: 4px; align-items: center; padding: 3px 0; }
.ask-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: ask-dot 1.2s infinite ease-in-out; }
.ask-dots span:nth-child(2) { animation-delay: .15s; }
.ask-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes ask-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* --- composer ---------------------------------------------------------------------------------------- */
.ask-composer { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 6px 6px 6px 18px; transition: border-color .15s; }
.ask-composer:focus-within { border-color: var(--violet); }
.ask-composer-input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-family: var(--sans); font-size: 14.5px; color: var(--ink); padding: 10px 0; }
.ask-composer-input::placeholder { color: var(--muted); }
.ask-send { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; border: none; background: var(--violet-fill); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .14s; }
.ask-send:hover:not(:disabled) { background: var(--violet-fill-hover); }
.ask-send:disabled { opacity: .45; cursor: not-allowed; }
.ask-save-err { display: flex; justify-content: center; min-height: 0; }

/* --- narrow ------------------------------------------------------------------------------------------- */
@media (max-width: 860px) {
  .ask-wrap { grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 420px; }
  .ask-hist { flex-direction: row; align-items: center; gap: 10px; }
  .ask-hist-list { flex-direction: row; overflow-x: auto; overflow-y: visible; }
  .ask-hist-item { flex: 0 0 auto; }
  .ask-new-btn { width: auto; flex: 0 0 auto; }
  .ask-cards { grid-template-columns: 1fr; }
  .ask-hero h1 { font-size: 26px; }
}

/* ============================================================================================== */
/* Theme toggle (topbar-right). Sun/moon crossfade; markup lives in index.html, wiring in app.js.  */
/* ============================================================================================== */
/* range sliders (ROI dept): Chromium paints a LIGHT track whenever accent-color is set, ignoring
   color-scheme — so the track is painted here off the tokens instead. Hairline rail, violet thumb,
   consistent in both themes. */
input[type="range"] { -webkit-appearance: none; appearance: none; height: 22px; background: transparent; padding: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: var(--line-2); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--violet-fill); border: none; margin-top: -5px; box-shadow: 0 1px 4px rgba(12,12,15,.3); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 999px; background: var(--line-2); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--violet-fill); border: none; }

.theme-toggle { position: relative; width: 36px; height: 36px; padding: 0; justify-content: center; }
.theme-toggle svg { position: absolute; width: 18px; height: 18px; transition: opacity .35s cubic-bezier(0.2,0.7,0.3,1), transform .35s cubic-bezier(0.2,0.7,0.3,1); }
.theme-toggle .tt-sun { opacity: 1; transform: rotate(0) scale(1); }
.theme-toggle .tt-moon { opacity: 0; transform: rotate(-90deg) scale(.5); }
:root[data-theme="dark"] .theme-toggle .tt-sun { opacity: 0; transform: rotate(90deg) scale(.5); }
:root[data-theme="dark"] .theme-toggle .tt-moon { opacity: 1; transform: rotate(0) scale(1); }

/* the flip itself eases — class added by app.js for ~400ms on toggle only, so first paint never animates */
html.theme-anim, html.theme-anim body, html.theme-anim * { transition: background-color .25s ease, color .25s ease, border-color .25s ease, box-shadow .25s ease !important; }

/* ============================================================================================== */
/* Creative Studio 4-tab library IA. Additive overrides for modules/ads.js.                         */
/* ============================================================================================== */
.main:has(.mkt-studio-tool), .main:has(.adspy-tool) { background-color: var(--paper); background-image: none; }
.mkt-studio-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 20px; padding: 4px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper-2); }
.mkt-studio-tabs button { min-width: 0; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--muted); padding: 10px 12px; font-family: var(--sans); font-size: 13px; font-weight: 500; cursor: pointer; transition: color .14s, background .14s, border-color .14s; }
.mkt-studio-tabs button:hover { color: var(--ink); }
.mkt-studio-tabs button.on { color: var(--ink); background: var(--card); border-color: var(--line); }
.mkt-studio-tabs button:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

.mkt-grid-tally { margin-bottom: 12px; }
.mkt-saved-copy { font-size: 12.5px; line-height: 1.5; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mkt-card-actions, .mkt-src-acts, .mkt-lib-acts { flex-wrap: wrap; }
.mkt-src-acts .mkt-star-btn, .mkt-src-acts .mkt-card-delete { flex: 0 0 auto; }
.mkt-star-btn { justify-content: center; color: var(--muted); }
.mkt-star-btn.on { color: var(--amber); border-color: var(--amber-line); background: var(--amber-soft); }
.mkt-star-btn.busy { position: relative; opacity: .62; }
.mkt-star-btn.busy::after { content: ""; width: 10px; height: 10px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: mkt-spin .7s linear infinite; }
.mkt-card-delete { color: var(--muted); }
.mkt-card-delete:hover, .mkt-card-delete:focus-visible { color: var(--danger); border-color: var(--danger-line); background: var(--danger-soft); }

.mkt-client-groups { display: flex; flex-direction: column; gap: 28px; }
.mkt-client-group { display: flex; flex-direction: column; gap: 12px; }
.mkt-client-group-head { display: flex; align-items: center; gap: 9px; padding-bottom: 9px; border-bottom: 1px solid var(--line-2); }
.mkt-client-group-head h3 { font-size: 20px; font-weight: 500; }
.mkt-ours-badge { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--violet); background: var(--violet-soft); border: 1px solid rgba(124,58,237,.25); border-radius: 999px; padding: 3px 8px; }
.mkt-client-group .mkt-lib-batch-head { align-items: center; }
.mkt-client-group .mkt-lib-batch-slug { font-family: var(--mono); font-size: 11.5px; font-weight: 400; color: var(--muted); }

.mkt-my-section { display: flex; flex-direction: column; gap: 12px; }
.mkt-my-section + .mkt-my-section { margin-top: 30px; }
.mkt-library-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 9px; border-bottom: 1px solid var(--line-2); }
.mkt-library-section-head h3 { font-size: 19px; font-weight: 500; }
.mkt-library-section-head span { font-family: var(--mono); font-size: 11px; color: var(--steel); }
.mkt-keeper-grid, .mkt-live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; }
.mkt-live-card { overflow: hidden; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.mkt-live-shot { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: var(--paper-2); }
.mkt-live-shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mkt-live-none { height: 100%; display: flex; align-items: center; justify-content: center; padding: 18px; text-align: center; font-family: var(--mono); font-size: 10.5px; color: var(--steel); }
.mkt-live-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 13px; }
.mkt-live-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; color: var(--ink); }

#modal-card:has(.mkt-delete-confirm) { width: 570px; }
.mkt-delete-warning { padding: 14px 16px; border: 1px solid var(--danger-line); border-radius: var(--r-sm); background: var(--danger-soft); color: var(--danger); font-size: 13.5px; line-height: 1.55; }
.mkt-delete-confirm .mkt-danger-btn { font-weight: 600; }

@media (max-width: 700px) {
  .mkt-studio-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mkt-studio-tabs button { padding: 9px 8px; }
  .mkt-studio-selection { align-items: stretch; flex-direction: column; gap: 11px; }
  .mkt-studio-selection-actions { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .mkt-studio-selection-actions .btn { justify-content: center; }
  .mkt-history-pulls > div { align-items: stretch; flex-direction: column; }
  .mkt-star-btn span, .mkt-card-delete span { display: none; }
  #modal-card:has(.mkt-delete-confirm) { width: 100%; }
}

/* ============================================================================================== */
/* Progressive Ad Spy search feed. Nathan's anatomy/density on the existing SPECIMEN-LIGHT tokens. */
/* The durable swipe-library rules above stay intact for tabLibrary(); these classes are isolated. */
.adspy-subtabs { display: flex; gap: 18px; margin: 0 0 14px; border-bottom: 1px solid var(--line); }
.adspy-subtabs button { padding: 9px 1px 8px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; }
.adspy-subtabs button:hover, .adspy-subtabs button.on { color: var(--ink); border-bottom-color: var(--violet); }
.adspy-page-choices { display: grid; gap: 5px; margin: 12px 0; padding: 12px; border: 1px solid var(--amber-line); border-radius: 8px; background: var(--amber-soft); }
.adspy-page-choices > span { color: var(--muted); font-size: 11px; }
.adspy-page-choices > div { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.adspy-load-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 18px 0 8px; }
.adspy-exhausted { padding: 16px 0 4px; color: var(--steel); font-size: 10px; text-align: center; }
/* ============================================================================================== */
.adspy-tool { max-width: 1240px; margin: 0 auto; }
.adspy-tool .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.adspy-tool .adspy-icon, .adspy-details-modal .adspy-icon { width: 14px; height: 14px; flex: 0 0 auto; display: block; }
.adspy-flow-intro { display: flex; align-items: baseline; gap: 8px; margin: -2px 0 12px; padding: 8px 1px 10px; border-bottom: 1px solid var(--line); }
.adspy-flow-intro b { color: var(--ink); font-size: 13px; }
.adspy-flow-intro span { color: var(--muted); font-size: 12px; }
.adspy-banner { display: flex; align-items: center; gap: 13px; padding: 16px 18px; margin-bottom: 14px; border: 1px solid rgba(255,255,255,.15); border-radius: 12px; color: #fff; background: linear-gradient(128deg, var(--violet-d), var(--violet-fill)); }
.adspy-banner-icon { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.2); font-size: 20px; }
.adspy-banner-icon svg { width: 23px; height: 23px; fill: none; stroke: #fff; stroke-width: 1.8; }
.adspy-banner h2 { color: #fff; font-size: 17px; font-weight: 700; letter-spacing: .045em; }
.adspy-banner p { margin: 2px 0 0; color: rgba(255,255,255,.78); font-size: 12.5px; }

.adspy-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: stretch; }
.adspy-search { min-width: 0; display: flex; align-items: center; gap: 9px; height: 43px; padding: 0 13px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--card); color: var(--steel); transition: border-color .14s, box-shadow .14s; }
.adspy-search:focus-within { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft); }
.adspy-search input { width: 100%; min-width: 0; border: 0; outline: 0; padding: 0; background: transparent; color: var(--ink); font-family: var(--sans); font-size: 13.5px; }
.adspy-search input::placeholder { color: var(--steel); }
.adspy-search-button { min-width: 120px; justify-content: center; border-radius: 9px; padding: 8px 15px; }
.adspy-button-spin { width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: mkt-spin .75s linear infinite; }

.adspy-suggestions, .adspy-filter-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.adspy-suggestions { padding: 10px 1px 9px; }
.adspy-row-label { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; margin-right: 2px; color: var(--muted); font-family: var(--mono); font-size: 10.5px; }
.adspy-suggestions button { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; background: var(--paper-2); color: var(--muted); font-family: var(--sans); font-size: 11.5px; cursor: pointer; transition: color .14s, border-color .14s, background .14s; }
.adspy-suggestions button:hover, .adspy-suggestions button:focus-visible { color: var(--violet); border-color: var(--violet); background: var(--violet-soft); outline: none; }
.adspy-filter-row { min-height: 38px; padding: 7px 0 11px; margin-bottom: 11px; border-bottom: 1px solid var(--line); }
.adspy-filter-row label { display: inline-flex; }
.adspy-filter-row select { min-height: 30px; padding: 4px 27px 4px 9px; border: 1px solid var(--line-2); border-radius: 7px; outline: 0; color: var(--text); font-family: var(--sans); font-size: 11.5px; cursor: pointer; }
.adspy-filter-row select:focus-visible { border-color: var(--violet); box-shadow: 0 0 0 2px var(--violet-soft); }
.adspy-results-count { margin-left: auto; color: var(--steel); font-family: var(--mono); font-size: 10.5px; font-variant-numeric: tabular-nums; }

.adspy-empty { min-height: 280px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px 20px; }
.adspy-first-run { min-height: 230px; }
.adspy-empty-eye { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 13px; border: 1px solid var(--line-2); border-radius: 50%; background: var(--card); color: var(--violet); font-size: 24px; }
.adspy-empty-eye svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.adspy-empty h2 { font-size: 15px; font-weight: 700; letter-spacing: .055em; }
.adspy-empty p { max-width: 470px; margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.adspy-empty .btn { margin-top: 16px; }
.adspy-empty-steps { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.adspy-empty-steps span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--text); font-size: 11px; }
.adspy-empty-steps b { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: var(--violet-soft); color: var(--violet); font-family: var(--mono); font-size: 9px; }
.adspy-first-run small { max-width: 530px; margin-top: 14px; color: var(--steel); font-size: 10.5px; line-height: 1.5; }

.adspy-scan-state { min-height: 310px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.adspy-scan-state.compact { min-height: 0; flex-direction: row; justify-content: flex-start; text-align: left; margin-bottom: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); }
.adspy-spinner { width: 38px; height: 38px; flex: 0 0 auto; border: 4px solid var(--violet-soft); border-top-color: var(--violet-fill); border-radius: 50%; animation: mkt-spin .8s linear infinite; }
.adspy-scan-state.compact .adspy-spinner { width: 20px; height: 20px; border-width: 3px; }
.adspy-scan-state b { display: block; color: var(--ink); font-family: var(--display); font-size: 14px; font-weight: 500; }
.adspy-scan-state span:not(.adspy-spinner) { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; }
.adspy-progress { width: min(260px, 42vw); height: 3px; margin-left: auto; overflow: hidden; border-radius: 999px; background: var(--paper-2); }
.adspy-progress span { height: 100%; margin: 0 !important; background: var(--violet-fill); }
.adspy-cache-note, .adspy-caveat { margin-bottom: 10px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-2); color: var(--muted); font-size: 11.5px; }
.adspy-cache-note span { margin-right: 5px; color: var(--violet); font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.adspy-caveat { border-color: var(--amber-line); background: var(--amber-soft); }
.adspy-caveat b { color: var(--amber); }
.adspy-error { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; margin-bottom: 11px; padding: 12px 14px; border: 1px solid var(--danger-line); border-radius: 10px; background: var(--danger-soft); }
.adspy-error-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--danger); color: #fff; font-weight: 700; }
.adspy-error h2 { color: var(--danger); font-size: 14px; }
.adspy-error p { margin: 2px 0 0; color: var(--text); font-size: 12px; }

.adspy-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.adspy-card { min-width: 0; height: 100%; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--card); }
.adspy-media { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: var(--media-bg); }
.adspy-media-el { width: 100%; height: 100%; display: block; object-fit: cover; background: var(--media-bg); }
.adspy-media video { object-fit: contain; }
.adspy-media-badge, .adspy-days { position: absolute; top: 7px; z-index: 2; display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 999px; font-family: var(--mono); font-size: 9px; line-height: 1.2; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.adspy-media-badge { left: 7px; color: #fff; background: rgba(12,12,15,.76); }
.adspy-days { right: 7px; color: #fff; background: var(--reach); }
.adspy-media-download { position: absolute; right: 7px; bottom: 7px; z-index: 3; width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; background: rgba(12,12,15,.76); color: #fff; font-size: 15px; }
.adspy-play { position: absolute; inset: 50% auto auto 50%; z-index: 2; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; transform: translate(-50%,-50%); border: 1px solid rgba(255,255,255,.4); border-radius: 50%; background: rgba(12,12,15,.72); color: #fff; cursor: pointer; }
.adspy-media.playing .adspy-play { display: none; }
.adspy-playback-unavailable { position: absolute; left: 7px; right: 41px; bottom: 7px; z-index: 2; overflow: hidden; padding: 4px 7px; border-radius: 5px; background: rgba(12,12,15,.78); color: rgba(255,255,255,.86); font-family: var(--mono); font-size: 8.5px; text-overflow: ellipsis; white-space: nowrap; }
.adspy-media-failed { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 15px; text-align: center; background: var(--danger-soft-2); color: var(--danger); }
.adspy-media-failed b { font-size: 12px; }
.adspy-media-failed span { font-size: 10.5px; color: var(--muted); }
.adspy-media-failed .btn { margin-top: 4px; }

.adspy-card-body { display: flex; flex: 1; flex-direction: column; gap: 7px; padding: 10px 11px 9px; }
.adspy-identity { display: flex; align-items: center; gap: 8px; min-width: 0; }
.adspy-identity > div { min-width: 0; }
.adspy-avatar { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; object-fit: cover; border: 1px solid var(--line); border-radius: 50%; background: var(--paper-2); }
.adspy-avatar.fallback { color: var(--violet); font-family: var(--display); font-size: 12px; font-weight: 700; }
.adspy-page { overflow: hidden; color: var(--ink); font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.adspy-platforms { overflow: hidden; margin-top: 1px; color: var(--steel); font-family: var(--mono); font-size: 8.5px; text-overflow: ellipsis; white-space: nowrap; }
.adspy-primary, .adspy-headline { position: relative; line-height: 1.45; }
.adspy-primary { min-height: 52px; color: var(--text); font-size: 11.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.adspy-headline { min-height: 19px; color: var(--ink); font-size: 11.8px; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.adspy-primary.unavailable, .adspy-headline.unavailable { color: var(--steel); font-style: italic; opacity: .72; }
.adspy-copy-one { position: absolute; top: 0; right: 0; width: 19px; height: 19px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: var(--steel); cursor: pointer; }
.adspy-copy-one:hover { color: var(--violet); }
.adspy-description { color: var(--muted); font-size: 10.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.adspy-business { color: var(--ink); font-size: 10.5px; font-weight: 700; }
.adspy-business.unclassified { color: var(--steel); font-weight: 500; }

.adspy-destination { min-width: 0; min-height: 27px; display: flex; align-items: center; gap: 6px; margin-top: auto; padding: 4px 5px; border-top: 1px solid var(--line); }
.adspy-destination a { min-width: 0; flex: 1; overflow: hidden; color: var(--info); font-family: var(--mono); font-size: 8.8px; text-overflow: ellipsis; white-space: nowrap; }
.adspy-dest-chip, .adspy-cta { flex: 0 0 auto; padding: 2px 6px; border-radius: 999px; font-size: 8.8px; font-weight: 600; white-space: nowrap; }
.adspy-dest-chip { display: inline-flex; align-items: center; gap: 3px; }
.adspy-dest-chip { color: var(--reach); background: var(--reach-soft); }
.adspy-cta { margin-left: auto; color: var(--text); background: var(--paper-2); }
.adspy-destination.lead .adspy-dest-chip { color: var(--amber); background: var(--amber-soft); }
.adspy-destination.lead .adspy-cta { color: var(--amber); }
.adspy-destination.unavailable, .adspy-dest-missing { color: var(--steel); font-size: 9.5px; }

.adspy-actions { display: flex; align-items: center; gap: 5px; padding: 6px 10px; border-top: 1px solid var(--line); }
.adspy-actions.conversion { padding-top: 8px; }
.adspy-actions.conversion .adspy-action { height: 31px; font-size: 10.5px; font-weight: 650; }
.adspy-actions.secondary { padding-top: 0; border-top: 0; }
.adspy-actions.links { justify-content: space-between; padding: 6px 11px 8px; border-top: 0; }
.adspy-action { min-width: 0; flex: 1; height: 25px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 5px; border: 1px solid var(--line-2); border-radius: 6px; background: transparent; color: var(--text); font-family: var(--sans); font-size: 9.7px; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; }
.adspy-action:hover:not(:disabled), .adspy-action:focus-visible:not(:disabled) { border-color: var(--violet); color: var(--violet); outline: none; }
.adspy-action.violet { border-color: rgba(109,40,217,.3); color: var(--violet); }
.adspy-action.blue { border-color: var(--info-line); color: var(--info); }
.adspy-action.blue.saved { color: #fff; border-color: var(--violet-fill); background: var(--violet-fill); }
.adspy-action.saved { color: var(--violet); border-color: rgba(109,40,217,.35); background: var(--violet-soft); }
.adspy-actions.library-save .adspy-action { flex-basis: 100%; }
.adspy-action:disabled { opacity: .3; cursor: not-allowed; }
.adspy-action-link { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: transparent; color: var(--muted); font-family: var(--sans); font-size: 9.7px; cursor: pointer; }
.adspy-action-link:hover:not(:disabled) { color: var(--violet); }
.adspy-action-link:disabled, .adspy-action-link.disabled { opacity: .3; cursor: not-allowed; }
.adspy-more { margin: 0 10px 8px; border-top: 1px solid var(--line); }
.adspy-more summary { padding: 7px 1px 1px; color: var(--muted); font-family: var(--mono); font-size: 9.5px; text-align: center; cursor: pointer; list-style-position: inside; }
.adspy-more summary:hover, .adspy-more summary:focus-visible { color: var(--violet); outline: none; }
.adspy-more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; padding-top: 7px; }
.adspy-more-grid .adspy-action:last-child:nth-child(odd) { grid-column: 1 / -1; }

#modal-card:has(.adspy-details-modal) { width: 920px; }
.adspy-detail-layout { display: grid; grid-template-columns: minmax(240px, .85fr) minmax(0, 1.15fr); gap: 18px; }
.adspy-media.detail { aspect-ratio: 4 / 3; border-radius: 9px; }
.adspy-detail-media-more { position: absolute; left: 7px; bottom: 7px; z-index: 3; display: flex; gap: 4px; }
.adspy-detail-media-more img { width: 35px; height: 35px; object-fit: cover; border: 1px solid rgba(255,255,255,.55); border-radius: 5px; }
.adspy-detail-copy { display: flex; flex-direction: column; gap: 11px; }
.adspy-detail-copy section { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.adspy-detail-copy h3 { margin-bottom: 4px; font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--steel); }
.adspy-detail-copy p { margin: 0; color: var(--text); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.adspy-detail-no-media { min-height: 180px; display: grid; place-items: center; padding: 20px; border: 1px dashed var(--line-2); border-radius: 9px; color: var(--steel); text-align: center; }
.adspy-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 18px 0 0; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--line); }
.adspy-meta > div { min-width: 0; padding: 9px 10px; background: var(--card); }
.adspy-meta dt { color: var(--steel); font-family: var(--mono); font-size: 8.7px; text-transform: uppercase; letter-spacing: .06em; }
.adspy-meta dd { margin: 2px 0 0; overflow-wrap: anywhere; color: var(--ink); font-size: 11px; }
.adspy-detail-links { display: flex; gap: 8px; margin-top: 14px; }

@media (max-width: 1120px) {
  .adspy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .adspy-flow-intro { align-items: flex-start; flex-direction: column; gap: 2px; }
  .adspy-search-row { grid-template-columns: 1fr; }
  .adspy-search-button { width: 100%; }
  .adspy-filter-row { align-items: stretch; }
  .adspy-filter-row label, .adspy-filter-row select { flex: 1 1 100%; width: 100%; }
  .adspy-results-count { width: 100%; margin: 4px 0 0; text-align: right; }
  .adspy-scan-state.compact { align-items: flex-start; }
  .adspy-progress { width: 70px; }
  .adspy-error { grid-template-columns: auto 1fr; }
  .adspy-error .btn { grid-column: 1 / -1; justify-content: center; }
  .adspy-grid { grid-template-columns: 1fr; }
  #modal-card:has(.adspy-details-modal) { width: 100%; }
  .adspy-detail-layout { grid-template-columns: 1fr; }
  .adspy-meta { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 430px) {
  .adspy-suggestions { gap: 5px; }
  .adspy-actions { padding-inline: 8px; }
  .adspy-action { font-size: 9px; }
  .adspy-meta { grid-template-columns: 1fr; }
}

/* FUNNEL BUILDER */
.fnb-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}
.fnb-list-head h2,
.fnb-create-head h2 {
  font-size: 24px;
  font-weight: 500;
}
.fnb-list-head p,
.fnb-create-head p {
  max-width: 650px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.fnb-list-head-actions { display: flex; align-items: center; gap: 8px; }
.fnb-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
}
.fnb-list-row {
  display: grid;
  grid-template-columns: 34px minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 13px;
  min-height: 72px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
}
.fnb-list-row:last-child { border-bottom: 0; }
.fnb-list-row:hover { background: var(--paper-2); }
.fnb-list-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--violet);
  background: var(--paper);
  font-size: 17px;
}
.fnb-list-copy { min-width: 0; }
.fnb-list-name {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--display);
  font-size: 15px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fnb-list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.fnb-list-meta code { font-family: var(--mono); }
.fnb-chips,
.fnb-list-actions,
.fnb-editor-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.fnb-chip {
  padding: 3px 8px;
  border: 1px solid var(--amber-line);
  border-radius: 999px;
  color: var(--amber);
  background: var(--amber-soft);
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.fnb-chip.muted {
  border-color: var(--line-2);
  color: var(--steel);
  background: var(--paper-2);
}
.fnb-chip.danger {
  border-color: var(--danger-line);
  color: var(--danger);
  background: var(--danger-soft);
}
.fnb-chip.ok {
  border-color: color-mix(in srgb, var(--ok) 30%, transparent);
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 10%, var(--card));
}
.fnb-chip.running { border-color: color-mix(in srgb, var(--violet) 30%, transparent); color: var(--violet); background: var(--violet-soft); }
.fnb-row-error {
  grid-column: 2 / -1;
  margin-top: -5px;
  color: var(--danger);
  font-size: 11px;
}
.fnb-trash { margin-bottom: 18px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper-2); }
.fnb-trash-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.fnb-trash-head > div { display: flex; flex-direction: column; }
.fnb-trash-head b, .fnb-trash-row b { color: var(--ink); }
.fnb-trash-head span, .fnb-trash-row span { color: var(--muted); font-size: 11px; }
.fnb-trash-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.fnb-trash-row:last-child { border-bottom: 0; }
.fnb-trash-row > div { display: flex; min-width: 0; flex-direction: column; }
.fnb-trash-row code { color: var(--steel); font-family: var(--mono); font-size: 10px; }
.fnb-danger-btn { color: var(--danger); }
.fnb-create-shell { max-width: 920px; margin: 0 auto; }
.fnb-create-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}
.fnb-back {
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  background: var(--card);
  cursor: pointer;
}
.fnb-back:hover { border-color: var(--violet); color: var(--violet); }
.fnb-create-card,
.fnb-section-card,
.fnb-settings,
.fnb-running {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  box-shadow: var(--shadow);
}
.fnb-create-card { padding: 22px; }
.fnb-form-grid,
.fnb-color-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.fnb-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin-bottom: 12px;
}
.fnb-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
}
.fnb-field input,
.fnb-field textarea,
.fnb-field select,
.fnb-option input {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  outline: none;
  color: var(--ink);
  background: var(--paper);
  font: inherit;
  font-size: 13px;
}
.fnb-field input,
.fnb-field select,
.fnb-option input { min-height: 38px; padding: 8px 10px; }
.fnb-field textarea { min-height: 70px; padding: 9px 10px; resize: vertical; }
.fnb-field input:focus,
.fnb-field textarea:focus,
.fnb-field select:focus,
.fnb-option input:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 2px var(--violet-soft);
}
.fnb-field input:disabled,
.fnb-field textarea:disabled,
.fnb-field select:disabled,
.fnb-option input:disabled {
  cursor: not-allowed;
  opacity: .55;
}
.fnb-field input[type="color"] { min-height: 38px; padding: 3px; cursor: pointer; }
.fnb-field-help {
  margin: -7px 0 14px;
  color: var(--steel);
  font-size: 11px;
}
.fnb-generate { width: 100%; margin-top: 4px; }
.fnb-running {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 13px 15px;
  color: var(--text);
}
.fnb-running > div { display: flex; flex-direction: column; }
.fnb-running span { color: var(--muted); font-size: 11px; }
.fnb-running-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--violet-fill);
  box-shadow: 0 0 0 5px var(--violet-soft);
}
.fnb-editor { min-width: 0; }
.fnb-editor-top {
  display: grid;
  grid-template-columns: minmax(170px, .7fr) minmax(350px, 1.3fr) auto;
  align-items: center;
  gap: 16px;
  margin: -8px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
}
.fnb-editor-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}
.fnb-editor-title b {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--display);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fnb-page-tabs {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  overflow-x: auto;
}
.fnb-page-tabs button {
  flex: 0 0 auto;
  padding: 8px 0 6px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.fnb-page-tabs button:hover,
.fnb-page-tabs button.on { color: var(--ink); border-bottom-color: var(--violet); }
.fnb-editor-grid {
  display: grid;
  grid-template-columns: minmax(360px, .78fr) minmax(430px, 1.22fr);
  gap: 16px;
  align-items: start;
}
.fnb-sections {
  max-height: calc(100vh - 205px);
  overflow-y: auto;
  padding-right: 4px;
}
.fnb-panel-label {
  margin: 4px 0 9px;
  color: var(--steel);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.fnb-variants {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.fnb-variants > span {
  margin-right: 3px;
  color: var(--steel);
  font-size: 11px;
}
.fnb-variants button,
.fnb-devices button {
  min-width: 34px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--card);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.fnb-variants button:hover,
.fnb-variants button.on,
.fnb-devices button:hover,
.fnb-devices button.on {
  border-color: var(--violet);
  color: var(--violet);
  background: var(--violet-soft);
}
.fnb-section-card { margin-bottom: 10px; overflow: hidden; }
.fnb-section-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
}
.fnb-section-card > header > div { display: flex; align-items: center; gap: 7px; }
.fnb-section-card > header b { color: var(--ink); font-size: 12px; }
.fnb-grip { color: var(--steel); font-size: 14px; }
.fnb-section-body { padding: 13px; }
.fnb-section-card.off .fnb-section-body { opacity: .58; background: var(--paper-2); }
.fnb-switch { position: relative; width: 34px; height: 20px; cursor: pointer; }
.fnb-switch input { position: absolute; opacity: 0; pointer-events: none; }
.fnb-switch span {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--paper-2);
}
.fnb-switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--steel);
  transition: transform .14s ease;
}
.fnb-switch input:checked + span { border-color: var(--violet-fill); background: var(--violet-fill); }
.fnb-switch input:checked + span::after { background: var(--solid-fg); transform: translateX(14px); }
.fnb-question-list { display: flex; flex-direction: column; gap: 9px; }
.fnb-question {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper);
}
.fnb-question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}
.fnb-question-head b { color: var(--ink); font-size: 11px; }
.fnb-question-head button,
.fnb-option button {
  width: 27px;
  height: 27px;
  border: 0;
  border-radius: 50%;
  color: var(--danger);
  background: var(--danger-soft);
  cursor: pointer;
}
.fnb-question-head button:disabled,
.fnb-option button:disabled,
.fnb-add-row:disabled { cursor: not-allowed; opacity: .35; }
.fnb-options { display: flex; flex-direction: column; gap: 7px; }
.fnb-option { display: grid; grid-template-columns: 28px 1fr 27px; align-items: center; gap: 7px; }
.fnb-option > span {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--violet);
  background: var(--violet-soft);
  font-size: 10px;
  font-weight: 700;
}
.fnb-add-row {
  width: fit-content;
  margin-top: 9px;
  padding: 6px 10px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-sm);
  color: var(--violet);
  background: transparent;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.fnb-settings { padding: 16px; }
.fnb-preview {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
}
.fnb-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
}
.fnb-preview-head > div:first-child { display: flex; flex-direction: column; }
.fnb-preview-head b { color: var(--ink); font-size: 12px; }
.fnb-preview-head span { color: var(--steel); font-size: 10px; }
.fnb-preview-unavailable { min-height: 520px; display: grid; place-items: center; align-content: center; gap: 5px; padding: 28px; color: var(--muted); text-align: center; }
.fnb-preview-unavailable b { color: var(--ink); font-size: 15px; }
.fnb-preview-unavailable span { max-width: 440px; font-size: 12px; }
.fnb-devices { display: flex; gap: 5px; }
.fnb-preview-stage {
  position: relative;
  min-height: 520px;
  overflow: auto;
  padding: 16px;
  background: var(--paper-2);
}
.fnb-preview-stage.desktop { overflow: hidden; }
.fnb-device {
  overflow: hidden;
  background: var(--card);
  transform-origin: top left;
}
.fnb-device iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--card); }
.fnb-device.desktop {
  width: 1280px;
  height: 760px;
  transform: scale(var(--fnb-scale, .5));
}
.fnb-preview-stage.mobile { display: flex; justify-content: center; min-height: 780px; }
.fnb-device.mobile {
  width: 390px;
  height: 744px;
  flex: 0 0 390px;
  border: 8px solid var(--ink);
  border-radius: 26px;
  box-shadow: var(--shadow-lg);
}
.fnb-save-errors {
  margin-bottom: 12px;
  padding: 11px 14px;
  border: 1px solid var(--danger-line);
  border-radius: var(--r-sm);
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 12px;
}
.fnb-save-errors ul { margin: 5px 0 0; padding-left: 18px; }
.fnb-qa-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--amber-line);
  border-radius: var(--r-sm);
  background: var(--amber-soft);
}
.fnb-qa-panel > div { display: flex; min-width: 0; flex-direction: column; }
.fnb-qa-panel span { color: var(--muted); font-family: var(--mono); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.fnb-qa-panel b { color: var(--ink); font-size: 12px; }
.fnb-qa-panel small { margin-top: 2px; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.fnb-qa-panel ul { grid-column: 1 / -1; margin: 2px 0 0; padding-left: 18px; color: var(--danger); font-size: 11px; }
.fnb-qa-panel.ok { border-color: color-mix(in srgb, var(--ok) 30%, transparent); background: color-mix(in srgb, var(--ok) 8%, var(--card)); }
.fnb-qa-panel.danger { border-color: var(--danger-line); background: var(--danger-soft); }
.fnb-qa-panel.running { border-color: color-mix(in srgb, var(--violet) 30%, transparent); background: var(--violet-soft); }
.fnb-leads-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
.fnb-leads { width: 100%; border-collapse: collapse; background: var(--card); font-size: 11px; }
.fnb-leads th,
.fnb-leads td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.fnb-leads th { color: var(--steel); background: var(--paper-2); font-family: var(--mono); font-size: 9px; text-transform: uppercase; }
.fnb-leads td:first-child { min-width: 145px; font-family: var(--mono); color: var(--muted); }
.fnb-leads td:nth-child(2) { color: var(--violet); font-weight: 600; }
.fnb-leads td div { display: flex; flex-direction: column; margin-bottom: 7px; }
.fnb-leads td b { color: var(--ink); font-size: 11px; }
.fnb-leads td span { color: var(--text); overflow-wrap: anywhere; }
.fnb-leads-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  padding: 24px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r);
  color: var(--muted);
  text-align: center;
}
.fnb-leads-empty b { color: var(--ink); }
.fnb-leads-empty span { font-size: 11px; }
@media (max-width: 1250px) {
  .fnb-editor-top { grid-template-columns: 1fr auto; }
  .fnb-page-tabs { grid-column: 1 / -1; grid-row: 2; }
  .fnb-editor-grid { grid-template-columns: minmax(330px, .9fr) minmax(380px, 1.1fr); }
}
@media (max-width: 940px) {
  .fnb-list-row { grid-template-columns: 34px 1fr auto; }
  .fnb-list-actions { grid-column: 2 / -1; }
  .fnb-editor-grid { grid-template-columns: 1fr; }
  .fnb-sections { max-height: none; overflow: visible; }
}
@media (max-width: 700px) {
  .fnb-list-head { flex-direction: column; }
  .fnb-list-head .btn { width: 100%; }
  .fnb-list-head-actions { width: 100%; }
  .fnb-list-row { grid-template-columns: 32px 1fr; }
  .fnb-chips,
  .fnb-list-actions { grid-column: 2; }
  .fnb-editor-top { display: flex; flex-direction: column; align-items: stretch; }
  .fnb-editor-actions { justify-content: flex-start; }
  .fnb-form-grid,
  .fnb-color-row { grid-template-columns: 1fr; gap: 0; }
  .fnb-preview-stage { padding: 9px; }
  .fnb-qa-panel { grid-template-columns: 1fr; }
  .fnb-qa-panel .btn { width: 100%; }
  .fnb-qa-panel ul { grid-column: 1; }
}

/* COLD EMAIL COMMAND CENTER =================================================================== */
.ob-shell {
  --ob-violet: #7C3AED;
  --ob-red: #D85D4C;
  --ob-green: #2F8F6B;
  max-width: 1480px;
  margin: 0 auto;
  padding-bottom: 48px;
}
.ob-shell button, .ob-shell input, .ob-shell select, .ob-shell textarea { font-family: var(--sans); }
.ob-commandbar {
  position: sticky; top: -1px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin: -4px 0 20px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px;
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(16px);
}
.ob-command-left { min-width: 0; display: flex; align-items: center; gap: 10px; }
.ob-command-left > div { min-width: 0; display: flex; align-items: baseline; gap: 9px; }
.ob-command-left strong { color: var(--ink); font-size: 12px; }
.ob-command-left span:not(.ob-live-dot) { overflow: hidden; color: var(--muted); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.ob-live-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; box-shadow: 0 0 0 4px var(--paper-2); }
.ob-live-dot.locked { background: var(--danger); }
.ob-live-dot.ready { background: var(--ok); }
.ob-command-actions, .ob-action-row { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.ob-safe { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--paper-2); font-size: 11px; cursor: pointer; }
.ob-safe input { width: 14px; height: 14px; accent-color: var(--violet-fill); }
.ob-icon-btn { width: 32px; height: 32px; justify-content: center; }
.ob-eyebrow { display: block; margin-bottom: 5px; color: var(--violet); font-family: var(--mono); font-size: 9.5px; letter-spacing: .13em; text-transform: uppercase; }
.ob-hero {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(270px, .7fr); gap: 28px; align-items: end;
  padding: 31px 32px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 16px;
  background: linear-gradient(125deg, var(--card) 0 62%, var(--violet-soft) 100%);
}
.ob-hero::after { content:""; position:absolute; width:220px; height:220px; right:-95px; top:-120px; border:1px solid color-mix(in srgb, var(--violet) 22%, transparent); border-radius:50%; box-shadow: 0 0 0 24px color-mix(in srgb, var(--violet) 5%, transparent), 0 0 0 58px color-mix(in srgb, var(--violet) 3%, transparent); }
.ob-hero h2, .ob-section-lead h2, .ob-control-hero h2 { max-width: 760px; font-size: clamp(25px, 3vw, 40px); line-height: 1.02; letter-spacing: -.035em; }
.ob-hero p, .ob-section-lead p, .ob-control-hero p { max-width: 690px; margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.ob-hero-proof { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 7px; padding-left: 18px; border-left: 2px solid var(--danger); }
.ob-hero-proof strong { color: var(--ink); font-family: var(--display); font-size: 17px; }
.ob-hero-proof span { color: var(--muted); font-size: 11px; line-height: 1.45; }
.ob-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin: 0 0 14px; }
.ob-kpi-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ob-kpi { min-width: 0; display: flex; flex-direction: column; padding: 15px 16px; border: 1px solid var(--line); border-top: 2px solid var(--line-2); border-radius: 10px; background: var(--card); }
.ob-kpi.violet { border-top-color: var(--violet-fill); }
.ob-kpi.green { border-top-color: var(--ok); }
.ob-kpi.red { border-top-color: var(--danger); }
.ob-kpi > span { color: var(--steel); font-family: var(--mono); font-size: 8.5px; letter-spacing: .07em; text-transform: uppercase; }
.ob-kpi strong { margin-top: 5px; overflow: hidden; color: var(--ink); font-family: var(--display); font-size: clamp(22px, 2.5vw, 31px); font-weight: 500; letter-spacing: -.03em; text-overflow: ellipsis; white-space: nowrap; }
.ob-kpi small { min-height: 16px; margin-top: 3px; color: var(--muted); font-size: 9.5px; line-height: 1.35; }
.ob-grid { display: grid; gap: 12px; margin-bottom: 12px; }
.ob-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ob-panel { min-width: 0; margin-bottom: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); }
.ob-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.ob-panel-head h3 { font-size: 18px; }
.ob-trend-value { color: var(--ink); font-family: var(--display); font-size: 24px; font-weight: 500; }
.ob-funnel { display: grid; gap: 9px; }
.ob-funnel-head { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 10.5px; }
.ob-funnel-head strong { color: var(--ink); font-family: var(--mono); font-size: 11px; }
.ob-funnel-track { height: 7px; overflow: hidden; border-radius: 999px; background: var(--paper-2); }
.ob-funnel-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--violet-fill), color-mix(in srgb, var(--violet-fill) 55%, var(--ok))); }
.ob-funnel-step small { display: block; margin-top: 3px; color: var(--steel); font-size: 8.5px; text-align: right; }
.ob-spark { width: 100%; height: 150px; display: block; overflow: visible; }
.ob-chart-empty { height: 150px; display: grid; place-items: center; color: var(--steel); font-size: 11px; }
.ob-chart-foot { display: flex; justify-content: space-between; color: var(--steel); font-family: var(--mono); font-size: 8.5px; }
.ob-alerts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ob-alert { min-width: 0; display: grid; grid-template-columns: 26px 1fr auto; gap: 9px; align-items: center; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--text); text-align: left; cursor: pointer; }
.ob-alert:hover { border-color: var(--violet); }
.ob-alert.critical { border-color: var(--danger-line); background: var(--danger-soft-2); }
.ob-alert.warning { border-color: var(--amber-line); background: var(--amber-soft); }
.ob-alert-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--danger); color: #fff; font-family: var(--mono); font-size: 10px; }
.ob-alert.warning .ob-alert-icon { background: var(--amber); }
.ob-alert > span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; }
.ob-alert strong { color: var(--ink); font-size: 11px; }
.ob-alert small { overflow: hidden; color: var(--muted); font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; }
.ob-alert b { color: var(--steel); }
.ob-good-state { padding: 18px; border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); border-radius: 9px; background: var(--reach-soft); color: var(--ok); text-align: center; }
.ob-ai-lane { display: grid; grid-template-columns: repeat(9, auto); align-items: center; justify-content: space-between; gap: 8px; padding: 15px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--ink); color: var(--solid-fg); }
.ob-ai-lane > div { display: grid; grid-template-columns: auto 1fr; gap: 1px 8px; align-items: center; }
.ob-ai-lane > div span { grid-row: 1 / 3; color: #C7B9FD; font-family: var(--mono); font-size: 9px; }
.ob-ai-lane strong { color: #fff; font-size: 11px; }
.ob-ai-lane small { color: #9C9CA6; font-size: 8.5px; }
.ob-ai-lane i { color: #666670; font-style: normal; }
.ob-section-lead { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 8px 0 22px; }
.ob-section-lead h2 { font-size: clamp(28px, 4vw, 46px); }
.ob-state, .ob-empty { min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 30px; border: 1px dashed var(--line-2); border-radius: 13px; text-align: center; }
.ob-state strong, .ob-empty strong { color: var(--ink); font-family: var(--display); font-size: 18px; }
.ob-state p, .ob-empty p { max-width: 560px; margin: 0; color: var(--muted); font-size: 11px; }
.ob-state.error { border-color: var(--danger-line); background: var(--danger-soft-2); }
.ob-spinner { width: 28px; height: 28px; border: 3px solid var(--violet-soft); border-top-color: var(--violet-fill); border-radius: 50%; animation: mkt-spin .75s linear infinite; }
.ob-empty-mark { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--violet); background: var(--card); font-size: 21px; }
.ob-niche-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.ob-niche-card { min-width: 0; display: flex; flex-direction: column; padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); }
.ob-niche-top, .ob-campaign-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ob-niche-top span:not(.ob-badge), .ob-campaign-title span { color: var(--steel); font-family: var(--mono); font-size: 8.5px; letter-spacing: .05em; text-transform: uppercase; }
.ob-niche-top h3, .ob-campaign-title h3 { margin-top: 2px; font-size: 18px; line-height: 1.1; }
.ob-badge { display: inline-flex; align-items: center; width: max-content; padding: 3px 7px; border-radius: 999px; color: var(--muted); background: var(--paper-2); font-family: var(--mono); font-size: 8px; line-height: 1.3; text-transform: uppercase; white-space: nowrap; }
.ob-badge.good { color: var(--ok); background: var(--reach-soft); }
.ob-badge.bad { color: var(--danger); background: var(--danger-soft); }
.ob-badge.warn { color: var(--amber); background: var(--amber-soft); }
.ob-niche-route, .ob-campaign-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 10px; color: var(--muted); font-size: 9.5px; }
.ob-score { display: flex; align-items: baseline; gap: 6px; margin: 18px 0 8px; }
.ob-score strong { color: var(--ink); font-family: var(--display); font-size: 39px; font-weight: 500; letter-spacing: -.04em; }
.ob-score span { color: var(--steel); font-size: 9px; text-transform: uppercase; }
.ob-mini-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.ob-mini-metrics > div { min-width: 0; display: flex; flex-direction: column; padding: 9px; background: var(--paper); }
.ob-mini-metrics strong { color: var(--ink); font-family: var(--mono); font-size: 11px; }
.ob-mini-metrics span { color: var(--steel); font-size: 8px; }
.ob-angle { min-height: 68px; margin: 11px 0; padding: 10px; border-left: 2px solid var(--violet); background: var(--violet-soft); }
.ob-angle.muted { border-left-color: var(--line-2); background: var(--paper-2); }
.ob-angle span { color: var(--steel); font-family: var(--mono); font-size: 8px; text-transform: uppercase; }
.ob-angle p { margin: 3px 0 0; color: var(--text); font-size: 10px; }
.ob-card-actions, .ob-side-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.ob-card-actions .btn, .ob-side-actions .btn { padding: 7px 11px; font-size: 10px; }
.ob-blockers { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.ob-blockers summary { color: var(--danger); font-size: 9px; cursor: pointer; }
.ob-blockers p { margin: 6px 0 0; color: var(--muted); font-size: 9px; }
.ob-campaign-stack { display: grid; gap: 11px; margin-bottom: 14px; }
.ob-campaign-card { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 235px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--card); }
.ob-campaign-main { min-width: 0; padding: 18px; }
.ob-campaign-side { display: flex; flex-direction: column; gap: 13px; padding: 18px; border-left: 1px solid var(--line); background: var(--paper-2); }
.ob-campaign-side > div:not(.ob-side-actions) { display: flex; flex-direction: column; gap: 2px; }
.ob-campaign-side span { color: var(--steel); font-family: var(--mono); font-size: 8px; text-transform: uppercase; }
.ob-campaign-side strong, .ob-campaign-side code { overflow-wrap: anywhere; color: var(--ink); font-size: 10px; }
.ob-copy-preview { display: grid; gap: 5px; margin-top: 13px; }
.ob-copy-preview details { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
.ob-copy-preview summary { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; background: var(--paper); cursor: pointer; }
.ob-copy-preview summary span, .ob-copy-preview summary small { color: var(--steel); font-family: var(--mono); font-size: 8px; }
.ob-copy-preview summary strong { overflow: hidden; color: var(--ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.ob-copy-preview pre { max-height: 220px; margin: 0; padding: 12px; overflow: auto; border-top: 1px solid var(--line); background: var(--card); color: var(--text); font-family: var(--sans); font-size: 10px; line-height: 1.5; white-space: pre-wrap; }
.good-text { color: var(--ok) !important; }
.bad-text { color: var(--danger) !important; }
.btn-danger { border-color: var(--danger-line); color: var(--danger); background: var(--danger-soft-2); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.ob-stage-grid { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; margin-bottom: 14px; }
.ob-stage { min-width: 0; display: flex; flex-direction: column; padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.ob-stage > span { color: var(--violet); font-family: var(--mono); font-size: 8px; }
.ob-stage strong { margin-top: 7px; color: var(--ink); font-family: var(--display); font-size: 22px; font-weight: 500; }
.ob-stage small { overflow: hidden; color: var(--steel); font-size: 8.5px; text-overflow: ellipsis; }
.ob-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; }
.ob-table { width: 100%; border-collapse: collapse; background: var(--card); font-size: 10px; }
.ob-table th, .ob-table td { min-width: 90px; padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.ob-table th { color: var(--steel); background: var(--paper-2); font-family: var(--mono); font-size: 8px; letter-spacing: .05em; text-transform: uppercase; }
.ob-table tr:last-child td { border-bottom: 0; }
.ob-table td strong, .ob-table td small { display: block; }
.ob-table td strong { color: var(--ink); }
.ob-table td small { max-width: 260px; margin-top: 2px; color: var(--muted); }
.ob-table code { max-width: 220px; display: block; overflow: hidden; color: var(--muted); font-family: var(--mono); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.ob-reply-list { display: grid; gap: 9px; }
.ob-reply { display: grid; grid-template-columns: minmax(190px, .7fr) minmax(300px, 1.5fr) minmax(170px, .6fr); gap: 18px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); }
.ob-reply-who { min-width: 0; display: grid; grid-template-columns: 35px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.ob-avatar { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--violet-fill); font-family: var(--display); }
.ob-reply-who > div:nth-child(2) { min-width: 0; display: flex; flex-direction: column; }
.ob-reply-who strong { overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.ob-reply-who span:not(.ob-badge) { overflow: hidden; color: var(--steel); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.ob-reply-body { min-width: 0; }
.ob-reply-body strong { color: var(--ink); font-size: 10.5px; }
.ob-reply-body p { display: -webkit-box; margin: 4px 0 0; overflow: hidden; color: var(--muted); font-size: 10px; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ob-reply-proof { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; color: var(--muted); font-size: 8.5px; }
.ob-mailbox-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.ob-mailbox { min-width: 0; display: flex; flex-direction: column; padding: 10px; border: 1px solid var(--line); border-left: 2px solid var(--line-2); border-radius: 8px; background: var(--paper); }
.ob-mailbox.warning { border-left-color: var(--amber); }
.ob-mailbox.critical { border-left-color: var(--danger); }
.ob-mailbox.healthy { border-left-color: var(--ok); }
.ob-mailbox > strong, .ob-mailbox > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ob-mailbox > strong { color: var(--ink); font-size: 9.5px; }
.ob-mailbox > span { color: var(--steel); font-size: 8px; }
.ob-mailbox > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 7px 0 2px; }
.ob-mailbox b { color: var(--ink); font-family: var(--mono); font-size: 12px; }
.ob-mailbox small { color: var(--muted); font-size: 7.8px; }
.ob-mailbox em { margin-top: 4px; color: var(--danger); font-size: 8px; font-style: normal; }
.ob-gate-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.ob-gate-list li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: center; color: var(--text); font-size: 10.5px; }
.ob-gate-list span { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; color: var(--danger); background: var(--danger-soft); font-family: var(--mono); }
.ob-control-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 14px; padding: 24px; border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 13px; background: var(--card); }
.ob-control-hero.paused { border-left-color: var(--danger); background: linear-gradient(90deg, var(--danger-soft-2), var(--card) 36%); }
.ob-control-hero h2 { font-size: clamp(24px, 3.2vw, 38px); }
.ob-integration-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.ob-integration { min-width: 0; display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.ob-integration-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--steel); }
.ob-integration-dot.good { background: var(--ok); }
.ob-integration-dot.bad { background: var(--danger); }
.ob-integration-dot.warn { background: var(--amber); }
.ob-integration > div { min-width: 0; display: flex; flex-direction: column; }
.ob-integration strong { color: var(--ink); font-size: 10.5px; }
.ob-integration small { overflow: hidden; color: var(--steel); font-size: 8.5px; text-overflow: ellipsis; white-space: nowrap; }
.ob-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 13px; }
.ob-field-hint { color: var(--steel); font-size: 9px; line-height: 1.35; }
.ob-callout { margin-bottom: 15px; padding: 11px 12px; border: 1px solid var(--info-line); border-radius: 8px; background: color-mix(in srgb, var(--info) 7%, var(--card)); }
.ob-callout.warning { border-color: var(--amber-line); background: var(--amber-soft); }
.ob-callout strong { color: var(--ink); font-size: 11px; }
.ob-callout p { margin: 2px 0 0; color: var(--muted); font-size: 9.5px; }
.ob-confirm { display: flex; align-items: flex-start; gap: 8px; color: var(--text); font-size: 11px; }
.ob-confirm input { margin-top: 2px; accent-color: var(--violet-fill); }
.ob-form-error { max-width: 340px; color: var(--danger); font-size: 10px; }
.modal-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.modal-head h2 { margin: 0; }

@media (max-width: 1180px) {
  .ob-kpi-grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ob-niche-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ob-stage-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .ob-mailbox-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ob-ai-lane { grid-template-columns: repeat(5, 1fr); }
  .ob-ai-lane i { display: none; }
  .ob-ai-lane > div { grid-template-columns: auto 1fr; }
}
@media (max-width: 920px) {
  .ob-hero, .ob-grid-2 { grid-template-columns: 1fr; }
  .ob-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ob-hero-proof { padding: 12px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .ob-campaign-card { grid-template-columns: 1fr; }
  .ob-campaign-side { border-top: 1px solid var(--line); border-left: 0; }
  .ob-reply { grid-template-columns: 1fr 1fr; }
  .ob-reply-proof { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .ob-mailbox-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ob-integration-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .ob-commandbar, .ob-section-lead, .ob-control-hero { align-items: stretch; flex-direction: column; }
  .ob-command-left > div { flex-direction: column; gap: 0; }
  .ob-command-actions { justify-content: space-between; }
  .ob-hero { padding: 22px 18px; }
  .ob-kpi-grid, .ob-kpi-grid-5 { grid-template-columns: 1fr 1fr; }
  .ob-alerts, .ob-niche-grid { grid-template-columns: 1fr; }
  .ob-ai-lane { grid-template-columns: 1fr; gap: 10px; }
  .ob-stage-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ob-reply { grid-template-columns: 1fr; }
  .ob-reply-proof { grid-column: 1; }
  .ob-mailbox-grid, .ob-integration-grid, .ob-form-grid { grid-template-columns: 1fr; }
  .ob-panel { padding: 13px; }
}
@media (max-width: 430px) {
  .ob-kpi-grid, .ob-kpi-grid-5 { grid-template-columns: 1fr; }
  .ob-stage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ob-copy-preview summary { grid-template-columns: 45px 1fr; }
  .ob-copy-preview summary small { display: none; }
}
