/*
 * Campuslook design system: tokens.
 * Light values were measured from what 광고 and 챙길 일 rendered on 2026-11-18
 * (computed styles at 1440px); see docs/design-system.md for the table and the
 * few contrast fixes. Every new or converted screen reads these tokens only.
 * Screens that are not converted yet keep their own colours (styles.css :root),
 * so changing a token here never changes them.
 */
/* Pretendard (SIL Open Font License 1.1, assets/licenses/Pretendard-OFL.txt), served by this app; no outside request. */
@font-face {
  font-family: "Pretendard Variable";
  src: url("assets/fonts/PretendardVariable.woff2") format("woff2-variations"), url("assets/fonts/PretendardVariable.woff2") format("woff2");
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
}

/* While the old operations screen (#app > .app-shell, not converted) is open, a dialog it opens outside the theme layer
   (body > not #app/#toast-region/.ds-layer) reads the light values in dark mode too. Every menu of the order workspace
   is converted (DESIGN_SYSTEM_VIEWS), so there every dialog, popup and toast follows the theme. */
:root[data-theme="dark"]:has(#app > .app-shell) body > :not(#app):not(#toast-region):not(.ds-layer),
:root,
.ds-theme-light {
  /* Colour roles: light */
  --ds-canvas: #f5f5f7;
  --ds-surface: #ffffff;
  --ds-sunken: #f1f1f4;
  --ds-raised: #ffffff; /* menus, popovers, the chosen segment: one step above surface */
  --ds-ink: #1d1d1f;
  --ds-ink-2: #6d6d72;
  --ds-ink-3: #8e8e93; /* placeholder, disabled, decoration only: 3.3:1, never for information */
  --ds-placeholder: var(--ds-ink-3); /* the hint text inside an empty input */
  --ds-line: #e1e1e5;
  --ds-line-strong: #d4d4d9;
  --ds-line-on-raised: #e1e1e5; /* lines drawn on --ds-raised: menu borders and separators, popovers, the chosen segment */
  --ds-accent: #0071e3;
  --ds-accent-strong: #005bb5; /* pressed state and accent text on --ds-accent-soft */
  --ds-on-accent: #ffffff;
  --ds-accent-soft: #eaf4ff;
  --ds-danger: #c4271b;
  --ds-danger-soft: #fff0ef;
  --ds-warn: #ad4c0d;
  --ds-warn-soft: #fff1e6;
  --ds-ok: #157a4a;
  --ds-ok-soft: #e9f7ef;
  --ds-info: #005bb5;
  --ds-info-soft: #eaf4ff;
  --ds-scrim: rgba(17, 17, 20, .32);
  --ds-focus: var(--ds-accent);
  --ds-shadow-1: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .04);
  --ds-shadow-2: 0 2px 6px rgba(0, 0, 0, .06), 0 16px 40px rgba(0, 0, 0, .14);
  /* Chart series: the first is the accent; the others are only for lines that must be told apart. */
  --ds-series-1: #0071e3;
  --ds-series-2: #e8590c;
  --ds-series-3: #c2255c;
  --ds-series-muted: #76767d;

  /* Type: one family, eight sizes, one per role, each a visible step from its neighbours (2026-11-18 design reset:
     the owner found 11–15px "all the same size"). Nothing that carries information is under 12px.
     From 1,680px wide every step but xs goes up one notch (below). */
  --ds-font-sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --ds-font-xs: 12px;   /* 배지, 각주 */
  --ds-font-sm: 13px;   /* 보조: 주문번호, 시각, 메타 정보, 버튼, 표 칸 */
  --ds-font-md: 15px;   /* 본문과 값 */
  --ds-font-name: 16px; /* 줄의 주인공: 목록 한 줄의 단체명 (굵게) */
  --ds-font-lg: 18px;   /* 묶음 제목: 날짜 묶음, 카드 제목 */
  --ds-font-xl: 22px;   /* 구역 제목, 상세의 주인공 */
  --ds-font-2xl: 28px;  /* 화면 제목 */
  --ds-font-3xl: clamp(26px, 2.6vw, 34px); /* 핵심 숫자: 요약 건수·금액 */
  --ds-weight-regular: 400;
  --ds-weight-medium: 500;
  --ds-weight-strong: 650;
  --ds-weight-bold: 700;
  --ds-leading-tight: 1.25;
  --ds-leading: 1.5;
  --ds-leading-loose: 1.65;
  --ds-tracking-title: -.03em;
  --ds-tracking-body: -.01em;

  /* Space, size, shape */
  --ds-space-1: 4px;
  --ds-space-2: 8px;
  --ds-space-3: 12px;
  --ds-space-4: 16px;
  --ds-space-5: 20px;
  --ds-space-6: 24px;
  --ds-space-7: 32px;
  --ds-space-8: 48px;
  --ds-control-sm: 32px;
  --ds-control-md: 40px;
  --ds-touch: 44px;
  --ds-icon-sm: 16px;
  --ds-icon-md: 18px;
  --ds-icon-lg: 20px;
  --ds-radius-sm: 6px;
  --ds-radius-md: 10px;
  --ds-radius-lg: 16px;

  /* Motion */
  --ds-duration-fast: 120ms;
  --ds-duration: 160ms;
  --ds-duration-slow: 180ms;
  --ds-ease: cubic-bezier(.2, 0, 0, 1);
  --ds-ease-exit: cubic-bezier(.4, 0, 1, 1);

  --ds-z-menu: 80;
  --ds-z-toast: 90;
}

/* Colour roles: dark. Applied when theme-boot.js resolves the choice to dark (.ds-theme-dark forces it on one panel, as in the style guide). */
:root[data-theme="dark"],
.ds-theme-dark {
  --ds-canvas: #141416;
  --ds-surface: #1c1c1f;
  --ds-sunken: #26262a;
  --ds-raised: #2c2c31;
  --ds-ink: #f2f2f4;
  --ds-ink-2: #a8a8b0;
  --ds-ink-3: #7c7c85;
  --ds-placeholder: #9a9aa2; /* 4.5:1 or more on every dark surface (--ds-raised 4.97:1); --ds-ink-3 is 3.4–4.1:1 */
  --ds-line: #2c2c31;
  --ds-line-strong: #3a3a40;
  --ds-line-on-raised: #3e3e45; /* --ds-line equals --ds-raised in dark, so lines on a raised panel need their own step */
  --ds-accent: #5ea2ff;
  --ds-accent-strong: #8cbcff;
  --ds-on-accent: #0b1424;
  --ds-accent-soft: #17263a;
  --ds-danger: #ff7b70;
  --ds-danger-soft: #3a1f1d;
  --ds-warn: #f0a35a;
  --ds-warn-soft: #382a18;
  --ds-ok: #55c98f;
  --ds-ok-soft: #16301f;
  --ds-info: #8cbcff;
  --ds-info-soft: #17263a;
  --ds-scrim: rgba(0, 0, 0, .56);
  --ds-shadow-1: 0 1px 2px rgba(0, 0, 0, .32);
  --ds-shadow-2: 0 2px 6px rgba(0, 0, 0, .32), 0 16px 40px rgba(0, 0, 0, .48);
  --ds-series-1: #5ea2ff;
  --ds-series-2: #ff8a4c;
  --ds-series-3: #f06595;
  --ds-series-muted: #8a8a93;
}

/* Wide monitors (the owner works at about 2,240px): one notch up so a line of text fills its width and the roles stay apart.
   Same selector list as the light block, because that block re-declares the sizes on dialogs outside the theme layer. */
@media (min-width: 1680px) {
  :root[data-theme="dark"]:has(#app > .app-shell) body > :not(#app):not(#toast-region):not(.ds-layer),
  :root,
  .ds-theme-light {
    --ds-font-sm: 14px;
    --ds-font-md: 16px;
    --ds-font-name: 17px;
    --ds-font-lg: 20px;
    --ds-font-xl: 24px;
    --ds-font-2xl: 30px;
    --ds-font-3xl: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --ds-duration-fast: 0ms;
    --ds-duration: 0ms;
    --ds-duration-slow: 0ms;
  }
}

/*
 * Theme scope.
 * Dark applies to the order workspace (every menu is converted: the frame gets data-ds-view), the signed-out pages
 * (.ds-layer) and every dialog, popup and toast opened from them. Only the old operations screen (#app > .app-shell)
 * is not converted: it and the dialogs it opens stay light. styles.css's dark colour layer turns the colours its rules
 * still name into tokens; tests/helpers/dark-mode-sweep-browser-check.mjs checks every menu in a real browser.
 */
:root[data-theme="dark"], .ds-theme-dark { color-scheme: dark; }
.ds-theme-light { color-scheme: light; }
:root[data-theme="dark"] .order-workspace-frame:not([data-ds-view]) > .order-workspace-content,
:root[data-theme="dark"] #app > :not(.order-workspace-frame):not(.skip-link):not(.ds-layer),
:root[data-theme="dark"]:has(#app > .app-shell) body > :not(#app):not(#toast-region):not(.ds-layer) { color-scheme: light; }
.order-workspace-frame[data-ds-view] { color: var(--ds-ink); background: var(--ds-canvas); }
.order-workspace-frame[data-ds-view] > .order-workspace-content { font-family: var(--ds-font-sans); }
:root[data-theme="dark"]:has(.order-workspace-frame[data-ds-view], #app > .ds-layer),
:root[data-theme="dark"]:has(.order-workspace-frame[data-ds-view], #app > .ds-layer) body { background: var(--ds-canvas); }

/* Segmented control: one choice out of a few (period, view, theme). */
.ds-segmented { display: inline-flex; align-items: stretch; gap: 2px; min-width: 0; padding: 2px; border-radius: var(--ds-radius-md); background: var(--ds-sunken); }
.ds-segmented > button { flex: 1 1 auto; min-width: 0; min-height: var(--ds-control-sm); padding: 0 var(--ds-space-3); border: 0; border-radius: calc(var(--ds-radius-md) - 2px); color: var(--ds-ink-2); background: transparent; font: inherit; font-size: var(--ds-font-sm); font-weight: var(--ds-weight-medium); line-height: 1.2; white-space: nowrap; cursor: pointer; transition: background-color var(--ds-duration) var(--ds-ease), color var(--ds-duration) var(--ds-ease), box-shadow var(--ds-duration) var(--ds-ease); }
.ds-segmented > button:hover { color: var(--ds-ink); }
.ds-segmented > button:is([aria-checked="true"], [aria-pressed="true"], [aria-selected="true"]) { color: var(--ds-ink); background: var(--ds-raised); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--ds-line-on-raised); font-weight: var(--ds-weight-strong); }
.ds-segmented > button:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 1px; }
.ds-segmented--block { display: flex; width: 100%; }
.ds-segmented--block > button { flex: 1 1 0; padding: 0 var(--ds-space-1); }
@media (max-width: 900px), (pointer: coarse) {
  .ds-segmented > button { min-height: var(--ds-touch); }
}

/* ---------- Components ---------- */
.ds-icon { width: var(--ds-icon-md); height: var(--ds-icon-md); flex: none; }

/* Buttons: default (outlined), primary (one per area), quiet (text-like), danger. */
.ds-button { display: inline-flex; align-items: center; justify-content: center; gap: var(--ds-space-2); min-height: var(--ds-control-md); padding: 0 var(--ds-space-4); border: 1px solid var(--ds-line-strong); border-radius: var(--ds-radius-md); color: var(--ds-ink); background: var(--ds-surface); font-family: inherit; font-size: var(--ds-font-sm); font-weight: var(--ds-weight-strong); line-height: 1.2; letter-spacing: var(--ds-tracking-body); white-space: nowrap; text-decoration: none; cursor: pointer; transition: background-color var(--ds-duration) var(--ds-ease), border-color var(--ds-duration) var(--ds-ease), color var(--ds-duration) var(--ds-ease), opacity var(--ds-duration) var(--ds-ease); }
.ds-button:hover { background: var(--ds-sunken); }
.ds-button:active { transform: translateY(.5px); }
.ds-button:focus-visible, .ds-icon-button:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.ds-button .ds-icon { width: var(--ds-icon-sm); height: var(--ds-icon-sm); }
.ds-button--primary { border-color: var(--ds-accent); color: var(--ds-on-accent); background: var(--ds-accent); }
.ds-button--primary:hover { border-color: var(--ds-accent-strong); background: var(--ds-accent-strong); }
.ds-button--quiet { border-color: transparent; color: var(--ds-ink-2); background: transparent; }
.ds-button--quiet:hover { color: var(--ds-ink); background: var(--ds-sunken); }
.ds-button--link { border-color: transparent; color: var(--ds-accent); background: transparent; padding-inline: var(--ds-space-2); }
.ds-button--link:hover { color: var(--ds-accent-strong); background: var(--ds-accent-soft); }
.ds-button--danger { color: var(--ds-danger); }
.ds-button--danger:hover { border-color: var(--ds-danger); background: var(--ds-danger-soft); }
.ds-button--sm { min-height: var(--ds-control-sm); padding: 0 var(--ds-space-3); border-radius: var(--ds-radius-sm); }
.ds-button:disabled, .ds-button[aria-disabled="true"], .ds-icon-button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.ds-button:disabled:hover, .ds-button[aria-disabled="true"]:hover { background: var(--ds-surface); }
.ds-button--primary:disabled:hover { background: var(--ds-accent); }
/* Loading: keep the label, show a spinner, block clicks. Set aria-busy="true" while the request runs. */
.ds-button[aria-busy="true"] { pointer-events: none; }
.ds-button[aria-busy="true"]::before { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ds-spin .7s linear infinite; }
.ds-button[aria-busy="true"] > .ds-icon { display: none; }
@keyframes ds-spin { to { transform: rotate(360deg); } }

/* Icon-only button: always give it aria-label. */
.ds-icon-button { display: inline-grid; place-items: center; width: var(--ds-control-md); height: var(--ds-control-md); padding: 0; border: 1px solid transparent; border-radius: var(--ds-radius-md); color: var(--ds-ink-2); background: transparent; cursor: pointer; transition: background-color var(--ds-duration) var(--ds-ease), color var(--ds-duration) var(--ds-ease); }
.ds-icon-button:hover, .ds-icon-button[aria-expanded="true"] { color: var(--ds-ink); background: var(--ds-sunken); }
.ds-icon-button--sm { width: var(--ds-control-sm); height: var(--ds-control-sm); border-radius: var(--ds-radius-sm); }
.ds-icon-button--outline { border-color: var(--ds-line-strong); background: var(--ds-surface); }

/* Dropdown menu: <div class="ds-menu"> trigger [aria-haspopup="menu"] + <div class="ds-menu__list" role="menu" hidden>. ds-components.js positions it. */
.ds-menu { position: relative; display: inline-flex; }
.ds-menu__list { position: fixed; z-index: var(--ds-z-menu); min-width: 180px; max-width: min(320px, calc(100vw - 16px)); max-height: min(420px, calc(100dvh - 16px)); overflow-y: auto; padding: var(--ds-space-1); border: 1px solid var(--ds-line-on-raised); border-radius: var(--ds-radius-md); color: var(--ds-ink); background: var(--ds-raised); box-shadow: var(--ds-shadow-2); font-family: var(--ds-font-sans); opacity: 0; transform: translateY(-4px); transition: opacity var(--ds-duration-fast) var(--ds-ease), transform var(--ds-duration-fast) var(--ds-ease); }
.ds-menu__list[hidden] { display: none; }
.ds-menu__list.is-open { opacity: 1; transform: none; }
.ds-menu__list[data-placement="top"] { transform: translateY(4px); }
.ds-menu__list[data-placement="top"].is-open { transform: none; }
.ds-menu__item { display: flex; align-items: center; gap: var(--ds-space-2); width: 100%; min-height: 36px; padding: 0 var(--ds-space-3); border: 0; border-radius: var(--ds-radius-sm); color: var(--ds-ink); background: transparent; font: inherit; font-size: var(--ds-font-sm); text-align: left; text-decoration: none; cursor: pointer; }
.ds-menu__item:hover, .ds-menu__item:focus-visible { outline: none; background: var(--ds-sunken); }
.ds-menu__item:focus-visible { box-shadow: inset 0 0 0 2px var(--ds-focus); }
.ds-menu__item .ds-icon { width: var(--ds-icon-sm); height: var(--ds-icon-sm); color: var(--ds-ink-2); }
.ds-menu__item[aria-checked="true"]::after { content: ""; width: 8px; height: 4px; margin-left: auto; border: solid var(--ds-accent); border-width: 0 0 2px 2px; transform: rotate(-45deg) translateY(-2px); }
.ds-menu__item--danger { color: var(--ds-danger); }
.ds-menu__item:disabled, .ds-menu__item[aria-disabled="true"] { opacity: .45; cursor: not-allowed; background: transparent; }
.ds-menu__separator { height: 1px; margin: var(--ds-space-1) calc(var(--ds-space-1) * -1); background: var(--ds-line-on-raised); }
.ds-menu__label { padding: var(--ds-space-2) var(--ds-space-3) var(--ds-space-1); color: var(--ds-ink-2); font-size: var(--ds-font-xs); font-weight: var(--ds-weight-medium); }

/* Tabs: switch between views of the same thing. Selected = ink text + accent underline. */
.ds-tabs { display: flex; gap: var(--ds-space-1); min-width: 0; overflow-x: auto; border-bottom: 1px solid var(--ds-line); scrollbar-width: none; }
.ds-tabs > [role="tab"], .ds-tabs > button { position: relative; flex: none; min-height: var(--ds-touch); padding: 0 var(--ds-space-3); border: 0; color: var(--ds-ink-2); background: transparent; font: inherit; font-size: var(--ds-font-md); font-weight: var(--ds-weight-medium); white-space: nowrap; cursor: pointer; transition: color var(--ds-duration) var(--ds-ease); }
.ds-tabs > :is([role="tab"], button):hover { color: var(--ds-ink); }
.ds-tabs > :is([role="tab"], button)::after { content: ""; position: absolute; left: var(--ds-space-3); right: var(--ds-space-3); bottom: -1px; height: 2px; border-radius: 2px; background: transparent; transition: background-color var(--ds-duration) var(--ds-ease); }
.ds-tabs > :is([aria-selected="true"], [aria-current="page"], .is-active) { color: var(--ds-ink); font-weight: var(--ds-weight-strong); }
.ds-tabs > :is([aria-selected="true"], [aria-current="page"], .is-active)::after { background: var(--ds-accent); }
.ds-tabs > :is([role="tab"], button):focus-visible { outline: 2px solid var(--ds-focus); outline-offset: -2px; border-radius: var(--ds-radius-sm); }

/* Status mark: dot + words. The words carry the meaning; the dot only helps scanning. */
.ds-status { display: inline-flex; align-items: center; gap: 6px; color: var(--ds-ink-2); font-size: var(--ds-font-sm); font-weight: var(--ds-weight-medium); white-space: nowrap; }
.ds-status::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--ds-ink-3); }
.ds-status--info::before { background: var(--ds-info); }
.ds-status--ok { color: var(--ds-ok); }
.ds-status--ok::before { background: var(--ds-ok); }
.ds-status--warn { color: var(--ds-warn); }
.ds-status--warn::before { background: var(--ds-warn); }
.ds-status--danger { color: var(--ds-danger); }
.ds-status--danger::before { background: var(--ds-danger); }
.ds-status--quiet::before { display: none; }

/* Badge: a short label next to a name (중복 제외, 측정 전). Outlined, not filled. Count: a number on a menu item. */
.ds-badge { display: inline-flex; align-items: center; min-height: 20px; padding: 0 6px; border: 1px solid var(--ds-line-strong); border-radius: var(--ds-radius-sm); color: var(--ds-ink-2); background: transparent; font-size: var(--ds-font-xs); font-weight: var(--ds-weight-medium); line-height: 1; white-space: nowrap; vertical-align: middle; }
.ds-badge--accent { border-color: transparent; color: var(--ds-accent-strong); background: var(--ds-accent-soft); }
.ds-badge--warn { border-color: transparent; color: var(--ds-warn); background: var(--ds-warn-soft); }
.ds-badge--danger { border-color: transparent; color: var(--ds-danger); background: var(--ds-danger-soft); }
.ds-count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; color: var(--ds-danger); background: var(--ds-danger-soft); font-size: var(--ds-font-xs); font-weight: var(--ds-weight-bold); font-variant-numeric: tabular-nums; line-height: 1; }

/* Text input and select. */
.ds-input, .ds-select { min-height: var(--ds-control-md); width: 100%; min-width: 0; padding: 0 var(--ds-space-3); border: 1px solid var(--ds-line-strong); border-radius: var(--ds-radius-md); color: var(--ds-ink); background: var(--ds-surface); font: inherit; font-size: var(--ds-font-md); transition: border-color var(--ds-duration) var(--ds-ease), box-shadow var(--ds-duration) var(--ds-ease); }
.ds-input::placeholder { color: var(--ds-placeholder); }
/* Dark: every input's hint text, also where a screen leaves it to the browser (#757575, 3.5:1 on the dark surfaces). */
:root[data-theme="dark"] ::placeholder { color: var(--ds-placeholder); }
.ds-input:hover, .ds-select:hover { border-color: var(--ds-ink-3); }
.ds-input:focus-visible, .ds-select:focus-visible { outline: none; border-color: var(--ds-accent); box-shadow: 0 0 0 3px var(--ds-accent-soft); }
.ds-input:disabled, .ds-select:disabled { opacity: .5; cursor: not-allowed; }
.ds-input[aria-invalid="true"] { border-color: var(--ds-danger); }
.ds-select { appearance: none; padding-right: 34px; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--ds-ink-2) 50%), linear-gradient(135deg, var(--ds-ink-2) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.ds-field { display: grid; gap: 6px; color: var(--ds-ink-2); font-size: var(--ds-font-sm); font-weight: var(--ds-weight-medium); }
.ds-input--sm, .ds-select--sm { min-height: var(--ds-control-sm); font-size: var(--ds-font-sm); border-radius: var(--ds-radius-sm); }

/* Page frame: every screen's content (except 진행주문) starts at the same gutter and top, so the title
   stands at the same place on every screen at any width. Left aligned; a screen may cap its width but never centres. */
:root { --ds-page-gutter: 32px; --ds-page-top: 24px; --ds-page-header-gap: var(--ds-space-4); }
@media (max-width: 1279px) { :root { --ds-page-gutter: 24px; } }
@media (max-width: 900px) { :root { --ds-page-top: 16px; } }
@media (max-width: 599px) { :root { --ds-page-gutter: 16px; } }
.order-workspace-frame[data-ds-view]:not([data-ds-view="order-desk"]) > .order-workspace-content > .order-workspace-page { margin: 0; padding: var(--ds-page-top) var(--ds-page-gutter) var(--ds-page-gutter); }

/* Page header and toolbar. */
.ds-page-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: flex-start; gap: var(--ds-space-3) var(--ds-space-4); min-height: var(--ds-control-md); margin: 0 0 var(--ds-page-header-gap); }
.ds-page-header > :last-child:not(:first-child) { margin-left: auto; }
/* The title line is one control high, so its baseline sits at the same place whatever stands beside it. */
.ds-page-header h1, .ds-page-title { margin: 0; color: var(--ds-ink); font-size: var(--ds-font-2xl); font-weight: var(--ds-weight-bold); line-height: var(--ds-control-md); letter-spacing: var(--ds-tracking-title); }
.ds-page-header__title { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--ds-space-2); min-width: 0; }
.ds-page-header__meta { color: var(--ds-ink-2); font-size: var(--ds-font-sm); font-weight: var(--ds-weight-regular); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ds-page-header p, .ds-page-description { margin: var(--ds-space-2) 0 0; color: var(--ds-ink-2); font-size: var(--ds-font-md); line-height: var(--ds-leading); }
.ds-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-2); min-width: 0; }
.ds-toolbar__spacer { flex: 1 1 auto; }
/* One header on every screen: screen rules may arrange what sits in it, not its place, title or control height. */
.order-workspace-frame[data-ds-view]:not([data-ds-view="order-desk"]) .ds-page-header { align-items: flex-start; min-height: var(--ds-control-md); max-width: none; margin: 0 0 var(--ds-page-header-gap); padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.order-workspace-frame[data-ds-view]:not([data-ds-view="order-desk"]) .ds-page-header h1 { margin: 0; color: var(--ds-ink); font-size: var(--ds-font-2xl); font-weight: var(--ds-weight-bold); line-height: var(--ds-control-md); letter-spacing: var(--ds-tracking-title); }
.order-workspace-frame[data-ds-view]:not([data-ds-view="order-desk"]) .ds-page-header :is(.ds-button, .ds-input, .ds-select, select, input:not([type="checkbox"]):not([type="radio"])) { min-height: var(--ds-control-md); }
.order-workspace-frame[data-ds-view]:not([data-ds-view="order-desk"]) .ds-page-header .ds-icon-button:not(.ds-page-header__title *) { width: var(--ds-control-md); height: var(--ds-control-md); }
.order-workspace-frame[data-ds-view]:not([data-ds-view="order-desk"]) .ds-page-header .ds-segmented > button { min-height: calc(var(--ds-control-md) - 4px); }
@media (max-width: 900px), (pointer: coarse) {
  .order-workspace-frame[data-ds-view]:not([data-ds-view="order-desk"]) .ds-page-header :is(.ds-button, .ds-input, .ds-select, select, input:not([type="checkbox"]):not([type="radio"])) { min-height: var(--ds-touch); }
  .order-workspace-frame[data-ds-view]:not([data-ds-view="order-desk"]) .ds-page-header .ds-icon-button:not(.ds-page-header__title *) { width: var(--ds-touch); height: var(--ds-touch); }
  .order-workspace-frame[data-ds-view]:not([data-ds-view="order-desk"]) .ds-page-header .ds-segmented > button { min-height: calc(var(--ds-touch) - 4px); }
}
/* At 900px and below the top bar names the screen: the in-page title stays for screen readers only. */
@media (max-width: 900px) {
  .order-workspace-frame[data-ds-view]:not([data-ds-view="order-desk"]) .ds-page-header { min-height: 0; }
  .order-workspace-frame[data-ds-view]:not([data-ds-view="order-desk"]) .ds-page-header h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* Group: a card with a header row and a list of rows. Tone shows on the header's left edge. */
.ds-group { margin: 0 0 var(--ds-space-4); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-lg); background: var(--ds-surface); box-shadow: var(--ds-shadow-1); overflow: hidden; }
.ds-group__header { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--ds-space-1) var(--ds-space-3); min-height: 48px; margin: 0; padding: var(--ds-space-3) var(--ds-space-4); border-bottom: 1px solid var(--ds-line); box-shadow: inset 3px 0 0 var(--ds-group-tone, transparent); }
.ds-group__title { margin: 0; color: var(--ds-ink); font-size: var(--ds-font-lg); font-weight: var(--ds-weight-bold); letter-spacing: var(--ds-tracking-title); }
:where(.ds-group__note) { color: var(--ds-ink-2); font-size: var(--ds-font-sm); font-weight: var(--ds-weight-medium); }
.ds-group__count { margin-left: auto; color: var(--ds-ink-2); font-size: var(--ds-font-sm); font-variant-numeric: tabular-nums; }
.ds-group--danger { --ds-group-tone: var(--ds-danger); }
.ds-group--warn { --ds-group-tone: var(--ds-warn); }
.ds-group--info { --ds-group-tone: var(--ds-accent); }
.ds-group--neutral { --ds-group-tone: var(--ds-line-strong); }

/* List row: main text grows, status/time/actions stay on the right and wrap under it when narrow. */
.ds-list { margin: 0; padding: 0; list-style: none; }
.ds-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-1) var(--ds-space-3); min-height: 56px; padding: var(--ds-space-2) var(--ds-space-4); border-bottom: 1px solid var(--ds-line); transition: background-color var(--ds-duration-fast) var(--ds-ease); }
.ds-row:last-child { border-bottom: 0; }
.ds-row:hover { background: color-mix(in srgb, var(--ds-sunken) 55%, transparent); }
.ds-row__main { flex: 1 1 280px; min-width: 0; }
.ds-row__title { color: var(--ds-ink); font-size: var(--ds-font-name); font-weight: var(--ds-weight-bold); }
.ds-row__meta { color: var(--ds-ink-2); font-size: var(--ds-font-sm); }
.ds-row__aside { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-1) var(--ds-space-3); color: var(--ds-ink-2); font-size: var(--ds-font-sm); font-variant-numeric: tabular-nums; }
.ds-row__actions { display: flex; flex: none; gap: var(--ds-space-1); margin-left: auto; }

/* One-line states: loading, empty, error. */
.ds-state { display: flex; align-items: center; gap: var(--ds-space-2); margin: 0 0 var(--ds-space-4); padding: var(--ds-space-4); border: 1px dashed var(--ds-line-strong); border-radius: var(--ds-radius-lg); color: var(--ds-ink-2); font-size: var(--ds-font-md); line-height: var(--ds-leading); }
.ds-state .ds-icon { color: var(--ds-ink-2); }
.ds-state--loading::before { content: ""; width: 16px; height: 16px; flex: none; border: 2px solid var(--ds-line-strong); border-top-color: var(--ds-accent); border-radius: 50%; animation: ds-spin .8s linear infinite; }
.ds-state--error { border-style: solid; border-color: transparent; color: var(--ds-danger); background: var(--ds-danger-soft); }
.ds-state--error .ds-icon { color: var(--ds-danger); }
.ds-state--note { border-style: solid; border-color: transparent; background: var(--ds-sunken); font-size: var(--ds-font-sm); }
.ds-state .ds-button { margin-left: auto; }

/* Toast (toast() in app.js). Inverse surface in light, a raised panel in dark; danger keeps the same surface with a red mark. */
.ds-toast-region { position: fixed; right: 22px; bottom: 22px; z-index: var(--ds-z-toast); display: grid; gap: var(--ds-space-2); }
.ds-toast { display: flex; align-items: flex-start; gap: var(--ds-space-2); max-width: 380px; padding: var(--ds-space-3) var(--ds-space-4); border-radius: var(--ds-radius-md); color: var(--ds-surface); background: var(--ds-ink); box-shadow: var(--ds-shadow-2); font-family: var(--ds-font-sans); font-size: var(--ds-font-sm); line-height: var(--ds-leading); animation: ds-toast-in var(--ds-duration-slow) var(--ds-ease) both; }
/* Dark: a toast is a raised dark panel; the ink-filled toast of the light screen would be a white block. */
:root[data-theme="dark"] .ds-toast, .ds-theme-dark .ds-toast { color: var(--ds-ink); background: var(--ds-raised); box-shadow: 0 0 0 1px var(--ds-line-on-raised), var(--ds-shadow-2); }
.ds-toast--danger::before { content: ""; width: 8px; height: 8px; flex: none; margin-top: 6px; border-radius: 50%; background: var(--ds-danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ds-danger) 30%, transparent); }
@keyframes ds-toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Narrow screens and touch: every control reaches 44px. */
@media (max-width: 900px), (pointer: coarse) {
  .ds-button, .ds-button--sm, .ds-input, .ds-select, .ds-menu__item { min-height: var(--ds-touch); }
  .ds-icon-button, .ds-icon-button--sm { width: var(--ds-touch); height: var(--ds-touch); }
}
@media (max-width: 640px) {
  .ds-row { padding: var(--ds-space-2) var(--ds-space-3); }
  .ds-row__actions { width: 100%; justify-content: flex-end; margin-left: 0; }
  .ds-toast-region { right: 16px; bottom: 16px; left: 16px; }
  .ds-toast { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ds-button[aria-busy="true"]::before, .ds-state--loading::before { animation-duration: 2.4s; }
  .ds-toast { animation: none; }
}

/* ---------- Style guide page (#design-system) ---------- */
.dsg { max-width: 1400px; margin: 0 auto; }
.dsg-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ds-space-6); align-items: start; }
.dsg-panel { min-width: 0; padding: var(--ds-space-6); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-lg); color: var(--ds-ink); background: var(--ds-canvas); font-family: var(--ds-font-sans); }
.dsg-panel-title { margin: 0 0 var(--ds-space-2); font-size: var(--ds-font-xl); letter-spacing: var(--ds-tracking-title); }
.dsg-h { margin: var(--ds-space-7) 0 var(--ds-space-3); color: var(--ds-ink-2); font-size: var(--ds-font-sm); font-weight: var(--ds-weight-strong); }
.dsg code { padding: 0; border: 0; color: var(--ds-ink-2); background: none; font-size: var(--ds-font-xs); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.dsg-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--ds-space-2); margin: 0; padding: 0; list-style: none; }
.dsg-swatches li { display: flex; align-items: center; gap: var(--ds-space-3); min-width: 0; padding: var(--ds-space-2); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-md); background: var(--ds-surface); }
.dsg-swatches li > span:last-child { display: grid; min-width: 0; font-size: var(--ds-font-xs); }
.dsg-swatches b { font-size: var(--ds-font-sm); font-weight: var(--ds-weight-strong); }
.dsg-swatches small { color: var(--ds-ink-2); font-variant-numeric: tabular-nums; }
.dsg-chip { width: 36px; height: 36px; flex: none; border: 1px solid var(--ds-line-strong); border-radius: var(--ds-radius-sm); }
.dsg-chip[data-role="canvas"] { background: var(--ds-canvas); }
.dsg-chip[data-role="surface"] { background: var(--ds-surface); }
.dsg-chip[data-role="raised"] { background: var(--ds-raised); }
.dsg-chip[data-role="sunken"] { background: var(--ds-sunken); }
.dsg-chip[data-role="ink"] { background: var(--ds-ink); }
.dsg-chip[data-role="ink-2"] { background: var(--ds-ink-2); }
.dsg-chip[data-role="ink-3"] { background: var(--ds-ink-3); }
.dsg-chip[data-role="line"] { background: var(--ds-line); }
.dsg-chip[data-role="line-strong"] { background: var(--ds-line-strong); }
.dsg-chip[data-role="accent"] { background: var(--ds-accent); }
.dsg-chip[data-role="accent-strong"] { background: var(--ds-accent-strong); }
.dsg-chip[data-role="on-accent"] { background: var(--ds-on-accent); }
.dsg-chip[data-role="accent-soft"] { background: var(--ds-accent-soft); }
.dsg-chip[data-role="danger"] { background: var(--ds-danger); }
.dsg-chip[data-role="danger-soft"] { background: var(--ds-danger-soft); }
.dsg-chip[data-role="warn"] { background: var(--ds-warn); }
.dsg-chip[data-role="warn-soft"] { background: var(--ds-warn-soft); }
.dsg-chip[data-role="ok"] { background: var(--ds-ok); }
.dsg-chip[data-role="ok-soft"] { background: var(--ds-ok-soft); }
.dsg-chip[data-role="info"] { background: var(--ds-info); }
.dsg-chip[data-role="info-soft"] { background: var(--ds-info-soft); }
.dsg-type, .dsg-space, .dsg-icons { margin: 0; padding: 0; list-style: none; }
.dsg-type li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--ds-space-2); padding: var(--ds-space-2) 0; border-bottom: 1px solid var(--ds-line); font-variant-numeric: tabular-nums; }
.dsg-type [data-size="xs"] span { font-size: var(--ds-font-xs); font-weight: var(--ds-weight-medium); }
.dsg-type [data-size="sm"] span { font-size: var(--ds-font-sm); font-weight: var(--ds-weight-medium); }
.dsg-type [data-size="md"] span { font-size: var(--ds-font-md); font-weight: var(--ds-weight-regular); }
.dsg-type [data-size="lg"] span { font-size: var(--ds-font-lg); font-weight: var(--ds-weight-bold); }
.dsg-type [data-size="xl"] span { font-size: var(--ds-font-xl); font-weight: var(--ds-weight-bold); }
.dsg-type [data-size="2xl"] span { font-size: var(--ds-font-2xl); font-weight: var(--ds-weight-bold); }
.dsg-type [data-size="3xl"] span { font-size: var(--ds-font-3xl); font-weight: var(--ds-weight-bold); }
.dsg-space li { display: flex; align-items: center; gap: var(--ds-space-3); padding: 2px 0; }
.dsg-space i { display: block; height: 10px; border-radius: 2px; background: var(--ds-accent); }
.dsg-space [data-space="1"] { width: var(--ds-space-1); }
.dsg-space [data-space="2"] { width: var(--ds-space-2); }
.dsg-space [data-space="3"] { width: var(--ds-space-3); }
.dsg-space [data-space="4"] { width: var(--ds-space-4); }
.dsg-space [data-space="5"] { width: var(--ds-space-5); }
.dsg-space [data-space="6"] { width: var(--ds-space-6); }
.dsg-space [data-space="7"] { width: var(--ds-space-7); }
.dsg-space [data-space="8"] { width: var(--ds-space-8); }
.dsg-shapes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--ds-space-3); margin-top: var(--ds-space-3); }
.dsg-shapes > div { display: grid; gap: 4px; min-height: 72px; padding: var(--ds-space-3); border: 1px solid var(--ds-line); background: var(--ds-surface); font-size: var(--ds-font-sm); }
.dsg-shapes [data-radius="sm"] { border-radius: var(--ds-radius-sm); }
.dsg-shapes [data-radius="md"] { border-radius: var(--ds-radius-md); }
.dsg-shapes [data-radius="lg"] { border-radius: var(--ds-radius-lg); }
.dsg-shapes [data-shadow="1"] { border-radius: var(--ds-radius-lg); box-shadow: var(--ds-shadow-1); }
.dsg-shapes [data-shadow="2"] { border-radius: var(--ds-radius-lg); box-shadow: var(--ds-shadow-2); }
.dsg-gap { margin-top: var(--ds-space-3); }
.dsg-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-3); margin: 0 0 var(--ds-space-3); }
.dsg-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--ds-space-3); }
.dsg-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: var(--ds-space-2); }
.dsg-icons li { display: flex; align-items: center; gap: var(--ds-space-2); min-width: 0; color: var(--ds-ink); }
.dsg-icons code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1100px) { .dsg-columns { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .dsg-panel { padding: var(--ds-space-4); } }
