/* The Impact Engine — Ads Command Centre
   TIE palette: black #060504, cream #F5F5F1, red #BD142D. One typeface, Inter, throughout:
   sentence-case headings, tight tracking on large sizes. */
:root {
  --ink: #060504; --cream: #F5F5F1; --paper: #FFFFFF; --red: #BD142D; --red-d: #96101F; --red-soft: #F7E3E6;
  --line: #E3E1DA; --line-2: #CFCBC0; --muted: #6E6A62; --muted-2: #9A958B;
  --ok: #1F7A4D; --ok-soft: #E1F2E8; --warn: #B4690E; --warn-soft: #FBEEDB; --bad: #BD142D; --bad-soft: #F7E3E6; --opp: #2357A6; --opp-soft: #E2EBF8;
  --google: #BD142D; --meta: #060504;
  --r: 14px; --r-sm: 9px; --shadow: 0 1px 0 rgba(6,5,4,.04), 0 6px 20px -12px rgba(6,5,4,.25);
  --head: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: var(--head);
  --ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--ui); color: var(--ink); background: var(--cream); -webkit-font-smoothing: antialiased; }
a { color: var(--red); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--head); font-weight: 600; margin: 0; line-height: 1.25; }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; } h2 { font-size: 16px; letter-spacing: -.005em; } h3 { font-size: 14.5px; }
h1 em, h2 em { color: var(--red); font-style: normal; }
.muted { color: var(--muted); } .small { font-size: 12px; } .serif { font-family: var(--serif); }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--ink); color: var(--cream); padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 14px; background: var(--red); }
.login-art h1 { font-size: 40px; margin: 40px 0 16px; max-width: 14ch; letter-spacing: -.025em; line-height: 1.1; }
.login-art p.lede { font-size: 16px; line-height: 1.6; max-width: 34ch; color: #D9D6CC; }
.feat { display: grid; gap: 14px; margin: 32px 0 40px; max-width: 420px; }
.feat div { border: 1.5px solid #3a3733; border-radius: var(--r); padding: 12px 16px; }
.feat b { font-weight: 600; font-size: 14.5px; color: var(--cream); display: block; }
.feat span { color: #B8B4AA; font-size: 13px; }
.login-form { display: grid; place-items: center; padding: 40px 24px; }
.login-form form { width: min(380px, 100%); }
.login-form h2 { font-size: 28px; margin-bottom: 6px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand .mark { width: 34px; height: 34px; border-radius: 9px; background: var(--red); color: var(--cream); display: grid; place-items: center; font-size: 15px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: var(--cream); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side .brand { padding: 20px 18px 18px; }
.side .brand small { display: block; font-size: 12px; font-weight: 400; color: #A9A59B; letter-spacing: 0; }
.nav { display: grid; gap: 2px; padding: 6px 10px; flex: 1; overflow: auto; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: #D8D4CA; font-weight: 500; }
.nav a:hover { background: #1b1916; text-decoration: none; color: #fff; }
.nav a.on { background: var(--red); color: #fff; }
.nav a .ct { margin-left: auto; background: #2a2723; color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 8px; }
.nav a.on .ct { background: rgba(255,255,255,.22); }
.nav .sep { height: 1px; background: #24211e; margin: 8px 6px; }
.nav a.sub { padding: 6px 12px 6px 40px; font-size: 13px; font-weight: 400; gap: 9px; }
.nav a.sub span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a.sub .dot { width: 7px; height: 7px; }
.nav svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side .who { padding: 14px 16px; border-top: 1px solid #24211e; display: flex; gap: 10px; align-items: center; }
.side .who .meta { flex: 1; min-width: 0; } .side .who b { display: block; font-weight: 600; font-size: 13px; }
.side .who span { font-size: 11px; color: #A9A59B; }
.side .band { height: 10px; background: var(--red); }
.av { width: 30px; height: 30px; border-radius: 50%; background: var(--cream); color: var(--ink); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.av.sm { width: 24px; height: 24px; font-size: 10px; } .av.red { background: var(--red); color: #fff; }
.avs { display: flex; } .avs .av { border: 2px solid var(--paper); margin-left: -6px; } .avs .av:first-child { margin-left: 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 16px 28px; border-bottom: 1px solid var(--line); background: var(--cream); position: sticky; top: 0; z-index: 5; }
.top .crumbs { font-size: 14.5px; font-weight: 600; }
.top .sp { flex: 1; }
.page { padding: 24px 28px 60px; display: grid; gap: 20px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: end; gap: 16px; flex-wrap: wrap; }
.page-head .sp { flex: 1; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }

/* ---------- elements ---------- */
.card { background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card.tight { padding: 0; overflow: hidden; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-h h2, .card-h h3 { flex: 1; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.split.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.split.form { grid-template-columns: 380px minmax(0, 1fr); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1.5px solid var(--ink); background: var(--paper); color: var(--ink); border-radius: 999px; padding: 8px 16px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, transform .05s; }
.btn:hover { background: var(--cream); } .btn:active { transform: translateY(1px); }
.btn.pri { background: var(--red); border-color: var(--red); color: #fff; } .btn.pri:hover { background: var(--red-d); }
.btn.dark { background: var(--ink); color: var(--cream); } .btn.dark:hover { background: #24211e; }
.btn.ghost { border-color: transparent; background: transparent; } .btn.ghost:hover { background: rgba(6,5,4,.06); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn { border: 0; background: transparent; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: rgba(6,5,4,.07); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

label.f { display: grid; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
label.f > span.hint { text-transform: none; letter-spacing: 0; font-weight: 400; }
input.i, select.i, textarea.i { width: 100%; border: 1.5px solid var(--line-2); background: var(--paper); border-radius: var(--r-sm); padding: 9px 11px; font-size: 14px; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--ink); }
input.i:focus, select.i:focus, textarea.i:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(189,20,45,.15); }
textarea.i { resize: vertical; min-height: 90px; line-height: 1.5; }
textarea.code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12.5px; min-height: 420px; }
select.i.inline { width: auto; padding: 7px 30px 7px 12px; border-radius: 999px; }
.seg { display: inline-flex; border: 1.5px solid var(--ink); border-radius: 999px; padding: 2px; background: var(--paper); }
.seg { max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: transparent; padding: 5px 13px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.seg button.on { background: var(--ink); color: var(--cream); }

.tag { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px; font-size: 11.5px; font-weight: 600; background: var(--cream); border: 1px solid var(--line); white-space: nowrap; }
.tag.red { background: var(--red-soft); border-color: #EFC3CA; color: var(--red-d); }
.tag.ok { background: var(--ok-soft); border-color: #BFE2CD; color: var(--ok); }
.tag.warn { background: var(--warn-soft); border-color: #F1D3A9; color: var(--warn); }
.tag.opp { background: var(--opp-soft); border-color: #C5D6F0; color: var(--opp); }
.tag.dark { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.plat { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; }
.plat i { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; font-style: normal; font-size: 10px; font-weight: 800; color: #fff; }
.plat.google i { background: var(--google); } .plat.meta i { background: var(--meta); }

/* KPI */
.kpi { padding: 16px 18px; }
.kpi .k { font-size: 13px; font-weight: 500; color: var(--muted); }
.kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 12px; margin-top: 2px; }
.up { color: var(--ok); } .down { color: var(--bad); } .flat { color: var(--muted); }

/* tables */
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 10px 12px; border-bottom: 1.5px solid var(--line); background: #FBFAF7; white-space: nowrap; cursor: default; position: sticky; top: 0; }
table.t th.sort { cursor: pointer; user-select: none; } table.t th.sort:hover { color: var(--ink); }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr:hover td { background: #FCFBF8; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.t .cname { font-weight: 600; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* projects */
.proj { display: grid; gap: 12px; cursor: pointer; transition: border-color .15s, transform .15s; }
.proj:hover { border-color: var(--ink); transform: translateY(-1px); }
.proj-h { display: flex; align-items: center; gap: 10px; }
.proj-h h3 { flex: 1; font-size: 17px; }
.proj-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.proj-stats div span { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.proj-stats div b { font-weight: 700; font-size: 17px; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.pace { height: 7px; border-radius: 999px; background: var(--cream); border: 1px solid var(--line); overflow: hidden; position: relative; }
.pace i { position: absolute; inset: 0 auto 0 0; background: var(--ink); border-radius: 999px; }
.pace b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--red); }
.member-group h3 { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; }

/* tasks */
.task { display: flex; gap: 12px; align-items: flex-start; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task .chk { width: 20px; height: 20px; border-radius: 6px; border: 1.8px solid var(--ink); background: var(--paper); flex: none; cursor: pointer; display: grid; place-items: center; margin-top: 1px; }
.task .chk.doing { background: var(--warn-soft); border-color: var(--warn); }
.task .chk.done { background: var(--ink); }
.task .chk.done::after { content: ''; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
.task .body { flex: 1; min-width: 0; }
.task .ttl { font-weight: 600; }
.task.done .ttl { text-decoration: line-through; color: var(--muted); }
.task .sub { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; font-size: 12px; color: var(--muted); }
.due.late { color: var(--bad); font-weight: 600; } .due.today { color: var(--warn); font-weight: 600; }
.pri-high { color: var(--red); font-weight: 700; }
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.col-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1.5px solid var(--line); font-weight: 600; font-size: 14px; }

/* brain */
.ask { background: var(--ink); color: var(--cream); border-radius: 20px; padding: 26px; position: relative; overflow: hidden; }
.ask::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: var(--red); }
.ask h1 { color: var(--cream); }
.ask p { color: #BDB9AF; margin: 8px 0 18px; }
.ask form { display: flex; gap: 10px; }
.ask input { flex: 1; border: 0; border-radius: 999px; padding: 14px 20px; font-size: 15px; background: var(--cream); color: var(--ink); }
.ask input:focus { outline: 3px solid var(--red); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.chips button { border: 1px solid #3a3733; background: transparent; color: #DDD9CF; border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 12.5px; }
.chips button:hover { border-color: var(--cream); color: #fff; }
.answer { font-size: 14.5px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.cite { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 6px; background: var(--red); color: #fff; font: 700 11px var(--ui); vertical-align: 2px; cursor: pointer; margin: 0 1px; }
.source { border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; display: grid; gap: 6px; background: var(--paper); transition: border-color .2s, box-shadow .2s; }
.source.flash { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.source .sh { display: flex; gap: 8px; align-items: center; }
.source .sh b { flex: 1; font-size: 13px; }
.source p { margin: 0; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.entry { padding: 14px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
.entry:last-child { border-bottom: 0; }
.entry .eh { display: flex; gap: 8px; align-items: center; }
.entry .eh b { flex: 1; }
.entry p { margin: 0; font-size: 13.5px; line-height: 1.6; color: #2b2925; }

/* decisions */
.dec { display: grid; gap: 10px; border-left: 5px solid var(--line-2); }
.dec.high { border-left-color: var(--red); } .dec.medium { border-left-color: var(--warn); } .dec.opportunity { border-left-color: var(--opp); }
.dec .dh { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dec .dh h3 { flex: 1; min-width: 220px; font-family: var(--ui); font-weight: 700; font-size: 14.5px; }
.dec p { margin: 0; }
.dec .act { background: var(--cream); border-radius: var(--r-sm); padding: 10px 12px; font-size: 13.5px; }
.dec .act b { font-weight: 600; font-size: 12.5px; color: var(--red); display: block; }

/* creator */
.copy-list { display: grid; gap: 6px; }
.copy-list div { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; background: #FDFCFA; }
.copy-list div span { flex: 1; overflow-wrap: anywhere; } .copy-list div small { color: var(--muted-2); font-variant-numeric: tabular-nums; }
.copy-list div small.over { color: var(--bad); font-weight: 700; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: 13px; }
dl.kv dt { color: var(--muted); font-weight: 600; } dl.kv dd { margin: 0; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.checklist input { margin-top: 3px; accent-color: var(--red); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.empty .art { font-size: 40px; font-weight: 300; color: var(--line-2); }

/* report preview */
.report-preview { background: #fff; border: 1.5px solid var(--line); border-radius: var(--r); padding: 30px 34px; }
.ph-list { display: grid; gap: 4px; max-height: 460px; overflow: auto; }
.ph-list button { text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 6px 9px; cursor: pointer; font-size: 12px; display: grid; }
.ph-list button:hover { border-color: var(--ink); }
.ph-list code { font-size: 11.5px; color: var(--red-d); }

/* activity */
.act-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.act-item:last-child { border-bottom: 0; }

/* charts */
.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--cream); padding: 7px 10px; border-radius: 8px; font-size: 12px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); z-index: 3; }

/* modal + toast */
.modal-bg { position: fixed; inset: 0; background: rgba(6,5,4,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--paper); border-radius: 18px; width: min(620px, 100%); max-height: 90vh; overflow: auto; padding: 22px; display: grid; gap: 14px; border-bottom: 8px solid var(--red); }
.modal-h { display: flex; align-items: center; } .modal-h h2 { flex: 1; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--cream); padding: 11px 18px; border-radius: 999px; z-index: 60; font-weight: 600; box-shadow: var(--shadow); }
.toast.err { background: var(--red); }
.banner { display: flex; gap: 12px; align-items: center; background: var(--warn-soft); border: 1.5px solid #F1D3A9; border-radius: var(--r); padding: 10px 14px; font-size: 13px; }
.banner.info { background: var(--paper); border-color: var(--line); }
.spin { width: 18px; height: 18px; border: 2.5px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: sp .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes sp { to { transform: rotate(360deg); } }
.skel { background: linear-gradient(90deg, #EEECE6, #F7F6F2, #EEECE6); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; min-height: 90px; }
@keyframes sk { to { background-position: -200% 0; } }
.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; white-space: nowrap; border: 0; background: none; padding: 9px 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1.5px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--red); }

.menu-btn { display: none; }
@media (max-width: 1180px) { .g5 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(2, 1fr); } .split, .split.form { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; } .login-art { padding: 32px 24px 40px; } .login-art h1 { font-size: 34px; margin-top: 24px; } .feat { display: none; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .menu-btn { display: inline-grid; }
  .top { padding: 12px 16px; } .page { padding: 18px 16px 50px; }
  .g2, .g3, .cols, .split.even { grid-template-columns: 1fr; } .g5, .g4 { grid-template-columns: repeat(2, 1fr); }
  .ask form { flex-direction: column; }
}
