/* Tokens, the shell (top bar, sidebar), and plain elements. Element rules sit in :where() so any class
   outranks them. */

/* Brand: the website's palette and type (gtm/website/atlas.css). Light unless the viewer chose dark:
   app/theme.py sets <html data-theme> from their cookie; the OS setting is not read.
   Every value a script reads (reports.js css()) is a plain hex: ECharts cannot parse color-mix().
   Chart series --c1..--c6 are one validated set per mode (CVD- and contrast-checked on --surface):
   teal, lime, plum, ochre, slate, clay, assigned in that order, never cycled. Status (--pos/--neg/--warn) is
   stepped to sit at least 10 OKLab dE from every series and 4.5:1 on --bg, --surface and --surface-2, so it never reads as one. */

@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 900; font-display: swap; src: url("fonts/SchibstedGrotesk-400-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 900; font-display: swap; src: url("fonts/SchibstedGrotesk-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap; src: url("fonts/JetBrainsMono-400-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap; src: url("fonts/JetBrainsMono-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* brand core */
  --ink: #222f30;
  --bone: #f7f7f5;
  --lichen: #c9cbbe;
  --lime: #cef79e;

  --bg: var(--bone);
  --surface: #ffffff;
  --surface-2: #ededea;
  --border: #d6d9d0;
  --border-soft: #e6e8e1;
  --text: var(--ink);
  --text-dim: #455354;
  --text-faint: #5d6967;
  --accent: var(--ink);          /* buttons, links, focus: ink on light, as on the website */
  --accent-ink: var(--bone);
  --accent-hover: #3a4a4b;       /* ink lifted: brightness() barely moves a near-black */
  --accent-soft: var(--lime);    /* selected nav item, avatar, tags: ink on lime */
  --mark: var(--lime);
  --pos: #127546;
  --neg: #be0f25;
  --warn: #965200;
  --c1: #108ca0;
  --c2: #6f9e09;
  --c3: #9b467a;
  --c4: #bd8708;
  --c5: #4c62b3;
  --c6: #c65d26;
  --r-mark: 2px;
  --r-btn: 3px;
  --r-card: 4px;
  --radius: var(--r-card);
  --shadow: 0 1px 2px rgba(34, 47, 48, .05);
  --shadow-pop: 0 8px 24px rgba(34, 47, 48, .12), 0 2px 6px rgba(34, 47, 48, .06);
  --sans: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --nav-w: 232px;
  --top-h: 52px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: var(--ink);
  --surface: #2b3a3b;
  --surface-2: #334344;
  --border: #42524f;
  --border-soft: #3a4849;
  --text: var(--bone);
  --text-dim: #bcc6c3;
  --text-faint: #a5b0ad;
  --accent: var(--lime);         /* lime on ink, as on the website's dark theme */
  --accent-ink: var(--ink);
  --accent-hover: #dbf9b6;       /* lime lifted toward white, as the website's dark button */
  --accent-soft: #45584b;        /* lime 16% over --surface */
  --mark: #45584b;
  --pos: #3ec691;
  --neg: #fe8b83;
  --warn: #e8af4f;
  --c1: #00a4bb;
  --c2: #76a713;
  --c3: #c3699e;
  --c4: #c08a11;
  --c5: #6e87db;
  --c6: #d86d38;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25);
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

::selection { background: var(--lime); color: var(--ink); }

* { box-sizing: border-box; }

html { scroll-padding-top: calc(var(--top-h) + 12px); } /* anchors land below the sticky top bar */

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--top-h);
  padding: 0 16px;
  background: var(--bg); /* the shell sits on the page, as the website's header does; only cards are lighter */
  border-bottom: 1px solid var(--border);
}
.brand { color: var(--text); text-decoration: none; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.tenant {
  color: var(--text-dim);
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tenant::before { content: "/"; color: var(--border); margin-right: 10px; }

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-left: -6px;
  padding: 0;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: var(--r-btn);
  cursor: pointer;
}
.nav-toggle:hover { background: var(--surface-2); }

/* The theme button: the website's (gtm/website/atlas.css .theme-toggle), sized for the shorter top bar. */
.theme-form { margin: 0 0 0 auto; }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--text-dim);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-faint); }

.account { position: relative; margin-left: auto; }
.theme-form + .account { margin-left: 8px; }
.account > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  list-style: none;
}
.account > summary::-webkit-details-marker { display: none; }
.account > summary:hover, .account[open] > summary { background: var(--surface-2); }
.account-email { color: var(--text-dim); font-size: 12px; }
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
}
.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 240px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
}
.account-who { margin: 0 0 12px; font-size: 13px; overflow-wrap: anywhere; }
.account-who small { color: var(--text-faint); }
.account-menu form { margin: 0; }
.account-menu button { width: 100%; justify-content: center; }
.account-menu .account-lang { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border-soft); }
.account-menu .support { margin: 0 0 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border-soft); }
.account-lang-label { margin: 0 0 6px; font-size: 12px; color: var(--text-faint); }
.account-lang-options { display: flex; gap: 6px; }
.account-lang-options button { flex: 1; }
.account-lang-options button.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

/* ---------- shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: var(--top-h);
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--top-h));
  overflow-y: auto;
  padding: 10px 10px 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
}
.nav-section { display: flex; flex-direction: column; gap: 1px; }
.nav-section:last-child:not(.nav-foot) { padding-bottom: 14px; }
.nav-heading {
  margin: 14px 11px 4px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.nav-section:first-child .nav-heading { margin-top: 6px; }
.nav-note { margin: 10px 11px; font-size: 13px; color: var(--text-dim); }
.nav-foot { position: sticky; bottom: 0; margin: 0 -10px; padding: 8px 10px 12px; background: var(--bg); border-top: 1px solid var(--border); }
.nav-foot:not(:first-child) { margin-top: auto; }
.nav-foot:first-child { border-top: 0; }
.nav-link {
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 6px 11px;
  border-radius: var(--r-btn);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.is-on { background: var(--accent-soft); color: var(--accent); font-weight: 620; }
.nav-backdrop { display: none; }

main.page { padding: 20px 28px 48px; max-width: 1100px; min-width: 0; }
main.page-wide { max-width: 1400px; }
body:not(.has-nav) main.page { margin: 0 auto; }

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .nav-toggle { display: inline-flex; }
  .account-email { display: none; }
  .sidebar {
    position: fixed;
    z-index: 30;
    top: var(--top-h);
    bottom: 0;
    left: 0;
    width: min(280px, 85vw);
    height: auto;
    transform: translateX(-100%);
    visibility: hidden; /* no shadow at the edge, and its links out of the tab order */
    transition: transform .18s ease, visibility .18s;
    box-shadow: var(--shadow-pop);
  }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  body.nav-open .nav-backdrop { display: block; position: fixed; z-index: 20; inset: var(--top-h) 0 0 0; background: rgba(0, 0, 0, .3); }
  main.page { padding: 14px 16px 40px; }
}

/* ---------- plain elements ----------
   Never inside a report (.r-page): reports.css styles its own widgets, and a default here would leak into them. */

:where(h1:not(.r-page *)) { font-size: 21px; font-weight: 650; letter-spacing: -.01em; margin: 0 0 12px; }
:where(h2:not(.r-page *)) { font-size: 15px; font-weight: 650; margin: 28px 0 10px; }
:where(p:not(.r-page *)) { margin: 0 0 12px; }
:where(a) { color: var(--accent); }
:where(small) { font-size: 12px; }
:where(code:not(.r-page *)) { font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: var(--r-btn); }
:where(pre:not(.r-page *)) { font-family: var(--mono); font-size: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; overflow: auto; }
:where(mark) { background: var(--mark); color: var(--text); padding: 0 5px; border-radius: var(--r-mark); }
:where(hgroup) { margin-bottom: 16px; }
:where(hgroup h1) { margin-bottom: 4px; }
:where(hgroup p) { color: var(--text-dim); font-size: 13px; }
:where(details > summary) { cursor: pointer; }
:where(ol:not(.r-page *)) { padding-left: 20px; }

:where(table:not(.r-page *)) {
  width: 100%;
  margin: 0 0 16px;
  font-variant-numeric: tabular-nums; /* figures line up in a column */
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 13px;
}
:where(table:not(.r-page *) :is(th, td)) { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border-soft); }
:where(table:not(.r-page *) thead th) {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--surface-2);
  border-bottom-color: var(--border);
}
:where(table:not(.r-page *) tbody tr:last-child td) { border-bottom: 0; }
:where(table:not(.r-page *) tbody tr:hover) { background: var(--surface-2); }
@media (max-width: 820px) {
  :where(table:not(.r-page *)) { display: block; width: max-content; max-width: 100%; overflow-x: auto; }
}

:where(button:not(.r-page *), a[role="button"]) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--r-btn);
  padding: 7px 14px;
  text-decoration: none;
  cursor: pointer;
}
:where(button:not(.r-page *):hover, a[role="button"]:hover) { background: var(--accent-hover); border-color: var(--accent-hover); }
:where(button, a[role="button"]).secondary { color: var(--text); background: var(--surface); border-color: var(--border); filter: none; }
:where(button, a[role="button"]).secondary:hover { border-color: var(--accent); }
:where(button).outline { padding: 4px 10px; font-weight: 500; }

:where(:is(input:not([type="checkbox"], [type="radio"], [type="hidden"]), select, textarea):not(.r-page *)) {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  padding: 7px 10px;
}
:where(:is(input, select, textarea):not(.r-page *)):focus { outline: 2px solid var(--accent); outline-offset: -1px; }
:where(label:not(.r-page *)) { display: block; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
:where(label:not(.r-page *) > input) { display: block; width: 100%; margin-top: 6px; font-weight: 400; }

/* ---------- shared pieces ---------- */

.muted { color: var(--text-dim); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Hidden until a keyboard user tabs to it: the first stop on every page, past the topbar and sidebar. */
.skip-link { position: absolute; left: 8px; top: -100px; z-index: 100; padding: 8px 12px; border-radius: var(--r-btn); background: var(--accent); color: var(--accent-ink); }
.skip-link:focus { top: 8px; }
form.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0 6px 6px 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 28px;
}
.card > :where(h1) { margin-bottom: 16px; }
.narrow { max-width: 420px; margin: 56px auto 0; }
.narrow :where(button, a[role="button"]) { width: 100%; justify-content: center; }
.login-card .or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--text-dim); font-size: 12px; }
.login-card .or::before, .login-card .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

.empty { max-width: 520px; margin: 48px auto 0; text-align: center; }
.support { margin: 16px 0 0; font-size: 13px; overflow-wrap: anywhere; }

dl.facts { display: grid; grid-template-columns: 10rem 1fr; gap: 6px 16px; margin: 0 0 12px; }
dl.facts dt { font-weight: 600; color: var(--text-dim); }
dl.facts dd { margin: 0; }
pre.email-body { white-space: pre-wrap; word-break: break-word; max-height: 30rem; }
ol.timeline li { margin-bottom: 6px; }

/* ---------- order pipeline diagram ---------- */

svg.flow { width: 100%; height: auto; display: block; margin: 0 0 16px; }
svg.flow a { text-decoration: none; }
svg.flow .node rect { stroke-width: 1.5; }
svg.flow .node text { font-size: 12px; font-weight: 600; }
/* A state is its status token: the stroke, the arrow and a tint of it over the card. The label stays in text ink,
   so it reads the same in both themes; the colour and the arrow carry the state. */
svg.flow .node.ok, svg.flow .arrow.ok, svg.flow marker.ok { --state: var(--pos); }
svg.flow .node.blocked, svg.flow .arrow.blocked, svg.flow marker.blocked { --state: var(--neg); }
svg.flow .node.waiting, svg.flow .arrow.waiting, svg.flow marker.waiting { --state: var(--warn); }
svg.flow .node.unreached, svg.flow .arrow.unreached, svg.flow marker.unreached { --state: var(--border); }
svg.flow .node rect { fill: color-mix(in oklab, var(--state) 16%, var(--surface)); stroke: var(--state); }
svg.flow .node text { fill: var(--text); }
svg.flow .node.unreached rect { fill: var(--surface-2); }
svg.flow .node.unreached text { fill: var(--text-faint); }
svg.flow .arrow { stroke: var(--state); }
svg.flow marker path { fill: var(--state); }
