/* Peppar · Admin — the hosted dashboard.
 *
 * Visual direction: Peppar's own palette (docs/peppar-brand.md) on a quiet
 * work surface. Ivory plane, white cards, a light side rail. Charcoal
 * (--control) carries every ordinary control and selection. Pepper red is
 * kept for two things only: what waits for you (counts) and what cannot be
 * undone (.btn--grave, .consequence). Sage (--success) means done. Headings
 * and figures are Nunito, text is Inter — as in the app.
 *
 * The signature survives from the first dashboard: the .consequence strip.
 * Nothing irreversible happens without first stating how many real people
 * it reaches.
 *
 * Every colour is a token with a dark value; the panel follows the system
 * setting. Documents shown inside the panel (mail and blog previews, the
 * campaign card) keep their own light look.
 */

:root {
  --page: #faf8f2;
  --side: #f3efe5;
  --card: #ffffff;
  --card-2: #f6f3ea;
  --field: #ffffff;
  --ink: #2b2725;
  --ink-2: #645c57;
  --ink-3: #7b736d;
  --line: #e9e3d6;
  --line-2: #d8d0c0;

  --control: #2b2725;
  --control-hover: #45403c;
  --on-control: #ffffff;
  --control-soft: #ece7dc;

  --red: #b5423a;
  --red-hover: #9a342d;
  --red-ink: #9a342d;
  --red-soft: #f8eae5;
  --red-line: #ecc9c1;
  --on-red: #ffffff;

  --success: #55693d;
  --on-success: #ffffff;
  --success-soft: #e9eedf;
  --success-line: #cfd9bd;

  --danger: #a8321f;
  --danger-soft: #f9e8e3;
  --danger-line: #eccabf;
  --amber-soft: #f9f0d8;
  --amber-ink: #7c5d10;
  --amber-line: #ead9ac;
  --info-soft: #e3eefb;
  --info-ink: #1d5aa6;

  /* Chart series. */
  --s1: #2b2725;
  --s2: #2a78d6;
  --s3: #4a3aa7;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Nunito", "Inter", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --shadow-card: 0 1px 2px rgba(43, 39, 37, 0.05),
    0 10px 28px -20px rgba(43, 39, 37, 0.25);
  --shadow-pop: 0 4px 10px -2px rgba(43, 39, 37, 0.12),
    0 16px 40px -18px rgba(43, 39, 37, 0.3);
  --r: 10px;
  --r-lg: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #1e1d22;
    --side: #19181c;
    --card: #2a292f;
    --card-2: #323137;
    --field: #232227;
    --ink: #f1eeeb;
    --ink-2: #b5afab;
    --ink-3: #9a948f;
    --line: #3d3b42;
    --line-2: #4b4951;
    --control: #f1eeeb;
    --control-hover: #ffffff;
    --on-control: #1e1d22;
    --control-soft: #3a393f;
    --red: #cd7367;
    --red-hover: #d98579;
    --red-ink: #e9a79d;
    --red-soft: #47322d;
    --red-line: #6a4740;
    --success: #b0be94;
    --on-success: #1e1d22;
    --success-soft: #333a2c;
    --success-line: #4a5540;
    --danger: #ee9a8c;
    --danger-soft: #472e2a;
    --danger-line: #6a4740;
    --amber-soft: #40371f;
    --amber-ink: #e3c877;
    --amber-line: #5c5030;
    --info-soft: #25364a;
    --info-ink: #9cc4f0;
    --s1: #f1eeeb;
    --s2: #6fa8ea;
    --s3: #a898ee;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-pop: 0 16px 40px -14px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

/* The hidden attribute must beat every class's display value — the gate and
 * the shell are both display-styled and toggled with [hidden]. */
[hidden] { display: none !important; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  caret-color: var(--control);
}

::selection { background: var(--control); color: var(--on-control); }

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

:focus-visible {
  outline: 2px solid var(--control);
  outline-offset: 2px;
  border-radius: 4px;
}

button { font-family: inherit; }

code, .mono { font-family: var(--mono); font-size: 12.5px; }

h1 {
  margin: 0;
  font: 800 25px/1.2 var(--display);
  letter-spacing: -0.015em;
}
h2 { margin: 0; font: 800 15.5px/1.3 var(--display); letter-spacing: -0.01em; }
.sub-head {
  margin: 24px 0 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.lede { margin: 4px 0 0; max-width: 56ch; color: var(--ink-2); font-size: 13.5px; }
.caption { margin: 6px 0 0; font-size: 12px; color: var(--ink-3); }
.muted { color: var(--ink-3); font-size: 13.5px; }

/* ── Gate: login / denied ─────────────────────────────────────────────── */

.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(50rem 30rem at 85% -10%, var(--red-soft) 0%, transparent 60%),
    var(--page);
}

.gate__card {
  width: min(400px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 36px 32px;
  text-align: center;
}

.gate__glyph { display: inline-block; }
.gate__wait { color: var(--ink-3); margin: 14px 0 0; }
.gate__name { font-size: 26px; margin-top: 8px; }
.gate__role {
  margin: 2px 0 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.gate__text { margin: 16px 0 22px; color: var(--ink-2); font-size: 13.5px; text-align: left; }
.gate__text code { background: var(--card-2); padding: 1px 5px; border-radius: 4px; }

.gate__uid {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 8px 8px 8px 12px;
  margin-bottom: 18px;
}
.gate__uid code { word-break: break-all; text-align: left; }
.gate__actions { display: flex; gap: 10px; justify-content: center; }

.btn--google {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--field);
  color: var(--ink);
  border: 1px solid var(--line-2);
  font-weight: 700;
  padding: 11px 16px;
}
.btn--google:hover { border-color: var(--ink-3); background: var(--field); }

/* ── Shell ────────────────────────────────────────────────────────────── */

.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100dvh;
}

.stage {
  padding: 26px 36px 80px;
  max-width: 1120px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
}

/* ── Side rail: six jobs ──────────────────────────────────────────────── */

.side {
  min-width: 0;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 20px 12px 14px;
}

.side__brand { display: flex; align-items: center; gap: 9px; padding: 0 8px; }
.side__glyph { flex-shrink: 0; }
.side__name { font: 800 19px/1 var(--display); letter-spacing: -0.01em; }
.side__env {
  margin-left: auto;
  padding: 2px 8px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
}

.side__jump {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: var(--field);
  font: 400 13px var(--sans);
  color: var(--ink-3);
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease;
}
.side__jump:hover { border-color: var(--ink-3); }
.side__jump svg { flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.side__jump kbd {
  margin-left: auto;
  padding: 0 5px;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  font: 600 11px var(--sans);
}

.side__nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }

.side__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  font: 600 14px var(--sans);
  text-align: left;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.side__item svg { flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.side__item:hover { background: var(--control-soft); color: var(--ink); }
.side__item.is-current { background: var(--control); color: var(--on-control); }

.side__badge {
  margin-left: auto;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--red);
  color: var(--on-red);
  font: 700 11.5px/20px var(--sans);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.side__foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 8px 0;
  border-top: 1px solid var(--line);
}
.side__who {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--ink-3);
}
.side__out {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.side__out svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.side__out:hover { background: var(--control-soft); color: var(--ink); }

/* ── Panels & page head ───────────────────────────────────────────────── */

.panel { display: none; }
.panel.is-current { display: block; animation: settle 200ms cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes settle {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

/* ── Cards ────────────────────────────────────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: 16px;
}
.card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.card > .muted { margin-top: 0; }

.stack { display: grid; gap: 10px; margin-bottom: 16px; }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
.split .card { margin-bottom: 0; }

/* ── KPI board ────────────────────────────────────────────────────────── */

.kpi-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  min-width: 0;
}
.kpi__label { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.kpi__value {
  margin-top: 3px;
  font: 800 27px/1.1 var(--display);
  letter-spacing: -0.02em;
}
.kpi__value.is-missing { font-size: 13px; font-weight: 700; color: var(--danger); }
.kpi__note { margin-top: 3px; font-size: 11.5px; color: var(--ink-3); }

.kpi__delta { font-family: var(--sans); font-size: 12.5px; font-weight: 800; letter-spacing: 0; margin-left: 7px; }
.kpi__delta.is-up { color: var(--success); }
.kpi__delta.is-down { color: var(--danger); }
.kpi__delta.is-flat { color: var(--ink-3); }

/* ── Charts ───────────────────────────────────────────────────────────── */

.chart-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.chart-grid .card { margin-bottom: 0; }
.chart-grid .card:last-child { grid-column: 1 / -1; }

.table-toggle {
  border: 0;
  background: none;
  padding: 2px 4px;
  font: 700 12px var(--sans);
  color: var(--ink-3);
  cursor: pointer;
  transition: color 150ms ease;
}
.table-toggle:hover { color: var(--ink); }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }

.chart__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
}
.chart__legend .key {
  display: inline-block;
  width: 14px;
  height: 0;
  border-top: 2.5px solid;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 6px;
}

.chart__empty {
  display: grid;
  place-items: center;
  min-height: 150px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r);
  color: var(--ink-3);
  font-size: 12.5px;
  text-align: center;
  padding: 12px;
}

.chart-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; }
.chart-table th {
  text-align: right;
  font-weight: 700;
  color: var(--ink-2);
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
}
.chart-table th:first-child, .chart-table td:first-child { text-align: left; }
.chart-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.chart-table tr:last-child td { border-bottom: 0; }

.viz-tooltip {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  box-shadow: var(--shadow-pop);
  padding: 9px 12px;
  font-size: 12.5px;
  min-width: 130px;
}
.viz-tooltip__date { font-weight: 800; margin-bottom: 5px; }
.viz-tooltip__row { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.viz-tooltip__row .key {
  width: 12px;
  height: 0;
  border-top: 2.5px solid;
  border-radius: 2px;
  flex-shrink: 0;
}
.viz-tooltip__row .val { font-weight: 800; font-variant-numeric: tabular-nums; }
.viz-tooltip__row .lbl { color: var(--ink-2); }

/* ── Inbox (Idag: what waits, from every part of the panel) ────────────── */

.inbox { display: grid; }
.inbox__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 2px;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.inbox__item:first-child { border-top: 0; }
.inbox__item:hover .inbox__text { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.inbox__count {
  flex-shrink: 0;
  min-width: 36px;
  padding: 5px 8px;
  border-radius: 9px;
  background: var(--card-2);
  font: 800 15px/1.2 var(--display);
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  text-align: center;
}
.inbox__item.is-due .inbox__count { background: var(--red-soft); color: var(--red-ink); }
.inbox__text { flex: 1; min-width: 0; font-size: 13.5px; color: var(--ink-2); }
.inbox__item.is-due .inbox__text { color: var(--ink); font-weight: 600; }
.inbox__where { flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.inbox__item svg { flex-shrink: 0; fill: none; stroke: var(--ink-3); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ── Figures (wellness summary) ───────────────────────────────────────── */

.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.figures:empty { display: none; }
.figure {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
}
.figure__label { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.figure__value {
  margin-top: 3px;
  font: 800 25px/1.1 var(--display);
  letter-spacing: -0.02em;
}
.figure__value.is-missing { font-size: 13px; color: var(--danger); }
.figure__note { margin-top: 3px; font-size: 11.5px; color: var(--ink-3); }

/* ── Consequence: the signature ───────────────────────────────────────── */

.consequence {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 18px 0 14px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card-2);
  transition: background 150ms ease, border-color 150ms ease;
}
.consequence__count {
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}
.consequence__text { font-size: 13px; color: var(--ink-2); }
.consequence.is-armed { background: var(--red-soft); border-color: var(--red-line); }
.consequence.is-armed .consequence__count { color: var(--red-ink); }
.consequence.is-armed .consequence__text { color: var(--ink); }
.consequence.is-empty { background: var(--success-soft); border-color: var(--success-line); }
.consequence.is-empty .consequence__count { color: var(--success); }

/* ── Controls ─────────────────────────────────────────────────────────── */

label {
  display: block;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
}
label.check {
  display: flex;
  gap: 9px;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
}

input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 11px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--field);
  font: 400 14px/1.4 var(--sans);
  color: var(--ink);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--control);
  box-shadow: 0 0 0 3px var(--control-soft);
}
input[type="color"] { padding: 3px; height: 36px; }
input[type="checkbox"] { accent-color: var(--control); width: 15px; height: 15px; }
label.check input { width: auto; margin: 0; }
textarea { resize: vertical; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0 14px;
}

.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid var(--control);
  border-radius: 9px;
  background: var(--control);
  font: 600 13.5px var(--sans);
  color: var(--on-control);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease,
    color 150ms ease, transform 100ms ease;
}
.btn:hover { background: var(--control-hover); border-color: var(--control-hover); }
.btn:active { transform: translateY(1px); }
.btn svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.btn--ghost { background: none; border-color: var(--line-2); color: var(--ink-2); }
.btn--ghost:hover { background: var(--card-2); border-color: var(--ink-3); color: var(--ink); }
.btn--grave { background: var(--red); border-color: var(--red); color: var(--on-red); }
.btn--grave:hover { background: var(--red-hover); border-color: var(--red-hover); }
.btn--slim { padding: 7px 13px; font-size: 13px; }
.btn--icon { padding: 7px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn:disabled:hover { background: var(--control); border-color: var(--control); }
.btn--ghost:disabled:hover { background: none; border-color: var(--line-2); color: var(--ink-2); }
.btn--grave:disabled:hover { background: var(--red); border-color: var(--red); }

/* ── Rows, tags, notices, tables ──────────────────────────────────────── */

.row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 13px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.row--split { align-items: center; }
.row .row { padding: 0; border: 0; background: none; gap: 8px; }
.row__main { min-width: 0; }
.row__title { font-size: 14.5px; font-weight: 800; }
.row__meta { margin-top: 2px; font-size: 12px; color: var(--ink-3); }
.row__actions { display: flex; gap: 8px; flex-shrink: 0; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: var(--card-2);
  color: var(--ink-2);
  vertical-align: middle;
}
.tag--live { background: var(--success); color: var(--on-success); }
.tag--off { background: var(--card-2); color: var(--ink-3); }
.tag--warn { background: var(--red-soft); color: var(--red-ink); }

.notice {
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--card-2);
  font-size: 13px;
  white-space: pre-wrap;
}
.notice--good { background: var(--success-soft); border-color: var(--success-line); color: var(--success); }
.notice--bad { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.notice--warn { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber-ink); margin: 0 0 20px; }

.data { width: 100%; border-collapse: collapse; font-size: 13px; }
.data td {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-variant-numeric: tabular-nums;
}
.data td:first-child {
  width: 38%;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  padding-right: 10px;
}
.data tr:last-child td { border-bottom: 0; }

/* ── Campaign card preview ────────────────────────────────────────────── */

.preview {
  margin-top: 10px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
  max-width: 420px;
}
.preview__top { display: flex; gap: 12px; align-items: flex-start; }
.preview__emoji {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 19px;
}
.preview__title { font-weight: 800; font-size: 15px; color: #20262e; }
.preview__body { margin-top: 2px; font-size: 13px; color: #6b7280; }
.preview__bar {
  margin-top: 13px; height: 7px;
  border-radius: 999px; background: rgba(32, 38, 46, 0.08);
  overflow: hidden;
}
.preview__fill { height: 100%; width: 30%; }

/* ── Responsive ───────────────────────────────────────────────────────── */

@media (max-width: 980px) {
  .kpi-board { grid-template-columns: repeat(2, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .split .card { margin-bottom: 0; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .side {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }
  .side__brand { padding: 0; }
  .side__name, .side__env, .side__jump span, .side__jump kbd, .side__item svg { display: none; }
  .side__jump { width: auto; flex-shrink: 0; padding: 8px; }
  .side__nav { display: flex; gap: 4px; }
  .side__item { white-space: nowrap; padding: 8px 11px; }
  .side__foot { display: none; }
  .stage { padding: 20px 16px 60px; }
  .page-head { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .panel.is-current { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

/* Wellness sales and customer email management. */
.portal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; margin: 16px 0; }
.portal-grid .figure { background: var(--card-2); border: 1px solid var(--line); }
.portal-grid .figure__value { font-size: 28px; }
.table-scroll { overflow-x: auto; }
.data th { text-align: left; font-size: 11px; color: var(--ink-3); padding: 10px 12px; }
.data select { min-width: 115px; }
details.card > summary { cursor: pointer; font-size: 16px; font-weight: 700; }
details.card[open] > summary { margin-bottom: 16px; }
.mail-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 18px; }
.mail-editor > div { min-width: 0; }
.mail-editor h3 { margin-top: 0; }
.mail-preview { background: var(--card-2); padding: 20px; border: 1px solid var(--line); border-radius: 12px; overflow-wrap: anywhere; }
.mail-preview pre { white-space: pre-wrap; font: inherit; font-size: 13px; line-height: 1.7; }
.mail-preview:empty { display: none; }
.mail-frame { display: block; width: 100%; height: 640px; margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; background: #FAF8F2; }
.mail-message summary { cursor: pointer; overflow-wrap: anywhere; }
.mail-message { padding: 15px 0; border-bottom: 1px solid var(--line); }
.mail-message .actions { margin: 12px 0; }
#wellness-filter { align-items: end; margin-bottom: 16px; }
#email-template-body { line-height: 1.6; }
@media (max-width: 900px) { .mail-editor { grid-template-columns: 1fr; } }

#weborders { overflow-x: auto; }
@media (max-width: 520px) {
  .panel[data-panel="emails"] .field-grid,
  .panel[data-panel="wellness"] .field-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Marknader */
.pill { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .04em; background: var(--card-2); color: var(--ink-2); vertical-align: middle; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

.table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Blog editor ─────────────────────────────────────────────────────── */
.blog-preview { width: 100%; height: 900px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; }
#blog-body { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.5; }
.tag--review { background: var(--amber-soft); color: var(--amber-ink); }
.blog-liv { margin: 16px 0; padding: 16px; border: 1px dashed var(--line-2); border-radius: 12px; background: var(--card-2); }
.blog-liv .sub-head { margin-top: 0; }
.tag--scheduled { background: var(--info-soft); color: var(--info-ink); }

/* ── Content queue ───────────────────────────────────────────────────── */
.content-editor { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 20px; align-items: start; margin-bottom: 16px; }
.content-video video { width: 100%; aspect-ratio: 9 / 16; border-radius: 14px; background: #111; display: block; }
.content-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.content-fields label { display: block; }
.content-fields label > .caption { margin-left: 8px; font-weight: 400; }
.content-platforms { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; margin: 10px 0; display: flex; gap: 18px; flex-wrap: wrap; }
.content-platforms label { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.content-review, .content-posted { margin-top: 14px; padding: 14px; border: 1px dashed var(--line-2); border-radius: 12px; background: var(--card-2); }
.content-review .sub-head, .content-posted .sub-head { margin-top: 0; }
.content-review ul { margin: 0; padding-left: 18px; font-size: 13px; }
.content-thumb { width: 54px; height: 96px; border-radius: 8px; object-fit: cover; background: var(--card-2); flex-shrink: 0; }
.content-row { display: flex; gap: 14px; align-items: center; min-width: 0; }
.tag--rejected { background: var(--danger-soft); color: var(--danger); }
@media (max-width: 900px) { .content-editor { grid-template-columns: 1fr; } }
.content-publishing__row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.content-publishing__row label { flex: 1; min-width: 220px; margin: 0; }
.content-tiktok { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); align-items: center; justify-content: space-between; }

/* In-page confirm/prompt/alert (dialogs.js) — Chrome suppresses the native
 * ones in a background tab. */
.admin-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 22px 22px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-pop);
  font-family: var(--sans);
}
.admin-dialog::backdrop { background: rgba(20, 18, 17, 0.45); }
.admin-dialog__message { margin: 0 0 16px; font-size: 15px; line-height: 1.5; white-space: pre-line; }
.admin-dialog__input {
  width: 100%;
  margin: 0 0 16px;
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}
.admin-dialog__input:focus { outline: 2px solid var(--control); outline-offset: 1px; }
.admin-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ── Nyhetsbrev editor ───────────────────────────────────────────────── */
.nl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
.nl-label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-2); margin: 4px 0 6px; }
.nl-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
#nl-body { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.6; }
#nl-body[readonly], #nl-subject[readonly], #nl-preheader[readonly] { background: var(--card-2); color: var(--ink-2); }
.nl-help { margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.nl-help summary { cursor: pointer; font-weight: 700; }
.nl-help ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.6; }
.nl-plain { margin-top: 12px; font-size: 13px; }
.nl-plain summary { cursor: pointer; color: var(--ink-2); }
.nl-plain pre { white-space: pre-wrap; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 8px 0 0; }
.nl-audience { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); max-width: 560px; }
.nl-audience p { margin: 6px 0 0; font-size: 13px; }
.nl-recipients-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 12px; }
.nl-recipients-head > label:first-child { flex: 1 1 240px; margin: 0; }
.nl-recipients-head > label.check { margin: 0 0 8px; }
.nl-recipients-list { margin-top: 8px; max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; }
.nl-recipients-list label.check { display: flex; align-items: center; gap: 8px; margin: 0; padding: 6px 0; border-bottom: 1px solid var(--line); font-weight: 400; }
.nl-recipients-list label.check:last-child { border-bottom: 0; }
.nl-recipients-list .mono { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.nl-recipients-list .muted { flex: 0 0 auto; font-size: 12px; }
.nl-send { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.nl-send label { flex: 1 1 220px; margin: 0; }
.link-button { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--ink); text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.link-button:hover { text-decoration-color: currentColor; }
.table tr.is-selected td { background: var(--card-2); }
@media (max-width: 520px) { .nl-send > .btn { flex: 1 1 100%; } }

/* ── Friskvård: tabs, to-do rows, ledger, sales, new-code dialog ──────── */

.head-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: -6px 0 18px; border-bottom: 1px solid var(--line-2); }
/* The pages of one job (app.js GROUPS), above the page head. */
.tabs--group { margin: 0 0 24px; }
.tab { display: inline-flex; align-items: center; gap: 8px; margin-bottom: -1px; padding: 9px 14px; border: 0; border-bottom: 3px solid transparent; background: none; font: 600 14px var(--sans); color: var(--ink-2); cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--control); }
.tab__count { padding: 1px 7px; border-radius: 999px; background: var(--red); color: var(--on-red); font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }

.todo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) auto; gap: 10px 20px; align-items: end; padding: 16px 0; border-top: 1px solid var(--line); }
.todo-list > .todo:first-child { border-top: 0; padding-top: 4px; }
.todo-list > .todo:last-child { padding-bottom: 0; }
.todo-list > p { margin: 0; }
.todo--line { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.todo__who { display: flex; flex-direction: column; gap: 2px; min-width: 0; align-self: start; font-size: 13px; }
.todo__ref { font-size: 15px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.todo__uid { font-size: 11.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.todo__fields { display: grid; grid-template-columns: 84px 120px minmax(120px, 1fr); gap: 10px; }
.todo__fields label { margin: 0; }
.todo__actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* Room for "Godkänn 12 månader", so checking does not shift the row. */
.todo__actions .btn:nth-child(2) { min-width: 176px; justify-content: center; }
.todo__mail, .todo > .consequence, .todo > .notice { grid-column: 1 / -1; margin: 0; }
@media (max-width: 900px) {
  .todo { grid-template-columns: minmax(0, 1fr); }
  .todo__fields { grid-template-columns: 1fr 1fr; }
  .todo__fields label:last-child { grid-column: 1 / -1; }
}

.ledger-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.ledger-tools select { width: auto; min-width: 140px; }
.ledger-tools input[type="search"] { flex: 1 1 220px; width: auto; }
.ledger-tools label.check { margin: 0; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--card); font: 700 13px var(--sans); color: var(--ink-2); cursor: pointer; }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--control); border-color: var(--control); color: var(--on-control); }
.ledger { min-width: 720px; font-variant-numeric: tabular-nums; }
.ledger th { white-space: nowrap; text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--line-2); }
.ledger td { padding: 10px 12px; vertical-align: middle; }
.ledger td:first-child { width: auto; padding-right: 12px; font-size: 13px; font-weight: 400; color: var(--ink-2); white-space: nowrap; }
.ledger th:first-child, .ledger td:first-child { padding-left: 0; }
.ledger th:last-child, .ledger td:last-child { padding-right: 0; }
.ledger .num { text-align: right; white-space: nowrap; }
.ledger tr.is-quiet td { color: var(--ink-3); }
.ledger__note { font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }
.ledger__actions { text-align: right; white-space: nowrap; }
.ledger__more { padding: 2px 10px; font-size: 16px; line-height: 1.2; }
.weborders { min-width: 640px; }
.weborders td { padding: 9px 12px; vertical-align: middle; }
.weborders td:first-child { width: auto; padding-left: 0; font-size: 13px; font-weight: 400; white-space: nowrap; }
.weborders td:last-child { padding-right: 0; }
.ledger .tag, .weborders .tag { white-space: nowrap; }
.ledger-count { margin: 12px 0 0; font-size: 12.5px; }
.tag--good { background: var(--success-soft); color: var(--success); }
.portal-edit { margin-left: -7px; padding: 3px 7px; border: 1px dashed transparent; border-radius: 6px; background: none; font: inherit; color: var(--ink); cursor: pointer; }
.portal-edit:hover { border-color: var(--line-2); background: var(--card-2); }
.portal-edit.is-missing { background: var(--amber-soft); color: var(--amber-ink); font-weight: 700; }
.row-menu { position: fixed; inset: auto; margin: 0; min-width: 190px; padding: 6px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--card); box-shadow: var(--shadow-pop); }
.row-menu:popover-open { display: grid; gap: 2px; }
.row-menu__item { padding: 8px 10px; border: 0; border-radius: 6px; background: none; font: 600 13.5px var(--sans); color: var(--ink); text-align: left; cursor: pointer; }
.row-menu__item:hover { background: var(--card-2); }
.row-menu__item.is-grave { color: var(--red-ink); }

.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg button { padding: 6px 12px; border: 0; background: var(--card); font: 700 13px var(--sans); color: var(--ink-2); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button[aria-pressed="true"] { background: var(--control); color: var(--on-control); }
.sales-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin: 4px 0 18px; }
.sales-total strong { font: 800 34px/1 var(--display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.sales-bars { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; gap: 10px 14px; align-items: center; margin-bottom: 16px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.sales-bars__track { height: 14px; border-radius: 4px; background: var(--card-2); }
.sales-bars__bar { height: 100%; min-width: 2px; border-radius: 4px; background: var(--control); }
.sales-bars__value { text-align: right; font-weight: 700; }
@media (max-width: 560px) {
  .sales-bars { grid-template-columns: minmax(0, 1fr) max-content; }
  .sales-bars__track { grid-column: 1 / -1; grid-row: auto; }
}

.code-dialog { width: min(640px, calc(100vw - 32px)); }
.code-dialog h2 { margin: 0; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin-bottom: 16px; }
.choice { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--card); font: 600 12.5px var(--sans); color: var(--ink-2); text-align: left; cursor: pointer; }
.choice b { font-size: 14px; font-weight: 800; color: var(--ink); }
.choice[aria-pressed="true"] { border-color: var(--control); background: var(--control-soft); }
.code-dialog .notice { margin-top: 14px; white-space: pre-line; }

/* ── Jump (⌘K) ────────────────────────────────────────────────────────── */
.jump { width: min(540px, calc(100vw - 32px)); margin-top: 14vh; padding: 0; overflow: hidden; }
.jump input { margin: 0; padding: 15px 18px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; font-size: 16px; }
.jump input:focus-visible { box-shadow: none; border-color: var(--line); }
.jump__list { list-style: none; margin: 0; padding: 6px; max-height: 340px; overflow-y: auto; }
.jump__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: 8px; background: none; font: 500 14px var(--sans); color: var(--ink); text-align: left; cursor: pointer; }
.jump__item:hover, .jump__item.is-selected { background: var(--control-soft); }
.jump__kind { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.jump__none { padding: 12px; font-size: 13.5px; color: var(--ink-3); }

/* The trend card on Idag: one chart at a time, its table toggle below. */
[data-trend-view] > .table-toggle { margin-top: 6px; padding-left: 0; }
