/*
 * Orchard ERP interface. One stylesheet built on shared tokens:
 *   colour   - neutrals, one brand colour and four status colours (success, warning, danger, info);
 *   type     - six sizes, none below 12 px: 12 / 14 / 16 / 20 / 28 / 40;
 *   spacing  - a 4 px scale: 4 / 8 / 12 / 16 / 20 / 24 / 32 / 48;
 *   radius   - three corner radii: 6 / 10 / 16 (plus round shapes for dots, avatars and pills).
 * Light and dark themes share every component; dark follows the system unless chosen in the account menu.
 */

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-1: 12px;
  --fs-2: 14px;
  --fs-3: 16px;
  --fs-4: 20px;
  --fs-5: 28px;
  --fs-6: 40px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 48px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --control-h: 40px;
  --control-h-sm: 32px;
  --sidebar-w: 248px;
  --topbar-h: 64px;

  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --surface-3: #eef3f0;
  --border: #e1e7e3;
  --border-strong: #c8d3cc;
  --text: #17261f;
  --text-2: #475850;
  --text-3: #5f6f68;
  --brand: #17674f;
  --brand-strong: #0f513d;
  --brand-soft: #e5f1eb;
  --brand-text: #ffffff;
  --accent-ink: #0f513d;
  --link: #14614a;
  --success: #276a43;
  --success-soft: #e6f3ea;
  --warning: #835614;
  --warning-soft: #fbf0d8;
  --danger: #a3372b;
  --danger-soft: #fbe9e5;
  --info: #31597f;
  --info-soft: #e8eff7;
  --focus: #1b6e53;
  --focus-halo: rgba(27, 110, 83, 0.22);
  --overlay: rgba(20, 38, 31, 0.42);
  --shadow-1: 0 1px 2px rgba(18, 40, 31, 0.06);
  --shadow-2: 0 8px 24px rgba(18, 40, 31, 0.08);
  --shadow-3: 0 24px 64px rgba(18, 40, 31, 0.2);
  --skeleton: linear-gradient(90deg, #eef2ef 25%, #f6f8f7 50%, #eef2ef 75%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0f1513;
    --surface: #161e1b;
    --surface-2: #1a2420;
    --surface-3: #212d28;
    --border: #2b3833;
    --border-strong: #3c4c45;
    --text: #e7eeea;
    --text-2: #b9c6c0;
    --text-3: #9aaaa3;
    --brand: #268060;
    --brand-strong: #1d6b50;
    --brand-soft: #1c3a2f;
    --brand-text: #ffffff;
    --accent-ink: #79d0aa;
    --link: #79d0aa;
    --success: #7fd3a1;
    --success-soft: #1d3a2a;
    --warning: #f0c56f;
    --warning-soft: #3d3016;
    --danger: #f19a8c;
    --danger-soft: #45231e;
    --info: #9ec1e8;
    --info-soft: #1f3044;
    --focus: #79d0aa;
    --focus-halo: rgba(121, 208, 170, 0.28);
    --overlay: rgba(0, 0, 0, 0.6);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-3: 0 24px 64px rgba(0, 0, 0, 0.55);
    --skeleton: linear-gradient(90deg, #1d2723 25%, #24302b 50%, #1d2723 75%);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0f1513;
  --surface: #161e1b;
  --surface-2: #1a2420;
  --surface-3: #212d28;
  --border: #2b3833;
  --border-strong: #3c4c45;
  --text: #e7eeea;
  --text-2: #b9c6c0;
  --text-3: #9aaaa3;
  --brand: #268060;
  --brand-strong: #1d6b50;
  --brand-soft: #1c3a2f;
  --brand-text: #ffffff;
  --accent-ink: #79d0aa;
  --link: #79d0aa;
  --success: #7fd3a1;
  --success-soft: #1d3a2a;
  --warning: #f0c56f;
  --warning-soft: #3d3016;
  --danger: #f19a8c;
  --danger-soft: #45231e;
  --info: #9ec1e8;
  --info-soft: #1f3044;
  --focus: #79d0aa;
  --focus-halo: rgba(121, 208, 170, 0.28);
  --overlay: rgba(0, 0, 0, 0.6);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-3: 0 24px 64px rgba(0, 0, 0, 0.55);
  --skeleton: linear-gradient(90deg, #1d2723 25%, #24302b 50%, #1d2723 75%);
}

/* ---------------------------------------------------------------- base */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-2);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
a {
  color: var(--link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
h1,
h2,
h3 {
  margin: 0;
  color: var(--text);
  line-height: 1.25;
}
h1 {
  font-size: var(--fs-5);
  font-weight: 650;
  letter-spacing: -0.02em;
}
h2 {
  font-size: var(--fs-3);
  font-weight: 650;
  letter-spacing: -0.01em;
}
h3 {
  font-size: var(--fs-2);
  font-weight: 650;
}
p {
  margin: 0 0 var(--sp-3);
}
svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
kbd {
  font-family: var(--font);
  font-size: var(--fs-1);
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 var(--sp-1);
  background: var(--surface);
}
code,
.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-1);
}
.nowrap {
  white-space: nowrap;
}
::selection {
  background: var(--brand-soft);
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  top: -80px;
  left: var(--sp-4);
  z-index: 200;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  color: var(--link);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
}
.skip-link:focus {
  top: var(--sp-3);
}
.muted,
.subtitle {
  color: var(--text-2);
}
.subtitle {
  margin: 0;
}
.num,
.numeric-cell {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.negative {
  color: var(--danger);
}
.overdue-text {
  color: var(--danger);
}
.full {
  grid-column: 1 / -1;
}
.stack {
  display: grid;
  gap: var(--sp-6);
  align-content: start;
  min-width: 0;
}
.detail-section {
  margin-top: var(--sp-6);
}
.print-only {
  display: none;
}

/* ---------------------------------------------------------------- shell */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-5) var(--sp-3) var(--sp-4);
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  scrollbar-width: thin;
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-2);
  margin-bottom: var(--sp-3);
  font-size: var(--fs-4);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}
.brand:hover {
  text-decoration: none;
}
/* The Dev Bhumi logo is round on a transparent square. */
.brand img {
  width: 32px;
  height: 32px;
  flex: none;
}
.brand small {
  display: block;
  white-space: nowrap;
  font-size: var(--fs-1);
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-3);
}
.nav-search {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  min-height: var(--control-h);
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-2);
  text-align: left;
}
.nav-search:hover {
  border-color: var(--border-strong);
}
.nav-search svg {
  width: 16px;
  height: 16px;
}
.nav-search kbd {
  margin-left: auto;
}
.nav-search span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.sidebar nav {
  display: grid;
  gap: 2px;
  margin-top: var(--sp-2);
}
.nav-label {
  padding: var(--sp-4) var(--sp-3) var(--sp-1);
  font-size: var(--fs-1);
  font-weight: 650;
  color: var(--text-3);
}
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 38px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  color: var(--text-2);
  font-weight: 500;
}
.nav-link svg {
  width: 18px;
  height: 18px;
}
.nav-link:hover {
  background: var(--surface-3);
  color: var(--text);
  text-decoration: none;
}
.nav-link.active {
  background: var(--brand-soft);
  color: var(--accent-ink);
  font-weight: 650;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--brand);
}
.nav-section {
  margin-top: var(--sp-2);
}
.nav-section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius);
  list-style: none;
  cursor: pointer;
  font-size: var(--fs-1);
  font-weight: 650;
  color: var(--text-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.nav-section > summary:hover {
  color: var(--text);
}
summary::-webkit-details-marker {
  display: none;
}
.nav-section > summary svg {
  width: 14px;
  height: 14px;
  transition: transform 0.15s;
}
.nav-section[open] > summary svg {
  transform: rotate(90deg);
}
.sidebar-footer {
  margin-top: auto;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
  display: grid;
  gap: var(--sp-1);
}
.local-indicator {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--fs-1);
  color: var(--text-3);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}
.version-label {
  margin-left: auto;
  padding: 0 var(--sp-2);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-3);
}
.nav-backdrop {
  display: none;
}
.bottom-nav {
  display: none;
}
.workspace {
  grid-column: 2;
  min-width: 0;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  height: var(--topbar-h);
  padding: 0 var(--sp-7);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.company-switcher {
  min-width: 0;
}
.company-tag {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-1);
  color: var(--text-3);
  line-height: 1.2;
}
.company-code {
  font-weight: 700;
  color: var(--accent-ink);
  letter-spacing: 0.04em;
}
.currency-context {
  padding-left: var(--sp-2);
  border-left: 1px solid var(--border-strong);
}
.company-select {
  max-width: 360px;
  width: 100%;
  padding: 2px var(--sp-6) 2px 0;
  border: 0;
  background: transparent;
  font-size: var(--fs-3);
  font-weight: 650;
  color: var(--text);
}
.top-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
/* Search trigger: looks like a field, opens the search and actions palette. */
.search-trigger {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 260px;
  min-height: var(--control-h);
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-3);
  text-align: left;
}
.search-trigger:hover {
  border-color: var(--border-strong);
  color: var(--text-2);
}
.search-trigger svg {
  width: 16px;
  height: 16px;
}
.search-trigger kbd {
  margin-left: auto;
}
.top-menu {
  position: relative;
}
.bell {
  position: relative;
}
.bell-count {
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 var(--sp-1);
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: var(--fs-1);
  font-weight: 700;
  line-height: 1;
}
.popover {
  position: absolute;
  top: calc(100% + var(--sp-2));
  right: 0;
  z-index: 50;
  width: 340px;
  max-width: calc(100vw - var(--sp-6));
  max-height: min(70vh, 560px);
  overflow: auto;
  padding: var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-3);
}
.bell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-3);
}
.bell-head a {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-weight: 600;
}
.bell-head svg {
  width: 14px;
  height: 14px;
}
.bell-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.bell-list a {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--radius);
  color: var(--text);
}
.bell-list a:hover,
.bell-list a:focus-visible {
  background: var(--surface-3);
  text-decoration: none;
}
.bell-list a.unread {
  background: var(--brand-soft);
}
.bell-list small {
  display: block;
  font-size: var(--fs-1);
  color: var(--text-3);
}
.bell-list strong {
  display: block;
  font-weight: 600;
}
.bell-list span > span {
  display: block;
  font-size: var(--fs-1);
  color: var(--text-2);
}
.bell-dot {
  flex: none;
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--info);
}
.bell-dot.amber {
  background: var(--warning);
}
.bell-dot.red {
  background: var(--danger);
}
.bell-empty,
.bell-loading {
  padding: var(--sp-5) var(--sp-3);
  color: var(--text-2);
  text-align: center;
}
.bell-loading {
  display: grid;
  gap: var(--sp-3);
}
/* Account menu: account security, theme, compact layout, install, sign out. */
.account-menu {
  width: 290px;
}
.menu-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-1);
  padding: var(--sp-2) var(--sp-3) var(--sp-3);
  border-bottom: 1px solid var(--border);
}
.menu-head strong,
.menu-head small {
  display: block;
}
.menu-head small {
  font-size: var(--fs-1);
  color: var(--text-3);
}
.account-menu [role^='menuitem']:not([data-theme-choice]) {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: 40px;
  padding: var(--sp-2) var(--sp-3);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-weight: 500;
  text-align: left;
}
.account-menu [role^='menuitem']:not([data-theme-choice]):hover {
  background: var(--surface-3);
  text-decoration: none;
}
.account-menu [role^='menuitem'] svg {
  width: 18px;
  height: 18px;
  color: var(--text-2);
}
.menu-check {
  margin-left: auto;
  color: var(--accent-ink);
}
.menu-group {
  padding: var(--sp-2) var(--sp-3);
}
.menu-group > span {
  display: block;
  margin-bottom: var(--sp-2);
  font-size: var(--fs-1);
  font-weight: 600;
  color: var(--text-3);
}
.menu-segmented {
  display: flex;
  margin: 0;
}
.menu-segmented button {
  flex: 1;
}
/* Search and actions palette (Command K). */
dialog.palette-dialog {
  max-width: 640px;
  margin-top: 10vh;
}
.palette-dialog .dialog-head {
  display: none;
}
.palette-dialog .dialog-body {
  padding: 0;
}
.palette-search {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.palette-search svg {
  color: var(--text-3);
}
.palette-search input {
  flex: 1;
  min-height: 44px;
  border: 0;
  background: transparent;
  font-size: var(--fs-3);
  outline: none;
}
.palette-list {
  max-height: 55vh;
  padding: var(--sp-2);
  overflow: auto;
}
.palette-group {
  padding: var(--sp-3) var(--sp-3) var(--sp-1);
  font-size: var(--fs-1);
  font-weight: 650;
  color: var(--text-3);
}
.palette-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: 44px;
  padding: var(--sp-2) var(--sp-3);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  text-align: left;
}
.palette-item svg {
  width: 18px;
  height: 18px;
  color: var(--text-3);
}
.palette-item > span {
  flex: 1;
  min-width: 0;
}
.palette-item small {
  display: block;
  font-size: var(--fs-1);
  color: var(--text-3);
}
.palette-item em {
  font-size: var(--fs-1);
  font-style: normal;
  color: var(--text-3);
  white-space: nowrap;
}
.palette-item[aria-selected='true'],
.palette-item:hover {
  background: var(--surface-3);
}
.palette-empty {
  padding: var(--sp-5);
  color: var(--text-2);
  text-align: center;
}
.palette-foot {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  margin: 0;
  padding: var(--sp-2) var(--sp-4);
  border-top: 1px solid var(--border);
  font-size: var(--fs-1);
  color: var(--text-3);
}
/* Loading placeholders in the shape of what is coming. */
@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}
.skeleton-line,
.skeleton-card {
  display: block;
  height: 14px;
  border-radius: var(--radius-sm);
  background: var(--skeleton);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
.skeleton-line.narrow {
  width: 18%;
}
.skeleton-line.title {
  width: 40%;
  height: 28px;
}
.skeleton-line.wide {
  width: 60%;
}
.skeleton-page {
  display: grid;
  gap: var(--sp-4);
}
.skeleton-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-4);
  margin-top: var(--sp-4);
}
.skeleton-card {
  height: 112px;
  border-radius: var(--radius-lg);
}
.skeleton-table {
  display: grid;
  gap: var(--sp-4);
  padding: var(--sp-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--accent-ink);
  font-size: var(--fs-1);
  font-weight: 700;
}
.avatar:hover {
  text-decoration: none;
}
button.avatar {
  border: 0;
}
.content {
  max-width: 1600px;
  margin: 0 auto;
  padding: var(--sp-7) var(--sp-7) var(--sp-8);
}
.content[aria-busy='true'] > * {
  opacity: 0.6;
  transition: opacity 0.2s 0.2s;
}
.demo-banner {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-1);
  color: var(--text-3);
}
.loading {
  padding: var(--sp-8);
  text-align: center;
  color: var(--text-3);
}

/* ---------------------------------------------------------------- page headings */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-5);
  margin-bottom: var(--sp-6);
}
.page-head > div:first-child {
  min-width: 0;
}
.page-head .subtitle {
  max-width: 720px;
  margin-top: var(--sp-2);
}
.page-head .button-row {
  justify-content: flex-end;
}
.page-head .button-row:empty {
  display: none;
}
.eyebrow,
.section-kicker {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-1);
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.section-kicker {
  margin-bottom: var(--sp-1);
}
.section-label {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-6) 0 var(--sp-3);
  font-size: var(--fs-1);
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.record-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  font-size: var(--fs-1);
  color: var(--text-3);
}
.record-breadcrumb a {
  color: var(--text-2);
}
.record-breadcrumb svg {
  width: 12px;
  height: 12px;
}
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.detail-meta .link-small {
  margin-left: auto;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.filters input,
.filters select {
  min-height: var(--control-h);
  padding: 0 var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.filters input {
  min-width: 260px;
}
.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}
.coverage-note {
  max-width: 900px;
  color: var(--text-2);
}
.link-small {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-weight: 600;
}
.link-small svg {
  width: 14px;
  height: 14px;
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--control-h);
  padding: 0 var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-1);
  transition:
    background 0.15s,
    border-color 0.15s,
    box-shadow 0.15s;
}
.btn:hover {
  background: var(--surface-3);
  text-decoration: none;
}
.btn svg {
  width: 16px;
  height: 16px;
}
.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-text);
}
.btn.primary:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}
.btn.danger {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}
.btn.danger:hover {
  border-color: var(--danger);
}
.btn.subtle {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-2);
}
.btn.subtle:hover {
  background: var(--surface-3);
  color: var(--text);
}
.btn.small {
  min-height: var(--control-h-sm);
  padding: 0 var(--sp-3);
  font-size: var(--fs-2);
}
.btn.icon {
  width: var(--control-h);
  min-width: var(--control-h);
  padding: 0;
}
.btn.icon.small {
  width: var(--control-h-sm);
  min-width: var(--control-h-sm);
}
.btn[aria-busy='true'] {
  opacity: 0.7;
  cursor: progress;
}
.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}

/* ---------------------------------------------------------------- badges and notices */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px var(--sp-2);
  border-radius: var(--radius-sm);
  background: var(--info-soft);
  color: var(--info);
  font-size: var(--fs-1);
  font-weight: 650;
  line-height: 1.5;
  white-space: nowrap;
}
.badge.green {
  background: var(--success-soft);
  color: var(--success);
}
.badge.amber,
.badge.overdue {
  background: var(--warning-soft);
  color: var(--warning);
}
.badge.red {
  background: var(--danger-soft);
  color: var(--danger);
}
.badge.blue {
  background: var(--info-soft);
  color: var(--info);
}
.notice {
  margin-bottom: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--text);
  line-height: 1.6;
}
.notice.warning {
  background: var(--warning-soft);
  color: var(--warning);
}
.notice.error {
  background: var(--danger-soft);
  color: var(--danger);
}
.notice > :last-child {
  margin-bottom: 0;
}
.balance-check {
  font-weight: 650;
  color: var(--success);
}

/* ---------------------------------------------------------------- panels and statistics */
.panel {
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.panel-head h2 {
  margin: 0;
}
.panel-body {
  padding: var(--sp-5);
}
.panel-caption {
  margin: 0;
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: var(--fs-1);
  color: var(--text-3);
  line-height: 1.6;
}
.panel-bottom-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-weight: 600;
}
.panel-bottom-link svg {
  width: 14px;
  height: 14px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.stat {
  min-width: 0;
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  color: var(--text-2);
  font-weight: 500;
}
.stat-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--surface-3);
  color: var(--accent-ink);
}
.stat-icon svg {
  width: 18px;
  height: 18px;
}
.stat-value {
  margin-top: var(--sp-2);
  font-size: var(--fs-5);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.stat-note {
  margin-top: var(--sp-1);
  font-size: var(--fs-1);
  color: var(--text-3);
}
.stat-attention .stat-icon,
.stat-warning .stat-icon {
  background: var(--warning-soft);
  color: var(--warning);
}
.stat-attention .stat-value,
.stat-warning .stat-value {
  color: var(--warning);
}

/* ---------------------------------------------------------------- tables */
.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}
.table-wrap:focus-visible {
  outline-offset: -2px;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th {
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-3);
  font-size: var(--fs-1);
  font-weight: 650;
  white-space: nowrap;
}
td {
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover td {
  background: var(--surface-2);
}
tbody tr[data-open] {
  cursor: pointer;
}
td.num,
th.num {
  text-align: right;
}
.cell-primary {
  font-weight: 600;
  color: var(--text);
}
a.cell-primary {
  color: var(--text);
}
a.cell-primary:hover {
  color: var(--link);
}
.cell-secondary {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-1);
  color: var(--text-3);
}
tr.section-row td {
  background: var(--surface-2);
  font-weight: 650;
}
tr.total-row td {
  font-weight: 650;
  border-top: 1px solid var(--border-strong);
}
tr.grand-row td {
  font-weight: 700;
  border-top: 2px solid var(--text-2);
}
.empty {
  padding: var(--sp-7) var(--sp-5);
  text-align: center;
  color: var(--text-2);
}
.empty h3 {
  margin-bottom: var(--sp-2);
  font-size: var(--fs-3);
}
.empty p {
  margin-bottom: var(--sp-4);
}
.empty .btn {
  margin: 0 var(--sp-1);
}

/* ---------------------------------------------------------------- tabs */
.segmented {
  display: inline-flex;
  max-width: 100%;
  gap: var(--sp-1);
  margin: 0 0 var(--sp-5);
  padding: var(--sp-1);
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--surface-3);
}
.segmented button {
  min-height: 34px;
  padding: 0 var(--sp-4);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-weight: 600;
  white-space: nowrap;
}
.segmented button:hover {
  color: var(--text);
}
.segmented button.selected {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
}
.segmented button span {
  margin-left: var(--sp-1);
  color: var(--text-3);
}

/* ---------------------------------------------------------------- forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4) var(--sp-5);
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  min-width: 0;
}
.form-field > label,
.form-field > .label {
  font-weight: 600;
  color: var(--text);
}
.form-field input:not([type='checkbox']):not([type='radio']),
.form-field select,
.form-field textarea,
.line-table input:not([type='checkbox']),
.line-table select,
.comment-box,
.pro-scan input {
  width: 100%;
  min-height: var(--control-h);
  padding: var(--sp-2) var(--pad-right, var(--sp-3)) var(--sp-2) var(--pad-left, var(--sp-3));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--field-bg, var(--surface));
  color: var(--text);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.form-field textarea,
.comment-box {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.line-table input:focus,
.line-table select:focus,
.comment-box:focus,
.pro-scan input:focus,
.filters input:focus,
.filters select:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--focus-halo);
}
.form-field input[aria-invalid='true'],
.form-field select[aria-invalid='true'],
.form-field textarea[aria-invalid='true'],
.line-table input[aria-invalid='true'],
.line-table select[aria-invalid='true'] {
  border-color: var(--danger);
  --field-bg: var(--danger-soft);
}
.form-field input[type='checkbox'],
.form-field input[type='radio'],
.role-checks input,
.column-checks input,
.permission-grid input,
.smart-table input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
  cursor: pointer;
}
.form-field > label:has(input[type='checkbox']) {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 500;
}
.form-help {
  margin: 0;
  font-size: var(--fs-1);
  color: var(--text-3);
}
.field-error {
  margin: 0;
  font-size: var(--fs-1);
  font-weight: 600;
  color: var(--danger);
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}
.form-section {
  min-width: 0;
  margin: var(--sp-2) 0 0;
  padding: var(--sp-4) 0 0;
  border: 0;
  border-top: 1px solid var(--border);
}
.form-section legend {
  padding: 0 var(--sp-3) 0 0;
  font-weight: 650;
  color: var(--text-2);
}
.form-context {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: var(--fs-1);
  color: var(--text-3);
}
.role-checks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.role-checks label,
.column-checks label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.column-checks {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-4) 0;
}
.column-checks label {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.draft-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
  font-size: var(--fs-1);
  color: var(--text-3);
}
.draft-restore {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  padding: var(--sp-3);
  border-radius: var(--radius);
  background: var(--info-soft);
  color: var(--info);
}
.draft-restore p {
  margin: 0 auto 0 0;
}
.req {
  color: var(--danger);
}
.form-field label .muted,
.line-table th .muted {
  font-weight: 400;
}
.form-field > label.check {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--control-h);
  font-weight: 500;
}
.num-input {
  text-align: right;
}
.input-affix {
  position: relative;
  --pad-left: 2.1em;
}
.input-affix > span {
  position: absolute;
  top: 50%;
  left: var(--sp-3);
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
/* The automatic title is shown as the title field's placeholder, so it stays readable. */
.title-field input::placeholder {
  color: var(--text-2);
  opacity: 1;
}
.auto-filled {
  --field-bg: var(--brand-soft);
}
.auto-note {
  color: var(--link);
}
/* Searchable picker: a text field with a list of matches (ARIA combobox). */
.combo {
  position: relative;
  --pad-right: 36px;
}
.combo-caret {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 36px;
  color: var(--text-3);
  cursor: pointer;
}
.combo-caret svg {
  width: 16px;
  height: 16px;
}
.combo-list {
  position: fixed;
  z-index: 70;
  margin: 0;
  padding: var(--sp-1);
  overflow: auto;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
}
.combo-list [role='option'] {
  display: grid;
  gap: 2px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.combo-list [role='option'] small {
  font-size: var(--fs-1);
  color: var(--text-3);
}
.combo-list [role='option'].active {
  background: var(--surface-3);
}
.combo-list [role='option'][aria-selected='true'] > span {
  font-weight: 650;
}
.combo-list [role='option'][aria-selected='true'] > span::after {
  content: ' ✓';
  color: var(--accent-ink);
}
.combo-more {
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-1);
  color: var(--text-3);
}
/* Order lines: a table with line amounts and a running total; cards on phones. */
.line-editor {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.line-editor > legend {
  margin-bottom: var(--sp-2);
  padding: 0;
  font-weight: 600;
}
.line-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  scrollbar-width: thin;
}
.line-table th {
  padding: var(--sp-2) var(--sp-3);
}
.line-table td {
  padding: var(--sp-2);
  vertical-align: top;
}
.line-table tbody tr:hover td {
  background: transparent;
}
.line-table .line-no {
  width: 40px;
  padding-top: var(--sp-4);
  text-align: center;
  color: var(--text-3);
}
.line-table th.line-no {
  padding-top: var(--sp-2);
}
.line-table td .combo {
  min-width: 220px;
}
.line-table td input.num-input {
  min-width: 96px;
}
.line-table td.line-amount {
  padding-top: var(--sp-4);
  font-weight: 600;
  white-space: nowrap;
}
.line-table .line-actions {
  width: 48px;
  text-align: center;
}
.line-table tfoot td {
  padding: var(--sp-3);
  border-top: 1px solid var(--border-strong);
  border-bottom: 0;
  background: var(--surface-2);
  font-weight: 650;
  white-space: nowrap;
}
.line-table .field-error {
  margin-top: var(--sp-1);
  white-space: normal;
}
.line-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
}
.line-summary {
  font-size: var(--fs-1);
  color: var(--text-2);
}
/* Save bar: stays at the bottom of the form while it scrolls. */
.form-footer {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin: var(--sp-5) calc(-1 * var(--sp-6)) 0;
  padding: var(--sp-3) var(--sp-6);
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.form-footer .button-row {
  margin-left: auto;
}
.draft-status {
  font-size: var(--fs-1);
  color: var(--text-3);
}
dialog.form-dialog {
  max-width: 1040px;
}
.form-dialog .dialog-body {
  padding-bottom: 0;
}
.draft-restore svg {
  width: 16px;
  height: 16px;
}
.pro-scan {
  display: flex;
  gap: var(--sp-3);
  max-width: 780px;
}
.pro-scan input {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-3);
}
.camera-scan {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
}
.camera-scan video {
  display: block;
  width: 100%;
  max-height: 60vh;
  object-fit: cover;
}
.camera-frame {
  position: absolute;
  inset: 22% 12%;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius);
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35);
}
.code-block,
.payload-preview {
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: var(--fs-1);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.payload-preview {
  max-height: 340px;
  overflow: auto;
}
.copy-row {
  display: flex;
  gap: var(--sp-2);
}
.copy-row input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--fs-1);
}

/* ---------------------------------------------------------------- dialogs, drawers and toasts */
dialog {
  overflow: auto;
  width: calc(100% - var(--sp-7));
  max-width: 920px;
  max-height: 90dvh;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-3);
}
dialog::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(3px);
}
.dialog-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.dialog-head h2 {
  font-size: var(--fs-4);
}
.dialog-body {
  padding: var(--sp-6);
}
dialog.record-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: 560px;
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  overflow: auto;
}
.record-drawer .dialog-head h2 {
  font-size: var(--fs-2);
  color: var(--text-2);
}
.drawer-object h2 {
  margin-bottom: var(--sp-3);
  font-size: var(--fs-4);
}
.drawer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  font-size: var(--fs-1);
  color: var(--text-3);
}
.drawer-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  margin: 0 0 var(--sp-5);
}
.drawer-fields dt,
.fields dt {
  margin-bottom: var(--sp-1);
  font-size: var(--fs-1);
  color: var(--text-3);
}
.drawer-fields dd,
.fields dd {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.drawer-evidence {
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
}
.drawer-evidence h3 {
  margin-bottom: var(--sp-2);
}
.drawer-footer {
  position: sticky;
  bottom: calc(-1 * var(--sp-6));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin: var(--sp-6) calc(-1 * var(--sp-6)) calc(-1 * var(--sp-6));
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--fs-1);
  color: var(--text-3);
}
#toast {
  position: fixed;
  right: var(--sp-6);
  bottom: var(--sp-6);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  max-width: min(460px, calc(100% - var(--sp-7)));
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-3);
}
#toast.error {
  background: var(--danger);
  color: #fff;
}
#toast button {
  border: 0;
  border-radius: var(--radius-sm);
  padding: var(--sp-1) var(--sp-2);
  background: transparent;
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
}

/* ---------------------------------------------------------------- record pages */
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--sp-6);
  align-items: start;
}
.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4) var(--sp-6);
  margin: 0;
}
.field-value {
  min-width: 0;
}
.field-value.full {
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}
.object-progress {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0 0 var(--sp-5);
  padding: var(--sp-3) var(--sp-5);
  overflow-x: auto;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.object-progress li {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text-3);
  white-space: nowrap;
}
.object-progress li > svg {
  width: 14px;
  height: 14px;
  margin: 0 var(--sp-4);
}
.progress-number {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-3);
  font-size: var(--fs-1);
}
.progress-number svg {
  width: 14px;
  height: 14px;
}
.object-progress li.current {
  color: var(--text);
  font-weight: 650;
}
.object-progress li.current .progress-number {
  background: var(--brand);
  color: var(--brand-text);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.object-progress li.done {
  color: var(--success);
}
.object-progress li.done .progress-number {
  background: var(--success-soft);
  color: var(--success);
}
.process-current {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-right: var(--sp-5);
  color: var(--success);
  font-weight: 600;
}
.process-current svg {
  width: 16px;
  height: 16px;
}
.object-progress > span:last-child {
  color: var(--text-3);
}
/* Record summary: who it concerns, how much, key dates and the next step. */
.record-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--sp-4) var(--sp-6);
  margin-bottom: var(--sp-5);
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.record-summary > div {
  min-width: 0;
}
.record-summary > div > span {
  display: block;
  margin-bottom: 2px;
  font-size: var(--fs-1);
  color: var(--text-3);
}
.record-summary strong {
  display: block;
  font-size: var(--fs-3);
  font-weight: 650;
  overflow-wrap: anywhere;
}
.record-summary > div:last-child {
  padding-left: var(--sp-4);
  border-left: 3px solid var(--brand);
}
.record-summary > div:last-child strong {
  font-size: var(--fs-2);
  font-weight: 600;
}
.drawer-summary {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin-bottom: var(--sp-4);
  box-shadow: none;
}
.drawer-summary > div:last-child {
  padding-left: 0;
  border-left: 0;
}
.drawer-summary > div:last-child strong {
  font-size: var(--fs-3);
  font-weight: 650;
}
.lines-view tfoot td {
  border-top: 1px solid var(--border-strong);
  background: var(--surface-2);
  font-weight: 650;
}
.record-guidance {
  margin-bottom: var(--sp-4);
  color: var(--text-3);
  font-size: var(--fs-1);
}
.record-guidance summary {
  cursor: pointer;
  padding: var(--sp-1) 0;
}
.record-guidance .notice {
  margin: var(--sp-2) 0;
}
.comment {
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}
.comment .author {
  margin-bottom: var(--sp-1);
  font-size: var(--fs-1);
  color: var(--text-3);
}
.comment p {
  margin: 0;
  white-space: pre-wrap;
}
.attachment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border);
}
.attachment svg {
  width: 16px;
  height: 16px;
  color: var(--text-3);
}
.disposal-list {
  display: grid;
  max-height: 46vh;
  margin: var(--sp-3) 0 var(--sp-4);
  padding: 0;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  list-style: none;
}
.disposal-list li {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
}
.disposal-list li:last-child {
  border-bottom: 0;
}
.disposal-list label {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
}
.disposal-list strong,
.disposal-list small {
  display: block;
  overflow-wrap: anywhere;
}
.disposal-list small {
  color: var(--text-3);
}
.attachment.removed {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.attachment.removed > span:first-child {
  color: var(--text-3);
  text-decoration: line-through;
  overflow-wrap: anywhere;
}
.attachment.removed > span:last-child {
  font-size: var(--fs-1);
}
.timeline-item {
  position: relative;
  margin-left: var(--sp-1);
  padding: 0 0 var(--sp-4) var(--sp-4);
  border-left: 1px solid var(--border-strong);
  font-size: var(--fs-1);
  color: var(--text-3);
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--brand);
}
.timeline-item strong {
  display: block;
  font-size: var(--fs-2);
  font-weight: 600;
  color: var(--text);
}
.document-flow {
  margin-bottom: var(--sp-5);
}
.document-flow > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  cursor: pointer;
  list-style: none;
}
.document-flow > summary > span {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}
.document-flow > summary svg {
  width: 18px;
  height: 18px;
  color: var(--accent-ink);
}
.document-flow[open] > summary > svg {
  transform: rotate(90deg);
}
.flow-context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
}
.flow-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-6);
  padding: var(--sp-5);
}
.flow-column .eyebrow {
  margin-bottom: var(--sp-2);
}
.flow-document {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-top: 1px solid var(--border);
}
.flow-document > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.flow-document strong {
  display: block;
  font-size: var(--fs-1);
  color: var(--link);
}
.flow-document span span {
  display: block;
}
.flow-document small {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-1);
  color: var(--text-3);
}
.flow-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--accent-ink);
}
.flow-icon svg {
  width: 16px;
  height: 16px;
}
.workflow-progress {
  display: flex;
  gap: var(--sp-6);
  margin: var(--sp-4) 0 var(--sp-5);
  padding: var(--sp-4) var(--sp-5);
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.workflow-step {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 140px;
  color: var(--text-3);
}
.workflow-step > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-3);
  font-size: var(--fs-1);
}
.workflow-step.current {
  color: var(--text);
}
.workflow-step.current > span {
  background: var(--brand-soft);
  border: 1px solid var(--brand);
}
.workflow-step.done > span {
  background: var(--success-soft);
  color: var(--success);
}
.workflow-step strong,
.workflow-step small {
  display: block;
}
.workflow-step small {
  font-size: var(--fs-1);
}
/* Approval route editor (public/admin-workflow-ui.js) */
.wf-section {
  margin-top: var(--sp-5);
}
.wf-section h3 {
  margin: 0 0 var(--sp-1);
}
#wf-stages {
  counter-reset: stage;
}
.wf-stage {
  display: grid;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.wf-stage .stage-number::before {
  counter-increment: stage;
  content: counter(stage);
}
.wf-stage-head {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) minmax(0, 220px) auto;
  align-items: end;
  gap: var(--sp-3);
}
.wf-stage-head .stage-number {
  margin-top: 0;
  margin-bottom: 6px;
}
.wf-stage-head > .btn {
  margin-bottom: 4px;
}
.wf-groups {
  display: grid;
  gap: var(--sp-2);
}
.wf-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) 110px;
  align-items: start;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.wf-stage.parallel .wf-group {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr) 110px auto;
}
.wf-stage:not(.parallel) .wf-branch-only {
  display: none;
}
.wf-group > .btn {
  margin-top: 26px;
}
.wf-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
}
.wf-rule {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 130px minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.wf-rule > .btn {
  margin-bottom: 4px;
}
.wf-test > summary {
  font-weight: 600;
  cursor: pointer;
}
.wf-test > .btn {
  margin-top: var(--sp-3);
}
.wf-result {
  display: grid;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.workflow-step small strong {
  display: inline;
  font-weight: 600;
}
.workflow-stage {
  display: grid;
  grid-template-columns: 32px minmax(120px, 1fr) minmax(150px, 1.4fr) minmax(90px, 0.6fr) minmax(90px, 0.6fr) auto;
  align-items: start;
  gap: var(--sp-3);
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--border);
}
.stage-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-top: 26px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--accent-ink);
  font-size: var(--fs-1);
}
.workflow-stage .form-field select[multiple] {
  min-height: 130px;
}
.workflow-stage > .btn {
  margin-top: 26px;
}
.permission-grid td {
  text-align: center;
}
.permission-grid td:first-child {
  text-align: left;
}

/* ---------------------------------------------------------------- overview */
.workday-context {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sp-3);
  margin: calc(-1 * var(--sp-2)) 0 var(--sp-5);
  color: var(--text-3);
}
.workday-context > span {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.workday-context svg {
  width: 16px;
  height: 16px;
}
.workspace-shortcuts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}
.workspace-shortcut {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.workspace-shortcut:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
  text-decoration: none;
}
.workspace-shortcut > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.workspace-shortcut strong {
  display: block;
  font-weight: 650;
}
.workspace-shortcut small {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-1);
  color: var(--text-3);
}
.workspace-shortcut > svg {
  width: 14px;
  height: 14px;
  color: var(--text-3);
}
.shortcut-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--accent-ink);
}
.shortcut-icon svg {
  width: 18px;
  height: 18px;
}
.overview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(300px, 1fr);
  gap: var(--sp-6);
  align-items: start;
}
.attention-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-4) var(--sp-5);
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  text-align: left;
}
.attention-item:hover {
  background: var(--surface-2);
}
.attention-item > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.attention-item strong {
  display: block;
  font-weight: 600;
}
.attention-item small {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-1);
  color: var(--text-3);
}
.attention-item > svg {
  width: 14px;
  height: 14px;
  margin-top: var(--sp-1);
  color: var(--text-3);
}
.attention-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--warning-soft);
  color: var(--warning);
}
.attention-icon svg {
  width: 16px;
  height: 16px;
}
.activity-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.activity-row:last-child {
  border-bottom: 0;
}
.activity-row > div {
  flex: 1;
  min-width: 0;
}
.activity-row a {
  font-weight: 600;
}
.activity-row p {
  margin: 2px 0 0;
  font-size: var(--fs-1);
  color: var(--text-3);
}
.activity-row time {
  font-size: var(--fs-1);
  color: var(--text-3);
  white-space: nowrap;
}
.activity-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--border-strong);
}
.room-mini {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.room-mini:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.room-mini > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.room-mini strong {
  display: block;
  font-weight: 600;
}
.room-mini small {
  display: block;
  font-size: var(--fs-1);
  color: var(--text-3);
}
.room-mini b {
  font-size: var(--fs-4);
  font-weight: 600;
}
.condition-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
}
.condition-dot.attention {
  background: var(--warning);
  box-shadow: 0 0 0 4px var(--warning-soft);
}
.workspace-tip {
  padding: var(--sp-5);
  border-radius: var(--radius-lg);
  background: var(--brand-soft);
}
.workspace-tip .shortcut-icon {
  margin-bottom: var(--sp-3);
  background: var(--surface);
}
.workspace-tip h3 {
  margin-bottom: var(--sp-2);
  font-size: var(--fs-3);
}
.workspace-tip p {
  color: var(--text-2);
}
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}
.module-card {
  display: block;
  padding: var(--sp-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
}
.module-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
  text-decoration: none;
}
.module-card h3 {
  margin-bottom: var(--sp-1);
  font-size: var(--fs-3);
}
.module-card p {
  margin: 0;
  color: var(--text-3);
}
.module-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: var(--sp-4);
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--accent-ink);
}
.module-icon svg {
  width: 18px;
  height: 18px;
}

/* ---------------------------------------------------------------- data grid (registers) */
.grid-skeleton {
  display: grid;
  gap: var(--sp-4);
  padding: var(--sp-6);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
#workspace-grid[aria-busy='true'] {
  opacity: 0.65;
  pointer-events: none;
}
.grid-viewbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.view-picker {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}
.view-picker > svg {
  width: 18px;
  height: 18px;
  color: var(--accent-ink);
}
.view-picker select {
  max-width: 280px;
  padding: var(--sp-2) var(--sp-6) var(--sp-2) 0;
  border: 0;
  background: transparent;
  font-weight: 650;
}
.view-modified {
  font-size: var(--fs-1);
  color: var(--warning);
}
.grid-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.grid-search {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--sp-2);
  min-width: 180px;
  max-width: 380px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.grid-search:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--focus-halo);
}
.grid-search svg {
  width: 16px;
  height: 16px;
  color: var(--text-3);
}
.grid-search input {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 0;
  background: transparent;
  outline: none;
}
.grid-filters select,
.ops-filters select {
  min-height: var(--control-h);
  max-width: 220px;
  padding: 0 var(--sp-6) 0 var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.grid-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  min-height: 30px;
  padding: 0 var(--sp-2) 0 var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--text);
  font-size: var(--fs-1);
  font-weight: 600;
}
.chip:hover {
  border-color: var(--brand);
}
.chip svg {
  width: 14px;
  height: 14px;
}
.grid-selection {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-5);
  border-bottom: 1px solid var(--border);
  background: var(--brand-soft);
}
.grid-selection span {
  font-size: var(--fs-1);
  color: var(--text-2);
}
.grid-scroll {
  position: relative;
  max-width: 100%;
  overflow: auto;
  scrollbar-width: thin;
}
.smart-table {
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}
.smart-table th {
  position: relative;
  height: 44px;
  padding: 0 var(--sp-4);
  overflow: visible;
}
.smart-table td {
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  overflow-wrap: anywhere;
}
.smart-table tr:hover td {
  background: var(--surface-2);
}
.smart-table tr.selected-row td {
  background: var(--brand-soft);
}
.smart-table .selection-cell {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 44px;
  padding: 0 var(--sp-3);
  text-align: center;
  background: var(--surface);
}
.smart-table th.selection-cell {
  z-index: 5;
  background: var(--surface-2);
}
.smart-table .select-col {
  width: 44px;
}
.smart-table .action-col {
  width: 64px;
}
.smart-table .pinned-column {
  position: sticky;
  left: 44px;
  z-index: 2;
  box-shadow: 1px 0 0 var(--border);
}
.smart-table th.pinned-column {
  z-index: 4;
}
.smart-table .numeric-cell {
  text-align: right;
}
.sort-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  width: 100%;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-size: var(--fs-1);
  font-weight: 650;
  text-align: left;
}
.sort-button:hover {
  color: var(--text);
}
.sort-button.static {
  cursor: default;
}
.smart-table th.numeric-cell .sort-button {
  justify-content: flex-end;
}
.resize-handle {
  position: absolute;
  top: 10px;
  bottom: 10px;
  right: -4px;
  z-index: 6;
  width: 9px;
  cursor: col-resize;
  touch-action: none;
}
.resize-handle::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}
.resize-handle:hover::after,
.resize-handle:focus::after {
  width: 2px;
  background: var(--brand);
}
.mini-avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: var(--fs-1);
}
.person-cell {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.row-actions {
  text-align: center;
}
.ownership-label {
  color: var(--text-2);
}
.grid-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border);
  font-size: var(--fs-1);
  color: var(--text-3);
}
.grid-paging {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.grid-paging label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-right: var(--sp-2);
}
.grid-paging select {
  min-height: var(--control-h-sm);
  padding: 0 var(--sp-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.grid-empty {
  padding: var(--sp-7) var(--sp-5) var(--sp-8);
  text-align: center;
  color: var(--text-2);
}
.grid-empty > svg {
  width: 28px;
  height: 28px;
  margin-bottom: var(--sp-2);
  color: var(--text-3);
}
.grid-empty h3 {
  margin-bottom: var(--sp-2);
  font-size: var(--fs-3);
}
.grid-empty p {
  margin-bottom: var(--sp-4);
}
.inventory-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.inventory-actions .section-kicker {
  margin: 0;
}

/* ---------------------------------------------------------------- process control */
.control-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
  padding: var(--sp-5);
  border-radius: var(--radius-lg);
  background: var(--brand-soft);
}
.control-summary p {
  margin: var(--sp-1) 0 0;
  color: var(--text-2);
}
.control-summary > .badge {
  margin-left: auto;
}
.control-symbol {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--accent-ink);
}
.control-symbol svg {
  width: 24px;
  height: 24px;
}
.control-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr);
  gap: var(--sp-6);
  align-items: start;
}
.process-lane {
  padding: var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.process-lane:last-child {
  border: 0;
}
.process-lane h3 {
  margin-bottom: var(--sp-1);
  font-size: var(--fs-3);
}
.process-lane p {
  margin-bottom: var(--sp-4);
  color: var(--text-3);
}
.process-stages {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
}
.process-stage {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
}
.process-stage:hover {
  border-color: var(--border-strong);
  text-decoration: none;
}
.process-stage > svg {
  width: 18px;
  height: 18px;
  color: var(--accent-ink);
}
.process-stage > svg:last-child {
  width: 14px;
  margin-left: auto;
  color: var(--text-3);
}
.control-check {
  border-bottom: 1px solid var(--border);
}
.control-check > summary {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  cursor: pointer;
  list-style: none;
}
.control-check strong {
  display: block;
}
.control-check small {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-1);
  color: var(--text-3);
}
.control-check > summary > svg {
  width: 14px;
  height: 14px;
  margin-left: auto;
}
.control-check[open] > summary > svg {
  transform: rotate(90deg);
}
.check-marker {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
.check-marker svg {
  width: 16px;
  height: 16px;
}
.check-marker.clear {
  background: var(--success-soft);
  color: var(--success);
}
.check-marker.review {
  background: var(--warning-soft);
  color: var(--warning);
}
.check-detail {
  padding: 0 var(--sp-5) var(--sp-4) 64px;
  color: var(--text-2);
}
.control-record {
  display: block;
  margin-top: var(--sp-2);
  font-size: var(--fs-1);
}
.control-record span {
  display: block;
  font-size: var(--fs-2);
}
.control-footnote {
  margin: 0;
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface-2);
  font-size: var(--fs-1);
  color: var(--text-3);
}

/* ---------------------------------------------------------------- cold chain */
.operations-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  background: var(--brand-soft);
  font-size: var(--fs-1);
  color: var(--text-2);
}
.operations-status > span:first-child {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 650;
  color: var(--text);
}
.operations-status svg {
  width: 14px;
  height: 14px;
}
.operations-status p {
  margin: 0 0 0 auto;
}
.cold-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  margin-bottom: var(--sp-4);
  color: var(--text-2);
}
.cold-note {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: calc(-1 * var(--sp-3)) 0 var(--sp-6);
  font-size: var(--fs-1);
  color: var(--text-3);
}
.cold-note svg {
  width: 14px;
  height: 14px;
}
/* Quick reading: a short sheet; on phones it rises from the bottom of the screen. */
dialog.sheet {
  max-width: 520px;
}
.reading-target {
  margin: 0 0 var(--sp-4);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-2);
}
.reading-form .form-field {
  margin-bottom: var(--sp-4);
}
.reading-input {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.reading-input .btn.icon {
  flex: none;
  width: 56px;
  min-height: 56px;
  font-size: var(--fs-4);
}
/* The temperature is the one value typed on every round, so it is large. */
#reading-temperature {
  flex: 1;
  min-height: 56px;
  font-size: var(--fs-5);
  font-weight: 600;
  text-align: right;
}
.reading-input > span {
  font-size: var(--fs-4);
  color: var(--text-2);
}
.reading-more {
  margin-bottom: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.reading-more > summary {
  cursor: pointer;
  font-weight: 600;
}
.reading-more > summary .muted {
  margin-left: var(--sp-2);
  font-weight: 400;
}
.reading-more[open] > summary {
  margin-bottom: var(--sp-3);
}
.reading-more .form-field {
  margin-bottom: 0;
}
.operations-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.operations-toolbar .segmented {
  margin: 0;
}
.operations-toolbar .grid-search {
  max-width: 260px;
}
.operations-rooms {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.operation-room {
  padding: var(--sp-5);
}
.room-card-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.room-card-head > div {
  flex: 1;
  min-width: 0;
}
.room-card-head h2 {
  font-size: var(--fs-3);
}
.room-card-head p {
  margin: 2px 0 0;
  font-size: var(--fs-1);
  color: var(--text-3);
}
.room-glyph {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--accent-ink);
}
.room-reading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin: var(--sp-5) 0 var(--sp-2);
}
.room-reading > span:first-child {
  font-size: var(--fs-6);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}
.room-reading small {
  margin-left: var(--sp-1);
  font-size: var(--fs-4);
  font-weight: 500;
  color: var(--text-2);
}
.room-range {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  font-size: var(--fs-1);
  color: var(--text-3);
}
.temperature-trend {
  display: block;
  width: 100%;
  height: 84px;
  margin-bottom: var(--sp-1);
  color: var(--brand);
}
.trend-band {
  fill: var(--brand-soft);
}
.trend-caption {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  font-size: var(--fs-1);
  color: var(--text-3);
}
.trend-empty {
  display: grid;
  place-items: center;
  height: 96px;
  margin-bottom: var(--sp-4);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: var(--fs-1);
  color: var(--text-3);
}
.room-information {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  padding: var(--sp-4) 0;
  border-top: 1px solid var(--border);
  font-size: var(--fs-1);
  color: var(--text-3);
}
.room-information strong {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-2);
  font-weight: 500;
  color: var(--text);
  overflow-wrap: anywhere;
}
.room-information > span:last-child:nth-child(3) {
  grid-column: 1 / -1;
}
.room-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}
.room-card-footer a {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-weight: 600;
}
.room-card-footer svg {
  width: 14px;
  height: 14px;
}
.room-attention {
  border-color: var(--warning);
}
.room-attention .room-glyph {
  background: var(--warning-soft);
  color: var(--warning);
}
.room-attention .room-reading > span:first-child,
.room-attention .temperature-trend {
  color: var(--warning);
}
.room-attention .trend-band {
  fill: var(--warning-soft);
}
.operations-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  gap: var(--sp-6);
}
.handover-links {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-4);
}
.handover-links .workspace-shortcut {
  padding: var(--sp-3);
  box-shadow: none;
}
.handover-links small {
  display: none;
}

/* ---------------------------------------------------------------- administration suite */
.rollout-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.rollout-banner svg {
  flex: none;
  width: 18px;
  height: 18px;
}
.rollout-stages {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.rollout-stage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.rollout-stage strong {
  font-size: var(--fs-4);
}
.meter {
  display: block;
  width: 100%;
  max-width: 160px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}
.meter > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--success);
}
.panel-head .meter {
  width: 120px;
}
.check-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.check-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.check-row:last-child {
  border-bottom: 0;
}
.check-row > div {
  flex: 1;
  min-width: 0;
}
.check-row strong,
.check-row small {
  display: block;
}
.check-row small {
  margin-top: 2px;
  font-size: var(--fs-1);
  color: var(--text-3);
}
.check-row small.evidence {
  color: var(--text-2);
}
.check-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--warning-soft);
  color: var(--warning);
}
.check-icon svg {
  width: 16px;
  height: 16px;
}
.check-row.met .check-icon {
  background: var(--success-soft);
  color: var(--success);
}
.signoffs {
  display: grid;
  gap: var(--sp-3);
}
.signoff {
  display: grid;
  gap: var(--sp-1);
  justify-items: start;
  padding: var(--sp-3) var(--sp-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.signoff.signed {
  border-style: solid;
  border-color: var(--success);
  background: var(--success-soft);
}
.signoff-role {
  font-size: var(--fs-1);
  font-weight: 600;
  color: var(--text-3);
}
.signoff strong {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}
.signoff strong svg {
  width: 16px;
  height: 16px;
  color: var(--success);
}
.signoff small {
  font-size: var(--fs-1);
  color: var(--text-3);
}
.choice-group {
  margin: 0;
  padding: 0;
  border: 0;
}
.choice-group > .btn {
  align-self: flex-start;
}
.choice-group > legend {
  margin-bottom: var(--sp-2);
  padding: 0;
  font-weight: 600;
}
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.choice {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 34px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 500;
  cursor: pointer;
}
.choice:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.choice input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}
.chip.static {
  min-height: 24px;
  margin: 0 var(--sp-1) var(--sp-1) 0;
  padding: 0 var(--sp-2);
  cursor: default;
}
.plain-list {
  display: grid;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.compact-fields {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.compact-fields dd {
  font-size: var(--fs-4);
  font-weight: 650;
}
.plain-list.numbered {
  padding-left: var(--sp-5);
  list-style: decimal;
}
.view-as {
  display: grid;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
  align-items: start;
  gap: var(--sp-5);
}
.view-as-menu {
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.view-as-menu .nav-link {
  cursor: default;
}
.view-as-group {
  margin: var(--sp-4) 0 var(--sp-2);
  font-size: var(--fs-2);
  color: var(--text-2);
}
.view-as-group:first-child {
  margin-top: 0;
}
@media (max-width: 760px) {
  .view-as {
    grid-template-columns: 1fr;
  }
}
.chip.static.added {
  border-color: var(--brand);
}
.chip.static.retired {
  opacity: 0.6;
  text-decoration: line-through;
}
.choice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}
.inline-form {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}
.inline-form .form-field {
  flex: 1;
  margin: 0;
}
/* Printed letterhead and terms (Numbering & printing) */
.print-letterhead {
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #000;
}
.print-letterhead img {
  max-width: 160px;
  max-height: 64px;
}
.print-letterhead span,
.print-letterhead strong {
  display: block;
}
.print-letterhead strong {
  font-size: 18px;
}
.print-terms {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid #000;
  font-size: 12px;
  white-space: pre-line;
}
.print-signature {
  margin-top: 48px;
}
.mention {
  color: var(--link);
  font-weight: 600;
}
.comment-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}
.mention-pick {
  max-width: 240px;
}
td.depth-1 {
  padding-left: calc(var(--sp-4) + 20px);
}
td.depth-2 {
  padding-left: calc(var(--sp-4) + 40px);
}
td.depth-3 {
  padding-left: calc(var(--sp-4) + 60px);
}
td.depth-4 {
  padding-left: calc(var(--sp-4) + 80px);
}
.admin-group {
  margin: var(--sp-6) 0 var(--sp-3);
  font-size: var(--fs-3);
  color: var(--text-2);
}
.admin-tools {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.link-field {
  width: 100%;
  font-family: var(--font-mono);
  font-size: var(--fs-1);
}
.sso-options {
  display: grid;
  gap: var(--sp-2);
}
.sso-options:empty {
  display: none;
}
.sso-or {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-2) 0 0;
  color: var(--text-3);
  font-size: var(--fs-1);
}
.sso-or::before,
.sso-or::after {
  flex: 1;
  border-top: 1px solid var(--border);
  content: '';
}
.announcements {
  display: grid;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.announcement {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.announcement.needs-ack {
  border-color: var(--warning);
  background: var(--warning-soft);
}
.announcement > div {
  flex: 1;
  min-width: 0;
}
.announcement h2 {
  margin: 0;
  font-size: var(--fs-4);
}
.announcement-meta {
  margin: 2px 0 var(--sp-2);
  font-size: var(--fs-1);
  color: var(--text-3);
}
.announcement-body {
  margin: 0;
  white-space: pre-line;
}
.announcement-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
}
.announcement-icon svg {
  width: 18px;
  height: 18px;
}
.escalation-list {
  margin-bottom: var(--sp-3);
}
.escalation-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  background: var(--warning-soft);
  font-size: var(--fs-2);
}
.escalation-list svg {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  color: var(--warning);
}
@media (max-width: 760px) {
  .rollout-stages {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------------------------------------------------------------- legal */
.legal-intro {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
  padding: var(--sp-5);
  border-radius: var(--radius-lg);
  background: var(--brand-soft);
}
.legal-intro > div {
  flex: 1;
}
.legal-intro h2 {
  margin-bottom: var(--sp-1);
  font-size: var(--fs-4);
}
.legal-intro p {
  margin: 0;
  color: var(--text-2);
}
.legal-symbol {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--accent-ink);
}
.legal-symbol svg {
  width: 26px;
  height: 26px;
}
.legal-shortcuts {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ---------------------------------------------------------------- productivity, finance and operations screens */
.pro-stats {
  margin-bottom: var(--sp-6);
}
.pro-stat-label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  color: var(--text-2);
}
.pro-stat-label svg {
  width: 18px;
  height: 18px;
}
.pro-two-col,
.security-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-5);
  align-items: start;
}
.pro-record-tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: var(--sp-4) 0;
}
.pro-record-tools:empty {
  display: none;
}
.panel td .cell-secondary {
  max-width: 480px;
  white-space: normal;
}
.ops-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-4);
}
.ops-filters .form-grid {
  flex: 1;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.journal-entry {
  border-bottom: 1px solid var(--border);
}
.journal-entry > summary {
  display: grid;
  grid-template-columns: 110px 150px 1fr 140px;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-1);
  cursor: pointer;
}
.journal-entry .journal-memo {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text-2);
}
.journal-entry .table-wrap {
  margin: 0 0 var(--sp-3) var(--sp-6);
}
.command-list {
  display: grid;
  gap: 2px;
  max-height: 55vh;
  margin-top: var(--sp-4);
  overflow: auto;
}
.command-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 44px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  color: var(--text);
}
.command-item:hover,
.command-item:focus-visible,
.command-item[aria-selected='true'] {
  background: var(--surface-3);
  text-decoration: none;
}
.command-item > svg:last-child {
  width: 14px;
  margin-left: auto;
  color: var(--text-3);
}

/* ---------------------------------------------------------------- sign-in and portals */
.login-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}
.login-intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--sp-8) 72px;
  background: #12322a;
  color: #fff;
}
.login-intro .brand {
  margin-bottom: 64px;
  padding: 0;
  color: #fff;
}
.login-intro .brand small {
  color: #a9cbbd;
}
.login-intro .brand img {
  width: 72px;
  height: 72px;
}
.login-intro h1 {
  max-width: 480px;
  color: #fff;
  font-size: var(--fs-6);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.login-intro p {
  max-width: 400px;
  margin-top: var(--sp-5);
  color: #c4dbd1;
}
.login-intro .login-foot {
  margin-top: 64px;
  font-size: var(--fs-1);
  color: #a9cbbd;
}
.login-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8);
  background: var(--surface);
}
.login-form {
  width: 100%;
  max-width: 380px;
}
.login-form h2 {
  margin-bottom: var(--sp-2);
  font-size: var(--fs-5);
}
.login-form .form-field {
  margin: var(--sp-4) 0;
}
.login-form .btn {
  width: 100%;
  margin-top: var(--sp-2);
}
.login-password-help {
  margin-top: var(--sp-6);
  font-size: var(--fs-1);
  line-height: 1.7;
  color: var(--text-3);
}
.portal-shell .content {
  max-width: 1280px;
}
.portal-shell .topbar {
  padding: 0 var(--sp-6);
}
.portal-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-4);
  font-weight: 700;
  color: var(--text);
}
.portal-brand img {
  width: 30px;
  height: 30px;
}
.portal-brand .muted {
  margin-left: var(--sp-3);
  font-size: var(--fs-2);
  font-weight: 400;
}

/* ---------------------------------------------------------------- compact density */
.compact {
  --control-h: 36px;
  --control-h-sm: 30px;
}
.compact td,
.compact .smart-table td {
  padding-top: var(--sp-2);
  padding-bottom: var(--sp-2);
}
.compact .panel-head,
.compact .grid-viewbar,
.compact .grid-filters {
  padding-top: var(--sp-2);
  padding-bottom: var(--sp-2);
}
.compact .stat {
  padding: var(--sp-4);
}
.compact .attention-item,
.compact .activity-row,
.compact .room-mini {
  padding-top: var(--sp-3);
  padding-bottom: var(--sp-3);
}
.compact .nav-link {
  min-height: 34px;
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1250px) {
  :root {
    --sidebar-w: 228px;
  }
  .content {
    padding: var(--sp-6);
  }
  .topbar {
    padding: 0 var(--sp-6);
  }
  .overview-layout {
    grid-template-columns: minmax(0, 1.5fr) minmax(270px, 1fr);
    gap: var(--sp-5);
  }
  .workspace-shortcuts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .operations-bottom,
  .control-layout {
    grid-template-columns: 1fr;
  }
  .detail-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
  .search-trigger {
    width: 200px;
  }
}
@media (max-width: 1050px) {
  .overview-layout,
  .detail-layout {
    grid-template-columns: 1fr;
  }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .search-trigger {
    width: auto;
  }
  .search-trigger span,
  .search-trigger kbd {
    display: none;
  }
  .skeleton-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .page-head {
    flex-wrap: wrap;
  }
  .page-head .button-row {
    justify-content: flex-start;
  }
}
@media (max-width: 760px) {
  :root {
    --topbar-h: 60px;
  }
  .app-shell {
    display: block;
  }
  .sidebar {
    width: min(300px, 86vw);
    transform: translateX(-100%);
    visibility: hidden;
    box-shadow: var(--shadow-3);
    transition:
      transform 0.2s,
      visibility 0.2s;
  }
  .sidebar.open {
    transform: none;
    visibility: visible;
  }
  .navigation-open {
    overflow: hidden;
  }
  .nav-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    border: 0;
    background: var(--overlay);
  }
  .topbar {
    gap: var(--sp-2);
    padding: 0 var(--sp-3);
  }
  .company-switcher {
    flex: 1;
  }
  .company-select {
    max-width: 100%;
    font-size: var(--fs-2);
  }
  .content {
    padding: var(--sp-5) var(--sp-4) var(--sp-8);
  }
  h1 {
    font-size: var(--fs-4);
  }
  .page-head {
    gap: var(--sp-3);
    margin-bottom: var(--sp-5);
  }
  .page-head .button-row {
    width: 100%;
  }
  .demo-banner span:last-child {
    display: none;
  }
  .stats {
    gap: var(--sp-3);
  }
  .stat {
    padding: var(--sp-4);
  }
  .stat-value {
    font-size: var(--fs-4);
  }
  .panel-head,
  .panel-body {
    padding: var(--sp-4);
  }
  th,
  td {
    padding: var(--sp-3) var(--sp-4);
  }
  .form-grid,
  .fields,
  .pro-two-col,
  .security-grid,
  .flow-columns,
  .process-stages {
    grid-template-columns: 1fr;
  }
  .line-row {
    grid-template-columns: 1fr 1fr;
  }
  .login-shell {
    grid-template-columns: 1fr;
  }
  .login-intro {
    padding: var(--sp-6);
  }
  .login-intro .brand {
    margin: 0;
  }
  .login-intro .brand img {
    width: 44px;
    height: 44px;
  }
  .login-intro h1,
  .login-intro p,
  .login-intro .login-foot {
    display: none;
  }
  .login-form-wrap {
    padding: var(--sp-7) var(--sp-5);
  }
  dialog {
    width: calc(100% - var(--sp-4));
    max-width: calc(100% - var(--sp-4));
    max-height: 94dvh;
  }
  .dialog-head {
    padding: var(--sp-4);
  }
  .dialog-body {
    padding: var(--sp-4);
  }
  .drawer-footer {
    margin: var(--sp-5) calc(-1 * var(--sp-4)) calc(-1 * var(--sp-4));
    bottom: calc(-1 * var(--sp-4));
    padding: var(--sp-3) var(--sp-4);
  }
  .segmented {
    display: flex;
    flex-wrap: wrap;
    overflow: visible;
  }
  .segmented button {
    flex: 1 1 120px;
  }
  .operations-toolbar .grid-search {
    max-width: none;
  }
  .workflow-stage {
    grid-template-columns: 1fr;
  }
  .wf-stage-head,
  .wf-group,
  .wf-stage.parallel .wf-group,
  .wf-rule {
    grid-template-columns: 1fr;
  }
  .workflow-stage > * {
    grid-column: 1 !important;
  }
  .stage-number,
  .workflow-stage > .btn {
    margin: 0;
  }
  .legal-shortcuts {
    grid-template-columns: 1fr;
  }
  .journal-entry > summary {
    grid-template-columns: 1fr 1fr;
  }
  .journal-entry .journal-memo {
    grid-column: 1 / -1;
  }
  .check-detail {
    padding-left: var(--sp-5);
  }
  .filters input {
    min-width: 0;
    flex: 1;
  }
  .grid-filters > .grid-search {
    max-width: none;
    flex-basis: 100%;
  }
  #toast {
    left: var(--sp-3);
    right: var(--sp-3);
    bottom: var(--sp-3);
    max-width: none;
  }
  .form-footer {
    margin: var(--sp-4) calc(-1 * var(--sp-4)) 0;
    padding: var(--sp-3) var(--sp-4);
  }
  .bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    gap: var(--sp-1);
    padding: var(--sp-1) var(--sp-1) calc(var(--sp-1) + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(14px);
  }
  .bottom-nav a,
  .bottom-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 52px;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-2);
    font-size: var(--fs-1);
    font-weight: 600;
  }
  .bottom-nav a:hover {
    text-decoration: none;
  }
  .bottom-nav a[aria-current='page'] {
    background: var(--brand-soft);
    color: var(--accent-ink);
  }
  .bottom-nav svg {
    width: 22px;
    height: 22px;
  }
  .content {
    padding-bottom: calc(var(--sp-8) + 64px + env(safe-area-inset-bottom));
  }
  #toast {
    bottom: calc(72px + env(safe-area-inset-bottom));
  }
  .pro-scan {
    flex-wrap: wrap;
  }
  .pro-scan input {
    flex-basis: 100%;
  }
  .pro-scan .btn {
    flex: 1;
  }
  /* Column widths, saved-view editing and page export are desk tools; phones keep the view picker. */
  .grid-viewbar .button-row {
    display: none;
  }
  /* Registers: one card per record, the title across the top and the other columns labelled beneath. */
  .grid-scroll {
    overflow: visible;
  }
  .smart-table {
    min-width: 0 !important;
  }
  .smart-table,
  .smart-table tbody {
    display: block;
  }
  .smart-table thead,
  .smart-table colgroup {
    display: none;
  }
  .smart-table tr {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-3) var(--sp-4);
    padding: var(--sp-4);
    border-bottom: 1px solid var(--border);
  }
  .smart-table td,
  .smart-table .pinned-column,
  .smart-table .selection-cell {
    position: static;
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .smart-table tr:hover td,
  .smart-table tr.selected-row td {
    background: transparent;
  }
  .smart-table .numeric-cell {
    text-align: left;
  }
  .smart-table td[data-label]::before,
  table.stack-on-phone td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-size: var(--fs-1);
    font-weight: 600;
    color: var(--text-3);
  }
  .smart-table td.pinned-column {
    grid-column: 1 / -1;
    padding-right: 48px;
  }
  .smart-table td.pinned-column::before,
  .smart-table .selection-cell {
    display: none;
  }
  .smart-table .row-actions {
    position: absolute;
    top: var(--sp-3);
    right: var(--sp-3);
  }
  /* Other wide tables (four or more columns) become cards in the same way. */
  .table-wrap:has(> table.stack-on-phone) {
    overflow: visible;
  }
  table.stack-on-phone,
  table.stack-on-phone tbody,
  table.stack-on-phone tfoot {
    display: block;
  }
  table.stack-on-phone thead {
    display: none;
  }
  table.stack-on-phone tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-2) var(--sp-4);
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border);
  }
  table.stack-on-phone td {
    display: block;
    padding: 0;
    border: 0;
    text-align: left;
  }
  table.stack-on-phone tbody td:first-child {
    grid-column: 1 / -1;
  }
  table.stack-on-phone tbody td:first-child::before,
  table.stack-on-phone td:empty {
    display: none;
  }
  table.stack-on-phone tbody tr:hover td {
    background: transparent;
  }
  table.stack-on-phone tfoot tr {
    background: var(--surface-2);
  }
  dialog.sheet {
    inset: auto 0 0;
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    margin: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  dialog.sheet .form-footer {
    padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom));
  }
  .form-footer .draft-status {
    flex-basis: 100%;
  }
  .form-footer .button-row {
    width: 100%;
  }
  .form-footer .button-row {
    flex-wrap: nowrap;
  }
  .form-footer .button-row .btn {
    flex: 1;
  }
  /* The dialog's close button cancels on phones, leaving room for both save buttons. */
  .form-footer .button-row .btn.subtle {
    display: none;
  }
  /* Order lines become cards: one per line, labels above each value. */
  .line-scroll {
    overflow: visible;
    border: 0;
  }
  .line-table,
  .line-table tbody,
  .line-table tfoot {
    display: block;
  }
  .line-table thead {
    display: none;
  }
  .line-table tr.line-row,
  .line-table tfoot tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-3);
    margin-bottom: var(--sp-3);
    padding: var(--sp-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
  }
  .line-table tfoot tr {
    background: var(--surface-3);
  }
  .line-table td,
  .line-table tfoot td {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
  }
  .line-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-size: var(--fs-1);
    font-weight: 600;
    color: var(--text-2);
  }
  .line-table td.line-no,
  .line-table tfoot td:empty {
    display: none;
  }
  .line-table td:has(.combo),
  .line-table td:has(textarea) {
    grid-column: 1 / -1;
  }
  .line-table td .combo,
  .line-table td input.num-input {
    min-width: 0;
  }
  .line-table td.line-amount {
    padding-top: 0;
  }
  .line-table td.line-actions {
    grid-column: 1 / -1;
    justify-self: end;
    width: auto;
  }
}
@media (max-width: 420px) {
  .stats {
    grid-template-columns: 1fr 1fr;
  }
  .workspace-shortcuts {
    grid-template-columns: 1fr;
  }
  .drawer-fields,
  .room-information {
    grid-template-columns: 1fr;
  }
  .line-row {
    grid-template-columns: 1fr;
  }
}
/* Touch screens: larger targets and 16 px inputs so phones do not zoom into fields. */
@media (pointer: coarse) {
  :root {
    --control-h: 44px;
    --control-h-sm: 40px;
  }
  .form-field input:not([type='checkbox']):not([type='radio']),
  .form-field select,
  .form-field textarea,
  .line-table input:not([type='checkbox']),
  .line-table select,
  .grid-search input,
  .filters input,
  .filters select,
  .comment-box {
    font-size: var(--fs-3);
  }
  .nav-link {
    min-height: 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* ---------------------------------------------------------------- print */
/* Warehouse scanning (public/warehouse-ui.js): phone screens with large targets for gloved hands. */
.wms-start {
  display: grid;
  gap: var(--sp-4);
  margin: var(--sp-4) 0;
}
.wms-big-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
}
.wms-big-buttons .btn {
  min-height: 64px;
  justify-content: center;
  font-size: var(--fs-4);
}
.wms-sessions li a,
.wms-sessions li > span {
  display: grid;
  gap: 2px;
}
.wms-sessions li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}
.wms-sessions small,
.wms-outcome small {
  color: var(--text-2);
}
.wms-outcome li {
  display: grid;
  gap: 2px;
}
.wms-outcome + p {
  margin-top: var(--sp-4);
}
.wms-outcome .wms-check {
  color: var(--warning);
}
.wms-start-form .wms-selfie {
  display: grid;
  place-items: center;
  overflow: hidden;
  margin: var(--sp-3) 0;
  border-radius: var(--radius);
  background: #000;
}
.wms-selfie video,
.wms-selfie img {
  display: block;
  width: 100%;
  max-height: 40vh;
  object-fit: cover;
}
.wms-screen {
  display: grid;
  gap: var(--sp-3);
  max-width: 720px;
  margin: 0 auto;
}
.wms-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
}
.wms-head h1 {
  margin: 0;
  font-size: var(--fs-5);
}
.wms-sync {
  flex: none;
  padding: var(--sp-1) var(--sp-3);
  border-radius: 999px;
  font-size: var(--fs-1);
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-2);
}
.wms-sync.ok {
  background: var(--success-soft);
  color: var(--success);
}
.wms-sync.waiting,
.wms-sync.sending {
  background: var(--info-soft);
  color: var(--info);
}
.wms-sync.offline {
  background: var(--warning-soft);
  color: var(--warning);
}
.wms-room {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  background: var(--brand-soft);
  font-weight: 600;
  font-size: var(--fs-3);
}
.wms-camera video {
  aspect-ratio: 4 / 3;
  max-height: 46vh;
}
.wms-no-camera {
  margin: 0;
  padding: var(--sp-5);
  color: #fff;
  text-align: center;
}
.wms-last {
  min-height: 64px;
  padding: var(--sp-3) var(--sp-4);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--fs-4);
  font-weight: 600;
  line-height: 1.35;
}
.wms-last.ok {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}
.wms-last.warn {
  border-color: var(--warning);
  background: var(--warning-soft);
  color: var(--warning);
}
.wms-last.error {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}
.wms-type {
  display: flex;
  gap: var(--sp-2);
}
.wms-type input {
  flex: 1;
  min-width: 0;
  min-height: var(--control-h);
}
.wms-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--sp-2);
}
.wms-actions .btn,
.wms-finish .btn {
  min-height: 52px;
  justify-content: center;
}
.wms-totals {
  margin: 0;
  padding: 0;
  list-style: none;
}
.wms-totals li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.wms-totals li span {
  grid-column: 1;
  color: var(--text-2);
  font-size: var(--fs-2);
}
.wms-totals li b {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-size: var(--fs-5);
}
.wms-empty,
.wms-attention {
  padding: var(--sp-3) var(--sp-4);
}
.wms-attention ul {
  margin-top: var(--sp-2);
}
.wms-finish {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--sp-2);
}
.wms-choices {
  display: grid;
  gap: var(--sp-2);
}
.wms-load-form {
  display: grid;
  gap: var(--sp-3);
  margin: var(--sp-4) 0;
}
.wms-count-scope .choice {
  align-self: flex-start;
}
.wms-count-scope select {
  margin-bottom: var(--sp-2);
}
/* Warehouse dashboard. */
.wh-group > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
}
.wh-group > summary span {
  color: var(--text-2);
}
.wh-group > summary > svg {
  width: 16px;
  height: 16px;
  margin-right: calc(var(--sp-2) * -1);
  color: var(--text-3);
  transition: transform 0.15s;
}
.wh-group[open] > summary > svg {
  transform: rotate(90deg);
}
.wh-worker {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.wh-worker img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}
.wh-found {
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border);
}
.wh-found h3 {
  margin: 0 0 var(--sp-1);
  font-size: var(--fs-3);
}
.chip-remove {
  margin-left: var(--sp-1);
  padding: 0 var(--sp-1);
  border: 0;
  background: none;
  color: var(--text-2);
  cursor: pointer;
}
/* Room labels: cut out and fixed at each room's door. Lot labels: stuck on boxes without a supplier label. */
.label-sheet {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: var(--sp-4);
}
.room-label,
.lot-label {
  margin: 0;
  padding: var(--sp-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
  color: #000;
  text-align: center;
  break-inside: avoid;
}
.room-label-name,
.lot-label-product {
  font-size: var(--fs-5);
  font-weight: 700;
}
.lot-label-lot,
.lot-label-dates {
  margin-top: var(--sp-1);
}
.lot-label-dates {
  font-size: var(--fs-1);
}
.room-label-code svg {
  width: 100%;
  height: auto;
  max-height: 120px;
  margin: var(--sp-3) 0;
}
.room-label figcaption,
.lot-label figcaption {
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}
/* Warehouse and inventory (public/inventory-ui.js, public/door-checks.js). */
.inline-select {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  color: var(--text-2);
  font-weight: 600;
}
.inline-select select {
  min-height: var(--control-h);
  max-width: 100%;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.inv-intro {
  margin-bottom: var(--sp-4);
}
.inv-note {
  margin-top: var(--sp-3);
}
.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  align-items: start;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.inv-list {
  gap: 0;
}
.inv-list li,
.inv-rooms li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-3);
}
.inv-list li {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border);
}
.inv-list li:first-child {
  border-top: 0;
}
.inv-list li > span:first-child,
.inv-rooms li > span:first-child {
  display: grid;
  flex: 1 1 200px;
  gap: 2px;
  min-width: 0;
}
.inv-list small,
.inv-rooms small {
  color: var(--text-3);
  overflow-wrap: anywhere;
}
.inv-occupancy + .inv-occupancy {
  border-top: 1px solid var(--border);
}
.inv-bar {
  flex: 0 0 96px;
  width: 96px;
  height: 8px;
  fill: var(--surface-3);
}
.inv-bar .inv-bar-fill {
  fill: var(--brand);
}
.pick-tick::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  vertical-align: middle;
}
@media (min-width: 761px) {
  .inv-report td {
    white-space: nowrap;
  }
}
.door-form {
  display: grid;
  gap: var(--sp-4);
}
.door-pulp {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-2);
}
.door-photos {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: var(--sp-3) 0 0;
}
/* ---------------------------------------------------------------- Sales and customer service */
.sales-form {
  display: grid;
  gap: var(--sp-4);
}
.sales-form .choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
}
.remedy-detail {
  display: grid;
  gap: var(--sp-3);
  margin: 0 0 var(--sp-2) var(--sp-6);
}
.sales-steps {
  display: grid;
  gap: 0;
  margin: 0 0 var(--sp-4);
  padding: 0;
  list-style: none;
}
.sales-steps li {
  position: relative;
  display: grid;
  gap: 2px;
  margin-left: var(--sp-1);
  padding: 0 0 var(--sp-3) var(--sp-5);
  border-left: 2px solid var(--border);
  color: var(--text-3);
}
.sales-steps li:last-child {
  padding-bottom: 0;
  border-left-color: transparent;
}
.sales-steps li::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: var(--surface);
}
.sales-steps li.done {
  border-left-color: var(--brand);
  color: var(--text-2);
}
.sales-steps li.done::before {
  border-color: var(--brand);
  background: var(--brand);
}
.sales-steps li.current::before {
  border-color: var(--warning);
}
.sales-steps li.current strong {
  color: var(--text);
}
.sales-steps strong {
  font-size: var(--fs-2);
  font-weight: 600;
}
.sales-steps small {
  font-size: var(--fs-1);
  overflow-wrap: anywhere;
}
@media (min-width: 761px) {
  .collections-table td:first-child {
    min-width: 15rem;
  }
  .collections-table td:not(:first-child) {
    white-space: nowrap;
  }
}
.sales-panels {
  margin-bottom: var(--sp-5);
}
.sales-contacts .section-kicker {
  margin: var(--sp-4) 0 var(--sp-1);
}
.complaint-text,
.event-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.complaint-text {
  margin: 0 0 var(--sp-4);
  color: var(--text);
}
.event-text {
  margin: 2px 0 0;
  color: var(--text-2);
}
.statement-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.statement-head p {
  margin: 0;
}
.availability {
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.availability-head {
  margin: 0 0 var(--sp-2);
}
.availability-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-1);
}
.availability-table th,
.availability-table td {
  padding: var(--sp-1) var(--sp-2);
  border-top: 1px solid var(--border);
  text-align: left;
}
.availability-table .num {
  text-align: right;
}
.availability-table .short-life td {
  color: var(--text-3);
}
/* ---------------------------------------------------------------- HR and attendance */
.punch-card .panel-body {
  display: grid;
  gap: var(--sp-3);
}
.punch-now {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}
.punch-now h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin: var(--sp-1) 0;
  font-size: var(--fs-4);
}
.punch-button {
  min-height: 56px;
  padding: 0 var(--sp-6);
  font-size: var(--fs-3);
}
.punch-list {
  display: grid;
  gap: var(--sp-2);
  margin: var(--sp-2) 0 0;
  padding: 0;
  list-style: none;
}
.punch-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}
.punch-dir {
  min-width: 36px;
  padding: 2px var(--sp-2);
  border-radius: var(--radius-sm);
  background: var(--success-soft);
  color: var(--success);
  font-size: var(--fs-1);
  font-weight: 700;
  text-align: center;
}
.punch-dir.out {
  background: var(--info-soft);
  color: var(--info);
}
.punch-time {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
.punch-place {
  color: var(--text-2);
}
.punch-place.flagged {
  color: var(--warning);
  font-weight: 600;
}
.punch-details {
  margin-top: var(--sp-1);
}
.punch-details summary {
  color: var(--link);
  cursor: pointer;
  font-size: var(--fs-1);
}
.punch-photo img {
  display: block;
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: var(--radius);
}
.punch-position {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--sp-2) var(--sp-4);
  margin: 0 0 var(--sp-3);
}
.punch-position dt {
  color: var(--text-3);
}
.punch-position dd {
  margin: 0;
}
.stats.compact {
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  margin: 0;
  padding: var(--sp-4);
}
.stats.compact .stat {
  padding: var(--sp-3);
}
.stats.compact .stat-value {
  font-size: var(--fs-4);
}
.segmented a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 var(--sp-4);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.segmented a:hover {
  color: var(--text);
}
.segmented a.selected {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
}
.report-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-3);
}
.report-filters label {
  display: grid;
  gap: var(--sp-1);
  color: var(--text-2);
  font-size: var(--fs-1);
  font-weight: 600;
}
.workspace-shortcuts.vertical {
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
  padding: var(--sp-4);
}
.hr-waiting,
.hr-setup {
  padding: var(--sp-4);
}
.hr-waiting a,
.hr-setup a {
  display: grid;
  gap: 2px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
}
.hr-waiting a:hover,
.hr-setup a:hover {
  background: var(--surface-2);
}
.hr-waiting small,
.hr-setup small {
  color: var(--text-3);
}
#punch-card:empty {
  display: none;
}
#punch-card:not(:empty) {
  margin-bottom: var(--sp-6);
}
.register th,
.register td {
  padding: var(--sp-2) var(--sp-2);
  text-align: center;
  white-space: nowrap;
}
.register th[scope='row'],
.register thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 120px;
  max-width: 180px;
  background: var(--surface);
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
@media (max-width: 760px) {
  .punch-now {
    flex-direction: column;
    align-items: stretch;
  }
  .punch-button {
    width: 100%;
  }
}
/* ---------------------------------------------------------------- procurement and imports */
.stage-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: var(--sp-3) var(--sp-4);
  list-style: none;
}
.stage-list .stage {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-3);
  min-height: 40px;
  border-bottom: 1px solid var(--border);
}
.stage-list .stage:last-child {
  border-bottom: 0;
}
.stage-dot {
  width: 10px;
  height: 10px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
}
.stage.done .stage-dot {
  border-color: var(--success);
  background: var(--success);
}
.stage.done .stage-name {
  font-weight: 600;
}
.stage-edit {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.stage-edit input[type='date'] {
  min-height: var(--control-h-sm);
}
.stage-date {
  color: var(--text-2);
}
.release-blockers {
  margin: 0 0 var(--sp-3);
  padding-left: var(--sp-5);
  color: var(--warning);
}
.eta-form {
  display: grid;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.eta-form label {
  color: var(--text-2);
  font-size: var(--fs-1);
  font-weight: 600;
}
.free-time > div {
  display: grid;
  gap: 2px;
  margin-top: var(--sp-3);
}
.free-time > div span,
.free-time small {
  color: var(--text-3);
  font-size: var(--fs-1);
}
.cost-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sp-3);
  color: var(--text-2);
}
.estimate-input {
  max-width: 140px;
}
.checklist-rows li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
}
.checklist-rows li input[name='type'] {
  flex: 1 1 240px;
  min-height: var(--control-h);
}
.checklist-rows {
  margin-bottom: var(--sp-4);
}
.container-earlier p {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.container-history {
  padding: var(--sp-4);
}
.container-history li span {
  display: grid;
  gap: 2px;
}
.container-history small {
  color: var(--text-3);
}
@media (max-width: 760px) {
  .stage-list .stage {
    grid-template-columns: 14px minmax(0, 1fr);
    padding: var(--sp-2) 0;
  }
  .stage-edit,
  .stage-date {
    grid-column: 2;
  }
}
@media print {
  :root {
    color-scheme: light;
  }
  body {
    background: #fff;
    color: #000;
  }
  .sidebar,
  .topbar,
  .demo-banner,
  .page-head .button-row,
  .no-print,
  .grid-viewbar,
  .grid-filters,
  .grid-selection,
  .grid-footer,
  .row-actions,
  .selection-cell,
  .resize-handle,
  .operations-toolbar,
  .workspace-shortcuts,
  .record-guidance,
  .segmented,
  .nav-backdrop,
  .skip-link,
  dialog,
  #toast {
    display: none !important;
  }
  .app-shell,
  .workspace,
  .detail-layout,
  .overview-layout,
  .operations-bottom,
  .control-layout {
    display: block;
  }
  .content {
    padding: 0;
  }
  .panel,
  .stat {
    box-shadow: none;
    break-inside: avoid;
  }
  .panel {
    margin: var(--sp-4) 0;
  }
  .table-wrap,
  .grid-scroll {
    overflow: visible;
  }
  .smart-table {
    min-width: 0 !important;
    table-layout: auto;
  }
  .print-only {
    display: block;
  }
  .label-sheet {
    grid-template-columns: 1fr 1fr;
  }
  .pick-tick::before {
    border-color: #000;
  }
  .print-letterhead.print-only {
    display: flex;
  }
  .document-flow:not([open]) {
    display: none;
  }
  body.print-dialog #app {
    display: none !important;
  }
  body.print-dialog dialog {
    display: block !important;
    position: static;
    width: 100%;
    max-width: none;
    max-height: none;
    box-shadow: none;
  }
  body.print-dialog dialog .btn {
    display: none !important;
  }
}
