/* ==========================================================================
   Dart Finance -- the tokens (§tokens, §design-system)
   --------------------------------------------------------------------------
   Every document is painted from this folder, linked in the order `SHEETS`
   declares (§sheets), and this sheet comes first. It declares what the design
   system declares -- `tokens.json` in the copy, which leads -- and the few
   measures the shell adds for itself. Every other sheet spends these by name:
   no colour of its own, no length off the scale, no weight outside the few a
   reader can tell apart (`rules.py`). Its tests hold the values here to the
   copy, so a pull that changes a token goes red until this sheet follows.

   Two themes, one declaration each. A colour is `light-dark(light, dark)` and
   `color-scheme` picks the side: the root follows the reader's device until
   `<html data-theme>` names a theme, which the server writes from the person's
   own setting (§design-system.theme). No second block, no script.
   ========================================================================== */

@font-face {
  font-family: Manrope;
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(/ux/assets/fonts/manrope-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: Manrope;
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(/ux/assets/fonts/manrope-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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;

  /* The fourteen UI colours (§design-system). Teal is the brand and it is
     rare: the symbol, the focus ring, one attention press per screen, and
     slot 1 of a chart -- never text, never a large fill. Grey does the work. */
  --brand: #0c7c84;
  --brand-deep: light-dark(#0f2a2e, #16393e);
  --paper: light-dark(#f4f3ef, #141b1d);
  --control: light-dark(#2f3e46, #3a474c);
  --on-fill: #ffffff;
  --page: light-dark(#f1f2f4, #111719);
  --surface: light-dark(#ffffff, #182022);
  --ink: light-dark(#1b2325, #e8ecec);
  --ink-muted: light-dark(#5c6366, #9aa3a6);
  --border: light-dark(#e2e4e7, #2a3437);
  --success: light-dark(#0b7a2e, #3dba67);
  --danger: light-dark(#bb3434, #f07a7a);
  --danger-fill: #bb3434;
  --warn: light-dark(#7a5b12, #e3ae4f);

  /* A press follows the theme -- white with a dark-grey word in light, dark
     grey with a white word in dark -- and a selected press, the active
     navigation row and a picked chip take the opposite. */
  --btn-face: light-dark(var(--on-fill), var(--control));
  --btn-ink: light-dark(var(--control), var(--on-fill));
  --btn-inv-face: light-dark(var(--control), var(--on-fill));
  --btn-inv-ink: light-dark(var(--on-fill), var(--control));

  /* The shade at a scrolling edge: darker on a light surface, lighter on a
     dark one, so it reads in both themes. */
  --edge-shade: light-dark(black, white);

  /* The chart colours: their own set, outside the UI colours, and the
     application's `dashboards/theme.py` paints its figures with the same
     values. Declared here so the copy and this sheet are one list. */
  --chart-1: #0c7c84;
  --chart-2: light-dark(#2f3e46, #e8ecec);
  --chart-3: light-dark(#eb6834, #d95926);
  --chart-4: light-dark(#2a78d6, #3987e5);
  --chart-5: light-dark(#eda100, #c98500);
  --chart-6: light-dark(#4a3aa7, #9085e9);
  --chart-7: light-dark(#e87ba4, #d55181);
  --chart-8: #008300;
  --chart-baseline: light-dark(#9aa3a6, #6a7477);
  --chart-other: light-dark(#c5cacc, #4d585c);
  --chart-seq-1: light-dark(#e3f1f2, #0f2a2e);
  --chart-seq-2: light-dark(#b3dadc, #124a50);
  --chart-seq-3: light-dark(#6fb8bc, #16676e);
  --chart-seq-4: light-dark(#2f969c, #1e8a92);
  --chart-seq-5: light-dark(#0c7c84, #4fb3ba);
  --chart-seq-6: light-dark(#07474c, #a6dde0);
  --chart-div-mid: light-dark(#e9ebed, #2e3a3e);

  /* A slide's grounds and the ink on each: the copy's decks, one value in
     both themes, as a deck has no theme. No screen spends them. */
  --slide-paper: #f4f3ef;
  --slide-light: #f1f2f4;
  --slide-graphite: #111719;
  --slide-deep: #0f2a2e;
  --slide-teal: #0c7c84;
  --slide-ink: #1b2325;
  --slide-muted: #5c6366;
  --slide-card: #ffffff;
  --slide-rule: #e2e4e7;
  --slide-ink-graphite: #e8ecec;
  --slide-muted-graphite: #9aa3a6;
  --slide-card-graphite: #182022;
  --slide-rule-graphite: #2a3437;
  --slide-ink-deep: #f4f3ef;
  --slide-muted-deep: #a9bdbf;
  --slide-card-deep: #16393e;
  --slide-rule-deep: #24484d;
  --slide-ink-teal: #ffffff;

  /* Depth is drawn inside the control and nowhere else: a light inside the
     top left and a shade inside the bottom right at rest, the mirror pushed
     in. The split pair leaves out the side where a part meets its neighbour,
     so a seam stays a hard line. Cards are flat with a border. */
  --input-default-raised: inset 2px 2px 4px light-dark(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.2)), inset -2px -2px 4px light-dark(rgba(19, 25, 28, 0.2), rgba(0, 0, 0, 0.3));
  --input-default-sunken: inset 2px 2px 4px light-dark(rgba(19, 25, 28, 0.3), rgba(0, 0, 0, 0.4)), inset -2px -2px 4px light-dark(rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.1));
  --input-split-raised-l: inset 2px 2px 3px light-dark(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.2)), inset 0 -2px 3px light-dark(rgba(19, 25, 28, 0.2), rgba(0, 0, 0, 0.3));
  --input-split-raised-m: inset 0 2px 3px light-dark(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.2)), inset 0 -2px 3px light-dark(rgba(19, 25, 28, 0.2), rgba(0, 0, 0, 0.3));
  --input-split-raised-r: inset 0 2px 3px light-dark(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.2)), inset -2px -2px 3px light-dark(rgba(19, 25, 28, 0.2), rgba(0, 0, 0, 0.3));
  --input-split-sunken-l: inset 2px 2px 3px light-dark(rgba(19, 25, 28, 0.3), rgba(0, 0, 0, 0.4)), inset 0 -2px 3px light-dark(rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.1));
  --input-split-sunken-m: inset 0 2px 3px light-dark(rgba(19, 25, 28, 0.3), rgba(0, 0, 0, 0.4)), inset 0 -2px 3px light-dark(rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.1));
  --input-split-sunken-r: inset 0 2px 3px light-dark(rgba(19, 25, 28, 0.3), rgba(0, 0, 0, 0.4)), inset -2px -2px 3px light-dark(rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.1));
  --search-box-sunken: inset 2px 2px 4px light-dark(rgba(19, 25, 28, 0.16), rgba(0, 0, 0, 0.4)), inset -2px -2px 4px light-dark(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.06));

  /* Steps of 4px. Lay out with `gap`. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 28px;
  --space-7: 40px;

  /* `radius-sm` is every press, control and card; `radius` the dialog, the
     sign-in card and the question box; the pill only a badge, a chip or a
     delta, never a press. */
  --radius-xs: 4px;
  --radius-sm: 9px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-tile: 22.5%;
  --radius-pill: 999px;

  /* The measures several components share. One height per row: every control
     in a filter panel is `--control-h`, every press on its own `--button-h`,
     every control in the row under a question box `--ask-h`. */
  --panel-w: 264px;
  --rail-w: 64px;
  --main-max: 1400px;
  --chat-max: 800px;
  --measure: 68ch;
  --control-h: 22.5px;
  --button-h: 32px;
  --ask-h: 29.25px;
  --symbol-min: 16px;
  --lockup-min: 24px;
  --settings-control: 270px;
  --slide-width: 1920px;
  --slide-height: 1080px;
  --slide-margin: 128px;
  --slide-gap: 48px;
  --slide-footer: 64px;

  /* Manrope for everything; the mono for a code or a dimension. */
  --font-sans: Manrope, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* The five sizes, and no others: a sheet names a step and never writes a
     length, and hierarchy below a step comes from weight and from colour. The
     copy spells each as a whole style; here it is the step alone, because a
     `font` shorthand resets what it does not say. A slide's steps are a deck's
     alone. */
  --text-small: 11px;
  --text-body: 13px;
  --text-title: 20px;
  --text-display: 30px;
  --text-wordmark: 56px;
  --text-slide-display: 120px;
  --text-slide-title: 72px;
  --text-slide-heading: 48px;
  --text-slide-body: 32px;
  --text-slide-small: 24px;

  /* The shell's own geometry. `--sidebar-w` is the panel until the rail
     closes: `.app-sidebar.is-collapsed` redefines it, and the chat block
     centres itself on the window from it (`--chat-left` below). The two names
     stay apart because the chat history panel is a panel and not the
     navigation (#4029, screens/chat/sheet.css). */
  --sidebar-w: var(--panel-w);
  --main-pad-x: var(--space-6);
  --main-pad-top: var(--space-5);
  --main-pad-bottom: var(--space-7);

  /* The one token whose value is not a design decision: what a region says
     while it fetches (§waiting, `components/feedback/busy/sheet.css`).
     Empty here and written per request in the index's own `<style>` block,
     which loads later and so wins the tie. */
  --busy-label: "";
}

/* The person's own choice, written on the root by the server. Absent, the
   device decides (§design-system.theme). */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* dash 4 paints every option list, input and popover from its own `--Dash-*`
   palette -- navy words, a purple focus -- declared on `:root` in a sheet it
   injects after these, so a `:root` rule here loses on order. Declared on
   `body` instead, which every control sits under, and pointed at the tokens:
   one declaration follows both themes, and a word keeps its ink when its box
   takes focus -- the ring says focus (#6844). */
body {
  --Dash-Text-Primary: var(--ink);
  --Dash-Text-Strong: var(--ink);
  --Dash-Text-Weak: var(--ink-muted);
  --Dash-Text-Disabled: var(--ink-muted);
  --Dash-Fill-Interactive-Strong: var(--ink);
  --Dash-Fill-Interactive-Weak: var(--page);
  --Dash-Fill-Inverse-Strong: var(--surface);
  --Dash-Fill-Primary-Hover: var(--page);
  --Dash-Fill-Primary-Active: var(--border);
  --Dash-Fill-Disabled: var(--border);
  --Dash-Stroke-Strong: var(--ink-muted);
  --Dash-Stroke-Weak: var(--border);
  --Dash-Shading-Strong: transparent;
  --Dash-Shading-Weak: transparent;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-sans);
  /* The root size every `rem` is measured against, so it is a length and not
     a step on the scale. */
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* The body size every word without a rule of its own is set in: dash's own
   15px is none of the five sizes (§design-system). */
body { font-size: var(--text-body); }

/* A link is dark text with a line under it at rest: teal is never a colour a
   word is written in, so the underline is the whole of what says "link".
   Every block-shaped link (a nav row, a card, a chip) turns it off again. */
a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

::selection { background: var(--border); }

/* ==========================================================================
   App shell: sidebar + content
   ========================================================================== */

/* The shell IS the window: no gap, no rounded corner, no shadow (#3518). What
   separates the column from the page is the sidebar's own edge (#3563). */
.app-shell {
  display: flex;
  min-height: 100%;
  background: var(--page);
  color: var(--ink);
}

/* Head, tree, foot. The tree is the only part that scrolls, so the foot is a
   bar at the bottom of the panel. This column itself must NOT scroll: a menu
   panel opens upward out of that foot and is wider than the column, so an
   `overflow` here would clip it. Sticky makes it a stacking context, so the
   panel's own z-index counts only inside it: the column itself stands above
   every layer a page draws (kept under 10) and under a window over the
   screen (20 and up), or a positioned page element covers the panel (#8092). */
.app-sidebar {
  flex: 0 0 auto;
  width: var(--sidebar-w);
  box-sizing: border-box;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--page);
  border-right: 1px solid var(--border);
  z-index: 10;
}

.app-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-group { display: flex; flex-direction: column; gap: 2px; }

.nav-group-label {
  padding: var(--space-3) var(--space-2) var(--space-1);
  font-size: var(--text-small);
  line-height: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  box-sizing: border-box;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  font-size: var(--text-body);
  line-height: 20px;
  font-family: var(--font-sans);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
/* A dashboard sits under the module that holds it and reads no louder than
   it (#3551): same size, one weight down. */
.nav-children .nav-link { padding: 4px 8px; font-weight: 400; }
.nav-link:hover { background: var(--border); }
.nav-label { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* How far this column starts from the left of the window: the sidebar and
   the main's own padding. The chat block subtracts it to centre itself on
   the window (components/assistant/box/sheet.css). **Declared here rather
   than at :root, and that is the whole trick.** A custom property is
   substituted where it is *declared*, so a :root declaration bakes in the
   expanded sidebar; declared on this element it is resolved against the
   --sidebar-w this element has, which `.app-sidebar.is-collapsed ~
   .app-content` overrides (screens/shell/rail.css). */
.app-content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  --chat-left: calc(var(--sidebar-w) + var(--main-pad-x));
  --main-w: calc(100vw - var(--sidebar-w) - 2 * var(--main-pad-x));
}

/* The whole column, and no measure of its own: the measure sits on the things
   standing here instead (§dashboard-pages.page-width). */
.app-main {
  padding: var(--main-pad-top) var(--main-pad-x) var(--main-pad-bottom);
}

/* ==========================================================================
   Page scaffold & typography
   ========================================================================== */

.page, .metric-page, [class*="page-body"], .data-status-section {
  display: flex; flex-direction: column; gap: var(--space-4); min-width: 0;
}
/* A press standing on the page itself is as wide as its words: stretched, it
   reads as a banner rather than as an action (§field-height). */
.page > button, .metric-page > button { align-self: flex-start; }
/* A drop-down standing on the page itself is as wide as a name, as one in a
   form is (§field-height). */
.page > .dash-dropdown-wrapper, .metric-page > .dash-dropdown-wrapper { width: 100%; max-width: var(--settings-control); }

/* One heading size, and hierarchy below it by weight and colour
   (§design-system). Written on the level rather than under `.page >`: a
   heading one wrapper further down was reached by nothing and wore the
   browser's own size (#4258). */
h1, h2, h3, h4, h5 { color: var(--ink); margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1, h2 { font-size: var(--text-title); line-height: 26px; }
h3, h4, h5 { font-size: var(--text-body); line-height: 20px; }
.page > h1, .metric-page > h1 {
  margin: 0; font-size: var(--text-title); line-height: 26px; font-weight: 700; letter-spacing: -0.01em;
}

/* The text elements written with no class to hang a rule on, at the step
   their role has (§dashboard-pages.text-size). The label carries
   `:not([class])`: the writer draws every dropdown, checklist and radio option as a
   `<label>` with a class of its own, and the size of one of those belongs to
   the rule that dresses the control it sits in. */
p, summary { font-size: var(--text-body); line-height: 20px; }
label:not([class]) { font-size: var(--text-small); }

.page-intro {
  color: var(--ink-muted);
  max-width: var(--measure);
  margin: 0;
}
/* A sentence beside a figure that says what was folded into it: a note, said
   where it applies (§design-system), not a banner. */
.revenue-hourly-consolidation-note, .average-spend-table-consolidation-note {
  color: var(--ink-muted);
  max-width: var(--measure);
  margin: 0;
  padding-left: 9px;
  box-shadow: inset 3px 0 0 var(--border);
  font-size: var(--text-body);
}

.chart-caption, .table-caption { color: var(--ink-muted); font-size: var(--text-small); line-height: 16px; margin: 0; }

/* ==========================================================================
   Cards -- one flat box for every thing that stands alone: a KPI, a chart,
   a filter panel. `surface`, a border, no shadow (§design-system).
   ========================================================================== */

.filter-bar,
.filter-bar-fold:not([open]),
.kpi-card,
.dash-graph {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
