/* MH AdX brand (from mhadx.com and the apply portal): navy #050912, panels #0b1423/#0e1b2d,
   blue #1677ff -> #075be1, cyan #24d5ff, green #64e2a0, Inter. Content stays light unless the
   viewer prefers dark; the sidebar, top bar and sign-in pages always wear the navy brand look. */
:root {
  color-scheme: light;
  --bg: #f4f7fc;
  --surface: #ffffff;
  --surface-2: #eef3fa;
  --border: #dfe6f0;
  --text: #0b1423;
  --text-2: #4b5a70;
  --text-3: #74839a;
  --accent: #1677ff;
  --accent-ink: #075be1;
  --accent-soft: #e8f1ff;
  --good: #0f8a4f;
  --amber: #b25e00; --violet: #6d4ad8; --maroon: #9b1c3c;
  --bad: #d23f3f;
  --warn-bg: #fff4dc;
  --warn-ink: #7a4d00;
  --grid: #e9eef5;
  --focus: rgba(22,119,255,.22);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(11,20,35,.04), 0 4px 14px rgba(11,20,35,.04);
  --shadow-hover: 0 2px 4px rgba(11,20,35,.05), 0 12px 28px rgba(11,20,35,.08);
  --brand-grad: linear-gradient(100deg, #1677ff, #075be1);
  --tab-grad: linear-gradient(110deg, #1b6ff3, #1fa7f3);
  --navy: #050912;
  --navy-line: rgba(132,166,213,.16);
  --navy-text: #c4d1e2;
  --navy-muted: #a8b6ca;
  --glow: radial-gradient(ellipse at 100% 0%, rgba(13,94,202,.24), transparent 55%);
  --ease: cubic-bezier(.2,.8,.2,1);
}
/* Navy brand tokens: dark mode, and always for the sidebar and sign-in pages */
:root[data-theme="dark"], .sidebar, .auth {
  color-scheme: dark;
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a8b6ca' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --bg: #050912; --surface: #0b1423; --surface-2: #0e1b2d; --border: rgba(132,166,213,.18);
  --text: #f4f7fc; --text-2: #a8b6ca; --text-3: #7d8ca3;
  --accent: #287cff; --accent-ink: #8ab8ff; --accent-soft: rgba(27,111,243,.16);
  --good: #64e2a0; --bad: #ff8a8a; --amber: #ffc46b; --violet: #b9a6ff; --maroon: #ff8fb0; --warn-bg: rgba(251,191,36,.12); --warn-ink: #fde7b0; --grid: rgba(132,166,213,.12);
  --focus: rgba(36,213,255,.18);
  --shadow: none;
  --shadow-hover: 0 12px 30px rgba(0,0,0,.35);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a8b6ca' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --bg: #050912; --surface: #0b1423; --surface-2: #0e1b2d; --border: rgba(132,166,213,.18);
    --text: #f4f7fc; --text-2: #a8b6ca; --text-3: #7d8ca3;
    --accent: #287cff; --accent-ink: #8ab8ff; --accent-soft: rgba(27,111,243,.16);
    --good: #64e2a0; --bad: #ff8a8a; --amber: #ffc46b; --violet: #b9a6ff; --maroon: #ff8fb0; --warn-bg: rgba(251,191,36,.12); --warn-ink: #fde7b0; --grid: rgba(132,166,213,.12);
    --focus: rgba(36,213,255,.18);
    --shadow: none;
    --shadow-hover: 0 12px 30px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -.025em; }
h2 { font-size: 15px; font-weight: 650; margin: 0 0 12px; letter-spacing: -.01em; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* Shell */
.brand { font-weight: 700; font-size: 16px; color: var(--text); display: flex; align-items: center; gap: 10px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { display: block; width: auto; height: 24px; flex: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card, .stack > * + * { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.grid-2 > .card + .card { margin-top: 0; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1000px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; text-align: left; font: inherit; color: inherit; cursor: pointer; box-shadow: var(--shadow); }
.kpi:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.kpi.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), 0 8px 22px rgba(22,119,255,.12); background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), var(--surface) 65%); }
.kpi.selected .kpi-label { color: var(--accent-ink); font-weight: 500; }
.kpi-label { color: var(--text-2); font-size: 12.5px; }
.kpi-value { font-size: 24px; font-weight: 700; margin: 2px 0; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi:first-child .kpi-value { font-size: 28px; }
.delta { font-size: 12px; color: var(--text-3); }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 2px; }
.seg a, .seg button { padding: 5px 11px; border-radius: 9px; color: var(--text-2); font-size: 13px; font-weight: 500; background: none; border: 0; cursor: pointer; font-family: inherit; }
.seg a:hover, .seg button:hover { text-decoration: none; color: var(--text); background: var(--surface-2); }
.seg .active, .seg .active:hover { background: var(--tab-grad); color: #fff; box-shadow: 0 2px 8px rgba(22,119,255,.25); }
.custom-range { display: none; gap: 6px; align-items: center; }
.custom-range.open { display: inline-flex; }

/* Forms */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid color-mix(in srgb, var(--text-3) 35%, var(--border)); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit;
}
.filters input[type=date], .filters select, .inline select { width: auto; padding: 5px 8px; }
.filters input[type=text], .filters input[type=email], .filters input[type=search] { padding: 5px 8px; }
.bulk-bar select, .bulk-bar input[type=text] { width: auto; padding: 5px 8px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid color-mix(in srgb, var(--text-3) 30%, var(--border)); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); text-decoration: none; }
.btn-primary { background: var(--brand-grad); border-color: rgba(90,177,255,.4); color: #fff; box-shadow: 0 6px 18px rgba(22,119,255,.2); }
.btn-primary:hover { background: var(--brand-grad); border-color: rgba(90,177,255,.6); box-shadow: 0 10px 26px rgba(22,119,255,.32); filter: brightness(1.06); }
.btn-danger { color: var(--bad); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }

/* Tables: fit their card on desktop (cells wrap), stacked cards on phones (see the 700px block at the end) */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
th { font-size: 12px; font-weight: 500; color: var(--text-2); }
td { overflow-wrap: anywhere; }
td.num, td .badge, td .btn { overflow-wrap: normal; }
tbody tr:hover { background: var(--surface-2); }
tfoot td { font-weight: 600; border-bottom: 0; }

/* Misc */
.badge { display: inline-block; white-space: nowrap; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--text-2); }
.badge-good { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.badge-bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); }
.alert { padding: 10px 14px; border-radius: 12px; margin-bottom: 16px; background: var(--accent-soft); color: var(--accent-ink); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.alert-error { background: color-mix(in srgb, var(--bad) 10%, transparent); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.alert-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: color-mix(in srgb, var(--warn-ink) 22%, transparent); }
/* Icons on notice boxes: info by default, warning, error and success. Announcements draw their own; the acting bar has none. */
.alert:not(.announcement):not(.acting-bar) { position: relative; padding-left: 40px; }
.alert:not(.announcement):not(.acting-bar)::before { content: ""; position: absolute; left: 13px; top: 11px; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--alert-icon) center / contain no-repeat; mask: var(--alert-icon) center / contain no-repeat; }
.alert { --alert-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E"); }
.alert-warn { --alert-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E"); }
.alert-error { --alert-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m15 9-6 6M9 9l6 6'/%3E%3C/svg%3E"); }
.alert-ok { --alert-icon: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m8 12 3 3 5-6'/%3E%3C/svg%3E"); }
.chart-box { position: relative; height: 300px; }
.empty { padding: 40px 0; text-align: center; color: var(--text-3); }
.card.empty { padding: 40px 18px; }
.tabs-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs-row h2 { margin: 0; }

/* Auth */
body:has(> .auth) { background: #050912; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; color: var(--text); background: radial-gradient(ellipse at 80% -10%, rgba(13,94,202,.28), transparent 50%), radial-gradient(ellipse at 10% 110%, rgba(36,213,255,.08), transparent 45%), #050912; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .brand { justify-content: center; margin-bottom: 20px; font-size: 18px; }
.auth-card .brand-mark { height: 28px; }
.auth .card { background: linear-gradient(145deg, rgba(14,27,45,.9), rgba(7,13,24,.94)); border-color: rgba(132,166,213,.2); box-shadow: 0 24px 60px rgba(0,0,0,.4), 0 0 0 1px rgba(36,213,255,.04); padding: 24px; }
.auth input:not([type=checkbox]):not([type=radio]) { background: #060c17; border-color: rgba(132,166,213,.28); padding: 10px 12px; }
.auth input:focus { border-color: #24d5ff; }
.auth .btn-primary { padding: 10px 16px; }
.auth a { color: #8ab8ff; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.google-btn svg { width: 18px; height: 18px; }

@media (max-width: 700px) {
  .user-name { display: none; }
  .seg a, .seg button { white-space: nowrap; }
  .page-head .filters { width: 100%; }
}

/* Sidebar shell */
body.has-sidebar { display: block; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 236px; background: radial-gradient(ellipse at 100% 0%, rgba(13,94,202,.26), transparent 45%), var(--navy); color: var(--text); border-right: 1px solid var(--navy-line); padding: 16px 12px; overflow-y: auto; z-index: 30; }
.sidebar .brand { padding: 6px 8px 14px; }
.sidebar-partner { padding: 0 8px 12px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; border: 1px solid transparent; color: var(--navy-text); }
.side-nav a:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.side-nav a.active { background: rgba(27,111,243,.16); border-color: rgba(27,111,243,.45); color: #8ab8ff; font-weight: 600; }
.side-nav a .icon { opacity: .85; }
.side-nav a.active .icon { opacity: 1; color: #24d5ff; }
.side-nav .count { margin-left: auto; background: var(--brand-grad); color: #fff; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 0 7px; line-height: 18px; }
.icon { width: 18px; height: 18px; flex: none; }
.main { margin-left: 236px; min-height: 100vh; }
.header { position: sticky; top: 0; z-index: 20; height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: rgba(5,9,18,.94); color: var(--navy-text); border-bottom: 1px solid var(--navy-line); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.header .btn { background: rgba(255,255,255,.04); border-color: var(--navy-line); color: #e7effa; }
.header .btn:hover { background: rgba(255,255,255,.09); border-color: rgba(132,166,213,.32); }
.header-spacer { flex: 1; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 0; background: none; color: var(--text-2); cursor: pointer; list-style: none; }
.icon-btn::-webkit-details-marker { display: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.header .icon-btn { color: var(--navy-text); }
.header .icon-btn:hover, .header .bell[open] > .icon-btn { background: rgba(255,255,255,.07); color: #fff; }
.icon-btn .dot { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 600; line-height: 17px; text-align: center; }
.menu-btn { display: none; }
/* Row actions: a ⋯ button that opens a small menu (placed with JS so table scrolling can't clip it). */
.row-menu { display: inline-block; }
.row-menu > summary { width: 32px; height: 32px; }
.row-menu[open] > summary { background: var(--surface-2); color: var(--text); }
.row-menu > .row-menu-list { display: none; }
.row-menu-list { position: fixed; z-index: 60; min-width: 170px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 18px 44px rgba(5,9,18,.18), 0 2px 6px rgba(5,9,18,.06); text-align: left; }
.row-menu-list form { margin: 0; }
.row-menu-list a, .row-menu-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.row-menu-list a:hover, .row-menu-list button:hover { background: var(--surface-2); }
.row-menu-list svg { flex: none; color: var(--text-2); }
.row-menu-list .danger, .row-menu-list .danger svg { color: var(--bad); }
td.cell-actions:has(.row-menu), table:has(td.cell-actions .row-menu) thead th:last-child { width: 1px; white-space: nowrap; }
.tabs-row.row-head { flex-wrap: nowrap; align-items: flex-start; }
.tabs-row.row-head > :first-child { flex: 1; min-width: 0; }
.row-menu-backdrop { position: fixed; inset: 0; z-index: 59; background: rgba(5,9,18,.38); }
@media (max-width: 700px) {
  /* Phones: the ⋯ column stays pinned on the right while a wide table swipes, and the menu opens as a bottom sheet. */
  .container table td.cell-actions:has(.row-menu), .container table:has(.row-menu) thead th:last-child { position: sticky; right: 0; background: var(--surface); box-shadow: -10px 0 12px -10px rgba(5,9,18,.25); }
  .row-menu > summary { width: 40px; height: 40px; }
  .row-menu-list { left: 8px !important; right: 8px !important; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom)); min-width: 0; padding: 8px; border-radius: 16px; }
  .row-menu-list a, .row-menu-list button { padding: 14px 12px; font-size: 16px; gap: 14px; }
  .row-menu-list svg { width: 20px; height: 20px; }
}
.bell { position: relative; }
.bell-panel { position: absolute; right: 0; top: 44px; width: min(360px, calc(100vw - 32px)); max-height: 70vh; overflow-x: hidden; overflow-y: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 18px 44px rgba(5,9,18,.18), 0 2px 6px rgba(5,9,18,.06); transform-origin: top right; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.bell-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.bell-item:hover { background: var(--surface-2); text-decoration: none; }
.bell-item.unread { background: var(--accent-soft); }
.bell-title { font-weight: 500; }
.bell-foot { display: block; text-align: center; padding: 10px; }
.bell-panel { z-index: 50; }
.bell-item, .bell-head { overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .bell[open] > summary::before { content: ""; position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.25); cursor: default; }
  .bell-panel { position: fixed; top: 64px; left: 12px; right: 12px; width: auto; max-height: calc(100dvh - 80px); -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .bell-item { padding: 14px 16px; }
  .bell-head, .bell-foot { padding: 14px 16px; }
  .bell-head .link-btn { padding: 6px 0; }
}
.link-btn { background: none; border: 0; color: var(--accent-ink); cursor: pointer; font: inherit; padding: 0; }
.sidebar-backdrop { display: none; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 700px) { .stat-grid { grid-template-columns: 1fr; } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat.hero { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), var(--surface) 65%); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.stat .kpi-value { font-size: 26px; }
.kpi-sep { margin: 0 6px; color: var(--text-3); font-weight: 400; }
.stat-grid > .span-2 { grid-column: span 2; }
@media (max-width: 700px) { .stat-grid > .span-2 { grid-column: auto; } }
.stat-grid.stat-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .stat-grid.stat-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .stat-grid.stat-grid-4 .kpi-value { font-size: 20px; } .stat-grid.stat-grid-4 .stat { padding: 12px; } }
.quick-actions.span-2 .quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 700px) { .quick-actions.span-2 .quick-grid { grid-template-columns: 1fr 1fr; } }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.quick-grid .btn { justify-content: center; text-align: center; padding-left: 8px; padding-right: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.hero .kpi-value { font-size: 32px; color: var(--accent-ink); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.badge-neutral { background: var(--surface-2); color: var(--text-2); }
.notif-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.notif-row.unread .bell-title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: middle; }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
}

/* Security page */
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; margin: 10px 0 0; padding: 0; list-style: none; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }
.qr { width: 192px; height: 192px; padding: 8px; background: #fff; border-radius: 8px; border: 1px solid var(--border); margin: 8px 0; box-sizing: content-box; }
.qr svg { display: block; width: 100%; height: 100%; }
.secret { font-size: 13px; word-break: break-all; }
.steps { margin: 0 0 8px; padding-left: 20px; color: var(--text-2); }
.steps li { margin-bottom: 4px; }
a.user-name { color: var(--text-2); }
.header a.user-name { color: var(--navy-muted); }
.header a.user-name:hover { color: #fff; }

/* Health, tags and admin notes */
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; line-height: 18px; margin: 1px 2px 1px 0; text-decoration: none; white-space: nowrap; }
.tag-chip button { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; font-size: 12px; opacity: .8; }
.notes { list-style: none; padding: 0; margin: 8px 0; }
.notes li { border-left: 3px solid var(--surface-2); padding: 4px 10px; margin-bottom: 8px; }
.notes .note-body { white-space: pre-line; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
/* Announcements and support */
.announcement { display: flex; align-items: flex-start; gap: 12px; }
.announcement-icon { flex: none; display: inline-flex; margin-top: 1px; }
#a-preview .icon-warning, #a-preview.alert-warn .icon-info { display: none; }
#a-preview.alert-warn .icon-warning { display: inline; }
.announcement-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.announcement-close { width: 28px; height: 28px; margin: -4px -6px -4px 0; font-size: 20px; line-height: 1; color: inherit; }
.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); max-width: 85%; }
.msg-mine { align-self: flex-end; background: var(--accent-soft); }
.msg-head { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; margin-bottom: 6px; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-file { margin-top: 8px; font-size: 13px; }
@media (max-width: 640px) { .msg { max-width: 100%; } }
/* Payout details (admin) */
.payout-details dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0; }
.payout-details dd { margin: 0; word-break: break-all; font-variant-numeric: tabular-nums; }

/* Finishing pass: spacing between page blocks, readable tables and tiles on phones */
.container > * + :is(.card, .grid-2, form, .stat-grid) { margin-top: 16px; }
.card + .hint { margin-top: 10px; }
code { overflow-wrap: anywhere; }
td.wrap { min-width: 180px; }
@media (max-width: 700px) {
  .seg a, .seg button { padding: 5px 7px; font-size: 12px; }
  .filters > input[type=text], .filters > input[type=email], .filters > input[type=search] { width: 100% !important; }
}
@media (max-width: 600px) {
  .kpi { padding: 12px 14px; }
  .kpi-value, .kpi:first-child .kpi-value { font-size: 21px; }
}

/* No visible scrollbars: boxes that scroll keep scrolling, without the bar */
.sidebar, .bell-panel, .scroll-y { scrollbar-width: none; -ms-overflow-style: none; }
.sidebar::-webkit-scrollbar, .bell-panel::-webkit-scrollbar, .scroll-y::-webkit-scrollbar { display: none; }
.scroll-y { max-height: 320px; overflow-x: hidden; overflow-y: auto; }

/* Payout run: two inputs stacked in one cell; payout details as one column inside tables */
.stack-inputs { display: flex; flex-direction: column; gap: 6px; }
td .payout-details dl { grid-template-columns: minmax(0, 1fr); gap: 0; }
td .payout-details dt { margin-top: 4px; }
td .payout-details dl { line-height: 1.35; }
@media (min-width: 701px) {
  table.align-top td { vertical-align: top; }
  table.align-top td:not(:has(input, .payout-details)) { padding-top: 17px; }
  table.align-top td.cell-check { padding-top: 19px; }
}

/* Key/value tables (a th and a td per row) */
table.kv th { width: 34%; vertical-align: top; }
table.kv td { vertical-align: top; }

/* Phones: tables stay tables; a wide one swipes sideways inside its card with no visible scrollbar */
@media (max-width: 700px) {
  .card { padding: 14px; }
  .container table:not(.kv) { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; scrollbar-width: none; }
  .container table:not(.kv)::-webkit-scrollbar { display: none; }
  .container table:not(.kv) th, .container table:not(.kv) td { white-space: nowrap; }
  .container table:not(.kv) td.empty { white-space: normal; }
  .container table:not(.kv) td:has(.payout-details), .container table:not(.kv) td:has(details:not(.row-menu)) { white-space: normal; min-width: 220px; }
  table.kv, table.kv tbody, table.kv tr, table.kv th, table.kv td { display: block; width: 100%; }
  table.kv th { border: 0; padding: 8px 0 0; }
  table.kv td { padding: 2px 0 8px; }
  .payout-details dl { grid-template-columns: 1fr; gap: 0; }
  .payout-details dt { margin-top: 4px; }
}
.nowrap { white-space: nowrap; overflow-wrap: normal; }

/* Motion: quick and quiet, only for viewers who have not asked for reduced motion */
@keyframes mh-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes mh-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes mh-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .container > * { animation: mh-rise .28s var(--ease) both; }
  .container > :nth-child(2) { animation-delay: .03s; }
  .container > :nth-child(3) { animation-delay: .06s; }
  .container > :nth-child(4) { animation-delay: .09s; }
  .container > :nth-child(5) { animation-delay: .12s; }
  .container > :nth-child(n+6) { animation-delay: .15s; }
  .auth-card { animation: mh-rise .3s var(--ease) both; }
  details.bell[open] > .bell-panel { animation: mh-pop .18s var(--ease); }
  .bell[open] > summary::before { animation: mh-fade .18s ease; }
  a, .link-btn { transition: color .15s ease; }
  .btn { transition: background-color .18s ease, border-color .18s ease, box-shadow .2s ease, transform .15s var(--ease), filter .18s ease; }
  .btn-primary:hover { transform: translateY(-1px); }
  .btn:active, .btn-primary:active, .link-btn:active, .icon-btn:active { transform: translateY(0) scale(.97); transition-duration: .08s; }
  .icon-btn { transition: background-color .15s ease, color .15s ease, transform .15s var(--ease); }
  .seg a, .seg button { transition: background-color .2s ease, color .2s ease, box-shadow .2s ease; }
  .side-nav a { transition: background-color .18s ease, color .18s ease, border-color .18s ease; }
  .side-nav a .icon { transition: opacity .18s ease, color .18s ease; }
  .card { transition: box-shadow .25s ease, border-color .25s ease; }
  .kpi, .stat { transition: transform .22s var(--ease), box-shadow .22s ease, border-color .2s ease; }
  .kpi:hover, .stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
  .kpi.selected:hover { box-shadow: inset 0 0 0 1px var(--accent), var(--shadow-hover); }
  .kpi:active { transform: translateY(0) scale(.99); }
  input, select, textarea { transition: border-color .15s ease, box-shadow .15s ease; }
  tbody tr { transition: background-color .15s ease; }
  .bell-item { transition: background-color .15s ease; }
  .alert { animation: mh-rise .25s var(--ease) both; }
  @media (max-width: 900px) {
    .sidebar { transition: transform .22s var(--ease); }
    body.nav-open .sidebar-backdrop { animation: mh-fade .2s ease; }
  }
}

/* Pop-up form (bottom sheet on phones) */
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
dialog.sheet { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow-hover); overflow: auto; }
dialog.sheet::backdrop { background: rgba(5, 9, 18, .55); }
dialog.sheet form { padding: 20px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sheet-head h2 { margin: 0; }
.sheet-close { background: none; border: 0; color: var(--text-3); font-size: 26px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.sheet-close:hover { color: var(--text); background: var(--surface-2); }
.sheet .field input, .sheet .field select, .sheet .field textarea { width: 100%; font-size: 16px; padding: 10px 12px; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.service-email { display: grid; gap: 8px; font-size: 14px; }
.copy-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.copy-row code { flex: 1; min-width: 0; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 13px; color: var(--text); }
.copy-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--accent-ink); cursor: pointer; }
.copy-btn:hover { border-color: var(--accent); }
.copy-btn.copied { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (max-width: 700px) {
  dialog.sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--radius) var(--radius) 0 0; max-height: 92dvh; }
  dialog.sheet form { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .sheet-actions .btn { flex: 1; }
  .head-actions { width: 100%; }
  .head-actions > .btn, .head-actions .inline, .head-actions .inline .btn { flex: 1; }
}
@media (prefers-reduced-motion: no-preference) {
  dialog.sheet[open] { animation: mh-sheet .22s var(--ease, ease); }
  @keyframes mh-sheet { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
}

/* Dropdowns */
:root { --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2374839a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
select:not([multiple]) {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  padding-right: 34px !important; min-height: 38px;
  background-image: var(--chev); background-repeat: no-repeat; background-position: right 12px center; background-size: 12px;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.filters select:not([multiple]), .inline select:not([multiple]), .bulk-bar select:not([multiple]) { min-height: 34px; padding-right: 30px !important; background-position: right 10px center; }
select:not([multiple]):hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background-color: var(--surface-2); }
select:disabled { opacity: .6; cursor: not-allowed; }
select option { background: var(--surface); color: var(--text); }

/* File upload drop zones (enhanced by the script in the layout) */
.dropzone { position: relative; display: flex; align-items: center; gap: 14px; padding: 16px; border: 1.5px dashed color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); cursor: pointer; transition: border-color .15s, background-color .15s, box-shadow .15s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.is-over { box-shadow: 0 0 0 3px var(--focus); }
.dropzone:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--brand-grad); color: #fff; box-shadow: 0 6px 16px rgba(22,119,255,.22); }
.dropzone-text { min-width: 0; display: grid; gap: 2px; font-size: 14px; }
.dropzone-text strong { font-weight: 600; color: var(--text); }
.dropzone-text strong u { color: var(--accent-ink); text-decoration: none; }
.dropzone-text small { color: var(--text-3); font-size: 12px; }
.dropzone.has-file .dropzone-text strong { overflow-wrap: anywhere; }
.dropzone-clear { position: relative; z-index: 1; margin-left: auto; flex: none; border: 0; background: none; color: var(--text-3); font-size: 20px; line-height: 1; padding: 4px 8px; border-radius: 8px; cursor: pointer; }
.dropzone-clear:hover { color: var(--text); background: var(--surface-2); }
.dropzone:not(.has-file) .dropzone-clear { display: none; }

/* Details from the API, under each child account */
.api-details { margin-top: 4px; min-width: 260px; max-width: 420px; }
.api-details .api-source { margin-top: 8px; }
.api-fields { margin: 4px 0 0; }
.api-fields dt { color: var(--text-3); margin-top: 6px; }
.api-fields dd { margin: 0; overflow-wrap: anywhere; }

/* Status badges: one colour per status, with a dot, same size everywhere */
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 9px; border-radius: 8px; font-size: 12.5px; font-weight: 600; line-height: 16px; border: 1px solid color-mix(in srgb, currentColor 22%, transparent); }
.status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.status-badge.badge-good { background: color-mix(in srgb, var(--good) 13%, transparent); color: var(--good); }
.status-badge.badge-accent { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent-ink); }
.status-badge.badge-warn { background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber); }
.status-badge.badge-bad { background: color-mix(in srgb, var(--bad) 13%, transparent); color: var(--bad); }
.status-badge.badge-muted { background: color-mix(in srgb, var(--violet) 13%, transparent); color: var(--violet); }
.status-badge.badge-closed { background: color-mix(in srgb, var(--maroon) 13%, transparent); color: var(--maroon); }
.status-badge.badge-neutral { background: var(--surface-2); color: var(--text-2); }

/* Selects inside table rows (partner assign and similar): a proper, even-sized control */
td select:not([multiple]), td .inline select:not([multiple]), select.assign-select { width: auto; min-width: 150px; max-width: 220px; min-height: 36px; padding: 6px 32px 6px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 500; background-color: var(--surface); box-shadow: 0 1px 2px rgba(11,20,35,.05); }
select.assign-select:has(option[value=""]:checked) { color: var(--text-3); }
td .btn-sm { min-height: 32px; border-radius: 9px; }
td.cell-main { min-width: 200px; }
td[data-label="MCM"], td[data-label="Status"], td[data-label="Network code"] { min-width: 110px; overflow-wrap: normal; word-break: normal; }
td[data-label="Status"] { white-space: nowrap; }

/* Admin → account page: label / value pairs */
.details-grid { display: grid; grid-template-columns: repeat(2, max-content minmax(0, 1fr)); gap: 10px 16px; margin: 0 0 8px; }
.details-grid dt { color: var(--text-2); font-size: 13px; }
.details-grid dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 800px) { .details-grid { grid-template-columns: max-content minmax(0, 1fr); } }
.card + .kpis { margin-top: 16px; }
.split-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin: 12px 0 4px; }
.split-form label.field { margin-bottom: 0; }
.split-form input { width: 140px; }
.table-x { max-width: 100%; overflow-x: auto; }

/* Account flags (high unfilled or deductions) */
.flag-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 8px; font-size: 11.5px; font-weight: 600; line-height: 16px; white-space: nowrap; color: var(--bad); background: color-mix(in srgb, var(--bad) 13%, transparent); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); }

/* Screening and Portfolio */
.inline-field { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.inline-field span { font-size: 12.5px; color: var(--text-2); }
.inline-field select { width: auto; padding: 5px 28px 5px 10px; font-size: 13px; }
td.is-bad { color: var(--bad); font-weight: 600; }
/* CTR and unfilled colours (Fmt::ctrTone / unfilledTone). */
.tone-good { color: var(--good); font-weight: 600; }
.tone-warn { color: var(--amber); font-weight: 600; }
.tone-bad { color: var(--bad); font-weight: 600; }
table.screening td.signals { min-width: 180px; max-width: 250px; white-space: normal; }
table.screening td.signals .flag-badge { margin: 1px 4px 1px 0; }
table.screening td.country { white-space: nowrap; }
table.screening td.cell-main { min-width: 170px; }
.share { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.share-bar { flex: 1; min-width: 56px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.share-bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.share > .num { min-width: 46px; font-size: 12.5px; }
table.shares td[data-label="Share"] { min-width: 136px; }
.grid-2 .table-x table { min-width: 100%; }
@media (max-width: 700px) { .portfolio-stats .kpi-value { font-size: 20px; } }
@media print {
  .sidebar, .header, .no-print, .menu-btn { display: none !important; }
  body, .container { background: #fff !important; color: #000 !important; margin: 0; padding: 0; max-width: none; }
  body.has-sidebar .container { margin-left: 0 !important; }
  .card, .stat { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; background: #fff !important; color: #000 !important; }
  .kpi-label, .delta, .muted { color: #444 !important; }
  .share-bar { background: #eee; } .share-bar i { background: #1677ff; }
  .grid-2 { display: block; } .grid-2 > .card { margin-top: 12px; }
}

/* Custom alert rules (Admin → Alerts) */
table.alert-rules tr.is-off td { color: var(--text-3); }
table.alert-rules td.row-actions { white-space: nowrap; }
table.alert-rules th:first-child, table.alert-rules td.cell-main { min-width: 140px; }
table.alert-rules td.row-actions .btn-sm { margin-right: 4px; vertical-align: middle; }
table.withdraw-rules td:nth-child(2) { min-width: 210px; }
.field > span > em { font-style: normal; font-weight: 400; }

/* Card heading with an action beside it (Alerts → Mark all read) */
.card-title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 12px; }
.card-title-row h2 { margin: 0; }
tr.unread > td.cell-main::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: middle; }

/* Live search: hidden rows and items stay hidden even where tables turn into cards on phones */
[data-search][hidden], tr[hidden] { display: none !important; }

/* Search box above a table (filters rows as you type). */
.table-search { display: block; width: 100%; max-width: 340px; margin-bottom: 12px; }

/* Admin → Leads: "More" panel per row (status, note, email again, every form answer) */
details.lead-more > summary { list-style: none; }
details.lead-more > summary::-webkit-details-marker { display: none; }
details.lead-more[open] .lead-panel { display: flex; }
.lead-panel { display: none; flex-direction: column; gap: 8px; margin-top: 8px; padding: 10px; min-width: 240px; max-width: 360px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); text-align: left; white-space: normal; }
.lead-panel label { display: flex; flex-direction: column; gap: 4px; }
.lead-panel select, .lead-panel textarea { width: 100%; }
.lead-answers { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin: 0; }
.lead-answers dt { color: var(--text-2); margin-top: 6px; }
.lead-answers dt:first-child { margin-top: 0; }
.lead-answers dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 700px) {
  /* Phones: WhatsApp / More stay pinned on the right while the row swipes */
  #leads-table td.cell-actions, #leads-table thead th:last-child { position: sticky; right: 0; background: var(--surface); box-shadow: -10px 0 12px -10px rgba(5,9,18,.25); }
  .container #leads-table td.cell-actions { min-width: 0; width: 1%; }
  #leads-table td.cell-actions .actions { flex-direction: column; align-items: stretch; }
  .container #leads-table td.cell-actions:has(details.lead-more[open]) { min-width: 250px; }
  .lead-panel { min-width: 0; max-width: none; box-sizing: border-box; }
}
/* Admin → Auto withdraw */
.aw-match { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 8px; font-weight: 400; }
.aw-match select, .aw-match .aw-days { width: auto; min-width: 0; }
.aw-match .aw-days { width: 72px; }
.aw-condition { display: grid; grid-template-columns: minmax(0, 1fr) 96px 110px 18px 36px; gap: 6px; align-items: center; margin-bottom: 8px; }
.aw-condition .aw-remove { padding: 0; height: 36px; }
@media (max-width: 560px) {
  .aw-condition { grid-template-columns: 96px minmax(0, 1fr) 18px 36px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
  .aw-condition [data-k=metric] { grid-column: 1 / -1; }
}
.aw-modes { border: 0; padding: 0; margin: 0 0 12px; }
.aw-modes .check { align-items: flex-start; }
.aw-modes .muted { font-size: 12.5px; }
.aw-scope { margin: 4px 0 14px; }
.aw-scope summary { cursor: pointer; font-weight: 500; margin-bottom: 8px; }
.aw-checks { display: flex; flex-wrap: wrap; gap: 4px 14px; max-height: 160px; overflow-y: auto; font-weight: 400; }
.aw-hit { padding: 6px 0; border-top: 1px solid var(--border); }
.aw-hit:first-of-type { border-top: 0; }
table.withdraw-rules td:nth-child(3) { min-width: 200px; }
.aw-sheet [hidden] { display: none !important; }
.aw-block { margin-bottom: 14px; }
.aw-label { font-weight: 500; font-size: 13.5px; margin-bottom: 6px; padding: 0; }
.aw-sheet .aw-match select, .aw-sheet .aw-match input { width: auto; display: inline-block; margin: 0; }
.aw-sheet .aw-match .aw-days { width: 72px; }
.aw-modes .check { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 6px; }
.aw-modes .check input { width: auto; margin-top: 3px; flex: none; }
.aw-modes .check .muted { display: block; }
.aw-checks .check input { width: auto; }
#risk-card[hidden] { display: none; }
.risk-table td:nth-child(2) { min-width: 120px; }
.risk-table td:nth-child(3) { min-width: 180px; }
.risk-score { display: flex; align-items: center; gap: 8px; }
.risk-score strong { min-width: 26px; font-variant-numeric: tabular-nums; }
.risk-bar { flex: 1; min-width: 60px; max-width: 120px; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.risk-bar span { display: block; height: 100%; border-radius: 3px; background: var(--good, #16a34a); }
.risk-medium strong { color: var(--amber); } .risk-medium .risk-bar span { background: var(--amber); }
.risk-high strong { color: var(--bad); } .risk-high .risk-bar span { background: var(--bad); }
.page-actions #risk-toggle { margin-right: 8px; }

/* Publisher portal (app.mhadx.com) */
.code-block { flex: 1; min-width: 0; margin: 0; max-height: 360px; overflow: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.5; color: var(--text); white-space: pre; }
.copy-row:has(.code-block) { align-items: flex-start; }
.onboard { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 12px; }
.onboard li { counter-increment: step; position: relative; padding-left: 38px; }
.onboard li::before { content: counter(step); position: absolute; left: 0; top: -2px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: var(--accent-soft); color: var(--accent-ink); }
.onboard li.done::before { content: "✓"; background: var(--accent); color: #fff; }
.onboard li > div { margin-top: 6px; }
details.unit-edit, details.add-unit { text-align: left; }
details.unit-edit > summary, details.add-unit > summary { list-style: none; display: inline-flex; }
details.unit-edit > summary::-webkit-details-marker, details.add-unit > summary::-webkit-details-marker { display: none; }
details.add-unit { margin-top: 14px; }
details.unit-edit[open] { min-width: min(320px, 80vw); }
.unit-form { margin: 10px 0; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.unit-form .field input, .unit-form .field select { width: 100%; }
.unit-id-field { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.unit-id-field input { width: 120px; }

/* Publisher terms: a wider auth card for long text. */
.auth-card.auth-card-wide { max-width: 760px; }
.terms h3 { font-size: 15px; margin: 22px 0 6px; }
.terms p, .terms li { line-height: 1.6; }
.terms ul { padding-left: 20px; margin: 0 0 12px; }
