/* ==========================================================================================================================================
     Stock app design system v6 (base layer)
     One stylesheet for every screen and every device: Android and iPhone in the hand, a Galaxy Z Fold folded and unfolded, a tablet, a Windows PC.
       - one layout that follows the width it is given, in three steps:  compact  < 600px  (bottom tab bar)
                                                                          medium   600 - 1023px (navigation rail: icons with a short word; Fold unfolded, tablets)
                                                                          expanded >= 1024px (full sidebar; Windows, landscape tablets)
       - controls are thumb-sized (44px) where the pointer is a finger and denser (40px) where it is a mouse; both keep a visible keyboard focus
       - colour from the logo: ink black for actions and text, logo red for the brand mark, the active item and the one key figure of a screen
       - light and dark, from the device setting or the person's own switch
     ========================================================================================================================================== */
  :root {
    --teal: #0E6E78;
    --bg: #F4F2EE; --ink: #1A1612; --muted: #6B645C; --line: #E2DDD5; --on-ink: #fff; --fg: var(--ink); --text: var(--ink);
    --brand: #D33A2C; --brand-soft: #FBE9E6; --brand-ink: #B02A20;
    --accent: #1A1612; --accent-soft: #EFEBE5; --accent-2: #2D2823; --accent-line: #CDC6BC;
    --warn: #8F4A06; --warn-bg: #FCEFD9; --warn-line: #EFD7AE; --warn-text: #8F4A06;
    --danger: #98180F; --danger-bg: #FBE4E1; --danger-line: #F0CAC5;
    --ok: #1B6B3A; --ok-bg: #E3F1E8; --ok-line: #C2DFCB;
    --info: #1F5A8A; --info-bg: #E6EFF7;
    --surface: #FFFFFF; --surface-2: #FAF8F5; --line-2: #EDE9E2; --hover: #F1EEE8;
    --glass: rgba(255,255,255,.92); --glass-solid: rgba(255,255,255,.98); --glass-line: rgba(26,22,18,.08);
    --shadow-sm: 0 1px 2px rgba(26,22,18,.05), 0 1px 1px rgba(26,22,18,.03);
    --shadow-md: 0 2px 4px rgba(26,22,18,.04), 0 8px 24px rgba(26,22,18,.08);
    --shadow-lg: 0 4px 10px rgba(26,22,18,.06), 0 28px 64px rgba(26,22,18,.20);
    --radius-sm: 10px; --radius-md: 14px; --radius-lg: 20px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --tabbar-h: calc(62px + var(--safe-bottom));
    --nav-w: 0px;
    --ctl-h: 44px; /* a finger */
    --gutter: 14px;
    --font: 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, 'SF Pro Text', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: ui-monospace, 'Cascadia Mono', 'SF Mono', Menlo, Consolas, monospace;
    --ease: cubic-bezier(.2, .7, .2, 1);
    --spring: cubic-bezier(.22, 1, .36, 1);
    --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 24%, transparent);
    color-scheme: light;
  }
  :root[data-theme="dark"] {
    --teal: #5CC3CE;
    --bg: #100E0C; --ink: #F3EFEA; --muted: #A59D95; --line: #322D28; --on-ink: #15120F;
    --brand: #E5483C; --brand-soft: #3A1B18; --brand-ink: #FF8A7E;
    --accent: #F3EFEA; --accent-soft: #26211D; --accent-2: #FFFFFF; --accent-line: #473F38;
    --warn: #F0B35B; --warn-bg: #33250F; --warn-line: #5A4219; --warn-text: #F0B35B; --danger: #FF8D82; --danger-bg: #3A1816; --danger-line: #5E2A26;
    --ok: #6FD095; --ok-bg: #112A1B; --ok-line: #1F4A31; --info: #7DB7EA; --info-bg: #12263A;
    --surface: #1A1714; --surface-2: #211D19; --line-2: #28231F; --hover: #2B2622;
    --glass: rgba(26,23,20,.92); --glass-solid: rgba(26,23,20,.98); --glass-line: rgba(255,255,255,.08);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.5); --shadow-md: 0 2px 4px rgba(0,0,0,.3), 0 10px 28px rgba(0,0,0,.45); --shadow-lg: 0 30px 70px rgba(0,0,0,.65);
    color-scheme: dark;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --teal: #5CC3CE;
      --bg: #100E0C; --ink: #F3EFEA; --muted: #A59D95; --line: #322D28; --on-ink: #15120F;
      --brand: #E5483C; --brand-soft: #3A1B18; --brand-ink: #FF8A7E;
      --accent: #F3EFEA; --accent-soft: #26211D; --accent-2: #FFFFFF; --accent-line: #473F38;
      --warn: #F0B35B; --warn-bg: #33250F; --warn-line: #5A4219; --warn-text: #F0B35B; --danger: #FF8D82; --danger-bg: #3A1816; --danger-line: #5E2A26;
      --ok: #6FD095; --ok-bg: #112A1B; --ok-line: #1F4A31; --info: #7DB7EA; --info-bg: #12263A;
      --surface: #1A1714; --surface-2: #211D19; --line-2: #28231F; --hover: #2B2622;
      --glass: rgba(26,23,20,.92); --glass-solid: rgba(26,23,20,.98); --glass-line: rgba(255,255,255,.08);
      --shadow-sm: 0 1px 2px rgba(0,0,0,.5); --shadow-md: 0 2px 4px rgba(0,0,0,.3), 0 10px 28px rgba(0,0,0,.45); --shadow-lg: 0 30px 70px rgba(0,0,0,.65);
      color-scheme: dark;
    }
  }
  /* a mouse can be precise: denser controls, 40px. A finger needs 44px (the default above). */
  @media (pointer: fine) { :root { --ctl-h: 40px; } }
  /* the installed app on an iPhone / iPad / Android home screen has no browser bars: keep clear of the clock, notch and gesture bar */
  @media all and (display-mode: standalone) {
    :root { --safe-top: max(env(safe-area-inset-top, 0px), 44px); --safe-bottom: max(env(safe-area-inset-bottom, 0px), 24px); }
  }
  .is-standalone { --safe-top: max(env(safe-area-inset-top, 0px), 44px); --safe-bottom: max(env(safe-area-inset-bottom, 0px), 24px); }
  @media (min-width: 600px) { :root { --gutter: 20px; } }
  @media (min-width: 1024px) { :root { --gutter: 28px; } }

  /* ---- base ---- */
  * { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
  html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; font-weight: 600; line-height: 1.45;
    -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
  body { overscroll-behavior-y: none; min-height: 100vh; min-height: 100dvh; }
  /* no scroll bar anywhere (owner, 28 Oct 2026): every page, table, sheet and list still scrolls (wheel, trackpad, touch, keys), nothing is drawn */
  * { scrollbar-width: none; -ms-overflow-style: none; }
  *::-webkit-scrollbar { display: none; width: 0; height: 0; }
  h1, h2, h3 { font-family: var(--font); margin: 0 0 12px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
  h1 { font-size: 24px; } h2 { font-size: 22px; } h3 { font-size: 16px; letter-spacing: -.01em; }
  .mono, .code { font-family: var(--font-mono); }
  .code-tag { font-family: var(--font-mono); font-weight: 600; font-size: .9em; color: var(--ink); background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
  a { color: var(--brand-ink); text-underline-offset: 2px; }
  .num, td.num, th.num, .k-value, .list-meta, input[type=number], .amount, .mono { font-variant-numeric: tabular-nums; }
  ::selection { background: var(--brand-soft); }
  :focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
  .hidden { display: none !important; }
  .muted { color: var(--muted); }
  .small-text { font-size: 13px; }
  .danger-text { color: var(--danger); } .ok-text { color: var(--ok); } .warn-text { color: var(--warn); font-weight: 600; } .neg { color: var(--danger); font-weight: 600; }

  /* the thin bar across the top while the app talks to the server */
  #progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 100; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .2s ease; }
  #progress::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 40%; background: linear-gradient(90deg, transparent, var(--brand), transparent); animation: progress-run 1.1s var(--ease) infinite; will-change: transform; }
  body.is-loading #progress { opacity: 1; }
  @keyframes progress-run { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }

  /* first paint, before any script has run */
  .splash { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--muted); font-weight: 600; letter-spacing: -.01em; }
  .splash-mark { width: 56px; height: 56px; border-radius: 14px; background: var(--brand); animation: splash-pulse 1.4s ease-in-out infinite; }
  @keyframes splash-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.92); opacity: .75; } }

  /* ---- buttons ---- */
  button, .btn, a, select, input, label { touch-action: manipulation; }
  button, .btn { font-family: inherit; font-size: 15px; font-weight: 600; letter-spacing: -.005em; min-height: var(--ctl-h); padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; position: relative; -webkit-user-select: none; user-select: none;
    transition: transform .14s var(--spring), box-shadow .2s ease, background-color .18s ease, border-color .18s ease, color .18s ease; }
  button:hover, .btn:hover { border-color: var(--accent-line); background: var(--hover); }
  button:active:not(:disabled), .btn:active { transform: scale(.975); transition-duration: .08s; }
  button.primary, .btn.primary { background: var(--accent); color: var(--on-ink); border-color: var(--accent); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
  button.primary:hover, .btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); box-shadow: var(--shadow-md); }
  button.brand { background: var(--brand); color: #fff; border-color: var(--brand); }
  button.brand:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
  button.danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
  button.danger:hover { background: var(--danger-bg); border-color: var(--danger); }
  button.ghost { background: transparent; border-color: transparent; }
  button.ghost:hover { background: var(--hover); }
  button.small, .btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
  button.block { width: 100%; }
  button.icon-btn { width: var(--ctl-h); height: var(--ctl-h); padding: 0; border-radius: 999px; flex: 0 0 auto; position: relative; }
  button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
  button.chip { min-height: 38px; border-radius: 999px; padding: 0 14px; font-size: 14px; background: var(--surface); }
  .place-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
  .place-chips button.chip { display: inline-flex; align-items: center; gap: 6px; }
  .place-chips .chip-n { font-size: 12px; opacity: .7; font-weight: 500; }
  .line-focus, .line-focus > td { background: color-mix(in srgb, var(--danger) 14%, transparent) !important; transition: background .4s; }
  .line-focus { outline: 2px solid var(--danger); outline-offset: -2px; }
  button.chip.on { background: var(--accent); color: var(--on-ink); border-color: var(--accent); font-weight: 600; }
  button.back-btn { padding: 0 12px 0 4px; margin: 0 0 4px -4px; color: var(--muted); font-size: 14px; }
  button.back-btn:hover { color: var(--ink); }
  button.is-busy { color: transparent !important; pointer-events: none; }
  button.is-busy > * { opacity: 0; }
  button.is-busy::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--ink); animation: spin .7s linear infinite; }
  button.primary.is-busy::after { border-color: rgba(255,255,255,.35); border-top-color: var(--on-ink); }
  @keyframes spin { to { transform: rotate(360deg); } }
  .link-btn { background: none; border: 0; padding: 0; min-height: 0; color: var(--brand-ink); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
  .link-btn:hover { background: none; }

  /* ---- fields ---- */
  input, select, textarea { font-family: inherit; font-size: 16px; /* 16px: iPhones zoom the page when a smaller field is tapped */ min-height: var(--ctl-h); padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); width: 100%;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease; }
  @media (pointer: fine) { input, select, textarea { font-size: 14.5px; } }
  select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23857d75' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; }
  textarea { padding: 10px 12px; min-height: 84px; line-height: 1.4; resize: vertical; }
  input:hover, select:hover, textarea:hover { border-color: var(--accent-line); }
  input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); background-color: var(--surface); }
  input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); opacity: .8; }
  input::placeholder, textarea::placeholder { color: #9a928a; }
  input[type=search] { -webkit-appearance: none; appearance: none; padding-left: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23857d75' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: left 12px center; background-size: 16px 16px; }
  input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; height: 22px; width: 22px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23857d75' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3C/svg%3E");
    background-size: 14px 14px; background-position: center; background-repeat: no-repeat; cursor: pointer; opacity: .7; padding: 4px; }
  input[type=search]::-webkit-search-cancel-button:hover { opacity: 1; }
  input[type=checkbox], input[type=radio] { accent-color: var(--ink); }
  input[type=number] { -moz-appearance: textfield; }
  input.check { width: 18px; height: 18px; min-height: 0; accent-color: var(--ink); padding: 0; }
  .check-row { display: flex; gap: 8px; align-items: center; margin: 10px 0 0; font-size: 14px; color: var(--ink); cursor: pointer; }
  label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
  .field { margin-bottom: 14px; }
  .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
  .input-wrap { position: relative; }
  .input-wrap input.with-toggle { padding-right: 46px; }
  .input-toggle { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 10px; color: var(--muted); }
  .static-value { padding: 10px 0; font-weight: 600; }
  .form-msg { margin-top: 10px; font-size: 13px; min-height: 18px; }
  .form-msg.warn { color: var(--warn); } .form-msg.danger { color: var(--danger); }
  /* an on / off switch made from a checkbox */
  input.switch { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; min-height: 0; padding: 0; border-radius: 999px; background: var(--accent-line); border: 1px solid transparent; position: relative; cursor: pointer; flex: none; transition: background .15s; }
  input.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .18s var(--spring); }
  input.switch:checked { background: var(--brand); }
  input.switch:checked::after { transform: translateX(18px); }

  /* ---- surfaces ---- */
  .card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow-sm); min-width: 0; }
  .card.flush { padding: 0; overflow: hidden; }
  .card.compact { padding: 12px; }
  .card.warn { background: var(--warn-bg); border-color: var(--warn-line); }
  .card.ok { background: var(--ok-bg); border-color: var(--ok-line); }
  .card.danger { background: var(--danger-bg); border-color: var(--danger-line); }
  .card.accent { border-color: var(--accent-line); box-shadow: inset 3px 0 0 var(--brand), var(--shadow-sm); }
  button.card { width: 100%; text-align: left; display: block; height: auto; font-weight: 600; white-space: normal; }
  button.card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-md); background: var(--surface); }
  .section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 20px 2px 10px; }
  .card > .section-title:first-child { margin-top: 0; }
  .row { display: flex; gap: 12px; flex-wrap: wrap; }
  .row > * { flex: 1; min-width: 140px; }
  .row.tight { gap: 8px; } .row.tight > * { flex: 0 0 auto; min-width: 0; }
  .row.filters { align-items: flex-start; }
  .filter-go { align-self: flex-end; margin-bottom: 14px; flex: 0 0 auto; min-width: 0; }
  .between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
  .pad { padding: 8px 4px; }
  .grid { display: grid; gap: 12px; margin-bottom: 12px; }
  .banner { display: flex; gap: 10px; align-items: flex-start; border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; background: var(--surface); border: 1px solid var(--line-2); }
  .banner > .icon { margin-top: 1px; }
  .banner.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
  .banner.danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
  .banner.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }

  /* page heading */
  .page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 18px; }
  .page-title { min-width: 0; flex: 1 1 240px; }
  .page-title h2, .content h2 { margin: 0; font-size: clamp(22px, 3.2vw, 30px); font-weight: 700; letter-spacing: -.026em; line-height: 1.12; }
  .page-sub { color: var(--muted); font-size: 14px; line-height: 1.45; margin-top: 4px; max-width: 62ch; }
  .page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
  .hello { margin-bottom: 14px; } .hello h2 { margin-bottom: 2px; }
  .list-meta { font-size: 13px; color: var(--muted); margin: 2px 2px 10px; }
  .list-line { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
  .list-line:last-child { border-bottom: 0; }

  /* pills and badges */
  .pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .01em; line-height: 1.6; white-space: nowrap; background: var(--line-2); color: var(--muted); }
  .pill.pending { background: var(--warn-bg); color: var(--warn); }
  .pill.approved, .pill.ok { background: var(--ok-bg); color: var(--ok); }
  .pill.rejected, .pill.danger { background: var(--danger-bg); color: var(--danger); }
  .pill.info { background: var(--info-bg); color: var(--info); }
  .badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; line-height: 1; box-shadow: 0 0 0 2px var(--surface); }

  /* KPI tiles */
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
  .kpi-grid.compact { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .kpi { background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; padding: 16px 18px; position: relative; box-shadow: var(--shadow-sm); min-width: 0; }
  .kpi .k-icon { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--ink); }
  .kpi .k-icon .icon { width: 18px; height: 18px; }
  .kpi .k-label { font-size: 13px; color: var(--muted); padding-right: 40px; }
  .kpi .k-value { font-size: 26px; font-weight: 700; margin-top: 4px; overflow-wrap: anywhere; letter-spacing: -.02em; line-height: 1.15; }
  .kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
  .kpi.accent { border-color: var(--brand); } .kpi.accent .k-value { color: var(--brand-ink); } .kpi.accent .k-icon { background: var(--brand-soft); color: var(--brand-ink); }
  .kpi.warn { border-color: var(--warn-line); background: var(--warn-bg); } .kpi.warn .k-value { color: var(--warn); } .kpi.warn .k-icon { background: rgba(143,74,6,.12); color: var(--warn); }
  .kpi.danger { border-color: var(--danger-line); background: var(--danger-bg); } .kpi.danger .k-value { color: var(--danger); } .kpi.danger .k-icon { background: rgba(152,24,15,.12); color: var(--danger); }
  .kpi.ok .k-value { color: var(--ok); } .kpi.ok .k-icon { background: var(--ok-bg); color: var(--ok); }
  .kpi.info .k-icon { background: var(--info-bg); color: var(--info); }
  .clickable { cursor: pointer; transition: transform .2s var(--spring), box-shadow .2s var(--spring), border-color .15s ease; }
  .share { height: 8px; background: var(--accent-soft); border-radius: 999px; overflow: hidden; margin-top: 12px; }
  @media (hover: hover) {
    button.card:hover, .kpi.clickable:hover, .tile:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--accent-line); }
  }

  /* home tiles */
  
  .tile { display: flex !important; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 4px; padding: 16px !important; min-height: 116px; margin: 0 !important; text-align: left; }
  .entry-card { padding: 12px 14px !important; }

  /* icons and the logo */
  .icon { width: 20px; height: 20px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .icon-lg { width: 36px; height: 36px; stroke-width: 1.4; }
  img.logo { display: block; object-fit: contain; flex: 0 0 auto; border-radius: 8px; background: #fff; }

  /* ---- tables, and the cards they become on a phone ---- */
  .table-wrap { overflow-x: auto; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-2); margin-bottom: 14px; -webkit-overflow-scrolling: touch; }
  table { width: 100%; border-collapse: collapse; }
  th, td { text-align: left; padding: 12px 14px; font-size: 14.5px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
  th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; background: var(--surface); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
  tbody tr:last-child td { border-bottom: 0; }
  tbody tr { transition: background-color .12s ease; }
  tbody tr:hover { background: var(--surface-2); }
  td.num, th.num { text-align: right; }
  .rcards { margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; }
  .rcard { background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow-sm); }
  .rcard-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0; font-size: 14px; border-bottom: 1px dashed var(--line-2); }
  .rcard-row:last-child { border-bottom: 0; padding-top: 8px; }
  .rcard-row .rk { color: var(--muted); font-size: 12px; flex: 0 0 auto; }
  .rcard-row .rv { text-align: right; min-width: 0; word-break: break-word; }
  .rcard-row.rcard-primary { display: block; padding: 2px 0 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line-2); font-size: 15px; font-weight: 600; }
  .rcard-row.rcard-primary .rk { display: none; }
  .rcard-row.rcard-primary .rv { text-align: left; }
  .rcard-row .rv .item-cell { justify-content: flex-end; text-align: right; }
  .rcard-row.rcard-primary .rv .item-cell { justify-content: flex-start; text-align: left; }
  .rcard-row.rcard-actions { border-bottom: 0; border-top: 1px solid var(--line-2); margin-top: 6px; padding-top: 10px; justify-content: flex-end; }
  .rcard-row.rcard-actions .rk { display: none; }
  .rcard-row.rcard-actions .rv { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; width: 100%; }
  /* a computer window made narrow after the page drew: the table folds into cards on its own */
  @media (max-width: 720px) {
    .table-wrap:has(td[data-label]) { background: transparent; border: 0; box-shadow: none; overflow: visible; }
    .table-wrap:has(td[data-label]) thead { display: none; }
    .table-wrap:has(td[data-label]) table, .table-wrap:has(td[data-label]) tbody, .table-wrap:has(td[data-label]) tr, .table-wrap:has(td[data-label]) td { display: block; width: 100%; }
    .table-wrap:has(td[data-label]) tr { background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; padding: 10px 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
    .table-wrap:has(td[data-label]) td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line-2); text-align: right; }
    .table-wrap:has(td[data-label]) td:last-child { border-bottom: 0; }
    .table-wrap:has(td[data-label]) td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: 0 0 auto; }
    .table-wrap:has(td[data-label]) td:first-child { font-weight: 600; text-align: left; justify-content: flex-start; }
    .table-wrap:has(td[data-label]) td:first-child::before { display: none; }
  }
  /* a table wider than its place on any screen folds into the same cards (owner, 10 Nov 2026: no sideways scrolling anywhere; fitTable in JsCore.html) */
  .table-wrap.fold { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .table-wrap.fold thead { display: none; }
  .table-wrap.fold table, .table-wrap.fold tbody, .table-wrap.fold tr, .table-wrap.fold td { display: block; width: 100%; }
  .table-wrap.fold tr { background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; padding: 10px 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
  .table-wrap.fold td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line-2); text-align: right; }
  .table-wrap.fold td:last-child { border-bottom: 0; }
  .table-wrap.fold td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: 0 0 auto; }
  .table-wrap.fold td:first-child { font-weight: 600; text-align: left; justify-content: flex-start; }
  .table-wrap.fold td:first-child::before { display: none; }
  .table-wrap.fold tr.row-more-tr { padding: 0; border: 0; box-shadow: none; background: transparent; }

  /* skeletons and empty states */
  .skel { background: linear-gradient(90deg, var(--line-2) 25%, var(--hover) 37%, var(--line-2) 63%); background-size: 400% 100%; animation: skel-shine 1.4s ease infinite; border-radius: var(--radius-sm); }
  @keyframes skel-shine { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
  .skel-line { height: 14px; margin: 8px 0; }
  .skel-row { display: flex; gap: 14px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line-2); }
  .skel-row:last-child { border-bottom: 0; }
  .empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }
  .empty-icon { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--accent-soft); color: var(--ink); display: flex; align-items: center; justify-content: center; }
  .empty-icon .icon-lg { width: 30px; height: 30px; }
  .empty-state .empty-title { color: var(--ink); font-weight: 600; font-size: 16px; margin-bottom: 4px; }
  .empty-state .empty-sub { font-size: 14px; max-width: 360px; margin: 0 auto; }
  .empty-state button { margin-top: 14px; }

  /* ---- dialogs and sheets ---- */
  .backdrop { position: fixed; inset: 0; background: rgba(21,18,15,.4); -webkit-backdrop-filter: blur(6px) saturate(140%); backdrop-filter: blur(6px) saturate(140%); z-index: 50; display: flex; align-items: flex-start; justify-content: center;
    padding: 8vh 16px 16px; overflow-y: auto; animation: fade-in .15s ease; overscroll-behavior: contain; }
  .backdrop.photo-view { align-items: center; background: rgba(0,0,0,.9); }
  .photo-view img { max-width: 95vw; max-height: 90vh; border-radius: 8px; }
  @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
  .modal-card { width: 100%; max-width: 500px; background: var(--surface); border: 1px solid var(--glass-line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 22px; margin: auto; animation: pop-in .26s var(--spring); overscroll-behavior: contain; }
  .modal-card.wide { max-width: 720px; }
  @keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
  .modal-card h3 { font-size: 18px; margin-bottom: 14px; }
  .modal-body { font-size: 15px; line-height: 1.5; }
  .modal-actions { margin-top: 18px; justify-content: flex-end; }
  /* a sheet opens from the right (from the bottom on a phone) and closes back to the same side */
  .backdrop.sheet-wrap { padding: 0; align-items: stretch; justify-content: flex-end; }
  .sheet { width: min(580px, 100vw); background: var(--surface); box-shadow: var(--shadow-lg); border-radius: 20px 0 0 20px; padding: 20px 22px calc(20px + var(--safe-bottom)); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    animation: sheet-in .34s var(--spring); display: flex; flex-direction: column; }
  .sheet.wide { width: min(780px, 100vw); }
  .sheet.closing { animation: sheet-out .2s var(--ease) forwards; }
  @keyframes sheet-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes sheet-out { to { transform: translateX(40px); opacity: 0; } }
  .sheet > .modal-actions:last-child { position: sticky; bottom: calc(-20px - var(--safe-bottom)); z-index: 2; margin: 18px -22px calc(-20px - var(--safe-bottom)); padding: 12px 22px calc(12px + var(--safe-bottom)); background: var(--glass-solid); border-top: 1px solid var(--line-2); }
  @media (max-width: 720px) {
    .backdrop { padding: 6vh 12px 12px; }
    .modal-card { padding: 18px; border-radius: 22px; }
    .backdrop.sheet-wrap { align-items: flex-end; justify-content: stretch; }
    .sheet { width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: 22px 22px 0 0; animation-name: sheet-up; }
    .sheet.closing { animation-name: sheet-down; }
    .sheet::before { content: ''; display: block; width: 38px; height: 4px; border-radius: 2px; background: var(--accent-line); margin: -8px auto 14px; flex-shrink: 0; }
    @keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
    @keyframes sheet-down { to { transform: translateY(40px); opacity: 0; } }
  }
  .photo-thumb { width: 64px; height: 64px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); overflow: hidden; cursor: pointer; flex: 0 0 auto; }
  .photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
  .item-thumb { border-radius: 8px; border: 1px solid var(--line); object-fit: cover; background: var(--bg); cursor: zoom-in; vertical-align: middle; margin-right: 8px; flex: none; }
  .item-thumb.missing { visibility: hidden; }
  .thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
  .alias-line { font-size: 12px; color: var(--brand-ink); font-weight: 600; }
  .item-cell { display: flex; align-items: center; gap: 10px; min-width: 0; } .item-cell .item-thumb { margin-right: 0; }
  .thumb-strip { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: inherit; } .thumb-strip .item-thumb { margin-right: 0; }
  .chips { gap: 8px; }

  /* connectivity badge */
  .conn-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: var(--ok); background: var(--ok-bg); border-radius: 999px; padding: 3px 9px 3px 7px; white-space: nowrap; }
  .conn-badge .conn-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--ok); flex: 0 0 auto; }
  .conn-badge.offline { color: var(--danger); background: var(--danger-bg); }
  .conn-badge.offline .conn-dot { background: var(--danger); animation: conn-pulse 1.2s ease-in-out infinite; }
  @keyframes conn-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
  @media (max-width: 720px) { .conn-badge .conn-label { display: none; } .conn-badge { padding: 5px; } }
  .outbox-badge { display: none; align-items: center; gap: 4px; border: 0; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; background: var(--warn-bg); color: var(--warn); cursor: pointer; min-height: 0; }
  .outbox-badge.failed { background: var(--danger-bg); color: var(--danger); }
  .outbox-badge .icon { width: 14px; height: 14px; }

  /* toast */
  .toast { position: fixed; bottom: calc(24px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--on-ink); padding: 12px 18px 12px 14px; border-radius: 14px; z-index: 70; box-shadow: var(--shadow-lg);
    max-width: min(92vw, 520px); font-size: 14px; display: flex; gap: 10px; align-items: flex-start; transition: opacity .2s ease, transform .25s var(--spring); }
  .toast .icon { margin-top: 1px; color: #6FD095; }
  :root[data-theme="dark"] .toast .icon { color: #1B6B3A; }
  .toast.error { background: var(--danger); color: #fff; } .toast.error .icon { color: #fff; }
  .toast.hidden { opacity: 0; transform: translateX(-50%) translateY(12px); pointer-events: none; display: flex !important; }
  @media (max-width: 599.98px) { body.has-tabbar .toast { bottom: calc(var(--tabbar-h) + 14px); } }

  /* search palette (Ctrl K) */
  .cmdk { width: 100%; max-width: 640px; background: var(--surface); border: 1px solid var(--glass-line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; max-height: 72vh; margin: 0 auto; animation: pop-in .2s var(--spring); }
  .cmdk-input-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 18px; border-bottom: 1px solid var(--line-2); color: var(--muted); }
  .cmdk-input-row input { border: 0; padding: 0; box-shadow: none !important; background: transparent !important; }
  .cmdk-results { overflow-y: auto; padding: 8px; overscroll-behavior: contain; }
  .cmdk-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; justify-content: flex-start; padding: 10px 12px; border: 0; background: none; border-radius: 12px; min-height: 44px; font-size: 14px; white-space: normal; font-weight: 600; }
  .cmdk-item:hover, .cmdk-item.on { background: var(--accent-soft); }
  .cmdk-item .icon { color: var(--muted); }
  .cmdk-item .trail { margin-left: auto; width: 16px; height: 16px; }
  .cmdk-empty { padding: 24px 16px; text-align: center; color: var(--muted); font-size: 13px; }

  /* segmented control (the tabs inside a page): a sliding highlight, scrolls sideways when the labels do not fit */
  .seg { position: relative; display: inline-grid; grid-template-columns: repeat(var(--seg-n, 2), 1fr); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 3px; margin: 0 0 14px; min-width: 240px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg:has(.seg-thumb) { overflow: hidden; grid-template-columns: repeat(var(--seg-n, 2), minmax(0, 1fr)); }
  .seg-thumb { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / var(--seg-n, 2)); background: var(--surface); border-radius: 11px; box-shadow: 0 1px 3px rgba(0,0,0,.22), 0 0 0 .5px var(--line-2); transition: transform .32s cubic-bezier(.22, 1.2, .36, 1); }
  .seg > button, .seg-btn { position: relative; z-index: 1; background: none; border: 0; min-height: 38px; padding: 0 14px; font-weight: 600; font-size: 14px; color: var(--muted); border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; transition: color .18s ease; }
  .seg > button:hover, .seg-btn:hover { background: none; }
  .seg > button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.18); }
  .seg-btn[aria-selected="true"] { color: var(--ink); }
  .seg:has(.seg-thumb) .seg-btn { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .seg-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
  @media (max-width: 480px) { .seg { min-width: 0; width: 100%; } .seg-btn { padding: 0 10px; font-size: 13px; } }
  @media (max-width: 380px) { .seg:has(.seg-thumb) .seg-btn { padding: 0 6px; font-size: 12.5px; gap: 4px; } }

  /* ---- sign-in ---- */
  .auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(340px, 5fr) minmax(380px, 6fr); }
  .auth-brand { background: #15120F; color: #fff; padding: 56px; display: flex; align-items: center; position: relative; overflow: hidden; }
  .auth-brand::before { content: ''; position: absolute; inset: -20%; background: repeating-linear-gradient(115deg, transparent 0 56px, rgba(255,255,255,.04) 56px 58px, transparent 58px 120px, rgba(255,255,255,.03) 120px 150px); }
  .auth-brand::after { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; right: -200px; bottom: -220px; background: radial-gradient(circle, rgba(216,58,47,.45), transparent 65%); }
  .auth-brand-inner { position: relative; max-width: 420px; z-index: 1; }
  .brand-row { display: flex; align-items: center; gap: 14px; margin-bottom: 44px; }
  .brand-name { font-weight: 700; font-size: 20px; letter-spacing: -.02em; line-height: 1.15; }
  .brand-name small { display: block; font-weight: 600; font-size: 12px; opacity: .7; letter-spacing: 0; }
  .auth-brand h1 { font-size: 36px; line-height: 1.12; margin-bottom: 26px; }
  .auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
  .auth-points li { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.88); font-size: 15px; }
  .auth-points .icon { padding: 8px; width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.1); }
  .auth-panel { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
  .auth-card { width: 100%; max-width: 400px; }
  .auth-card h2 { font-size: 28px; margin-bottom: 4px; }
  .auth-sub { margin-bottom: 22px; }
  .auth-mobile-brand { display: none; align-items: center; gap: 12px; margin-bottom: 26px; font-size: 18px; }
  .auth-mobile-brand.show { display: flex; }
  .auth-single { grid-template-columns: 1fr; }
  .form-narrow { max-width: 460px; }
  @media (max-width: 860px) {
    .auth { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-mobile-brand { display: flex; }
    .auth-panel { align-items: flex-start; padding: calc(8vh + var(--safe-top)) max(20px, var(--safe-left)) 24px max(20px, var(--safe-right)); }
  }

  /* ==========================================================================================================================================
     the shell: top bar + one of three navigations (tab bar / rail / sidebar) + the page
     ========================================================================================================================================== */
  .layout { display: flex; min-height: 100vh; min-height: 100dvh; }
  .main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .sidebar { width: var(--nav-w); flex: 0 0 var(--nav-w); border-right: 1px solid var(--glass-line); background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
    position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; z-index: 25; padding-left: var(--safe-left); }
  .party-cases { display: inline-block; margin-left: 8px; padding: 1px 9px; border-radius: 999px; background: var(--brand, #cc5f0a); color: #fff; font-size: 12.5px; font-weight: 800; white-space: nowrap; vertical-align: middle; }
  .party-tags { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
  .party-tags .party-cases { margin-left: 0; }
  .nav-toggle { flex: 0 0 auto; }
  .sidebar-brand .nav-toggle { margin-left: auto; }
  .nt-top { display: none; }
  @media (min-width: 600px) {
    .nt-top { display: inline-flex; }
    .layout.nav-collapsed .sidebar { display: none; }
    .layout:not(.nav-collapsed) .nt-top { display: none; } /* the panel is open: its own button closes it (full width); on the rail the top one stays */
  }
  @media (min-width: 600px) and (max-width: 1023.98px) { .layout:not(.nav-collapsed) .nt-top { display: inline-flex; } .sidebar-brand .nav-toggle { display: none; } }
  @media (max-width: 599.98px) { .nav-toggle { display: none !important; } }
  .sidebar-brand { display: flex; align-items: center; gap: 12px; padding: calc(16px + var(--safe-top) * 0) 16px 12px; min-height: 64px; }
  .sidebar-brand strong { display: block; font-size: 15px; line-height: 1.15; letter-spacing: -.02em; }
  .brand-sub { display: block; font-size: 11px; color: var(--muted); }
  .nav-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 12px 12px; }
  .nav-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 16px 10px 6px; }
  .navlink { display: flex; justify-content: flex-start; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 9px 12px; border-radius: 12px; border: 0; background: none; color: var(--ink); font-size: 14px; font-weight: 600; min-height: 42px; margin-bottom: 2px; cursor: pointer; position: relative; transition: background-color .18s ease, color .18s ease; }
  .navlink .nl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .navlink .nl-short { display: none; }
  .navlink svg { color: var(--muted); transition: color .15s ease; }
  .navlink:hover { background: var(--hover); border-color: transparent; }
  .navlink.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
  .navlink.active svg { color: var(--brand-ink); }
  .navlink.active::before { content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand); }
  .navlink .badge { position: static; margin-left: auto; box-shadow: none; }
  .navlink .trail { margin-left: auto; color: var(--muted); width: 16px; height: 16px; }
  .navlink.big { font-size: 15px; min-height: 52px; }
  .navlink.danger-text, .navlink.danger-text svg { color: var(--danger); }
  .nav-main { padding-top: 6px; } .nav-main .navlink { font-weight: 600; }
  .nav-more-btn { margin-top: 6px; border-top: 1px solid var(--line-2); border-radius: 0 0 12px 12px; padding-top: 10px; }
  .nav-more-btn .trail { transition: transform .15s; margin-left: auto; }
  .nav-more-btn.open .trail { transform: rotate(90deg); }
  .rail-more { display: none; }
  .sidebar-user { border-top: 1px solid var(--glass-line); padding: 12px 14px calc(12px + var(--safe-bottom) * 0); display: flex; flex-direction: column; gap: 10px; }
  .su-actions { display: flex; gap: 8px; }
  .su-actions button { flex: 1; padding: 0 8px; }
  .su-actions .icon { width: 15px; height: 15px; }
  .user-card { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
  .user-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
  .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: var(--on-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: 0 0 auto; }
  .nav-list { padding: 6px; }

  /* the top bar: padding is written side by side, never as one shorthand, so the safe area above (Dynamic Island, camera hole, clock) is always kept clear */
  .top { display: flex; align-items: center; gap: 12px; padding-top: calc(8px + var(--safe-top)); padding-bottom: 8px; padding-left: max(var(--gutter), var(--safe-left)); padding-right: max(var(--gutter), var(--safe-right));
    border-bottom: 1px solid transparent; box-shadow: 0 1px 0 var(--glass-line); background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
    position: sticky; top: 0; z-index: 20; min-height: calc(56px + var(--safe-top)); }
  .top-title { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 1 auto; }
  .top-title h1 { margin: 0; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .search-pill { flex: 1 1 360px; max-width: 480px; margin: 0 auto; justify-content: flex-start; font-weight: 600; background: var(--surface); color: var(--muted); border-radius: 999px; min-height: 40px; padding: 0 14px; }
  .search-pill span { flex: 1; text-align: left; }
  .search-pill kbd { font-family: var(--font-mono); font-size: 11px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; background: var(--surface-2); color: var(--muted); }
  .top-right { display: flex; align-items: center; gap: 4px; margin-left: auto; }
  .theme-toggle { width: 38px; height: 38px; min-height: 0; }
  .content { flex: 1; min-width: 0; padding-top: 20px; padding-bottom: 56px; padding-left: max(var(--gutter), var(--safe-left)); padding-right: max(var(--gutter), var(--safe-right)); width: 100%; max-width: 1440px; margin: 0 auto; outline: none;
    view-transition-name: page; container-type: inline-size; container-name: page; }
  .content.enter { animation: page-in .1s ease-out; }
  @keyframes page-in { from { opacity: .6; transform: translateY(3px); } to { opacity: 1; transform: none; } }
  @supports (view-transition-name: none) { .content.enter { animation: none; } }
  ::view-transition-old(page) { animation: vt-out .04s ease-out both; }
  ::view-transition-new(page) { animation: vt-in .09s cubic-bezier(0, 0, 0.2, 1) both; }
  @keyframes vt-out { to { opacity: 0; } }
  @keyframes vt-in { from { opacity: 0; transform: translateY(3px); } }
  .sticky-actions { margin: 4px 0 12px; position: sticky; bottom: calc(10px + var(--safe-bottom)); z-index: 11; padding: 10px; border-radius: 18px; background: var(--glass); -webkit-backdrop-filter: blur(18px) saturate(180%); backdrop-filter: blur(18px) saturate(180%); border: 1px solid var(--line-2); box-shadow: 0 8px 28px rgba(0,0,0,.18); }
  .narrow-only { display: none; }
  .search-icon { display: none; }

  /* tab bar: compact widths (phones, a Fold folded) */
  .tabbar { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 -1px 0 var(--glass-line); padding-top: 6px; padding-left: max(6px, var(--safe-left)); padding-right: max(6px, var(--safe-right)); padding-bottom: calc(6px + var(--safe-bottom)); }
  .tabbar-inner { display: flex; width: 100%; max-width: 640px; margin: 0 auto; }
  .tabbar button { flex: 1; min-width: 0; min-height: 50px; flex-direction: column; gap: 3px; font-size: 11px; font-weight: 600; border: 0; background: none; color: var(--muted); border-radius: 14px; padding: 2px 2px; position: relative; justify-content: center; }
  .tabbar button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .tabbar button:hover { background: none; }
  .tabbar button.active { color: var(--brand-ink); }
  .tabbar button.active::before { content: ''; position: absolute; top: -6px; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
  .tabbar button .icon { width: 22px; height: 22px; transition: transform .22s var(--spring); }
  .tabbar button.active .icon { transform: translateY(-1px) scale(1.08); }
  .tabbar button:active .icon { transform: scale(.9); }
  .tabbar .badge { right: calc(50% - 22px); top: 2px; }

  @media (max-width: 599.98px) {
    .sidebar { display: none; }
    .tabbar { display: block; }
    .narrow-only { display: inline-flex; }
    .top { gap: 8px; }
    .top-title h1 { font-size: 17px; }
    .content { padding-top: 14px; padding-bottom: calc(var(--tabbar-h) + 36px); }
    .sticky-actions { bottom: calc(var(--tabbar-h) + 8px); margin: 12px -4px 0; border-radius: 16px; }
  }
  @media (max-width: 719.98px) { .search-pill { display: none; } .search-icon { display: inline-flex; } }
  /* an ultra-narrow cover screen (Galaxy Z Fold folded is about 344px, a few phones are 320px) */
  @media (max-width: 380px) {
    :root { --gutter: 10px; }
    .top { gap: 4px; padding-top: calc(6px + var(--safe-top)); padding-bottom: 6px; min-height: calc(50px + var(--safe-top)); }
    .top-title { gap: 6px; } .top-title h1 { font-size: 15.5px; }
    .top-right { gap: 0; } .top-right .icon-btn, .top-right button { width: 34px; height: 34px; min-height: 34px; padding: 0; }
    .tabbar button { font-size: 10.5px; }
    .card { padding: 14px; }
  }

  /* navigation rail: medium widths (a Fold unfolded, tablets, a narrow window) - icons with a one-word label, the rest behind More */
  @media (min-width: 600px) and (max-width: 1023.98px) {
    :root { --nav-w: 84px; }
    .sidebar-brand { padding: 14px 0 8px; justify-content: center; min-height: 0; }
    .sidebar-brand > div { display: none; }
    .nav-scroll { padding: 4px 8px 8px; }
    .sidebar .navlink { flex-direction: column; justify-content: center; gap: 3px; padding: 8px 2px; min-height: 58px; font-size: 11px; font-weight: 600; text-align: center; margin-bottom: 4px; border-radius: 14px; }
    .sidebar .navlink .nl { display: none; }
    .sidebar .navlink .nl-short { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.15; }
    .sidebar .navlink.active::before { left: -8px; top: 14px; bottom: 14px; }
    .sidebar .navlink .badge { position: absolute; top: 4px; right: 14px; margin: 0; box-shadow: 0 0 0 2px var(--bg); }
    .nav-title, .nav-more, .nav-more-btn, .nav-main + .nav-more-btn { display: none !important; }
    .rail-more { display: flex; }
    .sidebar-user { padding: 10px 6px; align-items: center; }
    .sidebar-user .user-meta, .sidebar-user .su-actions { display: none; }
    .search-icon { display: none; } .search-pill { display: flex; flex: 1 1 200px; }
  }
  @media (min-width: 600px) and (max-width: 719.98px) { .search-pill { display: none; } .search-icon { display: inline-flex; } }

  /* sidebar: expanded widths (Windows, landscape tablets) */
  @media (min-width: 1024px) {
    :root { --nav-w: 272px; }
    .top { padding-top: 10px; padding-bottom: 10px; min-height: 64px; }
    .top-title h1 { font-size: 20px; }
    .content { padding-top: 26px; }
  }
  @media (min-width: 1600px) { .content { max-width: 1560px; } }
  /* a dual-screen foldable (one hinge, two panels): the page stays on the first panel */
  @media (horizontal-viewport-segments: 2) {
    .layout { max-width: env(viewport-segment-width 0 0, 100%); }
  }
  @media (prefers-reduced-transparency: reduce) {
    .top, .sidebar, .tabbar, .sticky-actions { background: var(--glass-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
    .backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; }
  }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .top, .sidebar, .tabbar, .sticky-actions { background: var(--glass-solid); } }

  /* the page area decides the layout of what is inside it (sidebar open or not, folded or unfolded) */
  @container page (max-width: 560px) {
    .kpi-grid, .kpi-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi .k-value { font-size: 21px; }
    .kpi .k-icon { width: 30px; height: 30px; }
    .page-actions { width: 100%; }
    .page-actions > button, .page-actions > .btn { flex: 1 1 auto; }
  }
  @container page (max-width: 340px) { .kpi-grid, .kpi-grid.compact { grid-template-columns: 1fr; } }

  /* phones: calmer spacing, search bars stay in view */
  @media (max-width: 720px) {
    .row:not(.tight):not(.filters) > * { min-width: 120px; }
    .toolbar input[type=search], .toolbar select { flex: 1 1 100%; }
    .card { padding: 16px; border-radius: 16px; }
    .card:has(> .toolbar):not(:has(> .toolbar select)) { position: sticky; top: calc(54px + var(--safe-top, 0px)); z-index: 12; background: var(--surface); margin-bottom: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
    button.small, .btn.small { min-height: 38px; padding: 0 14px; }
    button.small::after, .btn.small::after { content: ''; position: absolute; inset: -3px; }
  }
  @media (max-width: 480px) { .row:not(.tight):not(.filters) > * { flex: 1 1 100%; } .row.filters > * { flex: 1 1 100%; } .filter-go { margin-bottom: 0; } .kpi .k-value { font-size: 22px; } }
  @media (max-width: 640px) { h1 { font-size: 22px; } h2 { font-size: 20px; } .auth-card h2 { font-size: 24px; } }

  /* the line a mouse user expects: pointer feedback only where there is a pointer */
  @media (hover: none) { button:hover, .btn:hover { background: var(--surface); border-color: var(--line); } button.primary:hover { background: var(--accent); border-color: var(--accent); } button.ghost:hover, .navlink:hover { background: transparent; } }

  /* long lists render only what is on screen */
  .item-list > .item-row:nth-child(n+12) { content-visibility: auto; contain-intrinsic-size: auto none auto 68px; }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { scroll-behavior: auto !important; }
    ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
    .content.enter, .modal-card, .cmdk { animation-name: fade-in; }
    .sheet { animation-name: fade-in !important; } .sheet.closing { animation-name: fade-out !important; }
    @keyframes fade-out { to { opacity: 0; } }
    #progress::before { animation: none; transform: none; width: 100%; opacity: .6; }
    .splash-mark, .skel, .conn-badge.offline .conn-dot, .voice-dot { animation: none; }
    button.is-busy::after { animation: none; opacity: .5; }
    button:active:not(:disabled), .item-row:active { transform: none; }
    button.card:hover, .kpi.clickable:hover, .tile:hover, .tabbar button.active .icon { transform: none; }
    .seg-thumb, .item-row { transition: none; }
  }
  /* Windows high-contrast themes and "increase contrast" settings */
  @media (forced-colors: active) {
    button, .btn, input, select, textarea, .card, .kpi, .table-wrap { border: 1px solid ButtonText; }
    .navlink.active, .tabbar button.active { outline: 2px solid Highlight; }
    .badge, .pill { border: 1px solid ButtonText; }
  }
  @media (prefers-contrast: more) { :root { --line: #9b948c; --line-2: #b8b1a8; --muted: #4a443e; } :root[data-theme="dark"] { --line: #6b645c; --line-2: #55504a; --muted: #cfc8c0; } }
  @media print { .sidebar, .top, .tabbar, .toast, #progress, .sticky-actions { display: none !important; } .content { padding: 0; max-width: none; } .card, .table-wrap { box-shadow: none; } body { background: #fff; color: #000; } }

  /* ---- line editor, search results, the bill grid and its phone cards ---- */
  /* line editor (transfers), stepper, search results */
  .lines { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); margin-bottom: 8px; overflow: hidden; }
  .lines-empty { padding: 22px 16px; color: var(--muted); text-align: center; font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
  .lines-empty .icon-lg { color: var(--line); }
  .results { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); max-height: 300px; overflow: auto; margin-top: 6px; box-shadow: var(--shadow-md); }
  .results button { display: flex; width: 100%; text-align: left; justify-content: flex-start; align-items: baseline; gap: 8px; border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0; background: none; padding: 10px 12px; min-height: 44px; white-space: normal; font-weight: 600; }
  .results button:last-child { border-bottom: 0; }
  .results button:hover, .results button.on { background: var(--accent-soft); }
  .results .res-name { flex: 1; min-width: 0; font-size: 14px; }
  .thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
  .chips { gap: 8px; }

  /* the bill grid: a spreadsheet on a computer, one card per line on a phone */
  .bill-search { position: relative; margin-bottom: 10px; }
  .bill-search .results { position: absolute; left: 0; right: 0; z-index: 20; top: 100%; }
  .bill-grid-wrap { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); overflow-x: auto; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
  table.bill-grid { min-width: 900px; width: 100%; }
  .bill-grid th { padding: 8px 4px; font-size: 10px; white-space: nowrap; }
  .bill-grid td { padding: 4px 4px; vertical-align: middle; border-bottom: 1px solid var(--line-2); }
  .bill-grid td.ro { padding: 4px 4px; text-align: right; color: var(--muted); white-space: nowrap; font-size: 12.5px; }
  .bill-grid td.item { min-width: 160px; font-size: 12.5px; }
  .bill-grid td.item .code-tag { margin-right: 4px; }
  .brand-tag { display: inline-block; margin-left: 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; vertical-align: 1px; }
  .bill-grid input { min-height: 34px; padding: 0 8px; font-size: 14px; border-radius: 8px; text-align: right; min-width: 0; width: 72px; padding: 0 6px; }
  .bill-grid input[aria-label=mm], .bill-grid input[aria-label=pcs] { width: 48px; }
  .bill-grid input[aria-label=widthM], .bill-grid input[aria-label=heightM] { width: 60px; }
  .bill-grid td[colspan] input { width: 100%; max-width: 200px; display: block; margin-left: auto; }
  .bill-grid select { min-height: 34px; font-size: 13px; padding: 0 28px 0 8px; border-radius: 8px; }
  .bill-grid td.amt { text-align: right; font-weight: 600; white-space: nowrap; padding-right: 10px; }
  .bill-grid tr.flash td { animation: cell-flash .7s var(--ease); }
  .bill-grid td.rate-on input { border-color: var(--ink); background: var(--accent-soft); }
  .bill-grid td.pc-line .tag { font-size: 11px; color: var(--brand-ink); font-weight: 600; }
  @keyframes cell-flash { 0% { background: var(--brand-soft); } 100% { background: transparent; } }
  .bill-cards { display: none; }
  .bill-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
  .bill-card .bc-head { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; font-size: 14px; }
  .bill-card .bc-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px 6px; }
  .bill-card .bc-grid > div { grid-column: span 4; min-width: 0; }
  .bill-card .bc-grid > div:nth-child(-n+4) { grid-column: span 3; }
  .bill-card .bc-grid > div:nth-child(2):last-child { grid-column: span 6; }
  .bill-card .bc-grid label { font-size: 11px; margin-bottom: 2px; }
  .bill-card .bc-grid input, .bill-card .bc-grid select { min-height: 40px; padding: 0 8px; width: 100%; }
  .bill-card .bc-foot { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); }
  .bill-card .bc-foot strong { font-size: 17px; color: var(--ink); }
  .bill-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
  .bill-side { position: sticky; top: 74px; }
  .totals-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px; box-shadow: var(--shadow-sm); }
  .totals-panel .t-row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 14px; }
  .totals-panel .t-row.sub { color: var(--muted); font-size: 13px; }
  .totals-panel .t-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--line); }
  .totals-panel .t-total strong { font-size: 28px; letter-spacing: -.02em; color: var(--brand-ink); }
  .t-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0; }
  .t-inputs .field { margin: 0; } .t-inputs input { min-height: 38px; text-align: right; }
  .meter { height: 10px; border-radius: 999px; background: var(--line-2); overflow: hidden; margin: 6px 0 4px; }
  .meter span { display: block; height: 100%; background: var(--ink); border-radius: 999px; transition: width .35s var(--ease), background-color .2s; }
  .meter.over span { background: var(--danger); }
  .meter-text { display: flex; justify-content: space-between; font-size: 13px; }
  .meter-text.over { color: var(--danger); font-weight: 600; }
  @media (max-width: 1500px) { .bill-layout { grid-template-columns: minmax(0, 1fr); } .bill-side { position: static; } .bill-side .t-inputs { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }
  @media (max-width: 900px) { .bill-grid-wrap { display: none; } .bill-cards { display: block; } }

  /* ---- morning count, voice notes, pickers ---- */
  /* morning verification / counting */
  .verify-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
  .verify-row:last-child { border-bottom: 0; }
  .verify-row .v-name { flex: 1 1 220px; min-width: 0; font-size: 14px; }
  .verify-row .v-count { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
  .count-input { width: 104px; text-align: center; font-size: 18px; font-weight: 600; font-family: var(--font-mono); }
  .moved-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
  .popup-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--ink); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
  .popup-line { padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
  .popup-line:last-child { border-bottom: 0; }
  .voice-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
  .line-remark { display: flex; align-items: center; gap: 4px; font-size: 12px; font-style: italic; color: var(--warn-text, #B7791F); margin-top: 3px; }
  .line-remark .icon { width: 12px; height: 12px; }
  .td-clear { display: flex; align-items: center; gap: 8px; color: var(--ok); font-size: 14px; margin: 0 0 16px; }
  .td-clear .icon { width: 16px; height: 16px; }
  
  .cs-list { max-height: 52vh; overflow: auto; border: 1px solid var(--line-2); border-radius: 12px; padding: 0 10px; margin: 8px 0 12px; }
  .cs-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
  .cs-row:last-child { border-bottom: 0; }
  .cs-name { flex: 1 1 220px; min-width: 0; font-size: 13px; }
  .cs-field { display: flex; flex-direction: column; gap: 2px; }
  .cs-pcs { width: 90px; }
  .slot-input { width: 64px; text-transform: uppercase; text-align: center; }
  .voice-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); margin-top: 2px; }
  .voice-tag .icon { width: 13px; height: 13px; }
  .voice-player { width: 100%; }
  /* the conversation of an entry: bubbles, mine on the right */
  .chat-thread { display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow-y: auto; padding: 2px 0 6px; }
  .chat-msg { max-width: 88%; padding: 8px 12px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface-2); font-size: 14px; overflow-wrap: anywhere; }
  .chat-msg.mine { align-self: flex-end; background: var(--brand-soft); border-color: transparent; border-bottom-right-radius: 4px; }
  .chat-msg.theirs { align-self: flex-start; border-bottom-left-radius: 4px; }
  .chat-msg.cancelled { opacity: .55; }
  .chat-who { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
  .chat-about { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 8px; background: var(--accent-soft); color: var(--fg); font-size: 11px; font-weight: 600; }
  .chat-text { white-space: pre-wrap; }
  .chat-foot { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
  .chat-foot:empty { display: none; }
  .chat-compose { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; border-top: 1px solid var(--line-2); padding-top: 10px; }
  .chat-input { flex: 1 1 auto; min-width: 0; resize: vertical; min-height: var(--ctl-h, 40px); }
  .chat-cancel { font-size: 11.5px; }
  /* a list entry as a card on a phone: number, tag, name, details, PDF */
  .doc-list { display: flex; flex-direction: column; gap: 10px; }
  .doc-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; padding: 14px; display: flex; gap: 12px; align-items: center; cursor: pointer; }
  .dc-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
  .dc-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .dc-no { font-size: 19px; letter-spacing: .01em; }
  .dc-tag { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 8px; background: var(--accent-soft); color: var(--fg); }
  .dc-tag.info { background: var(--info-bg, #E8F0FB); color: var(--info, #1A4E8C); }
  .dc-tag.ok { background: var(--ok-bg); color: var(--ok); }
  .dc-tag.pending { background: var(--warn-bg, #FFF1D6); color: var(--warn-text, #7A4A00); }
  .dc-tag.danger { background: var(--danger-bg); color: var(--danger); }
  .dc-sub { font-size: 13px; color: var(--muted); }
  .dc-title { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
  .dc-meta { font-size: 13px; color: var(--muted); }
  /* a broken item's own decision: the tick, who decided, and its buttons; green when approved, red when rejected */
  .tick-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
  .tick-row.ok { background: var(--ok-bg); }
  .tick-row.no { background: var(--danger-bg); }
  /* the cases of the left side and the right side, at the end of a loading list */
  .side-cases { margin-top: 14px; display: grid; gap: 8px; }
  .sc-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
  .sc-cell { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border: 1px solid var(--line); border-left: 5px solid var(--accent, #CC6109); border-radius: 12px; background: var(--surface-2); }
  .sc-cell.sc-muted { border-left-color: var(--muted); }
  .sc-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
  .sc-val { font-size: 26px; line-height: 1.1; }
  .sc-total { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--warn-bg); border: 1px solid var(--warn-line); font-weight: 700; }
  .sc-total strong { font-size: 24px; }
  /* tap a row: its items open under it; Edit and the X at the end of the row */
  .x-btn { color: var(--danger); }
  .doc-wrap { display: flex; flex-direction: column; gap: 0; }
  .doc-wrap > .doc-card.row-expanded { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .doc-wrap > .row-more { background: var(--surface); border: 1px solid var(--line-2); border-top: 0; border-radius: 0 0 16px 16px; padding: 12px 14px; }
  .rcard .row-more, .td-card .row-more, .item-row .row-more { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); cursor: default; }
  tr.row-expanded > td { background: var(--hover); }
  tr.row-more-tr > td { padding: 0; }
  tr.row-more-tr .row-more { padding: 12px 16px; background: var(--surface-2); cursor: default; }
  .more-items { display: grid; gap: 0; }
  .more-line { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
  .more-line:last-child { border-bottom: 0; }
  .more-line .ml-qty { flex: none; white-space: nowrap; }
  .more-btns { margin-top: 10px; }
  .more-note { margin-bottom: 6px; }
  .trip-card .trip-more { margin-top: 10px; cursor: default; }
  .trip-head .row.tight { flex-wrap: nowrap; align-items: center; }
  /* Edit beside PDF, the customer ticks in "Add from load list", the cancel under a customer */
  .row-btns { flex-wrap: nowrap; align-items: center; justify-content: flex-end; }
  .doc-card > .row-btns { flex: none; }
  .party-pick-row { display: flex; align-items: center; gap: 8px; }
  .party-pick-row .party-box { flex: 1 1 auto; min-width: 0; }
  .party-tick { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; cursor: pointer; }
  .party-tick input { width: 26px; height: 26px; min-height: 26px; accent-color: var(--ok); }
  .pick-bar { position: sticky; top: 0; z-index: 2; padding: 8px 0; margin-bottom: 8px; background: var(--surface); align-items: center; }
  .pick-sum { font-size: 13.5px; font-weight: 800; padding: 6px 12px; }
  .pick-sum[hidden] { display: none !important; }
  .party-actions { margin-top: 8px; }
  /* stock differences (morning count) */
  .sd-lines { display: grid; gap: 8px; margin-top: 10px; }
  .sd-line { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
  label.sd-line { cursor: pointer; }
  .sd-line input[type=checkbox] { width: 22px; height: 22px; min-height: 22px; margin: 11px 0; flex: none; accent-color: var(--ok); }
  .sd-line .grow, .sd-trip .grow, .sd-fix .grow { flex: 1 1 auto; min-width: 0; }
  .sd-nums { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 6px 0 2px; font-size: 13.5px; color: var(--muted); }
  .sd-nums strong { color: var(--text); }
  .sd-trip { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
  .sd-act { align-items: flex-end; flex-wrap: wrap; }
  .sd-lbl { display: grid; gap: 2px; font-size: 12px; color: var(--muted); }
  .sd-qty { width: 96px; }
  .sd-adjust { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
  .sd-adjust select, .sd-adjust input[type=text] { flex: 1 1 140px; min-width: 0; }
  .sd-fix { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
  .sd-fix.undone > .grow > span { text-decoration: line-through; color: var(--muted); }
  .sd-big { font-size: 34px; font-weight: 800; line-height: 1; padding: 6px 14px; border-radius: 14px; }
  .sd-big.neg { color: var(--danger); background: var(--danger-bg); }
  .sd-big.pos { color: var(--ok); background: var(--ok-bg); }
  .sd-line1 { margin: 10px 0 12px; font-size: 16px; font-weight: 600; }
  /* stock journal (owner, 24 Nov 2026) */
  .jn-row { display: block; width: 100%; text-align: left; cursor: pointer; }
  .jn-sides { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 2px; font-weight: 600; }
  .jn-line, .jn-below { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .jn-line:last-child, .jn-below:last-child { border-bottom: 0; }
  .jn-line .grow, .jn-below .grow { flex: 1 1 220px; min-width: 0; }
  .jn-lines:empty { display: none; }
  .jn-head > * { min-width: 0; max-width: 100%; }
  .jn-head select { max-width: 100%; }
  .jn-totals { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 4px 0 8px; }
  .jn-totals[hidden] { display: none; }
  .sd-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px; }
  .sd-choice { min-width: 0; overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; min-height: 64px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); }
  .sd-choice strong { font-size: 16px; }
  .sd-choice span { font-size: 13px; color: var(--muted); }
  .sd-choice.on { border-color: var(--ink); background: var(--surface-2); }
  .sr-choices .sd-choice { min-height: 56px; padding: 10px 12px; white-space: normal; }
  .sr-choices .sd-choice > * { white-space: normal; max-width: 100%; }
  .sr-choices .sd-choice strong { font-size: 15px; }
  .sd-reported { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
  .sd-panel { margin-top: 10px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
  .sd-done-title { margin-top: 14px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
  .sd-close { margin-top: 12px; }
  .place-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
  .loading-rate { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); max-width: 400px; }
  .loading-rate .lr-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
  .loading-rate .lr-field input { width: 120px; }
  .loading-rate .lr-note { flex-basis: 100%; }
  .city-tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 0.78em; font-weight: 700; letter-spacing: .02em; vertical-align: middle; }
  .te-fixed-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px 16px; margin-top: 10px; }
  .te-fixed-diesel { margin-bottom: 4px; }
  .te-other { display: flex; flex-direction: column; gap: 6px; }
  .td-customers .chip-static .city-tag { margin-left: 8px; }
  /* the page area takes focus when a page opens or is scrolled; it must not show a ring around the whole page (owner, 27 Oct 2026) */
  #content:focus, #content:focus-visible, .main:focus, .main:focus-visible, [tabindex="-1"]:not(.clickable):focus-visible { outline: none; box-shadow: none; }
  .table-wrap:focus-visible, .nav-scroll:focus-visible, .cmdk-results:focus-visible, .rcards:focus-visible { outline: none; }
  .kb-list { display: grid; gap: 8px; margin: 10px 0 4px; }
  .kb-row { display: grid; grid-template-columns: 11rem 1fr; gap: 12px; align-items: center; }
  .kb-row kbd { justify-self: start; padding: 3px 9px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 8px; background: var(--surface-2); font: 600 12.5px/1.4 inherit; }
  .rate-list { display: flex; flex-direction: column; gap: 10px; }
  .rate-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 230px); gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
  .rate-row .rr-name { font-size: 17px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
  .rate-row .rr-name .hint { font-size: 13px; font-weight: 500; margin-top: 2px; }
  .rate-row .rr-in { display: flex; flex-direction: column; gap: 6px; }
  .rate-row .rate-in { font-size: 22px; font-weight: 700; min-height: 52px; text-align: right; }
  @media (max-width: 560px) { .rate-row { grid-template-columns: 1fr; } }
  /* a ring shows only while someone is moving with the keyboard (Tab, j / k); with the mouse, scrolling or clicking no card or box gets a red outline, and a card under the pointer is not tinted (owner, 27 Oct 2026) */
  html:not(.kbd-nav) :focus-visible { outline: none !important; }
  .sd-warn { display: flex; gap: 6px; align-items: center; margin-top: 4px; font-size: 12.5px; font-weight: 600; color: var(--danger); }
  .sd-warn .icon { width: 14px; height: 14px; }
  .tick-row > .row { margin-left: auto; }
  .tick-mark { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 13px; }
  .tick-mark .icon { width: 16px; height: 16px; }
  .tick-mark.ok { color: var(--ok); }
  .tick-mark.no { color: var(--danger); }
  .tick-mark.wait { color: var(--muted); }
  /* trip details: kilometres, diesel lines with the mileage band, other expenses, the total (design 26 Oct 2026) */
  .te-title { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .te-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
  .te-grid2.te-kind { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
  .te-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 8px; }
  .te-grid2 .field, .te-grid3 .field { min-width: 0; }
  .te-dist { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; margin: 2px 0 10px; }
  .te-dist span { font-size: 13px; font-weight: 700; color: var(--muted); }
  .te-dist strong { font-size: 24px; letter-spacing: -0.01em; }
  .te-dist.bad strong { font-size: 15px; color: var(--danger); }
  .te-line { border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px 6px; margin-bottom: 10px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
  .te-line .field { margin-bottom: 0; }
  .te-remark { width: 100%; box-sizing: border-box; background: var(--surface-2); }
  .te-line > input { width: 100%; box-sizing: border-box; }
  .te-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
  .te-calc { font-size: 13px; color: var(--muted); }
  .te-calc strong { color: var(--fg); }
  .te-calc:empty { display: none; }
  .te-add { border-style: dashed !important; }
  .te-band { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--fg); color: var(--bg); border-radius: 12px; padding: 12px 14px; }
  .te-band > div { display: flex; flex-direction: column; gap: 2px; }
  .te-band > div span { font-size: 11px; font-weight: 700; opacity: .75; text-transform: uppercase; letter-spacing: .04em; }
  .te-band strong { font-size: 26px; letter-spacing: -0.01em; }
  .te-band-note { font-size: 12px; opacity: .75; text-align: right; }
  .te-sum { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; font-size: 14px; }
  .te-sum .muted { color: var(--muted); }
  .te-sum-total { border-top: 1px solid var(--line-2); padding-top: 8px; margin-top: 2px; align-items: baseline; }
  .te-sum-total span { font-weight: 800; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
  .te-sum-total strong { font-size: 24px; }
  /* trip details lists: a card per trip with its four figures, an expense as a two-line row */
  .td-cards { display: flex; flex-direction: column; gap: 10px; }
  .td-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; }
  .td-card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .td-card-top strong:first-child { font-size: 18px; }
  .td-card-top .grow { flex: 1 1 auto; }
  .td-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .td-figs span { display: flex; flex-direction: column; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
  .td-figs strong { font-size: 15px; color: var(--fg); text-transform: none; }
  .td-card .hint { font-size: 12px; }
  .ex-row { background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; cursor: pointer; margin-bottom: 8px; }
  .ex-row strong { font-size: 15px; }
  .ex-row .hint { font-size: 12px; }
  .ex-band { background: var(--fg); color: var(--bg); border-radius: 14px; padding: 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin-bottom: 8px; }
  .ex-band span { display: flex; flex-direction: column; font-size: 10px; font-weight: 700; opacity: .8; text-transform: uppercase; }
  .ex-band strong { font-size: 17px; opacity: 1; }
  .chat-day { align-self: center; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--accent-soft); border-radius: 10px; padding: 3px 10px; }
  .te-day { font-weight: 700; font-size: 13px; margin: 14px 0 6px; display: flex; justify-content: space-between; gap: 8px; }
  .voice-player-bar { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 20px; padding: 6px 14px; margin-top: 8px; width: 100%; box-sizing: border-box; }
  .voice-btn-play { width: 32px; height: 32px; border-radius: 50%; background: var(--fg); color: var(--bg); border: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; padding: 0; transition: transform 0.1s ease; }
  .voice-btn-play .icon { width: 16px; height: 16px; stroke: currentColor; fill: currentColor; }
  .voice-btn-play:active { transform: scale(0.92); }
  .voice-bar-track-wrap { flex: 1; height: 24px; display: flex; align-items: center; cursor: pointer; position: relative; touch-action: none; outline: none; }
  .voice-bar-track { width: 100%; height: 6px; background: var(--line-2); border-radius: 3px; position: relative; overflow: visible; }
  .voice-bar-fill { height: 100%; width: 0%; background: var(--fg); border-radius: 3px; pointer-events: none; }
  .voice-bar-thumb { position: absolute; top: 50%; left: 0%; width: 12px; height: 12px; border-radius: 50%; background: var(--fg); transform: translate(-50%, -50%); pointer-events: none; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
  .voice-bar-time { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); flex: none; min-width: 65px; text-align: right; }
  .voice-player audio { width: 100%; margin-top: 8px; }
  .voice-rec { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 18px 0 8px; }
  .voice-timer { font-size: 34px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
  .voice-dot { width: 14px; height: 14px; border-radius: 50%; background: #E5484D; animation: voicePulse 1.2s ease-in-out infinite; }
  @keyframes voicePulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
  @media (prefers-reduced-motion: reduce) { .voice-dot { animation: none; } }
  .pick-line { display: block; width: 100%; text-align: left; background: var(--surface-2, transparent); color: inherit; font: inherit; border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; margin: 0 0 8px; cursor: pointer; }
  .pick-line:last-child { border-bottom: 1px solid var(--line-2); }
  .pick-line:active { transform: scale(0.99); }
  .pick-line .between { gap: 10px; }
  .pick-line .hint { margin-top: 4px; }

  /* ---- bill form steps, total bar, loading checklist, smart count ---- */
  /* bill form: numbered steps, the bar that always shows the total, and the broken-on-arrival rows */
  .step-title { display: flex; align-items: center; gap: 8px; }
  .step-no { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0; flex: none; }
  .total-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px 12px; box-shadow: var(--shadow-md); }
  .total-bar .row { margin: 0; flex-wrap: wrap; }
  .total-bar button { min-width: 140px !important; box-shadow: none; }
  .tb-sum { display: flex; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; font-size: 13px; }
  .tb-total { font-size: 19px; }
  .check-line { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; margin-bottom: 6px; }
  .check-line input { width: auto; margin: 0; }
  /* rate boxes (owner, 10 Nov 2026): a locked one is red, the one that can be typed in is green */
  .bill-grid td.rate-locked input, .bc-grid .rate-locked input { opacity: 1; color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); cursor: not-allowed; }
  .bill-grid td.rate-open input, .bc-grid .rate-open input { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); font-weight: 600; }
  .rate-row .rate-in { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); font-weight: 600; }
  .bc-grid .rate-locked label { color: var(--danger); }
  .bc-grid .rate-open label { color: var(--ok); }
  /* ---- Items and stock (owner, 11 Nov 2026): filters down the side with counts, bold item cards, the stock bar, the in / out story */
  .iv-top { margin: 0 0 12px; }
  .iv-search-wrap { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1.5px solid var(--line-2); border-radius: 14px; padding: 0 14px; box-shadow: var(--shadow-sm); }
  .iv-search-wrap:focus-within { border-color: var(--ink); }
  .iv-search-wrap .icon { color: var(--muted); flex: 0 0 auto; }
  .iv-search-wrap .iv-search { border: 0; background: transparent; box-shadow: none; min-height: 50px; font-size: 16.5px; font-weight: 600; flex: 1 1 auto; min-width: 0; padding: 0; }
  .iv-search-wrap .iv-search:focus { outline: none; box-shadow: none; }
  .iv-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; } /* the filters stay hidden until the Filters button is tapped (owner, 14 Nov 2026) */
  .iv-layout > .iv-facets { display: none; }
  .iv-facets { position: sticky; top: 12px; max-height: calc(100dvh - 24px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 4px 14px 14px; }
  .iv-facets-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0 6px; border-bottom: 1px solid var(--line); font-size: 15px; }
  .iv-facet { padding: 12px 0 10px; border-bottom: 1px solid var(--line); }
  .iv-facet:last-child { border-bottom: 0; }
  .iv-facet > select { width: 100%; }
  .iv-facet-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-weight: 800; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 6px; }
  .iv-facet-title .link-btn { font-size: 12.5px; text-transform: none; letter-spacing: 0; font-weight: 600; }
  .iv-facet-find { width: 100%; margin: 0 0 6px; min-height: 36px; font-size: 14px; }
  .iv-facet-list { display: flex; flex-direction: column; gap: 1px; }
  .iv-opt { display: flex; align-items: center; gap: 9px; min-height: 34px; padding: 3px 6px; margin: 0 -6px; border-radius: 8px; cursor: pointer; font-size: 14.5px; font-weight: 600; }
  .iv-opt:hover { background: var(--hover); }
  .iv-opt.on { background: var(--ok-bg); }
  .iv-opt .check { margin: 0; flex: 0 0 auto; }
  .iv-opt-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
  .iv-n { flex: 0 0 auto; font-size: 12.5px; font-weight: 700; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums; }
  .iv-opt[hidden] { display: none; }
  .iv-facets [hidden], .iv-facets-in [hidden] { display: none !important; }
  .iv-more { margin-top: 4px; font-size: 13.5px; font-weight: 700; min-height: 44px; }
  .iv-facet-title .link-btn { min-height: 44px; }
  @media (pointer: fine) { .iv-fig, .iv-more, .iv-facet-title .link-btn { min-height: 32px; } }
  .iv-results { min-width: 0; }
  .iv-bar-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
  .iv-meta { font-size: 15px; color: var(--muted); }
  .iv-meta strong { color: var(--ink); font-weight: 800; }
  .iv-tools { align-items: center; flex-wrap: nowrap; }
  .iv-sort { min-width: 0; max-width: 230px; font-weight: 700; }
  .iv-filter-btn { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
  .iv-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
  .iv-chips:empty { display: none; }
  .iv-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 2px 6px 2px 12px; border-radius: 999px; border: 1px solid var(--ok); background: var(--ok-bg); color: var(--ink); font-weight: 700; font-size: 13.5px; cursor: pointer; }
  .iv-chip .hint { font-weight: 600; }
  .iv-chip .iv-x { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 16px; line-height: 1; }
  .iv-chip:hover .iv-x { background: var(--surface); }
  .iv-list { display: flex; flex-direction: column; gap: 10px; }
  .iv-card { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 52px 14px 14px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
  .iv-card:hover { border-color: var(--ink); }
  .iv-card:focus-visible { outline: 3px solid var(--ring, var(--ok)); outline-offset: 2px; }
  .iv-card.is-last { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok-bg); }
  .iv-card.is-zero .iv-media, .iv-card.is-zero .iv-name { opacity: .7; }
  .iv-media img, .iv-media .thumb { border-radius: 12px; }
  .iv-main { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
  .iv-name { font-size: 17px; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; overflow-wrap: anywhere; }
  .iv-alias { font-size: 13px; color: var(--muted); margin-top: -4px; }
  .iv-tags { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
  .iv-tag { display: inline-flex; align-items: center; gap: 3px; min-height: 24px; padding: 1px 9px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
  .iv-tag .icon { width: 13px; height: 13px; }
  .iv-tag.rack { background: var(--warn-bg); border-color: var(--warn-line, var(--warn)); }
  .iv-tag.rack.none { background: var(--surface-2); border-color: var(--line-2); color: var(--muted); }
  .iv-tag.brand { background: var(--ink); color: var(--surface); border-color: var(--ink); }
  .iv-tag.soft { color: var(--muted); font-weight: 600; }
  .iv-tag.warn { background: var(--danger-bg); border-color: var(--danger-line, var(--danger)); color: var(--danger); }
  .iv-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line-2); gap: 2px; margin-top: 2px; }
  .iv-bar.empty, .iv-bar.loading { height: 22px; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--muted); }
  .iv-bar.over { border-color: var(--danger); }
  .iv-seg { display: block; height: 100%; cursor: pointer; }
  .iv-seg.free { background: var(--ok); }
  .iv-seg.booked { background: var(--warn); }
  .iv-seg.held { background: var(--danger); }
  .iv-figs { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
  .iv-fig { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; padding: 2px 0; min-height: 44px; font-size: 13.5px; color: var(--muted); font-weight: 600; cursor: pointer; }
  .iv-fig strong { color: var(--ink); font-weight: 800; font-size: 14.5px; }
  .iv-fig i { width: 10px; height: 10px; border-radius: 3px; background: var(--muted); }
  .iv-fig.free i { background: var(--ok); }
  .iv-fig.booked i { background: var(--warn); }
  .iv-fig.held i, .iv-fig.short i { background: var(--danger); }
  .iv-fig.short strong { color: var(--danger); }
  .iv-fig.inquiry { cursor: default; }
  .iv-fig.inquiry strong { color: var(--muted); }
  .iv-fig.wh { cursor: default; font-family: var(--font-mono); font-size: 12.5px; }
  .iv-fig:hover:not(.wh):not(.inquiry) strong { text-decoration: underline; }
  .iv-side { text-align: right; min-width: 92px; max-width: 230px; }
  .iv-big { font-size: 30px; font-weight: 900; line-height: 1; letter-spacing: -.02em; color: var(--ok); font-variant-numeric: tabular-nums; }
  .iv-big.zero { color: var(--muted); }
  .iv-big.neg { color: var(--danger); }
  .iv-big-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 3px; }
  .iv-sub { font-size: 13px; font-weight: 600; color: var(--ink); margin-top: 6px; }
  .iv-low { display: inline-block; margin-top: 6px; padding: 1px 8px; border-radius: 6px; background: var(--danger-bg); color: var(--danger); font-size: 12px; font-weight: 800; }
  .iv-edit { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; }
  .iv-edit:hover { border-color: var(--ink); }
  .iv-more-wrap { margin-top: 4px; }
  @container page (max-width: 899px) {
    .iv-layout { grid-template-columns: minmax(0, 1fr); }
    .iv-facets { display: none; }
    .iv-filter-btn { display: inline-flex; }
  }
  @container page (max-width: 560px) {
    .iv-card { grid-template-columns: auto minmax(0, 1fr); padding: 12px 48px 12px 12px; gap: 10px 12px; }
    .iv-side { grid-column: 1 / -1; max-width: none; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; text-align: left; border-top: 1px solid var(--line); padding-top: 8px; }
    .iv-big { font-size: 24px; }
    .iv-big-label, .iv-sub, .iv-low { margin-top: 0; }
    .iv-name { font-size: 16px; }
    .iv-media img, .iv-media .thumb { width: 48px !important; height: 48px !important; }
    .iv-sort { max-width: 170px; }
  }
  .sheet .iv-facets-in .iv-facets-head { padding-top: 0; }
  /* + New: the choices with their letters */
  .new-menu { display: flex; flex-direction: column; gap: 6px; }
  .new-choice { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; min-height: 54px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); cursor: pointer; color: var(--ink); }
  .new-choice:hover, .new-choice:focus-visible { border-color: var(--ink); background: var(--hover); }
  .new-choice kbd { flex: 0 0 auto; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--ink); color: var(--surface); font-weight: 900; font-family: var(--font-mono); font-size: 15px; }
  .nc-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
  .nc-text strong { font-size: 15.5px; }
  /* one item's in and out */
  .story-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 6px 0 12px; }
  .story-sum .ss { border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
  .story-sum .ss span { display: block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
  .story-sum .ss strong { display: block; font-size: 22px; font-weight: 900; margin-top: 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  .story-sum .ss.in strong { color: var(--ok); }
  .story-sum .ss.out strong { color: var(--danger); }
  .story-tools { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
  .story-pills { display: flex; flex-wrap: wrap; gap: 6px; }
  .story-pill { min-height: 34px; padding: 4px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 700; font-size: 13.5px; cursor: pointer; color: var(--ink); }
  .story-pill.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
  .story-sort { width: auto; max-width: 100%; align-self: flex-start; min-height: 40px; padding: 6px 36px 6px 14px; border-radius: 12px; font-weight: 700; } /* one Sort dropdown, as on a shopping app */
  .story-sort[hidden] { display: none; }
  .bill-files { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
  .bill-file { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); }
  .bill-file .bf-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .story-row.booked .sr-icon { background: var(--warn-bg); color: var(--warn); }
  .story-list { display: flex; flex-direction: column; gap: 6px; }
  .story-row { display: grid; grid-template-columns: auto minmax(0, 1fr) max-content; gap: 12px; align-items: start; justify-content: stretch; white-space: normal; line-height: 1.3; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; }
  button.story-row { cursor: pointer; }
  button.story-row:hover { border-color: var(--ink); }
  .sr-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; }
  .story-row.in .sr-icon { background: var(--ok-bg); color: var(--ok); }
  .story-row.out .sr-icon { background: var(--danger-bg); color: var(--danger); }
  .sr-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
  .sr-main strong { font-size: 15px; }
  .sr-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
  .sr-doc { font-size: 12.5px; font-weight: 800; padding: 1px 8px; border-radius: 6px; background: var(--ink); color: var(--surface); max-width: 100%; overflow-wrap: anywhere; }
  .sr-party { align-self: flex-start; max-width: 100%; font-size: 15.5px; font-weight: 900; color: var(--ink); background: var(--warn-bg); border-left: 3px solid var(--warn); padding: 2px 8px; border-radius: 6px; }
  .sr-tags { display: flex; flex-wrap: wrap; gap: 4px 6px; }
  .sr-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface-2, var(--surface)); }
  .sr-tag .icon, .sr-tag svg { width: 14px; height: 14px; }
  .sr-tag.bad { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }
  .sr-note { font-size: 13px; font-style: italic; color: var(--muted); }
  .sr-meta { font-size: 12.5px; color: var(--muted); font-weight: 600; }
  .sr-detail { font-size: 13.5px; font-weight: 600; }
  .sr-qty { text-align: right; display: flex; flex-direction: column; align-items: flex-end; padding-left: 4px; white-space: nowrap; }
  @media (max-width: 599px) {
    .story-row { grid-template-columns: auto minmax(0, 1fr); gap: 8px 10px; }
    .sr-qty { grid-column: 1 / -1; flex-direction: row; align-items: baseline; justify-content: space-between; border-top: 1px solid var(--line); padding: 6px 0 0; }
  }
  .sr-qty strong { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
  .story-row.in .sr-qty strong { color: var(--ok); }
  .story-row.out .sr-qty strong { color: var(--danger); }
  .open-stock { flex-wrap: wrap; }
  .adj-box { display: flex; gap: 6px; align-items: center; }
  .adj-box .adj-input { flex: 1 1 auto; min-width: 0; }
  .adj-box .adj-flip { flex: 0 0 auto; font-weight: 700; }
  .rate-key { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 12.5px; color: var(--muted); margin: 4px 0 8px; }
  .rate-key span::before { content: ''; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; border: 1px solid; }
  .rate-key .k-open::before { background: var(--ok-bg); border-color: var(--ok); }
  .rate-key .k-locked::before { background: var(--danger-bg); border-color: var(--danger-line); }
  .new-version-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + var(--safe-bottom, 0px)); z-index: 90; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
    max-width: calc(100vw - 32px); padding: 10px 14px; border-radius: 14px; background: var(--surface, #fff); color: var(--ink); border: 1px solid var(--ok); box-shadow: 0 8px 30px rgba(0,0,0,.18); font-size: 14px; }
  table.bill-grid.no-rates { min-width: 0; }
  .warn-text { color: var(--warn); font-weight: 600; }
  /* the loading checklist */
  /* the smart morning count popup: the moved items scroll inside it */
  .smart-list { max-height: 52vh; overflow-y: auto; margin: 10px 0; border: 1px solid var(--line); border-radius: var(--radius-md); }

  /* ---- stock bars, breakage picker, loading-list plan ---- */
  /* free stock beside a quotation line */
  .avail-tag { font-size: 11px; color: var(--muted); margin-top: 4px; }
  /* the stock under every item (owner, 24 Nov 2026): small figures, display only */
  .item-stock.tap { background: none; border: 0; padding: 2px 0; min-height: 0; text-align: left; cursor: pointer; border-radius: 6px; font: inherit; font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: inherit; color: var(--muted); }
  .item-stock.tap:hover, .item-stock.tap:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
  .sdx-title { display: flex; justify-content: space-between; margin: 16px 0 4px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: 12px; color: var(--muted); }
  .sdx-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 0; min-height: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; font-weight: 400; text-transform: none; letter-spacing: 0; }
  .sdx-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .sdx-row .sdx-qty { font-size: 16px; }
  .item-stock { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 4px; font-size: 12px; color: var(--muted); font-weight: 600; line-height: 1.4; }
  .is-fig { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
  .is-fig strong { color: var(--ink); font-weight: 800; }
  .is-fig i { width: 8px; height: 8px; border-radius: 2px; background: var(--muted); }
  .is-fig.free i { background: var(--ok); }
  .is-fig.none i { background: var(--danger); }
  .is-fig.none strong { color: var(--danger); }
  .is-fig.booked i { background: var(--warn); }
  .is-fig.held i { background: var(--danger); }
  .is-fig.pieces i, .is-fig.inquiry i { display: none; }
  .is-fig.total { font-weight: 500; }
  .stock-bar { display: flex; gap: 2px; height: 20px; border-radius: 6px; overflow: hidden; min-width: 180px; max-width: 360px; }
  .sb-seg { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; padding: 0 4px; min-width: 52px; }
  .sb-booked { background: #FCEFD9; color: #7a3d05; }
  .sb-free { background: #E4F2E8; color: #1C6B3A; }
  .sb-none { background: #FBE7E4; color: #A4231A; }
  .sb-foot { font-size: 11px; color: var(--muted); margin-top: 2px; }
  .stock-bar-wrap.over .sb-foot { color: var(--danger); font-weight: 600; }
  .avail-tag.short { color: var(--danger); font-weight: 600; }
  /* breakage sheet picker: the piece and the photos of its break */
  .piece-photos { margin: 4px 0 0 34px; }
  .piece-photos .photo-thumb { width: 54px; height: 54px; }
  /* the owner's loading-list plan */
  
  .bill-grid.no-rates td.item { min-width: 260px; }
  @media (min-width: 901px) { .sticky-total { position: sticky; bottom: 8px; z-index: 15; } }

  /* ---- dues, settings, import, price rows, activity feed, loading list ---- */
  .neg { color: var(--danger); font-weight: 600; }
  .choice-list { display: grid; gap: 8px; }
  .choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
  .choice.on { border-color: var(--ink); background: var(--accent-soft); }
  .choice input { margin-top: 4px; }
  .totals { margin-top: 10px; display: grid; gap: 4px; }

  /* activity feed, loading list, filters */
  .feed { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); margin-bottom: 12px; }
  .toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
  .toolbar input[type=search] { flex: 1 1 220px; min-width: 0; }
  .toolbar select { flex: 0 1 180px; }
  .piece-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-ink); font-size: 12px; font-weight: 600; }
  .danger-text { color: var(--danger); }
  .ok-text { color: var(--ok); }
  .meter-wrap { padding: 2px 0; }
  .ll-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 100px 90px 70px; gap: 8px; padding: 9px 12px; border-top: 1px solid var(--line-2); font-size: 14px; align-items: baseline; }
  .ll-row:first-child { border-top: 0; }
  @media (max-width: 640px) {
    .ll-row { grid-template-columns: 28px minmax(0, 1fr) auto; grid-template-areas: "sl desc desc" ". size qty" ". rack rack"; row-gap: 2px; }
    .ll-sl { grid-area: sl; color: var(--muted); }    .ll-rack { grid-area: rack; color: var(--muted); font-size: 12px; } .ll-rack:not(:empty)::before { content: 'Rack '; }
  }
  .piece-row { align-items: center; margin-bottom: 6px; }
  .piece-row input { min-height: 40px; }

  /* ---- item list and stock metrics ---- */
  .item-list { display: flex; flex-direction: column; gap: 8px; }
  .item-row { background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 10px 12px 9px; cursor: pointer; transition: background .15s, transform .12s; }
  .item-row:focus-visible { outline: 2px solid var(--brand, #E5484D); outline-offset: 2px; }
  .ir-top { display: flex; align-items: center; gap: 9px; min-width: 0; }
  .ir-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; }

  /* Item physical specs & dimensions row */

  /* Item Stock Progress Bar */

  /* Loading shimmer progress bar */
  @keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

  /* Stock Metrics Badges (Rack, Cases, Pcs, SqFt) */

  .ir-meta { margin-top: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .item-row .item-thumb { width: 40px; height: 40px; border-radius: 8px; flex: none; }

  /* ---- hero and to-do list ---- */
  .todo { background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; margin-bottom: 18px; overflow: hidden; }

  /* ---- owner dashboard and charts ---- */
  /* ---- Owner Redesigned Dashboard & Interactive Charts ---- */
  .dash { display: flex; flex-direction: column; gap: 18px; margin-bottom: 24px; padding-bottom: calc(72px + env(safe-area-inset-bottom, 20px)); min-width: 0; }

  /* KPI deck with sparklines - responsive across 320px Fold 5, 884px Fold 5 unfolded, iPad & 1440px Windows */

  
  /* Pipeline funnel */

  
  
  /* Chart cards & containers */

  /* High-density summary stat bar for charts */

  /* Interactive chart cursor & floating tooltip */
  
  /* 2-column grid for charts and watchlists - auto collapses safely on 320px fold */

  /* Donut chart */

  
  /* Horizontal ranking rows */
  
  /* Warehouse cards */

  /* ==========================================================================================================================================
     adjustments that must come after the screen-specific rules above
     ========================================================================================================================================== */
  @media (min-width: 901px) { .sticky-actions button { min-width: 220px; } .sticky-actions button.block { width: auto; } }
  .sticky-actions { margin-bottom: 12px; }

  /* the bill form's side panel stays beside the lines when the page area is wide enough, whatever the window width */
  /* the charges and totals panel always sits BELOW the items (never beside them), on every window size; its boxes spread across the width */
  .bill-layout { grid-template-columns: minmax(0, 1fr) !important; }
  .bill-side { position: static !important; }
  .bill-side .t-inputs { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

  /* items: one item per row on every screen, a comfortable tap on the row */
  .item-row { border-radius: 16px; }

  /* the owner dashboard */
  .dash { gap: 0; margin-bottom: 8px; padding-bottom: 0; }
   .todo { margin-bottom: 16px; }
  
  /* phones: two figures to a row, no little chart (the number is what matters at arm's length) */

  .todo { border-radius: 18px; border-color: var(--line-2); }

  /* a whole list row made from a button may wrap onto more lines (a long vehicle, driver and customer line) */

  /* the on / off switch keeps its size inside a label row; filter bars keep their fields side by side */
  input.switch { width: 44px; height: 26px; min-width: 44px; }
  .check-line input.switch, .check-row input.switch { width: 44px; }
  .toolbar > input, .toolbar > select, .toolbar > .input-wrap { width: auto; }
  .toolbar input[type=date], .toolbar input[type=month] { flex: 0 1 180px; min-width: 150px; }
  @media (max-width: 720px) { .toolbar input[type=date], .toolbar input[type=month] { flex: 1 1 100%; } }
  @media (max-width: 720px) { .toolbar input[type=search], .toolbar select { flex: 1 1 100%; width: 100%; } }

  /* ==========================================================================================================================================
     v6.1 easier to use: less scrolling before the work starts, one clear save bar, compact shortcuts
     ========================================================================================================================================== */
  /* filters that fold away on a phone */
  .filter-panel { margin-top: 10px; }
  .filter-toggle { gap: 6px; }
  .filter-toggle .icon { width: 16px; height: 16px; }
  .filter-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
  .filter-body { margin-top: 10px; }
  .filter-body > .row:first-child { margin-top: 0; }
  @media (min-width: 721px) { .filter-toggle { display: none; } .filter-body.hidden { display: block !important; } .filter-panel { margin-top: 12px; } .filter-body { margin-top: 0; } }
  @media (max-width: 720px) { .card:has(.filter-body:not(.hidden)) { position: static; } }

  @container page (max-width: 560px) {
    /* a long description: two lines, the rest on a tap */
    .page-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
    .page-sub.open { display: block; -webkit-line-clamp: unset; }
    /* the page's buttons: one row that scrolls sideways, the main one first in its own colour, instead of three rows of buttons */
    .page-actions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 4px; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
    .page-actions::-webkit-scrollbar { display: none; }
    .page-actions > *, .page-actions > .row > * { flex: 0 0 auto !important; scroll-snap-align: start; }
    .page-actions > .row { flex-wrap: nowrap; }
    .page-actions button, .page-actions .btn { min-height: 40px; padding: 0 14px; font-size: 14px; }
    .page-head { margin-bottom: 14px; }
  }

  /* the save bar at the bottom of a form: one clean bar, the summary on top and the buttons sharing the width */
  .sticky-actions .total-bar { border: 0; background: none; padding: 0; box-shadow: none; }
  @media (max-width: 720px) {
    .sticky-actions { padding: 10px 12px; }
    .total-bar { gap: 8px; }
    .total-bar .tb-sum { width: 100%; display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
    .total-bar > .row, .sticky-actions > .row { width: 100%; flex-wrap: wrap; }
    .total-bar > .row > button, .sticky-actions > .row > button { flex: 1 1 120px; min-width: 0 !important; }
    .sticky-actions .row > button { white-space: normal; line-height: 1.2; padding-top: 6px; padding-bottom: 6px; text-align: center; }
  }

  /* warehouse shortcuts on a phone: icon and word side by side, so all of them fit on one screen */

  /* a bill without rates has no totals to show: no empty box */
  .totals-panel:has(> div:only-child:empty) { display: none; }
  /* in the sideways button row the main action comes first */
  @container page (max-width: 560px) { .page-actions > .primary, .page-actions > .row > .primary { order: -1; } }

  /* item figures: total, booked, breakage, shortage, available */
  /* a table row or phone card that opens its document */
  tr.row-link { cursor: pointer; }
  tr.row-link:hover td { background: var(--hover); }
  .rcard.row-link { cursor: pointer; }
  .row-link-hint { display: flex; justify-content: flex-end; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 600; color: var(--brand-ink); padding-top: 6px; }
  .row-link-hint .icon { width: 15px; height: 15px; }
  /* a page description keeps a readable width beside the buttons */
  .page-title { flex: 1 1 420px; }
  .sb-held { background: #FBE4E1; color: #98180F; }
  :root[data-theme="dark"] .sb-held { background: #3A1816; color: #FF8D82; }
  .bill-total-row td { border-top: 2px solid var(--line); background: var(--surface-2); font-weight: 700; padding: 10px 8px; }
  .bill-total-row td.num { font-variant-numeric: tabular-nums; }
  /* PDF preview */
  .pdf-preview-box { flex: 1 1 auto; min-height: 60vh; display: flex; flex-direction: column; }
  .pdf-frame { width: 100%; flex: 1 1 auto; min-height: 62vh; height: 70vh; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
  @media (max-width: 720px) { .pdf-frame { height: 64vh; } }
  /* Items: the item looked at last, so the eye finds it again */
  .item-row.is-last { box-shadow: 0 0 0 2px var(--brand) inset; }
  /* phones: the PDF's pages drawn as pictures, one under the other; Zoom + makes them wider and the box scrolls both ways */
  .pdf-preview-box:has(.pdf-pages) { overflow: auto; max-height: 70vh; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2, #e9e9e9); padding: 8px; }
  .pdf-pages { width: 100%; }
  .pdf-canvas { display: block; width: 100%; height: auto; margin: 0 0 10px; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.25); border-radius: 4px; }
  .results .res-stock { margin-left: auto; white-space: nowrap; font-size: 12.5px; flex: 0 0 auto; padding-left: 8px; }
  .results .res-stock strong { font-weight: 700; }
  .cmdk-item .res-stock { margin-left: auto; white-space: nowrap; font-size: 12.5px; padding-left: 8px; flex: 0 0 auto; }
  /* Back in the top bar */
  .top-back { width: 38px; height: 38px; min-height: 0; margin-left: -6px; }
  .top-back.hidden { display: none !important; }
  @media (max-width: 599.98px) { body.has-top-back .top-brand { display: none !important; } }
  /* the item picked with the keyboard */
  .results .res-head { display: flex; gap: 8px; padding: 6px 12px; position: sticky; top: 0; z-index: 1; background: var(--surface-2, var(--surface)); border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted, var(--ink-3)); }
  .results .res-head .rh-name { flex: 1; min-width: 0; padding-left: 40px; }
  .results .res-head .rh-code { width: 0; flex: 0 0 0; visibility: hidden; }
  .results .res-foot { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 7px 12px; border-top: 1px solid var(--line); background: var(--surface-2, var(--surface)); font-size: 12px; color: var(--muted, var(--ink-3)); position: sticky; bottom: 0; }
  .results .res-foot kbd { display: inline-block; padding: 0 5px; margin-right: 2px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; font: inherit; font-size: 11px; font-weight: 700; background: var(--surface); }
  .results button.kb-on, .cmdk-item.kb-on { background: var(--accent-soft); outline: 2px solid var(--brand); outline-offset: -2px; }
  /* places */
  .place-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  @container page (min-width: 760px) { .place-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  .place-card { margin-bottom: 0; }
  .place-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
  .chip-static { font-size: 12.5px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-2); }
  .place-members { max-height: 280px; overflow: auto; border: 1px solid var(--line-2); border-radius: 12px; padding: 4px 10px; margin-top: 8px; }
  .place-member { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
  .place-member:last-child { border-bottom: 0; }
  .place-pick { display: flex; flex-direction: column; gap: 6px; }
  .order-head > * { flex: 1 1 210px; min-width: 0; }
  /* the little up / down arrows on number boxes are gone everywhere (type the number; on a phone the number keyboard opens) */
  input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }
  input[type=number] { -moz-appearance: textfield; appearance: textfield; }
  input, select, textarea, button, td, th { font-weight: 600; }
  th { font-weight: 700; }
  .cases-beside { font-size: 12.5px; white-space: nowrap; color: var(--muted); font-weight: 700; min-width: 0; }
  .party-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); cursor: pointer; font: inherit; color: inherit; }
  .party-box { flex-wrap: wrap; box-sizing: border-box; max-width: 100%; }
  .party-box > div { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
  .party-box:hover { border-color: var(--ink); }
  .party-items[hidden] { display: none; }
  .bill-add-row td { padding: 8px 10px; background: var(--surface); }
  .next-item { min-width: 0; max-width: 100%; }
  .next-item input[type=search] { width: 100%; border-style: dashed; }
  .bill-add-row td { overflow: visible; }
  /* ---- shell polish (shell-agent) ---- */
  html { scrollbar-gutter: auto; }
  body:has(.backdrop) { overflow: hidden; } /* the page behind a dialog, sheet or photo does not scroll */
  .modal-card:focus, .sheet:focus, .cmdk:focus { outline: none; }
  .cmdk-input-row input[type=search]::-webkit-search-cancel-button { display: none; } /* the palette has its own close button */
  .cmdk-input-row input[type=search] { background-image: none; padding-left: 0; }
  .photo-view { position: fixed; }
  .photo-close { position: fixed; top: calc(12px + var(--safe-top)); right: calc(12px + var(--safe-right)); width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; border-color: rgba(255,255,255,.25); }
  .photo-close:hover { background: rgba(0,0,0,.75); }
  .navlink .nl-text { flex: 1; min-width: 0; text-align: left; }
  /* the More page: grouped lists, each row a full-width tap */
  .nav-list .navlink.big { padding: 10px 14px; margin-bottom: 0; border-radius: 0; border-bottom: 1px solid var(--line-2); }
  .nav-list .navlink.big:last-child { border-bottom: 0; }
  .nav-list .navlink.big:hover { background: var(--hover); }
  .nav-list .navlink.big .badge { position: static; margin-left: auto; box-shadow: none; }
  .nav-list .navlink.big .badge + .trail { margin-left: 8px; }
  .card.nav-list { padding: 0; overflow: hidden; }
  .card.user-card-box { padding: 14px 16px; }
  .section-title:first-child { margin-top: 4px; }
  /* any dialog taller than the screen scrolls inside the backdrop, with the actions kept reachable */
  .modal-card .modal-actions { flex-wrap: wrap; }
  @media (max-width: 480px) { .modal-card .modal-actions > button { flex: 1 1 120px; } .modal-card .modal-actions { gap: 8px; } }
  /* the dialogs on the open Fold (and any tablet width): a roomy centre card, not a stretched one */
  @media (min-width: 721px) { .backdrop:not(.sheet-wrap):not(.photo-view) { padding-top: 6vh; } }
  .empty-state button { min-width: 140px; }
  /* focus: the same ring on every control, including the ones that remove the default outline */
  button:focus-visible, .navlink:focus-visible, .seg-btn:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
  .tabbar button:focus-visible { outline-offset: -3px; }
  input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
  .party-name { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; overflow-wrap: anywhere; }
  input, textarea { text-overflow: ellipsis; } /* a long placeholder ends in ... instead of being cut */
  .claim-status { margin-bottom: 6px; } .claim-title { display: block; font-size: 15.5px; line-height: 1.3; }
  /* a status pill on a tinted card keeps its own solid colour, so it never melts into the card */
  .card.danger .pill.rejected, .card.danger .pill.danger { background: var(--danger); color: #fff; }
  :root[data-theme="dark"] .card.danger .pill.rejected, :root[data-theme="dark"] .card.danger .pill.danger { color: #1B0B09; }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card.danger .pill.rejected, :root:not([data-theme="light"]) .card.danger .pill.danger { color: #1B0B09; } }
  .card.warn .pill.pending { background: var(--warn); color: #fff; }
  :root[data-theme="dark"] .card.warn .pill.pending { color: #1F1405; }
  /* form rows: the field's own bottom margin is the vertical gap (no double gap when the fields stack on a phone) */
  .row:has(> .field) { row-gap: 0; }
  @media (max-width: 480px) { .row.filters > .field { flex: 1 1 calc(50% - 6px); min-width: 0; } .row.filters > .field:has(input[type=search]), .row.filters > .field:has(select) { flex-basis: 100%; } }
  /* trips-agent: loading list lines as cards (no sideways scrolling table), sized by the page width */
  
  /* loading-list lines (v5): SL, rack, name, pieces (cases under), slot - one row on a wide page, two rows on a phone / folded Fold */
  .ll-grid { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; min-width: 0; }
  .ll-row { display: grid; gap: 6px 10px; align-items: center; min-width: 0; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface);
    grid-template-columns: 30px 72px minmax(0, 1fr) 96px 150px 44px; grid-template-areas: "sl rack name pcs slot end"; }
  .ll-row > .ll-sl { grid-area: sl; } .ll-row > .ll-rack { grid-area: rack; } .ll-row > .ll-name { grid-area: name; } .ll-row > .ll-pcs { grid-area: pcs; } .ll-row > .ll-slot { grid-area: slot; } .ll-row > .ll-end { grid-area: end; }
  .ll-headrow { border: 0; background: none; padding: 0 10px; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
  .ll-headrow > span:nth-child(1) { grid-area: sl; } .ll-headrow > span:nth-child(2) { grid-area: rack; } .ll-headrow > span:nth-child(3) { grid-area: name; } .ll-headrow > span:nth-child(4) { grid-area: pcs; } .ll-headrow > span:nth-child(5) { grid-area: slot; } .ll-headrow > span:nth-child(6) { grid-area: end; }
  /* the customer above their lines: a highlighted band (the gold band of the printed list), so each customer stands out while entering */
  .ll-party { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 14px 0 2px; padding: 10px 14px; font-size: 15.5px; overflow-wrap: anywhere; background: var(--warn-bg); border: 1px solid var(--warn-line); border-left: 6px solid var(--warn); border-radius: 12px; }
  .ll-party strong { color: var(--warn-text); font-size: 16.5px; font-weight: 800; letter-spacing: .02em; }
  .ll-party .muted { color: var(--warn-text); opacity: .8; }
  .ll-grid > .ll-party:first-of-type { margin-top: 8px; }
  .ll-party-tools { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
  .book-filters { margin-top: 8px; }
  .book-filters[hidden] { display: none; }
  .book-acts { justify-content: flex-end; flex-wrap: nowrap; }
  .book-x-gap { display: inline-block; width: var(--ctl-h, 40px); }
  /* Order book: Edit and the X at the end of a customer's row; the customers on a loading list card */
  .book-head { display: flex; align-items: center; gap: 8px; }
  .book-head > .party-box { flex: 1 1 auto; min-width: 0; }
  .book-head .party-box .hint { white-space: normal; overflow-wrap: anywhere; }
  .book-head-acts { flex: 0 0 auto; flex-wrap: nowrap; }
  .stage-tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
  @media (max-width: 720px) { .book-head { flex-wrap: wrap; } .book-head > .party-box { flex-basis: 100%; } .book-head-acts { margin-left: auto; } }
  .trip-custs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
  .trip-cust { font-size: 0.86em; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); border: 1px solid var(--line); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sct-side { color: var(--warn-text); text-transform: uppercase; letter-spacing: .04em; }
  .ll-sl { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
  .ll-name { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
  .ll-name .hint, .ll-name .line-remark { font-weight: 400; }
  .ll-num { text-align: right; }
  .ll-pcs, .ll-slot { min-width: 0; }
  .ll-pcs input, .ll-slot input { width: 100%; max-width: none; min-width: 0; box-sizing: border-box; margin: 0; }
  .ll-pcs input { text-align: right; font-variant-numeric: tabular-nums; }
  .ll-slot input { text-align: center; text-transform: uppercase; font-weight: 700; }
  .ll-cs { font-size: 11.5px; color: var(--muted); text-align: right; min-height: 1.15em; margin-top: 2px; font-variant-numeric: tabular-nums; }
  .ll-end { display: flex; justify-content: center; align-items: center; }
  .ll-tick { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; cursor: pointer; }
  .ll-off { opacity: .5; }
  .ll-slot { display: flex; flex-direction: column; gap: 4px; align-self: start; }
  .ll-part { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 4px; }
  .ll-part input { width: 100%; min-width: 0; box-sizing: border-box; margin: 0; }
  .ll-part .ll-part-pcs { text-align: right; font-variant-numeric: tabular-nums; }
  .ll-part .ll-part-pcs:disabled { opacity: .75; }
  .slot-input.slot-dup { border-color: var(--danger, #e5484d); box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger, #e5484d) 35%, transparent); color: var(--danger, #e5484d); }
  .ll-split { display: flex; flex-wrap: wrap; gap: 4px; }
  .ll-split button { flex: 1 1 auto; }
  .ll-row > .ll-pcs, .ll-row > .ll-end, .ll-row > .ll-sl, .ll-row > .ll-rack { align-self: start; padding-top: 4px; }
  .ll-row > .ll-name { align-self: start; }
  @container page (max-width: 620px) {
    .ll-headrow { display: none; }
    .ll-row { grid-template-columns: 52px 92px minmax(0, 1fr) 44px; grid-template-areas: "sl name name end" "rack pcs slot slot"; }
  }
  .choice-actions { flex-wrap: wrap; justify-content: flex-end; }
  .slot-tag { font-size: 1.05em; letter-spacing: .02em; }
  .veh-no-in { text-transform: uppercase; font-size: 18px; font-weight: 700; letter-spacing: .04em; }
  /* orders-agent: the Tally-style next-item box fills the whole Total row width, text on the left, matches drop down right under it */
  .bill-grid .bill-add-row .next-item { width: 100%; }
  .bill-grid .bill-add-row .next-item input { width: 100%; max-width: none; margin: 0; text-align: left; min-height: 40px; padding-left: 38px; }
  .bill-grid .bill-add-row .next-item .results { margin-top: 4px; max-height: 260px; text-align: left; }
  .bill-grid .bill-add-row .next-item .hint.pad { text-align: left; padding: 8px 4px; }
  /* orders-agent: leave room under the top bar when the item box is scrolled to the top of the screen */
  .next-item input, .bill-search input { scroll-margin-top: 84px; }
  /* orders-agent: a focused cell is never left under the top bar or the bottom bar */
  .bill-grid input, .bc-grid input { scroll-margin-top: 90px; scroll-margin-bottom: 120px; }
  /* orders-agent: the Total row never wraps its amount; the voice-notes card under the lines gets air above it */
  .bill-total-row td { white-space: nowrap; }
  .bill-layout + .card, .bill-layout ~ .card { margin-top: 14px; }
  /* orders-agent: charges boxes two per row on phones instead of one long column */
  @media (max-width: 600px) { .bill-side .t-inputs, .totals-panel .t-inputs { grid-template-columns: 1fr 1fr !important; gap: 10px; } }
  /* the customer / supplier list opens over the page, wide enough to read, and the bottom action bar steps aside while it is open */
  .party-picker { position: relative; }
  .party-picker .results { position: absolute; left: 0; top: 100%; z-index: 60; width: max(100%, min(400px, calc(100vw - 32px))); max-height: min(340px, 46vh); }
  body.picking-party .sticky-actions, body.picking-party .sticky-total { display: none; }
  .add-next-btn { width: 100%; min-height: var(--ctl-h, 44px); border: 1.5px dashed var(--line); border-radius: var(--radius-md); background: transparent; font-weight: 700; cursor: pointer; }
  .add-next-btn:hover { border-color: var(--ink); background: var(--accent-soft); }
  .next-line { display: flex; align-items: flex-start; gap: 10px; }
  .next-line > div:last-child { flex: 1; min-width: 0; }
  .next-no { flex: 0 0 auto; min-width: 26px; height: 26px; margin-top: 9px; border-radius: 13px; background: var(--accent-soft); display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; }
  /* a size typed in feet or metres (breakage pieces, breakage sheet) */
  .size-pair { display: grid; gap: 6px; min-width: 0; }
  .size-pair-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
  .size-pair-row .size-in { width: 92px; min-width: 0; flex: 0 1 92px; }
  .size-unit { width: 22px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
  .ft-in { min-width: 64px; max-width: 84px; }
  /* the stock bar and its figures open that part of the item's story */
  /* plain text a little lighter than headings and figures, so the emphasis stands out */
  body { font-weight: 500; }
  td, .hint, .muted, .page-sub, .small-text { font-weight: 500; }
  h1, h2, h3, h4, th, strong, b, .section-title, .pill { font-weight: 700; }
  /* the page title is already in the top bar on a phone: it is not shown twice */
  @media (max-width: 599px) {
    .page-head .page-title h2 { display: none; }
    .page-head .page-title:empty, .page-head .page-title:not(:has(.page-sub)) { display: none; }
    .page-head { margin-top: 4px; }
  }
  /* links and small buttons inside tables (order numbers, open, edit) are easy to hit */
  .table-wrap td .link-btn, .table-wrap td a, td .link-btn, td a { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 4px; }
  @media (pointer: coarse) {
    .table-wrap td .link-btn, .table-wrap td a, td .link-btn, td a, .rcards .link-btn { min-height: 44px; padding: 10px 6px; }
  }
  /* the owner's stock audit */
  .audit-card { display: block; width: 100%; text-align: left; padding: 14px 16px; margin-bottom: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); cursor: pointer; font: inherit; color: inherit; box-sizing: border-box; }
  .audit-card:hover { border-color: var(--ink); }
  .audit-kpis { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 14px; }
  .audit-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 8px 0 12px; }
  .audit-list { display: grid; gap: 8px; }
  .audit-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 130px minmax(120px, 190px); gap: 10px 14px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
  .audit-row.differs { border-color: var(--danger, #c0392b); }
  .audit-name { min-width: 0; overflow-wrap: anywhere; }
  .audit-app { text-align: right; }
  .audit-in { width: 100%; text-align: right; }
  .audit-result { min-width: 0; }
  @media (max-width: 720px) {
    .audit-row { grid-template-columns: 1fr 1fr; }
    .audit-name { grid-column: 1 / -1; }
    .audit-app { text-align: left; }
    .audit-result { grid-column: 1 / -1; }
  }
  .alerts-card { padding: 12px 14px; margin: 0 0 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
  .alerts-line { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
  .alerts-line svg { flex: 0 0 auto; margin-top: 2px; }
  /* ---- shell / items / purchases / alerts agent: block of its own ---- */
  /* a row of page buttons that scrolls sideways on a phone fades on the right edge while there is more to reach */
  .page-actions.scrolls:not(.at-end) { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
  /* the stock bar wraps its labels instead of clipping them when the space is narrow */
  .stock-bar { flex-wrap: wrap; height: auto; min-height: 20px; }
  .sb-seg { min-height: 20px; flex-shrink: 0; white-space: nowrap; }

  /* ==========================================================================================================================================
     CAPITAL LETTERS everywhere (the owner's choice, like the item names and the printed sheets): every label, button, heading, item and value,
     and what is typed (JsCore keeps typed text in capitals too). A password keeps its own case. Capitals are wider: a little tighter tracking.
     ========================================================================================================================================== */
  body, button, input, select, textarea, .btn, svg text { text-transform: uppercase; }
  input::placeholder, textarea::placeholder { text-transform: uppercase; }
  input[type=password], input.with-toggle, .keep-case { text-transform: none; }
  body { letter-spacing: 0.01em; }
  h1, h2, h3, .page-title, #page-title { letter-spacing: 0; }

  /* ---- fine tuning (phones, Fold, iPad, Windows) ---- */
  /* the row of page buttons that scrolls sideways on a phone keeps the page margin on the left too (it snapped to the very edge) */
  @media (max-width: 720px) { .page-actions { scroll-padding-inline: var(--gutter); } }
  /* tabs with four or more choices (All, Drafts, Booked ...): on a phone they become a row of tabs that scrolls, each word whole */
  @media (max-width: 600px) {
    .seg.seg-many { display: flex; width: 100%; overflow-x: auto; overflow-y: hidden; gap: 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .seg.seg-many::-webkit-scrollbar { display: none; }
    .seg.seg-many .seg-thumb { display: none; }
    .seg.seg-many .seg-btn { flex: 0 0 auto; padding: 0 14px; font-size: 13px; overflow: visible; }
    .seg.seg-many .seg-btn[aria-selected="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.22), 0 0 0 .5px var(--line-2); }
  }
  /* the item list: the name shows in full (two lines at most) instead of being cut off */
  .ir-name { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
  .ir-top { align-items: flex-start; }
   .ir-top > .code-tag, .ir-top > .item-thumb { flex: 0 0 auto; }
  /* the figures under an item: one size and one look, tappable or not */
  
  /* the buttons at the top of a page are all one height (Excel / Preview PDF were smaller than the rest) */
  .page-actions button, .page-actions .btn { min-height: var(--ctl-h); }
  /* a note under a box reads like the other notes (monospace capitals looked out of place) */
  .hint.mono { font-family: inherit; letter-spacing: 0.01em; }
  /* the chosen tab stands out in light and dark alike (it looked pressed-in on the dark theme) */
  .seg-thumb { background: var(--brand-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 55%, transparent); }
  .seg-btn[aria-selected="true"], .seg > button.on { color: var(--brand-ink); }
  /* the side menu shows each name whole in capitals: a long one goes onto a second line instead of "BOOKINGS AND QUOTATIO..." */
  .navlink .nl { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.2; }
  @media (min-width: 600px) and (max-width: 1023.98px) {
    .sidebar .navlink .nl-short { white-space: normal; overflow: visible; text-overflow: clip; font-size: 10.5px; letter-spacing: 0; overflow-wrap: anywhere; }
  }
  @media (max-width: 600px) { .seg.seg-many .seg-btn[aria-selected="true"] { background: var(--brand-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 55%, transparent); } }
  /* the chosen tab: a clear red border all the way round, easy to see in the light theme too; on a phone it is part of the tab itself, so it moves with the tabs when they scroll */
  .seg-thumb { box-shadow: inset 0 0 0 2px var(--brand); }
  @media (max-width: 600px) { .seg.seg-many .seg-btn[aria-selected="true"] { box-shadow: inset 0 0 0 2px var(--brand); } }
  .seg-btn[aria-selected="true"] { font-weight: 700; }
  .seg.seg-many { scroll-padding-inline: 12px; }
  /* rows and cards that open with a tap (no Open button): a hand on a mouse, a soft press on a finger */
  .trip-card.clickable:active, .truck-card.clickable:active, .rcard.row-link:active, .list-line.clickable:active { background: var(--hover); }
  tr.row-link:active td { background: var(--hover); }
  .trip-card.clickable, .truck-card.clickable { transform: none; }
  .trip-card.clickable:hover, .truck-card.clickable:hover { transform: none; }

  /* ---------------------------------------------------------------- warehouse home: big coloured job buttons, few words */
  .wh-home { --job-in: var(--ok); --job-out: var(--info); --job-stock: #6E56CF; --job-break: var(--danger); }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wh-home { --job-stock: #B4A5F5; } }
  :root[data-theme="dark"] .wh-home { --job-stock: #B4A5F5; }
  .wh-q { margin: 18px 2px 10px; font-size: 17px; font-weight: 800; letter-spacing: .01em; }
  .wh-q-sm { font-size: 13px; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin-top: 22px; }
  .wh-step1 { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 16px; margin: 4px 0 6px; border-radius: 18px;
    background: var(--danger-bg); border: 2px solid var(--danger); color: var(--ink); cursor: pointer; font: inherit; }
  .wh-step1-n { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%; background: var(--danger); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; }
  .wh-step1-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
  .wh-step1-t strong { font-size: 18px; line-height: 1.2; }
  .wh-step1-t span { font-size: 14px; color: var(--ink-2, var(--muted)); line-height: 1.35; }
  .wh-step1-go { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 14px; border-radius: 12px; background: var(--danger); color: #fff; font-weight: 800; font-size: 15px; }
  .wh-step1-go .icon { width: 18px; height: 18px; }
  .wh-done { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding: 12px 16px; border-radius: 14px; background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok); font-weight: 700; font-size: 15px; }
  .wh-done .icon { width: 22px; height: 22px; flex: 0 0 auto; }
  .wh-done-diff { font-weight: 600; font-size: 13px; color: var(--warn); }
  .job-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  @container page (min-width: 760px) { .job-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
  .job { --c: var(--job-in); position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 148px; padding: 16px; margin: 0; text-align: left; cursor: pointer; font: inherit; color: var(--ink);
    border-radius: 20px; border: 2px solid color-mix(in srgb, var(--c) 45%, transparent); background: color-mix(in srgb, var(--c) 12%, var(--surface));
    transition: transform .15s var(--spring, ease), box-shadow .15s ease; }
  .job:hover { box-shadow: var(--shadow-md); }
  .job:active { transform: scale(.97); }
  .job:focus-visible { outline: 3px solid var(--c); outline-offset: 2px; }
  .job-out { --c: var(--job-out); } .job-stock { --c: var(--job-stock); } .job-break { --c: var(--job-break); }
  .job-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--c); color: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
  :root[data-theme="dark"] .job-icon { color: #111; }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .job-icon { color: #111; } }
  .job-icon .icon { width: 30px; height: 30px; stroke-width: 2.2; }
  .wh-home button, .truck-card button { min-width: 0; max-width: 100%; white-space: normal; }
  .wh-step1-t strong, .wh-step1-t span { white-space: normal; overflow-wrap: anywhere; }
  .job-label, .job-sub, .job-row-t, .truck-line-t span { white-space: normal; overflow-wrap: anywhere; max-width: 100%; }
  .job-label { font-size: 20px; font-weight: 800; line-height: 1.15; letter-spacing: -.005em; }
  .job-sub { font-size: 13px; line-height: 1.3; color: var(--muted); }
  .job-count { position: absolute; top: 12px; right: 12px; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 17px; background: #E5484D; color: #fff; font-size: 18px; font-weight: 800; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 3px var(--surface); }
  .job.is-locked { opacity: .55; }
  .job.is-locked .job-sub { color: var(--danger); font-weight: 700; }
  .job-rows { background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; overflow: hidden; }
  .job-row, .truck-line { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 58px; padding: 10px 16px; margin: 0; border: 0; border-top: 1px solid var(--line-2); background: transparent; color: var(--ink); text-align: left; cursor: pointer; font: inherit; border-radius: 0; }
  .job-row:first-child, .truck-line:first-child { border-top: 0; }
  .job-row-icon, .truck-line-icon { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; }
  .job-row-icon .icon, .truck-line-icon .icon { width: 20px; height: 20px; }
  .job-row-t { flex: 1; min-width: 0; font-size: 15.5px; font-weight: 600; line-height: 1.25; }
  .job-row-n { flex: 0 0 auto; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 14px; background: #E5484D; color: #fff; font-weight: 800; font-size: 14px; display: flex; align-items: center; justify-content: center; }
  .job-row-go { flex: 0 0 auto; color: var(--muted); display: inline-flex; }
  .job-row-go .icon { width: 18px; height: 18px; }
  .truck-line-icon { background: color-mix(in srgb, var(--info) 18%, var(--surface)); color: var(--info); }
  .truck-line-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .truck-line-t strong { font-size: 17px; }
  .truck-line-t span { font-size: 13px; color: var(--muted); }
  .truck-line-go { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 2px; min-height: 40px; padding: 0 12px; border-radius: 11px; background: var(--info); color: var(--surface); font-weight: 800; font-size: 14px; }
  .truck-line-go .icon { width: 16px; height: 16px; }
  .truck-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  @container page (min-width: 760px) { .truck-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  .truck-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-2); }
  .truck-card.to-load { border: 2px solid var(--info); background: color-mix(in srgb, var(--info) 7%, var(--surface)); }
  .truck-card-top { display: flex; align-items: center; gap: 12px; }
  .truck-card-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .truck-card-t strong { font-size: 21px; font-weight: 800; letter-spacing: .02em; overflow-wrap: anywhere; }
  .truck-card-t strong.tc-words { font-size: 17px; overflow-wrap: normal; word-break: normal; } /* "Outside vehicle": words, not a number, so it wraps between them */
  .truck-card-t span { font-size: 14px; color: var(--muted); overflow-wrap: break-word; }
  .truck-card-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .truck-card-figs > div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 12px; background: var(--accent-soft); }
  .truck-card-figs b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
  .truck-card-figs span { font-size: 11.5px; color: var(--muted); letter-spacing: .04em; }
  .truck-card .hint { margin: 0; }
  .truck-card .big-go { min-height: 54px; font-size: 17px; font-weight: 800; border-radius: 14px; }
  /* the note box under an item's name in a bill line */
  .line-note { display: block; width: 100%; min-height: 34px; margin: 6px 0 2px; padding: 4px 10px; font-size: 13px; border-style: dashed; background: transparent; }
  .line-note:placeholder-shown { color: var(--muted); }
  td.item { min-width: 250px; }
  td.item .line-note { max-width: none; width: 100%; }
  .line-note { text-align: left; }
  .trip-cards { display: grid; gap: 14px; }
  .trip-card .trip-head { align-items: flex-start; gap: 10px; }
  .trip-card .trip-sum { margin: 4px 0 10px; font-size: 14px; font-weight: 600; }
  .trip-card .trip-parties .card { margin: 0 0 8px; box-shadow: none; background: var(--bg); }
  .load-head { padding: 14px 16px; margin-bottom: 12px; border-radius: 18px; background: var(--surface); border: 2px solid var(--info); }
  .load-steps { list-style: none; margin: 0 0 14px; padding: 6px 0; border-radius: 16px; background: var(--warn-bg); border: 1px solid var(--warn-line); }
  .load-steps li { display: flex; align-items: flex-start; gap: 12px; padding: 8px 14px; font-size: 15px; line-height: 1.35; font-weight: 600; }
  .load-steps b { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; background: var(--warn); color: var(--surface); display: flex; align-items: center; justify-content: center; font-size: 15px; }
  .load-steps span { padding-top: 3px; min-width: 0; }
  .rack-tag { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 8px; background: var(--ink); color: var(--surface); font-weight: 800; letter-spacing: .04em; }
  @media (max-width: 360px) { .job { min-height: 136px; padding: 14px 12px; } .job-label { font-size: 18px; } .job-icon { width: 50px; height: 50px; } }

  /* ---- fine tuning 2 (phones, iPhone, Fold, Windows) ---- */
  /* a drop-down still on "Choose the ..." reads like a hint, not like a chosen value; the list itself keeps the normal colour */
  select:has(> option[value=""]:checked) { color: #9a928a; }
  select option { color: var(--ink); background: var(--surface); }
  /* a box that is focused or scrolled to stays clear of the top bar and of the save bar / tab bar at the bottom (the iPhone keyboard too) */
  input, select, textarea { scroll-margin-top: calc(88px + var(--safe-top)); scroll-margin-bottom: calc(150px + var(--safe-bottom)); }
  /* iPhone: a date box is as tall as the others and its date starts on the left like every other value */
  @supports (-webkit-touch-callout: none) {
    input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; display: flex; align-items: center; text-align: left; line-height: normal; }
    input[type=date]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value { text-align: left; margin: 0; }
  }
  /* a long choice in a narrow drop-down ends in ... instead of being cut through a letter */
  select { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
  /* Excel / Preview PDF at the top of a page have the same letters as the buttons beside them */
  .page-actions button.small, .page-actions .btn.small { font-size: inherit; padding: 0 16px; border-radius: 12px; }
  @media (min-width: 721px) {
    .page-actions button.small, .page-actions .btn.small { font-size: 15px; }
    .page-actions button, .page-actions .btn { padding: 0 14px; }
    .page-actions, .page-actions > .row { gap: 8px; }
  }
  /* booking or quotation: two halves of one row on a phone instead of two lines */
  @media (max-width: 600px) {
    .kind-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .kind-pick > button.chip { min-width: 0; white-space: normal; line-height: 1.2; text-align: center; padding: 6px 10px; font-size: 13.5px; min-height: var(--ctl-h); }
  }
  /* the cash switch sits under the customer box when the boxes stand side by side, so Warehouse, Customer and Place start on one line */
  .cust-box { display: flex; flex-direction: column; min-width: 0; }
  @media (min-width: 600px) { .order-head .cust-box > .cash-switch { order: 2; margin: -4px 0 12px; } }
  /* a save bar with four or more buttons: three to a row on a phone (two rows instead of three), so the form above stays in sight */
  @media (max-width: 720px) {
    .sticky-actions > .row:has(> button:nth-child(4)) { gap: 6px; }
    .sticky-actions > .row:has(> button:nth-child(4)) > button { flex: 1 1 88px; font-size: 13.5px; padding: 4px 8px; min-height: 44px; }
    .sticky-actions { padding: 8px; }
  }
  /* ==========================================================================================================================================
     v7 phones (and a Fold folded): the calm look of the Windows screens, sized for a thumb. Lighter letters, flatter boxes, less chrome:
     only the figures and titles are bold, boxes inside boxes lose their frame, filters sit two to a row, tips fold to one line.
     ========================================================================================================================================== */
  @media (max-width: 599.98px) {
    html, body { font-size: 14px; font-weight: 500; line-height: 1.4; }
    body { letter-spacing: .005em; }
    input, select, textarea { font-weight: 500; }
    button, .btn { font-size: 14px; font-weight: 600; }
    strong, b, h1, h2, h3, .k-value { font-weight: 700; }
    /* fields: small grey labels over the boxes, like on a PC */
    label { font-size: 11.5px; letter-spacing: .04em; margin-bottom: 4px; }
    .field { margin-bottom: 12px; }
    .hint { font-size: 11.5px; line-height: 1.35; }
    /* boxes: one frame, not frames inside frames */
    .card { padding: 14px; border-radius: 16px; margin-bottom: 12px; box-shadow: none; }
    .card .card { border: 0; background: var(--surface-2); padding: 12px; margin-bottom: 8px; border-radius: 12px; }
    .section-title { font-size: 11px; margin: 16px 2px 8px; }
    .list-meta { font-size: 12px; margin: 2px 2px 8px; }
    /* page heading: the tip under the title is one line (tap it for the rest) */
    .page-head { margin-bottom: 12px; gap: 10px; }
    .page-sub { font-size: 12.5px; font-weight: 500; line-height: 1.4; }
    .content .page-sub:not(.open) { -webkit-line-clamp: 1; }
    .page-title h2, .content h2 { font-size: 21px; }
    .page-actions button, .page-actions .btn { font-size: 13.5px; }
    /* filters: the search across the top, the drop-downs two to a row */
    .toolbar { gap: 8px; margin-bottom: 8px; }
    .toolbar select { flex: 1 1 calc(50% - 4px); width: auto; min-width: 0; font-size: 14px; }
    .card:has(> .toolbar) { padding: 10px; }
    /* tabs and the tab bar */
    .seg-btn, .seg > button { font-size: 12.5px; }
    .tabbar button { font-size: 10.5px; font-weight: 600; }
    .tabbar button .icon { width: 21px; height: 21px; }
    /* an item in the list: its sizes as one quiet line, the stock figures without the empty ones */
    .ir-name { font-size: 13.5px; }
    .ir-top { gap: 8px; }
    .item-row { padding: 12px; }
    /* dashboard */
    .kpi { padding: 12px 14px; box-shadow: none; }
    .kpi .k-label { font-size: 12px; }
    /* the save bar */
    .sticky-actions { box-shadow: 0 6px 20px rgba(0,0,0,.14); }
  }
  /* a list row on a phone: the name across the top, then the facts two to a row (small grey label over the value), the buttons at the bottom.
     It was one line per fact with a dashed rule under each, so one purchase filled the screen. */
  @media (max-width: 720px) {
    .rcards { gap: 8px; }
    .rcard { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; padding: 12px 14px; box-shadow: none; border-radius: 14px; }
    .rcard > .rcard-row { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 1px; padding: 0; border: 0; font-size: 13.5px; min-width: 0; }
    .rcard > .rcard-row:last-child { padding-top: 0; }
    .rcard > .rcard-row .rk { font-size: 10.5px; letter-spacing: .05em; line-height: 1.3; }
    .rcard > .rcard-row .rv { text-align: left; font-weight: 600; max-width: 100%; }
    .rcard > .rcard-row .rv .item-cell { justify-content: flex-start; text-align: left; }
    .rcard > .rcard-row.rcard-primary { grid-column: 1 / -1; padding: 0 0 8px; margin: 0; border-bottom: 1px solid var(--line-2); font-size: 14.5px; }
    .rcard > .rcard-row.rcard-primary .rv { font-weight: 700; }
     .rcard > .rcard-row:has(.item-cell) { grid-column: 1 / -1; }
    .rcard > .rcard-row.rcard-actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; border-top: 1px solid var(--line-2); padding-top: 8px; margin-top: 2px; }
    .rcard > .rcard-row.rcard-actions .rv { justify-content: flex-end; }
    .rcard > .row-link-hint { grid-column: 1 / -1; }
    .rcard > .rcard-row.rcard-actions button, .rcard > .rcard-row.rcard-actions .btn { min-height: 38px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
  }
  @media (min-width: 380px) and (max-width: 720px) { .rcard { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); } }
  /* Android and the Fold: the boxes may use the PC's smaller letters; an iPhone keeps 16px, or it zooms the page when a box is tapped */
  @media (max-width: 599.98px) { @supports not (-webkit-touch-callout: none) { input, select, textarea { font-size: 15px; } .toolbar select { font-size: 14px; } } }
  @media (max-width: 599.98px) { @supports (-webkit-touch-callout: none) { .toolbar select { font-size: 16px; } } }

  /* ==========================================================================================================================================
     the owner dashboard and the pages behind its taps (owner, 28 Oct 2026, from the design canvas): white cards on the page ground, clear titles,
     figures in the mono face, the logo red as the one accent, teal for stock. Every card, tile, row and bar is a real button (JsOwner.html, JsDash.html).
     The layout follows the page area (@container page), not the window: the sidebar being open or the Fold being folded changes it.
     ========================================================================================================================================== */
  .dx-dash, .dx-detail { min-width: 0; }
  .dx-stack, .dx-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
  .dx-detail > .back-btn { align-self: flex-start; }
  .dx-headslot .page-head { margin-bottom: 14px; }
  /* the title of a page behind a tap is shown on a phone too: the top bar only says "Dashboard" */
  @media (max-width: 599.98px) {
    .dx-detail .page-head .page-title, .dx-detail .page-head .page-title:not(:has(.page-sub)) { display: block; }
    .dx-detail .page-head .page-title h2 { display: block; }
  }

  /* a card */
  .dx-card { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-sm); }
  .dx-card.flush { --in: 16px; gap: 0; padding: 8px; }
  .dx-card.flush > .dx-card-head { padding: 10px var(--in) 8px; }
  .dx-card-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; min-width: 0; }
  .dx-ht { flex: 1 1 200px; min-width: 0; }
  .dx-h { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; }
  .dx-sub { margin-top: 2px; font-size: 13px; font-weight: 500; color: var(--muted); line-height: 1.4; }
  .dx-card-foot { display: flex; justify-content: flex-end; }
  .dx-empty { padding: 14px 0; font-size: 14px; font-weight: 500; color: var(--muted); line-height: 1.45; }
  .dx-clear { display: flex; align-items: center; gap: 8px; padding: 12px var(--in, 16px) 14px; color: var(--ok); font-size: 14.5px; font-weight: 600; }
  .dx-clear .icon { width: 18px; height: 18px; flex: none; }
  .dx-note { padding: 8px var(--in, 16px) 10px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
  .dx-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
  /* the title of a card that opens a page, and the small links at the end of a title line: buttons without a frame */
  button.dx-hbtn { position: relative; min-height: 36px; padding: 0 6px 0 0; gap: 4px; justify-content: flex-start; border: 0; border-radius: 8px; background: transparent; color: inherit; font: inherit; text-align: left; white-space: normal; }
  button.dx-hbtn:hover { background: transparent; }
  button.dx-hbtn::after { content: ''; position: absolute; inset: -4px -4px; }
  button.dx-link { gap: 2px; padding: 0 8px 0 12px; border-color: transparent; background: transparent; color: var(--muted); font-weight: 700; }
  button.dx-link:hover { border-color: var(--line-2); }
  .dx-chev { width: 18px; height: 18px; flex: none; color: var(--muted); }
  .dx-link .dx-chev, .dx-ro-open .dx-chev { width: 16px; height: 16px; }

  /* the headline tiles */
  .dx-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  button.dx-tile { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 8px; height: auto; min-height: 150px; padding: 16px 18px; border: 1px solid var(--line-2); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); color: var(--ink); text-align: left; white-space: normal; font-weight: inherit; }
  .dx-tile-label { font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--muted); }
  .dx-tile-val { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
  .dx-tile-sub { font-size: 13px; font-weight: 500; line-height: 1.35; color: var(--muted); }
  .dx-tile-foot { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-top: auto; }
  .dx-spark { display: block; flex: 1 1 80px; width: 100%; max-width: 120px; height: 32px; overflow: visible; }
  .dx-spark path { fill: none; stroke: var(--c, var(--teal)); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
  .dx-delta { display: inline-flex; align-items: center; border-radius: 99px; padding: 3px 10px; background: var(--accent-soft); color: var(--muted); font-size: 12px; font-weight: 800; white-space: nowrap; }
  .dx-delta.ok { background: var(--ok-bg); color: var(--ok); }
  .dx-delta.warn { background: var(--warn-bg); color: var(--warn); }
  .dx-delta.danger { background: var(--danger-bg); color: var(--danger); }
  @container page (min-width: 900px) {
    .dx-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
    button.dx-tile { min-height: 168px; padding: 20px; gap: 10px; }
    .dx-tile-val { font-size: 28px; }
    .dx-spark { flex: 0 0 120px; height: 36px; }
  }
  @container page (max-width: 340px) { .dx-tiles { grid-template-columns: minmax(0, 1fr); } }

  /* Needs you */
  .dx-card.flush > .dx-need-head { align-items: center; padding: 14px var(--in) 6px; }
  .dx-badge { padding: 4px 12px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 13px; font-weight: 800; white-space: nowrap; }
  button.dx-need { display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; height: auto; min-height: 52px; padding: 8px var(--in, 16px); border: 0; border-top: 1px solid var(--line-2); border-radius: 0; background: transparent; color: var(--ink); text-align: left; white-space: normal; font-weight: inherit; }
  .dx-ndot { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 99px; background: var(--muted); }
  .dx-ndot.hot { background: var(--brand); }
  .dx-ndot.warm { background: var(--warn); }
  .dx-n { flex: 0 0 34px; font-family: var(--font-mono); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .dx-nt { flex: 1 1 auto; min-width: 0; font-size: 14.5px; font-weight: 600; line-height: 1.3; }
  .dx-nw { flex: none; font-size: 13px; font-weight: 500; color: var(--muted); }

  /* Order to dispatch */
  .dx-pipe { display: flex; flex-wrap: wrap; gap: 12px; }
  button.dx-step { flex: 1 1 150px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 6px; height: auto; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface-2); color: var(--ink); text-align: left; white-space: normal; font-weight: inherit; }
  .dx-step-bar { display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--c, var(--muted)); }
  .dx-step-n { font-family: var(--font-mono); font-size: 28px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
  .dx-step-l { font-size: 13px; font-weight: 700; line-height: 1.3; color: var(--muted); }

  /* the two charts: a 7 / 14 / 30 day switch, figures, the picture, the line that reads the day under the pointer */
  .dx-range { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); }
  button.dx-rbtn { position: relative; min-width: 46px; min-height: 36px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 800; }
  button.dx-rbtn::after { content: ''; position: absolute; inset: -4px -2px; }
  button.dx-rbtn:hover { background: var(--hover); }
  button.dx-rbtn[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
  .dx-chartwrap { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .dx-pills { display: flex; flex-wrap: wrap; gap: 8px; }
  .dx-pill { padding: 4px 12px; border-radius: 99px; background: var(--bg); font-size: 13px; font-weight: 500; }
  .dx-pill strong { font-family: var(--font-mono); font-weight: 600; }
  .dx-pill.ok strong, .dx-pill.in strong { color: var(--teal); }
  .dx-pill.danger strong, .dx-pill.out strong { color: var(--brand-ink); }
  .dx-chartbox { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
  .dx-chart { position: relative; width: 100%; min-width: 0; }
  .dx-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
  .dx-gl { stroke: var(--line-2); stroke-width: 1; }
  .dx-ax { fill: var(--muted); font-family: var(--font-mono); font-size: 11px; font-weight: 500; }
  .dx-vl { fill: var(--ink); font-weight: 600; }
  .dx-area { fill: var(--teal); fill-opacity: .13; stroke: none; }
  .dx-line { fill: none; stroke: var(--teal); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
  .dx-dot { fill: var(--teal); stroke: var(--surface); stroke-width: 2.5; }
  .dx-mk.teal { fill: var(--teal); }
  .dx-mk.red { fill: var(--brand); }
  .dx-mk.amber { fill: var(--warn); }
  .dx-sel { fill: var(--hover); }
  .dx-hit { fill: transparent; cursor: pointer; }
  .dx-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; font-weight: 600; }
  .dx-lg { display: inline-flex; align-items: center; gap: 6px; }
  .dx-ldot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--muted); }
  .dx-ldot.teal { background: var(--teal); }
  .dx-ldot.red { background: var(--brand); }
  .dx-ldot.amber { background: var(--warn); }
  .dx-readout { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; min-height: 40px; padding: 6px 12px; border-radius: 10px; background: var(--bg); font-size: 13.5px; }
  .dx-ro-title { font-weight: 700; }
  .dx-ro-vals { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; font-family: var(--font-mono); font-weight: 600; }
  .dx-ro-vals .teal { color: var(--teal); }
  .dx-ro-vals .red { color: var(--brand-ink); }
  .dx-ro-vals .amber { color: var(--warn); }
  button.dx-ro-open { margin-left: auto; gap: 2px; padding: 0 8px 0 12px; }

  /* godowns and categories */
  .dx-godowns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
  button.dx-godown { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 10px; height: auto; padding: 16px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface-2); color: var(--ink); text-align: left; white-space: normal; font-weight: inherit; }
  .dx-gd-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
  .dx-gd-top strong { font-size: 16px; }
  .dx-gd-share { font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; }
  .dx-gd-pcs { font-family: var(--font-mono); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .dx-gd-pcs small { font-family: var(--font); font-size: 13px; font-weight: 600; color: var(--muted); }
  .dx-gd-sub { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; font-size: 13px; font-weight: 500; color: var(--muted); }
  .dx-track { display: block; height: 8px; border-radius: 8px; background: var(--line-2); overflow: hidden; }
  .dx-fill { display: block; height: 100%; border-radius: 8px; background: var(--teal); }
  .dx-fill.brand { background: var(--brand); }
  .dx-fill.ok { background: var(--ok); }
  .dx-fill.warn { background: var(--warn); }
  .dx-fill.danger { background: var(--brand); }
  .dx-fill.info { background: var(--info); }
  .dx-donutbox { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; }
  .dx-donut { flex: 0 0 132px; width: 132px; height: 132px; }
  .dx-donut-bg { fill: none; stroke: var(--line-2); stroke-width: 16; }
  .dx-seg { fill: none; stroke-width: 16; cursor: pointer; }
  .dx-seg:hover { stroke-width: 19; }
  .dx-donut-n { fill: var(--ink); font-size: 20px; font-weight: 800; }
  .dx-donut-l { fill: var(--muted); font-size: 10.5px; font-weight: 500; }
  .dx-lglist { flex: 1 1 170px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  button.dx-lgrow { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; height: auto; min-height: 40px; padding: 6px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font-size: 14px; text-align: left; white-space: normal; font-weight: inherit; }
  .dx-sw { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 3px; }
  .dx-lg-name { flex: 1 1 auto; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
  .dx-lg-pct { flex: none; font-family: var(--font-mono); font-weight: 500; color: var(--muted); }

  /* rows: running low, selling fastest, approvals and every list of the detail pages */
  .dx-list { display: flex; flex-direction: column; }
  .dx-row { display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; min-height: 56px; height: auto; padding: 8px var(--in, 16px); border: 0; border-top: 1px solid var(--line-2); border-radius: 0; background: transparent; color: var(--ink); font-size: 14px; font-weight: 500; text-align: left; white-space: normal; }
  .dx-row:nth-child(n+26) { content-visibility: auto; contain-intrinsic-size: auto none auto 60px; }
  .dx-code { flex: none; padding: 3px 8px; border-radius: 6px; background: var(--accent-soft); font-family: var(--font-mono); font-size: 12px; font-weight: 600; white-space: nowrap; }
  .dx-main { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .dx-title { font-size: 14px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
  .dx-rsub { font-size: 12.5px; font-weight: 500; line-height: 1.35; color: var(--muted); overflow-wrap: anywhere; }
  .dx-right { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; max-width: 46%; text-align: right; }
  .dx-rv { font-family: var(--font-mono); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  .dx-rv.danger { color: var(--danger); }
  .dx-rv.ok { color: var(--ok); }
  .dx-rv.warn { color: var(--warn); }
  .dx-rv.info { color: var(--info); }
  .dx-rs { font-size: 12px; font-weight: 500; color: var(--muted); }
  .dx-tag { flex: none; padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--muted); font-size: 12px; font-weight: 800; white-space: nowrap; }
  .dx-tag.ok { background: var(--ok-bg); color: var(--ok); }
  .dx-tag.warn { background: var(--warn-bg); color: var(--warn); }
  .dx-tag.danger { background: var(--danger-bg); color: var(--danger); }
  .dx-tag.info { background: var(--info-bg); color: var(--info); }
  .dx-minibar { flex: 0 1 30%; min-width: 48px; height: 8px; border-radius: 8px; background: var(--line-2); overflow: hidden; }
  .dx-searchrow { padding: 0 var(--in, 16px) 10px; }
  .dx-search { width: 100%; }
  .dx-foot { display: flex; flex-direction: column; align-items: stretch; }
  button.dx-showall { margin: 6px var(--in, 16px) 4px; }

  /* bars (a godown, a category, an item, a customer ...) and facts */
  .dx-bars { display: flex; flex-direction: column; gap: 2px; margin: 0 -6px; }
  .dx-brow { display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 6px; width: 100%; height: auto; min-height: 56px; padding: 10px 6px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font-weight: inherit; text-align: left; white-space: normal; }
  div.dx-brow { min-height: 0; }
  .dx-brow-top { display: flex; align-items: baseline; gap: 10px; }
  .dx-brow-label { flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
  .dx-brow-text { flex: none; font-family: var(--font-mono); font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .dx-brow-top .dx-chev { align-self: center; margin-right: -4px; }
  .dx-fact { display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; min-height: 52px; height: auto; padding: 8px var(--in, 16px); border: 0; border-top: 1px solid var(--line-2); border-radius: 0; background: transparent; color: var(--ink); font-size: 14px; text-align: left; white-space: normal; font-weight: inherit; }
  .dx-fact-label { flex: 1 1 auto; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
  .dx-fact-val { flex: none; max-width: 55%; font-family: var(--font-mono); font-weight: 600; text-align: right; overflow-wrap: anywhere; }
  .dx-ebar { display: flex; align-items: center; gap: 12px; font-size: 14px; }
  .dx-ebar-l { flex: 0 0 38%; font-weight: 600; overflow-wrap: anywhere; }
  .dx-ebar .dx-track { flex: 1 1 auto; }
  .dx-ebar-v { flex: 0 0 5.5em; text-align: right; font-family: var(--font-mono); font-weight: 600; }
  button.dx-body-btn { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 10px; width: 100%; height: auto; padding: 4px 0; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font-weight: inherit; text-align: left; white-space: normal; }
  .dx-exp-total { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; font-family: var(--font-mono); font-size: 28px; font-weight: 600; line-height: 1.15; }
  .dx-exp-total .dx-delta { font-family: var(--font); }

  /* the buttons that open something: no tint under the pointer on a card (owner, 27 Oct 2026), a soft one on a list row, and no press-shrink on a whole row */
  button.dx-tile:hover, button.dx-step:hover, button.dx-godown:hover { border-color: var(--line-2); }
  button.dx-tile:hover { background: var(--surface); }
  button.dx-step:hover, button.dx-godown:hover { background: var(--surface-2); }
  button.dx-row:hover, button.dx-need:hover, button.dx-fact:hover, button.dx-brow:hover, button.dx-lgrow:hover, button.dx-body-btn:hover { border-color: var(--line-2); background: transparent; }
  button.dx-row:active:not(:disabled), button.dx-need:active:not(:disabled), button.dx-fact:active:not(:disabled), button.dx-brow:active:not(:disabled), button.dx-lgrow:active:not(:disabled), button.dx-body-btn:active:not(:disabled) { transform: none; background: var(--hover); }
  @media (hover: hover) {
    button.dx-tile:hover { border-color: var(--accent-line); box-shadow: var(--shadow-md); }
    button.dx-step:hover, button.dx-godown:hover { border-color: var(--accent-line); }
    button.dx-row:hover, button.dx-need:hover, button.dx-fact:hover, button.dx-brow:hover, button.dx-lgrow:hover, button.dx-body-btn:hover { background: var(--hover); }
  }

  /* the figures at the top of a detail page: tiles like the dashboard's, not buttons */
  .dx-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .dx-chip { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); }
  .dx-chip-label { font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--muted); }
  .dx-chip-val { font-family: var(--font-mono); font-size: 22px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  .dx-chip-val.long { font-size: 16px; }
  .dx-chip.ok .dx-chip-val { color: var(--ok); }
  .dx-chip.warn .dx-chip-val { color: var(--warn); }
  .dx-chip.danger .dx-chip-val { color: var(--brand-ink); }
  .dx-chip.info .dx-chip-val { color: var(--info); }
  .dx-chips > .dx-chip:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .dx-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
  @container page (min-width: 600px) {
    .dx-chips { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; }
    .dx-chips > .dx-chip:last-child:nth-child(odd) { grid-column: auto; }
    .dx-chip { padding: 16px 18px; }
    .dx-chip-val { font-size: 24px; }
    .dx-chip-val.long { font-size: 17px; }
  }
  @container page (min-width: 900px) {
    .dx-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dx-pair.w32 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
    .dx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dx-grid > .wide { grid-column: 1 / -1; }
  }
  /* a phone: one column, the strip of steps slides sideways (the only thing that does), the rows a little tighter */
  @container page (max-width: 599px) {
    .dx-card { padding: 14px; border-radius: 16px; box-shadow: none; }
    .dx-card.flush { --in: 12px; padding: 6px; }
    .dx-h { font-size: 17px; }
    .dx-nw { display: none; }
    .dx-pipe { flex-wrap: nowrap; overflow-x: auto; margin: 0 -4px; padding: 0 4px 4px; scroll-snap-type: x proximity; }
    button.dx-step { flex: 0 0 132px; scroll-snap-align: start; padding: 14px; }
    .dx-step-n { font-size: 26px; }
    button.dx-tile { min-height: 140px; padding: 14px 16px; box-shadow: none; }
    .dx-tile-val { font-size: 22px; }
    .dx-row { gap: 10px; }
    .dx-minibar { flex-basis: 56px; min-width: 40px; }
    .dx-ebar-l { flex-basis: 34%; }
    .dx-donutbox { justify-content: center; }
    .dx-lglist { flex-basis: 100%; }
    .dx-exp-total { font-size: 24px; }
  }
  @media (forced-colors: active) {
    .dx-card, .dx-chip, button.dx-tile, button.dx-step, button.dx-godown { border: 1px solid CanvasText; }
    .dx-fill, .dx-mk, .dx-area, .dx-line, .dx-seg { forced-color-adjust: none; }
  }

  /* the dashboard steps: one row of five wherever there is room (Fold open, tablets), not three and two */
  
  @media (forced-colors: active) { .job, .wh-step1, .job-rows { border: 2px solid CanvasText; } .job-icon, .job-count, .wh-step1-n, .wh-step1-go, .truck-line-go { forced-color-adjust: none; } }

  /* ==========================================================================================================================================
     Item Name Redesign Across Whole App (bigger font & single line while adding entries and viewing items everywhere)
     ========================================================================================================================================== */
  .item-line-head { display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; font-size: 16px; font-weight: 700; line-height: 1.3; color: var(--ink); }
  .item-line-head::-webkit-scrollbar { display: none; }
  .item-line-head > .item-thumb, .item-line-head > .code-tag, .item-line-head > .brand-tag { flex: 0 0 auto; }
  .item-title-text { font-size: 16px; font-weight: 700; white-space: nowrap; color: var(--ink); letter-spacing: 0.01em; }
  .item-cell-body, .bc-head-main { min-width: 0; flex: 1 1 0; }
  .bill-grid td.item, td.item { min-width: 340px; font-size: 16px; font-weight: 700; }
  .bill-grid input { width: 64px; padding: 0 5px; }
  .bill-grid input[aria-label=mm], .bill-grid input[aria-label=pcs] { width: 46px; }
  .bill-grid input[aria-label=widthM], .bill-grid input[aria-label=heightM] { width: 54px; }
  .bill-grid .ft-in { min-width: 58px; max-width: 72px; }
  .bill-card .bc-head { font-size: 16px; font-weight: 700; align-items: center; }
  .results button { align-items: center; }
  .results .res-name { font-size: 16px; font-weight: 700; white-space: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; color: var(--ink); }
  .results .res-name::-webkit-scrollbar { display: none; }
  .ll-row { grid-template-columns: 26px 64px minmax(0, 1fr) 86px 128px 40px; }
  @container page (max-width: 620px) { .ll-row { grid-template-columns: 52px 92px minmax(0, 1fr) 44px; grid-template-areas: "sl name name end" "rack pcs slot slot"; } }
  .ll-name { font-size: 16px; font-weight: 700; min-width: 0; }
  .ir-name { font-size: 16.5px !important; font-weight: 700 !important; white-space: nowrap !important; overflow-x: auto !important; overflow-y: hidden !important; display: block !important; -webkit-line-clamp: unset !important; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .ir-name::-webkit-scrollbar { display: none; }
   .verify-row .v-name, .cs-name, .audit-name, .more-line > span:first-child { font-size: 16px; font-weight: 700; white-space: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
   .verify-row .v-name::-webkit-scrollbar, .cs-name::-webkit-scrollbar, .audit-name::-webkit-scrollbar, .more-line > span:first-child::-webkit-scrollbar { display: none; }
  /* the places filter: a box that opens a list with a search line and ticks (placePicker in JsTrips.html) */
  .place-pick { position: relative; min-width: 0; }
  .place-pick-btn { display: inline-flex; align-items: center; gap: 8px; width: 100%; min-width: 180px; max-width: 280px; justify-content: flex-start; font-weight: 600; }
  .place-pick-btn .icon { width: 16px; height: 16px; flex: 0 0 auto; opacity: .7; }
  .place-pick-label { flex: 1 1 auto; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .place-pick-caret { flex: 0 0 auto; opacity: .7; }
  .place-pick-btn.on { border-color: var(--ink); background: var(--accent-soft); }
  .place-pick-panel { position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; width: 300px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-md); padding: 10px; }
  .place-pick-panel[hidden] { display: none; }
  .place-pick-panel input[type=search] { width: 100%; margin-bottom: 8px; }
  .place-pick-list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
  .place-pick-row { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 8px; border-radius: 10px; cursor: pointer; font-weight: 600; }
  .place-pick-row:hover, .place-pick-row.on { background: var(--surface-2); }
  .place-pick-row .chip-n { font-size: 12px; opacity: .7; font-weight: 500; }
  .place-pick-foot { justify-content: flex-end; margin-top: 8px; border-top: 1px solid var(--line-2); padding-top: 8px; }
  /* no sideways scrolling anywhere (owner, 10 Nov 2026): a long name runs on to the next line instead of scrolling inside its box,
     and the bill table fits the page (a page too narrow for it shows the cards, JsBills narrow()) */
  .item-line-head, .item-title-text, .results .res-name, .verify-row .v-name, .cs-name, .audit-name, .more-line > span:first-child { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
  .item-line-head { flex-wrap: wrap; row-gap: 2px; }
  .ir-name { white-space: normal !important; overflow: visible !important; overflow-wrap: anywhere; }
  table.bill-grid { min-width: 0; }
  .bill-grid th { white-space: normal; line-height: 1.2; }
  .bill-grid td.item, .bill-grid.no-rates td.item { min-width: 200px; width: 34%; }
  .bill-grid input, .bill-grid input[aria-label=mm], .bill-grid input[aria-label=pcs], .bill-grid input[aria-label=widthM], .bill-grid input[aria-label=heightM] { width: 100%; min-width: 46px; max-width: 72px; }
  .bill-grid td.rate-on input { min-width: 54px; }
  .bill-grid .ft-in { min-width: 50px; max-width: 70px; }
  .bill-grid td.ro, .bill-grid td.amt { font-size: 12.5px; }
  /* with a mouse, the entry under the pointer gets a green border (owner, 10 Nov 2026): items, bookings, quotations, loading lists, every list row and card.
     An outline, so nothing moves; never on a phone or a tablet's finger. */
  @media (hover: hover) and (pointer: fine) {
    tbody tr:hover, .item-row:hover, .doc-card:hover, .rcard:hover, .trip-card:hover, .truck-card:hover, .td-card:hover, .user-card:hover, .party-pick-row:hover, .party-box:hover, .ll-row:hover, .ph-row:hover, .bill-card:hover, .check-row:hover, .verify-row:hover, .more-line:hover, .audit-card:hover, .job-row:hover, .job:hover, button.card:hover, .tile:hover, .kpi.clickable:hover, button.dx-tile:hover, button.dx-row:hover, button.dx-brow:hover, button.dx-lgrow:hover, button.dx-step:hover, button.dx-godown:hover, button.dx-need:hover, .cmdk-item:hover, .results button:hover {
      outline: 2px solid var(--ok); outline-offset: -2px;
    }
  }

/* ==========================================================================================================================================
     The phone design (owner, 4 Nov 2026). Everything is inside one media query: a window of 600 px or wider never reads a line of this.
     Type: 28 big figure / 20 heading / 17 title / 15 text / 13 small, ordinary sentence capitals, weight 400 for text, 600 only where something matters.
     Space: 16 px gutter, 8 / 12 / 16 / 24 steps. One level of surface: a list is rows on one card, never a card inside a card.
     Item names and typed text stay in capitals because that is how they are stored.
     ========================================================================================================================================== */
  @media (max-width: 599.98px) {
    :root { --font-mono: var(--font); --gutter: 16px; --ctl-h: 46px; --ph-top: calc(52px + var(--safe-top)); --tabbar-h: calc(58px + var(--safe-bottom)); --ph-r: 14px; }
    /* only an iPhone needs the clock kept clear by hand: on Android the system already keeps its bars out of the app */
    .is-standalone:not(.is-ios) { --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px); }
    :root:not([data-theme="dark"]) { --ph-page: #F2F2EF; }
    html { scroll-behavior: auto; }
    html, body { overscroll-behavior: none; } /* a sideways swipe moves between tabs; it must never make the browser go Back */

    /* ---- type ---- */
    html, body { font-size: 15px; font-weight: 400; line-height: 1.4; letter-spacing: 0; }
    body, button, input, select, textarea, .btn, svg text, input::placeholder, textarea::placeholder { text-transform: none; }
    body, h1, h2, h3, .page-title, #page-title { letter-spacing: 0; }
    .section-title, th, .nav-title, .sc-label, .sd-done-title, .te-band > div span, .te-sum-total span, .td-figs span, .ex-band span, .k-label, label, .field > label { text-transform: none; letter-spacing: 0; }
    strong, b { font-weight: 600; }
    h2 { font-size: 20px; font-weight: 600; margin: 0 0 8px; } h3 { font-size: 17px; font-weight: 600; margin: 0 0 8px; }
    .hint, .small-text, .list-meta, .dc-meta, .page-sub { font-size: 13px; font-weight: 400; line-height: 1.35; }
    .section-title { font-size: 13px; font-weight: 600; color: var(--muted); margin: 24px 4px 8px; }
    .list-meta { color: var(--muted); margin: 12px 4px 8px; }
    label, .field > label, .field label { font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }

    /* ---- a press shows at once; a finger leaves no hover behind ---- */
    button:hover, .btn:hover { background: var(--surface); border-color: var(--line); }
    button.primary:hover, .btn.primary:hover { background: var(--accent); border-color: var(--accent); box-shadow: none; }
    button.ghost:hover, .ph-row:hover, .navlink:hover { background: transparent; border-color: transparent; }
    button.danger:hover { background: var(--danger-bg); border-color: var(--danger-line); }
    button:active:not(:disabled), .btn:active { transform: none; opacity: .62; transition: none; }
    .content.enter { animation: none; }

    /* ---- top bar: back, the page's name, its actions. Nothing else ---- */
    .top { position: sticky; top: 0; z-index: 30; min-height: var(--ph-top); gap: 2px; padding-top: var(--safe-top); padding-bottom: 0; padding-left: max(8px, var(--safe-left)); padding-right: max(4px, var(--safe-right)); background: var(--bg); border-bottom: 1px solid var(--line-2); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
    .top-title { gap: 2px; min-width: 0; flex: 1; }
    .top-title .top-brand, .nt-top, .theme-toggle, .conn-badge:not(.offline), .search-pill { display: none !important; }
    #page-title { font-size: 17px; font-weight: 600; margin: 0 0 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    body.has-top-back #page-title { margin-left: 0; }
    .top-right { gap: 0; flex: 0 0 auto; }
    .top .icon-btn { width: 42px; height: 42px; min-height: 42px; }
    .top .icon-btn .icon { width: 21px; height: 21px; }
    .top .badge { top: 3px; right: 2px; min-width: 16px; height: 16px; font-size: 10px; line-height: 16px; padding: 0 4px; }
    .ph-dots { display: inline-flex; gap: 3px; } .ph-dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; display: block; }

    /* ---- the page ---- */
    .content { padding-top: 0; padding-bottom: calc(var(--tabbar-h) + 24px); }
    body.ph-has-fab .content { padding-bottom: calc(var(--tabbar-h) + 88px); }
    .content > div > * + .page-head, .page-head { margin: 0; }
    .page-head { display: block; padding: 0; }
    .page-head.ph-same > .page-title { display: none; }
    .page-head:not(.ph-same) > .page-title { padding: 16px 0 4px; }
    .page-head:not(.ph-same) .page-sub { display: block; color: var(--muted); -webkit-line-clamp: unset; }
    .page-actions { display: flex; flex-wrap: wrap; gap: 8px; overflow: visible; padding: 0; margin: 0; }
    .page-actions::after, .page-actions.scrolls::after { display: none; }
    .page-actions:not(.ph-keep) button, .page-actions:not(.ph-keep) a.btn, .page-actions:not(.ph-keep) label.btn { display: none; }
    .page-actions.ph-keep { margin: 12px 0 0; }
    .page-actions.ph-keep button { width: 100%; }
    .back-btn { display: none !important; }

    /* ---- cards: one level ---- */
    .card { background: var(--surface); border: 0; box-shadow: none; border-radius: var(--ph-r); padding: 16px; margin: 12px 0 0; }
    .card .card { background: transparent; padding: 0; margin: 12px 0 0; border-radius: 0; }
    .card.compact, .card:has(> .toolbar) { background: transparent !important; padding: 0; box-shadow: none !important; }
    /* the search box stays in reach on a long list: a solid strip under the top bar; a page with tabs keeps only the tabs there */
    .card:has(> .toolbar):not(:has(> .toolbar select)) { position: sticky; top: var(--ph-top); z-index: 15; background: var(--bg) !important; margin: 0 calc(0px - var(--gutter)); padding: 8px var(--gutter); border-radius: 0; }
    .content:has(.seg) .card:has(> .toolbar):not(:has(> .toolbar select)) { position: static; margin: 4px 0 0; padding: 8px 0; background: transparent !important; }
    .sheet .card:has(> .toolbar), .modal-card .card:has(> .toolbar) { position: static !important; margin: 8px 0 0 !important; padding: 0 !important; background: transparent !important; }
    /* Add from load list: Tick all and Add stay at the top of the sheet while the customers scroll under them */
    .sheet .pick-bar { position: sticky; top: -20px; z-index: 3; margin: 8px -16px 0; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line-2); }
    .pick-bar { flex-wrap: wrap; gap: 8px; }
    .pick-bar button { min-height: 44px; }
    .pick-bar button.primary { flex: 1 1 0; min-width: 0; }
    .pick-sum { flex: 1 1 100%; text-align: center; white-space: normal; }
    :root:not([data-theme="dark"]) .card { box-shadow: 0 0 0 1px var(--line-2); }
    :root:not([data-theme="dark"]) .card.compact, :root:not([data-theme="dark"]) .card .card { box-shadow: none; }
    .kpi { border: 0; box-shadow: none; border-radius: var(--ph-r); padding: 14px; }
    .kpi .k-label { font-size: 13px; font-weight: 500; } .kpi .k-value { font-size: 24px; font-weight: 600; line-height: 1.15; } .kpi .k-sub { font-size: 12px; font-weight: 400; line-height: 1.3; }

    /* ---- controls ---- */
    input, select, textarea { font-size: 16px; font-weight: 400; border-radius: 12px; min-height: var(--ctl-h); }
    input:focus, select:focus, textarea:focus { box-shadow: none; }
    :focus-visible { outline-width: 2px; outline-offset: 0; }
    button, .btn { font-size: 15px; font-weight: 500; min-height: var(--ctl-h); border-radius: 12px; padding: 0 16px; }
    /* a long name on a button runs on to a second line: it never leaves the card */
    button, .btn { white-space: normal; line-height: 1.2; }
    .seg-btn, .ph-fab, button.ph-chip, .tabbar button { white-space: nowrap; }
    button.small, .btn.small { min-height: 38px; font-size: 14px; font-weight: 500; padding: 0 12px; border-radius: 10px; }
    button.primary, .btn.primary { font-weight: 600; box-shadow: none; }

    /* ---- tabs: words with a line under the chosen one, flush to the top bar, always in reach ---- */
    .seg, .seg.seg-many { display: flex; position: sticky; top: var(--ph-top); z-index: 20; width: auto; max-width: none; margin: 0 calc(0px - var(--gutter)); padding: 0 8px; gap: 0; border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0; background: var(--bg); box-shadow: none; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .seg .seg-thumb { display: none !important; }
    div:has(> .seg:only-child) { display: contents; } /* a box around the tabs would stop them staying under the top bar */
    .seg > button, .seg-btn, .seg.seg-many .seg-btn { flex: 0 0 auto; min-height: 46px; padding: 0 12px; font-size: 14px; font-weight: 500; color: var(--muted); background: none !important; border: 0 !important; border-radius: 0; box-shadow: none !important; outline: 0; display: inline-flex; gap: 6px; }
    .seg:not(.seg-many) .seg-btn { flex: 1 1 0; }
    .seg-btn[aria-selected="true"], .seg.seg-many .seg-btn[aria-selected="true"] { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--brand) !important; }
    .seg-badge { position: static; min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; font-weight: 600; line-height: 18px; border-radius: 9px; background: var(--accent-soft); color: var(--ink); box-shadow: none; }

    /* ---- search with one filter button beside it ---- */
    .toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
    .toolbar.ph-bar { flex-wrap: nowrap; align-items: center; }
    .toolbar input[type=search], .toolbar > :first-child { flex: 1 1 0; min-width: 0; width: auto; }
    .toolbar.no-fold { display: block; }
    .toolbar.no-fold > input[type=search], .toolbar.no-fold > :first-child { display: block; width: 100%; }
    .ph-strip { display: flex; gap: 8px; margin: 8px calc(0px - var(--gutter)) 0; padding: 0 var(--gutter) 2px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .ph-strip > * { flex: 0 0 auto; margin: 0; }
    .ph-strip select, .ph-strip input { flex: 0 0 auto; width: auto !important; min-width: 136px; max-width: 200px; min-height: 40px; }
    .ph-strip select.ph-on { border-color: var(--ink); font-weight: 600; }
    .sheet .ph-strip { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
    .ph-hold { display: none; }
    .toolbar.ph-bar > button.ghost { display: none; }
    .sheet .ph-hold { display: flex; flex-direction: column; gap: 12px; }
    .sheet .ph-hold > * { width: 100%; max-width: none; }
    .ph-filter { position: relative; flex: 0 0 auto; width: var(--ctl-h); padding: 0; }
    .ph-filter .filter-count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; line-height: 18px; font-size: 11px; border-radius: 9px; background: var(--brand); color: #fff; padding: 0 4px; }
    .card:has(> .toolbar + .filter-panel) { display: flex; gap: 8px; align-items: center; }
    .card:has(> .toolbar + .filter-panel) > .toolbar { flex: 1 1 0; min-width: 0; }
    .filter-panel { margin: 0; flex: 0 0 auto; }
    .card:has(> .toolbar) button.small.filter-toggle { font-size: 0; gap: 0; width: var(--ctl-h); min-height: var(--ctl-h); padding: 0; position: relative; border-radius: 12px; }
    .card:has(> .toolbar) button.small.filter-toggle .filter-count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; line-height: 18px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; }
    .filter-body { display: flex; flex-direction: column; gap: 12px; }
    .sheet .filter-body .row { flex-direction: column; align-items: stretch; gap: 12px; }
    .sheet .filter-body select, .sheet .filter-body input:not([type=checkbox]) { width: 100%; }
     .check-row { font-size: 15px; font-weight: 400; color: var(--ink); min-height: 40px; }

    /* ---- entries in a list ---- */
    .doc-wrap, .doc-card { margin: 0; }
    .doc-card { background: var(--surface); border: 0; border-radius: var(--ph-r); box-shadow: none; padding: 14px 8px 14px 16px; margin-top: 8px; gap: 8px; align-items: flex-start; }
    :root:not([data-theme="dark"]) .doc-card { box-shadow: 0 0 0 1px var(--line-2); }
    .dc-top { gap: 8px; align-items: center; }
    .dc-no { font-size: 15px; font-weight: 600; }
    .dc-tag { font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 6px; text-transform: none; letter-spacing: 0; }
    .dc-title { font-size: 15px; font-weight: 400; margin-top: 2px; line-height: 1.3; }
    .dc-meta { margin-top: 4px; color: var(--muted); }
    .doc-card .row-btns { flex-wrap: nowrap; gap: 0; }
    .doc-card button.small { background: none; border: 0; color: var(--muted); padding: 0 8px; }
    .x-btn { color: var(--muted) !important; }
    .pill { font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: 0; }

    /* ---- an item: what it is on the left, what can be sold on the right ---- */
    .item-list { display: block; background: var(--surface); border-radius: var(--ph-r); margin-top: 8px; overflow: hidden; }
    :root:not([data-theme="dark"]) .item-list { box-shadow: 0 0 0 1px var(--line-2); }

    /* what opens under a row sits on the same card */
    .row-more, .row-more .card, .row-more .table-wrap, .row-more .ph-table { background: transparent !important; box-shadow: none !important; }

    /* ---- a table: rows on one card ---- */
    .ph-table { background: var(--surface); border-radius: var(--ph-r); margin-top: 8px; overflow: hidden; }
    :root:not([data-theme="dark"]) .ph-table { box-shadow: 0 0 0 1px var(--line-2); }
    .ph-tr { padding: 12px 16px; border-top: 1px solid var(--line-2); }
    .ph-tr:first-child { border-top: 0; }
    .ph-tr.row-link:active { background: var(--hover); }
    .ph-tr-main { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 12px; }
    .ph-tr-body { flex: 1 1 0; min-width: 150px; }
    .ph-tr-title { display: flex; align-items: baseline; gap: 8px; font-size: 14px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
    .ph-tr-title > * { min-width: 0; }
    .ph-tr-lead { flex: 0 0 auto; color: var(--muted); font-weight: 400; }
    .ph-tr-title.stacked { display: block; }
    .ph-tr-title.stacked .ph-tr-lead { display: block; margin-bottom: 2px; }
    .ph-tr-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; margin-top: 4px; font-size: 13px; }
    .ph-fact .k { color: var(--muted); }
    .ph-fact input, .ph-fact select { min-height: 40px; width: 88px; }
    .ph-tr-num { flex: 0 1 auto; max-width: 100%; margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
    .ph-tr-num strong { display: block; font-size: 17px; font-weight: 600; line-height: 1.2; }
    .ph-tr-num span { display: block; font-size: 12px; color: var(--muted); }
    .ph-tr-num strong.long { font-size: 14px; font-weight: 500; }
    .ph-tr-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px; margin: 4px -8px -4px 0; }
    .ph-tr-acts .row { gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
    .ph-tr-acts button.small:not(.primary):not(.danger) { background: none; border: 0; color: var(--muted); padding: 0 10px; }
    .ph-tr-acts .icon-btn { width: 38px; height: 38px; min-height: 38px; color: var(--muted); }
    .card .ph-table, .card .item-list { background: transparent; box-shadow: none !important; margin: 8px -16px -16px; border-radius: 0; border-top: 1px solid var(--line-2); }

    /* ---- a customer picked for a loading list, and a customer's own block on a list ---- */
    .party-pick-row { display: flex; align-items: flex-start; gap: 12px; }
    .party-tick { flex: 0 0 auto; padding-top: 2px; }
    .party-box { display: block; width: 100%; min-height: 0; padding: 0; background: none; border: 0; text-align: left; font-weight: 400; }
    .party-box:hover { background: none; border: 0; }
    .party-box > div { min-width: 0; }
    .between { flex-wrap: wrap; gap: 8px; }
    .party-actions { flex-wrap: wrap; }
    .party-actions button { max-width: 100%; text-align: center; }
    .seg ~ div > .hint:first-child, .seg ~ .hint { margin-top: 12px; }

    /* ---- the order book: a customer is one card, its name and what is left, nothing boxed inside ---- */
    .book-head { display: block; padding: 0; margin: 0; border: 0; background: none; box-shadow: none; }
    .book-head.party-pick-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 12px; }
    .book-head.party-pick-row > .party-box { flex: 1 1 calc(100% - 56px); min-width: 0; }
    .book-head.party-pick-row > .book-head-acts { flex-basis: 100%; justify-content: flex-end; }
    .book-head > *, .book-head .row-link { border: 0; background: none; box-shadow: none; padding: 0; margin: 0; border-radius: 0; }
    .book-head-acts { display: flex; justify-content: flex-end; gap: 4px; margin: 4px -8px -8px 0 !important; }
    .book-head-acts button.small { background: none; border: 0; color: var(--muted); }
    .book-acts button.small { background: none; border: 0; color: var(--muted); }
    .ph-tr-acts:empty { display: none; }

    /* ---- the round button: what this page makes ---- */
    .ph-fab { position: fixed; z-index: 25; right: calc(16px + var(--safe-right)); bottom: calc(var(--tabbar-h) + 16px); min-height: 52px; padding: 0 20px 0 16px; border-radius: 26px; border: 0; gap: 8px; background: var(--accent); color: var(--on-ink); font-size: 15px; font-weight: 600; box-shadow: var(--shadow-md); }
    .ph-fab:hover { background: var(--accent); }
    .ph-fab .icon { width: 20px; height: 20px; }
    body.ph-form .ph-fab { display: none; }

    /* ---- a form takes the whole screen; its main button sits at the foot ---- */
    body.ph-form .tabbar { display: none; }
    body.ph-form .content { padding-bottom: calc(96px + var(--safe-bottom)); }
    .sticky-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 26; margin: 0; padding: 8px 16px calc(8px + var(--safe-bottom)); background: var(--bg); border: 0; border-top: 1px solid var(--line-2); border-radius: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
    .sticky-actions .row { display: flex; flex-wrap: nowrap; gap: 8px; margin: 0; }
    .sticky-actions button { flex: 1 1 0; min-width: 0; min-height: 48px; }
    .sticky-actions button.primary { flex: 2 1 0; }
    .sticky-actions .ph-over { display: none !important; }
    .sticky-actions .ph-foot-more { flex: 0 0 48px !important; width: 48px; max-width: 48px; padding: 0; }
    .total-bar { font-size: 14px; margin-bottom: 8px; }

    /* ---- sheets and dialogs both rise from the bottom, where the thumb is ---- */
    .backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(0,0,0,.45); }
    .backdrop, body.has-tabbar .backdrop { padding-bottom: 0; }
    .backdrop:not(.sheet-wrap):not(.photo-view) > .modal-card { margin: auto 0 0; }
    .res-foot { display: none; }
    .backdrop:not(.sheet-wrap):not(.photo-view) { padding: 0; align-items: flex-end; justify-content: stretch; }
    .modal-card, .sheet, .sheet.wide { width: 100%; max-width: none; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; border-radius: 16px 16px 0 0; padding: 20px 16px calc(16px + var(--safe-bottom)); box-shadow: none; }
    /* a sheet lays itself out by its own width, like a page: without this, everything inside one kept the columns of a wide screen */
    .modal-card, .sheet, .sheet.wide { container-name: page; container-type: inline-size; }
    .sheet > *, .modal-card > * { flex-shrink: 0; }
    .sheet .cs-list { max-height: none; overflow: visible; }
    .modal-card > h3:first-child, .sheet > h3:first-child { font-size: 17px; }

    /* ---- a line of a loading list: the name has the whole width, its boxes under it ---- */
    .ll-grid { gap: 0; margin-top: 8px; }
    .ll-headrow { display: none !important; }
    .ll-row, .ll-pick .ll-row { grid-template-columns: 20px minmax(0, 1fr) 84px 104px 36px; grid-template-areas: "sl name name name end" ". rack pcs slot slot"; gap: 8px; padding: 12px 0; border: 0; border-top: 1px solid var(--line-2); border-radius: 0; background: none; align-items: center; }
    .ll-row > .ll-sl, .ll-row > .ll-name, .ll-row > .ll-end { align-self: start; padding-top: 0; }
    .ll-row > .ll-rack, .ll-row > .ll-pcs { padding-top: 0; }
    .ll-sl { font-weight: 400; font-size: 13px; line-height: 1.4; }
    .ll-name { font-size: 14px; font-weight: 500; line-height: 1.3; }
    .ll-rack { font-size: 13px; color: var(--muted); }
    .ll-pcs input, .ll-slot input { min-height: 44px; padding: 0 8px; }
    .ll-slot input { font-weight: 500; }
    .ll-end button { width: 36px; height: 36px; min-height: 36px; padding: 0; }
    .ll-party { margin: 16px 0 0; padding: 10px 12px; font-size: 14px; border-left-width: 4px; border-radius: 10px; }
    .ll-party strong { font-size: 15px; font-weight: 600; letter-spacing: 0; }
    .modal-actions, .row.tight.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
    .modal-actions button { flex: 1 1 0; min-height: 48px; }
    .sheet > .modal-actions:last-child { margin: 16px -16px calc(-16px - var(--safe-bottom)); padding: 8px 16px calc(8px + var(--safe-bottom)); bottom: calc(-16px - var(--safe-bottom)); background: var(--surface); }
    .ph-rows { display: flex; flex-direction: column; margin: 4px -16px 0; }
    .ph-row { width: 100%; min-height: 52px; justify-content: flex-start; gap: 14px; padding: 0 16px; background: none; border: 0; border-top: 1px solid var(--line-2); border-radius: 0; font-size: 16px; font-weight: 400; white-space: normal; text-align: left; }
    .ph-row:first-child { border-top: 0; }
    .ph-row svg { width: 20px; height: 20px; color: var(--muted); flex: 0 0 auto; }
    .ph-note { font-size: 13px; color: var(--muted); line-height: 1.4; margin-bottom: 8px; }

    /* ---- tab bar ---- */
    .tabbar { background: var(--surface); border-top: 1px solid var(--line-2); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; padding: 0 0 var(--safe-bottom); }
    .tabbar-inner { padding: 0; gap: 0; }
    .tabbar button { min-height: 58px; gap: 2px; font-size: 11px; font-weight: 500; border-radius: 0; color: var(--muted); }
    .tabbar button.active { color: var(--ink); font-weight: 600; }
    .tabbar button.active::before { display: none; }
    .tabbar button.active .icon { color: var(--brand); transform: none; }
    .tabbar button .icon { width: 23px; height: 23px; }

    /* ---- the More page, menus ---- */
    .user-card-box { margin-top: 16px; }
    .nav-list { padding: 0; overflow: hidden; }
    .navlink.big { min-height: 52px; padding: 0 16px; font-size: 15px; font-weight: 400; border-radius: 0; border: 0; border-top: 1px solid var(--line-2); gap: 14px; }
    .navlink.big:first-child { border-top: 0; }
    .navlink.big .icon:not(.trail) { color: var(--muted); }

    /* ---- the warehouse home: big jobs, plain ---- */
    .hello { padding-top: 16px; }
    .hello h2 { font-size: 20px; margin-bottom: 2px; }
    .hello .page-sub { display: block; color: var(--muted); }
    .wh-q { font-size: 15px; font-weight: 600; margin: 24px 0 8px; text-transform: none; }
    .wh-q-sm { font-size: 13px; color: var(--muted); }
    .job-grid { gap: 8px; }
    .job { min-height: 112px; padding: 14px; gap: 2px; background: var(--surface); border: 0; border-radius: var(--ph-r); box-shadow: none; }
    :root:not([data-theme="dark"]) .job { box-shadow: 0 0 0 1px var(--line-2); }
    .job:hover { background: var(--surface); }
    .job-icon { width: 38px; height: 38px; border-radius: 10px; margin-bottom: 8px; }
    .job-icon .icon { width: 21px; height: 21px; stroke-width: 2; }
    .job-label { font-size: 16px; font-weight: 600; line-height: 1.2; }
    .job-sub { font-size: 13px; }
    .job-count { top: 12px; right: 12px; min-width: 24px; height: 24px; font-size: 13px; font-weight: 600; line-height: 24px; padding: 0 7px; border-radius: 12px; }
    .job-rows { border: 0; border-radius: var(--ph-r); }
    .truck-line-go { background: var(--accent); color: var(--on-ink); font-weight: 600; font-size: 14px; border-radius: 10px; }

    /* ---- the owner's home ---- */
    .ph-home { padding-top: 16px; }
    .ph-hello h2 { font-size: 22px; font-weight: 600; line-height: 1.2; margin: 0; }
    .ph-date { font-size: 13px; color: var(--muted); margin-top: 2px; }
    .ph-lookup { width: 100%; justify-content: flex-start; gap: 10px; margin-top: 16px; min-height: 48px; border-radius: 14px; color: var(--muted); font-weight: 400; background: var(--surface); border: 1px solid var(--line-2); }
    .ph-lookup:hover { background: var(--surface); }
    .ph-lookup .icon { width: 20px; height: 20px; }
    .ph-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin: 16px -4px 8px; }
    .ph-q { flex-direction: column; gap: 6px; min-height: 76px; padding: 4px 0; background: none; border: 0; font-size: 12px; font-weight: 500; white-space: normal; line-height: 1.2; }
    .ph-q:hover { background: none; }
    .ph-q-ic { width: 48px; height: 48px; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: var(--surface); color: var(--brand-ink); }
    :root:not([data-theme="dark"]) .ph-q-ic { box-shadow: 0 0 0 1px var(--line-2); }
    .ph-q-ic .icon { width: 22px; height: 22px; }
    .dx-nt { display: block; }
    .dx-nt::first-letter { text-transform: uppercase; }
    .dx-need { min-height: 52px; }

    /* a row of a dashboard page: its figures go under the name when there is no room beside it */
    .dx-row { flex-wrap: wrap; row-gap: 4px; }
    .dx-main { flex: 1 1 55%; min-width: 150px; }
    .dx-right { max-width: 100%; }
    .dx-title { font-weight: 500; }

    .sb-seg { min-width: fit-content; white-space: nowrap; overflow: visible; }

    /* ---- filters in use: chips under the search ---- */
    .place-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .place-chips button.chip { flex: 0 0 auto; white-space: nowrap; }
    .ph-chips { display: flex; gap: 8px; overflow-x: auto; margin: 8px calc(0px - var(--gutter)) 0; padding: 0 var(--gutter); }
    button.ph-chip { flex: 0 0 auto; min-height: 34px; padding: 0 8px 0 12px; gap: 4px; border-radius: 17px; font-size: 13px; font-weight: 500; background: var(--accent-soft); border: 0; color: var(--ink); }
    button.ph-chip:hover { background: var(--accent-soft); }
    .ph-chip .icon { width: 14px; height: 14px; color: var(--muted); }
    .ph-tel { display: inline-flex; align-items: center; min-height: 40px; margin: -10px 0; color: var(--info); text-decoration: none; }
    .ph-tel, .table-wrap td a.ph-tel { padding: 0 2px; }

    .toast { pointer-events: none; }

    /* ---- pull to refresh ---- */
    .ph-ptr { position: fixed; z-index: 28; left: 50%; top: calc(var(--ph-top) - 36px); width: 36px; height: 36px; margin-left: -18px; border-radius: 50%; display: none; align-items: center; justify-content: center; background: var(--surface); color: var(--muted); box-shadow: var(--shadow-md); }
    .ph-ptr.on { display: flex; }
    .ph-ptr.armed { color: var(--brand); }
    .ph-ptr .icon { width: 18px; height: 18px; }
    .ph-ptr.busy { transition: transform .2s ease; }
    .ph-ptr.busy .icon { animation: ph-spin .7s linear infinite; }
    @keyframes ph-spin { to { rotate: 360deg; } }

    /* ---- movement: short, and a press never waits for it ---- */
    .content { view-transition-name: none; }
    .content.enter { animation: ph-fade .13s ease-out; }
    @keyframes ph-fade { from { opacity: .35; } to { opacity: 1; } }
    .ph-fab span { max-width: 180px; overflow: hidden; white-space: nowrap; transition: max-width .22s cubic-bezier(.22,1,.36,1), opacity .15s ease; }
    .ph-fab { transition: padding .22s cubic-bezier(.22,1,.36,1); }
    body.ph-reading .ph-fab { padding: 0 16px; gap: 0; }
    body.ph-reading .ph-fab span { max-width: 0; opacity: 0; }
    .sheet::before, .modal-card::before { content: ''; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--accent-line); margin: -10px auto 12px; flex-shrink: 0; }
    @media (prefers-reduced-motion: reduce) { .content.enter { animation: none; } .ph-fab, .ph-fab span { transition: none; } }

    /* ---- while the keyboard is up, the page has the room ---- */
    body.ph-kb .tabbar, body.ph-kb .sticky-actions, body.ph-kb .ph-fab { display: none; }
    body.ph-kb .content { padding-bottom: 24px; }

    /* ---- search takes the whole screen ---- */
    .backdrop:has(> .cmdk):not(.sheet-wrap):not(.photo-view) { align-items: stretch; background: var(--surface); }
    .cmdk { max-width: none; width: 100%; max-height: none; height: 100dvh; border: 0; border-radius: 0; box-shadow: none; padding-top: var(--safe-top); }
    .cmdk-input-row { min-height: 56px; padding: 0 4px 0 16px; border-bottom: 1px solid var(--line-2); }
    .cmdk-input-row input { font-size: 17px; border: 0; background: none; }
    .cmdk-results { flex: 1 1 auto; max-height: none; overflow-y: auto; padding-bottom: calc(16px + var(--safe-bottom)); }
    button.cmdk-item { min-height: 52px; font-weight: 400; white-space: normal; border-radius: 0; padding: 8px 16px; }

    /* ---- sign in ---- */
     .auth-card { max-width: none; }

    /* ---- item name redesign on phones: bigger font & single line ---- */
    .item-line-head { font-size: 15.5px; font-weight: 700; white-space: normal; flex-wrap: wrap; overflow: visible; }
    .item-title-text { font-size: 15.5px; font-weight: 700; white-space: normal; min-width: 0; overflow-wrap: anywhere; }
    .ll-name { font-size: 15.5px; font-weight: 700; }
    .results .res-name { font-size: 15.5px; font-weight: 700; white-space: normal; overflow: visible; }
    .bill-card .bc-head { font-size: 15.5px; font-weight: 700; }
  }

/* AI TALLY: the few pieces the stock app's design system (Styles.css, StylesPhone.css, copied unchanged) does not have.
   Same tokens: --bg, --ink, --brand, --ok, --danger, --warn, --info, --radius-*, --ctl-h. */

.key-chip, .menu-key { display: inline-block; margin-left: 8px; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line, rgba(0,0,0,.15)); font: 600 11px/1.5 var(--font, system-ui); color: var(--muted, #6b6259); background: transparent; vertical-align: middle; }
.navlink .menu-key { margin-left: auto; }
button.primary .key-chip { color: inherit; border-color: rgba(255,255,255,.45); }

.home-tiles { margin-bottom: 16px; }
.home-tile .k-value { font-variant-numeric: tabular-nums; }
.home-menu-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.home-menu-item { display: flex; align-items: center; gap: 10px; min-height: var(--ctl-h, 44px); padding: 8px 12px; border-radius: var(--radius-sm, 10px); }
.home-menu-item:hover, .home-menu-item:focus-visible { background: var(--hover, rgba(0,0,0,.05)); }
.home-menu-item .menu-key { margin-left: auto; }
.home-keys { margin-top: 12px; }

.picker { position: relative; width: 100%; min-width: 0; }
.picker > input, .voucher-form .bill-grid .picker > input { width: 100% !important; min-width: 0; }
.pick-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); max-height: 320px; overflow: auto; background: var(--surface, #fff); border: 1px solid var(--line, rgba(0,0,0,.12)); border-radius: var(--radius-md, 14px); box-shadow: 0 12px 32px rgba(0,0,0,.16); padding: 4px; min-width: 280px; }
.pick-list .res-head, .pick-list .res-foot { display: flex; justify-content: space-between; padding: 6px 10px; font-size: 12px; color: var(--muted, #6b6259); position: sticky; background: inherit; }
.pick-list .res-head { top: 0; } .pick-list .res-foot { bottom: 0; border-top: 1px solid var(--line, rgba(0,0,0,.08)); }
.pick-line { display: flex; justify-content: space-between; gap: 12px; width: 100%; text-align: left; min-height: 40px; padding: 6px 10px; border: 0; background: transparent; border-radius: 8px; }
.pick-line.kb-on, .pick-line:hover { background: var(--hover-strong, rgba(211,58,44,.10)); }
.item-stock { margin-top: 4px; font-size: 12px; }

.voucher-form .v-head .row { align-items: end; }
.v-lines-head { display: grid; grid-template-columns: 120px 1fr 170px 90px 40px; gap: 8px; padding: 0 2px 6px; }
.v-line { display: grid; grid-template-columns: 120px 1fr 170px 90px 40px; gap: 8px; align-items: start; margin-bottom: 8px; }
.v-line .money-in, .v-extra-row .money-in { text-align: right; }
.v-extra { margin-top: 10px; }
.v-extra-row { display: grid; grid-template-columns: 1fr 170px 40px; gap: 8px; margin-bottom: 6px; }
.v-items td { vertical-align: top; }
.voucher-form .bill-grid { width: 100%; min-width: 0; table-layout: auto; }
.voucher-form .bill-grid .v-item { width: 40%; min-width: 220px; }
.voucher-form .bill-grid select { min-width: 84px; }
.voucher-form .bill-grid input.num { width: 96px; text-align: right; }
.voucher-form .bill-grid input.gst-in { width: 64px; }
.v-amt { display: inline-block; min-width: 90px; padding-top: 10px; font-variant-numeric: tabular-nums; }
/* not enough width for the item table: each line becomes a small card, labels above the boxes */
@container page (max-width: 1100px) {
  .voucher-form .bill-grid thead { display: none; }
  .voucher-form .bill-grid, .voucher-form .bill-grid tbody { display: block; }
  .voucher-form .bill-grid tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 10px; padding: 10px 0; border-bottom: 1px solid var(--line, rgba(0,0,0,.1)); }
  .voucher-form .bill-grid td { display: block; padding: 0; border: 0; width: auto !important; min-width: 0 !important; }
  .voucher-form .bill-grid td.v-item { grid-column: 1 / -1; }
  .voucher-form .bill-grid td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted, #6b6259); margin-bottom: 2px; text-transform: uppercase; letter-spacing: .04em; }
  .voucher-form .bill-grid td.num { text-align: left; }
  .voucher-form .bill-grid input.num, .voucher-form .bill-grid select, .voucher-form .bill-grid input.gst-in { width: 100%; }
  .voucher-form .bill-grid td:last-child { align-self: end; }
}
@container page (max-width: 520px) { .voucher-form .bill-grid tr { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.v-totals .totals-panel { max-width: 420px; margin-left: auto; }
.v-totals .tb-sum, .v-totals .tb-total { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.v-totals .tb-total { font-size: 1.1em; border-top: 1px solid var(--line, rgba(0,0,0,.12)); margin-top: 4px; padding-top: 8px; }
.words { font-style: italic; }
.is-cancelled td, .is-cancelled .rv { opacity: .6; }
.voucher-form.is-cancelled .card { opacity: .85; }
.lock-tag { display: inline-flex; align-items: center; color: var(--muted, #6b6259); }
.lock-tag .icon { width: 16px; height: 16px; }
.locked-box { display: flex; gap: 6px; align-items: center; }
input:disabled, select:disabled, textarea:disabled { opacity: .75; }

.fs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fs-rows { display: flex; flex-direction: column; }
.fs-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 8px; border-radius: 8px; font-variant-numeric: tabular-nums; }
.fs-row.fs-sub { padding-left: 26px; color: var(--muted, #6b6259); font-size: .95em; }
.fs-row.fs-strong { font-weight: 700; }
.fs-row.fs-total { font-weight: 700; border-top: 2px solid var(--ink, #1A1612); margin-top: 6px; }
.fs-row.clickable:hover { background: var(--hover, rgba(0,0,0,.05)); }
.tree-name { display: inline-block; }

.db-split { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 1280px) { .db-split:has(.db-side:not(.hidden)) { grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); } .db-side { position: sticky; top: 76px; align-self: start; } }

.inbox-card { margin-bottom: 10px; }
.inbox-card .inbox-lines { margin: 8px 0; }
.inbox-card input[type=checkbox] { margin-right: 8px; width: 20px; height: 20px; vertical-align: middle; }
.inbox-card.changed { border: 1px solid color-mix(in srgb, var(--warn, #8F4A06) 45%, transparent); }

.facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 6px 0 12px; }
.fact .k { color: var(--muted, #6b6259); margin-right: 6px; font-size: .92em; }
.period-bar { flex-wrap: wrap; gap: 8px; }
.top-co { display: flex; flex-direction: column; min-width: 0; }
.top-co .top-sub { font-size: 12px; color: var(--muted, #6b6259); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-date { white-space: nowrap; }
.conn-badge.sync-err .conn-dot { background: var(--danger, #98180F); }
button.conn-badge { border: 0; cursor: pointer; }
.start-more { margin-top: 14px; flex-wrap: wrap; }
.check-line { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
.check-line input { width: 20px; height: 20px; }
.banner.ok { background: color-mix(in srgb, var(--ok, #1B6B3A) 12%, transparent); color: var(--ok, #1B6B3A); }
.banner.info { background: color-mix(in srgb, var(--info, #1F5A8A) 10%, transparent); color: var(--info, #1F5A8A); display: flex; gap: 8px; align-items: center; }
.banner { padding: 10px 12px; border-radius: var(--radius-sm, 10px); margin: 8px 0; }
.log-json { white-space: pre-wrap; word-break: break-word; font-size: 12px; max-height: 50vh; overflow: auto; background: var(--hover, rgba(0,0,0,.04)); padding: 8px; border-radius: 8px; }
.fab { display: none; }
body:has(.voucher-form) .fab, body:has(.form-watch) .fab { display: none !important; }
.print-only { display: none; }

.period-btn { white-space: nowrap; }
@media (max-width: 599.98px) {
  .key-chip, .menu-key { display: none; }
  .page-actions.ph-keep { flex-wrap: wrap; }
  .page-actions.ph-keep button { width: auto; flex: 1 1 auto; }
  .period-bar { display: flex; }
  .voucher-form { padding-bottom: 84px; }
  .voucher-form .sticky-actions { position: fixed; left: 0; right: 0; bottom: var(--tabbar-h, 58px); z-index: 25; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 8px 12px; margin: 0; background: var(--surface, #fff); border-top: 1px solid var(--line, rgba(0,0,0,.1)); }
  .voucher-form .sticky-actions button { min-height: 44px; }
  .voucher-form .sticky-actions button.primary { flex: 1 1 40%; }
  .fab { display: flex; position: fixed; right: 16px; bottom: calc(76px + var(--safe-bottom, 0px)); width: 56px; height: 56px; border-radius: 50%; align-items: center; justify-content: center; background: var(--brand, #D33A2C); color: #fff; border: 0; box-shadow: 0 8px 20px rgba(0,0,0,.25); z-index: 30; }
  .fab .icon { width: 26px; height: 26px; }
  .v-lines-head { display: none; }
  .v-line { grid-template-columns: 96px 1fr; }
  .v-line .money-in { grid-column: 1 / -1; }
  .v-extra-row { grid-template-columns: 1fr 120px 40px; }
  .fs-grid { grid-template-columns: 1fr; }
  .v-items .v-item { min-width: 0; }
  .search-pill { display: none; }
  .top-date { display: none; }
  .top-co .top-sub { display: none; }
  .pick-list { min-width: 0; }
  .home-menu-list { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .top, .tabbar, .fab, .no-print, .sticky-actions, .page-actions, .seg, .toolbar, .toast { display: none !important; }
  .layout, .main, .content { display: block !important; margin: 0 !important; padding: 0 !important; }
  .print-only { display: block; }
  #print-head { border-bottom: 2px solid #000; margin-bottom: 10px; padding-bottom: 6px; }
  #print-head .ph-co { font-size: 18pt; font-weight: 700; }
  #print-head .ph-title { font-size: 13pt; margin-top: 4px; }
  .card { box-shadow: none !important; border: 0 !important; }
  @page { size: A4; margin: 12mm; }
  body.print-a5 { } @page a5 { size: A5; }
}

/* AI TALLY: the combined look. The stock app's design system (Styles.css, StylesPhone.css) stays the base: cards, tiles, tabs, sheets,
   the sidebar and the phone design. This layer adds the keyboard side: the gateway menu with letter keys, the key rail, dense
   report tables with Dr / Cr columns, mixed case for working text. The shop's red is replaced by deep teal; no shop name or logo. */

:root {
  --brand: #0E6E78; --brand-soft: #DCEFF0; --brand-ink: #0A5961;
  --ring: 0 0 0 3px color-mix(in srgb, #0E6E78 26%, transparent);
  --key-amber: #B9820F;
  --rail-w: 188px;
}
:root[data-theme="dark"] { --brand: #4FB8C3; --brand-soft: #12312F; --brand-ink: #8DD6DE; --key-amber: #E2B44A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --brand: #4FB8C3; --brand-soft: #12312F; --brand-ink: #8DD6DE; --key-amber: #E2B44A; } }

::selection { background: color-mix(in srgb, var(--brand) 28%, transparent); }
* { scrollbar-color: color-mix(in srgb, var(--ink) 22%, transparent) transparent; }
input, textarea { caret-color: var(--brand); }
.num, td.num, .k-value, .fs-row .num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ type: mixed case, one scale, regular weight for reading
   Every word reads as written (no forced capitals); only the small column and group labels stay in spaced capitals so they
   read as labels, not text. Weights: 400 reading, 500 names, 600 headings / buttons / totals. One size step per level. */
:root {
  --t-xs: 11.5px; --t-sm: 12.5px; --t-base: 14px; --t-md: 15px; --t-lg: 17px; --t-xl: 24px;
  --w-read: 400; --w-name: 500; --w-head: 600;
}
body, button, .btn, input, select, textarea, label, h1, h2, h3, th, svg text, .seg-btn, .k-label, .navlink,
input::placeholder, textarea::placeholder { text-transform: none; }
body { letter-spacing: 0; }
th, .section-title, .nav-title, .gw-title, .res-head, .vt-key { text-transform: uppercase; }

@media (min-width: 600px) {
  body { font-weight: var(--w-read); font-size: var(--t-base); line-height: 1.5; }
  h1, h2, h3 { font-weight: var(--w-head); letter-spacing: -.01em; }
  .page-title h2, .content h2 { font-size: var(--t-xl); font-weight: var(--w-head); letter-spacing: -.018em; line-height: 1.2; }
  .page-sub { font-size: var(--t-sm); color: var(--muted); margin-top: 3px; font-weight: var(--w-read); }
  .page-head { align-items: center; margin-bottom: 16px; }
  #page-title { font-size: var(--t-md); font-weight: var(--w-head); letter-spacing: 0; line-height: 1.25; }
  .top-co .top-sub { font-size: var(--t-xs); font-weight: var(--w-name); }
  .section-title { font-size: var(--t-xs); font-weight: var(--w-head); letter-spacing: .08em; color: var(--muted); margin: 22px 2px 8px; }
  .card > .section-title:first-child { margin-top: 0; }
  label { font-size: var(--t-sm); font-weight: var(--w-name); color: var(--muted); margin-bottom: 5px; letter-spacing: 0; }
  input, select, textarea { font-size: var(--t-base); font-weight: var(--w-read); }
  button, .btn { font-size: var(--t-base); font-weight: var(--w-head); letter-spacing: 0; }
  button.small, .btn.small { font-size: var(--t-sm); }
  .hint { font-size: var(--t-sm); line-height: 1.45; font-weight: var(--w-read); }
  .card > .hint + label, .card > .hint + .field, .card .hint + .field { margin-top: 12px; }
  .navlink { font-size: var(--t-base); font-weight: var(--w-name); }
  .navlink.active, .navlink[aria-current="page"] { font-weight: var(--w-head); }
  .nav-title { font-size: var(--t-xs); }
  .seg-btn, .seg > button { font-size: var(--t-sm); font-weight: var(--w-head); }
  /* figure tiles: label above in one line, the figure, then its note; icons sit on the label's line */
  .kpi .k-label { font-size: var(--t-sm); font-weight: var(--w-name); line-height: 1.3; letter-spacing: 0; }
  .kpi .k-sub { font-size: var(--t-xs); font-weight: var(--w-read); }
  .home-tile .k-value { font-size: 22px; font-weight: var(--w-head); letter-spacing: -.01em; }
  /* the console side is sharper than the stock app's soft cards */
  .card, .kpi, .modal-card, .sheet, .table-wrap, .rcard { border-radius: 8px; }
  button, .btn, input, select, textarea { border-radius: 6px; }
}
.home-new { display: inline-flex; align-items: center; gap: 6px; }
.home-new .icon { width: 18px; height: 18px; }

/* ------------------------------------------------------------------ work area and key rail */
.work { flex: 1; min-width: 0; display: flex; align-items: stretch; }
.work > .content { flex: 1; min-width: 0; }
.key-rail { display: none; }
@media (min-width: 1180px) {
  .key-rail {
    display: flex; flex-direction: column; gap: 10px; flex: 0 0 var(--rail-w); width: var(--rail-w);
    position: sticky; top: 64px; align-self: flex-start; max-height: calc(100dvh - 64px); overflow: auto;
    padding: 14px 10px 24px; border-left: 1px solid var(--line); background: var(--surface-2);
  }
}
.rail-group { display: flex; flex-direction: column; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--line-2); }
.rail-group:last-child { border-bottom: 0; }
.rail-key {
  display: grid; grid-template-columns: 62px 1fr; align-items: center; gap: 8px; min-height: 30px; padding: 3px 8px;
  border: 0; border-radius: 6px; background: transparent; color: var(--ink); font-size: 13px; text-align: left; cursor: pointer;
}
.rail-key kbd {
  justify-self: start; padding: 1px 6px; border-radius: 4px; border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent);
  background: var(--brand-soft); color: var(--brand-ink); font: 600 11.5px/1.5 var(--font); white-space: nowrap;
}
.rail-key:hover, .rail-key:focus-visible { background: var(--hover); outline: none; }
.rail-key:focus-visible { box-shadow: var(--ring); }

/* ------------------------------------------------------------------ gateway (Home) */
.home-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 1100px) { .home-split { grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); } .home-split .home-tiles { grid-template-columns: 1fr 1fr; } }
.gateway { padding: 16px 18px 18px; }
.gw-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.gw-head h3 { margin: 0; font-size: 14px; letter-spacing: .06em; color: var(--brand-ink); }
.gw-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 6px 22px; }
.gw-title { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 6px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.gw-item { display: block; min-height: 34px; padding: 7px 10px; border-radius: 6px; font-size: 14.5px; color: var(--ink); cursor: pointer; }
.gw-key { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; font-weight: 700; color: var(--brand); }
.gw-item:hover { background: var(--hover); }
.gw-item:focus, .gw-item:focus-visible { outline: none; background: var(--brand); color: #fff; }
.gw-item:focus .gw-key { color: #fff; }
.home-tile .k-value { font-size: 22px; }

/* ------------------------------------------------------------------ dense working tables (computer) */
@media (min-width: 600px) {
  .table-wrap table { font-size: 13.5px; }
  .table-wrap th { padding: 7px 10px; font-size: 11px; }
  .table-wrap td { padding: 6px 10px; }
  .table-wrap tbody tr.row-link:focus, .table-wrap tbody tr.row-link:focus-visible { outline: none; background: var(--brand); color: #fff; }
  .table-wrap tbody tr.row-link:focus td, .table-wrap tbody tr.row-link:focus .hint { color: #fff; }
  .table-wrap tfoot td { font-weight: 700; border-top: 2px solid var(--ink); }
  .fs-row { padding: 5px 8px; font-size: 14px; }
  .fs-row.clickable:focus-visible, .fs-row.clickable:focus { outline: none; background: var(--brand); color: #fff; }
  .fs-row.clickable:focus *, .fs-row.clickable:focus-visible * { color: #fff; }
}

/* voucher entry: the item box takes its full cell (the stock grid caps inputs at a small width) */
.voucher-form .bill-grid .picker > input { max-width: none !important; min-width: 0; }
@container page (min-width: 760px) and (max-width: 1100px) {
  .voucher-form .bill-grid thead { display: table-header-group; }
  .voucher-form .bill-grid { display: table; }
  .voucher-form .bill-grid tbody { display: table-row-group; }
  .voucher-form .bill-grid tr { display: table-row; padding: 0; border: 0; }
  .voucher-form .bill-grid td { display: table-cell; padding: 6px 6px; }
  .voucher-form .bill-grid td[data-label]::before { content: none; }
  .voucher-form .bill-grid td.v-item { width: 34% !important; min-width: 200px !important; }
  .voucher-form .bill-grid input.num { width: 84px; }
  .voucher-form .bill-grid select { width: auto; min-width: 84px; }
}
/* voucher entry: the type, number and date read like a header line; Dr / Cr rows tighter */
.v-line { margin-bottom: 4px; }
.voucher-form .totals-panel .tb-total { color: var(--ink); }

/* the top bar shows where you are: company and FY under the page title */
.top-co h1 { letter-spacing: .02em; }
.top-co .top-sub { color: var(--brand-ink); }

/* phone: the stock app's phone design stays; no key rail, no key chips */
@media (max-width: 599.98px) { .key-rail { display: none !important; } .gw-cols { grid-template-columns: 1fr; } .gw-item { min-height: 44px; padding: 11px 10px; } .gw-key { text-decoration: none; } }

@media (max-width: 599.98px) { .home-split .home-tiles { order: -1; } .gw-head .hint { display: none; } .home-new { display: none !important; } .home-split { margin-top: 12px; } }


/* ------------------------------------------------------------------ tables and statements: reading weight, names a step up, totals bold */
@media (min-width: 600px) {
  .table-wrap td { font-weight: var(--w-read); }
  .table-wrap th { font-weight: var(--w-head); letter-spacing: .07em; }
  .table-wrap td.num, .table-wrap th.num { text-align: right; }
  .fs-row { font-weight: var(--w-read); }
  .fs-row:not(.fs-sub) > span:first-child { font-weight: var(--w-name); }
  .fs-row.fs-strong, .fs-row.fs-strong > span:first-child { font-weight: var(--w-head); }
}
/* the two sides of a statement are the same height and their totals sit on one line, as on paper */
.fs-grid { align-items: stretch; }
.fs-side { display: flex; flex-direction: column; }
.fs-side .fs-rows { flex: 1 1 auto; }
.fs-row.fs-total { font-weight: var(--w-head, 600); margin-top: 10px; padding-top: 9px; }
.fs-row.fs-total > span:first-child { font-weight: var(--w-head, 600); }

/* ------------------------------------------------------------------ vouchers: one keyed list, names and keys in columns */
.vt-list { display: grid; grid-template-columns: 1fr; padding: 6px; gap: 2px; }
@container page (min-width: 760px) { .vt-list { grid-template-columns: 1fr 1fr; column-gap: 10px; } }
.vt-item {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  min-height: 56px; padding: 8px 12px; margin: 0; border: 0; border-radius: 6px; background: transparent;
  color: var(--ink); text-align: left; font: inherit; cursor: pointer;
}
.vt-item:hover { background: var(--hover); }
.vt-item:focus-visible { outline: none; background: var(--brand); color: #fff; }
.vt-item:focus-visible .vt-sub, .vt-item:focus-visible .vt-icon { color: #fff; }
.vt-item:focus-visible .vt-icon { background: color-mix(in srgb, #fff 18%, transparent); }
.vt-item:focus-visible .vt-key { background: #fff; color: var(--brand-ink); border-color: #fff; }
.vt-item:disabled { opacity: .5; cursor: default; }
.vt-icon { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); }
.vt-icon .icon { width: 19px; height: 19px; }
.vt-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.vt-name { font-size: var(--t-md, 15px); font-weight: var(--w-head, 600); line-height: 1.3; }
.vt-sub { font-size: var(--t-sm, 12.5px); color: var(--muted); line-height: 1.35; font-weight: var(--w-read, 400); }
.vt-key {
  justify-self: end; min-width: 58px; text-align: center; padding: 2px 7px; border-radius: 4px;
  border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent); background: var(--brand-soft); color: var(--brand-ink);
  font: 600 11.5px/1.5 var(--font); letter-spacing: .02em; white-space: nowrap;
}
.vt-list + .section-title { margin-top: 26px; }
@media (max-width: 599.98px) { .vt-key { display: none; } .vt-item { min-height: 60px; } }

/* ------------------------------------------------------------------ the key rail: keys in one column of equal chips */
.rail-key kbd { min-width: 52px; text-align: center; }
.rail-key { font-weight: var(--w-read, 400); }

/* ------------------------------------------------------------------ start screen: teal, not the shop's red */
.auth-brand::after { background: radial-gradient(circle, color-mix(in srgb, #0E6E78 55%, transparent), transparent 65%); }
.auth-brand h1 { font-weight: 600; letter-spacing: -.02em; }

/* ------------------------------------------------------------------ motion: quick and quiet. Nothing bounces or lifts; a press dims. */
button, .btn { transition: background-color .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease; }
button:active:not(:disabled), .btn:active { transform: none; filter: brightness(.94); }
.clickable { transition: background-color .12s ease, border-color .12s ease; }
.clickable:hover, .clickable:active { transform: none; }
.job:active { transform: none; }
.modal-card, .cmdk { animation-duration: .14s; animation-timing-function: cubic-bezier(.16, 1, .3, 1); }
.sheet { animation-duration: .2s; animation-timing-function: cubic-bezier(.16, 1, .3, 1); }
.seg-thumb { transition-duration: .18s; transition-timing-function: cubic-bezier(.16, 1, .3, 1); }

/* Home tiles: one height per row and every label two lines tall, so the figures of a row sit on one line */
.home-split .home-tiles { grid-auto-rows: 1fr; }
.home-tile .k-label { min-height: calc(2 * 1.3em); display: flex; align-items: flex-start; }
.home-tile { display: flex; flex-direction: column; }
.home-tile .k-sub { margin-top: auto; padding-top: 2px; }
@media (max-width: 599.98px) { .home-split .home-tiles { grid-auto-rows: auto; } }

/* tables: short columns stay on one line; the toolbar over a report stays on one row and its search box takes the rest */
@media (min-width: 600px) { .table-wrap td.nowrap, .table-wrap th.nowrap { white-space: nowrap; } }
.toolbar.period-bar { flex-wrap: wrap; align-items: center; }
@media (min-width: 900px) {
  .toolbar.period-bar { flex-wrap: nowrap; }
  .toolbar.period-bar > input, .toolbar.period-bar > .search, .toolbar.period-bar > .picker { flex: 1 1 200px; min-width: 140px; }
  .toolbar.period-bar > select { flex: 0 1 170px; min-width: 120px; }
  .toolbar.period-bar > button { flex: 0 0 auto; white-space: nowrap; }
}
/* voucher entry: the Bill view / Accounts view switch and its note sit on one line */
.voucher-form .seg + .hint, .voucher-form .seg ~ .hint { align-self: center; margin: 0; }
.v-view { align-items: center; } .v-view > .hint { margin: 0; }
/* a row with a name and a note under it (companies, lists): the note goes on its own line */
.job-row-t { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; }
.job-row-t > .hint { margin: 0; }
.page-sub { max-width: 72ch; }

/* ------------------------------------------------------------------ the Update button (top bar) and the update card */
.update-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: 999px;
  background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; white-space: nowrap; }
.update-btn:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
.update-btn .icon { width: 16px; height: 16px; }
.update-btn.hidden { display: none; }
@media (max-width: 599.98px) { .update-btn .ub-label { display: none; } .update-btn { padding: 0 9px; } }
.update-ver { font-size: var(--t-md, 15px); margin: 2px 0 6px; }
.update-notes { white-space: pre-wrap; padding: 10px 12px; margin: 8px 0; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: var(--t-sm, 12.5px); max-height: 220px; overflow: auto; }

/* first run: "already on AI TALLY? get it from the server" sits above the new-company form */
.start-join { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 22px;
  border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent); background: var(--brand-soft); border-radius: 8px; }
.start-join .hint { margin-top: 2px; }
.start-join button { flex: 0 0 auto; }

/* a figure never breaks over two lines: it sizes itself to its tile (longer amounts a step smaller) */
.home-tile { container-type: inline-size; }
.home-tile .k-value { white-space: nowrap; font-size: min(22px, 15cqi); }
.home-tile .k-value.k-long { font-size: min(20px, 12.5cqi); }
.home-tile .k-value.k-xlong { font-size: min(18px, 10.5cqi); }
