/* House of Marketers admin hub, in Ollie's design: the same tokens (oli.css), sidebar (with fold), buttons, tags,
   tables, sign-in card, light/dark switch and "Our Systems" app switcher (app.css). */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
  --font: #333333; --font-2: #666666; --font-3: #999999; --font-light: #b3b3b3;
  --bg: #ffffff; --bg-2: #fcfcfc; --bg-3: #f1f1f1; --bg-4: #ebebeb;
  --hover: rgba(0, 0, 0, 0.04); --hover-strong: rgba(0, 0, 0, 0.078);
  --border: #ebebeb; --border-light: #f1f1f1; --border-strong: #d6d6d6;
  --brand-fuchsia: #fe489c; --brand-navy: #270f95;
  --accent: #dc3486; --accent-bg: #fdebf4; --accent-border: #f5a9cc;
  --danger: #d4544f;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 0 4px rgba(0, 0, 0, 0.08);
  --shadow-strong: 2px 4px 16px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.04);
  --gray-bg: #f1f1f1; --gray: #666666;
  --green-bg: #e9f6ec; --green: #308052;
  --blue-bg: #eef2fd; --blue: #415ac1;
  --purple-bg: #f6eefc; --purple: #7948af;
  --pink-bg: #fae9f5; --pink: #b23887;
  --orange-bg: #fcefd9; --orange: #c25700;
  --red-bg: #fbecec; --red: #be3b38;
  --s1: #E8338B; --s2: #9B2AA6; --s3: #5B32C9; --s4: #270F95; --s5: #F27BB4; --s6: #C46BD1; --s7: #8F72E6; --s8: #5A4BB8;
  --grid: #ececec;
  font-family: Inter, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  color: var(--font);
  -webkit-font-smoothing: antialiased;
  color-scheme: light;
}
/* Dark: follows the computer, unless Light or Dark was picked with the switch (Ollie's dark tokens). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --font: #ebebeb; --font-2: #b3b3b3; --font-3: #818181; --font-light: #666666;
    --bg: #171717; --bg-2: #1b1b1b; --bg-3: #222222; --bg-4: #292929;
    --hover: rgba(255, 255, 255, 0.06); --hover-strong: rgba(255, 255, 255, 0.1);
    --border: #292929; --border-light: #222222; --border-strong: #333333;
    --accent: #ff6aae; --accent-bg: #3a1529; --accent-border: #7a2f57;
    --gray-bg: #262626; --gray: #b3b3b3; --green-bg: #17291d; --green: #6cc48d;
    --blue-bg: #1b2140; --blue: #9eb1ff; --purple-bg: #261c33; --purple: #c9a4f0;
    --pink-bg: #2d1828; --pink: #f19cd0; --orange-bg: #2d1f12; --orange: #ffa057;
    --red-bg: #2f1716; --red: #ff8f8a;
    --s1: #F0509C; --s2: #B94BC4; --s3: #7D5AE6; --s4: #5B48D6; --s5: #F59AC6; --s6: #D08ADB; --s7: #A894EE; --s8: #7E70D6;
    --grid: #2a2a2a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --font: #ebebeb; --font-2: #b3b3b3; --font-3: #818181; --font-light: #666666;
  --bg: #171717; --bg-2: #1b1b1b; --bg-3: #222222; --bg-4: #292929;
  --hover: rgba(255, 255, 255, 0.06); --hover-strong: rgba(255, 255, 255, 0.1);
  --border: #292929; --border-light: #222222; --border-strong: #333333;
  --accent: #ff6aae; --accent-bg: #3a1529; --accent-border: #7a2f57;
  --gray-bg: #262626; --gray: #b3b3b3; --green-bg: #17291d; --green: #6cc48d;
  --blue-bg: #1b2140; --blue: #9eb1ff; --purple-bg: #261c33; --purple: #c9a4f0;
  --pink-bg: #2d1828; --pink: #f19cd0; --orange-bg: #2d1f12; --orange: #ffa057;
  --red-bg: #2f1716; --red: #ff8f8a;
  --s1: #F0509C; --s2: #B94BC4; --s3: #7D5AE6; --s4: #5B48D6; --s5: #F59AC6; --s6: #D08ADB; --s7: #A894EE; --s8: #7E70D6;
  --grid: #2a2a2a;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { background: #dc3486; border-color: #dc3486; } }
:root[data-theme="dark"] .btn.primary { background: #dc3486; border-color: #dc3486; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg-2); }
body { overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; }
.muted { color: var(--font-3); }
.small { font-size: 0.92rem; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }
[hidden] { display: none !important; }

/* Frame: Ollie's sidebar on the light grey, the page on white */
.shell { display: flex; min-height: 100vh; background: var(--bg-2); }
.side { width: 220px; flex-shrink: 0; display: flex; flex-direction: column; gap: 2px; padding: 12px 8px; position: sticky; top: 0; height: 100vh; background: var(--bg-2); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; color: var(--font); font-weight: 600; font-size: 1.35rem; letter-spacing: -0.01em; }
.brand img { width: 32px; height: 32px; object-fit: contain; }
.brand-row { display: flex; align-items: center; padding-right: 4px; }
.brand-row .brand { padding-bottom: 4px; }
/* Light/dark switch (sun / moon), beside the logo like Ollie's */
.theme-switch { position: relative; width: 40px; height: 22px; border-radius: 11px; border: 1px solid var(--border); background: var(--bg-3); cursor: pointer; padding: 0; flex: none; }
.theme-switch .ico { position: absolute; top: 4px; width: 12px; height: 12px; color: var(--font-3); }
.theme-switch .ico.sun { left: 5px; }
.theme-switch .ico.moon { right: 5px; }
.theme-switch .knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: left 0.15s; }
.theme-switch.on .knob { left: 20px; }
/* Sidebar folded to icons (the « / » button) */
.nav-fold { width: 100%; border: 0; background: transparent; cursor: pointer; font: inherit; text-align: left; color: var(--font-3); }
.nav-fold:hover { color: var(--font); }
.side { transition: width 0.18s ease; }
.side.folded { width: 56px; }
.side.folded .brand span, .side.folded .nav-text, .side.folded .nav-label, .side.folded .who span { display: none; }
.side.folded .brand-row { justify-content: center; padding-right: 0; }
.side.folded .brand-row > :not(.brand) { display: none; }
.side.folded .brand { padding: 4px 0; }
.side.folded .nav-item, .side.folded .side-foot .who { justify-content: center; padding: 0; }
/* "Our Systems": the 9-dot app switcher at the right of the top bar */
.apps-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin-left: 4px; border: 0; border-radius: 6px; background: transparent; color: var(--font); cursor: pointer; flex: none; }
.apps-btn:hover, .apps-btn.open { background: var(--hover); }
.apps-pop { position: fixed; z-index: 2500; width: 300px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-strong); padding: 8px 6px 10px; }
.apps-head { font-weight: 600; font-size: 14px; padding: 2px 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.apps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.apps-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; border-radius: 8px; color: var(--font); text-decoration: none; text-align: center; }
.apps-tile:hover { background: var(--hover); }
.apps-logo { display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.apps-logo img { width: 34px; height: 34px; object-fit: contain; }
.apps-name { font-size: 12px; }
.apps-tile.soon { cursor: default; }
.apps-tile.soon:hover { background: transparent; }
.apps-tile.soon .apps-logo img { opacity: 0.55; filter: grayscale(0.4); }
.apps-tile.soon .apps-name { color: var(--font-3); }
.apps-soon { margin-top: -3px; padding: 1px 6px; border-radius: 999px; background: var(--hover); color: var(--font-2); font-size: 10px; font-weight: 500; }
.topbar > .apps-btn { margin-left: auto; }
/* Group tabs at the top of a page (Connections) */
.page-tabs { position: sticky; top: 48px; z-index: 4; background: var(--bg); padding-block: 4px; }
.nav-item { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px; border-radius: 4px; color: var(--font-2); font-weight: 500; cursor: pointer; }
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--accent-bg); color: var(--accent); }
.nav-item svg { width: 16px; height: 16px; flex: none; color: var(--font-3); }
.nav-item.active svg { color: var(--accent); }
.nav-label { padding: 12px 8px 4px; font-size: 0.92rem; color: var(--font-3); font-weight: 500; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.side-foot .who { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px; font-weight: 500; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); border-left: 1px solid var(--border); }
.topbar { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 24px; border-bottom: 1px solid var(--border); flex-wrap: wrap; background: var(--bg); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-weight: 600; font-size: 1.08rem; }
.content { padding: 16px 24px 40px; display: flex; flex-direction: column; gap: 16px; max-width: 1400px; width: 100%; }
.btn.menu-btn { display: none; }

/* Sections */
.card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; min-width: 0; }
.card-h { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border-light); min-height: 44px; }
.card-h h2 { font-size: 1rem; font-weight: 600; }
.card-b { padding: 12px 16px; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.tile { padding: 12px 16px; }
.tile .k { color: var(--font-3); font-weight: 500; }
.tile .v { font-size: 1.85rem; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .d { margin-top: 2px; color: var(--font-2); font-size: 0.92rem; }
.up { color: var(--red); }
.down { color: var(--green); }

/* Buttons (Ollie's t-btn) */
.btn { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 4px; border: 1px solid var(--border); background: var(--bg); color: var(--font-2); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background 0.1s ease; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(0.95); background: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn svg { width: 14px; height: 14px; }

/* Inputs */
.input, select.input { height: 32px; border: 1px solid var(--border); border-radius: 4px; padding: 0 8px; background: var(--bg); outline: none; min-width: 0; }
.input:focus { border-color: var(--accent-border); box-shadow: 0 0 0 3px var(--accent-bg); }
label.field { display: flex; flex-direction: column; gap: 4px; color: var(--font-2); font-weight: 500; }
.seg { display: inline-flex; background: var(--bg-3); border-radius: 4px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; height: 20px; padding: 0 8px; border-radius: 3px; color: var(--font-3); font-weight: 500; cursor: pointer; }
.seg button.active { background: var(--bg); color: var(--font); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.switch { position: relative; width: 28px; height: 16px; border-radius: 8px; background: var(--bg-4); border: 0; cursor: pointer; flex: none; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { left: 14px; }
.t-check, input[type="checkbox"] { accent-color: var(--accent); }

/* Tags (Ollie's t-tag colours) */
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 4px; white-space: nowrap; background: var(--gray-bg); color: var(--gray); }
.tag.green { background: var(--green-bg); color: var(--green); }
.tag.blue { background: var(--blue-bg); color: var(--blue); }
.tag.purple { background: var(--purple-bg); color: var(--purple); }
.tag.pink { background: var(--pink-bg); color: var(--pink); }
.tag.orange { background: var(--orange-bg); color: var(--orange); }
.tag.red { background: var(--red-bg); color: var(--red); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--green); } .dot.bad { background: var(--red); } .dot.idle { background: var(--font-light); } .dot.warn { background: var(--orange); }

/* Tables (Ollie's t-table) */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { height: 32px; padding: 0 8px; text-align: left; font-weight: 500; color: var(--font-3); white-space: nowrap; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border-light); background: var(--bg); }
.t td { height: 36px; padding: 4px 8px; border-bottom: 1px solid var(--border-light); border-right: 1px solid var(--border-light); vertical-align: middle; }
.t th:first-child, .t td:first-child { padding-left: 16px; }
.t th:last-child, .t td:last-child { border-right: 0; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: var(--bg-2); }
.t tbody tr.click { cursor: pointer; }
.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.who { display: flex; align-items: center; gap: 8px; min-width: 180px; }
.avatar { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; font-weight: 500; color: #fff; flex: none; position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.side-foot .avatar, .drawer-h .avatar { width: 24px; height: 24px; font-size: 10px; }
.empty { padding: 32px 24px; text-align: center; color: var(--font-3); }

/* Charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { fill: var(--font-3); font-size: 11px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .hit { fill: transparent; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; color: var(--font-2); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.tip { position: absolute; pointer-events: none; background: var(--bg); border: 1px solid var(--border); box-shadow: var(--shadow-strong); border-radius: 8px; padding: 8px 10px; min-width: 160px; z-index: 3; }
.tip .tr { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.tip .tr b { font-weight: 500; font-variant-numeric: tabular-nums; }
.bar-track { height: 6px; background: var(--bg-3); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; }
.amt { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Drawers and dialogs (Ollie's menus/dialogs: white, 8px, strong shadow) */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.2); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--bg); border-left: 1px solid var(--border); box-shadow: var(--shadow-strong); z-index: 21; display: flex; flex-direction: column; }
.drawer-h { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.drawer-h h2 { font-size: 1.08rem; }
.drawer-b { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.drawer-f { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.app-box { border: 1px solid var(--border); border-radius: 8px; }
.app-box .ah { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border-light); font-weight: 600; }
.app-box .ab { padding: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.app-box .ab .full { grid-column: 1 / -1; }
.dialog { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-strong); z-index: 21; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #333333; color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 40; box-shadow: var(--shadow-strong); max-width: calc(100vw - 32px); }
.toast.err { background: var(--danger); }
.note { background: var(--bg-3); color: var(--font-2); border-radius: 6px; padding: 8px 12px; }
.secret { font-family: ui-monospace, Menlo, monospace; background: var(--bg-3); padding: 6px 8px; border-radius: 4px; word-break: break-all; }
.err-text { color: var(--danger); font-size: 0.92rem; }
.err-text:empty { display: none; }

/* Sign-in (Ollie's auth card) */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px 16px; background: var(--bg-2); }
.login .card { width: 360px; max-width: 100%; border-radius: 12px; box-shadow: var(--shadow); padding: 32px 28px 24px; display: flex; flex-direction: column; gap: 12px; }
.login .logo { width: 56px; height: 56px; object-fit: contain; margin-bottom: 4px; }
.login .sub { margin: -8px 0 4px; }
.login .err-text:empty { display: none; }
.login .foot { font-size: 0.92rem; }
.login h1 { font-size: 1.54rem; font-weight: 600; }
.login label.field input { height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 6px; font-size: 1rem; }
.login label.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.login .btn.primary { height: 36px; justify-content: center; font-size: 1rem; border-radius: 6px; }

/* Role matrix */
.matrix .c { text-align: center; }
.check { color: var(--green); font-weight: 600; }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g21 { grid-template-columns: 1fr; } }
@media (max-width: 780px) {
  .shell { display: block; }
  .side { position: fixed; left: 0; z-index: 30; width: 240px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-strong); }
  .side.open { transform: none; }
  .btn.menu-btn { display: inline-flex; }
  .main { border-left: 0; }
  .topbar { padding: 8px 16px; }
  .content { padding: 16px; }
  .g3, .g2 { grid-template-columns: 1fr; }
  .app-box .ab { grid-template-columns: 1fr; }
}
@media (max-width: 480px) { .g4 { grid-template-columns: 1fr; } }

/* Spend spike: one line, brand pink, like Ollie's notices. */
.spike { width: 100%; gap: 10px; padding: 10px 14px; margin-bottom: 16px; border: 1px solid var(--accent-border); border-radius: 8px; background: var(--accent-bg); color: var(--font); font: inherit; text-align: left; cursor: pointer; }
.spike:hover { filter: brightness(0.98); }
.spike svg { color: var(--accent); }
.spike-link { color: var(--accent); font-weight: 500; }
