/* WebmasterID Partners — dashboard styles. Colour roles follow the data-viz palette:
   one accent hue for magnitude, status colours only for status, text always in ink tokens. */
:root {
  color-scheme: light;
  --page: #f9f9f7; --surface: #fcfcfb; --ink: #0b0b0b; --ink-2: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --border: rgba(11, 11, 11, .10); --wash: rgba(11, 11, 11, .04);
  --accent: #2a78d6; --accent-track: #cde2fb; --accent-wash: rgba(42, 120, 214, .10);
  --good: #0ca30c; --good-text: #006300; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --focus: #2a78d6;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, .10); --wash: rgba(255, 255, 255, .05);
    --accent: #3987e5; --accent-track: #184f95; --accent-wash: rgba(57, 135, 229, .14);
    --good-text: #0ca30c; --focus: #6da7ec;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 16px; } h2 { font-size: 15px; } h3 { font-size: 13px; color: var(--ink-2); font-weight: 500; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
pre { margin: 8px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--wash); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Shell */
.top { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.top .brand { font-weight: 600; white-space: nowrap; }
.tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; }
.tabs button { border: 0; background: none; padding: 6px 10px; border-radius: 6px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.tabs button:hover { background: var(--wash); }
.tabs button[aria-selected="true"] { background: var(--accent-wash); color: var(--ink); font-weight: 600; }
main { max-width: 1240px; margin: 0 auto; padding: 16px 20px 64px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow-x: auto; max-width: 100%; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 10px; cursor: pointer; color: var(--ink-2); white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { background: var(--accent-wash); color: var(--ink); font-weight: 600; }
select, input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], input[type="url"], textarea {
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 6px 10px; min-height: 34px; max-width: 100%;
}
textarea { width: 100%; min-height: 96px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: inherit; }
.btn { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 6px 12px; cursor: pointer; min-height: 34px; white-space: nowrap; }
.btn:hover { background: var(--wash); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grow { flex: 1; min-width: 180px; }
label.field { display: grid; gap: 4px; font-size: 12px; color: var(--ink-2); }
.form { display: grid; gap: 12px; }
.cols { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

/* Cards, tiles */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; min-width: 0; }
.card > header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
/* A second, related block inside one card: set apart from what is above it, and readable as a heading. */
.card h3.section { margin: 18px 0 8px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 14px; color: var(--ink); font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.tile .label { font-size: 12px; color: var(--ink-2); }
.tile .value { font-size: 24px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.tile .sub { font-size: 12px; color: var(--muted); }
.kpis .tile .value { font-size: 22px; }
.notice.row { justify-content: space-between; }

/* Tables */
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--grid); text-align: left; vertical-align: middle; }
th { font-size: 12px; font-weight: 500; color: var(--ink-2); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
tbody tr:hover { background: var(--wash); }
td.wrap { overflow-wrap: anywhere; min-width: 140px; }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); }

/* Meter list: a name, a bar and a figure per row; one hue, bars on one baseline */
.meters { display: grid; grid-template-columns: minmax(96px, max-content) 1fr max-content max-content; gap: 8px 12px; align-items: center; }
.meters .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.meters .track { height: 8px; border-radius: 4px; background: var(--accent-track); min-width: 60px; }
.meters .fill { height: 100%; border-radius: 4px; background: var(--accent); min-width: 2px; }
.meters .fig { text-align: right; font-variant-numeric: tabular-nums; }
.meters .fig.dim { color: var(--muted); font-size: 12px; }

/* Charts */
.chart { position: relative; }
.chart { min-width: 0; overflow: hidden; }
.chart svg { display: block; max-width: 100%; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axisline { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent); opacity: .10; }
.chart .bar { fill: var(--accent); }
.chart .bar.hot { filter: brightness(1.15); }
.chart .cross { stroke: var(--axis); stroke-width: 1; }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.tooltip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; box-shadow: 0 4px 16px rgba(0, 0, 0, .12); white-space: nowrap; z-index: 3; }
.tooltip strong { font-size: 14px; } .tooltip span { color: var(--ink-2); font-size: 12px; display: block; }

/* Status: always an icon and a label, never colour alone */
.status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.status.good::before { background: var(--good); }
.status.warn::before { background: var(--warning); border-radius: 1px; transform: rotate(45deg); }
.status.bad::before { background: var(--critical); border-radius: 1px; }
.flag { display: inline-block; border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; font-size: 12px; margin: 1px 4px 1px 0; }
.flag::before { content: "⚠ "; }
.notice { border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 12px; background: var(--surface); margin-bottom: 16px; }
.notice.error { border-left-color: var(--critical); }
.notice.ok { border-left-color: var(--good); }
.busy { opacity: .55; transition: opacity .15s; }

/* Sign-in */
.signin { max-width: 380px; margin: 12vh auto; }
@media (max-width: 640px) {
  main { padding: 12px 16px 48px; }
  .top { padding: 10px 16px; gap: 8px 10px; flex-wrap: wrap; justify-content: space-between; }
  .tabs { order: 3; flex-basis: 100%; }
  .meters { grid-template-columns: minmax(64px, 34%) 1fr max-content max-content; gap: 8px; }
}

/* Forms, offers, chips */
.lang { min-height: 34px; }
.field input, .field select, .field textarea { width: 100%; }
input[readonly] { background: var(--wash); color: var(--ink-2); }
.form .cols { gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.offer { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; background: var(--surface); }
.offer > header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.offer .terms { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0; color: var(--ink-2); }
.offer .terms strong { color: var(--ink); font-weight: 600; }
.offer .desc { color: var(--ink-2); margin: 6px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.builder { border-top: 1px solid var(--grid); margin-top: 12px; padding-top: 12px; display: grid; gap: 10px; }
.linkbox { display: flex; gap: 8px; align-items: stretch; }
.linkbox output { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; background: var(--wash); overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 2px 10px; cursor: pointer; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.chip:hover { background: var(--wash); }
.money { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.money .tile.primary { border-color: var(--accent); }
.progress { height: 6px; border-radius: 3px; background: var(--accent-track); margin-top: 8px; }
.progress > div { height: 100%; border-radius: 3px; background: var(--accent); }
.tabs2 { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 12px; }
.tabs2 button { border: 0; background: none; padding: 6px 14px; cursor: pointer; color: var(--ink-2); }
.tabs2 button[aria-pressed="true"] { background: var(--accent-wash); color: var(--ink); font-weight: 600; }
td input[type="checkbox"], th input[type="checkbox"] { width: 16px; height: 16px; }
.split { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) { .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; } }
td .row { flex-wrap: nowrap; }
.goalgrid { display: grid; grid-template-columns: 110px minmax(120px, 1fr) 210px 96px 240px 96px; gap: 8px; align-items: center; min-width: 880px; margin-bottom: 10px; }
.goalgrid input, .goalgrid select { width: 100%; min-width: 0; }
.detail h3 { margin: 20px 0 8px; } .detail > h3:first-of-type { margin-top: 0; }
.detail .split { margin-top: 4px; }
.detail select[multiple] { min-width: 240px; flex: 1; }
.row.top { align-items: flex-start; }
.rategrid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: center; margin-bottom: 10px; }
.rategrid input, .rategrid select { width: 100%; min-width: 0; }
p.wrap { overflow-wrap: anywhere; }
