/* The console's, the back office's and the console's sign-in pages' rules,
 * on top of docs.css.
 *
 * Linked by console/shell.py, ops/shell.py and web/docs_shell.py (for the
 * console's own public pages) after docs.css, which loads the design
 * system's tokens and fonts. This file loads the rest of what these pages
 * take from the design system, vendored unchanged in ds/ (ds/VENDORED.md
 * names the commit): its base, its buttons (.nums-button), its account
 * tables ([data-nums-table]), its header (.nums-header), its layout
 * (.nums-app-shell, .nums-actions) and its sidebar width. What follows is
 * only what the console needs beyond them, drawn from the same tokens, so
 * every surface turns dark with the operating system.
 *
 * Five things are the design system's own rules and nothing of ours
 * (console/README.md, "Design system rules", maps each to its source):
 * the gap in a row of buttons and links (.nums-actions), the content
 * column's width and alignment (.nums-app-shell, workspace profile), the
 * seats (the facts table), and the tables (the workspace table and its cell
 * roles). Nothing below changes their spacing, widths, padding or type. */
@import url("ds/base.css");
@import url("ds/button.css");
@import url("ds/table.css");
@import url("ds/header.css");
@import url("ds/layout.css");
@import url("ds/sidebar.css");

/* The names the console's inline rules use, on the tokens. */
:root {
  --c-ink: var(--color-ink);
  --c-quiet: var(--color-muted);
  --c-rule: var(--color-line);
  --c-rule-light: var(--color-line);
  --c-fill: var(--color-surface);
  --c-bg: var(--color-paper);
}

/* The frame is the design system's (.nums-app-shell, workspace profile):
   its columns, its lane gap and the content lane's start and end padding.
   The sidebar rail (docs.css, .side) sticks under the bar, as the design
   system's .nums-app-sidebar does, and its links start level with the
   page's heading, the lane's start padding below the bar. */
.console-frame > .side { top: var(--site-header-height);
  max-height: calc(100dvh - var(--site-header-height));
  padding-top: var(--layout-start); }
/* One width in the content lane: a notice runs as wide as the tables, as
   paragraphs, ledes and headings do (docs.css gives it the reading width
   elsewhere). The design system's workspace profile has no measure of its
   own (ds/layout.css: .nums-prose[data-layout-profile="workspace"]). */
.console #notice { max-width: none; }
.console { font-size: var(--text-small); line-height: 1.6; }
.console h1 { margin-bottom: 8px; }
/* A page with no lede under its heading starts its first block a little
   lower. */
.console h1:has(+ :not(.lede)) { margin-bottom: 20px; }
.console h2 { font-size: 20px; margin-top: 40px; }
.console h3 { font-size: 15px; margin: 24px 0 8px; }
/* The one exception to the single width: the design system caps a page
   description at its workspace description measure (640px). */
.console .lede { color: var(--color-muted); margin: 0 0 28px;
  max-width: var(--workspace-description-measure, 640px); }
.console small, .console .quiet-text { color: var(--color-muted); font-weight: 400; }
.console label small { font-size: 12px; }
.console form p { margin: 0 0 var(--form-field-space); }
/* Fields fill the content lane, as the design system's native account
   fields do (platform.css: ".nums-app-content :is(input, select, textarea)
   { width: 100%; max-width: 100% }"), so a form's right edge is the
   tables'. A field in a table cell or beside a button keeps its own size. */
.nums-app-content :is(input[type=text], input[type=email], input[type=number],
  input[type=password], input[type=search], input[type=url], input:not([type]),
  select, textarea) { width: 100%; max-width: 100%; }
.nums-app-content td :is(input, select, textarea) { width: auto; }

/* Rows of buttons and links are the design system's action row
   (ds/layout.css, .nums-actions: wraps, its 8px --stack-space-xs gap, no
   outer spacing); the form's paragraph flow above owns the space after it. */
.nums-actions > form { margin: 0; }

/* Tables are the design system's account tables (ds/table.css), as they
   are: frame, 14px type, 14px by 16px cell insets, muted header row on the
   soft surface, figures end aligned in tabular digits, wrapping by cell
   role, and a table wider than the lane scrolling in its named region.
   The console adds only the space under a table, the parent's (it has no
   flow parent of the design system's), and the muted row of something
   archived. */
.console [data-nums-table] { margin: 0 0 28px; }
/* A free-text detail cell (console_shell.table `detail`: Activity's
   Detail) is the one cell that may break inside a long token -- an id, an
   address -- so the names, dates and states beside it stay whole and the
   table stays inside the lane (Activity at 1440px, with two long
   addresses beside it). The design system has no such role; this is
   wrapping only, no spacing, width or type of its own: the table's
   automatic layout gives the cell the room the others leave. */
.console [data-nums-table] [data-cell-wrap] { overflow-wrap: anywhere; }
.console [data-nums-table] [data-cell-wrap] .nb { white-space: normal; }
/* An id in code there breaks too: the design system keeps a cell's code
   on one line, which in this cell is the long token it exists to break
   (the back office's Activity Target, a 50-character lot id). */
.console [data-nums-table] [data-cell-wrap] code { white-space: normal; overflow-wrap: anywhere; }
.console .off td { color: var(--color-muted); }
.console a.nums-button, .doc p a.nums-button { text-decoration: none; }

/* Forms: a row of fields and its button, and the small forms in a table
   row, whose buttons are the design system's small size as they are. */
.console .inline { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end;
  max-width: none; margin-bottom: 8px; }
.console .inline p { margin: 0; flex: 1 1 240px; }
.console .inline p.fit { flex: 0 0 auto; }
.console .row-form { display: inline-flex; flex-wrap: wrap; gap: var(--stack-space-xs);
  align-items: center; margin: 0; }
.console .row-form :is(select, input) { min-height: var(--button-height-sm); padding-block: 6px; }
/* The back office's Polar orders: the reasons are sentences, so their column
   keeps room to be read; the actions sit beside them, stacked (link, note,
   button), so they are in view however narrow the lane and only the figures
   scroll. */
.console table.polar-orders :is(th, td):first-child { min-width: 18rem; }
.console table.polar-orders td:nth-child(2) { min-width: 12rem; }
.console table.polar-orders td:nth-child(2) > a { display: inline-flex; margin-bottom: var(--stack-space-xs); }
.console table.polar-orders td:nth-child(2) .row-form { display: flex; flex-direction: column;
  align-items: flex-start; }
.console table.polar-orders td:nth-child(2) .row-form input { width: 100%; box-sizing: border-box; }
/* The back office's credit lots: where the lot came from, with its ids
   beneath, keeps room; the figures and the action stay in the lane. */
.console table.credit-lots :is(th, td):first-child { min-width: 18rem; }
.console table.credit-lots td:first-child [data-cell-detail],
.console table.credit-lots td:first-child [data-cell-detail] code { white-space: normal; overflow-wrap: anywhere; }
.console table.credit-lots td:nth-child(2) { white-space: nowrap; }
.console .pager { display: flex; flex-wrap: wrap; gap: 16px; color: var(--color-muted); }
.console .pager a { color: var(--color-ink); }

/* Tabs over a list (the back office's open and done requests): the
   sidebar's links laid in a row, the current one on the same soft fill. */
.console .tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 24px; }
.console .tabs a {
  min-height: 36px; padding: 8px 14px;
  border-radius: var(--radius-field);
  color: var(--color-muted); font-size: 13px; line-height: 1.5; text-decoration: none;
}
.console .tabs a:hover { color: var(--color-ink); background: var(--color-surface-raised); }
.console .tabs a[aria-current] { color: var(--color-ink); background: var(--color-accent-soft);
  font-weight: 500; }

/* Links that are actions are the design system's small outlined pill
   (.nums-button-outline, ds/button.css). One that stops a customer or
   cannot be undone (archive, remove, suspend, close) is drawn in the danger
   colour, outline and text only, and so is the button that does it. */
.console .nums-button.danger {
  --button-ink: var(--color-status-danger);
  --button-background: transparent;
  --button-border: var(--color-status-danger);
  --button-hover-background: var(--color-accent-soft);
  --button-hover-border: var(--color-status-danger);
  --button-shadow: none;
  background: transparent; color: var(--color-status-danger);
  border-color: var(--color-status-danger); box-shadow: none;
}
.console .nums-button.danger:hover:not([disabled]) {
  background: var(--color-accent-soft); border-color: var(--color-status-danger); }

/* --- The sidebar's own parts: the workspace picker, the way back, the account
   menu at its foot. The narrow menu (.menu-side, under 850px) is drawn by the
   same builder (console/shell.py _rail) and shares these rules. ------------ */
:is(.side, .menu-side) .ws { margin: 0 0 24px; }
:is(.side, .menu-side) .ws summary {
  cursor: pointer; list-style: none;
  display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--color-button-line);
  border-radius: var(--radius-field);
  background: var(--color-surface);
}
:is(.side, .menu-side) .ws summary:hover { border-color: var(--color-button-hover-line); }
:is(.side, .menu-side) .ws summary::-webkit-details-marker { display: none; }
:is(.side, .menu-side) .ws summary span { display: block; grid-column: 1; font-size: 12px; color: var(--color-muted); line-height: 1.4; }
:is(.side, .menu-side) .ws summary strong { grid-column: 1; font-weight: 500; font-size: 13px; line-height: 1.5;
  overflow-wrap: anywhere; }
/* The chevron at the right, pointing down when closed and up when open. */
:is(.side, .menu-side) .ws summary::after {
  content: ""; grid-column: 2; grid-row: 1 / span 2;
  width: 6px; height: 6px; margin-top: -3px;
  border-right: 1px solid currentColor; border-bottom: 1px solid currentColor;
  transform: rotate(45deg);
}
:is(.side, .menu-side) .ws[open] summary::after { transform: translateY(3px) rotate(225deg); }
:is(.side, .menu-side) .ws[open] summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
:is(.side, .menu-side) .ws > a { margin-top: 2px; }
/* The organisation at the top (console/shell.py _org_switcher): the picker's
   look; a person in one organisation sees the name alone, without the box. */
:is(.side, .menu-side) .org-pick { margin: 0 0 16px; }
:is(.side, .menu-side) .org-now { padding: 0 8px; }
:is(.side, .menu-side) .org-now span { display: block; font-size: 12px; color: var(--color-muted); line-height: 1.4; }
:is(.side, .menu-side) .org-now strong { display: block; font-weight: 500; font-size: 13px; line-height: 1.5;
  overflow-wrap: anywhere; }
:is(.side, .menu-side) .org-pick form { margin: 0; }
:is(.side, .menu-side) .org-pick .org-here,
:is(.side, .menu-side) .org-pick button.org-choice {
  display: block; width: 100%; min-height: 36px; margin: 2px 0 0; padding: 8px;
  border: 0; border-radius: var(--radius-field); box-shadow: none; background: none;
  font: inherit; font-size: 13px; line-height: 1.5; text-align: left;
  color: var(--color-muted); overflow-wrap: anywhere; white-space: normal;
}
:is(.side, .menu-side) .org-pick button.org-choice { cursor: pointer; }
:is(.side, .menu-side) .org-pick button.org-choice:hover { color: var(--color-ink); background: var(--color-surface-raised); }
:is(.side, .menu-side) .org-pick .org-here { color: var(--color-ink); background: var(--color-accent-soft); font-weight: 500; }
.menu-side .org-pick .org-here, .menu-side .org-pick button.org-choice {
  display: flex; align-items: center; justify-content: flex-start; min-height: 44px;
  font-size: 17px; line-height: 1.4; color: var(--color-ink); }
:is(.side, .menu-side) .back { margin: 0 0 20px; }
:is(.side, .menu-side) .back a::before { content: "\2190\00a0"; }
/* In a workspace's settings the picker follows the way back, as close under
   it as in the reference look (an arrow, then the workspace selector). */
:is(.side, .menu-side) .back + .ws { margin-top: -8px; }
/* App mode: Workspace settings and Organization settings between the pages
   and the account block, a divider above them; the account block's own top
   border is the one below. */
:is(.side, .menu-side) .side-settings {
  margin-top: 32px; padding-top: 16px;
  border-top: 1px solid var(--color-line);
}
:is(.side, .menu-side) .side-settings + .acct { margin-top: 16px; }
:is(.side, .menu-side) .acct {
  margin-top: 32px; padding: 8px 0 0;
  border-top: 1px solid var(--color-line);
}
/* The account block: an icon tile and the name over the organization,
   one link to My account. */
:is(.side, .menu-side) a.acct-card {
  display: flex; align-items: center; gap: 12px; padding: 8px;
  border-radius: var(--radius-field); color: var(--color-ink); text-decoration: none;
}
:is(.side, .menu-side) a.acct-card:hover, :is(.side, .menu-side) a.acct-card[aria-current="page"] { background: var(--color-accent-soft); }
:is(.side, .menu-side) .acct-icon {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid var(--color-line); border-radius: 8px;
  background: var(--color-surface); color: var(--color-muted);
}
:is(.side, .menu-side) .acct-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
:is(.side, .menu-side) .acct-name { font-size: 14px; font-weight: 500; color: var(--color-ink);
  overflow-wrap: anywhere; }
:is(.side, .menu-side) .acct .org { font-size: 13px; color: var(--color-muted); overflow-wrap: anywhere; }
/* A button that reads as a link: the organisation switcher's entries. */
.console .switch, .side .acct .switch {
  display: inline; min-height: 0; padding: 4px 0;
  background: none; border: 0; border-radius: 0; box-shadow: none;
  color: var(--color-ink); font: inherit; font-size: 13px; font-weight: 400; text-align: left;
  white-space: normal;
  text-decoration: underline; text-decoration-color: var(--color-button-hover-line);
  text-underline-offset: 3px; cursor: pointer;
}
.console .switch:hover:not([disabled]), .side .acct .switch:hover:not([disabled]) {
  background: none; text-decoration-color: var(--color-ink); }

/* Under 850px the sidebar is gone and the header's menu (ds/header.css,
   .nums-header-menu, a native <details>) holds the sidebar's own parts
   (.menu-side): the same items in the same order, with touch-sized links. */
.nums-native-menu-panel { box-shadow: 0 18px 48px var(--color-shadow); }
.nums-native-menu-panel nav.menu { display: flex; flex-direction: column; }
.nums-native-menu-panel nav.menu > a {
  display: flex; align-items: center; min-height: 48px; padding-block: 8px;
  font-size: 20px; line-height: 1.4; letter-spacing: -.02em;
  color: var(--color-ink); text-decoration: none;
  border-bottom: 1px solid var(--color-line);
}
.nums-native-menu-panel nav.menu > a[aria-current] { text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: 6px; }
.menu-side .side-label { display: block; margin: 0 0 4px; font-size: 13px; font-weight: 600;
  color: var(--color-ink); }
.menu-side .back > a, .menu-side .ws > a, .menu-side .side-group > a,
.menu-side .side-settings > a {
  display: flex; align-items: center; min-height: 44px; padding: 8px;
  border-radius: var(--radius-field);
  font-size: 17px; line-height: 1.4; color: var(--color-ink); text-decoration: none;
}
.menu-side .back > a[aria-current], .menu-side .ws > a[aria-current],
.menu-side .side-group > a[aria-current], .menu-side .side-settings > a[aria-current] {
  background: var(--color-accent-soft); font-weight: 500; }
.menu-side :is(.side-settings, .acct) { margin-top: 16px; }
.nums-mobile-trigger span { transition: transform var(--motion-fast); }
/* The brand mark and the context label keep docs.css's link rules out. */
.nums-header a { text-decoration: none; }

@media (max-width: 640px) {
  .console .inline p, .console .inline p.fit { flex: 1 1 100%; }
}

/* --- The back office (ops/shell.py) ------------------------------------------ */
.console pre.plan {
  white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--color-surface) !important;
}
/* The back office's cells that break inside a long id (a personal
   account's Recent activity: Target, Detail) keep a floor, so a narrow
   lane scrolls the table in its frame rather than stack an id one
   character group to a line. */
body[data-section="ops"] .console [data-nums-table] [data-cell-wrap] { min-width: 9rem; }



/* Dashboard: the title with its one action on one row. */
.console .page-head { display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; }
.console .page-head h1 { margin-right: auto; }
/* Room between the title row and what follows it, as under a page title
   (2026-11-02: the table sat close under "Create API key"). */
.console .page-head { margin-bottom: 24px; }

/* A Name row (My account, Workspace and Organization settings' General):
   the field and Save on one line, right-aligned like the other values in
   the table. On a phone the field takes its own line under the label and
   Save goes under it, so neither is squeezed or cut off. */
.console .name-form { display: flex; flex-wrap: nowrap; justify-content: flex-end;
  align-items: center; gap: var(--stack-space-xs); }
.console .name-form input { flex: 0 1 240px; min-width: 0; }
@media (max-width: 600px) {
  .console [data-nums-table="facts"]:has(.name-form) :is(table, tbody, tr, th, td) {
    display: block; width: auto; text-align: left; }
  .console [data-nums-table="facts"]:has(.name-form) th { padding-bottom: 0; border-bottom: 0; }
  .console [data-nums-table="facts"]:has(.name-form) td { overflow-wrap: anywhere; }
  .console [data-nums-table="facts"]:has(.name-form) td * { white-space: normal; }
  .console .name-form { flex-wrap: wrap; justify-content: flex-start; }
  .console .name-form input { flex: 1 1 100%; }
}

/* Workspace settings, Members: one box a person to add several at once
   (2026-11-02). */
.console fieldset.checks { border: 0; padding: 0; margin: 0 0 16px; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; }
.console fieldset.checks legend { padding: 0; margin-bottom: 8px; font-weight: 500; }
.console label.check { display: flex; align-items: center; gap: 8px; }
.console label.check input { width: auto; flex: none; }
.console label.check small { color: var(--color-muted); }
/* Organization settings, Members: room between the invite form and the
   member table under it. */
.console form.invite-form { margin-bottom: 32px; }
