    :root {
      --bb-ink: #111721;
      --bb-ink-soft: #181E29;
      --bb-primary: #F67E0F;
      --bb-primary-hover: #DB6908;
      --bb-primary-pressed: #B95604;
      --bb-coffee: #784C1D;
      --bb-coffee-dark: #3F210C;
      --bb-copper: #A35C31;
      --bb-cream: #FFE5CD;
      --bb-off-white: #FFF7ED;
      --surface-page: #FFFAF4;
      --surface-main: #FFFFFF;
      --surface-card: #FFF1E4;
      --surface-tonal: #FADEBC;
      --surface-soft: #FCF2E4;
      --surface-nested: #F0E0CE;
      --surface-input: #FFFFFF;
      --surface-list: #FFFFFF;
      --scrim: rgba(17, 23, 33, 0.62);
      --surface-dark: #111721;
      --selection-bg: #FAECDD;
      --selection-fill: #FECC85;
      --selection-text: #3F210C;
      --touch-target-min: 48px;
      --filter-chip-visual-height: 28px;
      --text-strong: #1F0F04;
      --text: #2C1607;
      --text-muted: #7A5A3A;
      --text-soft: #86684A;
      --text-inverse: #FFF7ED;
      --text-tonal: #662C00;
      --color-on-primary: #FFFFFF;
      --state-layer-inverse-hover: rgba(255, 255, 255, 0.06);
      --text-inverse-muted: rgba(255, 247, 237, 0.72);
      --border-strong: #9A7A5A;
      --border-soft: rgba(120, 76, 29, 0.50);
      --border-chip: rgba(120, 76, 29, 0.10);
      --border-subtle: rgba(120, 76, 29, 0.11);
      --divider: rgba(120, 76, 29, 0.13);
      --focus-ring: rgba(246, 126, 15, 0.28);
      --field-error-bg: #FFF8F7;
      --access-input-inset: inset 0 0 0 1px rgba(17, 23, 33, 0.08);
      --access-error-ring: rgba(245, 184, 177, 0.28);
      --access-submit-hover: #FF932B;
      --bottom-nav-text: rgba(255, 247, 237, 0.72);
      --bottom-nav-active-text: #FFFFFF;
      --success-bg: #E7F5EC;
      --success-border: #B7DEC6;
      --success-text: #0E3D25;
      --warning-bg: #FFF3D6;
      --warning-border: #F3D28A;
      --warning-text: #5F3B00;
      --danger: #B42318;
      --danger-bg: #FDE8E5;
      --danger-border: #F5B8B1;
      --danger-text: #65120C;
      --info-bg: #E7EFFF;
      --info-border: #B8CCFF;
      --info-text: #153E96;
      --neutral-bg: #EFE5DA;
      --neutral-border: #D8C7B7;
      --neutral-text: #3A2A20;
      --font-body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
      /* Typography scale — v2.5.0 doctrine: size-first hierarchy, weight reinforces */
      --fs-display: 2.5rem;         /* 40px - Hero numbers / primary KPIs */
      --fs-stat: 2.5rem;            /* 40px - Lightweight stat/display numbers */
      --fs-page-title: 2rem;        /* 32px - Core page and auth titles */
      --fs-lead: 1.125rem;          /* 18px - Page introductions / lead copy */
      --fs-section-head: 1.5rem;    /* 24px - Major section breakpoints, modal titles */
      --fs-card-title: 1.25rem;     /* 20px - Card, record, container titles */
      --fs-body: 0.9375rem;         /* 15px - Default operational reading / inputs */
      --fs-subheadline: 0.875rem;   /* 14px - Supporting text / metadata */
      --fs-label: 0.75rem;          /* 12px - Labels, kickers, table headers, badges, chips */
      --lh-display: 1.1;
      --lh-heading: 1.25;
      --lh-body: 1.5;
      --motion-duration-page: 300ms;
      --motion-duration-enter: 400ms;
      --motion-duration-exit: 220ms;
      --motion-easing-decelerate: cubic-bezier(0.05, 0.7, 0.1, 1.0);
      --motion-easing-accelerate: cubic-bezier(0.3, 0, 0.8, 0.15);
      --radius-sm: 4px;
      --radius-md: 6px;
      --radius-lg: 8px;
      --radius-xl: 12px;
      --radius-2xl: 16px;
      --radius-pill: 999px;
      --shadow-main: 0 10px 28px rgba(120, 76, 29, 0.10);
      --shadow-card: 0 5px 16px rgba(120, 76, 29, 0.07);
      --shadow-shell: 0 14px 36px rgba(17, 23, 33, 0.16);
      --shadow-modal: 0 26px 70px rgba(17, 23, 33, 0.28);
      --shadow-auth: 0 28px 80px rgba(0, 0, 0, 0.30);
      --space-1: 4px;
      --space-2: 8px;
      --space-3: 10px;
      --space-4: 14px;
      --space-5: 16px;
      --space-6: 20px;
      --control-desktop: 36px;
      --control-mobile: 48px;
      --mobile-header-height: 64px;
      --mobile-nav-height: 64px;
      --mobile-nav-gap: 0px;
      --mobile-nav-clearance: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 72px);
      --z-header: 9000;
      --z-nav: 9200;
      --z-modal: 10000;
      --z-toast: 11000;
    }

    * { box-sizing: border-box; }

    html {
      min-height: 100%;
      background: var(--surface-page);
      font-size: 100%;
      -webkit-text-size-adjust: 100%;
    }

    body {
      min-height: 100%;
      margin: 0;
      background: var(--surface-page);
      color: var(--text);
      font-family: var(--font-body);
      font-size: var(--fs-body);
      line-height: var(--lh-body);
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      overflow-x: hidden;
      -webkit-tap-highlight-color: transparent;
    }

    button,
    input,
    select,
    textarea { font: inherit; font-size: 1rem; }

    button {
      border: 0;
      cursor: pointer;
    }

    a { color: inherit; text-decoration: none; }

    svg {
      display: block;
      width: 20px;
      height: 20px;
      fill: none;
      stroke: currentColor;
      stroke-width: 2.15;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    :focus-visible {
      outline: 3px solid rgba(246, 126, 15, 0.28);
      outline-offset: 2px;
    }

    .hidden { display: none !important; }
    .stack { display: grid; gap: var(--space-4); }
    .stack-lg { display: grid; gap: var(--space-6); }
    .inline-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
    .muted { color: var(--text-muted); }
    .soft { color: var(--text-soft); }

    .access-shell {
      position: relative;
      isolation: isolate;
      display: grid;
      min-height: 100dvh;
      overflow: hidden;
      background: var(--surface-dark);
      color: var(--text-inverse);
    }

    .access-wave {
      position: absolute;
      inset-inline: 0;
      z-index: -1;
      width: 100%;
      pointer-events: none;
      user-select: none;
    }

    .access-wave--top { top: 0; height: clamp(116px, 14vw, 204px); }
    .access-wave--bottom { bottom: 0; height: clamp(176px, 22vw, 296px); }
    .access-wave svg { width: 100%; height: 100%; }
    .access-wave path { stroke: none; }
    .access-wave-primary { fill: var(--bb-primary); }
    .access-wave-secondary { fill: var(--bb-coffee); }

    .access-main {
      display: grid;
      place-items: center;
      min-height: 100%;
      padding: max(32px, env(safe-area-inset-top)) 24px max(32px, env(safe-area-inset-bottom));
    }

    .access-stack {
      width: min(100%, 320px);
      display: grid;
      justify-items: center;
      text-align: center;
      animation: access-stack-in var(--motion-duration-enter) var(--motion-easing-decelerate) both;
    }

    @keyframes access-stack-in {
      from { opacity: 0; transform: translateY(24px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .access-logo-img {
      display: block;
      width: 40px;
      height: 48px;
      margin-bottom: var(--space-3);
      object-fit: contain;
    }

    .access-brand {
      margin: 0;
      color: var(--bb-primary);
      font-size: var(--fs-card-title);
      font-weight: 800;
      line-height: 1;
      letter-spacing: -0.04em;
    }

    .access-title {
      max-width: 10ch;
      margin: 7px 0 0;
      color: var(--text-inverse);
      font-size: clamp(2.25rem, 7.2vw, var(--fs-display));
      font-weight: 800;
      line-height: 0.9;
      letter-spacing: -0.055em;
    }

    .access-form {
      width: 100%;
      display: grid;
      gap: var(--space-2);
      margin-top: var(--space-4);
    }

    .access-pin {
      width: 100%;
      min-height: 56px;
      padding: 0 14px;
      border: 2px solid color-mix(in srgb, var(--bb-cream) 42%, transparent);
      border-radius: var(--radius-lg);
      background: #FFFCF8;
      color: var(--bb-ink);
      box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16), inset 0 0 0 1px rgba(17, 23, 33, 0.08);
      font-size: 1.65rem;
      font-weight: 800;
      letter-spacing: 0.36em;
      text-align: center;
      outline: none;
      transition: border-color 160ms var(--motion-easing-decelerate), box-shadow 160ms var(--motion-easing-decelerate), background 160ms var(--motion-easing-decelerate);
    }

    .access-pin::placeholder { color: #8A8E96; opacity: 1; letter-spacing: 0.26em; }
    .access-pin:focus { border-color: var(--bb-primary); background: #FFFFFF; box-shadow: 0 0 0 4px rgba(246, 126, 15, 0.28), inset 0 0 0 1px rgba(17, 23, 33, 0.08); }
    .access-pin[aria-invalid="true"] { border-color: var(--danger-border); background: #FFF9F8; box-shadow: 0 0 0 4px rgba(245, 184, 177, 0.28), inset 0 0 0 1px rgba(17, 23, 33, 0.08); }
    .access-pin:disabled { opacity: 0.78; cursor: wait; }

    .access-message {
      margin: 0;
      color: var(--danger-border);
      font-size: var(--fs-subheadline);
      font-weight: 650;
      line-height: 1.4;
    }

    .access-message:empty { display: none; }

    .access-submit {
      width: 100%;
      min-height: 56px;
      display: flex;
      align-items: center;
      justify-content: center;
      border: none;
      border-radius: var(--radius-pill);
      background: var(--bb-primary);
      color: #FFFFFF;
      padding: 0 14px;
      font-size: 1rem;
      font-weight: 800;
      letter-spacing: -0.015em;
      cursor: pointer;
      transition: transform 140ms var(--motion-easing-decelerate), background 140ms var(--motion-easing-decelerate), opacity 140ms var(--motion-easing-decelerate);
    }

    .access-submit:hover:not(:disabled) { background: var(--bb-primary-hover); }
    .access-submit:active:not(:disabled) { transform: translateY(1px); }
    .access-submit:disabled { opacity: 0.48; cursor: wait; }
    .access-submit-content { display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
    .access-submit .spinner { width: 16px; height: 16px; border-width: 2px; border-color: currentColor; border-top-color: transparent; }

    .access-back {
      justify-self: center;
      min-height: 48px;
      display: inline-flex;
      align-items: center;
      border: none;
      border-radius: var(--radius-pill);
      background: transparent;
      color: var(--text-inverse);
      padding: 0 13px;
      font-size: var(--fs-subheadline);
      font-weight: 700;
      text-decoration: none;
      transition: color 140ms var(--motion-easing-decelerate), background 140ms var(--motion-easing-decelerate);
    }

    .access-back:hover { color: #FFFFFF; background: rgba(255, 255, 255, 0.06); }

    .access-version {
      position: absolute;
      left: max(20px, env(safe-area-inset-left));
      bottom: max(18px, env(safe-area-inset-bottom));
      margin: 0;
      color: rgba(255, 247, 237, 0.52);
      font-size: var(--fs-label);
      font-weight: 800;
      letter-spacing: 0.02em;
      pointer-events: none;
      user-select: none;
    }

    .loading-row {
      display: flex;
      align-items: center;
      gap: var(--space-3);
      margin-top: 18px;
      padding: 14px;
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-lg);
      background: var(--surface-soft);
      color: var(--text);
      font-weight: 700;
    }

    .spinner {
      width: 24px;
      height: 24px;
      border-radius: 50%;
      border: 3px solid var(--bb-cream);
      border-top-color: var(--bb-primary);
      animation: spinner-rotate 0.8s linear infinite;
    }

    @keyframes spinner-rotate { to { transform: rotate(360deg); } }

    @keyframes skeleton-pulse {
      0%, 100% { opacity: 0.56; }
      50% { opacity: 1; }
    }

    .mobile-header {
      display: none;
      position: fixed;
      inset: 0 0 auto 0;
      min-height: var(--mobile-header-height);
      z-index: var(--z-header);
      padding: 12px 16px;
      padding-top: calc(12px + env(safe-area-inset-top));
      background:
        radial-gradient(circle at 14% 0%, rgba(246, 126, 15, 0.30), transparent 34%),
        linear-gradient(135deg, var(--bb-ink) 0%, var(--bb-coffee-dark) 100%);
      color: var(--text-inverse);
      box-shadow: var(--shadow-shell);
    }

    .mobile-header-inner {
      min-height: calc(var(--mobile-header-height) - 24px);
      display: flex;
      align-items: center;
    }

    .mobile-title-row {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .mobile-logo-icon {
      width: 36px;
      height: 36px;
      flex: 0 0 auto;
    }

    .mobile-logo-icon img {
      display: block;
      width: 100%;
      height: 100%;
    }

    .mobile-copy {
      min-width: 0;
      flex: 1 1 auto;
    }

    .mobile-kicker {
      margin: 0 0 3px;
      color: rgba(255, 247, 237, 0.68);
      font-size: var(--fs-label);
      font-weight: 650;
      letter-spacing: 0.11em;
      line-height: 1.15;
      text-transform: uppercase;
    }

    .mobile-title {
      margin: 0;
      color: var(--text-inverse);
      font-family: var(--font-body);
      font-size: 1.625rem;
      font-weight: 700;
      line-height: var(--lh-display);
      letter-spacing: -0.02em;
    }

    .mobile-subtitle {
      margin: 2px 0 0;
      color: rgba(255, 247, 237, 0.78);
      font-size: var(--fs-label);
      line-height: 1.15;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .mobile-actions {
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }

    .mobile-bottom-nav {
      display: none;
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: var(--z-nav);
      min-height: var(--mobile-nav-height);
      padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
      background: var(--bb-ink);
      color: var(--text-inverse);
      box-shadow: 0 -10px 30px rgba(17, 23, 33, 0.18);
      border-radius: 0;
    }

    body.bb-modal-lock .mobile-bottom-nav {
      overscroll-behavior: none;
      touch-action: none;
    }

    body:not(.bb-modal-lock) .mobile-bottom-nav {
      touch-action: auto;
    }

    .mobile-nav-inner {
      display: grid;
      grid-template-columns: repeat(var(--nav-count, 5), minmax(0, 1fr));
      gap: 6px;
      width: 100%;
      max-width: none;
      margin: 0;
      padding: 0;
    }

    .mobile-nav-button {
      position: relative;
      min-height: 48px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 4px;
      padding: 6px 4px;
      border-radius: var(--radius-lg);
      background: transparent;
      color: var(--bottom-nav-text);
      font-size: var(--fs-label);
      font-weight: 800;
      line-height: 1.05;
      white-space: nowrap;
      text-align: center;
      width: 100%;
      min-width: 0;
    }

    .mobile-nav-button svg {
      width: 19px;
      height: 19px;
    }

    .mobile-nav-button.active {
      background: var(--bb-primary);
      color: var(--bottom-nav-active-text);
    }

    .mobile-nav-button span {
      display: block;
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    @keyframes mobile-nav-select-feedback {
      from { transform: scale(0.94); }
      to   { transform: scale(1); }
    }

    .mobile-nav-button.nav-feedback {
      animation: mobile-nav-select-feedback 360ms cubic-bezier(0.05, 0.7, 0.1, 1.0) both;
      transform-origin: center;
    }

    .app-shell {
      display: grid;
      grid-template-columns: 230px minmax(0, 1fr);
      min-height: 100vh;
      background: var(--surface-page);
    }

    .sidebar {
      position: sticky;
      top: 0;
      height: 100vh;
      display: flex;
      flex-direction: column;
      background: var(--surface-dark);
      color: var(--text-inverse);
      padding: 24px 18px;
      overflow-y: auto;
    }

    .sidebar-brand {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 26px;
    }

    .sidebar-logo-icon {
      width: 36px;
      height: 36px;
      flex: 0 0 auto;
    }

    .sidebar-logo-icon img {
      display: block;
      width: 100%;
      height: 100%;
    }

    .brand-name {
      margin: 0;
      color: var(--text-inverse);
      font-size: var(--fs-card-title);
      font-weight: 700;
      line-height: 0.95;
      letter-spacing: 0.01em;
    }

    .brand-sub {
      margin: 2px 0 0;
      color: var(--text-inverse-muted);
      font-size: 0.7rem;
      font-weight: 400;
    }

    .nav-list {
      display: grid;
      gap: 8px;
    }

    .nav-spacer { flex: 1 1 auto; }

    .nav-button {
      width: 100%;
      height: var(--control-desktop);
      min-height: 0;
      display: grid;
      grid-template-columns: 22px minmax(0, 1fr);
      align-items: center;
      gap: 12px;
      padding: 0 12px;
      border-radius: var(--radius-pill);
      background: transparent;
      color: rgba(255, 247, 237, 0.72);
      font-size: var(--fs-subheadline);
      font-weight: 650;
      text-align: left;
      position: relative;
      isolation: isolate;
      transition: background 140ms ease, color 140ms ease;
    }

    .nav-badge-dot {
      position: absolute;
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--warning-border);
      pointer-events: none;
    }

    .nav-button .nav-badge-dot {
      top: 4px;
      left: 30px;
    }

    .mobile-nav-button .nav-badge-dot {
      top: 5px;
      right: calc(50% - 12px);
    }

    .sidebar-link {
      width: 100%;
      min-height: var(--control-desktop);
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 12px;
      border-radius: var(--radius-pill);
      background: rgba(255, 247, 237, 0.06);
      color: rgba(255, 247, 237, 0.72);
      font-size: var(--fs-subheadline);
      font-weight: 650;
      text-align: left;
      position: relative;
      isolation: isolate;
      transition: background 140ms ease, color 140ms ease;
      border: 1px solid rgba(255, 247, 237, 0.10);
      margin-top: 8px;
    }

    .nav-button::after,
    .sidebar-link::after {
      content: '';
      position: absolute;
      inset: 0;
      border-radius: inherit;
      background: currentColor;
      opacity: 0;
      pointer-events: none;
      transition: opacity 140ms ease;
    }

    .nav-button:hover::after,
    .sidebar-link:hover::after {
      opacity: 0.10;
    }

    .nav-button.active {
      background: var(--bb-primary);
      color: #ffffff;
    }

    .main {
      min-width: 0;
      padding: 24px;
    }

    .page-wrap {
      max-width: 1320px;
      margin: 0 auto;
    }

    .desktop-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--space-5);
      min-height: 38px;
      margin-bottom: 0;
    }

    .top-actions {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: var(--space-3);
    }

    .desktop-sync-text {
      min-width: 150px;
      color: var(--text-muted);
      font-size: var(--fs-label);
      line-height: 1.25;
      text-align: right;
    }

    .desktop-header .desktop-sync-text {
      min-width: 0;
    }

    .desktop-sync-text strong {
      display: block;
      color: var(--text-strong);
      font-size: var(--fs-label);
      font-weight: 650;
    }

    .page-title {
      margin: 0;
      color: var(--text-strong);
      font-family: var(--font-body);
      font-size: clamp(1.625rem, 3vw, var(--fs-page-title));
      line-height: var(--lh-display);
      letter-spacing: -0.03em;
      font-weight: 700;
    }

    .page-subtitle {
      max-width: 800px;
      margin: 6px 0 0;
      color: var(--text-muted);
      font-size: var(--fs-subheadline);
      line-height: var(--lh-body);
    }

    .page-lead {
      margin: 0;
      color: var(--text-muted);
      font-size: var(--fs-lead);
      font-weight: 400;
      line-height: 1.45;
    }

    .section-title {
      margin: 0;
      color: var(--text-strong);
      font-family: var(--font-body);
      font-size: var(--fs-section-head);
      line-height: 1.2;
      font-weight: 700;
      letter-spacing: -0.015em;
    }

    .card-title {
      margin: 0;
      color: var(--text-strong);
      font-family: var(--font-body);
      font-size: var(--fs-card-title);
      line-height: var(--lh-heading);
      font-weight: 700;
      letter-spacing: -0.015em;
    }

    .surface-main {
      background: var(--surface-card);
      border-radius: var(--radius-2xl);
      padding: var(--space-5);
    }

    .surface-card {
      background: var(--surface-card);
      border-radius: var(--radius-xl);
      padding: var(--space-4);
    }

    .status-desktop-grid > .surface-card {
      background: var(--surface-main);
    }

    #page-settings > .surface-card {
      background: var(--surface-main);
    }

    .surface-tonal {
      background: var(--surface-tonal);
      border-radius: var(--radius-xl);
      padding: var(--space-4);
    }

    .surface-nested {
      background: var(--surface-nested);
      border-radius: var(--radius-lg);
      padding: var(--space-3);
    }

    .surface-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: var(--space-4);
      margin-bottom: var(--space-3);
    }

    .surface-header p {
      margin: 6px 0 0;
      color: var(--text-muted);
      font-size: var(--fs-subheadline);
    }

    .layout-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--space-5);
    }

    .three-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: var(--space-4);
    }

    .metric-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: var(--space-2);
    }

    .metric-card {
      background: var(--surface-card);
      border: 0;
      border-radius: var(--radius-xl);
      box-shadow: none;
      padding: 14px;
    }

    .metric-unit {
      font-size: var(--fs-card-title);
      font-weight: 700;
      letter-spacing: 0;
      margin-left: 4px;
    }

    .metric-card.cream { background: var(--bb-cream); }
    .metric-card.success { background: var(--success-bg); }
    .metric-card.warning { background: var(--warning-bg); }
    .metric-card.danger { background: var(--danger-bg); }
    .metric-card.info { background: var(--info-bg); }

    .metric-label {
      margin: 8px 0 0;
      color: currentColor;
      font-size: var(--fs-label);
      font-weight: 650;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      opacity: 0.75;
    }

    .metric-value {
      width: 100%;
      min-width: 0;
      color: var(--text-strong);
      font-size: var(--fs-stat);
      font-weight: 700;
      line-height: var(--lh-display);
      letter-spacing: -0.03em;
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }

    /* Number colors — darker shade of the card's semantic family */
    .metric-card .metric-value { color: var(--text-strong); }

    .btn {
      min-height: var(--control-desktop);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 10px 15px;
      border: 1px solid transparent;
      border-radius: var(--radius-pill);
      background: var(--surface-tonal);
      color: var(--text-strong);
      font-size: var(--fs-subheadline);
      font-weight: 650;
      line-height: 1;
      white-space: nowrap;
      position: relative;
      isolation: isolate;
      transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
    }

    /* M3-style state layer */
    .btn::after {
      content: '';
      position: absolute;
      inset: 0;
      border-radius: inherit;
      background: currentColor;
      opacity: 0;
      pointer-events: none;
      transition: opacity 140ms ease;
    }

    .btn:hover::after { opacity: 0.08; }
    .btn:active { transform: scale(0.99); }
    .btn-primary:hover::after { opacity: 0.12; }
    .btn:disabled,
    .filter-chip:disabled,
    .qc-toggle:disabled {
      opacity: 0.58;
      cursor: not-allowed;
      transform: none;
      box-shadow: none;
    }
    .btn-primary { background: var(--bb-primary); border-color: var(--bb-primary); color: var(--color-on-primary); }
    .btn-secondary { background: var(--bb-ink); color: var(--text-inverse); }
    .btn-tonal { background: #FFE7CF; border-color: rgba(246, 126, 15, 0.18); color: var(--text-tonal); }
    .btn-outline { background: transparent; border-color: var(--border-soft); color: var(--text-strong); }
    .btn-danger { background: var(--danger); border-color: var(--danger); color: #FFFFFF; }
    .btn-text { background: transparent; border-color: transparent; color: var(--text-muted); }
    .btn-small { min-height: 32px; padding: 7px 11px; font-size: var(--fs-label); }
    .btn-block { width: 100%; }
    .icon-btn { width: var(--control-desktop); min-width: var(--control-desktop); padding: 0; }

    /* Filter chips are selectable controls with a 48px accessible hit target
       containing a visually smaller chip. Per v2.5.0 doctrine. */
    .filter-chip {
      min-height: var(--touch-target-min);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      border: 0;
      background: transparent;
      cursor: pointer;
    }

    .filter-chip-visual {
      min-height: var(--filter-chip-visual-height);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      padding: 0 12px;
      border: 1px solid var(--border-soft);
      border-radius: var(--radius-pill);
      background: transparent;
      color: var(--text-strong);
      font-size: var(--fs-label);
      font-weight: 650;
      line-height: 1;
      white-space: nowrap;
      position: relative;
      isolation: isolate;
      transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
    }

    .filter-chip-visual::after {
      content: '';
      position: absolute;
      inset: 0;
      border-radius: inherit;
      background: currentColor;
      opacity: 0;
      pointer-events: none;
      transition: opacity 140ms ease;
    }

    .filter-chip:hover .filter-chip-visual::after { opacity: 0.08; }

    .filter-chip:hover .filter-chip-visual {
      border-color: var(--border-strong);
    }

    .filter-chip.active .filter-chip-visual {
      background: var(--selection-fill);
      border-color: transparent;
      color: var(--selection-text);
    }

    .status-chip {
      min-height: 24px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      padding: 4px 9px;
      border: 1px solid var(--border-chip);
      border-radius: var(--radius-md);
      background: var(--surface-soft);
      color: var(--text-strong);
      font-size: var(--fs-label);
      font-weight: 650;
      line-height: 1;
      letter-spacing: normal;
      white-space: nowrap;
      cursor: default;
      box-shadow: none;
      transform: none;
    }


    .status-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
    .status-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-text); }
    .status-danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-text); }
    .status-info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }
    .status-neutral { background: var(--neutral-bg); border-color: var(--neutral-border); color: var(--neutral-text); }

    .badge {
      min-height: 22px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 3px 8px;
      border: 1px solid var(--border-chip);
      border-radius: var(--radius-md);
      background: var(--neutral-bg);
      color: var(--neutral-text);
      font-size: var(--fs-label);
      font-weight: 650;
      line-height: 1;
      white-space: nowrap;
      cursor: default;
    }

    .form-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--space-3);
    }

    .field {
      display: grid;
      gap: 6px;
      min-width: 0;
      align-content: start;
    }

    .field label {
      color: var(--text-muted);
      font-size: var(--fs-label);
      font-weight: 650;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      line-height: 1.1;
    }

    .input,
    .select,
    .textarea,
    input,
    select,
    textarea {
      width: 100%;
      max-width: 100%;
      min-height: var(--control-desktop);
      border: 1.5px solid var(--border-strong);
      border-radius: var(--radius-lg);
      background: var(--surface-input);
      color: var(--text);
      padding: 6px 12px;
      font-size: var(--fs-body);
      font-weight: 400;
      outline: none;
      transition: border-color 140ms ease, box-shadow 140ms ease;
    }

    select,
    .select {
      appearance: none;
      -webkit-appearance: none;
      padding-right: 42px;
      background-color: var(--surface-input);
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23784C1D' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
      background-position: calc(100% - 14px) 50%;
      background-repeat: no-repeat;
      background-size: 16px 16px;
    }

    .input:focus,
    .select:focus,
    .textarea:focus,
    input:focus,
    select:focus,
    textarea:focus {
      border-color: var(--bb-primary);
      box-shadow: 0 0 0 4px rgba(246, 126, 15, 0.26);
    }

    .readonly-value {
      min-height: var(--control-desktop);
      display: flex;
      align-items: center;
      padding: 6px 12px;
      border: 1.5px dashed var(--border-strong);
      border-radius: var(--radius-md);
      background: var(--surface-tonal);
      color: var(--text-strong);
      font-size: var(--fs-body);
      font-weight: 800;
    }

    .record-list { display: grid; gap: var(--space-3); }

    .record-card {
      background: var(--surface-card);
      border: 1px solid var(--border-soft);
      border-radius: var(--radius-xl);
      padding: var(--space-3);
    }

    .record-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: var(--space-3);
      margin-bottom: var(--space-3);
    }

    .record-title {
      margin: 0;
      color: var(--text-strong);
      font-weight: 800;
      letter-spacing: -0.01em;
    }

    .record-meta {
      margin: 3px 0 0;
      color: var(--text-muted);
      font-size: var(--fs-label);
    }

    .record-details {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: var(--space-2);
    }

    .detail-cell {
      background: var(--surface-soft);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-xl);
      padding: 8px 10px;
    }

    .detail-label {
      color: var(--text-muted);
      font-size: var(--fs-label);
      font-weight: 650;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .detail-value {
      margin-top: 3px;
      color: var(--text-strong);
      font-weight: 700;
    }

    .helper {
      margin: 6px 0 0;
      color: var(--text-muted);
      font-size: var(--fs-subheadline);
    }

    .table-wrap {
      overflow-x: auto;
      border: 1px solid var(--border-soft);
      border-radius: var(--radius-xl);
      background: var(--surface-card);
    }

    table {
      width: 100%;
      min-width: 680px;
      border-collapse: collapse;
    }

    th {
      text-align: left;
      padding: 12px 14px;
      color: var(--text-muted);
      background: var(--surface-tonal);
      font-size: var(--fs-label);
      font-weight: 650;
      letter-spacing: 0.10em;
      text-transform: uppercase;
    }

    td {
      padding: 13px 14px;
      border-top: 1px solid var(--divider);
      vertical-align: middle;
    }

    /* ── Stock advanced table (spreadsheet modal) ─────────────── */
    .stock-table-wrap {
      overflow: auto;
      max-height: min(60dvh, 520px);
      border: 1px solid var(--border-soft);
      border-radius: var(--radius-xl);
      background: var(--surface-card);
      flex: 1 1 auto;
    }

    .stock-table {
      width: 100%;
      min-width: 900px;
      border-collapse: collapse;
      font-size: var(--fs-subheadline);
    }

    .stock-table th {
      text-align: left;
      padding: 10px 10px;
      color: var(--text-muted);
      background: var(--surface-tonal);
      font-size: var(--fs-label);
      font-weight: 850;
      letter-spacing: 0.10em;
      text-transform: uppercase;
      white-space: nowrap;
      position: sticky;
      top: 0;
      z-index: 2;
    }

    .stock-table td {
      padding: 6px 8px;
      border-top: 1px solid var(--divider);
      vertical-align: middle;
    }

    .stock-table-input {
      width: 100%;
      padding: 7px 9px;
      border: 1px solid var(--border-soft);
      border-radius: var(--radius-md);
      background: var(--surface-input);
      color: var(--text);
      font-size: var(--fs-subheadline);
      line-height: 1.3;
    }

    .stock-table-input:focus {
      outline: none;
      border-color: var(--bb-primary);
      box-shadow: 0 0 0 3px rgba(246, 126, 15, 0.14);
    }

    .stock-table-input.sku-cell {
      font-weight: 800;
      color: var(--text-strong);
    }

    .stock-table-input.num-cell {
      text-align: right;
      font-variant-numeric: tabular-nums;
      width: 90px;
    }

    .stock-table-select {
      padding: 6px 8px;
      border: 1px solid var(--border-soft);
      border-radius: var(--radius-md);
      background: var(--surface-input);
      color: var(--text);
      font-size: var(--fs-subheadline);
    }

    .stock-table-select:focus {
      outline: none;
      border-color: var(--bb-primary);
    }

    /* ─── Roast Targets read-only modal table ─────────────── */
    .target-table-wrap {
      overflow: auto;
      max-height: min(60dvh, 520px);
      border: 1px solid var(--border-soft);
      border-radius: var(--radius-xl);
      background: var(--surface-card);
    }

    .target-table {
      width: 100%;
      border-collapse: collapse;
      font-size: var(--fs-subheadline);
    }

    .target-table th {
      text-align: left;
      padding: 10px 10px;
      color: var(--text-muted);
      background: var(--surface-tonal);
      font-size: var(--fs-label);
      font-weight: 850;
      letter-spacing: 0.10em;
      text-transform: uppercase;
      white-space: nowrap;
      position: sticky;
      top: 0;
      z-index: 2;
    }

    .target-table td {
      padding: 8px 10px;
      border-top: 1px solid var(--divider);
      vertical-align: middle;
      white-space: nowrap;
    }

    .target-table td.wrap-cell {
      white-space: normal;
      word-break: break-word;
      max-width: 180px;
    }

    .gcb-archived td {
      background: var(--surface-soft);
    }

    .target-table td.num,
    .target-table th.num {
      text-align: right;
      font-variant-numeric: tabular-nums;
    }

    .target-table tbody tr:hover {
      background: var(--surface-soft);
    }

    .target-edit-link {
      background: none;
      border: none;
      padding: 0;
      color: var(--bb-primary);
      font-weight: 800;
      font-size: var(--fs-label);
      cursor: pointer;
    }
    .target-edit-link:hover {
      color: var(--bb-primary-hover);
      text-decoration: underline;
    }

    .target-table .target-muted td {
      color: var(--text-muted);
      font-style: italic;
    }

    .target-source {
      display: block;
      font-size: var(--fs-label);
      font-weight: 600;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }

    .target-warn {
      font-size: var(--fs-label);
      color: var(--warning, #c47a1a);
      font-weight: 700;
    }

    .target-status {
      display: inline-block;
      padding: 2px 8px;
      border-radius: var(--radius-sm);
      font-size: var(--fs-label);
      font-weight: 800;
      letter-spacing: 0.06em;
      text-transform: uppercase;
    }

    .target-active {
      background: rgba(34, 197, 94, 0.12);
      color: #15803d;
    }

    .target-inactive {
      background: rgba(148, 163, 184, 0.14);
      color: var(--text-muted);
    }

    .stock-table-remove {
      padding: 4px 8px;
      border: 0;
      border-radius: var(--radius-sm);
      background: transparent;
      color: var(--danger);
      font-size: var(--fs-label);
      font-weight: 800;
      cursor: pointer;
    }

    .stock-table-remove:hover {
      background: var(--danger-bg);
    }

    .stock-table-new-row td {
      background: var(--surface-soft);
    }

    .stock-table-dirty td {
      background: #FFFBEB;
    }

    .stock-table-archived-row td {
      background: var(--surface-soft);
      color: var(--text-muted);
      opacity: 0.7;
    }

    .stock-movements-wrap {
      overflow-x: auto;
      border: 1px solid var(--border-soft);
      border-radius: var(--radius-xl);
    }

    .modal-body > *,
    #stockEditActivity {
      min-width: 0;
    }
    .stock-movements-table { width: 100%; border-collapse: collapse; font-size: var(--fs-label); }
    .stock-movements-table th {
      padding: 10px 12px;
      background: var(--surface-tonal);
      color: var(--text-muted);
      font-size: var(--fs-label);
      font-weight: 850;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      text-align: left;
      white-space: nowrap;
      border-bottom: 1px solid var(--divider);
    }
    .stock-movements-table td {
      padding: 8px 12px;
      background: #fff;
      border-bottom: 1px solid var(--divider);
      white-space: nowrap;
    }
    .stock-movements-table tr:last-child td { border-bottom: 0; }
    .stock-movements-table .delta-neg { color: var(--danger); font-weight: 800; }
    .stock-movements-table .delta-pos { color: var(--success-text); font-weight: 800; }
    .movement-reason-badge {
      display: inline-block;
      padding: 2px 8px;
      border-radius: var(--radius-md);
      font-size: var(--fs-label);
      font-weight: 800;
      background: var(--surface-soft);
      color: var(--text);
    }
    .stock-activity-list {
      display: grid;
      gap: 6px;
      max-height: 240px;
      overflow-y: auto;
      padding: 2px 0;
    }
    .stock-activity-item {
      display: grid;
      grid-template-columns: auto 1fr auto;
      gap: 8px;
      align-items: center;
      padding: 6px 8px;
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-md);
      background: var(--surface-soft);
      font-size: var(--fs-label);
    }
    .stock-activity-item .delta-neg { color: var(--danger); font-weight: 800; }
    .stock-activity-item .delta-pos { color: var(--success-text); font-weight: 800; }
    .stock-activity-item .act-time { color: var(--text-muted); font-size: var(--fs-label); }
    .stock-activity-item .act-reason { color: var(--text); font-size: var(--fs-label); }

    .activity-row {
      display: grid;
      grid-template-columns: auto auto 1fr;
      gap: var(--space-2);
      align-items: center;
      font-size: var(--fs-label);
    }
    .activity-row .delta-neg { color: var(--danger); font-weight: 800; }
    .activity-row .delta-pos { color: var(--success-text); font-weight: 800; }
    .activity-row .act-time { color: var(--text-muted); font-size: var(--fs-label); }
    .activity-row .act-reason { color: var(--text); font-size: var(--fs-label); }

    /* ── Profile-code sub-row pairs ─────────────────────────── */
    .adv-profile-cell {
      min-width: 280px;
    }

    .adv-pair-row {
      display: flex;
      align-items: center;
      gap: 4px;
      padding: 2px 0;
    }

    .adv-pair-row + .adv-pair-row {
      border-top: 1px solid var(--border-subtle);
      padding-top: 4px;
      margin-top: 1px;
    }

    .adv-pair-profile {
      flex: 1 1 auto;
      min-width: 100px;
      font-weight: 700;
    }

    .adv-pair-code {
      flex: 0 0 auto;
      font-family: var(--font-body);
      font-weight: 800;
      letter-spacing: 0.03em;
      text-align: center;
    }

    .adv-pair-add,
    .adv-pair-remove {
      flex: 0 0 auto;
      width: 22px;
      height: 22px;
      padding: 0;
      border: none;
      border-radius: var(--radius-sm);
      background: transparent;
      color: var(--text-muted);
      font-size: var(--fs-subheadline);
      font-weight: 800;
      line-height: 1;
      cursor: pointer;
      display: grid;
      place-items: center;
    }

    .adv-pair-remove {
      color: var(--danger);
    }

    .adv-pair-remove:hover {
      color: var(--danger);
      background: transparent;
    }

    .stock-advanced-actions {
      display: flex;
      justify-content: flex-start;
      gap: var(--space-2);
      flex: 0 0 auto;
    }

    .adv-confirm-summary {
      background: var(--surface-soft);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-lg);
      padding: var(--space-3);
      font-size: var(--fs-subheadline);
      line-height: 1.5;
    }
    .adv-confirm-summary p { margin: 0.2em 0; }
    .adv-confirm-summary strong { color: var(--text-strong); }

    .kanban {
      display: grid;
      grid-template-columns: repeat(5, minmax(220px, 1fr));
      gap: var(--space-3);
      overflow-x: auto;
      padding-bottom: 2px;
    }

    .kanban-column {
      min-width: 210px;
      background: var(--surface-tonal);
      border: 1px solid var(--border-chip);
      border-radius: var(--radius-xl);
      padding: var(--space-3);
    }

    .kanban-title {
      margin: 0 0 12px;
      color: var(--text-strong);
      font-size: var(--fs-subheadline);
      font-weight: 850;
    }

    .kanban-column-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--space-2);
      margin-bottom: var(--space-3);
      padding-bottom: var(--space-2);
      border-bottom: 1px solid var(--divider);
    }

    .kanban-count {
      min-width: 26px;
      min-height: 26px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 4px 8px;
      border-radius: var(--radius-md);
      background: var(--surface-card);
      color: var(--text-strong);
      font-size: var(--fs-label);
      font-weight: 850;
      border: 1px solid var(--border-subtle);
    }

    .status-kanban-card {
      overflow: hidden;
      background: var(--surface-main);
    }

    .status-card-toolbar {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: var(--space-3);
      flex-wrap: wrap;
    }

    .status-sync-text {
      display: grid;
      gap: 2px;
      color: var(--text-muted);
      font-size: var(--fs-label);
      font-weight: 750;
      line-height: 1.2;
      text-align: right;
    }

    .status-sync-label {
      color: var(--text-soft);
      font-size: var(--fs-label);
      font-weight: 850;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .status-sync-value {
      color: var(--text-muted);
      white-space: nowrap;
    }

    .status-kanban-board {
      display: grid;
      grid-template-columns: repeat(5, minmax(220px, 1fr));
      gap: var(--space-3);
      overflow-x: auto;
      padding-bottom: 2px;
    }

    .status-kanban-column {
      min-width: 210px;
      border: 1px solid var(--border-soft);
      border-radius: var(--radius-xl);
      padding: var(--space-3);
    }

    .status-lane-order-in { background: #F4ECE4; border-color: #D8C7B7; }
    .status-lane-scheduled { background: #E7EFFF; border-color: #B8CCFF; }
    .status-lane-roasting { background: #FFF3D6; border-color: #F3D28A; }
    .status-lane-packing { background: #FFE7CF; border-color: rgba(246, 126, 15, 0.24); }
    .status-lane-ready-for-pickup { background: #E7F5EC; border-color: #B7DEC6; }

    .kanban-column-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--space-2);
      margin-bottom: var(--space-3);
      padding-bottom: var(--space-2);
      border-bottom: 1px solid var(--divider);
    }

    .kanban-title {
      margin: 0;
      color: var(--text-strong);
      font-size: var(--fs-subheadline);
      font-weight: 850;
    }

    .kanban-count {
      min-width: 26px;
      min-height: 26px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 4px 8px;
      border-radius: var(--radius-md);
      background: var(--surface-card);
      color: var(--text-strong);
      font-size: var(--fs-label);
      font-weight: 850;
      border: 1px solid var(--border-subtle);
    }

    .status-card {
      display: grid;
      gap: var(--space-2);
      margin-bottom: var(--space-2);
      padding: var(--space-2);
      border: 1px solid var(--border-soft);
      border-radius: var(--radius-lg);
      background: var(--surface-card);
    }

    .status-card-title {
      margin: 0;
      color: var(--text-strong);
      font-size: var(--fs-subheadline);
      font-weight: 850;
      letter-spacing: -0.015em;
      line-height: 1.2;
    }

    .status-card-meta {
      color: var(--text-muted);
      font-size: var(--fs-label);
      line-height: 1.35;
    }

    .status-card-tags {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .status-card-actions {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 6px;
    }

    .status-card-actions .status-view-button {
      grid-column: 1 / -1;
    }

    .status-column-empty {
      min-height: 96px;
      display: grid;
      place-items: center;
      text-align: center;
      padding: var(--space-4);
      border: 1px dashed var(--border-strong);
      border-radius: var(--radius-lg);
      background: rgba(255, 251, 247, 0.64);
      color: var(--text-muted);
      font-size: var(--fs-subheadline);
      font-weight: 750;
    }

    .status-desktop-grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: var(--space-3);
      align-items: start;
    }


    .status-legend-row {
      display: flex;
      flex-wrap: wrap;
      gap: var(--space-2);
      margin-bottom: var(--space-3);
    }

    .status-legend-chip {
      min-height: 24px;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 9px;
      border-radius: var(--radius-md);
      border: 1px solid var(--border-chip);
      background: var(--surface-soft);
      color: var(--text-strong);
      font-size: var(--fs-label);
      font-weight: 750;
      line-height: 1;
      white-space: nowrap;
      cursor: default;
    }


    .status-calendar-scroll {
      width: 100%;
      overflow: visible;
    }

    .status-calendar-grid {
      display: grid;
      grid-template-columns: repeat(7, minmax(0, 1fr));
      border: 1px solid var(--border-soft);
      border-radius: var(--radius-xl);
      overflow: hidden;
      background: var(--surface-card);
    }

    .status-calendar-weekday {
      padding: 8px 6px;
      background: var(--surface-soft);
      border-right: 1px solid var(--divider);
      color: var(--text-muted);
      font-size: var(--fs-label);
      font-weight: 850;
      letter-spacing: 0.08em;
      text-align: center;
      text-transform: uppercase;
    }

    .status-calendar-weekday:nth-child(7n) { border-right: 0; }

    .status-calendar-day {
      min-height: 98px;
      display: flex;
      flex-direction: column;
      gap: 6px;
      padding: 8px;
      border-top: 1px solid var(--divider);
      border-right: 1px solid var(--divider);
      background: #FFFFFF;
      min-width: 0;
    }

    .status-calendar-day:nth-child(7n) { border-right: 0; }

    .status-calendar-day.outside-month {
      background: #EFE5DA;
      color: rgba(58, 42, 32, 0.54);
    }

    .status-calendar-date {
      width: 28px;
      height: 28px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: var(--radius-pill);
      color: var(--text-strong);
      font-size: var(--fs-label);
      font-weight: 850;
    }

    .status-calendar-date.today {
      border: 2px solid var(--bb-primary);
      color: var(--bb-primary-pressed);
      background: #FFF4E8;
    }

    .status-calendar-items {
      display: grid;
      gap: 4px;
      min-width: 0;
    }

    .status-calendar-chip {
      min-width: 0;
      max-width: 100%;
      display: block;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      padding: 4px 7px;
      border-radius: var(--radius-pill);
      border: 1px solid transparent;
      color: var(--text-strong);
      font-size: var(--fs-label);
      font-weight: 800;
      line-height: 1.1;
    }

    .status-tone-order-in { background: #F4ECE4; border-color: #D8C7B7; color: #3A2A20; }
    .status-tone-scheduled { background: #E7EFFF; border-color: #B8CCFF; color: #153E96; }
    .status-tone-roasting { background: #FFF3D6; border-color: #F3D28A; color: #5F3B00; }
    .status-tone-packing { background: #FFE7CF; border-color: rgba(246, 126, 15, 0.24); color: var(--text-tonal); }
    .status-tone-ready-for-pickup { background: #E7F5EC; border-color: #B7DEC6; color: #0E3D25; }

    .status-activity-table {
      border: 1px solid var(--border-soft);
      border-radius: var(--radius-xl);
      overflow: hidden;
      background: var(--surface-card);
    }

    .status-activity-row {
      display: grid;
      grid-template-columns: minmax(140px, 0.7fr) minmax(220px, 1.3fr) minmax(120px, 0.7fr);
      gap: var(--space-3);
      align-items: center;
      padding: 12px 14px;
      border-top: 1px solid var(--divider);
      font-size: var(--fs-label);
    }

    .status-activity-row:first-child { border-top: 0; }

    .status-activity-primary {
      color: var(--text-strong);
      font-weight: 850;
    }

    .status-activity-detail {
      color: var(--text-muted);
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .status-progress-panel {
      display: grid;
      justify-items: center;
      gap: var(--space-3);
      text-align: center;
      padding: var(--space-2);
    }

    .empty-state,
    .loading-state {
      min-height: 220px;
      display: grid;
      place-items: center;
      text-align: center;
      padding: var(--space-6);
      border: 1px dashed var(--border-strong);
      border-radius: var(--radius-xl);
      background: var(--surface-soft);
    }

    .empty-state svg,
    .loading-state svg {
      width: 40px;
      height: 40px;
      margin: 0 auto 12px;
      color: var(--bb-coffee);
      opacity: 0.7;
    }

    .sync-loader {
      min-height: 420px;
      display: grid;
      gap: var(--space-4);
      padding: var(--space-4) 0;
    }

    .sync-loader-status {
      display: flex;
      align-items: center;
      gap: var(--space-3);
      color: var(--text-muted);
      font-size: var(--fs-subheadline);
      font-weight: 650;
    }

    .dashboard-skeleton {
      display: grid;
      gap: var(--space-4);
    }

    .dash-skel-filter {
      display: flex;
      flex-wrap: wrap;
      gap: var(--space-2);
    }

    .dash-skel-chip {
      width: 96px;
      height: var(--control-desktop);
      border-radius: var(--radius-pill);
      background: var(--surface-tonal);
      animation: skeleton-pulse 1.4s linear infinite;
    }

    .dash-skel-chip.wide {
      width: 140px;
    }

    .dash-skel-metrics {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--space-3);
    }

    .dash-skel-metric {
      height: 132px;
      border-radius: var(--radius-xl);
      border: 1px solid var(--border-soft);
      background: var(--surface-card);
      animation: skeleton-pulse 1.4s linear infinite;
    }

    .dash-skel-summary {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      gap: var(--space-4);
      padding: var(--space-4);
      border-radius: var(--radius-xl);
      background: var(--selection-bg);
    }

    .dash-skel-summary-list {
      display: grid;
      gap: var(--space-3);
    }

    .dash-skel-summary-title {
      width: 45%;
      height: 14px;
      border-radius: var(--radius-pill);
      background: var(--surface-tonal);
      animation: skeleton-pulse 1.4s linear infinite;
    }

    .dash-skel-line {
      height: 14px;
      border-radius: var(--radius-pill);
      background: var(--surface-tonal);
      animation: skeleton-pulse 1.4s linear infinite;
    }

    .dash-skel-line.short {
      width: 62%;
    }

    @media (min-width: 921px) {
      .dash-skel-metrics {
        grid-template-columns: repeat(4, minmax(0, 1fr));
      }

      .dash-skel-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }

    .alert {
      padding: 14px 15px;
      border: 1px solid var(--info-border);
      border-radius: var(--radius-lg);
      background: var(--info-bg);
      color: var(--info-text);
      font-weight: 400;
    }

    .alert.warning { border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning-text); }
    .alert.danger { border-color: var(--danger-border); background: var(--danger-bg); color: var(--danger-text); }

    .modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: var(--z-modal);
      display: none;
      align-items: center;
      justify-content: center;
      padding: 18px;
      background: rgba(17, 23, 33, 0.62);
    }

    .modal-backdrop.show { display: flex; animation: backdrop-fade-in 200ms ease both; }

    .modal {
      width: min(100%, 520px);
      max-height: min(88dvh, 820px);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      border: none;
      border-radius: var(--radius-2xl);
      background: var(--surface-page);
      color: var(--text);
      box-shadow: var(--shadow-modal);
    }

    .modal:not(.confirm) {
      animation: modal-in 170ms ease both;
    }

    .modal.wide {
      width: min(100%, 760px);
    }

    .modal.confirm {
      max-width: 440px;
      animation: confirm-in 180ms var(--motion-easing-decelerate) both;
    }

    .modal-head {
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: var(--space-4) var(--space-5) var(--space-2) var(--space-5);
      border: none;
    }

    .modal-title {
      margin: 0;
      color: var(--text-strong);
      font-size: var(--fs-section-head);
      font-weight: 700;
      line-height: var(--lh-heading);
      letter-spacing: -0.02em;
    }

    .modal-close-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      border: none;
      border-radius: 50%;
      background: transparent;
      color: var(--text-muted);
      cursor: pointer;
      flex-shrink: 0;
      transition: background 140ms ease, color 140ms ease;
    }

    .modal-close-btn:hover {
      background: var(--surface-soft);
      color: var(--text-strong);
    }

    .modal-close-btn:active {
      background: var(--surface-tonal);
      transform: scale(0.95);
    }

    .modal-close-btn svg {
      width: 18px;
      height: 18px;
    }

    .modal-body {
      flex: 1;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      padding: var(--space-2) var(--space-6) var(--space-4) var(--space-6);
      min-width: 0;
    }

    .modal-actions {
      display: flex;
      flex-shrink: 0;
      justify-content: flex-end;
      gap: var(--space-2);
      padding: var(--space-2) var(--space-5) var(--space-5) var(--space-5);
    }

    @media (min-width: 920px) {
      .metric-value { font-size: clamp(1.75rem, 3vw, var(--fs-stat)); }
      .modal:not(.confirm) .modal-actions [data-action="close-modal"],
      .modal:not(.confirm) .modal-actions [data-action="roast-target-edit-cancel"] { display: none; }
    }

    .modal.xl {
      width: min(100%, 1050px);
    }

    .modal.xl .modal-body {
      flex: 1;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      padding: var(--space-2) var(--space-5) var(--space-4) var(--space-5);
      display: flex;
      flex-direction: column;
      gap: var(--space-3);
    }

    @keyframes modal-in {
      from { opacity: 0; transform: scale(0.97); }
      to { opacity: 1; transform: scale(1); }
    }

    @keyframes confirm-in {
      from { opacity: 0; transform: scale(1.2); }
      to { opacity: 1; transform: scale(1); }
    }

    @keyframes modal-slide-up {
      from { opacity: 1; transform: translateY(100%); }
      to { opacity: 1; transform: translateY(0); }
    }

    @keyframes modal-slide-down {
      from { opacity: 1; transform: translateY(0); }
      to { opacity: 1; transform: translateY(100%); }
    }

    @keyframes backdrop-fade-in {
      from { opacity: 0; }
      to { opacity: 1; }
    }

    @keyframes backdrop-fade-out {
      from { opacity: 1; }
      to { opacity: 0; }
    }

    .toast {
      position: fixed;
      right: 18px;
      bottom: 18px;
      z-index: var(--z-toast);
      display: none;
      max-width: min(420px, calc(100vw - 28px));
      padding: 13px 15px;
      border: 1px solid rgba(255, 255, 255, 0.06);
      border-radius: var(--radius-lg);
      background: var(--bb-ink);
      color: var(--text-inverse);
      box-shadow: var(--shadow-modal);
      font-size: var(--fs-subheadline);
      font-weight: 800;
    }

    .toast.show { display: block; animation: toast-in 180ms ease both; }
    .toast.success { background: #10291D; }
    .toast.error { background: #4A130F; }
    @keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

    .page { display: none; }
    .page.active { display: grid; }

    .page.page-transition {
      animation: pageIn 300ms cubic-bezier(0.05, 0.7, 0.1, 1.0) both;
    }

    @keyframes pageIn {
      from { opacity: 0; transform: translateY(8px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    @keyframes pageOut {
      from { opacity: 1; transform: translateY(0); }
      to   { opacity: 0; transform: translateY(8px); }
    }

    @keyframes modal-in-mobile {
      from { transform: translateY(100%); }
      to { transform: translateY(0); }
    }

    /* ── Date range picker ───────────────────────────── */
    .date-picker-wrap { position: relative; }
    .date-picker-trigger { display: flex; align-items: center; gap: var(--space-2); padding: 8px 12px; border: 1px solid var(--border-soft); border-radius: var(--radius-lg); background: var(--surface-card); cursor: pointer; font-size: var(--fs-subheadline); color: var(--text-strong); min-width: 180px; transition: border-color 140ms ease; }
    .date-picker-trigger:hover { border-color: var(--border-strong); }
    .date-picker-trigger.open { border-color: var(--bb-primary); }
    .date-picker-panel { position: absolute; z-index: var(--z-modal); top: calc(100% + 4px); left: 0; background: var(--surface-main); border: 1px solid var(--border-soft); border-radius: var(--radius-xl); box-shadow: var(--shadow-modal); padding: var(--space-4); min-width: 480px; }
    .date-picker-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
    .date-picker-nav { display: flex; gap: var(--space-1); }
    .date-picker-nav-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--radius-md); background: transparent; cursor: pointer; color: var(--text-strong); font-size: var(--fs-subheadline); transition: background 140ms ease; }
    .date-picker-nav-btn:hover { background: var(--surface-soft); }
    .date-picker-month-label { font-size: var(--fs-card-title); font-weight: 800; color: var(--text-strong); min-width: 140px; text-align: center; }
    .date-picker-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; text-align: center; }
    .date-picker-weekday { padding: 4px 0; color: var(--text-muted); font-size: var(--fs-label); font-weight: 850; text-transform: uppercase; }
    .date-picker-day { height: 36px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: var(--radius-md); background: transparent; cursor: pointer; font-size: var(--fs-subheadline); color: var(--text-strong); transition: background 80ms ease; position: relative; }
    .date-picker-day:hover { background: var(--surface-soft); }
    .date-picker-day.is-today { font-weight: 850; }
    .date-picker-day.is-today::after { content: ''; position: absolute; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--bb-primary); }
    .date-picker-day.is-start,
    .date-picker-day.is-end { background: var(--selection-fill); color: var(--selection-text); font-weight: 850; border-radius: var(--radius-md); }
    .date-picker-day.is-in-range { background: var(--selection-bg); border-radius: 0; }
    .date-picker-day.is-start.is-in-range { border-radius: var(--radius-md) 0 0 var(--radius-md); }
    .date-picker-day.is-end.is-in-range { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
    .date-picker-day:disabled { opacity: 0.3; cursor: default; pointer-events: none; }
    .date-picker-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--divider); }
    .date-picker-months { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
    .date-picker-month { min-width: 0; }

    @media (max-width: 919px) {
      .date-picker-panel {
        position: fixed;
        inset: auto 0 0;
        top: auto;
        z-index: var(--z-modal);
        isolation: isolate;
        min-width: 0;
        max-height: 86dvh;
        overflow-y: auto;
        border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
        background: var(--surface-main);
        box-shadow: 0 0 0 100vmax rgba(17, 23, 33, 0.62), var(--shadow-modal);
        animation: modal-slide-up var(--motion-duration-enter) var(--motion-easing-decelerate) both;
      }
      .date-picker-months { grid-template-columns: 1fr; }
      .date-picker-month-label { min-width: 0; }
      .date-picker-day { height: 44px; font-size: var(--fs-body); }
      .date-picker-trigger { width: 100% !important; min-width: 0 !important; }
    }

    .log-page {
      gap: var(--space-4);
    }

    .log-desktop-layout {
      display: grid;
      grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.75fr);
      gap: var(--space-4);
      align-items: start;
    }

    .log-main-column,
    .log-side-column {
      display: grid;
      gap: var(--space-4);
      min-width: 0;
    }

    .log-side-column {
      position: sticky;
      top: 20px;
    }

    .log-side-column .log-preview-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-page {
      gap: var(--space-4);
    }

    .dashboard-analyze-btn {
      justify-self: end;
      min-height: var(--control-desktop);
      padding-block: 8px;
    }

    .dashboard-analyze-btn .stars-icon {
      fill: currentColor;
      stroke: none;
    }

    .dashboard-production-summary {
      display: grid;
      gap: var(--space-4);
    }

    .dashboard-production-title {
      margin: 0;
      font-size: var(--fs-section-head);
      font-weight: 700;
      line-height: 1.2;
      color: var(--text-strong);
    }

    .dashboard-production-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--space-4);
    }

    .dashboard-production-list {
      display: grid;
      align-content: start;
      gap: var(--space-2);
      min-width: 0;
      padding: var(--space-5);
      background: var(--surface-main);
      border: 0;
      border-radius: var(--radius-xl);
      box-shadow: none;
    }

    .dashboard-production-list-title {
      margin: 0;
      font-size: var(--fs-label);
      font-weight: 650;
      line-height: 1.2;
      letter-spacing: 0.03em;
      text-transform: uppercase;
      color: var(--text-soft);
    }

    .dashboard-production-list .summary-list {
      display: grid;
    }

    .dashboard-production-list .summary-row {
      position: relative;
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: var(--space-3);
      padding: var(--space-2) 0;
      background: transparent;
      box-shadow: none;
      border-bottom: none;
    }

    .dashboard-production-list .summary-row + .summary-row::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 1px;
      background: var(--border-soft);
    }

    .dashboard-filter-card {
      display: grid;
      gap: var(--space-3);
    }


    .log-preview-card {
      background: var(--surface-tonal);
    }
    



    .foundation-list {
      margin: 0;
      padding-left: 18px;
      color: var(--text-muted);
    }

    .foundation-list li + li { margin-top: 6px; }

    .mini-separator {
      height: 1px;
      background: var(--divider);
      margin: var(--space-3) 0;
    }

    .dashboard-filter-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--space-3);
      align-items: end;
    }

    .dashboard-custom-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
      gap: var(--space-3);
      align-items: end;
    }

    .dashboard-range-row,
    .history-range-row {
      display: grid;
      gap: var(--space-2);
    }

    .range-shortcut-row {
      display: grid;
      gap: var(--space-2);
    }

    .range-shortcut-row.three {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .range-shortcut-row.two {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .range-shortcut-row .filter-chip {
      width: 100%;
    }

    .range-shortcut-row .filter-chip .filter-chip-visual {
      width: 100%;
    }

    .dashboard-metric-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: var(--space-3);
    }

    .summary-list {
      display: grid;
      gap: var(--space-2);
    }

    .summary-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: var(--space-3);
      align-items: center;
      padding: var(--space-2) 0;
      border-bottom: 1px solid var(--divider);
    }

    .summary-row:last-child {
      border-bottom: none;
    }

    .summary-row strong {
      color: var(--text-strong);
      font-size: var(--fs-subheadline);
      line-height: 1.2;
    }

    .summary-row span {
      color: var(--text-muted);
      font-size: var(--fs-label);
    }

    .analysis-panel {
      display: grid;
      gap: var(--space-2);
    }

    .analysis-toolbar {
      display: flex;
      justify-content: flex-end;
    }

    .analysis-actions {
      display: inline-flex;
      align-items: center;
      gap: var(--space-2);
    }

    .analysis-action-btn {
      border: 0;
      background: var(--surface-tonal);
      color: var(--text-tonal);
    }

    .analysis-action-btn .analysis-action-icon {
      display: inline-flex;
      align-items: center;
    }

    .analysis-action-btn .analysis-action-icon svg {
      width: 16px;
      height: 16px;
    }

    .analysis-close-btn {
      width: var(--control-desktop);
      min-width: var(--control-desktop);
      padding-inline: 0;
    }

    .analysis-output {
      white-space: normal;
      padding: var(--space-3);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-lg);
      background: var(--surface-soft);
      color: var(--text);
      font-size: var(--fs-subheadline);
      line-height: 1.55;
    }
    .analysis-output h2,
    .analysis-output h3,
    .analysis-output h4,
    .analysis-output h5 {
      margin: 0.85em 0 0.35em;
      color: var(--text-strong);
      font-weight: 800;
    }
    .analysis-output h2 { font-size: 1.1rem; }
    .analysis-output h3 { font-size: 1rem; }
    .analysis-output h4 { font-size: 0.9rem; }
    .analysis-output h5 { font-size: 0.85rem; }
    .analysis-output p { margin: 0.35em 0; }
    .analysis-output ul,
    .analysis-output ol { margin: 0.35em 0; padding-left: 1.4em; }
    .analysis-output li { margin: 0.15em 0; }
    .analysis-output code {
      background: var(--surface-card);
      padding: 1px 5px;
      border-radius: var(--radius-sm);
      font-size: var(--fs-label);
    }
    .analysis-output pre {
      background: var(--surface-card);
      padding: var(--space-2);
      border-radius: var(--radius-md);
      overflow-x: auto;
      font-size: var(--fs-label);
    }
    .analysis-output pre code {
      background: none;
      padding: 0;
    }
    .analysis-output hr {
      border: 0;
      border-top: 1px solid var(--divider);
      margin: var(--space-3) 0;
    }
    .analysis-output strong { color: var(--text-strong); }


    .log-form-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--space-3);
    }


    .log-form-grid.three {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .log-field-status {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      color: var(--text-muted);
      font-size: var(--fs-label);
      font-weight: 750;
    }

    .log-field-status::before {
      content: "";
      width: 7px;
      height: 7px;
      border-radius: var(--radius-pill);
      background: var(--border-strong);
    }

    .log-field-status.ok::before { background: var(--success-text); }
    .log-field-status.warn::before { background: var(--warning-text); }
    .log-field-status.err::before { background: var(--danger); }

    .log-stock-panel {
      grid-column: 1 / -1;
      width: 100%;
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: var(--space-4);
      align-items: start;
      background: var(--surface-page);
    }

    .log-stock-context {
      min-width: 0;
    }

    .log-stock-profile {
      margin-top: 3px;
      color: var(--text-strong);
      font-size: var(--fs-subheadline);
      font-weight: 800;
      line-height: 1.2;
      overflow-wrap: anywhere;
    }

    .log-stock-values {
      min-width: 150px;
      display: grid;
      justify-items: end;
      gap: 5px;
      text-align: right;
    }

    .log-stock-values .status-chip {
      min-height: 24px;
      padding: 4px 9px;
      font-size: var(--fs-label);
    }

    .log-stock-number {
      color: var(--text-strong);
      font-size: var(--fs-page-title);
      font-weight: 850;
      line-height: 1;
      letter-spacing: -0.04em;
    }

    .log-stock-reorder {
      margin: 0;
      color: var(--text-muted);
      font-size: var(--fs-label);
      font-weight: 750;
      line-height: 1.25;
    }

    .qc-toggle-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 0;
      padding: 1px;
      border: 1px solid var(--border-soft);
      border-radius: var(--radius-pill);
      background: transparent;
    }

    .qc-toggle {
      min-height: calc(var(--control-desktop) - 4px);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0 16px;
      border: none;
      border-radius: calc(var(--radius-pill) - 1px);
      background: transparent;
      color: var(--text-strong);
      font-size: var(--fs-label);
      font-weight: 650;
      cursor: pointer;
      position: relative;
      isolation: isolate;
      transition: background-color 140ms ease, color 140ms ease;
    }

    .qc-toggle::after {
      content: '';
      position: absolute;
      inset: 0;
      border-radius: inherit;
      background: currentColor;
      opacity: 0;
      pointer-events: none;
      transition: opacity 140ms ease;
    }

    .qc-toggle:hover:not(:disabled)::after {
      opacity: 0.08;
    }

    .qc-toggle:hover:not(:disabled) {
      background: var(--surface-nested);
    }



    .qc-toggle.active {
      background: var(--selection-fill);
      color: var(--selection-text);
      font-weight: 700;
    }

    .qc-toggle.active.pending {
      background: #C48300;
      color: #FFFFFF;
    }

    .qc-toggle.active.pass {
      background: #18844F;
      color: #FFFFFF;
    }

    .qc-toggle.active.fail {
      background: var(--danger);
      color: #FFFFFF;
    }

    .log-preview-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: var(--space-2);
    }

    .preview-sku {
      grid-column: 1 / -1;
    }

    .preview-sku .detail-label {
      font-size: var(--fs-label);
    }

    .preview-sku .detail-value {
      font-size: var(--fs-section-head);
      font-weight: 850;
    }

    .log-actions {
      display: flex;
      gap: var(--space-2);
      justify-content: flex-end;
      align-items: center;
    }

    .log-action-row {
      display: flex;
      gap: var(--space-2);
      justify-content: flex-end;
      align-items: center;
    }

    .textarea.notes-field {
      min-height: 104px;
    }


    .stock-filter-grid {
      display: grid;
      grid-template-columns: minmax(220px, 1fr) auto;
      gap: var(--space-3);
      align-items: center;
    }

    .stock-page-filter-row-desktop { display: flex; flex-wrap: nowrap; gap: var(--space-2); overflow-x: auto; padding-bottom: 2px; }
    .stock-page-filter-row-desktop .filter-chip { flex: 0 0 auto; }
    .stock-page-filter-row-desktop .filter-chip-visual { width: 100%; }
    .stock-page-filter-row { display: none; }

    .search-input-wrap {
      position: relative;
      display: flex;
      align-items: center;
    }

    .search-input-wrap svg {
      position: absolute;
      left: 12px;
      width: 18px;
      height: 18px;
      color: var(--text-muted);
      pointer-events: none;
      flex-shrink: 0;
    }

    .search-input-wrap .input {
      padding-left: 38px;
    }

    .stock-group {
      display: grid;
      gap: var(--space-3);
    }

    .stock-group-header,
    .history-date-header {
      position: sticky;
      z-index: 2;
      width: max-content;
      max-width: 100%;
      top: 12px;
      display: inline-flex;
      align-items: center;
      gap: var(--space-2);
      padding: 6px 10px;
      border: 1px solid rgba(255, 229, 205, 0.14);
      border-radius: var(--radius-xl);
      background: rgba(63, 33, 12, 0.96);
      color: var(--text-inverse);
      box-shadow: var(--shadow-card);
      backdrop-filter: blur(10px);
    }

    .stock-group-title,
    .history-date-header strong {
      margin: 0;
      color: var(--text-inverse);
      font-size: var(--fs-label);
      font-weight: 850;
      line-height: 1;
      letter-spacing: 0.02em;
      white-space: nowrap;
    }

    .stock-card-grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: var(--space-2);
    }

    .stock-card {
      display: grid;
      gap: var(--space-2);
      cursor: pointer;
      transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
    }

    .stock-card:hover {
      transform: translateY(-1px);
      border-color: var(--border-strong);
      box-shadow: var(--shadow-main);
    }

    .stock-card:active {
      transform: translateY(0);
    }

    .stock-card-header {
      min-width: 0;
      display: flex;
      align-items: center;
      gap: var(--space-3);
    }

    .stock-card-caret {
      margin-left: auto;
      flex-shrink: 0;
      color: var(--text-muted);
      opacity: 0.5;
    }

    .stock-card-caret svg {
      width: 18px;
      height: 18px;
    }

    .stock-card-title-row {
      min-width: 0;
      display: flex;
      align-items: center;
      gap: var(--space-2);
    }

    .stock-card-name {
      min-width: 0;
      margin: 0;
      overflow: hidden;
      color: var(--text-strong);
      font-size: var(--fs-body);
      font-weight: 850;
      line-height: 1.15;
      letter-spacing: -0.01em;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .stock-code-chip {
      min-height: 24px;
      display: inline-flex;
      align-items: center;
      flex: 0 0 auto;
      padding: 4px 9px;
      border-radius: var(--radius-md);
      border: 1px solid var(--border-soft);
      background: var(--neutral-bg);
      color: var(--neutral-text);
      font-size: var(--fs-label);
      font-weight: 850;
      line-height: 1;
      white-space: nowrap;
    }

    .stock-card-amount {
      display: flex;
      align-items: baseline;
      flex-wrap: wrap;
      gap: 7px;
      color: var(--text-strong);
      font-size: var(--fs-section-head);
      font-weight: 700;
      line-height: var(--lh-display);
      letter-spacing: -0.03em;
    }

    .stock-card-unit {
      color: var(--text-muted);
      font-size: var(--fs-label);
      font-weight: 750;
      letter-spacing: 0;
    }

    .stock-card-bar-row {
      display: block;
    }

    .stock-card-meta {
      margin: 0;
      color: var(--text-muted);
      font-size: var(--fs-label);
      font-weight: 650;
    }

    .stock-level-bar {
      width: 100%;
      height: 4px;
      overflow: hidden;
      border-radius: var(--radius-pill);
      background: var(--surface-soft);
    }

    .stock-level-fill {
      height: 100%;
      min-width: 5%;
      border-radius: var(--radius-pill);
      transition: width 160ms ease;
    }

    .stock-level-fill.healthy { background: #18844F; }
    .stock-level-fill.low { background: #D99A18; }
    .stock-level-fill.reorder { background: var(--danger); }
    .stock-level-fill.unknown { background: var(--text-soft); }

    .stock-modal-summary {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--space-2);
    }



    .stock-modal-summary .stock-modal-current-value {
      display: flex;
      align-items: center;
      gap: var(--space-2);
    }

    .stock-modal-current-value {
      color: var(--text-strong);
      font-size: var(--fs-page-title);
      font-weight: 850;
      line-height: 1;
      letter-spacing: -0.04em;
    }

    .stock-modal-status-row {
      display: flex;
      justify-content: flex-end;
    }

    .stock-modal-action-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--space-3);
    }

    .stock-modal-action-card {
      display: grid;
      gap: var(--space-2);
      align-content: start;
      border-radius: var(--radius-xl);
      padding: var(--space-3);
      border: 1px solid var(--border-soft);
      background: var(--surface-card);
    }

    .stock-modal-action-card > .btn:last-child {
      justify-self: end;
    }

    .stock-modal-action-card.add {
      background: var(--success-bg);
      border-color: var(--success-border);
    }

    
    .stock-modal-field-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      gap: var(--space-3);
    }

    .history-filter-grid {
      display: grid;
      grid-template-columns: minmax(220px, 1.2fr) repeat(2, minmax(150px, 0.8fr));
      gap: var(--space-3);
      align-items: end;
    }

    .history-custom-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(150px, 1fr)) auto;
      gap: var(--space-3);
      align-items: end;
    }

    .history-group {
      display: grid;
      gap: var(--space-2);
    }

    .history-date-card {
      display: grid;
      gap: var(--space-2);
    }

    .history-log-list {
      display: grid;
      gap: var(--space-2);
    }

    .history-log-row {
      display: grid;
      gap: var(--space-2);
      padding: var(--space-3);
      border: 1px solid var(--border-soft);
      border-radius: var(--radius-xl);
      background: var(--surface-card);
      cursor: pointer;
      transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
    }

    .history-log-row:hover {
      border-color: var(--border-strong);
      background: var(--surface-soft);
      transform: translateY(-1px);
    }

    .history-log-head {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: var(--space-3);
      align-items: start;
    }

    .history-row-caret {
      display: flex;
      align-items: center;
      color: var(--text-muted);
      opacity: 0.4;
    }

    .history-row-caret svg {
      width: 16px;
      height: 16px;
    }

    .history-log-kicker {
      margin: 0 0 2px;
      color: var(--bb-primary);
      font-size: var(--fs-label);
      font-weight: 650;
      letter-spacing: 0.09em;
      line-height: 1.1;
      text-transform: uppercase;
    }

    .history-log-title {
      min-width: 0;
      margin: 0;
      color: var(--text-strong);
      font-size: var(--fs-card-title);
      font-weight: 700;
      line-height: var(--lh-heading);
      letter-spacing: -0.015em;
    }

    .history-log-meta-row {
      display: flex;
      align-items: center;
      gap: 7px;
      color: var(--text-soft);
      font-size: var(--fs-label);
      font-weight: 650;
      line-height: 1.35;
    }

    .history-log-chip-row {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 7px;
    }

    .history-log-chip {
      min-height: 24px;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 4px 8px;
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-md);
      background: var(--surface-soft);
      color: var(--text-strong);
      font-size: var(--fs-label);
      font-weight: 800;
      line-height: 1;
      white-space: nowrap;
    }

    .history-missing-chip {
      min-height: 24px;
      display: inline-flex;
      align-items: center;
      padding: 4px 8px;
      border: 1px solid var(--danger-border);
      border-radius: var(--radius-md);
      background: var(--danger-bg);
      color: var(--danger-text);
      font-size: var(--fs-label);
      font-weight: 850;
      line-height: 1;
      white-space: nowrap;
    }

    .history-save-chip {
      min-height: 24px;
      display: inline-flex;
      align-items: center;
      padding: 4px 8px;
      border: 1px solid var(--warning-border);
      border-radius: var(--radius-md);
      background: var(--warning-bg);
      color: var(--warning-text);
      font-size: var(--fs-label);
      font-weight: 850;
      line-height: 1;
      white-space: nowrap;
    }

    .history-save-chip.saved {
      border-color: var(--success-border);
      background: var(--success-bg);
      color: var(--success-text);
    }

    .history-save-chip.failed {
      border-color: var(--danger-border);
      background: var(--danger-bg);
      color: var(--danger-text);
    }

    .history-log-retry {
      justify-self: start;
    }

    .history-modal-title-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: center;
      gap: var(--space-3);
    }

    .history-detail-controls {
      display: inline-flex;
      align-items: center;
      gap: var(--space-2);
    }

    .history-detail-controls .icon-btn {
      width: var(--control-desktop);
      padding-inline: 0;
    }

    .roast-details-card,
    .roast-detail-section,
    .roast-curve-scroll { min-width: 0; max-width: 100%; }

    .roast-curve-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    .btn-group {
      --btn-group-height: 36px;
      --btn-group-radius: calc(var(--btn-group-height) / 2);
      display: inline-flex;
      gap: 2px;
      padding: 2px;
      background: transparent;
    }

    .btn-group button {
      min-height: var(--btn-group-height);
      border: 1px solid var(--border-soft);
      background-color: var(--selection-bg);
      color: var(--text-strong);
      border-radius: var(--radius-sm);
      font-size: var(--fs-subheadline);
      font-weight: 650;
      cursor: pointer;
      padding: 0 16px;
      white-space: nowrap;
      transition: background-color 180ms var(--motion-easing-decelerate), color 180ms var(--motion-easing-decelerate), border-radius 180ms var(--motion-easing-decelerate);
    }

    .btn-group .icon-btn {
      width: 36px;
      padding: 0;
    }

    .btn-group button:first-child {
      border-radius: var(--btn-group-radius) var(--radius-sm) var(--radius-sm) var(--btn-group-radius);
    }

    .btn-group button:last-child {
      border-radius: var(--radius-sm) var(--btn-group-radius) var(--btn-group-radius) var(--radius-sm);
    }

    .btn-group button:hover {
      background-color: var(--surface-nested);
      color: var(--text-strong);
    }

    .btn-group button.active {
      background-color: var(--selection-fill);
      color: var(--selection-text);
      border-color: transparent;
      border-radius: var(--btn-group-radius);
      font-weight: 700;
    }

    .history-detail-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: var(--space-2);
    }

    .history-detail-grid.two {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Key-value grid — clean label/value pairs without per-cell cards */
    .kv-grid {
      display: grid;
      grid-template-columns: max-content 1fr;
      gap: var(--space-2) var(--space-5);
      align-items: baseline;
    }
    .kv-grid .detail-label {
      padding: var(--space-1) 0;
    }
    .kv-grid .detail-value {
      margin: 0;
      padding: var(--space-1) 0;
    }

    /* Status detail order header */
    .order-detail-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: var(--space-3);
    }
    .order-detail-header .card-title {
      font-size: var(--fs-page-title);
      font-weight: 700;
      margin: 0;
    }

    .detail-card-grid {
      display: grid;
      gap: var(--space-4);
    }

    .roast-details-card { gap: var(--space-5); }
    .roast-detail-section + .roast-detail-section { border-top: 1px solid var(--divider); padding-top: var(--space-5); }
    .roast-detail-kicker { margin: 0 0 var(--space-3); color: var(--text-muted); font-size: var(--fs-label); font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
    .roast-curve { display: block; width: 100%; height: auto; min-width: 560px; fill: none; stroke: none; stroke-width: 0; }
    .roast-curve text { stroke: none; }
    .roast-curve-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .roast-curve-grid { stroke: var(--divider); stroke-width: 1; stroke-dasharray: 3 5; }
    .roast-curve-axis { stroke: var(--border-strong); stroke-width: 1.5; }
    .roast-curve-path { fill: none; stroke: var(--bb-primary); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
    .roast-curve-point { fill: var(--surface-card); stroke: var(--bb-coffee); stroke-width: 2.5; }

    .roast-curve-leader { stroke: var(--text-muted); stroke-width: 1; }
    .roast-curve-label { fill: var(--text-strong); font-family: var(--font-body); font-size: var(--fs-label); font-weight: 650; }
    .roast-curve-value { fill: var(--text-muted); font-family: var(--font-body); font-size: var(--fs-subheadline); font-weight: 500; }
    .roast-curve-axis-label { fill: var(--text-muted); font-family: var(--font-body); font-size: var(--fs-label); font-weight: 650; }
    .roast-curve-empty { display: grid; min-height: 180px; place-items: center; padding: var(--space-4); color: var(--text-muted); font-size: var(--fs-subheadline); text-align: center; }
    .roast-phase-grid, .roast-yield-flow, .roast-key-metrics { display: grid; }
    .roast-phase-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .roast-phase { min-width: 0; padding: 0 var(--space-4); }
    .roast-phase:first-child { padding-left: 0; }
    .roast-phase:last-child { padding-right: 0; }
    .roast-phase + .roast-phase { border-left: 1px solid var(--divider); }
    .roast-phase-name, .roast-yield-label, .roast-metric-label { display: block; color: var(--text-muted); font-size: var(--fs-label); font-weight: 650; text-transform: uppercase; }
    .roast-phase-value, .roast-yield-value, .roast-metric-value { display: block; margin-top: 5px; color: var(--text-strong); font-size: var(--fs-card-title); font-weight: 700; }
    .roast-phase-note { display: block; margin-top: 5px; color: var(--text-muted); font-size: var(--fs-subheadline); }
    .roast-yield-flow { grid-template-columns: 1fr auto 1fr auto 1fr; gap: var(--space-3); align-items: center; }
    .roast-yield-node { min-width: 0; }
    .roast-yield-arrow { color: var(--text-muted); font-size: var(--fs-section-head); }
    .roast-yield-notes { grid-column: 2 / -1; display: flex; gap: var(--space-5); color: var(--text-muted); font-size: var(--fs-subheadline); }
    .roast-key-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .roast-metric { min-width: 0; padding: 0 var(--space-4); }
    .roast-metric:first-child { padding-left: 0; }
    .roast-metric:last-child { padding-right: 0; }
    .roast-metric + .roast-metric { border-left: 1px solid var(--divider); }

    @media (max-width: 919px) {
      .roast-details-card { gap: var(--space-4); }
      .roast-detail-section + .roast-detail-section { padding-top: var(--space-4); }
      .history-detail-controls { gap: 4px; }
      .history-detail-controls .history-copy-btn,
      .history-detail-controls .history-download-btn {
        width: var(--control-desktop);
        height: var(--control-desktop);
        min-height: var(--control-desktop);
        padding-inline: 0;
      }
      .history-detail-controls .history-control-label { display: none; }
      .roast-curve { min-width: 520px; }
      .roast-phase-grid { grid-template-columns: 1fr; gap: 0; }
      .roast-phase { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--space-3); padding: var(--space-3) 0; border: 0; border-radius: 0; border-bottom: 1px solid var(--divider); background: transparent; }
      .roast-phase + .roast-phase { border-left: 0; }
      .roast-phase:last-child { border-bottom: 0; }
      .roast-phase-value { grid-column: 2; grid-row: 1; margin: 0; font-size: var(--fs-subheadline); }
      .roast-phase-note { grid-column: 1 / -1; margin: 0; }
      .roast-yield-flow { grid-template-columns: 1fr auto; gap: 0; }
      .roast-yield-node { display: contents; }
      .roast-yield-label { padding: var(--space-2) 0; }
      .roast-yield-value { margin: 0; padding: var(--space-2) 0; text-align: right; font-size: var(--fs-subheadline); }
      .roast-yield-arrow { display: none; }
      .roast-yield-notes { grid-column: 1 / -1; display: grid; gap: 0; margin: 0; padding: var(--space-1) 0 var(--space-2); border-top: 1px solid var(--divider); }
      .roast-key-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-4); }
      .roast-metric { padding: var(--space-3) 0; border: 0; border-bottom: 1px solid var(--divider); }
      .roast-metric + .roast-metric { border-left: 0; }
      .roast-metric:nth-last-child(-n + 2) { border-bottom: 0; }
      .roast-metric { display: flex; align-items: baseline; justify-content: space-between; padding: var(--space-2) 0; border: 0; border-radius: 0; border-bottom: 1px solid var(--divider); background: transparent; }
      .roast-metric-value { margin: 0; font-size: var(--fs-subheadline); }
    }

    .section-head-title {
      font-size: var(--fs-section-head);
      font-weight: 850;
    }
    .order-detail-header .muted {
      margin: 3px 0 0;
      font-size: var(--fs-subheadline);
    }

    .history-output-input.filled,
    .edit-log-input.filled {
      background: var(--surface-soft);
      border-color: var(--border-strong);
    }

    .history-output-actions {
      display: flex;
      justify-content: space-between;
      gap: var(--space-2);
      align-items: center;
    }

    .settings-version-card {
      display: grid;
      justify-items: center;
      text-align: center;
      gap: 6px;
    }

    .settings-app-title {
      margin: 0;
      color: var(--text-strong);
      font-size: clamp(24px, 2.6vw, 34px);
      font-weight: 850;
      line-height: 1.05;
      letter-spacing: -0.025em;
    }

    .settings-version-number {
      color: var(--text-muted);
      font-size: var(--fs-subheadline);
      font-weight: 850;
      line-height: 1;
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }

    

    

    .settings-page-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: var(--space-4);
      width: 100%;
    }

    /* v2.3.2 code-note block */
    .code-note {
      margin: 0;
      padding: 14px;
      border-radius: var(--radius-lg);
      background: var(--surface-card);
      color: var(--text-strong);
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      font-size: 0.75rem;
      line-height: 1.5;
      overflow-x: auto;
      max-height: 320px;
      overflow-y: auto;
    }

    .settings-account-body {
      display: grid;
      gap: var(--space-3);
      align-content: start;
    }

    .settings-account-actions {
      display: flex;
      justify-content: flex-end;
      gap: var(--space-2);
    }

    .settings-account-body .btn {
      justify-self: start;
      min-width: 200px;
    }

    .account-session-line {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--space-3);
      padding: 10px 0;
      border-top: 1px solid var(--divider);
    }

    .account-session-line:first-child {
      border-top: 0;
      padding-top: 0;
    }

    .account-session-label {
      color: var(--text-muted);
      font-size: var(--fs-label);
      font-weight: 850;
      letter-spacing: 0.08em;
      line-height: 1.1;
      text-transform: uppercase;
    }

    .account-session-value {
      color: var(--text-strong);
      font-size: var(--fs-subheadline);
      font-weight: 800;
      line-height: 1.2;
      text-align: right;
    }

    .stock-confirm-flow {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
      gap: var(--space-3);
      align-items: stretch;
    }

    .stock-confirm-card {
      display: grid;
      gap: 8px;
      padding: var(--space-4);
      border: 1px solid var(--border-soft);
      border-radius: var(--radius-lg);
      background: var(--surface-soft);
    }

    .stock-confirm-card.after {
      background: var(--success-bg);
      border-color: var(--success-border);
    }

    .stock-confirm-value {
      color: var(--text-strong);
      font-size: clamp(26px, 3.2vw, 36px);
      font-weight: 850;
      line-height: 1;
      letter-spacing: -0.04em;
    }

    .stock-confirm-note {
      color: var(--text-muted);
      font-size: var(--fs-label);
      font-weight: 750;
      line-height: 1.3;
    }

    .stock-confirm-arrow {
      width: 38px;
      display: grid;
      place-items: center;
      color: var(--bb-coffee);
    }

    .stock-confirm-arrow svg {
      width: 28px;
      height: 28px;
    }

    @media (max-width: 919px) {
      :root {
        --radius-sm: 8px;
        --radius-md: 10px;
        --radius-lg: 14px;
        --radius-xl: 20px;
        --radius-2xl: 28px;
      }
      .settings-page-header {
        flex-direction: column;
        align-items: stretch;
      }
      .settings-account-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--space-2);
      }

      .stock-confirm-flow {
        grid-template-columns: 1fr;
      }

      .stock-confirm-arrow {
        width: 100%;
        transform: rotate(90deg);
      }
    }


    .oms-lane-banner {
      width: 100%;
    }

    .oms-lane-banner[hidden] {
      display: none;
    }

    .oms-lane-alert {
      display: flex;
      align-items: center;
      text-align: left;
      overflow: hidden;
      border: 1px solid var(--warning-border);
      border-radius: var(--radius-xl);
      background: var(--warning-bg);
      color: var(--warning-text);
      box-shadow: var(--shadow-card);
      cursor: pointer;
    }

    .oms-lane-banner .oms-lane-alert {
      width: 100%;
      max-width: none;
      min-height: 52px;
      box-sizing: border-box;
    }

    .oms-lane-alert:hover {
      border-color: var(--warning-text);
    }

    .oms-lane-alert:focus-visible {
      outline: 3px solid rgba(246, 126, 15, 0.28);
      outline-offset: -3px;
    }

    .oms-lane-alert > svg {
      flex-shrink: 0;
      margin-left: 12px;
    }

    .oms-lane-alert-row {
      flex: 1 1 0;
      display: inline-flex;
      align-items: center;
      justify-content: flex-start;
      gap: var(--space-2);
      min-height: 42px;
      padding: 10px 8px;
    }

    .oms-lane-caret {
      flex-shrink: 0;
      margin-left: auto;
      padding: 0 12px;
      color: var(--warning-text);
      opacity: 0.5;
      display: flex;
      align-items: right;
    }

    .oms-lane-caret svg {
      width: 18px;
      height: 18px;
    }

    .oms-lane-alert-title {
      margin: 0;
      font-size: var(--fs-subheadline);
      font-weight: 850;
      line-height: 1.2;
    }

    .oms-lane-alert-count {
      min-width: 28px;
      min-height: 28px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 4px 9px;
      border-radius: var(--radius-pill);
      background: #5F3B00;
      color: #FFF7ED;
      font-size: var(--fs-label);
      font-weight: 850;
      line-height: 1;
    }


    @media (max-width: 919px) {
      .oms-lane-banner .oms-lane-alert {
        flex-wrap: wrap;
        gap: 4px;
        padding: 8px 10px;
      }

      .oms-lane-banner .oms-lane-alert > svg {
        margin-left: 2px;
      }

      .oms-lane-banner .oms-lane-alert-row {
        min-height: 32px;
        padding: 4px 6px;
      }

      .oms-lane-banner .oms-lane-caret {
        padding: 0 4px;
      }
    }

    .history-desktop-workspace {
      display: none;
    }

    .history-mobile-workspace {
      display: block;
    }

    .history-desktop-workspace .history-group {
      gap: var(--space-2);
    }

    .history-desktop-workspace .history-date-card {
      display: contents;
    }

    .history-desktop-workspace .history-log-row {
      background: var(--surface-card);
    }

    .history-loading {
      opacity: 0.72;
      pointer-events: none;
    }


    @media (min-width: 921px) {

      .settings-account-actions {
        display: none;
      }

      .dashboard-filter-card,
      .history-filter-card {
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
      }

      .dashboard-range-row,
      .history-range-row {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: var(--space-2);
      }

      .dashboard-range-row .dashboard-analyze-btn {
        margin-left: auto;
      }

      .range-shortcut-row {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-2);
      }

      .range-shortcut-row.three,
      .range-shortcut-row.two {
        grid-template-columns: none;
      }

      .range-shortcut-row .filter-chip {
        width: auto;
      }

      .history-desktop-workspace { display: grid; gap: var(--space-3); }
      .history-mobile-workspace { display: none; }
      .history-filter-grid {
        grid-template-columns: minmax(260px, 1.4fr) minmax(160px, 0.8fr) minmax(180px, 0.8fr);
      }
      .detail-card-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--space-4);
      }
      .stock-card-grid {
        grid-template-columns: repeat(2, minmax(280px, 1fr));
        align-items: stretch;
      }

      .stock-card {
        align-content: start;
      }

      .status-desktop-grid {
        grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
      }

      .status-calendar-day {
        min-height: 92px;
      }

      .status-activity-row {
        grid-template-columns: minmax(120px, 0.65fr) minmax(0, 1.35fr) minmax(110px, 0.65fr);
        padding: 10px 12px;
      }
    }

    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
      }
    }

    @media (max-width: 919px) {
      .app-shell {
        display: block;
        padding-top: calc(var(--mobile-header-height) + 24px + env(safe-area-inset-top, 0px));
      }

      .sidebar,
      .desktop-header { display: none; }

      .main { padding: 12px 12px var(--mobile-nav-clearance); }
      .mobile-header,
      .mobile-bottom-nav { display: block; }
      .layout-grid,
      .three-grid,
      .metric-grid,
      .form-grid,
      .record-details { grid-template-columns: 1fr; }
      .surface-main { padding: var(--space-4); border-radius: var(--radius-xl); }

      .surface-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
        column-gap: var(--space-3);
        row-gap: 5px;
        margin-bottom: var(--space-3);
      }

      .surface-header > div:first-child { display: contents; }
      .surface-header .kicker { grid-column: 1; grid-row: 1; align-self: center; margin-bottom: 0; }
      .surface-header .section-title { grid-column: 1 / -1; grid-row: 2; }
      .surface-header > div:first-child > p:not(.kicker) { grid-column: 1 / -1; grid-row: 3; margin-top: 2px; }
      .surface-header > .status-chip,
      .surface-header > .inline-row,
      .surface-header > .btn { grid-column: 2; grid-row: 1; justify-self: end; align-self: center; }

      .btn,
      .input,
      .select,
      .textarea,
      input,
      select,
      textarea,
      .readonly-value { min-height: var(--control-mobile); }

      .btn {
        font-size: 1rem;
        font-weight: 700;
        letter-spacing: -0.02em;
      }

      .dashboard-analyze-btn {
        min-height: var(--control-mobile);
        padding-block: 10px;
      }

      .filter-chip-visual {
        min-height: 36px;
        font-size: var(--fs-subheadline);
      }
      .status-chip { min-height: 26px; padding: 5px 9px; }
      .status-kanban-board { grid-template-columns: repeat(5, 58.5vw); }
      .status-calendar-grid { width: 100%; min-width: 0; }
      .status-calendar-scroll { overflow: visible; padding-bottom: 0; }
      .status-calendar-weekday { padding: 7px 2px; font-size: var(--fs-label); letter-spacing: 0.04em; }
      .status-calendar-day { min-height: 82px; padding: 5px 3px; gap: 4px; }
      .status-calendar-date { width: 24px; height: 24px; font-size: var(--fs-label); }
      .status-calendar-chip { padding: 3px 5px; font-size: var(--fs-label); }
      .status-activity-row { grid-template-columns: 1fr; gap: 3px; }
      .status-card-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .modal-backdrop { align-items: flex-end; padding: 0; }
      .modal:not(.confirm) .modal-close-btn { display: none; }
      .modal-backdrop.closing { animation: backdrop-fade-out 200ms ease both; }
      .modal { width: 100%; max-height: 86dvh; border-radius: var(--radius-2xl) var(--radius-2xl) 0 0; }
      .modal:not(.confirm) { animation: modal-slide-up 400ms cubic-bezier(.05,.7,.1,1) both; }
      .modal:not(.confirm).closing { animation: modal-slide-down 220ms cubic-bezier(.3,0,.8,.15) both; }
      .modal-backdrop.centered-confirm { align-items: center; padding: 18px; }
      .modal-backdrop.centered-confirm .modal { width: min(100%, 460px); border-radius: var(--radius-2xl); }
      .toast { left: 14px; right: 14px; bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 10px); max-width: none; }
      .log-desktop-layout, .dashboard-production-grid { grid-template-columns: 1fr; }
      .log-side-column { position: static; }
      .log-form-grid, .log-form-grid.three { grid-template-columns: 1fr; }
      .log-preview-grid, .log-side-column .log-preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .log-preview-grid .preview-full { grid-column: 1 / -1; }
      .stock-modal-action-grid, .history-filter-grid, .history-detail-grid, .history-detail-grid.two, .dashboard-filter-grid { grid-template-columns: 1fr; }
      .history-filter-grid { grid-template-columns: 1fr 1fr; }
      .history-filter-grid .search-field { grid-column: 1 / -1; }
      .history-range-row { display: flex; flex-wrap: nowrap; gap: var(--space-2); overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
      .history-range-row .range-shortcut-row { display: flex; flex: 0 0 auto; gap: var(--space-2); }
      .history-range-row .range-shortcut-row.three,
      .history-range-row .range-shortcut-row.two { grid-template-columns: none; }
      .history-range-row .filter-chip { width: auto; flex: 0 0 auto; }
      .history-range-row .filter-chip-visual { width: auto; }
      .dashboard-range-row { display: flex; flex-wrap: nowrap; gap: var(--space-2); overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
      .dashboard-range-row .range-shortcut-row { display: flex; flex: 0 0 auto; gap: var(--space-2); }
      .dashboard-range-row .range-shortcut-row.three,
      .dashboard-range-row .range-shortcut-row.two { grid-template-columns: none; }
      .dashboard-range-row .filter-chip { width: auto; flex: 0 0 auto; }
      .dashboard-range-row .filter-chip-visual { width: 100%; }
      .history-filter-card { background: transparent; padding: 0; }
      .history-filter-grid .field select { min-width: 0; }
      .history-custom-grid, .dashboard-custom-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .history-custom-grid .btn, .dashboard-custom-grid .btn { grid-column: 1 / -1; }
      .stock-modal-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }

      .stock-filter-grid { grid-template-columns: minmax(0, 1fr); }
      .stock-page-filter-row-desktop { display: none; }
      .stock-page-filter-row { display: flex; flex-wrap: nowrap; gap: var(--space-2); overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
      .dashboard-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .stock-group-header,
      .history-date-header { top: calc(var(--mobile-header-height) + 24px + env(safe-area-inset-top, 0px)); }
      .history-mobile-workspace .history-group + .history-group { margin-top: var(--space-4); }
      .log-stock-panel {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: var(--space-2);
        align-items: center;
      }
      .stock-card-header { gap: var(--space-2); }
      .stock-card-title-row { flex: 1 1 auto; }
      .stock-card-name { font-size: clamp(14px, 4vw, 16px); }
      .stock-card-amount { font-size: var(--fs-section-head); }
      .log-stock-values {
        min-width: 112px;
        justify-items: end;
        text-align: right;
      }
      .log-stock-number { font-size: var(--fs-section-head); }
      .log-stock-reorder { font-size: var(--fs-label); }
      .log-preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .log-preview-grid .preview-full { grid-column: 1 / -1; }
      input[type="date"].input {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        display: block;
        text-align: left;
        font-size: var(--fs-body);
        line-height: 1.2;
        -webkit-appearance: none;
        appearance: none;
      }
      input[type="date"].input::-webkit-date-and-time-value {
        min-width: 0;
        text-align: left;
      }
      .qc-toggle { min-height: calc(var(--control-mobile) - 4px); font-size: var(--fs-subheadline); font-weight: 700; }
      .log-action-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
      }
    }

    /* ── Typography Showcase ─────────────────────────── */
    .type-ref-page {
      max-width: 900px;
    }
    .type-ref-table {
      width: 100%;
      border-collapse: collapse;
    }
    .type-ref-table th {
      text-align: left;
      padding: 10px 14px;
      background: var(--surface-tonal);
      font-size: var(--fs-label);
      font-weight: 850;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--text-muted);
      border-bottom: 1px solid var(--divider);
    }
    .type-ref-table td {
      padding: 14px;
      border-bottom: 1px solid var(--divider);
      vertical-align: middle;
    }
    .type-ref-sample {
      display: block;
      color: var(--text-strong);
      letter-spacing: normal;
    }
    .type-ref-token {
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      font-size: var(--fs-label);
      color: var(--bb-primary);
      white-space: nowrap;
    }
    .type-ref-px {
      font-size: var(--fs-subheadline);
      font-weight: 800;
      color: var(--text-strong);
      white-space: nowrap;
    }
    .type-ref-weight {
      font-size: var(--fs-subheadline);
      color: var(--text-muted);
    }
    .type-ref-usage {
      font-size: var(--fs-subheadline);
      color: var(--text-muted);
      line-height: 1.4;
    }

    /* Required roast-batch assignment for Roasting → Packing. */
    .roast-batch-picker { display: grid; gap: var(--space-3); }
    .roast-batch-picker .field-label { color: var(--text-strong); font-size: var(--fs-label); font-weight: 800; }
    .roast-batch-picker .field-label span { color: var(--danger); }
    .roast-batch-picker .input { width: 100%; min-height: var(--control-desktop); padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface-input); color: var(--text); }
    .roast-batch-picker .input:focus { outline: 3px solid var(--focus-ring); outline-offset: 1px; border-color: var(--bb-primary); }
    .roast-batch-results { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; padding: 2px; }
    .roast-batch-option { display: grid; gap: 2px; width: 100%; padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: var(--radius-md); background: var(--surface-card); color: var(--text); text-align: left; cursor: pointer; }
    .roast-batch-option:hover, .roast-batch-option:focus-visible { border-color: var(--bb-primary); background: var(--selection-bg); }
    .roast-batch-option.selected { border-color: var(--bb-primary); background: var(--surface-tonal); box-shadow: 0 0 0 2px var(--focus-ring); }
    .roast-batch-option strong { color: var(--text-strong); font-size: var(--fs-subheadline); }
    .roast-batch-option span { color: var(--text-muted); font-size: var(--fs-label); }
    .roast-batch-selected { display: grid; gap: 2px; padding: 9px 12px; border: 1px solid var(--success-border); border-radius: var(--radius-md); background: var(--success-bg); color: var(--success-text); }
    .roast-batch-selected strong { font-size: var(--fs-label); }
    .roast-batch-selected span { font-size: var(--fs-subheadline); font-weight: 700; }
    .roast-batch-picker-state, .roast-batch-picker-error { padding: 12px; border-radius: var(--radius-md); color: var(--text-muted); font-size: var(--fs-subheadline); text-align: center; }
    .roast-batch-picker-error { background: var(--danger-bg); color: var(--danger-text); }
    .roast-batch-load-more { justify-self: center; }
