/* ============================================================================
   Wilson Cortex Group — Command Dashboard
   styles.css — Brand-matched UI ("The Crest" identity)
   Palette: Cortex Gold #C9A84A · Parchment Cream #F0EAD6 ·
            Antique Brass #8A7D56 · Deep Ink #0B0A07
   Fonts: Cormorant Garamond (display) · Outfit (UI) · Spectral (serif accent)
   ============================================================================ */

:root {
  --gold: #c9a84a;
  --gold-soft: #d8be72;
  --gold-deep: #8a7d56;
  --cream: #f0ead6;
  --ink: #0b0a07;
  --bg: #0c0c0e;
  --panel: #111113;
  --panel-2: #0e0e10;
  --line: #1c1c1f;
  --line-2: #2a2618;
  --text: #e8e8ea;
  --text-dim: #9a9aa2;
  --text-faint: #6b6b73;
  --good: #74c69d;
  --warn: #e9b949;
  --bad: #d98c8c;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 50px rgba(0,0,0,.45);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
html { background: var(--bg); }
body {
  background:
    radial-gradient(1200px 600px at 50% -10%, #15130d 0%, rgba(12,12,14,0) 60%) no-repeat,
    var(--bg);
  background-attachment: fixed;
  font-family: 'Outfit', system-ui, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.hidden { display: none !important; }
.ac { color: var(--gold); }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #26261b; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #34301f; }

/* ---------------------------------------------------------------- buttons */
.btn {
  font-family: 'Outfit', sans-serif; font-weight: 500; font-size: 13px;
  letter-spacing: .3px; border: 1px solid var(--line-2); background: transparent;
  color: var(--cream); padding: 10px 16px; border-radius: var(--radius-sm);
  cursor: pointer; transition: all .15s ease; white-space: nowrap;
}
.btn:hover { border-color: var(--gold-deep); background: rgba(201,168,74,.06); }
.btn-gold { background: linear-gradient(180deg, var(--gold-soft), var(--gold)); color: #1a1605; border-color: transparent; font-weight: 600; }
.btn-gold:hover { filter: brightness(1.06); background: linear-gradient(180deg, var(--gold-soft), var(--gold)); }
.btn-ghost { border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--cream); background: rgba(255,255,255,.04); }
.btn-danger:hover { border-color: var(--bad); color: var(--bad); background: rgba(217,140,140,.06); }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 9px; background: transparent;
  color: var(--text-dim); cursor: pointer; font-size: 16px; transition: all .15s;
}
.icon-btn:hover { color: var(--gold); border-color: var(--gold-deep); }

/* ============================================================== LOCK SCREEN */
.lock-screen {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at center, #16140e 0%, #0b0a07 75%);
}
.lock-card {
  width: min(420px, 90vw); text-align: center; padding: 46px 38px 30px;
  border: 1px solid var(--line); border-radius: 18px;
  background: linear-gradient(180deg, #111113, #0c0c0e);
  box-shadow: var(--shadow);
}
.lock-emblem { display: grid; place-items: center; margin-bottom: 22px; }
.lock-name { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 30px; letter-spacing: 5px; text-transform: uppercase; color: var(--cream); }
.lock-sub { font-weight: 300; font-size: 10px; letter-spacing: 7px; text-transform: uppercase; color: var(--gold-deep); margin-top: 8px; }
.lock-hint { font-family: 'Spectral', serif; font-style: italic; color: var(--text-dim); font-size: 13.5px; margin: 26px 0 18px; }
.lock-form { display: flex; flex-direction: column; gap: 12px; }
.lock-foot { margin-top: 22px; font-size: 10.5px; letter-spacing: .4px; color: var(--text-faint); }
.lock-error { font-size: 12.5px; color: var(--bad); text-align: left; margin-top: -2px; }
.lock-reset { background: transparent; border: none; color: var(--text-faint); font-size: 11.5px; cursor: pointer; margin-top: 14px; text-decoration: underline; }
.lock-reset:hover { color: var(--gold); }
input[type="password"], input[type="text"], select, textarea {
  font-family: 'Outfit', sans-serif; font-size: 14px; color: var(--cream);
  background: #0a0a0c; border: 1px solid var(--line-2); border-radius: 9px;
  padding: 12px 14px; outline: none; transition: border-color .15s; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold-deep); }
input::placeholder { color: var(--text-faint); }

/* ================================================================= TOP BAR */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  padding: 14px 26px; border-bottom: 1px solid var(--line);
  background: rgba(12,12,14,.82); backdrop-filter: blur(10px);
}
.topbar-left { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.topbar-emblem { display: grid; place-items: center; }
.topbar-word { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 19px; letter-spacing: 3px; text-transform: uppercase; color: var(--cream); }
.topbar-group { color: var(--gold-deep); }
.topbar-nav { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.crumb { color: var(--text-dim); cursor: pointer; }
.crumb:hover { color: var(--gold); }
.crumb.current { color: var(--cream); cursor: default; }
.crumb-sep { color: var(--text-faint); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.vault-pill { font-size: 11px; letter-spacing: .4px; color: var(--good); padding: 6px 12px; border: 1px solid #1f2a22; border-radius: 20px; background: rgba(116,198,157,.06); }
.vault-pill.locked { color: var(--bad); border-color: #2a1f1f; background: rgba(217,140,140,.06); }

/* =================================================================== VIEW */
.view { flex: 1; padding: 34px 26px 64px; max-width: 1240px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 26px; flex-wrap: wrap; }
.page-title { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 34px; letter-spacing: 1px; color: var(--cream); }
.page-eyebrow { font-size: 11px; letter-spacing: 4px; text-transform: uppercase; color: var(--gold-deep); margin-bottom: 8px; }
.page-sub { font-family: 'Spectral', serif; font-style: italic; color: var(--text-dim); font-size: 14px; margin-top: 6px; }

/* ----------------------------------------------------------- stat strip */
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 34px; }
.stat {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
}
.stat .label { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-faint); }
.stat .value { font-family: 'Cormorant Garamond', serif; font-size: 30px; font-weight: 600; color: var(--cream); margin-top: 8px; }
.stat .delta { font-size: 12px; margin-top: 4px; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--text-faint); }
/* clickable portfolio stats (drill into a detail screen) */
.stat.clickable { cursor: pointer; transition: border-color .15s, transform .15s; }
.stat.clickable:hover { border-color: var(--gold-deep); transform: translateY(-2px); }
.stat .stat-go { font-size: 11px; letter-spacing: .5px; color: var(--gold-deep); margin-top: 8px; opacity: 0; transition: opacity .15s; }
.stat.clickable:hover .stat-go { opacity: 1; }

/* back button */
.back-btn { display: inline-flex; align-items: center; gap: 6px; }
.workspace-head .back-btn { padding: 8px 12px; }

/* detail-screen venture rows */
.vrow { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.vrow:last-child { border-bottom: none; }
.vrow:hover { background: rgba(255,255,255,.015); }
.vrow:hover .vrow-name { color: var(--gold); }
.vrow-emblem { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; border: 1px solid var(--line-2); background: radial-gradient(ellipse at center, #14120c, #0b0a07); flex-shrink: 0; }
.vrow-main { flex: 1; min-width: 0; }
.vrow-name { font-size: 15px; color: var(--cream); font-weight: 500; transition: color .12s; }
.vrow-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vrow-val { font-family: 'Cormorant Garamond', serif; font-size: 19px; font-weight: 600; color: var(--cream); white-space: nowrap; width: 150px; text-align: right; flex-shrink: 0; }
.vrow-val .delta { font-size: 11px; font-family: 'Outfit', sans-serif; margin-left: 6px; }
.vrow-share { width: 130px; flex-shrink: 0; }
.vrow-cell { flex-shrink: 0; display: flex; align-items: center; }
.share-track { height: 7px; border-radius: 6px; background: #1a1a1d; overflow: hidden; }
.share-fill { height: 100%; border-radius: 6px; transition: width .3s; }
.vrow-sharepct { font-size: 10.5px; color: var(--text-faint); margin-top: 4px; }

/* venture chip (used in unified feeds / cross-venture approvals) */
.venture-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-dim); border: 1px solid var(--line-2); border-radius: 20px; padding: 2px 9px; white-space: nowrap; }
.vc-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.feed-click { cursor: pointer; }
.feed-click:hover .txt { color: var(--cream); }

/* venture icon picker */
.icon-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-opt { width: 44px; height: 44px; border: 1px solid var(--line-2); border-radius: 10px; display: grid; place-items: center; cursor: pointer; background: var(--panel-2); transition: all .15s; }
.icon-opt:hover { border-color: var(--gold-deep); transform: translateY(-1px); }
.icon-opt.selected { border-color: var(--gold); background: rgba(201,168,74,.08); }
.icon-upload { color: var(--gold-deep); font-size: 20px; }
.icon-upload span { display: grid; place-items: center; line-height: 1; }
.icon-upload:hover { color: var(--gold); }

/* draggable stat cards (reorder the top tiles) */
.stat.dragging { opacity: .35; }
.stat.drop-before { box-shadow: -5px 0 0 0 var(--gold); }
.stat.drop-after { box-shadow: 5px 0 0 0 var(--gold); }

/* clickable provider rows (open settings editor) */
.conn-row.editable { cursor: pointer; }
.conn-row.editable:hover .conn-name { color: var(--gold); }

/* ===================== VENTURE WORKSPACE WIDGETS ===================== */
.widget-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.wt-hint { font-family: 'Spectral', serif; font-style: italic; font-size: 12.5px; color: var(--text-dim); }
/* Masonry packing: 1px row tracks + JS-computed row spans so short widgets
   don't leave gaps and the next row packs upward. Full-width widgets span both
   columns. See layoutWidgets() in app.js. */
.widget-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; row-gap: 20px; grid-auto-rows: 1px; }
.widget { min-width: 0; }
.widget .panel { margin: 0; }
.widget.dragging { opacity: .35; }
.widget.drop-before { box-shadow: -5px 0 0 0 var(--gold); border-radius: var(--radius); }
.widget.drop-after { box-shadow: 5px 0 0 0 var(--gold); border-radius: var(--radius); }
.w-head-left { display: flex; align-items: center; }
.w-grip { cursor: grab; color: var(--text-faint); margin-right: 9px; letter-spacing: -2px; font-size: 13px; }
.w-grip:hover { color: var(--gold); }
.widget.dragging .w-grip { cursor: grabbing; }
.w-actions { display: flex; align-items: center; gap: 8px; }
.w-remove { background: transparent; border: none; color: var(--text-faint); cursor: pointer; font-size: 13px; padding: 2px 4px; line-height: 1; }
.w-remove:hover { color: var(--bad); }
.w-notes { width: 100%; min-height: 130px; resize: vertical; font-family: 'Outfit', sans-serif; }

/* widget picker modal */
.widget-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wpick { border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 14px; cursor: pointer; background: var(--panel-2); transition: all .15s; }
.wpick:hover { border-color: var(--gold); transform: translateY(-1px); }
.wpick-name { font-size: 14px; color: var(--cream); font-weight: 500; letter-spacing: .3px; }
.wpick-desc { font-size: 11.5px; color: var(--text-dim); margin-top: 5px; line-height: 1.45; }

/* content calendar widget */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { font-size: 9.5px; text-align: center; color: var(--text-faint); letter-spacing: .5px; text-transform: uppercase; padding-bottom: 4px; }
.cal-day { aspect-ratio: 1 / 1; border: 1px solid var(--line); border-radius: 7px; padding: 5px 6px; font-size: 11px; color: var(--text-dim); position: relative; overflow: hidden; }
.cal-day.empty { border: none; }
.cal-day.today { border-color: var(--gold); color: var(--cream); }
.cal-evt { position: absolute; left: 4px; right: 4px; bottom: 4px; font-size: 8px; color: #1a1605; border-radius: 4px; padding: 1px 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* widget header icon buttons (settings / resize / remove) */
.w-icon { background: transparent; border: none; color: var(--text-faint); cursor: pointer; font-size: 13px; padding: 2px 5px; line-height: 1; border-radius: 6px; transition: color .15s, background .15s; }
.w-icon:hover { color: var(--gold); background: rgba(201,168,74,.08); }
.w-remove:hover { color: var(--bad); background: rgba(217,140,140,.08); }
.wpick-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wpick-group { font-size: 9.5px; letter-spacing: .8px; text-transform: uppercase; color: var(--gold-deep); border: 1px solid var(--line-2); border-radius: 20px; padding: 2px 7px; white-space: nowrap; }

/* shared widget content primitives */
.w-bignum { font-family: 'Cormorant Garamond', serif; font-size: 30px; font-weight: 600; color: var(--cream); line-height: 1.1; margin-bottom: 12px; }
.w-bignum-sub { font-family: 'Outfit', sans-serif; font-size: 12px; color: var(--text-faint); font-weight: 400; }
.pbar { height: 8px; border-radius: 6px; background: #1a1a1d; overflow: hidden; }
.pbar-fill { height: 100%; border-radius: 6px; transition: width .3s; }
.kv-list { display: flex; flex-direction: column; }
.kv { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv-l { color: var(--text-dim); }
.kv-v { color: var(--cream); font-weight: 500; }
.kv-s { color: var(--text-faint); font-weight: 400; font-size: 11px; }
.mini-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.stat-inline { display: flex; gap: 10px; }
.stat-inline .kv { flex: 1; flex-direction: column; align-items: flex-start; gap: 2px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.stat-inline .kv-l { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-faint); }
.stat-inline .kv-v { font-family: 'Cormorant Garamond', serif; font-size: 20px; }

/* agent roster */
.roster-row { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.roster-row:last-child { border-bottom: none; }
.roster-info { flex: 1; min-width: 0; }
.roster-name { font-size: 13.5px; color: var(--cream); }
.roster-meta { font-size: 11px; color: var(--text-dim); }
.roster-state { font-size: 12px; color: var(--gold-soft); text-align: right; }
.roster-when { display: block; font-size: 10px; color: var(--text-faint); }

/* exception feed */
.err-row { display: flex; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.err-row:last-child { border-bottom: none; }
.err-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); margin-top: 4px; flex-shrink: 0; }
.err-txt { font-size: 13px; color: var(--text); }
.err-time { font-size: 10.5px; color: var(--text-faint); margin-top: 2px; }

/* guardrail toggles */
.gr-toggles { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.gr-toggle { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--text-dim); cursor: pointer; padding: 4px 0; }
.gr-toggle input { width: auto; accent-color: var(--gold); cursor: pointer; }

/* quick actions */
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qa-btn { font-family: 'Outfit', sans-serif; font-size: 12.5px; color: var(--cream); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 9px; padding: 12px 10px; cursor: pointer; transition: all .15s; }
.qa-btn:hover { border-color: var(--gold); color: var(--gold); background: rgba(201,168,74,.06); }

/* asset gallery */
.asset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.asset { border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; position: relative; background: radial-gradient(ellipse at center, #14120c, #0b0a07); }
.asset.approved { outline: 2px solid var(--good); outline-offset: -2px; }
.asset-thumb { aspect-ratio: 1 / 1; display: grid; place-items: center; font-size: 30px; }
.asset-actions { position: absolute; bottom: 6px; right: 6px; display: flex; gap: 6px; }
.asset-ok, .asset-no { width: 24px; height: 24px; border-radius: 6px; border: none; cursor: pointer; font-size: 12px; display: grid; place-items: center; }
.asset-ok { background: var(--good); color: #0c0c0e; }
.asset-no { background: var(--bad); color: #0c0c0e; }

/* content pipeline (kanban) */
.kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.kan-col { background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px; min-height: 120px; }
.kan-h { font-size: 10.5px; letter-spacing: .5px; text-transform: uppercase; color: var(--gold-deep); margin-bottom: 9px; display: flex; justify-content: space-between; }
.kan-card { background: #141416; border: 1px solid var(--line-2); border-radius: 7px; padding: 8px; font-size: 11.5px; color: var(--text); margin-bottom: 7px; }
.kan-card:last-child { margin-bottom: 0; }

/* order queue */
.ord-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.ord-row:last-child { border-bottom: none; }
.ord-id { font-size: 12px; color: var(--text-faint); width: 56px; flex-shrink: 0; }
.ord-item { flex: 1; font-size: 13px; color: var(--text); }

/* gig pipeline stages */
.stage-row { display: flex; gap: 10px; }
.stage { flex: 1; text-align: center; border: 1px solid var(--line); border-radius: 9px; padding: 14px 6px; background: var(--panel-2); }
.stage-c { font-family: 'Cormorant Garamond', serif; font-size: 26px; font-weight: 600; color: var(--cream); }
.stage-n { font-size: 10px; letter-spacing: .5px; text-transform: uppercase; color: var(--text-faint); margin-top: 4px; }

/* inventory */
.inv-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.inv-row:last-child { border-bottom: none; }
.inv-name { color: var(--text); }
.inv-q { color: var(--text-dim); }
.inv-q.low { color: var(--bad); }

/* deadlines */
.dl-row { display: flex; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.dl-row:last-child { border-bottom: none; }
.dl-when { font-size: 11px; letter-spacing: .3px; color: var(--gold-soft); width: 50px; flex-shrink: 0; }
.dl-when.soon { color: var(--bad); }
.dl-task { font-size: 13px; color: var(--text); }

/* campaign / score rows (ads, virality, expenses) */
.camp { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.camp-n { font-size: 12.5px; color: var(--text); width: 38%; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.camp .pbar { flex: 1; }
.camp-r { font-size: 12px; color: var(--cream); width: 38px; text-align: right; flex-shrink: 0; }

/* funnel */
.fn-step { margin-bottom: 12px; }
.fn-step:last-child { margin-bottom: 0; }
.fn-lbl { font-size: 11.5px; color: var(--text-dim); margin-bottom: 5px; }
.fn-val { font-size: 11px; color: var(--text-faint); margin-top: 3px; }

/* seo / trends / competitors rows */
.seo-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.seo-row:last-child { border-bottom: none; }
.seo-kw { flex: 1; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seo-rank { font-size: 13px; color: var(--cream); font-weight: 500; }
.seo-row .delta { font-size: 11px; width: 42px; text-align: right; }
.trend-act { padding: 4px 10px; }

/* reviews */
.rev-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.rev-avg { font-family: 'Cormorant Garamond', serif; font-size: 22px; font-weight: 600; color: var(--cream); }
.rev-n { font-size: 12px; color: var(--text-faint); }
.rev-row { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rev-row:last-child { border-bottom: none; }
.rev-txt { font-size: 12.5px; color: var(--text-dim); }
.stars { white-space: nowrap; font-size: 12px; letter-spacing: 1px; }
.st-on { color: var(--gold); }
.st-off { color: #33312a; }

/* inbox */
.inbox-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.inbox-row:last-child { border-bottom: none; }
.inbox-t { flex: 1; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-st { font-size: 11px; color: var(--text-faint); }

/* health score */
.health { display: flex; align-items: baseline; gap: 8px; }
.health-score { font-family: 'Cormorant Garamond', serif; font-size: 46px; font-weight: 600; line-height: 1; }
.health-cap { font-size: 12px; color: var(--text-faint); }
.goal-pct { font-size: 12px; color: var(--text-dim); margin-top: 8px; }

@media (max-width: 920px) {
  .widget-grid { grid-template-columns: 1fr; }
  .widget[style*="span 2"] { grid-column: span 1 !important; }
  .widget-pick { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(2, 1fr); }
}

/* --------------------------------------------------------------- tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.tile {
  position: relative; border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  padding: 22px; cursor: pointer; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
  overflow: hidden; min-height: 210px; display: flex; flex-direction: column;
}
.tile::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(420px 140px at 100% 0%, rgba(201,168,74,.10), transparent 60%);
  opacity: 0; transition: opacity .2s;
}
.tile:hover { transform: translateY(-3px); border-color: var(--gold-deep); box-shadow: var(--shadow); }
.tile:hover::before { opacity: 1; }
/* drag-to-reorder */
.tile[draggable="true"] { cursor: grab; }
.tile.dragging { opacity: .35; cursor: grabbing; }
.tile.drop-before { box-shadow: inset 4px 0 0 var(--gold); }
.tile.drop-after { box-shadow: inset -4px 0 0 var(--gold); }
.tile-grip { position: absolute; top: 16px; right: 16px; color: var(--text-faint); font-size: 14px; letter-spacing: -2px; opacity: 0; transition: opacity .15s; pointer-events: none; }
.tile:hover .tile-grip { opacity: .55; }
.tile:has(.pending-flag) .tile-grip { display: none; }
.tile-top { display: flex; align-items: center; gap: 13px; }
.tile-emblem {
  width: 46px; height: 46px; border-radius: 11px; display: grid; place-items: center;
  border: 1px solid var(--line-2); background: radial-gradient(ellipse at center, #14120c, #0b0a07); flex-shrink: 0;
}
.tile-id { min-width: 0; }
.tile-name { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 21px; color: var(--cream); line-height: 1.1; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-type { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold-deep); margin-top: 3px; }
.tile-tag { font-family: 'Spectral', serif; font-style: italic; color: var(--text-dim); font-size: 13px; margin: 14px 0 16px; flex: 1; }
.tile-metrics { display: flex; gap: 20px; margin-bottom: 14px; }
.tile-metric .m-val { font-family: 'Cormorant Garamond', serif; font-size: 20px; font-weight: 600; color: var(--cream); }
.tile-metric .m-lbl { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-faint); }
.tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tile-spark { opacity: .9; }

/* status + autonomy badges */
.badge { font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; padding: 4px 10px; border-radius: 20px; border: 1px solid var(--line-2); color: var(--text-dim); white-space: nowrap; }
.badge.live { color: var(--good); border-color: #1f2a22; background: rgba(116,198,157,.07); }
.badge.paused { color: var(--warn); border-color: #2a2616; background: rgba(233,185,73,.07); }
.badge.draft { color: var(--text-faint); }
.badge-dot::before { content: "●"; margin-right: 6px; font-size: 8px; vertical-align: 1px; }
.badge.auto-autonomous { color: var(--gold); border-color: var(--line-2); }
.badge.auto-supervised { color: var(--gold-soft); }
.badge.auto-manual { color: var(--text-dim); }
.pending-flag { position: absolute; top: 16px; right: 16px; font-size: 10px; letter-spacing: .8px; color: #1a1605; background: var(--gold); padding: 4px 9px; border-radius: 20px; font-weight: 600; }

/* add-business tile */
.tile-add {
  border: 1px dashed var(--line-2); background: transparent; align-items: center; justify-content: center;
  text-align: center; color: var(--text-dim);
}
.tile-add:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-3px); }
.tile-add .plus { font-size: 34px; font-weight: 200; line-height: 1; margin-bottom: 12px; color: var(--gold-deep); }
.tile-add:hover .plus { color: var(--gold); }
.tile-add .add-label { font-size: 13px; letter-spacing: 2px; text-transform: uppercase; }
.tile-add .add-sub { font-family: 'Spectral', serif; font-style: italic; font-size: 12.5px; margin-top: 6px; color: var(--text-faint); }

/* ====================================================== VENTURE WORKSPACE */
.workspace-head { display: flex; align-items: center; gap: 18px; margin-bottom: 8px; }
.ws-emblem { width: 58px; height: 58px; border-radius: 13px; display: grid; place-items: center; border: 1px solid var(--line-2); background: radial-gradient(ellipse at center, #14120c, #0b0a07); flex-shrink: 0; }
.ws-titles { flex: 1; }
.ws-name { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 32px; color: var(--cream); letter-spacing: .5px; }
.ws-meta { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.ws-actions { display: flex; gap: 10px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 26px 0 28px; flex-wrap: wrap; }
.tab { font-size: 13px; letter-spacing: .5px; color: var(--text-dim); padding: 12px 16px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s; }
.tab:hover { color: var(--cream); }
.tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.tab .tab-count { font-size: 10px; background: var(--gold); color: #1a1605; border-radius: 20px; padding: 1px 7px; margin-left: 7px; font-weight: 600; vertical-align: 1px; }

/* generic panel + grid */
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, var(--panel), var(--panel-2)); overflow: hidden; }
.panel-head { padding: 15px 20px; border-bottom: 1px solid var(--line); font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: var(--gold-deep); display: flex; align-items: center; justify-content: space-between; }
.panel-body { padding: 20px; }
/* Only add spacing when panels are STACKED in a tab body — not when they sit
   side-by-side as grid siblings (which previously pushed the 2nd panel down). */
#tabBody > .panel + .panel { margin-top: 20px; }
/* Stacked panels on a detail (drill-down) screen need the same gap. */
#view > .panel + .panel { margin-top: 20px; }

/* kpi mini grid in workspace */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; background: var(--panel-2); }
.kpi .k-lbl { font-size: 10.5px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--text-faint); }
.kpi .k-val { font-family: 'Cormorant Garamond', serif; font-size: 26px; font-weight: 600; color: var(--cream); margin-top: 6px; }
.kpi .k-delta { font-size: 11.5px; margin-top: 3px; }

/* chart */
.chart-wrap { padding: 8px 4px 0; }
.chart-modes { display: flex; gap: 4px; }
.chart-mode-btn { font-family: 'Outfit', sans-serif; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-dim); background: transparent; border: 1px solid var(--line-2); border-radius: 7px; padding: 4px 10px; cursor: pointer; transition: all .15s; }
.chart-mode-btn:hover { color: var(--cream); border-color: var(--gold-deep); }
.chart-mode-btn.active { color: #1a1605; background: var(--gold); border-color: transparent; font-weight: 600; }
.chart-readout { font-size: 12.5px; color: var(--text-dim); min-height: 18px; margin-bottom: 10px; letter-spacing: .2px; }
.chart-readout b { color: var(--cream); font-weight: 600; }
.chart-readout .delta.up { color: var(--good); }
.chart-readout .delta.down { color: var(--bad); }
.chart-area { position: relative; width: 100%; }
.ch-svg { width: 100%; height: 210px; display: block; overflow: visible; }
.ch-axis { stroke: var(--line); stroke-width: 1; }
.ch-xlabel { fill: var(--text-faint); font-size: 9px; font-family: 'Outfit', sans-serif; letter-spacing: .3px; }
.ch-guide { stroke: var(--gold); stroke-width: 1; stroke-dasharray: 3 3; transition: opacity .12s; }
.ch-dot { stroke: #0c0c0e; stroke-width: 2; transition: opacity .12s; }
.bar { transition: opacity .12s; cursor: pointer; }
.ch-hit { cursor: pointer; }
.ch-hit:hover ~ .bar { opacity: 1; }
.chart-tip { position: absolute; top: -2px; transform: translateX(-50%); background: linear-gradient(180deg, #16140e, #0e0d09); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 11px; font-size: 12px; color: var(--cream); white-space: nowrap; pointer-events: none; transition: opacity .12s; box-shadow: var(--shadow); z-index: 5; }
.chart-tip b { color: var(--gold); }
.chart-tip .up { color: var(--good); }
.chart-tip .down { color: var(--bad); }

/* add tool / AI form */
.add-prov { margin-top: 14px; padding: 18px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel-2); }
.add-prov .field:first-child { margin-top: 0; }
.conn-remove { width: 30px; height: 30px; font-size: 13px; flex-shrink: 0; }
.conn-remove:hover { color: var(--bad); border-color: var(--bad); }

/* activity feed */
.feed { list-style: none; display: flex; flex-direction: column; }
.feed li { display: flex; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: none; }
.feed .who { font-size: 11px; letter-spacing: .5px; color: var(--gold); width: 92px; flex-shrink: 0; padding-top: 1px; }
.feed .who .ts { display: block; color: var(--text-faint); font-size: 10px; margin-top: 3px; letter-spacing: .3px; }
.feed .txt { font-size: 13.5px; color: var(--text); line-height: 1.5; }

/* approvals */
.approval { border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: var(--radius-sm); padding: 16px 18px; background: var(--panel-2); margin-bottom: 14px; }
.approval:last-child { margin-bottom: 0; }
.approval .ap-kind { font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--gold-deep); }
.approval .ap-title { font-family: 'Cormorant Garamond', serif; font-size: 19px; font-weight: 600; color: var(--cream); margin: 5px 0 8px; }
.approval .ap-detail { font-size: 13px; color: var(--text-dim); line-height: 1.55; margin-bottom: 14px; }
.approval .ap-actions { display: flex; gap: 10px; }
.urgency { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; padding: 3px 9px; border-radius: 20px; }
.urgency.high { color: var(--bad); border: 1px solid #2a1f1f; }
.urgency.med { color: var(--warn); border: 1px solid #2a2616; }

/* tasks */
.task-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: none; }
.task-state { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ts-running { background: var(--good); box-shadow: 0 0 8px rgba(116,198,157,.6); }
.ts-scheduled { background: var(--gold); }
.ts-blocked { background: var(--bad); }
.ts-done { background: var(--text-faint); }
.task-label { font-size: 14px; color: var(--text); flex: 1; }
.task-note { font-size: 11.5px; color: var(--text-faint); font-style: italic; }
.task-badge { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-dim); border: 1px solid var(--line-2); border-radius: 20px; padding: 3px 10px; }

/* agents / connections */
.conn-row { display: flex; align-items: center; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.conn-row:last-child { border-bottom: none; }
.conn-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 18px; flex-shrink: 0; }
.conn-info { flex: 1; }
.conn-name { font-size: 14.5px; color: var(--cream); font-weight: 500; }
.conn-role { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.conn-detail { font-size: 11px; color: var(--text-faint); margin-top: 3px; font-family: 'Outfit', monospace; letter-spacing: .3px; }
.conn-status { font-size: 11px; letter-spacing: .5px; padding: 5px 11px; border-radius: 20px; }
.cs-connected { color: var(--good); border: 1px solid #1f2a22; background: rgba(116,198,157,.06); }
.cs-needs-setup { color: var(--warn); border: 1px solid #2a2616; background: rgba(233,185,73,.06); }

/* autonomy control */
.autonomy-control { display: flex; gap: 10px; margin-top: 6px; }
.auto-opt { flex: 1; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 14px; cursor: pointer; transition: all .15s; background: var(--panel-2); }
.auto-opt:hover { border-color: var(--gold-deep); }
.auto-opt.selected { border-color: var(--gold); background: rgba(201,168,74,.07); }
.auto-opt .ao-name { font-size: 13px; color: var(--cream); font-weight: 500; letter-spacing: .5px; }
.auto-opt .ao-desc { font-size: 11.5px; color: var(--text-dim); margin-top: 5px; line-height: 1.45; }
.auto-opt.selected .ao-name { color: var(--gold); }

/* empty state */
.empty { text-align: center; padding: 40px 20px; color: var(--text-faint); }
.empty .e-mark { font-size: 30px; opacity: .5; margin-bottom: 12px; }
.empty .e-text { font-family: 'Spectral', serif; font-style: italic; font-size: 14px; }

/* ==================================================================== MODAL */
.modal-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(6,6,8,.72); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 24px; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { width: min(620px, 100%); max-height: 88vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(180deg, #111113, #0c0c0e); box-shadow: var(--shadow); animation: rise .2s ease; }
@keyframes rise { from { transform: translateY(12px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.modal-head { padding: 22px 26px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 24px; color: var(--cream); }
.modal-eyebrow { font-size: 11px; letter-spacing: 4px; text-transform: uppercase; color: var(--gold-deep); margin-bottom: 6px; }
.modal-body { padding: 24px 26px; }
.modal-foot { padding: 18px 26px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 12px; }

.field { margin-bottom: 18px; }
.field > label { display: block; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
.template-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tmpl { border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 15px; cursor: pointer; transition: all .15s; background: var(--panel-2); }
.tmpl:hover { border-color: var(--gold-deep); }
.tmpl.selected { border-color: var(--gold); background: rgba(201,168,74,.07); }
.tmpl .t-icon { font-size: 22px; }
.tmpl .t-name { font-size: 14px; color: var(--cream); font-weight: 500; margin-top: 8px; letter-spacing: .5px; }
.tmpl .t-blurb { font-size: 11.5px; color: var(--text-dim); margin-top: 5px; line-height: 1.45; }
.swatches { display: flex; gap: 10px; }
.sw-pick { width: 34px; height: 34px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; transition: transform .12s; }
.sw-pick:hover { transform: scale(1.08); }
.sw-pick.selected { border-color: var(--cream); }
.agent-pick { display: flex; gap: 10px; flex-wrap: wrap; }
.agent-chip { font-size: 12px; padding: 8px 13px; border: 1px solid var(--line-2); border-radius: 20px; cursor: pointer; color: var(--text-dim); transition: all .15s; }
.agent-chip:hover { border-color: var(--gold-deep); }
.agent-chip.selected { border-color: var(--gold); color: var(--gold); background: rgba(201,168,74,.07); }

/* toast */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 120; background: linear-gradient(180deg, #16140e, #0e0d09); border: 1px solid var(--line-2); color: var(--cream); padding: 13px 22px; border-radius: 12px; font-size: 13.5px; box-shadow: var(--shadow); animation: rise .2s ease; }
.toast .ac { font-weight: 600; }

/* responsive */
@media (max-width: 920px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .stat-strip, .kpi-grid { grid-template-columns: 1fr; }
  .template-grid { grid-template-columns: 1fr; }
  .topbar-word { font-size: 16px; }
  .view { padding: 24px 16px 48px; }
}

/* ===================== NOTIFICATION CENTER (topbar bell) ===================== */
.notif-btn { position: relative; }
.notif-badge { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 9px; background: var(--gold); color: #1a1605; font-size: 10px; font-weight: 600; display: grid; place-items: center; line-height: 1; }
.notif-badge.hidden { display: none; }
.notif-pop { position: fixed; top: 60px; right: 18px; width: 360px; max-width: calc(100vw - 36px); max-height: 72vh; display: flex; flex-direction: column; overflow: hidden; background: linear-gradient(180deg, #111113, #0c0c0e); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); z-index: 90; animation: rise .15s ease; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold-deep); }
.notif-list { overflow-y: auto; }
.notif-row { display: flex; gap: 11px; align-items: flex-start; padding: 13px 16px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.notif-row:last-child { border-bottom: none; }
.notif-row:hover { background: rgba(201,168,74,.06); }
.notif-row.unread { background: rgba(201,168,74,.04); }
.notif-ic { width: 18px; text-align: center; font-size: 14px; margin-top: 1px; flex-shrink: 0; }
.notif-body { flex: 1; min-width: 0; }
.notif-text { font-size: 13px; color: var(--text); line-height: 1.45; }
.notif-meta { font-size: 11px; color: var(--text-faint); margin-top: 3px; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex-shrink: 0; margin-top: 5px; }

/* ===================== PER-VENTURE AI CHAT ===================== */
.chat { display: flex; flex-direction: column; height: calc(100vh - 290px); min-height: 440px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, var(--panel), var(--panel-2)); overflow: hidden; }
.chat-bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.chat-bar-l { display: flex; align-items: center; gap: 11px; }
.chat-emblem { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; border: 1px solid var(--line-2); background: radial-gradient(ellipse at center, #14120c, #0b0a07); flex-shrink: 0; }
.chat-title { font-size: 14px; color: var(--cream); font-weight: 500; }
.chat-sub { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.chat-log { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.bubble { display: flex; gap: 10px; max-width: 80%; }
.bubble.user { align-self: flex-end; }
.bubble.agent { align-self: flex-start; }
.bubble-body { padding: 11px 14px; border-radius: 13px; font-size: 13.5px; line-height: 1.5; }
.bubble.agent .bubble-body { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-top-left-radius: 4px; }
.bubble.user .bubble-body { background: linear-gradient(180deg, var(--gold-soft), var(--gold)); color: #1a1605; border-top-right-radius: 4px; }
.chat-avatar { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; border: 1px solid var(--line-2); background: radial-gradient(ellipse at center, #14120c, #0b0a07); flex-shrink: 0; }
.typing-dots { display: inline-flex; gap: 4px; padding: 2px 0; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); animation: blink 1s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .2s; }
.typing-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
.chat-suggest { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 18px 12px; }
.chat-chip { font-family: 'Outfit', sans-serif; font-size: 12px; color: var(--text-dim); background: transparent; border: 1px solid var(--line-2); border-radius: 20px; padding: 7px 13px; cursor: pointer; transition: all .15s; }
.chat-chip:hover { border-color: var(--gold); color: var(--gold); }
.chat-input { display: flex; gap: 10px; align-items: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); }
.chat-input textarea { flex: 1; resize: none; max-height: 120px; line-height: 1.4; }

/* ===================== SCHEDULE & TRIGGERS (Automation) ===================== */
.trig-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.trig-row:last-child { border-bottom: none; }
.trig-ic { width: 20px; text-align: center; color: var(--gold); flex-shrink: 0; }
.trig-info { flex: 1; min-width: 0; }
.trig-name { font-size: 14px; color: var(--text); }
.trig-meta { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.trig-next { font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.trig-remove { width: 28px; height: 28px; font-size: 12px; flex-shrink: 0; }
.pb-link { color: var(--gold); cursor: pointer; border-bottom: 1px solid transparent; }
.pb-link:hover { border-bottom-color: var(--gold); }
/* switch */
.switch { position: relative; display: inline-flex; width: 38px; height: 21px; flex-shrink: 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { position: absolute; inset: 0; border-radius: 20px; background: var(--line-2); transition: background .15s; }
.switch-track::before { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: var(--text-faint); transition: transform .15s, background .15s; }
.switch input:checked + .switch-track { background: var(--gold); }
.switch input:checked + .switch-track::before { transform: translateX(17px); background: #1a1605; }

/* ===================== KNOWLEDGE BASE ===================== */
.kb-hint { font-size: 13px; color: var(--text-dim); margin-bottom: 18px; line-height: 1.5; }
.kb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.kb-wide { grid-column: 1 / -1; }
.kb-sub { font-size: 10px; letter-spacing: .3px; text-transform: none; color: var(--text-faint); margin-left: 6px; }
.kb-grid textarea { resize: vertical; }

/* ===================== AGENT RUN CONSOLE ===================== */
.runs-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.run-item { display: flex; align-items: center; gap: 11px; padding: 13px 16px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.run-item:last-child { border-bottom: none; }
.run-item:hover { background: rgba(201,168,74,.05); }
.run-item.active { background: rgba(201,168,74,.09); box-shadow: inset 3px 0 0 var(--gold); }
.run-ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; flex-shrink: 0; border: 1px solid var(--line-2); }
.rt-sched { color: var(--gold); } .rt-man { color: var(--good); } .rt-evt { color: var(--gold-soft); }
.run-meta { flex: 1; min-width: 0; }
.run-when { font-size: 13px; color: var(--text); }
.run-sub { font-size: 10.5px; color: var(--text-faint); margin-top: 2px; }
.run-status { font-size: 9.5px; letter-spacing: .5px; text-transform: uppercase; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.rs-success { color: var(--good); border: 1px solid #1f2a22; }
.rs-failed { color: var(--bad); border: 1px solid #2a1f1f; }
.rs-needs-approval { color: var(--gold); border: 1px solid var(--line-2); }
.run-summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.run-summary .kv { flex: 1; min-width: 110px; flex-direction: column; align-items: flex-start; gap: 3px; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.run-summary .kv-l { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-faint); }
.run-summary .kv-v { font-size: 14px; }
.run-step { display: flex; gap: 14px; }
.rs-rail { display: flex; flex-direction: column; align-items: center; width: 16px; flex-shrink: 0; }
.rs-node { width: 11px; height: 11px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; border: 2px solid var(--bg); }
.rsn-ok { background: var(--good); } .rsn-flagged { background: var(--gold); } .rsn-error { background: var(--bad); }
.rs-line { flex: 1; width: 2px; background: var(--line); margin: 2px 0; }
.rs-content { padding-bottom: 16px; flex: 1; min-width: 0; }
.run-step:last-child .rs-content { padding-bottom: 0; }
.rs-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rs-agent { font-size: 10.5px; letter-spacing: .5px; text-transform: uppercase; color: var(--gold-deep); }
.rs-cost { font-size: 11px; color: var(--text-faint); }
.rs-action { font-size: 14px; color: var(--text); margin-top: 3px; }
.rs-detail { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; line-height: 1.45; }

@media (max-width: 760px) {
  .kb-grid { grid-template-columns: 1fr; }
  .runs-wrap { grid-template-columns: 1fr; }
}

/* ===================== PLATFORM / ACCOUNT CONNECTIONS ===================== */
.cs-error { color: var(--bad); border: 1px solid #2a1f1f; background: rgba(217,140,140,.06); }
.plat-cat { font-size: 10.5px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold-deep); margin: 18px 0 10px; }
.plat-cat:first-child { margin-top: 4px; }
.plat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.plat-card { position: relative; display: flex; align-items: center; gap: 9px; padding: 12px 13px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel-2); cursor: pointer; font-family: 'Outfit', sans-serif; color: var(--text); transition: all .15s; text-align: left; }
.plat-card:hover:not(:disabled) { border-color: var(--gold); transform: translateY(-1px); }
.plat-card:disabled { opacity: .55; cursor: default; }
.plat-card.connecting { border-color: var(--gold); opacity: 1; }
.plat-ic { font-size: 18px; }
.plat-name { font-size: 13px; }
.plat-check { position: absolute; right: 10px; color: var(--good); font-size: 12px; }
.scope-list { list-style: none; margin-top: 4px; }
.scope-list li { font-size: 13px; color: var(--text-dim); padding: 5px 0 5px 18px; position: relative; }
.scope-list li::before { content: "✓"; position: absolute; left: 0; color: var(--good); }
@media (max-width: 640px) { .plat-grid { grid-template-columns: 1fr 1fr; } }

/* ============================== LIGHT THEME ==============================
   Activated by html[data-theme="light"]. Remaps the design tokens, then
   overrides the handful of rules that hard-coded dark colors. The brand
   emblem stays Cortex Gold (drawn with a literal hex in JS). */
html[data-theme="light"] {
  --gold: #a8842c;
  --gold-soft: #c9a84a;
  --gold-deep: #7d7048;
  --cream: #2b2720;          /* heading / primary text token → ink on light */
  --bg: #ece5d4;
  --panel: #fbf7ee;
  --panel-2: #f2ecdb;
  --line: #e3dcc8;
  --line-2: #d6cab0;
  --text: #2b2720;
  --text-dim: #675f50;
  --text-faint: #948b79;
  --good: #2f8f5b;
  --warn: #9c6f0c;
  --bad: #bf5555;
  --shadow: 0 18px 40px rgba(70,58,24,.16);
}
html[data-theme="light"] { background: var(--bg); }
html[data-theme="light"] body {
  background: radial-gradient(1200px 600px at 50% -10%, #f7f0de 0%, rgba(236,229,212,0) 60%) no-repeat, var(--bg);
}
html[data-theme="light"] .topbar { background: rgba(245,240,228,.85); }
html[data-theme="light"] input[type="password"],
html[data-theme="light"] input[type="text"],
html[data-theme="light"] input[type="number"],
html[data-theme="light"] select,
html[data-theme="light"] textarea { background: #fffdf6; color: var(--text); }
html[data-theme="light"] .lock-screen { background: radial-gradient(ellipse at center, #f4eddb 0%, #e7dfca 75%); }
html[data-theme="light"] .lock-card,
html[data-theme="light"] .modal,
html[data-theme="light"] .toast,
html[data-theme="light"] .notif-pop,
html[data-theme="light"] .chart-tip { background: linear-gradient(180deg, #fdfaf2, #f3eddf); }
html[data-theme="light"] .toast,
html[data-theme="light"] .chart-tip { color: var(--text); }
html[data-theme="light"] .tile-emblem,
html[data-theme="light"] .ws-emblem,
html[data-theme="light"] .conn-icon,
html[data-theme="light"] .asset,
html[data-theme="light"] .asset-thumb,
html[data-theme="light"] .chat-emblem,
html[data-theme="light"] .chat-avatar { background: radial-gradient(ellipse at center, #fbf6ea, #f0e8d4); }
html[data-theme="light"] .kan-card { background: #fffdf6; }
html[data-theme="light"] .pbar { background: #e6dec9; }
html[data-theme="light"] .st-off { color: #d8cdb0; }
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: #d8cdb0; }
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #c9bd9c; }
html[data-theme="light"] .modal-overlay { background: rgba(60,52,30,.38); }

/* ===================== Agent Library (home) ===================== */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 40px 0 18px; }
.section-title { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 28px; color: var(--cream); line-height: 1.1; }
.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.agent-card {
  position: relative; border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), var(--panel-2)); padding: 18px 18px 14px;
  cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; display: flex; flex-direction: column; gap: 12px;
}
.agent-card:hover { transform: translateY(-2px); border-color: var(--gold-deep); box-shadow: var(--shadow); }
.agent-card:focus-visible { outline: none; border-color: var(--gold); }
.agent-card-top { display: flex; align-items: center; gap: 12px; }
.agent-card-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 21px; flex-shrink: 0; }
.agent-card-id { min-width: 0; }
.agent-card-name { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 19px; color: var(--cream); line-height: 1.15; }
.agent-card-role { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.agent-card-meta { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; align-content: flex-start; }
.agent-chip { font-size: 10.5px; letter-spacing: .3px; color: var(--text-dim); border: 1px solid var(--line-2); border-radius: 20px; padding: 3px 9px; white-space: nowrap; }
.agent-chip.agent-skill { color: var(--gold-soft); border-color: var(--line-2); }
.agent-chip.agent-noskill { color: var(--text-faint); font-style: italic; }
.agent-card-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 11px; }
.agent-usedby { font-size: 11px; color: var(--text-faint); letter-spacing: .3px; }
.agent-edit { font-size: 11.5px; color: var(--gold-deep); }
.agent-card:hover .agent-edit { color: var(--gold); }

/* agent edit modal — skills checklist */
.skill-grid { display: flex; flex-direction: column; gap: 8px; }
.skill-opt { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.skill-opt:hover { border-color: var(--gold-deep); }
.skill-opt:has(input:checked) { border-color: var(--gold); background: rgba(201,168,74,.07); }
.skill-opt input { width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--gold); }
.skill-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 15px; flex-shrink: 0; }
.skill-info { display: flex; flex-direction: column; }
.skill-name { font-size: 13.5px; color: var(--cream); }
.skill-role { font-size: 11.5px; color: var(--text-dim); }

/* ===================== Workflow tab ===================== */
.wf-mode { display: flex; gap: 10px; margin: 16px 0 18px; }
.wf-mode-opt { flex: 1; border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px; cursor: pointer; transition: all .15s; }
.wf-mode-opt:hover { border-color: var(--gold-deep); }
.wf-mode-opt.selected { border-color: var(--gold); background: rgba(201,168,74,.07); }
.wf-mode-name { font-size: 13.5px; color: var(--cream); font-weight: 500; }
.wf-mode-desc { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.wf-steps { display: flex; flex-direction: column; gap: 10px; }
.wf-step { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line-2); border-radius: 11px; padding: 12px 14px; background: var(--panel-2); transition: border-color .15s, box-shadow .15s; }
.wf-step.dragging { opacity: .4; }
.wf-step.drop-before { box-shadow: inset 0 4px 0 var(--gold); }
.wf-step.drop-after { box-shadow: inset 0 -4px 0 var(--gold); }
.wf-grip { color: var(--text-faint); cursor: grab; font-size: 14px; letter-spacing: -2px; }
.wf-num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; color: var(--gold); border: 1px solid var(--line-2); flex-shrink: 0; }
.wf-icon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; border: 1px solid var(--line-2); background: var(--panel); font-size: 18px; flex-shrink: 0; }
.wf-info { flex: 1; min-width: 0; }
.wf-name { font-size: 14px; color: var(--cream); font-weight: 500; }
.wf-model { font-size: 10.5px; color: var(--text-faint); border: 1px solid var(--line-2); border-radius: 20px; padding: 1px 7px; margin-left: 6px; }
.wf-detail { font-size: 12px; color: var(--text-dim); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; }
.wf-skills { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.wf-skill { font-size: 10px; color: var(--gold-soft); border: 1px solid var(--line-2); border-radius: 20px; padding: 1px 7px; }
.wf-gate { margin-left: auto; }
.wf-gate-lbl { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-faint); }
.wf-edit, .wf-remove { font-size: 14px; }

/* add-agent / step picker */
.agent-pick-list { display: flex; flex-direction: column; gap: 8px; }
.agent-pick { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; transition: all .15s; }
.agent-pick:hover { border-color: var(--gold-deep); }
.agent-pick:has(input:checked) { border-color: var(--gold); background: rgba(201,168,74,.07); }
.agent-pick input { width: 16px; height: 16px; accent-color: var(--gold); flex-shrink: 0; }
.agent-pick-ic { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 16px; flex-shrink: 0; }
.agent-pick-info { display: flex; flex-direction: column; min-width: 0; }
.agent-pick-name { font-size: 13.5px; color: var(--cream); }
.agent-pick-role { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

html[data-theme="light"] .agent-card,
html[data-theme="light"] .wf-step { background: linear-gradient(180deg, #fdfaf2, #f3eddf); }
html[data-theme="light"] .agent-card-icon,
html[data-theme="light"] .skill-ic,
html[data-theme="light"] .agent-pick-ic,
html[data-theme="light"] .wf-icon { background: radial-gradient(ellipse at center, #fbf6ea, #f0e8d4); }

/* trigger target chip + run-now */
.trig-target { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; border: 1px solid var(--line-2); border-radius: 20px; padding: 1px 8px; margin-left: 2px; }
.trig-target.tt-wf { color: var(--gold-soft); }
.trig-target.tt-agent { color: var(--text-dim); }
.trig-run { flex-shrink: 0; }

/* appearance toggle (Settings) */
.theme-toggle { display: flex; gap: 8px; }
.theme-opt { flex: 1; font-family: 'Outfit', sans-serif; font-size: 13px; color: var(--text-dim); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 9px; padding: 12px; cursor: pointer; transition: all .15s; }
.theme-opt:hover { border-color: var(--gold-deep); }
.theme-opt.active { border-color: var(--gold); color: var(--gold); background: rgba(201,168,74,.08); }
