:root {
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-2: #f7fafb;
  --text: #16232b;
  --muted: #64757f;
  --line: #e4ebef;
  --line-2: #cfdae0;

  --primary: #12788c;
  --primary-hover: #0e5f70;
  --primary-soft: #e6f2f4;

  --up: #1f8a5f;
  --up-soft: #e7f4ee;
  --down: #b8453c;
  --down-soft: #fbeceb;
  --warn: #96690f;
  --warn-soft: #fbf3e3;
  --flat: #64757f;
  --flat-soft: #eef2f4;

  --google: #3b7ddd;
  --meta: #12788c;
  --bing: #e0913a;
  --other: #b9c5cc;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* Screens are switched with the hidden attribute. Any rule below that sets a
   display would otherwise beat the browser default and leave one screen on top
   of another. This keeps hidden meaning hidden. */
[hidden] { display: none !important; }

body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 13.5px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 13.5px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 12.5px; }

button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

/* One explicit height for both. A native <select> sizes itself from its own
   metrics and ignores the padding an <input> honours, which is why the brand
   and country boxes sat lower than week and year. appearance:none makes the
   select obey the box, and the chevron is drawn back in - inline, so the page
   still fetches nothing. */
input, select {
  font: inherit; width: 100%; height: 34px; padding: 0 10px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: 8px;
  line-height: normal;
}
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2364757f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 9px 6px;
}
/* the four controls share a baseline because the labels above them are one
   line of a fixed height, not merely "usually" one line */
.filters-bar .field label { height: 15px; line-height: 15px; }
input:hover, select:hover { border-color: var(--primary); }
input::placeholder { color: #a7b4bc; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.label-row { display: flex; align-items: baseline; justify-content: space-between;
             margin-top: 12px; }
.label-row label { margin-top: 0; }

/* ================================ LOGIN ================================= */
.login { min-height: 100dvh; background: var(--surface); }
.login-left { min-height: 100dvh; display: grid; place-items: center; padding: 40px 24px; }
.login-inner { width: min(410px, 100%); }

.brandmark { font-size: 44px; font-weight: 700; color: var(--primary);
             letter-spacing: -0.03em; line-height: 1; }
.brandline { font-size: 23px; font-weight: 600; margin-top: 4px; }
.brandsub { color: var(--muted); font-size: 14px; margin-top: 10px; }

.login-box {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 24px; margin-top: 30px;
  display: flex; flex-direction: column;
}
.login-box h2 { margin-bottom: 3px; }
.login-box > label { font-size: 12.5px; font-weight: 500; color: var(--muted);
                     margin-top: 16px; margin-bottom: 6px; }
.login-box input { height: 38px; }
.login-box .label-row + input { margin-top: 6px; }
.login-box button[type="submit"] {
  margin-top: 20px; padding: 11px; border: none; border-radius: 8px;
  background: var(--primary); color: #fff; font-weight: 600; font-size: 15px;
}
.login-box button[type="submit"]:hover { background: var(--primary-hover); }
.login-box button[disabled] { opacity: .55; cursor: default; }

.or { display: flex; align-items: center; gap: 12px; margin: 16px 0 0;
      color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sso {
  margin-top: 16px; padding: 11px; border: 1px solid var(--line-2);
  border-radius: 8px; background: var(--surface); font-weight: 500;
}
.sso:hover:not([disabled]) { border-color: var(--primary); color: var(--primary); }
.login-error {
  margin-top: 14px; padding: 10px 12px; border-radius: 8px;
  background: var(--down-soft); color: var(--down); font-size: 13.5px;
}
.login-note { margin-top: 14px; color: var(--muted); font-size: 12.5px; }

.helps { margin-top: 32px; display: flex; flex-direction: column; gap: 17px; }
.helps h3 { font-size: 14px; margin-bottom: 1px; }
.help { display: flex; gap: 13px; align-items: flex-start; }
.help-icon {
  width: 30px; height: 30px; flex: none; border-radius: 8px;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-size: 13px;
}
.help-body { font-size: 12.5px; color: var(--muted); }
.help-body strong { display: block; color: var(--text); font-size: 13.5px;
                    font-weight: 600; margin-bottom: 2px; }
.login-foot { margin-top: 34px; color: var(--muted); font-size: 12px; }

/* ================================ CHROME =============================== */
.topbar {
  display: flex; align-items: center; gap: 18px; height: 54px; padding: 0 18px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.wordmark { font-weight: 700; font-size: 21px; color: var(--primary);
            letter-spacing: -0.02em; }
.workspace {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px;
  border: 1px solid var(--line-2); border-radius: 8px;
  font-size: 13.5px; color: var(--muted); white-space: nowrap;
}
.tabs { display: flex; gap: 3px; }
.tabs button {
  border: none; background: none; color: var(--muted);
  padding: 8px 12px; border-radius: 8px; font-size: 14px;
}
.tabs button:hover { background: var(--surface-2); color: var(--text); }
.tabs button[aria-current="page"] {
  background: var(--primary-soft); color: var(--primary); font-weight: 600;
}
.account { margin-left: auto; display: flex; align-items: center; gap: 14px;
           font-size: 13.5px; color: var(--muted); }
.bell { font-size: 16px; }
.link { border: none; background: none; color: var(--primary);
        padding: 4px; font-size: 13px; }
.link:hover { text-decoration: underline; }

.view { padding: 16px; max-width: 1560px; margin: 0 auto; }

/* ============================== FILTER BAR ============================= */
.filters-bar {
  display: grid; gap: 10px; align-items: end;
  /* brand, country, the read-only period, the button. minmax(0,...) stops a
     long brand name widening its own column. */
  grid-template-columns: minmax(0, 190px) minmax(0, 190px) auto auto;
  justify-content: start;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 14px;
}

/* ---- the analysis period: shown, never chosen ------------------------- */
/* Styled as a readout rather than a control, so it does not read as a field
   somebody failed to fill in. */
.period {
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px 12px; border-left: 1px solid var(--line);
}
.period-label { font-size: 11px; font-weight: 600; color: var(--muted);
                text-transform: uppercase; letter-spacing: .04em; }
.period-week { font-size: 15px; font-weight: 600; white-space: nowrap; }
.period-note { font-size: 11.5px; color: var(--muted); }
.run-max {
  padding: 8px 18px; border: none; border-radius: 8px;
  background: var(--primary); color: #fff; font-weight: 600; font-size: 14.5px;
  white-space: nowrap;
}
.run-max:hover:not([disabled]) { background: var(--primary-hover); }
.run-max[disabled] { opacity: .5; cursor: default; }
/* A failed start has to be READ, not inferred from nothing happening. It sits
   in the filter bar so it follows the bar into the Run MAX dialog. */
.start-note {
  grid-column: 1 / -1; margin: 2px 0 0; font-size: 13px;
  color: var(--down); background: var(--down-soft);
  border: 1px solid #eecac6; border-radius: 8px; padding: 9px 12px;
}
.start-note[data-tone="muted"] {
  color: var(--muted); background: none; border: none; padding: 2px;
}

/* ================================= KPIS ================================ */
.kpis {
  display: grid; gap: 10px; margin: 12px 0;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 13px;
  display: flex; gap: 10px; align-items: flex-start;
}
.kpi-badge {
  width: 30px; height: 30px; flex: none; border-radius: 8px;
  display: grid; place-items: center; font-size: 13px;
  background: var(--primary-soft); color: var(--primary);
}
.kpi-badge.up { background: var(--up-soft); color: var(--up); }
.kpi-badge.down { background: var(--down-soft); color: var(--down); }
.kpi-badge.warn { background: var(--warn-soft); color: var(--warn); }
.kpi-label { font-size: 11.5px; color: var(--muted); }
.kpi-value { font-size: 19px; font-weight: 600; margin-top: 3px;
             font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi-value.small { font-size: 15px; font-weight: 500; line-height: 1.35;
                   color: var(--muted); }
.kpi-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.kpi-value.up { color: var(--up); } .kpi-value.down { color: var(--down); }
.kpi-sub.up { color: var(--up); } .kpi-sub.down { color: var(--down); }

/* ================================= GRID ================================ */
/* Budget Recommendations beside Current spend vs MAX proposal. Close to even
   so the comparison is readable rather than squeezed into a gutter; the
   recommendations table is compacted below to fit its narrower half without
   sliding sideways. */
.grid { display: grid; gap: 12px; grid-template-columns: 1.15fr 1fr; margin-bottom: 12px; }
.grid-3 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr 1fr; }
/* one card across the full width: the primary decision card and the spend comparison */
.grid-1 { display: grid; gap: 12px; grid-template-columns: 1fr; margin-bottom: 12px; }

.card { background: var(--surface); border: 1px solid var(--line);
        border-radius: 12px; display: flex; flex-direction: column; }
.card-head { display: flex; align-items: center; gap: 9px;
             padding: 11px 14px; border-bottom: 1px solid var(--line); }
.card-num {
  width: 19px; height: 19px; flex: none; border-radius: 6px;
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}
.card-head .muted { margin-left: auto; }
.card-body { padding: 12px 14px; flex: 1; }
.card-foot { padding: 9px 14px; border-top: 1px solid var(--line); }

/* ================================ TABLE ================================ */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
           margin-bottom: 14px; }
.filters .field { min-width: 150px; }
.filters .field-check { min-width: 0; justify-content: flex-end; }
.filters .field-check label { display: flex; align-items: center; gap: 6px; height: 34px; cursor: pointer; }
.filters .field-check input { width: auto; margin: 0; }

/* ================================ ADMIN ================================= */
.kv-grid { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.invite-form { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: end; }
.invite-form .brand-choice { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.invite-form .brand-choice legend { font-size: 12.5px; color: var(--muted); }
.invite-form .check { display: inline-flex; align-items: center; gap: 6px; margin: 4px 14px 4px 0; }
.invite-form .check input { width: auto; margin: 0; }
.field-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; }
.invite-result, .link-box { word-break: break-all; }
.invite-result { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.link-box { display: block; margin-top: 6px; font-size: 12px; user-select: all; }
#admin-users td.actions { white-space: nowrap; }
#admin-users td.actions button { margin-right: 4px; }
.st.deactivated { opacity: .6; }
.activity-controls { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.activity-controls button[aria-pressed="true"] { border-color: var(--primary); }
.activity { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto;
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.activity-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.activity-row.warn { background: rgba(214, 120, 0, .08); }
.activity-at { color: var(--muted); }
.activity-action { font-weight: 600; }
.activity-detail { flex-basis: 100%; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line);
         white-space: nowrap; }
th { font-size: 11px; font-weight: 600; color: var(--muted);
     text-transform: uppercase; letter-spacing: 0.03em; }

/* A bounded, scrollable panel. The header stays put so the columns are still
   named after scrolling. */
.scroll-y { max-height: 176px; overflow-y: auto; }

/* The table is allowed to be wider than its panel: with the decision column it
   no longer fits, and squeezing columns to fit would truncate the numbers a
   person is deciding on. It slides instead. */
.slide-x { overflow-x: auto; }
.slide-x table { min-width: 780px; }

/* COMPACT: the same table in a half-width panel, with no horizontal scroll.
   Nothing is removed - the text columns clip with an ellipsis and keep their
   full value in the title attribute and in the row's detail panel, which is
   where a person reads them anyway. */
.compact-table { overflow-x: hidden; }
.compact-table table { min-width: 0; width: 100%; table-layout: fixed; font-size: 12px; }
.compact-table th, .compact-table td { padding: 6px 7px; }
.compact-table th { font-size: 10px; letter-spacing: 0.02em; }
.compact-table td:not(.num) { overflow: hidden; text-overflow: ellipsis; }
.compact-table .campaign-cell { max-width: 100%; }
/* proportions: identity left, money right, verdicts last */
.compact-table th:nth-child(1) { width: 15%; }
.compact-table th:nth-child(2) { width: 20%; }
.compact-table th:nth-child(3) { width: 13%; }
.compact-table th:nth-child(4),
.compact-table th:nth-child(5) { width: 11%; }
.compact-table th:nth-child(6) { width: 8%; }
.compact-table th:nth-child(7) { width: 9%; }
.compact-table th:nth-child(8) { width: 9%; }
.compact-table th:nth-child(9) { width: 4%; }
/* the Exports listing uses the same compact form, its own proportions */
#exports-body .compact-table th:nth-child(1) { width: 26%; }
#exports-body .compact-table th:nth-child(2) { width: 14%; }
#exports-body .compact-table th:nth-child(3) { width: 30%; }
#exports-body .compact-table th:nth-child(4) { width: 10%; }
#exports-body .compact-table th:nth-child(5) { width: 20%; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-quiet { background: var(--surface-2); color: var(--muted);
              font-weight: 500; font-size: 11px; padding: 2px 9px; }
.scroll-y thead th { position: sticky; top: 0; background: var(--surface);
                     box-shadow: inset 0 -1px 0 var(--line); }
tbody tr:last-child td { border-bottom: none; }
tbody tr[tabindex]:hover { background: var(--surface-2); cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Campaign ids run to 30+ characters and would set the table's width on their
   own. They are clipped to a readable stub; the full value stays in the DOM,
   is shown on hover, and is written out in full in the row's detail panel - so
   nothing is lost, only folded. */
.campaign-cell { display: flex; flex-direction: column; gap: 1px;
                 max-width: 168px; }
.campaign-id, .campaign-meta {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block;
}
.campaign-id { font-weight: 600; }
.campaign-meta { font-size: 10.5px; color: var(--muted); }

.pill { display: inline-flex; align-items: center; padding: 3px 11px;
        border-radius: 20px; font-size: 12px; font-weight: 600;
        border: 1px solid transparent; }
.pill-up   { background: var(--up-soft);   color: var(--up);   border-color: #c2e2d2; }
.pill-down { background: var(--down-soft); color: var(--down); border-color: #eecac6; }
.pill-flat { background: var(--flat-soft); color: var(--flat); border-color: var(--line-2); }
.pill-warn { background: var(--warn-soft); color: var(--warn); border-color: #ead9b3; }

.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dot-c { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.dot-c.on { background: var(--primary); }

.val-up { color: var(--up); } .val-down { color: var(--down); }
.val-flat { color: var(--muted); }

/* ================================ DONUT ================================ */
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut { width: 116px; height: 116px; flex: none; border-radius: 50%; position: relative; }
.donut-hole { position: absolute; inset: 22px; background: var(--surface);
              border-radius: 50%; display: grid; place-items: center; text-align: center; }
.donut-total { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.donut-caption { font-size: 11px; color: var(--muted); }
.legend { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 145px; }
.legend-row { display: grid; grid-template-columns: 10px 1fr auto auto; gap: 8px;
              align-items: center; font-size: 12px; }
.swatch { width: 11px; height: 11px; border-radius: 3px; }
.legend-share, .legend-value { font-variant-numeric: tabular-nums; }
.legend-share { color: var(--muted); }

/* ============================= BARS / SPARK ============================ */
.bars { display: flex; flex-direction: column; gap: 9px;
        max-height: 176px; overflow-y: auto; }
.bar-row { display: grid; grid-template-columns: 128px 1fr; gap: 11px; align-items: center; }
.bar-name { font-weight: 550; font-size: 12px; }
.bar-pair { display: flex; flex-direction: column; gap: 5px; }
.bar-line { display: grid; grid-template-columns: 44px 1fr 82px; align-items: center;
            gap: 8px; font-size: 11.5px; }
.bar-line span:first-child { color: var(--muted); }
.bar-track { background: var(--surface-2); border-radius: 3px; height: 10px; }
.bar-fill { height: 10px; border-radius: 3px; background: var(--flat); }
.bar-fill.now { background: var(--line-2); }
.bar-fill.max { background: var(--primary); }
.bar-amount { text-align: right; font-variant-numeric: tabular-nums; }
.bar-delta { font-size: 12.5px; font-variant-numeric: tabular-nums; }

.spark { display: flex; align-items: flex-end; gap: 6px; height: 88px; padding-top: 6px; }
.spark-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.spark-bar { width: 100%; max-width: 40px; background: var(--primary);
             border-radius: 3px 3px 0 0; min-height: 3px; }
.spark-cap { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ============================== LEARNING =============================== */
.learn-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-bottom: 12px; }
.learn-value { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.learn-value.small { font-size: 14px; font-weight: 500; color: var(--muted); }
.learn-label { font-size: 12.5px; color: var(--muted); }

/* ============================== INSIGHTS =============================== */
.insights { display: flex; flex-direction: column; gap: 11px; }
.insight { display: flex; gap: 12px; align-items: flex-start; }
.insight-icon { width: 25px; height: 25px; flex: none; border-radius: 7px;
                display: grid; place-items: center; font-size: 10px;
                background: var(--primary-soft); color: var(--primary); }
.insight-icon.up { background: var(--up-soft); color: var(--up); }
.insight-icon.warn { background: var(--warn-soft); color: var(--warn); }
.insight-icon.down { background: var(--down-soft); color: var(--down); }
.insight-body { font-size: 11.5px; color: var(--muted); }
.insight-body strong { display: block; color: var(--text); font-size: 12.5px;
                       font-weight: 600; margin-bottom: 2px; }

/* =============================== STATES ================================ */
.state { background: var(--surface); border: 1px solid var(--line);
         border-radius: 12px; padding: 46px 24px; text-align: center; }
.state h3 { margin-bottom: 6px; }
.state .muted { margin-bottom: 16px; }
.state button { padding: 10px 20px; border: none; border-radius: 8px;
                background: var(--primary); color: #fff; font-weight: 600; }
.state button:hover { background: var(--primary-hover); }
.state-bad { background: var(--down-soft); border-color: #eecac6; }
.state-inline { padding: 18px 8px; text-align: center; color: var(--muted);
                font-size: 13px; }

.banner { display: flex; gap: 10px; padding: 11px 15px; border-radius: 8px;
          font-size: 13px; margin-bottom: 16px; border: 1px solid transparent;
          flex-wrap: wrap; }
.banner-warn { background: var(--warn-soft); color: var(--warn); border-color: #ead9b3; }

.approval-note { display: flex; align-items: center; justify-content: center; gap: 8px;
                 padding: 12px; color: var(--muted); font-size: 13px; }

/* ============================ START/RUNNING ============================ */
.running { display: grid; place-items: center; min-height: 62vh; }
.running-box { width: min(620px, 100%); background: var(--surface);
               border: 1px solid var(--line); border-radius: 14px; padding: 30px; }
.progress { list-style: none; margin: 20px 0 16px; padding: 0;
            display: flex; flex-direction: column; gap: 13px; }
.progress li { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.phase-name { flex: 1; }
.phase-meta { text-align: right; line-height: 1.25; }
.phase-pct { display: block; font-size: 14px; font-weight: 600; color: var(--text);
             font-variant-numeric: tabular-nums; }
.phase-time { display: block; font-size: 11.5px; color: var(--muted);
              font-variant-numeric: tabular-nums; }
.progress li:not([data-state]) .phase-pct { color: var(--muted); font-weight: 500; }
.progress li[data-state="done"] .phase-pct { color: var(--up); }
.progress .dot { width: 11px; height: 11px; border-radius: 50%; flex: none;
                 border: 2px solid var(--line-2); background: var(--surface); }
.progress li[data-state="active"] { color: var(--text); font-weight: 550; }
.progress li[data-state="active"] .dot { border-color: var(--primary);
                                         background: var(--primary); }
.progress li[data-state="done"] { color: var(--text); }
.progress li[data-state="done"] .dot { border-color: var(--up); background: var(--up); }

/* =============================== DETAIL ================================ */
/* The explanation opens inside the table, under the row it belongs to. There is
   no panel beside the page: it sat over the page whether or not it had
   anything to say. */
.detail-row > td { padding: 0; background: var(--surface-2); white-space: normal; }
.detail-panel { padding: 20px 18px; max-width: 660px; }
.detail-head { display: flex; align-items: baseline; justify-content: space-between;
               gap: 18px; margin-bottom: 14px; }
.detail-head h3 { white-space: normal; }

.money-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
               background: var(--line); border: 1px solid var(--line);
               border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
.money-split > div { background: var(--surface); padding: 13px 15px; }
.money-label { font-size: 12px; color: var(--muted); text-transform: uppercase;
               letter-spacing: 0.04em; }
.money-value { font-size: 20px; font-weight: 600; margin-top: 3px;
               font-variant-numeric: tabular-nums; }

.reasons { list-style: none; margin: 0 0 14px; padding: 0; }
.reasons li { display: flex; justify-content: space-between; gap: 16px;
              padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.reasons li span:first-child { color: var(--muted); }
.explain { background: var(--surface-2); border: 1px solid var(--line);
           border-radius: 8px; padding: 13px 15px; font-size: 13.5px; }

@media (max-width: 1180px) { .grid, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 12px; }
  .filters-bar { grid-template-columns: 1fr 1fr; }
  .bar-row { grid-template-columns: 1fr; gap: 7px; }
  .view { padding: 16px; }
}

/* ============================ DECISION COLUMN =========================== */
.decide { display: inline-flex; gap: 5px; }
.decide button {
  border: 1px solid var(--line-2); background: var(--surface);
  border-radius: 6px; padding: 3px 9px; font-size: 11px; font-weight: 600;
  color: var(--muted);
}
.decide button:hover { border-color: var(--primary); color: var(--primary); }
.decide button[aria-pressed="true"][data-mark="approve"] {
  background: var(--up-soft); border-color: #c2e2d2; color: var(--up);
}
.decide button[aria-pressed="true"][data-mark="deny"] {
  background: var(--down-soft); border-color: #eecac6; color: var(--down);
}
.decide-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted);
}
.decide-bar button {
  margin-left: auto; padding: 7px 16px; border: none; border-radius: 7px;
  background: var(--primary); color: #fff; font-weight: 600; font-size: 12.5px;
}
.decide-bar button[disabled] { opacity: .45; cursor: default; }
.decide-note { flex-basis: 100%; font-size: 11px; }

/* ========================= LOGIN BACKGROUND ART ========================= */
.login-art {
  position: absolute; top: -46px; right: -74px;
  width: 250px; height: auto; opacity: .92; pointer-events: none;
}
.login-head { position: relative; }
@media (max-width: 820px) { .login-art { display: none; } }

/* ============================== SCOPE DIALOG =========================== */
/* Centred over the page, not anchored to an edge: it is the first thing a
   person answers, so it sits where they are already looking. */
.modal {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: 24px;
  background: rgba(16, 32, 40, .28);
}
.modal-card {
  width: min(720px, 100%); background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; padding: 34px 38px 30px;
  box-shadow: 0 18px 48px rgba(16, 32, 40, .16);
}
.modal-card h2 { font-size: 27px; letter-spacing: -0.02em; margin-bottom: 6px; }
.modal-sub { color: var(--muted); font-size: 15px; margin-bottom: 24px; }

/* inside the dialog the bar is the content, so it drops its own frame. Two
   equal columns, then the period and the button each across the full width. */
.modal-card .filters-bar {
  border: none; padding: 0; background: none;
  grid-template-columns: 1fr 1fr; gap: 18px;
}
.modal-card .filters-bar .field label { font-size: 13.5px; height: auto; }
/* the two things being chosen are the largest targets in the dialog */
.modal-card .filters-bar select {
  height: 52px; font-size: 16px; padding: 0 34px 0 14px;
  background-position: right 13px center; background-size: 11px 7px;
}
.modal-card .period {
  grid-column: 1 / -1; border-left: none; padding: 14px 16px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; gap: 3px;
}
.modal-card .period-week { font-size: 19px; }
.modal-card .period-note { font-size: 12.5px; }
.modal-card .filters-bar .run-max {
  grid-column: 1 / -1; width: 100%;
  height: 54px; font-size: 17px; border-radius: 10px; letter-spacing: .01em;
}
.modal-card #scope-modal-close { display: block; margin: 16px auto 0; }

@media (max-width: 720px) {
  .modal-card { padding: 24px 20px; }
  .modal-card .filters-bar { grid-template-columns: 1fr; }
}

/* A download is an ordinary link, not a button: middle-click, copy-link and
   "save as" all work, and the browser handles the transfer. */
.dl { color: var(--accent); text-decoration: none; font-size: 12px;
      white-space: nowrap; }
.dl:hover { text-decoration: underline; }
