:root {
      --bg:        #fffdf8;
      --surface:   #f5f1e9;
      --fg:        #191816;
      --muted:     #6f6c65;
      --border:    rgba(25,24,22,.14);
      --accent:    #9f2721;
      --accent-deep:#741b17;
      --accent-solid:#9f2721;
      --olive:     #596047;
      --warn:      #a16207;

      --accent-soft: color-mix(in oklch, var(--accent) 14%, transparent);
      --fg-soft:     color-mix(in oklch, var(--fg) 6%, transparent);

      --font-display: 'Manrope', system-ui, -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
      --font-body:    'DM Sans', system-ui, -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
      --font-mono:    ui-monospace, 'SF Mono', Menlo, monospace;

      --fs-h1: 26px;
      --fs-h2: 20px;
      --fs-h3: 16px;
      --fs-body: 15px;
      --fs-meta: 12px;

      --radius-card: 8px;
      --radius-pill: 999px;
    }

    *, *::before, *::after { box-sizing: border-box; }
    html, body { margin: 0; padding: 0; min-height: 100%; }
    body {
      background:
        radial-gradient(60% 80% at 50% 0%, color-mix(in oklch, var(--accent) 6%, var(--bg)) 0%, var(--bg) 60%);
      color: var(--fg);
      font-family: var(--font-body);
      font-size: var(--fs-body);
      line-height: 1.4;
      -webkit-font-smoothing: antialiased;
      display: grid;
      place-items: center;
      padding: 32px;
    }

    .stage { display: flex; flex-direction: column; align-items: center; gap: 24px; }
    .caption {
      font-family: var(--font-mono);
      font-size: 11px;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--muted);
    }
    .caption strong { color: var(--fg); font-weight: 600; }

    /* ─── device frame (iPad-style) ─────────────────────────────────── */
    .device {
      position: relative;
      width: 834px;
      height: 1194px;
      border-radius: 30px;
      padding: 16px;
      background: linear-gradient(160deg, #2a2a2c 0%, #1a1a1c 50%, #0e0e10 100%);
      box-shadow:
        0 0 0 1px rgba(255,255,255,0.04) inset,
        0 0 0 2px #000 inset,
        0 28px 60px -12px rgba(0,0,0,0.45),
        0 8px 20px -8px rgba(0,0,0,0.35);
      isolation: isolate;
    }
    .device::before, .device::after {
      content: '';
      position: absolute;
      width: 3px;
      background: linear-gradient(to bottom, transparent 0%, rgba(255,255,255,0.06) 8%, transparent 16%, transparent 84%, rgba(255,255,255,0.04) 92%, transparent 100%);
      top: 200px; bottom: 200px;
      pointer-events: none;
    }
    .device::before { left: -1px; }
    .device::after  { right: -1px; }

    /* front camera dot (iPad bezel, top centre) */
    .camera {
      position: absolute;
      top: 20px; left: 50%;
      transform: translateX(-50%);
      width: 12px; height: 12px;
      background: #000;
      border-radius: 50%;
      z-index: 5;
    }
    .camera::after {
      content: '';
      position: absolute;
      left: 3px; top: 3px;
      width: 4px; height: 4px;
      border-radius: 50%;
      background: radial-gradient(circle at 30% 30%, #2b2b33, #000);
    }

    .btn-rail { position: absolute; width: 4px; background: #0a0a0c; border-radius: 2px; }
    .btn-rail.left-1  { left: -3px; top: 300px; height: 40px; }
    .btn-rail.left-2  { left: -3px; top: 356px; height: 80px; }
    .btn-rail.left-3  { left: -3px; top: 446px; height: 80px; }
    .btn-rail.right-1 { right: -3px; top: 380px; height: 140px; }

    .screen {
      position: relative;
      width: 100%; height: 100%;
      background: var(--bg);
      border-radius: 22px;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    .appbody { flex: 1 1 auto; display: flex; min-height: 0; }

    .statusbar {
      flex: 0 0 44px;
      padding: 14px 34px 0;
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      font-family: var(--font-body);
      font-size: 15px;
      font-weight: 600;
      color: var(--fg);
      letter-spacing: -0.01em;
    }
    .statusbar .right { display: inline-flex; align-items: center; gap: 6px; }
    .statusbar svg { width: 17px; height: 11px; fill: var(--fg); }
    .statusbar .battery { width: 25px; }

    .content {
      flex: 1 1 auto;
      overflow-y: auto;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch;
      padding: 6px 0 120px;
    }
    .content::-webkit-scrollbar { display: none; }

    .home-indicator { flex: 0 0 28px; position: relative; }
    .home-indicator::after {
      content: '';
      position: absolute;
      left: 50%; bottom: 8px;
      transform: translateX(-50%);
      width: 134px; height: 5px;
      background: var(--fg);
      border-radius: 999px;
      opacity: 0.85;
    }

    /* ─── primitives ────────────────────────────────────────────────── */
    .pad     { padding-inline: 28px; }
    .stack   { display: flex; flex-direction: column; gap: 16px; }
    .row     { display: flex; align-items: center; gap: 12px; }
    .row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
    .grid-2  { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .grid-3  { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .grid-2[data-od-id="kpis"],
    [data-od-id="shortcuts"] .grid-2 { grid-template-columns: repeat(4, 1fr); }

    .header {
      padding: 10px 28px 14px;
      display: flex; align-items: center; justify-content: space-between; gap: 12px;
    }
    .header h1 {
      font-family: var(--font-display);
      font-size: var(--fs-h1);
      letter-spacing: -0.04em;
      line-height: 1.1;
      margin: 0;
      font-weight: 700;
    }
    .icon-btn {
      width: 36px; height: 36px;
      border-radius: 999px;
      background: var(--surface);
      border: 1px solid var(--border);
      display: grid; place-items: center;
      color: var(--fg);
      cursor: pointer;
      padding: 0;
      flex: 0 0 auto;
    }
    .icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; }
    .icon-btn.avatar {
      font-family: var(--font-display);
      font-weight: 700;
      font-size: 13px;
      color: var(--accent-deep);
      background: linear-gradient(135deg, var(--accent-soft), var(--fg-soft)), var(--surface);
    }
    .icon-btn.back { background: transparent; border: 0; }

    .greeting {
      font-family: var(--font-body);
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0.16em;
      text-transform: uppercase;
      color: var(--muted);
      margin: 0 0 4px;
    }

    .h2  { font-family: var(--font-display); font-size: var(--fs-h2); letter-spacing: -0.03em; font-weight: 700; line-height: 1.2; margin: 0; }
    .h3  { font-size: var(--fs-h3); font-weight: 600; line-height: 1.3; margin: 0; }
    .meta { font-family: var(--font-body); font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
    .num  { font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

    .card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius-card);
      padding: 16px;
    }
    .card.accent {
      background: var(--accent-solid);
      color: #fff;
      border-color: transparent;
    }
    .card.accent .meta { color: rgba(255,255,255,0.72); }
    .card.flat { background: transparent; border: 0; padding: 12px 0; border-top: 1px solid var(--border); border-radius: 0; }
    .card.flat:first-child { border-top: 0; padding-top: 0; }

    .list-row {
      display: grid;
      grid-template-columns: 40px 1fr auto;
      align-items: center;
      gap: 12px;
      padding: 12px 0;
      border-top: 1px solid var(--border);
    }
    .list-row:first-child { border-top: 0; }
    .avatar {
      border-radius: 50%;
      display: grid; place-items: center;
      font-family: var(--font-display);
      font-weight: 700; font-size: 13px;
      color: var(--accent-deep);
      background: linear-gradient(135deg, var(--accent-soft), var(--fg-soft)), var(--surface);
      border: 1px solid var(--border);
    }
    .list-row .avatar { width: 40px; height: 40px; }
    .list-row .body { min-width: 0; }
    .list-row .body .title { font-size: 15px; font-weight: 500; line-height: 1.25; }
    .list-row .body .sub   { color: var(--muted); font-size: 13px; line-height: 1.3; margin-top: 2px; }

    /* ─── floating navigation dock (iPad) ───────────────────────────── */
    .tabbar {
      position: absolute;
      left: 24px;
      right: 24px;
      bottom: 44px;
      z-index: 40;
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 4px;
      padding: 8px;
      border: 1px solid var(--border);
      border-radius: 24px;
      background: color-mix(in oklch, var(--surface) 92%, transparent);
      backdrop-filter: blur(20px);
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
    }
    body:has(.view-login.active) .tabbar,
    body:has(.view-loading.active) .tabbar { display: none; }
    .tab {
      display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
      padding: 8px 0;
      min-height: 56px;
      color: var(--muted);
      font-size: 11px;
      letter-spacing: 0.02em;
      cursor: pointer;
      border: 0;
      background: none;
      outline: none;
      -webkit-tap-highlight-color: transparent;
      font-family: var(--font-body);
    }
    .tab:focus, .tab:focus-visible { outline: none; }
    .tab.active { color: var(--accent); font-weight: 600; }
    .tab svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.7; }
    .tab.active svg { stroke-width: 2; }

    /* ─── buttons ───────────────────────────────────────────────────── */
    .btn-primary {
      display: flex; align-items: center; justify-content: center;
      width: 100%;
      min-height: 48px;
      padding: 14px 20px;
      background: var(--accent-solid);
      color: #fff;
      border: 0;
      border-radius: 8px;
      font: inherit;
      font-size: 15px;
      font-weight: 600;
      letter-spacing: -0.005em;
      cursor: pointer;
    }
    .autosave-hint {
      margin-top: 2px;
      padding-top: 16px;
      border-top: 1px solid var(--border);
      font-size: 13px;
      color: var(--muted);
      text-align: center;
      letter-spacing: -0.01em;
    }
    .btn-secondary {
      display: flex; align-items: center; justify-content: center;
      width: 100%;
      min-height: 48px;
      padding: 14px 20px;
      background: transparent;
      color: var(--fg);
      border: 1px solid var(--border);
      border-radius: 8px;
      font: inherit;
      font-size: 15px;
      font-weight: 500;
      cursor: pointer;
    }

    /* ─── misc brand bits ───────────────────────────────────────────── */
    .eyebrow {
      font-family: var(--font-body);
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0.16em;
      text-transform: uppercase;
      color: var(--muted);
      margin: 0;
    }
    .pill {
      display: inline-flex; align-items: center; gap: 4px;
      padding: 5px 11px;
      background: var(--accent-soft);
      color: var(--accent);
      border-radius: 999px;
      font-family: var(--font-body);
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0.1em;
      text-transform: uppercase;
    }
    .tag {
      display: inline-flex;
      padding: 3px 9px;
      background: transparent;
      color: var(--muted);
      border: 1px solid var(--border);
      border-radius: 999px;
      font-size: 11px;
      font-weight: 500;
      white-space: nowrap;
    }
    .tag.warn { color: var(--warn); border-color: color-mix(in oklch, var(--warn) 40%, transparent); background: color-mix(in oklch, var(--warn) 10%, transparent); }
    .tag.ok   { color: var(--olive); border-color: color-mix(in oklch, var(--olive) 40%, transparent); background: color-mix(in oklch, var(--olive) 10%, transparent); }
    .badge {
      display: inline-flex;
      padding: 3px 8px;
      border-radius: 6px;
      font-size: 11px;
      font-weight: 600;
      background: var(--fg-soft);
      color: var(--fg);
      white-space: nowrap;
    }
    .badge.ok   { background: #e8f5e6; color: #063516; }
    .badge.warn { background: color-mix(in oklch, var(--warn) 14%, transparent); color: var(--warn); }
    .badge.send { background: color-mix(in oklch, #2569b5 14%, transparent); color: #2569b5; }
    .badge.rec  { background: color-mix(in oklch, #1a4d96 14%, transparent); color: #1a4d96; }

    .progress-n { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
    .progress-n > span { display: block; height: 100%; }

    /* ─── KPI ───────────────────────────────────────────────────────── */
    .kpi {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius-card);
      padding: 14px;
      min-width: 0;
    }
    .kpi-label {
      display: block;
      font-family: var(--font-body);
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: var(--muted);
      line-height: 1.3;
    }
    .kpi-value {
      font-family: var(--font-display);
      font-weight: 700;
      font-size: 24px;
      letter-spacing: -0.04em;
      line-height: 1.1;
      margin: 8px 0 6px;
      font-variant-numeric: tabular-nums;
    }
    .kpi-value.accent { color: var(--accent); }
    .kpi-foot { display: flex; align-items: baseline; gap: 6px; font-size: 11px; color: var(--muted); min-width: 0; }
    .kpi-foot .delta { font-family: var(--font-display); font-weight: 700; font-size: 11px; white-space: nowrap; }
    .delta.up   { color: #2e7d32; }
    .delta.down { color: #c62828; }
    .delta.warn { color: var(--warn); }
    .kpi-stock { position: relative; }
    .kpi-stock .delta.warn { position: absolute; top: 14px; right: 14px; }
    .kpi-stock .kpi-foot > span:last-child { white-space: nowrap; }

    /* ─── section headers ───────────────────────────────────────────── */
    .sec { margin-top: 22px; }
    .sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
    .sec-title {
      font-family: var(--font-body);
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0.16em;
      text-transform: uppercase;
      color: var(--muted);
    }
    .link-btn {
      display: inline-flex; align-items: center; gap: 4px;
      border: 0; background: none; padding: 10px 6px; margin: -10px -6px;
      font: inherit; font-size: 13px; font-weight: 500;
      color: var(--muted);
      cursor: pointer;
    }
    .link-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; }

    /* ─── segmented / chips / search ────────────────────────────────── */
    .seg {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 4px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 4px;
    }
    .seg-btn {
      border: 0; background: none;
      padding: 8px 6px;
      border-radius: 6px;
      font: inherit; font-size: 13px; font-weight: 500;
      color: var(--muted);
      cursor: pointer;
      min-height: 44px;
    }
    .seg-btn.active { background: var(--bg); color: var(--fg); font-weight: 600; }

    .seg-drop { position: relative; }
    .seg-trigger {
      display: flex; align-items: center; justify-content: center; gap: 6px;
      width: 100%; text-align: center;
    }
    .seg-drop.open .seg-trigger { background: var(--bg); color: var(--fg); font-weight: 600; }
    .seg-trigger.active { background: var(--bg); color: var(--fg); font-weight: 600; }
    .seg-menu {
      position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 8px;
      box-shadow: 0 8px 24px rgba(0,0,0,0.25);
      padding: 4px;
      max-height: min(280px, 55vh);
      overflow-y: auto;
      overscroll-behavior: contain;
    }
    .seg-opt {
      display: flex; align-items: center; justify-content: space-between; gap: 8px;
      width: 100%; min-height: 44px;
      padding: 10px 12px;
      border: 0; background: none; border-radius: 6px;
      font: inherit; font-size: 13px; font-weight: 500;
      color: var(--fg); cursor: pointer; text-align: left;
    }
    .seg-opt:hover { background: var(--surface); }
    .seg-opt.active { background: var(--surface); font-weight: 600; }
    .seg-opt .tick { width: 16px; height: 16px; stroke: var(--fg); fill: none; stroke-width: 2; opacity: 0; }
    .seg-opt.active .tick { opacity: 1; }

    .search {
      display: flex; align-items: center; gap: 8px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 0 12px;
      min-height: 44px;
    }
    .search svg { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 1.8; flex: 0 0 auto; }
    .search input { border: 0; background: transparent; font: inherit; color: var(--fg); flex: 1; min-width: 0; outline: none; }

    .chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
    .chip {
      flex: 0 0 auto;
      padding: 10px 14px;
      min-height: 44px;
      border-radius: 999px;
      border: 1px solid var(--border);
      background: var(--surface);
      color: var(--fg);
      font: inherit;
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
    }
    .chip.active { background: var(--accent-solid); border-color: var(--accent-solid); color: #fff; font-weight: 600; }

    /* ─── views / router ────────────────────────────────────────────── */
    .view { display: none; }
    .view.active { display: block; }
    #view-loading.active { display: flex; align-items: center; justify-content: center; min-height: 100%; }

    .dhead {
      display: flex; align-items: center; gap: 10px;
      padding: 6px 12px 10px 16px;
    }

    .shortcut {
      display: flex; align-items: center; gap: 12px;
      padding: 14px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius-card);
      color: var(--fg);
      text-decoration: none;
      min-height: 56px;
    }
    .shortcut svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.7; flex: 0 0 auto; }
    .shortcut .sc-label { font-size: 13px; font-weight: 500; }
    .shortcut .sc-sub { font-size: 11px; color: var(--muted); }

    /* ─── switches (config) ─────────────────────────────────────────── */
    .switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
    .switch-row:first-child { border-top: 0; }
    .switch-row .ttl { font-size: 14px; font-weight: 500; }
    .switch-row .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
    .switch { position: relative; width: 46px; height: 26px; flex: 0 0 auto; }
    .switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 2; }
    .switch .track { position: absolute; inset: 0; border-radius: 999px; background: var(--border); transition: background .18s ease; }
    .switch .track::after {
      content: ''; position: absolute; top: 2px; left: 2px;
      width: 22px; height: 22px; border-radius: 50%;
      background: var(--bg);
      box-shadow: 0 1px 3px rgba(0,0,0,0.25);
      transition: transform .18s ease;
    }
    .switch input:checked ~ .track { background: var(--olive); }
    .switch input:checked ~ .track::after { transform: translateX(20px); }

    /* ─── detail extras ─────────────────────────────────────────────── */
    .warn-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in oklch, var(--warn) 12%, transparent); color: var(--warn); flex: 0 0 auto; }
    .warn-ico svg, .box-ico svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }
    .box-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--fg-soft); color: var(--muted); flex: 0 0 auto; }

    .unit-card { display: flex; gap: 14px; }
    .unit-card .u-ico { width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; background: var(--fg-soft); color: var(--fg); flex: 0 0 auto; }
    .unit-card .u-ico svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.7; }

    /* ─── toast ─────────────────────────────────────────────────────── */
    .toast {
      position: absolute;
      left: 50%; bottom: 130px;
      transform: translateX(-50%);
      background: var(--fg);
      color: var(--bg);
      font-size: 13px;
      font-weight: 500;
      padding: 12px 18px;
      border-radius: 10px;
      box-shadow: 0 8px 24px rgba(0,0,0,0.25);
      z-index: 60;
      white-space: nowrap;
      opacity: 0;
      animation: toast-in .2s ease forwards;
      pointer-events: none;
    }
    @keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

    /* ─── settings rows as dropdown triggers ───────────────────────── */
    .row-trigger {
      width: 100%;
      background: none;
      border: 0;
      padding: 0;
      font: inherit;
      color: var(--fg);
      text-align: left;
      cursor: pointer;
    }
    .row-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
    .seg-drop + .seg-drop { border-top: 1px solid var(--border); }
    .seg-drop[data-dropdown-wrap^="pref-"] .seg-menu {
      left: 52px;
      right: auto;
      width: max-content;
      min-width: 0;
      max-width: min(240px, calc(100% - 64px));
      padding: 4px;
    }
    .seg-drop[data-dropdown-wrap^="pref-"] .seg-opt {
      min-height: 34px;
      padding: 5px 12px;
      font-size: 12px;
    }
    .seg-drop[data-dropdown-wrap^="pref-"] .seg-opt .tick { width: 14px; height: 14px; }

    /* ─── custom dropdown selects ─────────────────────────────────── */
    .csel { position: relative; }
    .csel-trigger {
      width: 100%; min-height: 46px;
      display: flex; align-items: center; justify-content: space-between; gap: 8px;
      padding: 12px 14px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 8px;
      font: inherit; font-size: 14px; color: var(--fg);
      text-align: left; cursor: pointer;
    }
    .csel-trigger .seg-trigger-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .csel-trigger .chev { width: 16px; height: 16px; flex-shrink: 0; stroke: var(--muted); fill: none; stroke-width: 2; transition: transform .18s ease; }
    .csel.open .csel-trigger { border-color: var(--accent); }
    .csel.open .csel-trigger .chev { transform: rotate(180deg); }
    .csel .seg-menu { left: 0; right: 0; }
    .item-row .csel-trigger { min-height: 40px; padding: 8px 10px; background: var(--bg); font-size: 13px; }
    .item-row .csel-trigger .chev { width: 14px; height: 14px; }

    /* ─── forms ────────────────────────────────────────────────────── */
    .field { margin-bottom: 14px; }
    .field label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
    .input, .select {
      width: 100%; min-height: 46px;
      padding: 12px 14px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 8px;
      font: inherit; font-size: 14px; color: var(--fg);
      outline: none;
      -webkit-appearance: none; appearance: none;
    }
    .select {
      background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
      background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
      background-size: 5px 5px;
      background-repeat: no-repeat;
      padding-right: 34px;
    }
    input::placeholder, textarea::placeholder { color: var(--muted); }
    .input:focus, .select:focus { border-color: var(--accent); }
    .input.invalid { border-color: var(--accent); }
    .field-error { display: none; margin: 6px 0 0; font-size: 12px; color: var(--accent); }
    .field.has-error .input, .field.has-error .select { border-color: var(--accent); }
    .field.has-error .field-error { display: block; }
    .form-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 16px; }
    .check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg); cursor: pointer; }
    .check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
    .form-stack .field { margin-bottom: 12px; }
    .form-stack .field:last-child { margin-bottom: 0; }

    /* ─── login ────────────────────────────────────────────────────── */
    .login { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 10px; min-height: 100%; padding: 24px 20px 18px; }
    .login-top { display: flex; align-items: center; justify-content: center; }
    #login-theme-toggle { position: absolute; top: 24px; right: 20px; background: transparent; border-color: transparent; }
    .brand-row { display: flex; align-items: center; gap: 10px; }
    .brand-mark {
      width: 34px; height: 34px; flex: 0 0 auto;
      border-radius: 9px;
      background: var(--accent-solid);
      color: #fff;
      display: grid; place-items: center;
      font-family: var(--font-display);
      font-size: 13px; font-weight: 700; letter-spacing: -0.02em;
    }
    .brand-name { font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
    .brand-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
    .login-body { display: flex; flex-direction: column; padding: 0; }
    .login-body h1 { font-family: var(--font-display); font-size: var(--fs-h1); font-weight: 700; letter-spacing: -0.04em; margin: 8px 0 6px; }
    .login-sub { font-size: 13px; color: var(--muted); margin: 0 0 22px; }
    .demo-hint {
      display: flex; align-items: flex-start; gap: 10px;
      padding: 12px 14px; margin-top: 18px;
      background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
      font-size: 12px; color: var(--muted); line-height: 1.5;
    }
    .demo-hint svg { width: 15px; height: 15px; stroke: var(--accent); fill: none; stroke-width: 1.8; flex: 0 0 auto; margin-top: 1px; }
    .demo-hint code { font-family: var(--font-mono); font-size: 11px; color: var(--fg); }
    .login-foot { display: flex; justify-content: center; font-size: 11px; color: var(--muted); }

    /* ─── loading ──────────────────────────────────────────────────── */
    .loading { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100%; padding: 24px; gap: 18px; text-align: center; }
    .loading .brand-mark { width: 56px; height: 56px; border-radius: 16px; font-size: 20px; }
    .brand-mark.brand-logo { background: transparent; display: block; object-fit: contain; border-radius: 0; }
    .loading .ld-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
    .loading .ld-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
    .ld-bar { width: 100%; max-width: 200px; height: 4px; border-radius: 999px; background: var(--border); overflow: hidden; }
    .ld-bar > span { display: block; height: 100%; width: 0; background: var(--accent); animation: ld-fill 1.6s ease forwards; }
    @keyframes ld-fill { to { width: 100%; } }

    /* ─── order form ───────────────────────────────────────────────── */
    .sec-card { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); padding: 16px; }
    .sec-card-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
    .sec-card-sub { font-size: 12px; color: var(--muted); margin: 2px 0 14px; }
    .item-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px 0; border-top: 1px solid var(--border); }
    .item-row:first-child { border-top: 0; }
    .ir-fields { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .ir-fields input { width: 100%; min-height: 40px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 13px; color: var(--fg); outline: none; }
    .ir-fields input:focus { border-color: var(--accent); }
    .ir-remove { width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 8px; }
    .ir-remove:hover { background: var(--fg-soft); }
    .ir-remove svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; }
    .add-item-btn { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 12px; }
    .add-item-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }
    .totals-row { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 14px; margin-top: 4px; }
    .totals-row .t-label { font-size: 14px; font-weight: 600; }
    .totals-row .t-value { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

    /* ─── filters ──────────────────────────────────────────────────── */
    .f-label { display: block; font-size: 10px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
    .f-pills { display: flex; gap: 8px; flex-wrap: wrap; }

    /* ─── dark theme ───────────────────────────────────────────────── */
    .screen[data-theme="dark"] {
      color: var(--fg);
      --bg:            #191814;
      --surface:       #24221d;
      --fg:            #f4f1ea;
      --muted:         #a9a59b;
      --border:        rgba(244,241,234,.16);
      --accent:        #d9736a;
      --accent-deep:   #e88d84;
      --accent-solid:  #a83a32;
      --olive:         #8f9a7c;
      --warn:          #d99c3d;
      --accent-soft:   color-mix(in oklch, var(--accent) 22%, transparent);
      --fg-soft:       color-mix(in oklch, var(--fg) 8%, transparent);
    }
    .screen[data-theme="dark"] .delta.up   { color: #7cc17f; }
    .screen[data-theme="dark"] .delta.down { color: #ef9a9a; }
    .screen[data-theme="dark"] .badge.ok   { background: color-mix(in oklch, #7cc17f 18%, transparent); color: #7cc17f; }
    .screen[data-theme="dark"] .badge.send { background: color-mix(in oklch, #7fb0e8 18%, transparent); color: #7fb0e8; }
    .screen[data-theme="dark"] .badge.rec  { background: color-mix(in oklch, #5f8fd1 20%, transparent); color: #5f8fd1; }
