/* Shopify-admin mimicry v2 — matched to Cole's 2026-08-31 admin screenshot:
   white sidebar, dense full-width cards, no top search, bright-blue charts */
* { margin:0; padding:0; box-sizing:border-box; }
html,body { height:100%; }
body {
  font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  font-size:13px; color:#303030; background:#f1f1f1;
  -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
}
svg { display:block; }

/* ── Top bar ─────────────────────────────────────── */
.topbar {
  position:fixed; top:0; left:0; right:0; height:56px; background:#1a1a1a;
  display:flex; align-items:center; padding:0 16px; gap:16px; z-index:10;
}
.brand { display:flex; align-items:center; gap:10px; }
.brand-tile {
  width:30px; height:30px; border-radius:8px; background:#2aa564;
  color:#fff; font-size:12px; font-weight:700; letter-spacing:.06em;
  display:flex; align-items:center; justify-content:center;
}
.brand-name { color:#fff; font-size:14px; font-weight:650; letter-spacing:.01em; }
.top-spacer { flex:1; }
.top-right { display:flex; align-items:center; gap:8px; }
.icon-btn-dark {
  width:32px; height:32px; border-radius:8px; background:#303030;
  display:flex; align-items:center; justify-content:center;
}
.user-chip {
  height:32px; border-radius:8px; background:#303030; display:flex;
  align-items:center; gap:8px; padding:0 10px 0 4px;
}
.avatar {
  width:24px; height:24px; border-radius:6px; display:flex; align-items:center;
  justify-content:center; font-size:10px; font-weight:650;
}
.user-chip .uname { color:#e3e3e3; font-size:12px; font-weight:550; }

/* ── Frame / sidebar ─────────────────────────────── */
.frame { padding-top:56px; display:flex; min-height:100vh; }
.sidebar {
  position:fixed; top:56px; bottom:0; left:0; width:240px; background:#fff;
  border-right:1px solid #e7e7e7;
  padding:10px 8px; display:flex; flex-direction:column; overflow:hidden;
}
.nav-item {
  display:flex; align-items:center; gap:8px; padding:5px 8px; border-radius:8px;
  font-size:13px; font-weight:500; color:#303030; cursor:pointer;
}
.nav-item svg { flex:0 0 20px; }
.nav-item.active { background:#f1f1f1; font-weight:650; }
.nav-item:hover:not(.active) { background:rgba(0,0,0,.05); }
.nav-sub { padding-left:36px; font-weight:450; color:#4a4a4a; }
.nav-sub.active { font-weight:650; color:#303030; }
.nav-label {
  font-size:12px; font-weight:600; color:#616161; padding:4px 8px; margin-top:14px;
  display:flex; align-items:center; gap:4px;
}
.nav-spacer { flex:1; }

/* ── Content ─────────────────────────────────────── */
.content { margin-left:240px; flex:1; padding:20px 24px 36px; }
.page { max-width:none; margin:0; }
.page-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.page-title { font-size:20px; font-weight:700; letter-spacing:-.01em; display:flex; align-items:center; gap:8px; }
.head-actions { display:flex; gap:8px; align-items:center; }
.section-head {
  display:flex; align-items:center; justify-content:space-between;
  font-size:14px; font-weight:650; margin:6px 0 10px;
}

/* ── Buttons ─────────────────────────────────────── */
.btn {
  margin:0; height:32px; padding:0 12px; border-radius:8px; background:#fff;
  border:1px solid #e3e3e3; border-bottom-color:#c9c9c9;
  box-shadow:0 1px 0 rgba(26,26,26,.05);
  font-family:inherit; font-size:13px; font-weight:550; color:#303030;
  display:inline-flex; align-items:center; gap:6px; cursor:pointer; white-space:nowrap;
}
.btn:hover { background:#fafafa; }
.btn-primary:hover { background:#303030; }
.btn-primary {
  background:#1a1a1a; color:#fff; border-color:#1a1a1a;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.14), 0 1px 0 rgba(26,26,26,.1);
}
.btn-primary svg { stroke:#fff; }
.mini-btn {
  width:28px; height:28px; border-radius:8px; background:#fff;
  border:1px solid #e3e3e3; border-bottom-color:#c9c9c9;
  display:inline-flex; align-items:center; justify-content:center;
}

/* ── Cards ───────────────────────────────────────── */
.card {
  background:#fff; border-radius:12px; border:1px solid #ebebeb;
  box-shadow:0 1px 0 rgba(26,26,26,.07); overflow-x:auto; overflow-y:hidden;
}
.card-pad { padding:14px; }
.card-title { font-size:13px; font-weight:650; }
.card-sub { font-size:12px; color:#616161; margin-top:2px; }

/* ── Metrics / grids ─────────────────────────────── */
.metrics { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:12px; }
/* 6 metric cards (Analytics): one line wide, 2-column when narrow */
.metrics.wide { grid-template-columns:repeat(6,1fr); }
@media (max-width: 1250px) {
  .metrics.wide { grid-template-columns:repeat(2,1fr); }
}
.grid3 { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; margin-bottom:12px; }
/* OL-98 responsiveness: grid children default to min-width:auto, so a wide
   $ value or table BLOWS OUT the column and the page scrolls sideways
   (Cole refimg2/6). min-width:0 lets content shrink; align-items:start
   stops short cards stretching to their row-mate's height (the "weird
   vertical spacing" on Analytics). */
.metrics > *, .grid3 > *, .two-col > *, .detail-grid > * { min-width:0; }
.two-col, .detail-grid, .grid3 { align-items:start; }
/* OL-98 round 2: card walls MASONRY-flow — within a column, when a card
   ends the next begins (no row-alignment gaps). JS-placed columns
   (masonryLayout in icons.js) — CSS multicol paints unreliably with
   scroll-container cards. Pre-JS fallback: single stacked column. */
.masonry { margin-bottom:12px; }
.masonry > .card { margin-bottom:12px; }
.masonry.mready { display:flex; gap:12px; align-items:flex-start; }
.masonry.mready > .mcol { flex:1; min-width:0; display:flex;
  flex-direction:column; gap:12px; }
.masonry.mready .card { margin-bottom:0; }
.metric-label { font-size:13px; font-weight:500; color:#616161; }
.metric-value {
  font-size:20px; font-weight:650; margin-top:6px; letter-spacing:-.01em;
  font-variant-numeric:tabular-nums; display:flex; align-items:baseline; gap:8px;
  flex-wrap:wrap; min-width:0;
}
.delta { font-size:12px; font-weight:500; color:#616161; }
.delta.up { color:#29845a; } .delta.down { color:#8e1f0b; }
.spark { margin-top:8px; }

/* ── Tables ──────────────────────────────────────── */
.tbl { width:100%; border-collapse:collapse; }
.tbl th {
  text-align:left; font-size:12px; font-weight:500; color:#616161;
  padding:7px 12px; border-bottom:1px solid #ebebeb; white-space:nowrap;
}
.tbl td { font-size:13px; padding:8px 12px; border-bottom:1px solid #f1f1f1; vertical-align:middle; white-space:nowrap; }
.tbl tr:last-child td { border-bottom:none; }
.tbl tr:not(:first-child):hover td { background:#fafafa; }
.tbl a:hover { text-decoration:underline; }
.tbl .num, .tbl th.num { text-align:right; font-variant-numeric:tabular-nums; }
.tbl .ctr, .tbl th.ctr { text-align:center; }
/* Sortable header carets (OL-98 r6) */
.sort-th { display:inline-flex; align-items:center; gap:4px; color:#616161;
  font-weight:500; cursor:pointer; white-space:nowrap; }
.sort-th:hover { color:#303030; }
.sort-th.on { color:#303030; font-weight:650; }
.sort-th .caret { font-size:9px; opacity:.55; }
.sort-th.on .caret { opacity:1; }
.tbl th.num .sort-th { flex-direction:row-reverse; }
.tbl .strong { font-weight:600; }
.tbl .dim { color:#8a8a8a; }
.cb {
  width:16px; height:16px; border:1.5px solid #8a8a8a; border-radius:4px;
  display:inline-block; vertical-align:middle;
}
.tbl th.cbcol, .tbl td.cbcol { width:34px; padding-right:0; }

/* ── Collapsible panes (Pay Commission cards, OL-98) ── */
details.pane { border-top:1px solid #ebebeb; }
details.pane > summary { list-style:none; cursor:pointer; display:flex;
  align-items:center; gap:8px; padding:10px 14px; font-weight:600;
  font-size:13px; user-select:none; }
details.pane > summary::-webkit-details-marker { display:none; }
details.pane > summary::before { content:"›"; font-size:16px; line-height:1;
  color:#616161; transition:transform .15s ease; }
details.pane[open] > summary::before { transform:rotate(90deg); }
details.pane > summary:hover { background:#fafafa; }

/* ── Tabs / toolbar ──────────────────────────────── */
.tabs {
  display:flex; align-items:center; gap:4px; padding:8px;
  border-bottom:1px solid #ebebeb;
}
.tab { padding:4px 12px; border-radius:8px; font-size:13px; font-weight:500; color:#616161; }
.tab.active { background:#f1f1f1; color:#303030; font-weight:600; }
.tabs .spacer { flex:1; }

/* ── Badges ──────────────────────────────────────── */
.badge {
  display:inline-flex; align-items:center; gap:4px; padding:2px 8px;
  border-radius:8px; font-size:12px; font-weight:500; white-space:nowrap;
}
.b-success { background:#affebf; color:#014b40; }
.b-warn    { background:#ffea8a; color:#4f4700; }
.b-crit    { background:#fedad9; color:#8e1f0b; }
.b-info    { background:#d6e9ff; color:#00527c; }
.b-neutral { background:#e3e3e3; color:#303030; }

/* ── Charts ──────────────────────────────────────── */
.legend { display:flex; gap:16px; align-items:center; font-size:12px; color:#616161; margin-top:4px; }
.dot { width:8px; height:8px; border-radius:50%; display:inline-block; margin-right:6px; }
.dot.a { background:#2472e8; } .dot.b { background:#9dc7f7; }
.hb { margin-bottom:10px; }
.hb-label { font-size:12px; color:#303030; margin-bottom:4px; }
.hb-row { display:flex; align-items:center; gap:8px; }
.hb-bar {
  height:32px; border-radius:3px; background:#33b1e4; display:flex;
  align-items:center; justify-content:flex-end; padding-right:8px;
  font-size:12px; font-weight:550; color:#0b3a4d; font-variant-numeric:tabular-nums;
}
.hb-val { font-size:12px; color:#303030; font-variant-numeric:tabular-nums; }
.fn-wrap { display:flex; gap:14px; margin-top:12px; }
.fn-col { flex:1; display:flex; flex-direction:column; height:216px; }
.fn-name { font-size:12px; color:#616161; white-space:nowrap; }
.fn-pct { font-size:15px; font-weight:650; margin-top:2px; }
.fn-n { font-size:12px; color:#8a8a8a; }
.fn-bar { background:#3b5bdb; border-radius:3px; width:70%; margin-top:auto; }

/* ── Misc ────────────────────────────────────────── */
.two-col { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.row-16 { margin-bottom:12px; }
.footnote { font-size:12px; color:#8a8a8a; margin-top:12px; line-height:1.5; }
.bar-track { height:4px; border-radius:2px; background:#f1f1f1; margin-top:6px; }
.bar-fill { height:4px; border-radius:2px; background:#2472e8; }
.pager { display:flex; align-items:center; justify-content:space-between; padding:8px 12px; border-top:1px solid #ebebeb; }
.pager .count { font-size:12px; color:#616161; }
.linkbox {
  display:flex; align-items:center; gap:8px; background:#f6f6f7;
  border:1px solid #e3e3e3; border-radius:8px; padding:6px 10px;
  font-family:'SF Mono',ui-monospace,Menlo,monospace; font-size:12px; color:#303030;
  flex:1;
}

/* ── Responsive: sidebar becomes a hamburger drawer ── */
.nav-toggle {
  display:none; width:32px; height:32px; min-width:32px; min-height:32px;
  flex:0 0 32px; box-sizing:border-box; border-radius:8px; background:#303030;
  align-items:center; justify-content:center; cursor:pointer;
}
.backdrop { display:none; }
@media (max-width: 900px) {
  .nav-toggle { display:flex; }
  .sidebar { transform:translateX(-105%); transition:transform .18s ease;
    z-index:30; box-shadow:0 8px 24px rgba(0,0,0,.18); }
  .sidebar.open { transform:translateX(0); }
  .backdrop.show { display:block; position:fixed; inset:56px 0 0 0;
    background:rgba(0,0,0,.35); z-index:25; }
  .content { margin-left:0; padding:16px; }
  .page-head { flex-wrap:wrap; gap:8px; }
  .brand-name { display:none; }          /* logo mark alone on phones */
  .user-chip .uname { display:none; }    /* avatar alone; name lives in the menu */
  .user-chip { padding:0 4px; }
  .topbar { gap:10px; padding:0 12px; }
}
/* The page itself never scrolls sideways — wide tables scroll INSIDE
   their card (.card has overflow-x:auto). */
html, body { overflow-x:clip; }
.content { min-width:0; }

/* ── Partner detail layout ───────────────────────── */
.detail-grid { display:grid; grid-template-columns:2fr 1fr; gap:12px; }
@media (max-width: 1000px) { .detail-grid { grid-template-columns:1fr; } }

/* ── Predictable column breakpoints (no mid-size odd wrapping) ── */
@media (max-width: 1250px) {
  .grid3 { grid-template-columns:repeat(2,1fr); }
  .metrics { grid-template-columns:repeat(2,1fr); }
}
@media (max-width: 900px) {
  .two-col { grid-template-columns:1fr; }
}
@media (max-width: 640px) {
  .grid3, .metrics { grid-template-columns:1fr; }
}

/* ── Date-range bar (marketing-dashboard parity) ── */
.range-wrap { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:12px; }
.range-bar {
  display:flex; align-items:center; gap:2px; background:#e7e7e7;
  border-radius:10px; padding:4px; max-width:100%; flex-wrap:wrap;
}
.range-pill {
  padding:4px 12px; border-radius:8px; font-size:13px; font-weight:550;
  color:#303030; text-decoration:none; white-space:nowrap;
}
.range-pill.active { background:#fff; box-shadow:0 1px 2px rgba(0,0,0,.12); }
.range-custom { display:flex; gap:6px; align-items:center; }
input[type=date] {
  height:28px; border:none; border-radius:8px; font:inherit;
  font-size:12px; font-weight:550; padding:0 8px; background:#e7e7e7;
}
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline:2px solid #005bd3; outline-offset:1px;
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition:none; }
}
/* Long partner names must never break layout (Cole 2026-09-01) */
.page-title { word-break:break-word; min-width:0; }
.user-chip { min-width:0; }
.user-chip .uname { max-width:200px; overflow:hidden; text-overflow:ellipsis;
  white-space:nowrap; }
.brand-name { max-width:260px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.linkbox { overflow-wrap:anywhere; }
.tbl td { overflow-wrap:anywhere; }
/* Multi-select partner filter (Analytics) */
.multi-pick { position:relative; display:inline-block; }
.multi-pick > summary { list-style:none; cursor:pointer; }
.multi-pick > summary::-webkit-details-marker { display:none; }
/* r6: anchor to the RIGHT edge (was cut off on the right), fixed height
   with the option list scrolling and Apply/Clear pinned as a footer. */
.multi-panel { position:absolute; z-index:30; top:calc(100% + 4px); right:0;
  left:auto; background:#fff; border:1px solid #d5d8dc; border-radius:10px;
  width:260px; max-height:min(70vh,360px); display:flex; flex-direction:column;
  box-shadow:0 10px 30px rgba(20,28,45,.16); }
.multi-opts { overflow:auto; padding:8px; flex:1; }
.multi-foot { display:flex; gap:8px; padding:8px; border-top:1px solid #ececec;
  background:#fafafa; border-radius:0 0 10px 10px; }
.multi-opt { display:flex; gap:8px; align-items:center; padding:6px;
  border-radius:6px; white-space:nowrap; cursor:pointer; font-size:13px; }
.multi-opt:hover { background:#f4f6f8; }
/* Commission calculator: itemized line items (portal Orders) */
.calc > summary { cursor:pointer; }
.calc-body { margin-top:6px; min-width:250px; font-size:12px; }
.calc-row { display:flex; justify-content:space-between; gap:16px; padding:4px 0;
  border-bottom:1px solid #f1f1f1; color:#4a4a4a; }
.calc-row.calc-total { border-top:1px solid #d5d8dc; border-bottom:none;
  margin-top:2px; padding-top:6px; font-weight:650; color:#1a1a1a; }
