/* ===== Tokens (light style, rounded cards) ===== */
:root {
  --page: #e9ebef;           /* outer frame */
  --bg: #f7f8fa;             /* app background */
  --surface: #ffffff;
  --surface-2: #f3f4f6;      /* inner tiles */
  --border: #e7e8ec;
  --border-strong: #d9dbe1;
  --text: #0f1115;
  --muted: #6b7180;
  --ink: #111216;            /* primary button / active item */
  --blue: #1f4fe0;
  --blue-2: #3b6cf6;
  --teal: #22b394;
  --orange: #f08a3c;
  --ok: #18a058;
  --ok-bg: #e8f7ef;
  --warn: #c27a10;
  --danger: #dc3b3b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .12);
  --on-ink: #ffffff;         /* text on primary button / active item */
  --soft-text: #3b3f4a;
  --blue-bg: #eaf0ff;
  --map-bg: #eceef2;
  --map-dot: #ffffff;
  --map-dot-shadow: #c3c9d4;
  --radar-grid: #e3e5ea;
  --radar-fill: #f7f8fa;
  --font-sans: "Schibsted Grotesk", "Schibsted Fallback", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-display: "Newsreader", "Newsreader Fallback", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: var(--font-sans);
  font-kerning: normal;
  font-synthesis-weight: none;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
/* Page titles carry the brand voice in Newsreader; everything operational stays in Schibsted Grotesk */
h1 { font-family: var(--font-display); font-size: 30px; line-height: 1.12; margin: 0 0 4px; letter-spacing: -.012em; font-weight: 600; text-wrap: balance; }
h2 { font-size: 18px; margin: 0 0 4px; letter-spacing: -.012em; font-weight: 650; }
h3 { font-size: 15px; margin: 18px 0 10px; font-weight: 650; letter-spacing: -.006em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--danger); margin: 0; }
[hidden] { display: none !important; }
.ico { flex-shrink: 0; }

/* ===== Frame + layout ===== */
.frame { padding: 0; min-height: 100vh; }
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh;
  /* white sidebar column down to the bottom, even with long content */
  background: linear-gradient(to right, var(--surface) 235px, var(--border) 235px 236px, var(--bg) 236px); /* full-bleed app shell: the window itself is the surface, so cards inside it are not cards-in-a-card */
  overflow: clip; }
.sidebar { background: var(--surface); padding: 18px 14px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--text); padding: 2px 6px; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--ink); color: var(--on-ink); font-size: 14px; }
.workspace { display: flex; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 12px; padding: 9px 10px; }
.workspace strong { display: block; font-size: 14px; }
.workspace span:not(.ws-icon) { font-size: 11px; color: var(--muted); }
.ws-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section { font-size: 11px; color: var(--muted); margin: 12px 8px 4px; font-weight: 500; }
.nav-link { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; color: var(--soft-text); font-weight: 500; }
.nav-link .ico { color: #7a7f8c; }
.nav-link:hover { background: var(--surface-2); text-decoration: none; }
.nav-link.active { background: var(--ink); color: var(--on-ink); }
.nav-link.active .ico { color: var(--on-ink); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.user-card { display: flex; gap: 10px; align-items: center; padding: 6px 4px; }
.user-card strong { display: block; font-size: 13px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), var(--teal)); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.content { padding: 18px 28px 48px; min-width: 0; }
.crumb { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; margin-bottom: 18px; }
.crumb span { opacity: .5; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.split { display: flex; gap: 18px; align-items: flex-start; }
.side { width: 250px; flex-shrink: 0; position: sticky; top: 18px; }
.side.wide { width: 360px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.back { display: inline-flex; margin-bottom: 12px; color: var(--muted); }

/* ===== Cards and controls ===== */
.panel, .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head p { margin: 0; }
.panel summary { cursor: pointer; font-weight: 600; }
.panel summary + * { margin-top: 12px; }
#meta-import { margin-bottom: 16px; }
.tile { background: var(--surface-2); border-radius: 12px; padding: 12px; }

input, select, textarea {
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
  border-radius: 10px; padding: 9px 11px; font: inherit; width: 100%;
}
.row input, .row select, .filters input, .filters select { width: auto; }
.row input.grow { flex: 1; min-width: 160px; }
.filters input.grow { flex: 1 1 320px; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(31, 79, 224, .15); border-color: var(--blue); }
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 500; }

.btn { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); padding: 8px 14px; border-radius: 10px; font: inherit; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; box-shadow: var(--shadow); }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn.primary:hover { background: var(--ink); opacity: .88; }
.btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn:disabled { opacity: .5; cursor: wait; }
.link { background: none; border: 0; color: var(--blue); cursor: pointer; font: inherit; padding: 0; }
.icon-btn { width: 36px; height: 36px; padding: 0; border-radius: 50%; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px 11px; font-size: 12px; color: var(--soft-text); cursor: pointer; }
.chip.active, .chip:hover { border-color: var(--ink); color: var(--text); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--soft-text); font-weight: 500; }
.badge.ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.badge.blue { color: var(--blue); background: var(--blue-bg); border-color: transparent; }
.badge.off { color: var(--muted); }
.trend { color: var(--ok); font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.trend.down { color: var(--danger); }
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.list li { display: flex; justify-content: space-between; align-items: center; padding: 7px 9px; border-radius: 8px; cursor: pointer; }
.list li:hover, .list li.active { background: var(--surface-2); }

/* ===== Dashboard ===== */
.greet h1 { font-size: 32px; }
.kpi-grid { display: grid; grid-template-columns: 1.15fr repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; min-height: 140px; }
.stat .stat-icon { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); display: grid; place-items: center; color: var(--soft-text); }
.stat .stat-label { color: var(--soft-text); font-weight: 500; }
.stat .stat-value { font-size: 30px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; margin-top: auto; }
.stat.hero { background: linear-gradient(140deg, #1d47d6 0%, #2e63f3 60%, #4b7cff 100%); color: #fff; border: 0; position: relative; overflow: hidden; }
.stat.hero::after { content: ""; position: absolute; inset: auto -40px -60px auto; width: 180px; height: 180px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.stat.hero .stat-icon { border-color: rgba(255, 255, 255, .35); color: #fff; background: rgba(255, 255, 255, .12); }
.stat.hero .stat-label, .stat.hero .trend { color: #fff; }
.stat.hero .muted { color: rgba(255, 255, 255, .78); }
.stat-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; margin-bottom: 14px; }
.dash-grid > .card { display: flex; flex-direction: column; }
.map-area { flex: 1; background: var(--map-bg); border-radius: 14px; display: flex; align-items: center; }
.map-area > div { width: 100%; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: auto; padding-top: 14px; }
.mini { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; }
.mini .ico { color: var(--muted); }
.mini strong { display: block; font-size: 18px; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.mini span { font-size: 11px; color: var(--muted); }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.quick a { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 10px 16px; box-shadow: var(--shadow); color: var(--text); display: flex; flex-direction: column; gap: 4px; transition: transform .15s, box-shadow .15s; }
.quick a:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.quick .art { background: var(--surface-2); border-radius: 12px; height: 120px; display: grid; place-items: center; margin-bottom: 10px; }
.quick .art span { width: 64px; height: 64px; border-radius: 14px; display: grid; place-items: center; color: #fff; box-shadow: 0 10px 24px rgba(16, 24, 40, .18), 0 0 0 8px var(--surface); }
.quick strong { padding: 0 6px; }
.quick small { padding: 0 6px; color: var(--muted); }
.feed { display: flex; flex-direction: column; gap: 10px; }
.feed-item { display: flex; gap: 12px; align-items: center; border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.feed-thumb { width: 52px; height: 52px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center; color: #fff; }
.feed-item .grow > div:last-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; color: var(--muted); }
.progress { background: var(--surface-2); border-radius: 999px; height: 6px; overflow: hidden; min-width: 90px; }
.progress > div { height: 100%; background: var(--blue); border-radius: 999px; }

/* Dotted map */
.map-wrap { position: relative; background: var(--map-bg); border-radius: 14px; overflow: hidden; }
.map-wrap canvas { display: block; width: 100%; height: auto; }
.map-pin { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; cursor: pointer; box-shadow: 0 0 0 3px var(--surface); transition: transform .15s; }
.map-pin:hover { transform: translate(-50%, -50%) scale(1.25); }
.map-pin::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid currentColor; opacity: .25; }
.map-tip { position: absolute; transform: translate(-50%, calc(-100% - 16px)); background: var(--surface); border-radius: 12px; padding: 8px 12px; box-shadow: var(--shadow-lg); font-size: 12px; white-space: nowrap; pointer-events: none; text-align: center; }
.map-tip strong { display: block; font-size: 13px; }
.map-tip b { color: var(--blue); }

/* Radar */
.radar { display: block; margin: 0 auto; width: 100%; max-width: 360px; height: auto; overflow: visible; }
.radar text { font-size: 11px; fill: var(--muted); font-family: inherit; }
.legend { display: flex; gap: 14px; justify-content: center; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.score-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.score-tile { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; }
.score-tile .bar-v { width: 6px; height: 34px; border-radius: 4px; }
.score-tile strong { display: block; font-size: 18px; }
.score-tile span { font-size: 11px; color: var(--muted); text-transform: capitalize; }

/* ===== Ad cards ===== */
.ad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.ad-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; padding: 8px; }
.ad-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.ad-media { aspect-ratio: 4 / 3; display: grid; place-items: center; position: relative; color: #fff; cursor: pointer; border-radius: 12px; }
.ad-media .badges { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; }
.ad-media .badge { background: rgba(255, 255, 255, .92); border: 0; color: #111216; }
.ad-media .days { position: absolute; bottom: 10px; right: 10px; background: rgba(17, 18, 22, .78); color: #fff; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.ad-media .fmt { width: 56px; height: 56px; border-radius: 14px; background: rgba(255, 255, 255, .92); color: #111216; display: grid; place-items: center; box-shadow: 0 10px 24px rgba(0, 0, 0, .15); }
.ad-body { padding: 12px 6px 6px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.ad-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.ad-copy { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.ad-actions { display: flex; gap: 6px; margin-top: auto; flex-wrap: wrap; }

/* ===== Competitors / KPIs ===== */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.brand-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.brand-card h4 { margin: 0; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin: 4px 0 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi span { color: var(--muted); font-size: 12px; }
.kpi strong { display: block; font-size: 26px; letter-spacing: -.02em; font-weight: 650; font-variant-numeric: tabular-nums; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.panel > h3:first-child { margin-top: 0; }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar { display: grid; grid-template-columns: 100px 1fr 54px; gap: 10px; align-items: center; font-size: 12px; }
.bar > span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.bar-track { background: var(--surface-2); border-radius: 999px; height: 8px; overflow: hidden; }
.bar-fill { background: var(--blue); height: 100%; border-radius: 999px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }

/* ===== AI Studio ===== */
.tabs { display: inline-flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); padding: 4px; border-radius: 12px; box-shadow: var(--shadow); }
.tab { background: none; border: 0; color: var(--muted); padding: 7px 14px; border-radius: 9px; cursor: pointer; font: inherit; font-weight: 500; }
.tab small { font-weight: 400; opacity: .7; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--on-ink); background: var(--ink); }
.result { min-height: 200px; margin-bottom: 20px; }
.result dl { display: grid; grid-template-columns: 170px 1fr; gap: 10px 16px; margin: 0; }
.result dt { color: var(--muted); font-size: 12px; }
.result dd { margin: 0; }
.variation { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: var(--surface); }
.variation h4 { margin: 0 0 6px; font-size: 15px; }
.variation p { margin: 6px 0; white-space: pre-line; }
.score { font-size: 32px; font-weight: 700; color: var(--blue); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.history .item { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; margin-bottom: 6px; }
.history .item:hover { border-color: var(--border-strong); background: var(--surface-2); }
.scene { display: grid; grid-template-columns: 70px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }

/* ===== Profiles ===== */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
.steps div { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.steps span { color: var(--muted); font-size: 12px; }

/* ===== Modal / toast ===== */
.modal { position: fixed; inset: 0; background: rgba(15, 17, 21, .35); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-box { background: var(--surface); border-radius: 20px; padding: 26px; width: min(720px, 100%); max-height: 90vh; overflow: auto; position: relative; box-shadow: var(--shadow-lg); }
.modal-close { position: absolute; top: 12px; right: 16px; background: none; border: 0; color: var(--muted); font-size: 24px; cursor: pointer; }
.pre { white-space: pre-line; background: var(--surface-2); padding: 12px; border-radius: 10px; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 20px; }

/* ===== Auth ===== */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 20% 10%, #dfe7ff, transparent 45%), radial-gradient(circle at 90% 90%, #dff6ef, transparent 40%), var(--page); }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 32px; width: min(400px, 100%); box-shadow: var(--shadow-lg); }
.auth-card .logo { margin-bottom: 20px; padding: 0; }

/* ===== Responsive ===== */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .frame { padding: 0; }
  .shell { grid-template-columns: 1fr; border-radius: 0; min-height: 100vh; background: var(--bg); }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .nav-section { display: none; }
  .sidebar-foot { flex-direction: row; align-items: center; }
  .sidebar-foot .btn.block { width: auto; }
  .content { padding: 16px 16px 40px; }
  .split { flex-direction: column; }
  .side, .side.wide { width: 100%; position: static; }
  .result dl { grid-template-columns: 1fr; }
  .kpi-grid, .quick, .mini-stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .kpi-grid, .quick { grid-template-columns: 1fr; }
}

/* ===== Top bar: search, quick actions, theme, user ===== */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar .crumb { margin: 0; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.gsearch { position: relative; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; padding: 0 8px 0 12px; width: 340px; box-shadow: var(--shadow); color: var(--muted); }
.gsearch:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31, 79, 224, .15); }
.gsearch input { border: 0; background: none; padding: 8px 0; outline: none; box-shadow: none; flex: 1; min-width: 0; }
.gsearch input:focus { outline: none; }
.gsearch input::-webkit-search-cancel-button { display: none; }
kbd { font: 500 11px var(--font-sans); color: var(--muted); border: 1px solid var(--border-strong); border-radius: 6px; padding: 1px 6px; background: var(--surface-2); white-space: nowrap; }
.icon-btn { width: 38px; height: 38px; padding: 0; border-radius: 50%; color: var(--soft-text); }
.dropdown { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; padding: 3px 10px 3px 3px; cursor: pointer; color: var(--text); font: inherit; font-weight: 500; box-shadow: var(--shadow); }
.user-btn .avatar { width: 30px; height: 30px; }
.user-btn .ico { color: var(--muted); }
.menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; min-width: 260px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column; }
.menu.right { left: auto; right: 0; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--text); background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.menu a:hover, .menu button:hover, .menu a.active { background: var(--surface-2); text-decoration: none; }
.menu small { display: block; font-size: 11px; color: var(--muted); }
.menu-ico { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); display: grid; place-items: center; color: var(--soft-text); flex-shrink: 0; }
.menu-title { font-size: 11px; color: var(--muted); padding: 8px 10px 4px; font-weight: 500; }
.menu-head { display: flex; gap: 10px; align-items: center; padding: 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-head strong { display: block; }
.menu-head > div { min-width: 0; }
.menu-head span:not(.avatar) { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.avatar.big { width: 40px; height: 40px; font-size: 16px; }
.menu-credits { font-variant-numeric: tabular-nums; display: flex; justify-content: space-between; align-items: center; margin: 4px 4px 6px; padding: 10px; border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.menu-credits span { display: inline-flex; gap: 6px; align-items: center; color: var(--soft-text); }
.menu-credits strong { color: var(--blue); }
.gsearch-results { width: 100%; min-width: 380px; max-height: 70vh; overflow: auto; }
.menu-empty { padding: 12px 10px; color: var(--muted); font-size: 13px; }
.menu-foot { border-top: 1px solid var(--border); margin-top: 4px; border-radius: 0 0 9px 9px !important; }

/* ===== Dark mode (toggled from the top bar; light is the default) ===== */
:root[data-theme="dark"] {
  --page: #08090b; --bg: #0f1115; --surface: #16181d; --surface-2: #1e2128; --border: #262a32; --border-strong: #323743;
  --text: #eceef3; --muted: #8d94a3; --soft-text: #c3c8d2; --ink: #f1f2f4; --on-ink: #111216;
  --blue: #4c7dff; --blue-2: #6b93ff; --blue-bg: rgba(76, 125, 255, .16); --ok: #3fcf8e; --ok-bg: rgba(63, 207, 142, .14);
  --map-bg: #13151a; --map-dot: #2b2f39; --map-dot-shadow: #0a0b0e; --radar-grid: #2a2e37; --radar-fill: #181b21;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 20px 50px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
:root[data-theme="dark"] .auth-page { background: radial-gradient(circle at 20% 10%, rgba(76, 125, 255, .14), transparent 45%), var(--page); }

@media (max-width: 1100px) {
  .gsearch { width: 240px; }
  .gsearch kbd { display: none; }
}
@media (max-width: 700px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .top-actions { flex-wrap: nowrap; }
  .gsearch { flex: 1; width: auto; }
  .gsearch-results { min-width: 0; }
  .user-btn-name, .user-btn .ico { display: none; }
  .user-btn { padding: 3px; }
}

/* ===== Language selector (sign-in screen and user menu) ===== */
.lang-select { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.lang-select .ico { margin: 0 4px; }
.lang-opt { background: none; border: 0; border-radius: 999px; padding: 4px 9px; min-height: 24px; font: 600 11px var(--font-sans); color: var(--muted); cursor: pointer; }
.lang-opt:hover { color: var(--text); }
.lang-opt.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.menu .lang-opt { padding: 4px 9px; border-radius: 999px; }
.menu-lang { display: flex; justify-content: space-between; align-items: center; padding: 4px 10px 8px; font-size: 13px; color: var(--soft-text); }
.auth-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 20px; }
.auth-top .logo { margin: 0; }

/* ===== Brand logos: pick the right version for the theme ===== */
/* One rule set for every light/dark asset (logos, symbols); !important avoids specificity fights */
.theme-logo-dark { display: none !important; }
:root[data-theme="dark"] .theme-logo-dark { display: block !important; }
:root[data-theme="dark"] .theme-logo-light { display: none !important; }
.logo img { height: 30px; width: auto; display: block; }
.sidebar .btn.block { margin-top: -2px; }

/* ===== Chat composer ===== */
.composer { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 22px; padding: 14px 14px 10px; box-shadow: var(--shadow-lg); text-align: left; transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(76, 125, 255, .15), var(--shadow-lg); }
.composer textarea { border: 0; background: none; resize: none; font-size: 16px; padding: 6px 6px 10px; min-height: 52px; max-height: 200px; box-shadow: none; }
.composer textarea:focus { outline: none; }
.composer textarea::placeholder { color: var(--muted); opacity: 1; }
.composer-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.platforms { display: flex; gap: 6px; flex-wrap: wrap; }
.pf { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 0; color: var(--soft-text); border-radius: 999px; padding: 6px 10px; font: 500 12.5px var(--font-sans); cursor: pointer; }
.pf:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
/* Platform picker reads as text tabs inside the composer (no pills-in-a-card): the active one is underlined */
.pf.active { color: var(--text); font-weight: 650; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 7px; text-decoration-color: var(--blue); }
.pf.active .ico { color: var(--blue); }
.pf .soon { font-size: 11px; line-height: 1.35; color: var(--muted); text-transform: lowercase; }
.pf .soon::before { content: "· "; }
.send { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.send:disabled { opacity: .3; cursor: not-allowed; }
.modes { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }
.modes .chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; background: transparent; }
.modes .chip.active { background: var(--surface); border-color: var(--blue); color: var(--text); }
.detect { min-height: 20px; margin: 12px 0 0; font-size: 13px; color: var(--blue); display: flex; gap: 6px; align-items: center; justify-content: center; }
.detect.warn { color: var(--warn); }


/* Auth modal */
.auth-box { width: min(420px, 100%); text-align: center; }
.auth-box form { text-align: left; margin-top: 10px; }
.brand-symbol { width: 44px; height: 44px; margin: 0 auto 6px; }
.pending-intent { background: var(--blue-bg); color: var(--blue); border-radius: 10px; padding: 8px 12px; font-size: 13px; margin: 10px 0; display: flex; gap: 6px; align-items: center; justify-content: center; text-align: left; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin-top: 12px; }
.seg-opt { background: none; border: 0; border-radius: 9px; padding: 8px; font: 600 13px var(--font-sans); color: var(--muted); cursor: pointer; }
.seg-opt.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.center { text-align: center; }
.panel.hint { border-color: var(--blue); margin-bottom: 14px; }
.panel.hint p { margin: 6px 0 10px; }


/* ===== Visitor vs signed-in shell (class set before paint in theme.ejs) ===== */
.is-guest .session-only { display: none !important; }
.has-session .guest-only { display: none !important; }
.guest-only.row { gap: 8px; }


/* ===== Chat (home) ===== */
.chat { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; min-height: calc(100vh - 140px); }
.chat-hero { text-align: center; margin-top: 8vh; }
.chat-hero h1 { font-size: clamp(28px, 3.6vw, 42px); letter-spacing: -.015em; margin-bottom: 8px; }
.chat-hero p { margin: 0 auto 24px; max-width: 600px; }
.chat .hero-symbol { width: 60px; height: 60px; margin: 0 auto 12px; display: block; }
.thread { display: flex; flex-direction: column; gap: 22px; padding-bottom: 12px; }
.composer-dock { margin-top: 4px; }
.starters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.starter { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--soft-text); border-radius: 12px; padding: 9px 14px; font: 500 13px var(--font-sans); cursor: pointer; }
.starter:hover { border-color: var(--border-strong); color: var(--text); }
/* During a conversation: hide the empty state and dock the composer at the bottom */
.chat.has-thread .chat-hero, .chat.has-thread .starters { display: none; }
.chat.has-thread .thread { padding-top: 8px; flex: 1; }
.chat.has-thread .composer-dock { position: sticky; bottom: 0; padding: 12px 0 14px; background: linear-gradient(to top, var(--bg) 75%, transparent); }
.chat.has-thread .modes { margin-top: 10px; }
.chat.has-thread .detect { margin-top: 6px; }

.msg { display: flex; gap: 12px; align-items: flex-start; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--surface-2); border: 1px solid var(--border); padding: 10px 14px; border-radius: 16px 16px 4px 16px; max-width: 80%; white-space: pre-wrap; }
.avatar-bot { width: 32px; height: 32px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; flex-shrink: 0; }
.avatar-bot img { width: 22px; height: 22px; }
.reply { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 4px 16px 16px 16px; padding: 14px 16px; }
.reply > p:first-child { margin-top: 0; }
.reply h4 { margin: 14px 0 8px; font-size: 14px; }
.reply-actions { margin-top: 12px; }
.reply-error { color: var(--warn); display: flex; gap: 8px; align-items: center; margin: 0; }
.warn-badge { color: var(--warn); margin-bottom: 8px; }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 10px 0 0; }
.dl dt { color: var(--muted); font-size: 12px; }
.dl dd { margin: 0; }
.dl ul { margin: 0; padding-left: 18px; }
.kpis.compact { grid-template-columns: repeat(4, 1fr); margin: 10px 0; }
.kpis.compact .kpi { padding: 10px 12px; box-shadow: none; }
.kpis.compact .kpi strong { font-size: 20px; }
.mini-posts { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.mini-post { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.hook-list { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.hook-list li { padding-left: 4px; }
.hook-list li span:first-child { margin-right: 8px; }
.chat-ads { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-top: 10px; }
.dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite both; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

@media (max-width: 760px) {
  .kpis.compact { grid-template-columns: repeat(2, 1fr); }
  .dl { grid-template-columns: 1fr; }
  .msg.user .bubble { max-width: 92%; }
  .chat-hero { margin-top: 2vh; }
}

/* ===== v0.4: account notices ===== */
.app-banners { display: flex; flex-direction: column; gap: 8px; margin: -6px 0 16px; }
.app-banners:empty { display: none; }
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); color: var(--text); background: var(--surface); }
.banner:hover { text-decoration: none; border-color: var(--border-strong); }
.banner.info { border-color: rgba(76, 125, 255, .45); background: var(--blue-bg); }
.banner.warn { border-color: rgba(194, 122, 16, .5); background: rgba(194, 122, 16, .1); }
.banner > span:nth-child(2) { flex: 1; }
.banner-cta { font-weight: 600; white-space: nowrap; }
a.workspace { color: var(--text); }
a.workspace:hover { text-decoration: none; border-color: var(--border-strong); }
.notice { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); margin: 8px 0; font-size: 13px; }
.notice.info { background: var(--blue-bg); color: var(--text); }
.notice.warn { background: rgba(194, 122, 16, .12); color: var(--warn); }
.section-title { margin-top: 28px; }
.cost-note { margin: -6px 0 16px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-state .ico { opacity: .7; }

/* ===== Skeleton loading + "AI working" ===== */
.sk { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk-line { height: 12px; margin: 10px 0; }
.sk-line.short { width: 55%; }
.sk-avatar { width: 40px; height: 40px; border-radius: 50%; }
.sk-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.ai-working { display: flex; gap: 10px; align-items: center; color: var(--blue); font-weight: 500; margin: 6px 0 14px; }
.skeleton-form { opacity: .55; pointer-events: none; }
.is-loading { opacity: .85; }
@media (prefers-reduced-motion: reduce) { .sk, .dots i { animation: none; } }

/* ===== Discover / track forms ===== */
.discover { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; padding: 8px 8px 8px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
.discover:focus-within { border-color: var(--blue); }
.discover input, .discover textarea { border: 0; background: none; box-shadow: none; padding: 8px 4px; font-size: 15px; }
.discover input:focus, .discover textarea:focus { outline: none; }
.discover select { width: auto; }
.discover-ico { color: var(--blue); display: grid; place-items: center; }
.history { margin-bottom: 14px; gap: 6px; }
.disc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.acc-card, .post-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.acc-head { display: flex; gap: 10px; align-items: center; }
.acc-head > div { flex: 1; min-width: 0; }
.acc-head strong, .acc-head span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #c13584, #f08a3c); color: #fff; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.acc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.acc-stats span { background: var(--surface-2); border-radius: 10px; padding: 8px; }
.acc-stats strong { display: block; font-size: 15px; }
.acc-stats small { color: var(--muted); font-size: 11px; }
.acc-cap { margin: 0; }
.post-card p { margin: 0; white-space: pre-line; }

/* ===== Monitors (profiles / competitors) ===== */
.monitor-list { display: flex; flex-direction: column; gap: 8px; }
.monitor-row { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; flex-wrap: wrap; }
.freq-select { width: auto; padding: 6px 8px; font-size: 13px; }

/* ===== My Brand ===== */
.welcome { border-color: var(--blue); margin-bottom: 16px; }
.welcome h2 { margin-top: 8px; }
.step-pill { display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--blue); background: var(--blue-bg); padding: 3px 10px; border-radius: 999px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.label-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.colors { display: flex; flex-direction: column; gap: 6px; }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type=color] { width: 44px; height: 36px; padding: 2px; }
.brand-preview { display: flex; flex-direction: column; gap: 6px; }
.bp-head { height: 90px; border-radius: 12px; display: grid; place-items: center; }
.bp-initial { width: 52px; height: 52px; border-radius: 14px; background: rgba(255, 255, 255, .9); color: #111216; display: grid; place-items: center; font-weight: 700; font-size: 22px; }
.bp-logo { max-height: 60px; max-width: 70%; border-radius: 8px; }
.swatches { display: flex; gap: 6px; }
.swatches span { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--border); }

/* ===== AI Studio (flows builder) ===== */
.ai-build textarea { resize: vertical; min-height: 44px; }
.templates { margin-bottom: 18px; gap: 6px; }
.flow-item { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; color: var(--text); font: inherit; cursor: pointer; }
.flow-item small { display: block; }
.flow-item.active, .flow-item:hover { border-color: var(--blue); }
.flow-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); flex-shrink: 0; }
.flow-dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.builder-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.flow-name { font-size: 18px; font-weight: 600; border: 0; background: none; padding: 4px 0; box-shadow: none; }
.flow-name:focus { outline: none; border-bottom: 1px solid var(--blue); border-radius: 0; }
.node { display: flex; gap: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px; }
.trigger-node { border-color: var(--blue); background: var(--blue-bg); }
.node-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; color: var(--blue); flex-shrink: 0; }
.node-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.node select { width: auto; }
.node p { margin: 6px 0; }
.node textarea { margin-top: 4px; }
.node-warn { color: var(--warn); font-size: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.connector { width: 2px; height: 18px; background: var(--border-strong); margin: 0 0 0 30px; }
.add-step { margin-left: 8px; border-style: dashed; }
.builder-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); flex-wrap: wrap; gap: 10px; }
.test-box { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 4px; }
.test-box textarea { margin-bottom: 8px; }
.run-log { margin: 10px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.run-log li.error strong { color: var(--danger); }
.run-img { max-width: 220px; border-radius: 10px; margin-top: 6px; display: block; }
.run-item { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.run-item summary { cursor: pointer; font-size: 13px; }
.switch { display: inline-flex; align-items: center; gap: 8px; flex-direction: row; font-size: 13px; color: var(--text); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 36px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--blue); }

/* ===== Billing ===== */
.current-plan { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.current-plan h2 { font-size: 24px; margin: 2px 0; }
.credit-meter { min-width: 240px; }
.credit-meter .progress { height: 10px; margin-top: 8px; }
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.plan-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.plan-card.featured { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue), var(--shadow-lg); }
.plan-card.is-current { opacity: .8; }
.plan-card h3 { margin: 4px 0 0; font-size: 20px; }
.plan-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--blue-bg); color: var(--blue); display: grid; place-items: center; }
.plan-ribbon { position: absolute; top: 14px; right: 14px; font-size: 11px; font-weight: 600; background: var(--blue); color: #fff; padding: 3px 10px; border-radius: 999px; }
.plan-price strong { font-size: 32px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.plan-feats { list-style: none; padding: 0; margin: 6px 0 12px; display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.plan-feats li { display: flex; gap: 8px; align-items: flex-start; }
.plan-feats li::before { content: ""; flex-shrink: 0; width: 15px; height: 15px; margin-top: 2px; background: var(--ok); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat; }

/* ===== Admin ===== */
.engine-row { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.engine-row p { margin: 0; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 12px; }

/* ===== Home: visitor cards, trust note, legal footer, coming-soon platforms ===== */
.home-cards { margin-top: 34px; }
.chat.has-thread .home-cards { display: none; }
.cap-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.cap-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.cap-card small { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.cap-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--blue-bg); color: var(--blue); display: grid; place-items: center; }
.trust-note { display: flex; gap: 6px; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; margin-top: 16px; }
.legal-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 18px 16px 6px; }
.pf.soon-pf { opacity: .75; cursor: not-allowed; }
.pf.soon-pf .soon { opacity: 1; }
.legal-foot .linkish { background: none; border: 0; padding: 4px 2px; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.legal-foot .linkish:hover { color: var(--text); }

@media (max-width: 1000px) {
  .plan-grid, .cap-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .plan-grid, .cap-grid, .form-grid { grid-template-columns: 1fr; }
  .discover { flex-wrap: wrap; }
  .discover .grow { flex-basis: 100%; }
}

/* =====================================================================
   v0.5 design layer — premium polish (tokens, depth, focus, components)
   ===================================================================== */
/* Type system (shared with the site): Schibsted Grotesk for UI/text (tabular figures on demand),
   Newsreader (optical cut 48 / italic 32) for page titles only. SIL OFL, self-hosted, latin + latin-ext.
   Metric-adjusted local fallbacks keep the swap from shifting layout. */
@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("/fonts/schibsted-grotesk.woff2") format("woff2"); }
@font-face { font-family: "Schibsted Grotesk"; font-style: italic; font-weight: 400 700; font-display: swap; src: url("/fonts/schibsted-grotesk-italic.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/newsreader-display.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-style: italic; font-weight: 400 600; font-display: swap; src: url("/fonts/newsreader-display-italic.woff2") format("woff2"); }
@font-face { font-family: "Schibsted Fallback"; src: local("Arial"), local("Helvetica"), local("Liberation Sans"); size-adjust: 105.2%; ascent-override: 92.8%; descent-override: 24.5%; line-gap-override: 0%; }
@font-face { font-family: "Newsreader Fallback"; src: local("Georgia"), local("Times New Roman"); size-adjust: 97%; ascent-override: 75.8%; descent-override: 27.3%; line-gap-override: 0%; }
:root {
  --radius: 14px; --radius-sm: 10px; --radius-xs: 8px;
  --ring: rgba(31, 79, 224, .45);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 6px rgba(16, 24, 40, .04);
  --shadow-lg: 0 18px 48px -12px rgba(16, 24, 40, .18), 0 2px 6px rgba(16, 24, 40, .05);
  --card-hi: rgba(255, 255, 255, .7);
  --nav-active: #eef1f7;
  --tone-blue: #1f4fe0; --tone-teal: #129a7d; --tone-violet: #6d4fd8; --tone-amber: #b7741a; --tone-rose: #c8415c;
  --ok-solid: #18a058; --info: #1f4fe0; --warn-solid: #d48a1a; --danger-solid: #dc3b3b;
  --ease: cubic-bezier(.2, .7, .2, 1);
  font-feature-settings: "cv11", "ss01", "ss03";
}
:root[data-theme="dark"] {
  --page: #050608; --bg: #0b0d11; --surface: #12151b; --surface-2: #1a1e26; --border: #222731; --border-strong: #2f3542;
  --ring: rgba(107, 147, 255, .55);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 14px -6px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 60px -16px rgba(0, 0, 0, .7), 0 2px 8px rgba(0, 0, 0, .4);
  --card-hi: rgba(255, 255, 255, .035);
  --nav-active: #1d222c;
  --tone-blue: #6b93ff; --tone-teal: #3fcf9e; --tone-violet: #a58bff; --tone-amber: #f0b45a; --tone-rose: #ff7d95;
  --warn: #e6a23c; --info: #6b93ff;
}

/* Depth: soft light falls from the top of the canvas instead of a flat fill */
body { text-rendering: optimizeLegibility; }
.frame { background:
  radial-gradient(900px 520px at 12% -8%, rgba(31, 79, 224, .10), transparent 60%),
  radial-gradient(700px 480px at 100% 110%, rgba(34, 179, 148, .06), transparent 60%), var(--page); }
:root[data-theme="dark"] .frame { background:
  radial-gradient(1000px 560px at 10% -10%, rgba(76, 125, 255, .13), transparent 60%),
  radial-gradient(800px 520px at 105% 110%, rgba(63, 207, 158, .06), transparent 60%), var(--page); }
.shell { grid-template-columns: 240px 1fr; background: var(--bg); border-color: var(--border); }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); }
.content { background: radial-gradient(1200px 420px at 70% -120px, rgba(76, 125, 255, .07), transparent 70%); }

/* Typography rhythm */
h1 { font-size: 30px; letter-spacing: -.012em; font-weight: 600; }
.page-head { margin-bottom: 22px; align-items: center; }
.page-head p.muted { margin-top: 4px; max-width: 680px; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 30px 0 12px; font-size: 15px; }
.crumb { gap: 8px; }
.crumb-sep { display: inline-flex; opacity: .55; }
.crumb .crumb-current { color: var(--soft-text); font-weight: 500; opacity: 1; }
.back { align-items: center; gap: 6px; font-weight: 500; }
.back:hover { color: var(--text); text-decoration: none; }

/* Focus: one visible ring for every interactive element (keyboard only) */
:where(a, button, [role="button"], [tabindex], summary, .chip, .seg-opt, .lang-opt):focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--ring); }
input, select, textarea { border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s; }
::selection { background: rgba(76, 125, 255, .28); }

/* Cards: hairline highlight on top gives depth without heavy shadows */
.panel, .card, .ad-card, .brand-card, .acc-card, .post-card, .kpi, .stat, .plan-card, .cap-card {
  box-shadow: inset 0 1px 0 var(--card-hi), var(--shadow); }
.panel, .card { border-radius: var(--radius); padding: 20px; }

/* Buttons: same height family, consistent gaps, smooth states */
.btn { min-height: 38px; padding: 0 15px; gap: 8px; border-radius: var(--radius-sm); font-weight: 550; letter-spacing: -.005em;
  transition: background .15s, border-color .15s, color .15s, opacity .15s, transform .1s; box-shadow: var(--shadow-sm); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.small { min-height: 32px; padding: 0 11px; font-size: 12.5px; gap: 6px; border-radius: var(--radius-xs); }
.btn.primary { box-shadow: 0 1px 0 rgba(255, 255, 255, .12) inset, 0 6px 16px -8px rgba(17, 18, 22, .5); }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); background: rgba(220, 59, 59, .06); }
.btn.danger-solid { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.btn.danger-solid:hover { background: #c53030; }
.btn:disabled { cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--soft-text); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
/* Square icon buttons (row actions): always with aria-label + data-tip */
.btn.icon { width: 32px; min-height: 32px; height: 32px; padding: 0; border-radius: var(--radius-xs); color: var(--soft-text); }
.btn.icon:hover { color: var(--text); }
.btn.icon.danger:hover { color: var(--danger); }
.ad-actions, .row-actions { gap: 6px; }

/* Tooltips: data-tip="…" (mouse + keyboard focus) */
[data-tip] { position: relative; }
[data-tip]::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translate(-50%, 4px);
  background: var(--ink); color: var(--on-ink); font: 500 11.5px/1.3 var(--font-sans); padding: 5px 8px; border-radius: 7px;
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s, transform .12s; z-index: 30; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }

/* ===== Sidebar ===== */
.nav-section { text-transform: uppercase; letter-spacing: .07em; font-size: 11.5px; font-weight: 600; margin: 16px 10px 6px; }
.nav-link { padding: 8px 10px; border-radius: 10px; transition: background .15s, color .15s; position: relative; }
.nav-link.active { background: var(--nav-active); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.nav-link.active .ico { color: var(--blue); }
.nav-link.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--blue); }
.workspace { border-radius: 12px; background: linear-gradient(180deg, var(--surface-2), transparent); transition: border-color .15s; }
.ws-icon { background: var(--blue-bg); color: var(--blue); }

/* ===== Top bar: every control is 38px tall and aligned ===== */
.top-actions { gap: 8px; }
.topbar .icon-btn { width: 38px; height: 38px; min-height: 38px; padding: 0; border-radius: 12px; color: var(--soft-text); background: var(--surface); }
.topbar .icon-btn:hover { color: var(--text); background: var(--surface-2); }
.topbar .btn.primary { height: 38px; border-radius: 12px; padding: 0 16px; }
.user-btn { height: 38px; border-radius: 999px; transition: border-color .15s, background .15s; }
.user-btn:hover { background: var(--surface-2); }
.gsearch { height: 38px; border-radius: 12px; }

/* Theme switch (sun | moon on one track, the thumb slides to the active side) */
.theme-toggle { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; width: 70px; height: 38px; padding: 3px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08); transition: border-color .2s, background .2s; }
.theme-toggle::before { content: ""; position: absolute; top: 3px; left: 3px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .18), inset 0 0 0 1px var(--border); transition: transform .35s var(--ease); }
:root[data-theme="dark"] .theme-toggle::before { transform: translateX(32px); }
.theme-toggle:hover { border-color: var(--muted); }
.theme-toggle:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.theme-toggle-ico { position: relative; z-index: 1; width: 30px; height: 30px; display: grid; place-items: center; color: var(--muted);
  transition: color .3s, transform .45s var(--ease), opacity .3s; }
.theme-toggle-ico + .theme-toggle-ico { margin-left: 2px; }
:root:not([data-theme="dark"]) .theme-toggle .sun { color: #c27a10; }
:root:not([data-theme="dark"]) .theme-toggle .moon { transform: rotate(-30deg) scale(.85); opacity: .7; }
:root[data-theme="dark"] .theme-toggle .moon { color: var(--tone-blue); }
:root[data-theme="dark"] .theme-toggle .sun { transform: rotate(90deg) scale(.85); opacity: .7; }
.theme-anim, .theme-anim * { transition: background-color .3s, border-color .3s, color .3s !important; }

/* ===== KPI cards (one system: dashboard, profiles, competitor, profile) ===== */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 0 0 18px; }
.kpi-card { --tone: var(--tone-blue); position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 6px; min-height: 118px;
  box-shadow: inset 0 1px 0 var(--card-hi), var(--shadow); }
.kpi-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--tone) 14%, transparent), transparent); pointer-events: none; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--tone);
  background: color-mix(in srgb, var(--tone) 12%, transparent); border: 1px solid color-mix(in srgb, var(--tone) 22%, transparent); }
.kpi-label { color: var(--muted); font-size: 12.5px; font-weight: 500; margin-top: 4px; }
.kpi-value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-foot { font-size: 12px; color: var(--muted); margin-top: auto; }
.kpi-card.teal { --tone: var(--tone-teal); } .kpi-card.violet { --tone: var(--tone-violet); }
.kpi-card.amber { --tone: var(--tone-amber); } .kpi-card.rose { --tone: var(--tone-rose); }
.kpi-card.hero { border: 0; color: #fff; background: linear-gradient(140deg, #1a43cf 0%, #2e63f3 55%, #5a86ff 100%); }
.kpi-card.hero .kpi-ico { color: #fff; background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .25); }
.kpi-card.hero .kpi-label, .kpi-card.hero .kpi-foot, .kpi-card.hero .muted, .kpi-card.hero .trend { color: rgba(255, 255, 255, .85); }
.kpi-card.hero::after { background: radial-gradient(closest-side, rgba(255, 255, 255, .16), transparent); width: 200px; height: 200px; right: -60px; top: auto; bottom: -80px; }
/* Dashboard .stat cards follow the same look */
.stat { border-radius: var(--radius); gap: 8px; min-height: 132px; }
.stat .stat-icon { width: 34px; height: 34px; color: var(--tone-blue); background: var(--blue-bg); border-color: transparent; }
.kpi-grid .stat:nth-child(2) .stat-icon { color: var(--tone-teal); background: color-mix(in srgb, var(--tone-teal) 12%, transparent); }
.kpi-grid .stat:nth-child(3) .stat-icon { color: var(--tone-violet); background: color-mix(in srgb, var(--tone-violet) 12%, transparent); }
.kpi-grid .stat:nth-child(4) .stat-icon { color: var(--tone-amber); background: color-mix(in srgb, var(--tone-amber) 12%, transparent); }
.kpi-grid .stat:nth-child(5) .stat-icon { color: var(--tone-rose); background: color-mix(in srgb, var(--tone-rose) 12%, transparent); }
.stat .stat-label { color: var(--muted); font-size: 12.5px; }
.stat .stat-value { font-size: 28px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat.hero { background: linear-gradient(140deg, #1a43cf 0%, #2e63f3 55%, #5a86ff 100%); }
.stat.hero .stat-icon { color: #fff; background: rgba(255, 255, 255, .14); }
.kpi strong { font-variant-numeric: tabular-nums; }

/* ===== Status chips ===== */
.status { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 550;
  border: 1px solid var(--border); color: var(--soft-text); background: var(--surface-2); white-space: nowrap; width: fit-content; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.status.busy { color: var(--blue); background: var(--blue-bg); border-color: transparent; }
.status.busy::before { animation: pulse 1.2s infinite ease-in-out; }
.status.err { color: var(--warn); background: rgba(212, 138, 26, .12); border-color: transparent; }
.status.off { color: var(--muted); }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }
.dot.live { width: 7px; height: 7px; background: #18a058; box-shadow: 0 0 0 3px rgba(24, 160, 88, .2); }

/* ===== Toasts (App.toast) ===== */
.toast-stack { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 10px;
  width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { --tc: var(--info); pointer-events: auto; position: relative; overflow: hidden; display: grid; grid-template-columns: auto 1fr auto; gap: 12px;
  align-items: start; padding: 13px 12px 15px 14px; border-radius: 14px; background: var(--surface); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--tc) 32%, var(--border-strong)); box-shadow: var(--shadow-lg); animation: toast-in .32s var(--ease) both;
  background-image: linear-gradient(color-mix(in srgb, var(--tc) 6%, transparent), color-mix(in srgb, var(--tc) 6%, transparent)); }
.toast.success { --tc: var(--ok-solid); } .toast.error { --tc: var(--danger-solid); } .toast.warn { --tc: var(--warn-solid); } .toast.info { --tc: var(--info); }
.toast-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--tc);
  background: color-mix(in srgb, var(--tc) 13%, transparent); }
.toast-text { min-width: 0; padding-top: 1px; }
.toast-title { display: block; font-size: 13px; font-weight: 650; letter-spacing: -.01em; }
.toast-msg { margin: 2px 0 0; font-size: 13px; color: var(--soft-text); overflow-wrap: anywhere; }
.toast-title[hidden] + .toast-msg { margin-top: 5px; color: var(--text); }
.toast-action { display: inline-flex; margin-top: 8px; font: 600 12.5px var(--font-sans); color: var(--blue); background: none; border: 0; padding: 0; cursor: pointer; }
.toast-close { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; }
.toast-close:hover { background: var(--surface-2); color: var(--text); }
.toast-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--tc); opacity: .55; transform-origin: left;
  animation: toast-progress var(--toast-ms, 4000ms) linear forwards; }
.toast.paused .toast-bar { animation-play-state: paused; }
.toast.leaving { animation: toast-out .22s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
@keyframes toast-progress { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ===== Skeletons (App.skeleton / App.withSkeleton) ===== */
.sk { display: block; background: linear-gradient(90deg, var(--surface-2) 0%, color-mix(in srgb, var(--border-strong) 70%, var(--surface-2)) 45%, var(--surface-2) 90%);
  background-size: 220% 100%; animation: shimmer 1.4s infinite ease-in-out; border-radius: 8px; }
.sk-line { height: 11px; margin: 9px 0; width: 100%; }
.sk-line.short { width: 45%; } .sk-line.mid { width: 70%; }
.sk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.sk-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px 14px; }
.sk-media { aspect-ratio: 4 / 3; border-radius: 10px; margin-bottom: 12px; }
.sk-foot { display: flex; gap: 8px; margin-top: 12px; }
.sk-pill { height: 26px; width: 74px; border-radius: 999px; flex-shrink: 0; }
.sk-pill.wide { width: 120px; }
.sk-rows { display: flex; flex-direction: column; gap: 10px; }
.sk-row { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.sk-row-text { flex: 1; }
.sk-avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.sk-avatar.sq { border-radius: 10px; width: 32px; height: 32px; }
.sk-icon { width: 34px; height: 34px; border-radius: 10px; }
.sk-num { height: 26px; width: 55%; margin-top: auto; border-radius: 8px; }
.sk-chart { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.sk-chart .sk { height: 240px; border-radius: 12px; }
.sk-table { display: flex; flex-direction: column; }
.sk-tr { display: grid; grid-template-columns: 2fr 1fr 1fr 1.4fr; gap: 18px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.sk-list { display: flex; flex-direction: column; gap: 4px; }
.sk-list .sk-line { height: 30px; margin: 0; border-radius: 9px; }
.sk-chat { display: flex; flex-direction: column; gap: 22px; padding-top: 8px; }
.sk-msg { display: flex; gap: 12px; }
.sk-msg.user { justify-content: flex-end; }
.sk-bubble-user { width: 46%; height: 42px; border-radius: 16px 16px 4px 16px; }
.sk-bubble { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 4px 16px 16px 16px; padding: 10px 16px; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }

/* ===== Empty states ===== */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 44px 20px; color: var(--muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 55%, transparent); grid-column: 1 / -1; }
.empty-state p { margin: 0; max-width: 460px; }
.empty-ico { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; color: var(--blue);
  background: var(--blue-bg); box-shadow: 0 0 0 8px color-mix(in srgb, var(--blue-bg) 45%, transparent); margin-bottom: 4px; }
.empty-state .ico { opacity: 1; }

/* ===== Modal + confirm ===== */
.modal { background: rgba(5, 6, 10, .55); backdrop-filter: blur(6px); animation: fade-in .18s ease both; }
.modal-box { border: 1px solid var(--border); border-radius: 20px; padding: 28px; animation: pop-in .22s var(--ease) both; }
.modal-close { top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-title { display: flex; align-items: center; gap: 10px; padding-right: 40px; }
.modal-actions { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.confirm-modal { z-index: 95; }
.confirm-box { width: min(420px, 100%); text-align: left; }
.confirm-box h2 { margin-top: 14px; }
.confirm-box p { margin: 6px 0 0; }
.confirm-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--blue); background: var(--blue-bg); }
.confirm-ico.danger { color: var(--danger); background: rgba(220, 59, 59, .12); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.file-it { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.file-it select { width: auto; min-width: 180px; }
.ext-link { display: inline-flex; align-items: center; gap: 6px; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ===== Legal footer ===== */
.legal-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 28px 16px 4px; margin-top: 24px; letter-spacing: .01em; }

/* ===== Monitor pages: add bar ===== */
.add-bar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px;
  box-shadow: inset 0 1px 0 var(--card-hi), var(--shadow); }
.add-bar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.add-bar-head h2 { font-size: 15px; display: flex; align-items: center; gap: 8px; margin: 0; }
.add-bar .discover { margin: 0; box-shadow: none; background: var(--bg); }
.add-bar .cost-note { margin: 10px 0 0; }
.discover { border-radius: 14px; padding: 6px 6px 6px 14px; gap: 10px; }

/* ===== Monitor table (profiles, competitors) ===== */
.mon-head, .mon-row { display: grid; grid-template-columns: minmax(220px, 2.2fr) 130px 160px 150px 110px auto; gap: 14px; align-items: center; }
.mon-head { padding: 0 16px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.mon-list { display: flex; flex-direction: column; gap: 8px; }
.mon-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px;
  box-shadow: inset 0 1px 0 var(--card-hi), var(--shadow-sm); transition: border-color .15s; }
.mon-row:hover { border-color: var(--border-strong); }
.mon-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mon-who > div { min-width: 0; }
.mon-who strong { display: flex; align-items: center; gap: 6px; }
.mon-who a { color: inherit; }
.mon-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mon-next, .mon-cost { font-size: 12.5px; color: var(--soft-text); display: flex; align-items: center; gap: 6px; }
.mon-cost .ico, .mon-next .ico { color: var(--muted); }
.mon-row .freq-select { width: 100%; height: 34px; }
.mon-row .row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.mon-cell-label { display: none; }
.acc-avatar { width: 40px; height: 40px; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border); }
.mon-row.is-loading { opacity: 1; }
@media (max-width: 1100px) {
  .mon-head { display: none; }
  .mon-row { grid-template-columns: 1fr 1fr; }
  .mon-who { grid-column: 1 / -1; }
  .mon-row .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .mon-cell-label { display: block; font-size: 11px; color: var(--muted); }
}

/* ===== Explore post stats / chat scenes ===== */
.post-stats { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.post-stats span { display: inline-flex; align-items: center; gap: 5px; }
.scene-line { display: flex; gap: 8px; align-items: flex-start; }
.scene-line .ico { margin-top: 3px; color: var(--muted); }

/* ===== Library ===== */
.lib { display: grid; grid-template-columns: 264px 1fr; gap: 18px; align-items: start; }
.lib-side { position: sticky; top: 18px; display: flex; flex-direction: column; gap: 14px; padding: 14px; }
.lib-side h3 { margin: 4px 6px 0; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.folder-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.folder-item { display: flex; align-items: center; gap: 10px; padding: 0 6px 0 10px; height: 38px; border-radius: 10px; cursor: pointer;
  color: var(--soft-text); border: 1px solid transparent; transition: background .12s, border-color .12s, transform .12s; }
.folder-item:hover { background: var(--surface-2); color: var(--text); }
.folder-item.active { background: var(--nav-active); color: var(--text); border-color: var(--border); }
.folder-item.active > .ico { color: var(--blue); }
.folder-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.folder-item .count { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 18px; text-align: right; }
.folder-item .folder-actions { display: none; gap: 2px; }
.folder-item:hover .folder-actions, .folder-item:focus-within .folder-actions { display: inline-flex; }
.folder-item:hover .count, .folder-item:focus-within .count { display: none; }
.folder-item .btn.icon { width: 26px; height: 26px; min-height: 26px; border: 0; background: none; box-shadow: none; }
.folder-item .btn.icon:hover { background: var(--surface); }
.folder-item.drop-target { border: 1px dashed var(--blue); background: var(--blue-bg); color: var(--text); transform: scale(1.02); }
.folder-item.drop-target .count, .folder-item.drop-target .folder-actions { display: none; }
.folder-form { display: flex; gap: 6px; }
.folder-form input { height: 36px; }
.folder-form .btn { min-height: 36px; height: 36px; width: 36px; padding: 0; flex-shrink: 0; }
.folder-rename { height: 30px; padding: 4px 8px; font-size: 13px; }
.lib-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.lib-tools .search-box { flex: 1; min-width: 220px; position: relative; }
.lib-tools .search-box .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.lib-tools .search-box input { padding-left: 36px; height: 38px; }
.lib-hint { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin: 0 0 14px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.lib-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: inset 0 1px 0 var(--card-hi), var(--shadow); transition: transform .15s, box-shadow .15s, border-color .15s, opacity .15s; }
.lib-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.lib-card[draggable="true"] { cursor: grab; }
.lib-card.dragging { opacity: .45; transform: scale(.98); }
.lib-card.drop-before::before, .lib-card.drop-after::before { content: ""; position: absolute; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--blue); }
.lib-card.drop-before::before { left: -9px; } .lib-card.drop-after::before { right: -9px; }
.lib-card-head { display: flex; align-items: flex-start; gap: 8px; }
.lib-card-head strong { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.grip { color: var(--muted); cursor: grab; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; margin: -1px -4px 0 -6px; flex-shrink: 0; }
.grip:hover { background: var(--surface-2); color: var(--text); }
.lib-card .ad-copy { -webkit-line-clamp: 3; font-size: 12.5px; }
.lib-note { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 6px 8px; }
.lib-note .ico { margin-top: 2px; }
.lib-card .ad-actions { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); justify-content: space-between; align-items: center; }
.lib-card .ad-actions .group { display: flex; gap: 6px; }
.lib-folder-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.move-menu { position: fixed; z-index: 60; min-width: 220px; max-height: 320px; overflow: auto; }
body.is-dragging .folder-item:not(.drop-target) { border-style: dashed; border-color: var(--border-strong); }
@media (max-width: 900px) {
  .lib { grid-template-columns: 1fr; }
  .lib-side { position: static; }
}

/* ===== Small screens ===== */
@media (max-width: 700px) {
  .toast-stack { top: auto; bottom: 12px; right: 12px; left: 12px; width: auto; }
  .page-head { align-items: flex-start; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-card { min-height: 104px; padding: 14px; }
  .kpi-value { font-size: 22px; }
  .top-actions { gap: 6px; }
  .theme-toggle { width: 66px; }
  .add-bar .discover { flex-wrap: wrap; }
  .add-bar .discover .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .toast, .toast.leaving, .modal, .modal-box { animation: none; }
  .toast-bar { display: none; }
  .theme-toggle::before, .theme-toggle-ico { transition: none; }
  .status.busy::before { animation: none; }
}

/* Helpers for skeleton containers + screen-reader-only text */
.skeleton { grid-column: 1 / -1; display: block; width: 100%; }
.sk-page { display: flex; flex-direction: column; gap: 12px; }
.sk-page .kpi-row { margin: 8px 0 4px; }
.sk-title { height: 26px; width: 260px; max-width: 70%; border-radius: 8px; }
.sk-gap { height: 4px; }
td > .skeleton { padding: 4px 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.kpi-grid > .skeleton .kpi-row { grid-template-columns: 1.15fr repeat(4, 1fr); margin: 0; }
@media (max-width: 1200px) { .kpi-grid > .skeleton .kpi-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .kpi-grid > .skeleton .kpi-row { grid-template-columns: 1fr 1fr; } }

/* Mobile shell (must come after the v0.5 layer, which widens the sidebar column) */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; }
  .nav-link.active::before { display: none; }
  .content { background: none; }
}
@media (max-width: 700px) {
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  .gsearch { flex: 1 1 100%; order: -1; }
  .banner { flex-wrap: wrap; }
}

/* a-account.css */
/* Workstream A: sign-up verification, settings, avatar, My Brand integrations + logo, focused map */

/* ---------- Sign-up verification (auth modal) ---------- */
.av-email-row { display: flex; gap: 8px; align-items: center; margin-top: -6px; }
.av-email-row input { flex: 1; min-width: 0; }
.av-verify-btn { flex-shrink: 0; animation: av-in .18s ease; }
.av-verified { flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ok); background: var(--ok-bg); padding: 5px 10px; border-radius: 999px; }
.av-code { border: 1px solid var(--border); background: var(--surface-2); border-radius: 14px; padding: 12px; animation: av-in .2s ease; }
.av-code p { margin: 0 0 10px; }
.av-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.av-box { text-align: center; font: 700 20px/1 SFMono-Regular, Consolas, monospace; padding: 10px 0; border-radius: 10px; }
.av-boxes.shake { animation: av-shake .35s; }
.av-code-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; min-height: 18px; }
.av-code-foot .error { color: var(--danger); }
.av-pass-label { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.av-lock { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; }
.av-signup-locked .av-pass input { opacity: .55; cursor: not-allowed; }
.av-forgot { align-self: flex-end; margin-top: -6px; }
#auth-reset { text-align: left; margin-top: 10px; }
@keyframes av-in { from { opacity: 0; transform: translateY(-3px); } }
@keyframes av-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- Avatar image in the top bar ---------- */
.avatar.has-img { background: var(--surface-2); padding: 0; overflow: hidden; }
.avatar .avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

/* ---------- Skeletons ---------- */
.st-skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: st-shimmer 1.3s ease infinite; border-radius: 8px; height: 14px; }
.st-skel.line { height: 34px; }
.st-skel.w60 { width: 60%; margin: 0 auto; height: 14px; }
.st-skel.w40 { width: 40%; margin: 0 auto; height: 12px; }
.st-skel.circle { width: 96px; height: 96px; border-radius: 50%; margin: 0 auto; }
@keyframes st-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Settings ---------- */
.st-grid { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.st-grid h3 { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; font-size: 15px; }
.st-avatar-card { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.st-avatar { width: 104px; height: 104px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: linear-gradient(135deg, var(--blue), var(--teal)); color: #fff; font-size: 38px; font-weight: 600; position: relative; }
.st-avatar img { width: 100%; height: 100%; object-fit: cover; }
.st-avatar.loading::after, .bl-drop.loading::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .35); animation: st-pulse 1s infinite alternate; }
@keyframes st-pulse { to { opacity: .4; } }
.st-avatar-actions { display: flex; gap: 8px; }
.st-avatar-actions label.btn { flex-direction: row; color: var(--text); font-size: 12px; }
.st-note { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.st-label { display: block; font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.st-seg { max-width: 420px; margin-top: 0; }
.st-seg .seg-opt { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
input[disabled][readonly] { opacity: .7; cursor: not-allowed; }
.st-guide-ico { vertical-align: -2px; }
:root[data-theme="dark"] .st-guide-ico { filter: invert(1); }
@media (max-width: 900px) { .st-grid { grid-template-columns: 1fr; } }

/* ---------- My Brand: integrations ---------- */
.int-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-top: 10px; }
.int-card { border: 1px solid var(--border); border-radius: 14px; padding: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.int-card.soon { opacity: .6; background: var(--surface-2); }
.int-head { display: flex; align-items: center; gap: 10px; }
.int-head strong { display: block; font-size: 13px; }
.int-head .small { display: block; line-height: 1.3; }
.int-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text); flex-shrink: 0; }
.int-ico.ig { background: linear-gradient(135deg, #f58529, #dd2a7b 55%, #8134af); color: #fff; }
.int-ico.fb { background: #1877f2; color: #fff; }
.int-body { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.int-body .badge { margin: 0; }
.int-body p { margin: 0; }

/* ---------- My Brand: logo upload (checkerboard shows transparency) ---------- */
.bl-row { display: flex; gap: 14px; align-items: center; }
.bl-side { flex: 1; gap: 6px; }
.bl-side p { margin: 0; }
.bl-side label.btn { flex-direction: row; color: var(--text); font-size: 12px; }
.bl-drop { position: relative; width: 112px; height: 112px; flex-shrink: 0; border-radius: 14px; border: 1px dashed var(--border-strong); display: grid; place-items: center; cursor: pointer; overflow: hidden; color: var(--muted);
  background-color: var(--surface); background-image: linear-gradient(45deg, var(--surface-2) 25%, transparent 25%), linear-gradient(-45deg, var(--surface-2) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--surface-2) 75%), linear-gradient(-45deg, transparent 75%, var(--surface-2) 75%);
  background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }
.bl-drop.over, .bl-drop:focus-visible { border-color: var(--blue); outline: none; }
.bl-drop img { max-width: 88%; max-height: 88%; object-fit: contain; }

/* ---------- Dashboard map toggle ---------- */
.map-toggle { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); margin-left: auto; }
.map-toggle button { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; color: var(--muted); font: 600 12px var(--font-sans); padding: 5px 9px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.map-toggle button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.card-head:has(.map-toggle) { align-items: center; flex-wrap: wrap; }

/* c-billing.css */
/* Workstream C: billing (usage meters, plans), team (users page), referral widget, shared dialogs. */

/* ---------- Usage meters ---------- */
.c-usage { margin-bottom: 22px; }
.c-usage .section-title, .c-plans .section-title { display: flex; align-items: center; gap: 8px; }
.c-meters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.c-meters.n4 { grid-template-columns: repeat(4, 1fr); }
.c-meter { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.c-meter p { margin: 0; }
.c-meter-head { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 500; }
.c-meter-ico { width: 28px; height: 28px; border-radius: 9px; background: var(--blue-bg); color: var(--blue); display: grid; place-items: center; flex: none; }
.c-meter-value { font-size: 28px; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.c-meter-value small { font-size: 15px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.c-balance.is-low { border-color: rgba(194, 122, 16, .45); }
.c-balance.is-low .c-meter-ico { background: rgba(194, 122, 16, .14); color: var(--warn); }
.c-reset { display: flex; align-items: center; gap: 6px; color: var(--soft-text); }
.c-hint { display: flex; align-items: center; gap: 6px; margin: 10px 2px 0; }
.c-sk-big { height: 28px; width: 45%; margin: 6px 0; }

.c-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.c-bar > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--blue), var(--blue-2, var(--blue))); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.c-bar.warn > div { background: var(--warn); }
.c-bar.danger > div { background: var(--danger); }
.c-bar.fair > div { background: linear-gradient(90deg, var(--teal), var(--blue)); opacity: .75; }

.c-team-usage { margin-top: 14px; }
.c-team-usage h3 { display: flex; align-items: center; gap: 8px; margin: 0; }
.c-team-usage table { margin-top: 10px; }

/* ---------- Plans ---------- */
.c-plans { margin-bottom: 22px; }
.c-section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 10px; }
.c-section-head p { margin: 2px 0 0; }
.c-plan { transition: transform .15s, box-shadow .15s; }
.c-plan:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.c-plan.c-current { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal), var(--shadow); opacity: 1; }
.c-ribbon-current { background: var(--teal); }
.c-feats { list-style: none; padding: 0; margin: 6px 0 12px; display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.c-feats li { display: flex; gap: 8px; align-items: flex-start; }
.c-feats li .ico { flex: none; margin-top: 2px; color: var(--ok); }
.c-feats li .muted + .ico, .c-feats li:has(.muted) .ico { color: var(--muted); }

/* ---------- History ---------- */
.c-history { margin-bottom: 14px; }
.c-history h3 { display: flex; align-items: center; gap: 8px; }
.c-amount { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.c-amount.pos { color: var(--ok); }
.c-amount.neg { color: var(--danger); }

/* ---------- Invite & earn ---------- */
.c-ref-wrap { margin-top: 18px; }
.c-ref { display: flex; flex-direction: column; gap: 14px; }
.c-ref h3, .c-ref h4 { margin: 0; }
.c-ref-head { display: flex; gap: 12px; align-items: center; }
.c-ref-head p { margin: 2px 0 0; }
.c-ref-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--blue); background: var(--blue-bg); flex: none; }
.c-ref-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
.c-ref-link { display: flex; gap: 8px; margin: 6px 0 12px; }
.c-ref-link input { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 13px; }
.c-ref-link .btn { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.c-ref-progress { display: flex; flex-direction: column; gap: 6px; }
.c-ref-progress p { margin: 0 0 6px; }
.c-ref-rules { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.c-ref-rules li { display: flex; gap: 10px; align-items: flex-start; }
.c-ref-rules li .ico { flex: none; color: var(--blue); margin-top: 1px; }
.c-ref-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.c-ref-stat { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); }
.c-ref-stat span { display: block; color: var(--muted); font-size: 12px; }
.c-ref-stat strong { font-size: 20px; letter-spacing: -.02em; }

/* ---------- Dialogs ---------- */
.c-dialog { display: flex; flex-direction: column; gap: 10px; }
.c-dialog h2 { margin: 4px 0 0; }
.c-dialog-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--blue-bg); color: var(--blue); flex: none; }
.c-dialog-ico.danger { background: rgba(220, 59, 59, .12); color: var(--danger); }
.c-fb-head { display: flex; gap: 12px; align-items: center; }
.c-fb-head h2 { margin: 0; }
.c-fb-head p { margin: 2px 0 0; }
.btn.danger, .btn.icon-btn.danger:hover { color: var(--danger); }
.danger-btn { background: var(--danger); color: #fff; border-color: transparent; }
.danger-btn:hover { filter: brightness(1.05); }

/* ---------- Users (team) ---------- */
.c-seats { margin-bottom: 18px; display: flex; flex-direction: column; gap: 10px; }
.c-seats-num { display: block; font-size: 26px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.c-seats-num small { font-size: 15px; color: var(--muted); }
.c-seats .notice { justify-content: space-between; }
.c-team-block { margin-bottom: 18px; }
.c-team-block .section-title { display: flex; align-items: center; gap: 8px; }
.c-member-list { display: flex; flex-direction: column; gap: 10px; }
.c-member { display: grid; grid-template-columns: auto 1fr 200px auto; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.c-member.sk-card { grid-template-columns: auto 1fr; }
.c-member-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.c-member-main > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-member .chips { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; }
.c-perm { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; }
.c-perm.pub { color: var(--ok); }
.c-member-usage { display: flex; flex-direction: column; gap: 4px; }
.c-mini-meter { display: flex; flex-direction: column; gap: 4px; }
.c-actions { display: flex; gap: 6px; }
.c-avatar-ghost { background: var(--surface-2); color: var(--muted); display: grid; place-items: center; }
.c-empty { padding: 26px 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.c-perm-grid { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; margin: 0; }
.c-perm-grid legend { padding: 0 6px; }
.c-perm-grid .switch .ico { color: var(--muted); }
.c-perm-pub { grid-column: 1 / -1; border-top: 1px solid var(--border); padding-top: 10px; }
.c-member-form label > .muted { display: block; margin-top: 4px; }

/* Members: locked areas */
.c-no-link { cursor: default; }
.c-locked { max-width: 440px; margin: 60px auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.c-locked h2 { margin: 6px 0 0; color: var(--text); }

@media (max-width: 1100px) {
  .c-meters.n4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .c-meters, .c-meters.n4 { grid-template-columns: 1fr 1fr; }
  .c-ref-grid { grid-template-columns: 1fr; }
  .c-ref-stats { grid-template-columns: repeat(2, 1fr); }
  .c-member { grid-template-columns: auto 1fr auto; }
  .c-member-usage { grid-column: 2 / -1; grid-row: 2; }
}
@media (max-width: 600px) {
  .c-meters, .c-meters.n4 { grid-template-columns: 1fr; }
  .c-perm-grid { grid-template-columns: 1fr; }
  .c-ref-link { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { .c-bar > div, .c-plan { transition: none; } }

/* c-feedback.css */
/* Workstream C: suggestions modal and NPS card. */
.c-fb-cats { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.c-fb-cats legend { margin-bottom: 6px; }
.c-fb-cat { position: relative; cursor: pointer; }
.c-fb-cat input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.c-fb-cat span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--soft-text); font-size: 13px; transition: border-color .15s, background .15s; }
.c-fb-cat input:checked + span { border-color: var(--blue); background: var(--blue-bg); color: var(--text); }
.c-fb-cat input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.c-fb textarea { resize: vertical; }

.c-nps { position: fixed; right: 20px; bottom: 20px; z-index: 60; width: min(420px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px 18px 14px; box-shadow: var(--shadow-lg);
  transform: translateY(16px); opacity: 0; transition: transform .25s ease, opacity .25s ease; }
.c-nps.open { transform: none; opacity: 1; }
.c-nps-q { margin: 0 26px 12px 0; font-weight: 600; line-height: 1.35; }
.c-nps-close { position: absolute; top: 10px; right: 10px; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 8px; }
.c-nps-close:hover { background: var(--surface-2); color: var(--text); }
.c-nps-scale { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; }
.c-nps-scale button { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 8px; padding: 7px 0; font: inherit; font-size: 13px; cursor: pointer; transition: background .12s, border-color .12s; }
.c-nps-scale button:hover { border-color: var(--blue); }
.c-nps-scale button.active { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.c-nps-legend { display: flex; justify-content: space-between; margin-top: 6px; }
.c-nps-more { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.c-nps-more[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .c-nps { transition: none; } }

/* c-help.css */
/* Workstream C: help center. */
.c-help-head { align-items: flex-end; }
.c-help-head h1 { display: flex; align-items: center; gap: 10px; }
.c-help-search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0 12px; min-width: min(360px, 100%); box-shadow: var(--shadow); color: var(--muted); }
.c-help-search input { border: 0; background: none; padding: 11px 0; flex: 1; outline: none; color: var(--text); font: inherit; box-shadow: none; }
.c-help-search:focus-within { border-color: var(--blue); }
.c-help { display: grid; grid-template-columns: 250px 1fr; gap: 18px; align-items: start; }
.c-help-nav { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px; }
.c-help-nav-title { padding: 0 10px 6px; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }
.c-help-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--soft-text); text-decoration: none; font-size: 14px; }
.c-help-nav a:hover { background: var(--surface); color: var(--text); }
.c-help-nav a.active { background: var(--ink); color: var(--on-ink); }
.c-help-article { min-height: 320px; line-height: 1.6; }
.c-help-article h2 { margin: 0; }
.c-help-article h3 { margin: 20px 0 6px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.c-help-article h4 { margin: 14px 0 4px; font-size: 14px; }
.c-help-article ul { padding-left: 20px; margin: 6px 0; }
.c-help-article li { margin: 4px 0; }
.c-help-article mark { background: rgba(240, 138, 60, .28); color: inherit; border-radius: 3px; padding: 0 1px; }
.c-help-art-head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.c-help-art-head p { margin: 2px 0 0; }
.c-help-tip { margin-top: 16px; align-items: flex-start; }
.c-help-tip .ico { flex: none; margin-top: 2px; }
.c-help-related { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--border); }
.c-help-related .chip { text-decoration: none; }
.c-help-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.c-help-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; text-decoration: none; color: var(--text); background: var(--surface); transition: border-color .15s, transform .15s; }
.c-help-card:hover { border-color: var(--blue); transform: translateY(-1px); }
.c-help-hit { padding: 14px 0; border-bottom: 1px solid var(--border); }
.c-help-hit a { text-decoration: none; color: var(--text); }
.c-help-hit h3 { margin-top: 0; }
.c-help-foot { display: flex; gap: 14px; align-items: center; margin-top: 18px; }
.c-help-foot p { margin: 2px 0 0; }
@media (max-width: 860px) {
  .c-help { grid-template-columns: 1fr; }
  .c-help-nav { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .c-help-nav-title { display: none; }
  .c-help-nav a { white-space: nowrap; border: 1px solid var(--border); }
  .c-help-foot { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .c-help-card { transition: none; } }

/* m-crm.css */
/* Sign-up e-mail opt-in (CRM consent). docs/product/crm.md */
#auth-modal-form[data-mode="login"] .crm-optin { display: none; }
#auth-modal-form label.crm-optin, .crm-optin { display: flex; flex-direction: row; align-items: flex-start; gap: 9px; font-size: 12.5px; line-height: 1.45; color: var(--muted); cursor: pointer; margin: 2px 0 4px; }
.crm-optin input { margin: 2px 0 0; width: 15px; height: 15px; flex: none; accent-color: var(--ink); }

/* onboarding.css */
/* Arsene guide (onboarding modal + resume pill) — workstream A */
.ob-overlay { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 18px; background: rgba(8, 9, 11, .55); backdrop-filter: blur(4px); animation: ob-fade .2s ease; }
.ob-card { width: min(520px, 100%); max-height: min(680px, 92vh); display: flex; flex-direction: column; background: #121418; color: #eceef3; border: 1px solid #262a32; border-radius: 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, .55); overflow: hidden; animation: ob-rise .28s cubic-bezier(.2, .8, .2, 1); }
.ob-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid #22262e; }
.ob-head strong { display: block; font-size: 15px; }
.ob-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #8d94a3; }
.ob-status i { width: 7px; height: 7px; border-radius: 50%; background: #3fcf8e; box-shadow: 0 0 0 3px rgba(63, 207, 142, .18); }
.ob-avatar { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(140deg, #1f2430, #0c0d10); border: 1px solid #323743; }
.ob-x { margin-left: auto; background: none; border: 0; color: #8d94a3; cursor: pointer; padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.ob-x:hover { color: #fff; background: #1e2128; }
.ob-steps { list-style: none; margin: 0; padding: 12px 18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; border-bottom: 1px solid #22262e; }
.ob-steps li { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 11px; color: #6f7686; text-align: center; }
.ob-steps li span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 1px solid #323743; background: #16181d; transition: all .2s; }
.ob-steps li em { font-style: normal; }
.ob-steps li.current { color: #eceef3; }
.ob-steps li.current span { border-color: #4c7dff; color: #fff; box-shadow: 0 0 0 4px rgba(76, 125, 255, .18); }
.ob-steps li.done { color: #c3c8d2; }
.ob-steps li.done span { background: #4c7dff; border-color: #4c7dff; color: #fff; }
.ob-chat { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; min-height: 180px; }
.ob-bubble { align-self: flex-start; max-width: 92%; background: #1c1f26; border: 1px solid #2a2e37; border-radius: 4px 16px 16px 16px; padding: 10px 14px; font-size: 14px; line-height: 1.55; color: #e3e6ec; animation: ob-pop .2s ease; }
.ob-dots { display: inline-flex; gap: 4px; padding: 3px 0; }
.ob-dots i { width: 6px; height: 6px; border-radius: 50%; background: #8d94a3; animation: ob-blink 1s infinite ease-in-out; }
.ob-dots i:nth-child(2) { animation-delay: .15s; }
.ob-dots i:nth-child(3) { animation-delay: .3s; }
.ob-check { list-style: none; margin: 2px 0 0; padding: 10px 14px; border: 1px dashed #323743; border-radius: 14px; display: grid; gap: 6px; font-size: 13px; color: #c3c8d2; }
.ob-check li { display: flex; align-items: center; gap: 8px; }
.ob-check li.ok { color: #3fcf8e; }
.ob-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 18px 18px; border-top: 1px solid #22262e; opacity: 0; transform: translateY(4px); transition: all .2s; }
.ob-actions.show { opacity: 1; transform: none; }
.ob-actions .btn { background: #1e2128; border-color: #323743; color: #eceef3; }
.ob-actions .btn.primary { background: #f1f2f4; border-color: #f1f2f4; color: #111216; }
.ob-actions .ob-skip { margin-left: auto; color: #8d94a3; }

.ob-pill { position: fixed; left: 18px; bottom: 18px; z-index: 45; display: inline-flex; align-items: center; gap: 9px; padding: 8px 14px 8px 10px; border-radius: 999px; border: 1px solid #323743; background: #121418; color: #eceef3; font: 600 13px var(--font-sans); cursor: pointer; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.ob-pill:hover { border-color: #4c7dff; }
.ob-pill-bar { width: 46px; height: 4px; border-radius: 4px; background: #2a2e37; overflow: hidden; }
.ob-pill-bar i { display: block; height: 100%; background: #4c7dff; border-radius: 4px; transition: width .3s; }

.ob-glow { position: relative; z-index: 2; outline: 2px solid var(--blue); outline-offset: 4px; border-radius: var(--radius); animation: ob-ring 1.6s ease-out 3; }
.ob-tip { position: fixed; right: 18px; bottom: 18px; z-index: 46; max-width: 340px; display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; border-radius: 16px; background: #121418; color: #e3e6ec; border: 1px solid #323743; box-shadow: 0 16px 40px rgba(0, 0, 0, .4); font-size: 13px; line-height: 1.5; animation: ob-rise .25s ease; }
.ob-tip button { background: none; border: 0; color: #8d94a3; cursor: pointer; padding: 2px; }

@keyframes ob-fade { from { opacity: 0; } }
@keyframes ob-rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes ob-pop { from { opacity: 0; transform: translateY(4px); } }
@keyframes ob-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes ob-ring { 0% { box-shadow: 0 0 0 0 rgba(76, 125, 255, .45); } 100% { box-shadow: 0 0 0 16px rgba(76, 125, 255, 0); } }
@media (prefers-reduced-motion: reduce) { .ob-overlay, .ob-card, .ob-bubble, .ob-tip, .ob-glow, .ob-dots i { animation: none !important; } }
@media (max-width: 560px) { .ob-steps li em { display: none; } .ob-pill { left: 12px; bottom: 12px; } }

/* studio.css */
/* ===== AI Studio: visual flow canvas (workstream B) ===== */
.bs-studio { --bs-accent: var(--blue); --bs-trigger: #c9a227; --bs-dot: var(--border-strong);
  display: flex; flex-direction: column; gap: 10px; height: calc(100vh - 128px); min-height: 560px; position: relative; }
.bs-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 8px 10px; box-shadow: var(--shadow); }
.bs-tb-left, .bs-tb-right { display: flex; align-items: center; gap: 8px; }
.bs-tb-right { margin-left: auto; }
.bs-switch-btn { gap: 8px; max-width: 220px; }
.bs-switch-btn span { overflow: hidden; text-overflow: ellipsis; }
.bs-switch-menu { min-width: 320px; max-height: 60vh; overflow-y: auto; }
.bs-flow-item { width: 100%; }
.bs-flow-item.active { background: var(--surface-2); }
.bs-flow-item strong { display: block; font-weight: 600; font-size: 13px; }
.bs-flow-item small { display: block; font-size: 11px; }
.bs-menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.bs-menu-empty { padding: 8px 10px; margin: 0; }
.bs-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); flex-shrink: 0; }
.bs-dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.bs-dot.paused { background: var(--warn); }
.bs-name { font: inherit; font-weight: 600; font-size: 15px; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; width: 240px; min-width: 120px; }
.bs-name:hover, .bs-name:focus { border-color: var(--border); background: var(--surface-2); outline: none; }
.bs-dirty { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.bs-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12px; color: var(--soft-text); user-select: none; }
.bs-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.bs-toggle-track { width: 34px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .2s; }
.bs-toggle-track span { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.bs-toggle input:checked + .bs-toggle-track { background: var(--ok); }
.bs-toggle input:checked + .bs-toggle-track span { transform: translateX(14px); }
.bs-toggle input:disabled + .bs-toggle-track { opacity: .45; }
.bs-toggle input:focus-visible + .bs-toggle-track { outline: 2px solid var(--bs-accent); outline-offset: 2px; }

.bs-gen { display: flex; align-items: center; gap: 6px; flex: 1 1 280px; min-width: 220px; max-width: 520px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px 4px 3px 10px; }
.bs-gen input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; outline: none; }
.bs-gen-ico { color: var(--bs-accent); display: inline-flex; }
.bs-studio.is-generating .bs-gen { background: linear-gradient(90deg, var(--surface-2) 25%, var(--blue-bg) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.bs-cost { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--blue-bg); color: var(--bs-accent); white-space: nowrap; }
.bs-cost.free { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.bs-queue-btn { position: relative; }
.bs-queue-count { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--bs-accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

.bs-notice { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: rgba(194, 122, 16, .12); border: 1px solid rgba(194, 122, 16, .35); color: var(--text); font-size: 13px; }
.bs-notice span { flex: 1; }

.bs-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px 1fr 300px; gap: 10px; }
.bs-palette, .bs-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px; overflow-y: auto; box-shadow: var(--shadow); }
.bs-pal-head { display: flex; flex-direction: column; font-weight: 600; margin-bottom: 6px; }
.bs-pal-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 12px 2px 6px; font-weight: 600; }
.bs-pal-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; cursor: grab; background: var(--surface); user-select: none; touch-action: none; transition: border-color .15s, transform .15s; }
.bs-pal-item:hover, .bs-pal-item:focus-visible { border-color: var(--bs-accent); outline: none; transform: translateX(2px); }
.bs-pal-item:active { cursor: grabbing; }
.bs-pal-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--blue-bg); color: var(--bs-accent); flex-shrink: 0; }
.bs-pal-item.is-trigger .bs-pal-ico { background: rgba(201, 162, 39, .15); color: var(--bs-trigger); }
.bs-pal-name { flex: 1; font-size: 12.5px; line-height: 1.25; }
.bs-pal-tpls { display: flex; flex-direction: column; gap: 6px; }
.bs-tpl { display: flex; align-items: center; gap: 8px; text-align: left; font: inherit; font-size: 12px; color: var(--soft-text); background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 10px; padding: 7px 9px; cursor: pointer; }
.bs-tpl:hover { border-color: var(--bs-accent); color: var(--text); }
.bs-ghost { position: fixed; left: 0; top: 0; z-index: 80; pointer-events: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--bs-accent); box-shadow: var(--shadow-lg); font-size: 12.5px; color: var(--text); }

/* Canvas */
.bs-canvas { position: relative; overflow: hidden; border-radius: 14px; border: 1px solid var(--border); background-color: var(--bg);
  background-image: radial-gradient(circle, var(--bs-dot) 1.1px, transparent 1.3px); background-size: 22px 22px; cursor: grab; touch-action: none; outline: none; user-select: none; }
.bs-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--blue-bg); }
.bs-canvas.is-panning { cursor: grabbing; }
.bs-canvas.is-drop { box-shadow: inset 0 0 0 2px var(--bs-accent); }
.bs-canvas.is-connecting { cursor: crosshair; }
.bs-viewport { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.bs-edges { position: absolute; left: 0; top: 0; overflow: visible; }
.bs-edge { fill: none; stroke: var(--border-strong); stroke-width: 2.2; pointer-events: none; transition: stroke .2s; }
.bs-edge.sel { stroke: var(--bs-accent); stroke-width: 2.8; }
.bs-edge.temp { stroke: var(--bs-accent); stroke-dasharray: 6 5; }
.bs-edge.is-flowing { stroke: var(--ok); stroke-dasharray: 8 6; animation: bs-flow 0.9s linear infinite; }
.bs-edge-hit { fill: none; stroke: transparent; stroke-width: 16; cursor: pointer; pointer-events: stroke; }
.bs-edge-hit:hover + .bs-edge { stroke: var(--bs-accent); }
.bs-arrow { fill: var(--border-strong); }
@keyframes bs-flow { to { stroke-dashoffset: -28; } }
.bs-edge-del { position: absolute; transform: translate(-50%, -50%); width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--danger); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow-lg); z-index: 3; }

.bs-node { position: absolute; width: 232px; height: 78px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border: 1.5px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); cursor: pointer; transition: border-color .15s, box-shadow .2s; z-index: 1; }
.bs-node:hover { border-color: var(--border-strong); }
.bs-node.sel { border-color: var(--bs-accent); box-shadow: 0 0 0 4px var(--blue-bg), var(--shadow-lg); z-index: 2; }
.bs-node.is-dragging { cursor: grabbing; box-shadow: var(--shadow-lg); z-index: 4; }
.bs-node.is-trigger { border-color: color-mix(in srgb, var(--bs-trigger) 55%, var(--border)); background: color-mix(in srgb, var(--bs-trigger) 6%, var(--surface)); }
.bs-node.is-loose { opacity: .62; border-style: dashed; }
.bs-node.is-trigger.sel { border-color: var(--bs-accent); background: var(--surface); }
.bs-node.is-target { border-color: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); }
.bs-node-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--blue-bg); color: var(--bs-accent); flex-shrink: 0; }
.bs-node.is-trigger .bs-node-ico, .bs-panel .bs-node-ico.trigger { background: rgba(201, 162, 39, .15); color: var(--bs-trigger); }
.bs-node-ico.big { width: 40px; height: 40px; }
.bs-node-main { flex: 1; min-width: 0; }
.bs-node-kind { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.bs-node-title { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bs-node-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bs-node-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; align-self: stretch; justify-content: space-between; }
.bs-node-del { border: 0; background: transparent; color: var(--muted); width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .15s; }
.bs-node:hover .bs-node-del, .bs-node.sel .bs-node-del { opacity: 1; }
.bs-node-del:hover { color: var(--danger); background: var(--surface-2); }
.bs-port { position: absolute; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); z-index: 3; transition: transform .15s, border-color .15s; }
.bs-port.in { left: -8px; }
.bs-port.out { right: -8px; cursor: crosshair; }
.bs-port.out::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; }   /* bigger hit area (touch) */
.bs-port:hover, .bs-node.is-target .bs-port.in { border-color: var(--bs-accent); transform: scale(1.25); background: var(--blue-bg); }

/* Live run status */
.bs-node-status { position: absolute; left: 12px; bottom: -11px; display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--soft-text); box-shadow: var(--shadow); }
.bs-node-cr { color: var(--muted); font-weight: 500; }
.bs-node-status.st-running { color: var(--bs-accent); border-color: var(--bs-accent); }
.bs-node-status.st-done { color: var(--ok); border-color: var(--ok); }
.bs-node-status.st-error { color: var(--danger); border-color: var(--danger); }
.bs-node-status.st-skipped { color: var(--muted); }
.bs-node.st-running { border-color: var(--bs-accent); animation: bs-pulse 1.4s ease-in-out infinite; }
.bs-node.st-done { border-color: var(--ok); }
.bs-node.st-error { border-color: var(--danger); }
.bs-node.st-skipped { opacity: .7; }
@keyframes bs-pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--blue-bg); } 50% { box-shadow: 0 0 0 7px var(--blue-bg); } }
.bs-spin { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--blue-bg); border-top-color: var(--bs-accent); animation: bs-rot .8s linear infinite; }
@keyframes bs-rot { to { transform: rotate(360deg); } }
.bs-st-badge { display: inline-flex; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--soft-text); border: 1px solid var(--border); white-space: nowrap; }
.bs-st-badge.st-done { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.bs-st-badge.st-running, .bs-st-badge.st-queued, .bs-st-badge.st-pending { color: var(--bs-accent); background: var(--blue-bg); border-color: transparent; }
.bs-st-badge.st-error, .bs-st-badge.st-failed { color: var(--danger); background: rgba(220, 59, 59, .1); border-color: transparent; }
.bs-st-badge.st-partial { color: var(--warn); background: rgba(194, 122, 16, .12); border-color: transparent; }

.bs-zoom { position: absolute; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px; box-shadow: var(--shadow); z-index: 5; }
.bs-zoom .icon-btn { width: 30px; height: 30px; border-radius: 8px; box-shadow: none; border-color: transparent; }
.bs-zoom-val { font-size: 11px; color: var(--muted); min-width: 38px; text-align: center; font-variant-numeric: tabular-nums; }
.bs-validate { position: absolute; left: 12px; bottom: 12px; z-index: 5; max-width: min(420px, 70%); }
.bs-val { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 7px 11px; font-size: 12px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 6px; }
details.bs-val { display: block; }
.bs-val summary { cursor: pointer; display: flex; align-items: center; gap: 6px; list-style: none; font-weight: 600; }
.bs-val summary::-webkit-details-marker { display: none; }
.bs-val.ok { color: var(--ok); }
.bs-val.has-errors summary { color: var(--danger); }
.bs-val.has-warn summary { color: var(--warn); }
.bs-val ul { margin: 6px 0 2px; padding-left: 18px; color: var(--soft-text); }
.bs-val li[data-focus] { cursor: pointer; text-decoration: underline dotted; }
.bs-val li.error { color: var(--danger); }
.bs-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 20px; pointer-events: none; color: var(--muted); }
.bs-empty strong { color: var(--text); font-size: 16px; }
.bs-empty-tpls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; pointer-events: auto; max-width: 640px; }
.bs-canvas-skel { position: absolute; inset: 0; }
.bs-sk-node { position: absolute; width: 200px; height: 70px; border-radius: 14px; }
.bs-sk-block { height: 40px; margin: 8px 0; border-radius: 10px; }
.bs-sk-area { height: 90px; margin: 12px 0; border-radius: 10px; }
.bs-studio[data-loading="1"] .bs-zoom, .bs-studio[data-loading="1"] .bs-toolbar > * { opacity: .5; pointer-events: none; }

/* Side panel */
.bs-panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bs-panel-head strong { font-size: 14px; }
.bs-field { display: flex; flex-direction: column; gap: 5px; margin: 12px 0; font-size: 12px; color: var(--soft-text); font-weight: 500; }
.bs-field select, .bs-field textarea, .bs-runbox textarea { font: inherit; font-size: 13px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; resize: vertical; width: 100%; }
.bs-field select:focus, .bs-field textarea:focus, .bs-runbox textarea:focus { outline: none; border-color: var(--bs-accent); }
.bs-warn { font-size: 12px; color: var(--warn); display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; margin: 8px 0; }
.bs-panel-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.bs-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.bs-stats div { background: var(--surface-2); border-radius: 10px; padding: 8px; text-align: center; }
.bs-stats strong { display: block; font-size: 16px; }
.bs-stats span { font-size: 11px; color: var(--muted); }
.bs-runbox { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.bs-runbox-head { display: flex; align-items: center; justify-content: space-between; }
.bs-hist { display: flex; flex-direction: column; gap: 6px; }
.bs-run-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; font: inherit; color: var(--text); background: transparent; border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px; cursor: pointer; margin-top: 6px; }
.bs-run-item:hover, .bs-run-item.active { border-color: var(--bs-accent); }
.bs-out { margin-top: 12px; padding: 10px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); }
.bs-out-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bs-pre { white-space: pre-wrap; font-size: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px; margin-top: 8px; max-height: 180px; overflow: auto; }
.bs-img-prev { position: relative; margin-top: 8px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.bs-img-prev img { display: block; width: 100%; height: auto; }
.bs-img-prev .bs-logo-over { position: absolute; top: 6%; right: 6%; width: 22%; height: auto; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .35)); }
.bs-kbd { margin-top: 14px; }

/* Queue drawer */
.bs-drawer { position: absolute; top: 58px; right: 0; bottom: 0; width: min(380px, 100%); z-index: 20; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 14px; display: flex; flex-direction: column; animation: bs-slide .2s ease-out; }
@keyframes bs-slide { from { transform: translateX(16px); opacity: 0; } }
.bs-drawer-head { display: flex; align-items: center; justify-content: space-between; }
.bs-drawer-head strong { display: inline-flex; align-items: center; gap: 8px; }
.bs-drawer-sub { margin: 6px 0 10px; }
.bs-jobs { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.bs-job { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border: 1px solid var(--border); border-radius: 10px; }
.bs-job strong { font-size: 12.5px; display: block; }
.bs-job small { display: block; font-size: 11px; }
.bs-job-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--soft-text); flex-shrink: 0; }
.bs-job-err { color: var(--danger); }
.bs-job-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }

@media (max-width: 1180px) {
  .bs-body { grid-template-columns: 190px 1fr 260px; }
}
@media (max-width: 900px) {
  .bs-studio { height: auto; }
  .bs-body { grid-template-columns: 1fr; grid-template-rows: auto 60vh auto; }
  .bs-palette { display: flex; flex-wrap: wrap; gap: 6px; max-height: 180px; }
  .bs-pal-item { margin: 0; flex: 1 1 160px; }
  .bs-pal-head, .bs-pal-group, .bs-pal-tpls { flex-basis: 100%; }
  .bs-name { width: 160px; }
}
@media (prefers-reduced-motion: reduce) {
  .bs-edge.is-flowing, .bs-node.st-running, .bs-spin { animation: none; }
}

/* z-os-session.css */
/* ADL³ OS support session banner */
.os-session-bar { position: sticky; top: 0; z-index: 1000; display: flex; gap: 12px; align-items: center; justify-content: center; padding: 8px 16px; background: #111; color: #fff; font-size: 13px; border-bottom: 2px solid #f5b400; }
.os-session-bar .btn { background: #fff; color: #111; border: 0; }
.os-imp { min-height: 100vh; display: grid; place-items: center; font-size: 15px; }
