/* =============================================================================
   JianCha SCM Platform — Static prototype stylesheet
   Implements design tokens from docs/11-ui-design-system.md.
   ============================================================================ */

/* ── Tokens ────────────────────────────────────────────────────────────────── */
/* JianCha International — colors aligned to the CI Brand Guidebook
   PRIMARY:    #181818 (deep charcoal black), #AD9C82 (champagne gold)
   SECONDARY:  #545351 (warm grey), #E0DDD3 (cream beige), #FFFFFF
   The legacy --brand-navy-* token names are kept as aliases so existing
   selectors continue to work — they now resolve to the brand colors. */
:root {
  /* CI brand */
  --brand-black:       #181818;   /* primary text, sidebar, topbar */
  --brand-gold:        #AD9C82;   /* champagne accent — buttons, links, highlights */
  --brand-gold-light:  #c4b69a;   /* hover */
  --brand-gold-dark:   #8c7d68;   /* pressed / strong emphasis */
  --brand-grey:        #545351;   /* secondary text */
  --brand-cream:       #E0DDD3;   /* dividers, subtle backgrounds */
  --brand-cream-light: #f0ede5;   /* lightest tint */
  --brand-white:       #FFFFFF;

  /* Legacy aliases (re-mapped to brand palette) */
  --brand-navy-900: #181818;    /* deepest → brand black */
  --brand-navy-700: #2a2624;    /* dark → warm charcoal */
  --brand-navy-500: #AD9C82;    /* main accent → brand gold */
  --brand-navy-300: #c4b69a;    /* mid → light gold */
  --brand-navy-100: #f0ede5;    /* lightest → light cream */

  --bg-base:     #ffffff;
  --bg-elevated: #fafaf7;       /* warm-tinted near-white */
  --bg-subtle:   #f4f1ea;       /* light cream surface */
  --border:      #e8e3d6;       /* warm cream border */
  --border-strong: #d4ccb8;
  --text-primary:   #181818;    /* brand black */
  --text-secondary: #545351;    /* brand grey */
  --text-disabled:  #9a9590;    /* muted warm grey */

  /* Status colors — gently warm-shifted to harmonise with the gold/cream palette */
  --status-blue:   #4a6c9e;     /* muted navy (info / in-transit) */
  --status-yellow: #c89f4a;     /* warm amber */
  --status-green:  #6a8e5e;     /* sage green */
  --status-red:    #b85a52;     /* warm terracotta */
  --status-grey:   #8c8580;     /* warm grey */

  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;   /* slightly softer corners — modern, refined */
  --shadow-sm: 0 1px 2px rgba(24,24,24,.06);
  --shadow-md: 0 4px 14px rgba(24,24,24,.08);
  --shadow-lg: 0 14px 40px rgba(24,24,24,.12);

  --topbar-h: 56px;
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 64px;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
[data-theme="dark"] {
  --bg-base: #1a1816; --bg-elevated: #25221f; --bg-subtle: #2f2a26;
  --border: #3a342d; --border-strong: #4a4238;
  --text-primary: #f0ede5; --text-secondary: #b8b2a4; --text-disabled: #6e6862;
  --brand-navy-700: #c4b69a; --brand-navy-500: #AD9C82; --brand-navy-300: #8c7d68; --brand-navy-100: #2f2a26;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter','IBM Plex Sans Thai',system-ui,-apple-system,sans-serif;
  font-size: 14px; line-height: 1.45;
  color: var(--text-primary); background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font: inherit; }
table { border-collapse: collapse; width: 100%; }
.hidden { display: none !important; }
.icon { width: 16px; height: 16px; }
:focus-visible { outline: 2px solid var(--brand-gold); outline-offset: 2px; border-radius: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* Headings — letter-spacing nods to the brand's wide-typography aesthetic */
h1 { font-size: 28px; line-height: 36px; font-weight: 600; margin: 0; letter-spacing: -.005em; color: var(--brand-black); }
h2 { font-size: 22px; line-height: 30px; font-weight: 600; margin: 0; letter-spacing: -.005em; color: var(--brand-black); }
h3 { font-size: 18px; line-height: 26px; font-weight: 600; margin: 0; letter-spacing: -.005em; color: var(--brand-black); }
h4 { font-weight: 600; color: var(--brand-black); }
.text-secondary { color: var(--text-secondary); }
/* Generic spin animation — used by Refresh button icon, loading spinners */
@keyframes spin { to { transform: rotate(360deg); } }

.font-mono {
  font-family: 'JetBrains Mono',ui-monospace,monospace;
  font-size: 13px;
  /* product codes / IDs never wrap (P-001, GPO-100250, JS202600028, "020001").
     !important defeats per-table overrides like .table--wide td strong { word-break: break-word }
     that would otherwise break the code mid-digit. */
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
}
/* Catch inline `style="font-family:'JetBrains Mono'..."` usages too — they also represent IDs/codes */
[style*="JetBrains Mono"] {
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
}

/* Logo mark — champagne-gold gradient with subtle inset highlight,
   matching the CI brand's "quiet luxury" feel */
.logo-mark {
  width: 40px; height: 40px; border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--brand-gold) 0%, var(--brand-gold-dark) 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; letter-spacing: 0.6px;
  font-family: 'Inter', system-ui, sans-serif;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.20), 0 2px 6px rgba(140,125,104,0.30);
  text-shadow: 0 1px 2px rgba(0,0,0,0.18);
}
.logo-mark--sm { width: 34px; height: 34px; font-size: 12px; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 18px; height: 38px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  font-weight: 500;
  letter-spacing: .01em;
  transition: background-color 180ms var(--ease), border-color 180ms var(--ease), color 180ms var(--ease), box-shadow 180ms var(--ease), transform 120ms var(--ease);
  white-space: nowrap;
}
/* Primary — premium black like the brand packaging; gold on hover */
.btn--primary {
  background: var(--brand-black);
  color: #fff;
  border-color: var(--brand-black);
  box-shadow: 0 1px 3px rgba(24,24,24,0.18);
}
.btn--primary:hover {
  background: var(--brand-gold-dark);
  border-color: var(--brand-gold-dark);
  box-shadow: 0 4px 10px rgba(140,125,104,0.30);
  transform: translateY(-1px);
}
.btn--primary:active { transform: translateY(0); }

/* Secondary — light cream surface, gold border on hover */
.btn--secondary {
  background: var(--bg-base);
  color: var(--brand-black);
  border-color: var(--border);
}
.btn--secondary:hover {
  background: var(--brand-cream-light);
  border-color: var(--brand-gold);
  color: var(--brand-gold-dark);
}

/* Ghost — minimal, gold accent on hover */
.btn--ghost { background: transparent; color: var(--brand-black); }
.btn--ghost:hover { background: var(--brand-cream-light); color: var(--brand-gold-dark); }

.btn--danger { background: var(--status-red); color: white; border-color: var(--status-red); }
.btn--danger:hover { background: #a44a44; border-color: #a44a44; }

.btn--block { width: 100%; height: 44px; }
.btn--sm { height: 30px; padding: 0 14px; font-size: 12px; }
.btn .ms-logo { width: 18px; height: 18px; }

.link { color: var(--brand-gold-dark); cursor: pointer; }
.link:hover { text-decoration: underline; color: var(--brand-black); }
.link--back { font-weight: 500; }

.icon-btn {
  background: transparent; border: none;
  width: 32px; height: 32px; padding: 0;
  border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
}
.icon-btn:hover { background: var(--bg-subtle); color: var(--text-primary); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn--lg { width: 36px; height: 36px; }
.icon-btn--lg svg { width: 18px; height: 18px; }
.icon-btn--sm { width: 28px; height: 28px; }
.icon-btn--sm svg { width: 14px; height: 14px; }
.icon-btn--danger { color: var(--status-red); }
.icon-btn--danger:hover { background: rgba(239, 68, 68, 0.1); color: var(--status-red); }

/* Doc-status icon buttons (blue/yellow/green) — for cert + shipment doc icons */
.doc-icon { position: relative; }
.doc-icon::after {
  content: ''; position: absolute; bottom: 2px; right: 2px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--status-grey);
  border: 1.5px solid var(--bg-elevated);
}
.doc-icon--blue::after   { background: var(--status-blue); }
.doc-icon--yellow::after { background: var(--status-yellow); }
.doc-icon--green::after  { background: var(--status-green); }

/* ── Login — premium charcoal screen with cream login card, gold-touched ── */
.screen { width: 100%; min-height: 100vh; }
.screen--login {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(173,156,130,0.10), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(173,156,130,0.08), transparent 50%),
    linear-gradient(180deg, var(--brand-black), #0d0d0d);
  padding: 24px;
  position: relative;
}
.screen--login::before {
  /* subtle gold hairline at the top — echoes the topbar's accent rule */
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-gold), transparent);
  opacity: 0.5;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--brand-white);
  border: 1px solid rgba(173,156,130,0.18);
  border-radius: var(--r-lg);
  padding: 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.30), 0 1px 0 rgba(255,255,255,0.04) inset;
  display: flex; flex-direction: column; gap: 22px; text-align: center;
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.logo-mark--login { width: 56px; height: 56px; font-size: 17px; }

/* Email + password form on the login screen */
.login-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-form__field { display: flex; flex-direction: column; gap: 6px; }
.login-form__label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  color: var(--text-secondary); text-transform: uppercase;
}
.login-form__field input {
  height: 42px; padding: 0 14px;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-base); color: var(--text-primary);
  font-size: 14px;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.login-form__field input:focus {
  outline: none;
  border-color: var(--brand-gold);
  box-shadow: 0 0 0 3px rgba(173,156,130,0.20);
}
/* Remember-me checkbox row on the login form */
.login-form__remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  margin: -2px 0 2px;
}
.login-form__remember input[type="checkbox"] {
  width: 16px; height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--brand-gold, #AD9C82);
}
.login-form__remember:hover { color: var(--text-primary); }

.login-form__error {
  padding: 10px 12px;
  background: rgba(184,90,82,0.08);
  border: 1px solid rgba(184,90,82,0.25);
  border-radius: var(--r-sm);
  color: var(--status-red, #b85a52);
  font-size: 13px; font-weight: 500;
}
/* "or" divider between password sign-in and Microsoft SSO */
.login-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-disabled); font-size: 11px;
  text-transform: uppercase; letter-spacing: .12em;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* Small explanatory note below the Sign-In button (replaces old demo list) */
.login-note {
  margin: 0;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.5;
}
.login-note svg { color: var(--brand-gold); }
.login-note strong { color: var(--brand-black); }
/* Demo accounts disclosure — collapsed by default */
.login-help-details {
  text-align: left;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 4px;
}
.login-help-details summary {
  font-size: 11px; color: var(--text-secondary); cursor: pointer;
  text-transform: uppercase; letter-spacing: .06em;
  list-style: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.login-help-details summary::-webkit-details-marker { display: none; }
.login-help-details summary::before {
  content: '▸'; color: var(--brand-gold); transition: transform .2s var(--ease);
}
.login-help-details[open] summary::before { transform: rotate(90deg); }
.login-demo-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.login-demo-item {
  width: 100%; padding: 8px 12px; text-align: left;
  background: var(--brand-cream-light);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  cursor: pointer; transition: all .15s var(--ease);
  display: flex; flex-direction: column; gap: 2px;
  font-family: inherit;
}
.login-demo-item:hover {
  background: var(--brand-cream);
  border-color: var(--brand-gold);
  transform: translateX(2px);
}
.login-demo-item strong { font-size: 12px; color: var(--brand-black); }
.login-demo-item small { font-size: 10.5px; color: var(--text-secondary); }
.login-brand h1 { color: var(--brand-navy-900); font-size: 22px; }
.login-brand p { color: var(--text-secondary); margin: 0; }
.login-help { display: inline-block; color: var(--brand-navy-500); font-size: 13px; }
.login-help:hover { text-decoration: underline; }
.login-footer { position: absolute; bottom: 24px; color: var(--text-secondary); font-size: 12px; }

/* ── App shell ─────────────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-areas: "topbar topbar" "sidebar main";
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  min-height: 100vh;
}
.app.collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* Top bar — brand black with a hairline gold underline for a premium feel */
.topbar {
  grid-area: topbar;
  display: flex; align-items: center; gap: 16px;
  background: var(--brand-black); color: white;
  padding: 0 16px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: inset 0 -1px 0 rgba(173,156,130,0.35), 0 2px 12px rgba(0,0,0,0.10);
}
.topbar__brand strong, .topbar__brand b { letter-spacing: .06em; }
.topbar__icon {
  background: transparent; color: rgba(255,255,255,.85); border: none;
  padding: 8px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.topbar__icon:hover { background: rgba(255,255,255,.1); color: white; }
.topbar__icon svg { width: 20px; height: 20px; }
.topbar__brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.topbar__search { flex: 1; max-width: 480px; position: relative; }
.topbar__search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: rgba(255,255,255,.6); }
.topbar__search input {
  width: 100%; height: 32px;
  background: rgba(255,255,255,.1); color: white;
  border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 0 12px 0 34px;
}
.topbar__search input::placeholder { color: rgba(255,255,255,.55); }
.topbar__search input:focus { background: rgba(255,255,255,.18); outline: none; }
.topbar__country {
  background: rgba(255,255,255,.1); color: white;
  border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 0 28px 0 12px; height: 32px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m3 5 3 3 3-3' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 12px;
}
.topbar__country option { color: var(--text-primary); background: var(--bg-base); }

/* Topbar country switcher — when upgraded to flag-aware custom dropdown,
   keep the dark/translucent theme of the topbar */
.topbar .country-select { min-width: 180px; }
.topbar .country-select__trigger {
  background: rgba(255,255,255,.10);
  color: white;
  border-color: transparent;
  height: 32px;
}
.topbar .country-select__trigger:hover { background: rgba(255,255,255,.18); border-color: transparent; }
.topbar .country-select__caret { color: rgba(255,255,255,.7); }

/* Topbar language switcher — 3 small flag buttons */
.topbar__lang {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(173,156,130,0.25);
  border-radius: 999px;
}
.topbar__lang-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 22px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .15s, transform .12s;
  opacity: .55;
}
.topbar__lang-btn img {
  width: 18px; height: 13px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
  display: block;
}
.topbar__lang-btn:hover { opacity: .85; background: rgba(255,255,255,0.10); }
.topbar__lang-btn.is-active {
  opacity: 1;
  background: var(--brand-gold);
  box-shadow: 0 1px 4px rgba(173,156,130,0.45);
}
.topbar__lang-btn.is-active img { box-shadow: 0 0 0 1px rgba(0,0,0,0.30); }
@media (max-width: 720px) {
  .topbar__lang { display: none; }
}
.bell-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--status-red); }
.bell-dot.is-empty { display: none; }
.topbar__user { display: flex; align-items: center; gap: 8px; background: transparent; color: white; border: none; padding: 4px 8px; border-radius: var(--r-sm); }
.topbar__user:hover { background: rgba(255,255,255,.1); }
.topbar__user-name { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.topbar__user-name strong { font-size: 13px; }
.topbar__user-name span { font-size: 11px; color: rgba(255,255,255,.7); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; color: white; }
.avatar--lg { width: 48px; height: 48px; font-size: 16px; }

.user-menu {
  position: absolute; top: calc(var(--topbar-h) + 6px); right: 12px;
  width: 280px;
  background: var(--bg-elevated); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 8px 0; z-index: 60;
}
.user-menu__head { display: flex; gap: 12px; align-items: center; padding: 12px 16px; }
.user-menu__head strong { display: block; }
.user-menu__head span { color: var(--text-secondary); font-size: 12px; }
.user-menu__divider { height: 1px; background: var(--border); margin: 4px 0; }
.user-menu__item { width: 100%; text-align: left; display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: transparent; color: var(--text-primary); border: none; }
.user-menu__item:hover { background: var(--bg-subtle); }
.user-menu__item svg { width: 16px; height: 16px; color: var(--text-secondary); }
.user-menu__item--danger { color: var(--status-red); }
.user-menu__item--danger svg { color: var(--status-red); }

/* Sidebar */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 14px 10px;
  overflow-y: auto;
}
.sidebar__nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.sidebar__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--r-md);
  color: var(--text-secondary); cursor: pointer;
  position: relative;
  transition: background-color 180ms var(--ease), color 180ms var(--ease);
  /* `text-decoration: none` so <a> tags don't show an underline */
  text-decoration: none;
  /* Ensure label text starts at the same x-coord across all rows even when
     an item also renders a trailing badge (e.g. Support Center). The label
     span takes the remaining flex space; the badge is pushed by margin-left:auto. */
}
.sidebar__item > span:not(.sidebar__badge) { flex: 1; min-width: 0; }
.sidebar__badge { margin-left: auto; flex-shrink: 0; }
.sidebar__item:hover { background: var(--brand-cream-light); color: var(--brand-black); }
.sidebar__item.active {
  background: var(--brand-black);
  color: #fff;
  font-weight: 500;
}
/* Subtle gold left-edge indicator on the active item — luxe touch */
.sidebar__item.active::before {
  content: '';
  position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--brand-gold);
}
.sidebar__item.active svg { color: var(--brand-gold); }
.sidebar__item svg {
  width: 18px; height: 18px; flex-shrink: 0;
  transition: color 180ms var(--ease), transform 180ms var(--ease);
}
/* ── Per-route icon colors ──────────────────────────────────────────────
   Each sidebar function gets a distinct tasteful hue so the icons read
   at a glance. Active state still gets the brand gold (overridden above)
   to keep the active row coherent with the brand-black background. */
.sidebar__item[data-route="dashboard"] svg     { color: #3B82F6; }   /* royal blue   */
.sidebar__item[data-route="performance"] svg   { color: #A855F7; }   /* purple       */
.sidebar__item[data-route="tasks"] svg         { color: #F59E0B; }   /* amber        */
.sidebar__item[data-route="masterdata"] svg    { color: #14B8A6; }   /* teal         */
.sidebar__item[data-route="costsaving"] svg    { color: #10B981; }   /* emerald      */
.sidebar__item[data-route="shopopen"] svg      { color: #EC4899; }   /* pink         */
.sidebar__item[data-route="tracking"] svg      { color: #0EA5E9; }   /* sky blue     */
.sidebar__item[data-route="inventory"] svg     { color: #B45309; }   /* warm brown   */
.sidebar__item[data-route="calculator"] svg    { color: #6366F1; }   /* indigo       */
.sidebar__item[data-route="history"] svg       { color: #64748B; }   /* slate        */
.sidebar__item[data-route="sop"] svg           { color: #8B5CF6; }   /* violet       */
.sidebar__item[data-route="notifications"] svg { color: #EF4444; }   /* red          */
.sidebar__item[data-route="feedback"] svg      { color: #06B6D4; }   /* cyan         */
.sidebar__item[data-route="settings"] svg      { color: #78716C; }   /* warm grey    */
/* Hover: gentle bump for feedback */
.sidebar__item:hover svg { transform: scale(1.08); }
/* Active row always wins — keeps brand-gold on the dark background */
.sidebar__item.active svg { color: var(--brand-gold) !important; transform: none; }
.sidebar__footer { padding: 12px 4px 4px; }
.sidebar__hint { font-size: 11px; color: var(--text-disabled); }

/* Main content */
.main {
  grid-area: main;
  padding: 24px;
  background: var(--bg-base);
  overflow-x: auto;
}

/* Page head */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head__actions { display: flex; gap: 8px; align-items: center; }
.page-back { margin-bottom: 8px; }
.detail-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.detail-head h1 { display: inline-block; margin-right: 12px; font-size: 22px; }
.detail-actions { margin-left: auto; display: flex; gap: 8px; }

/* Sub-nav (tabs at top of each section) */
.subnav {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto; flex-wrap: nowrap;
}
.subnav button {
  padding: 10px 16px; background: transparent;
  border: none; border-bottom: 2px solid transparent;
  color: var(--text-secondary); font-weight: 500;
  white-space: nowrap; flex-shrink: 0;
}
.subnav button:hover { color: var(--text-primary); }
.subnav button.active { color: var(--brand-navy-700); border-bottom-color: var(--brand-navy-500); }
.subnav button .subnav-icon { display: inline-block; vertical-align: -3px; margin-right: 4px; }
.subnav button .subnav-flag {
  display: inline-block;
  width: 20px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 6px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08);
  object-fit: cover;
}

/* Info banner */
.info-banner {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-left: 3px solid var(--brand-navy-500);
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.info-banner svg { color: var(--brand-navy-500); flex-shrink: 0; }
.info-banner div { flex: 1; font-size: 13px; }
.info-banner--ai { border-left-color: var(--status-blue); transition: background .35s var(--ease), border-color .35s var(--ease); }
.info-banner--ai svg { color: var(--status-blue); }
/* Flash effect when an auto-sync just landed — pulses gold for ~1.2s */
.erp-banner--flash {
  background: linear-gradient(90deg, rgba(173,156,130,0.18), rgba(173,156,130,0.04)) !important;
  border-left-color: var(--brand-gold) !important;
  animation: erp-flash 1.2s var(--ease);
}
@keyframes erp-flash {
  0%   { box-shadow: 0 0 0 0 rgba(173,156,130,0.55); }
  50%  { box-shadow: 0 0 0 8px rgba(173,156,130,0.10); }
  100% { box-shadow: 0 0 0 0 rgba(173,156,130,0.00); }
}

/* "Next auto-sync in 04:32" countdown pill next to the Sync now button */
.erp-countdown {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px;
  margin-right: 8px;
  background: var(--brand-cream-light);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}
.erp-countdown strong {
  font-family: 'JetBrains Mono', monospace;
  color: var(--brand-black);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  margin-left: 2px;
}
.erp-countdown svg { color: var(--brand-gold-dark); }
.erp-countdown #poNextSync.is-soon {
  color: #c2410c;            /* warm-orange when under 30s */
  background: rgba(217, 119, 6, 0.12);
  padding: 1px 6px;
  border-radius: 999px;
}

/* Cards */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  transition: box-shadow .2s var(--ease);
}
.card:hover { box-shadow: 0 2px 6px rgba(24,24,24,0.06), 0 8px 24px rgba(24,24,24,0.05); }
.card__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card__head h3 { letter-spacing: .01em; }
.card__head h3 { font-size: 16px; }
.card__badge { font-size: 11px; font-weight: 600; background: var(--bg-subtle); color: var(--text-secondary); padding: 2px 8px; border-radius: 999px; }
.card__head-actions { display: inline-flex; align-items: center; gap: 8px; }
.card__head-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.card__head-select { height: 30px; padding: 0 10px; background: var(--bg-base); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 12px; min-width: 180px; }
.card__head-select:focus { border-color: var(--brand-navy-500); outline: none; }

/* Currency picker button — looks like a select, but opens the searchable popover on click */
.ccy-picker-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  min-width: 90px;
  justify-content: space-between;
}
.ccy-picker-btn:hover { border-color: var(--brand-navy-500); }
.ccy-picker-btn:focus { outline: 2px solid rgba(173, 156, 130,0.25); }

/* Custom country dropdown — supports flag images (native <option> can't) */
.country-select { position: relative; display: inline-block; min-width: 200px; }
.country-select__trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; height: 30px; padding: 0 10px;
  background: var(--bg-base); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 12px; cursor: pointer;
  transition: border-color 150ms var(--ease);
}
.country-select__trigger:hover { border-color: var(--brand-navy-300); }
.country-select__trigger:focus-visible { border-color: var(--brand-navy-500); outline: none; }
.country-select__label { display: inline-flex; align-items: center; gap: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.country-select__caret { color: var(--text-secondary); flex-shrink: 0; }
.country-select__flag { width: 20px; height: 15px; object-fit: cover; margin-right: 8px; border-radius: 1px; flex-shrink: 0; vertical-align: middle; }
.country-select__list {
  position: absolute; top: calc(100% + 4px); right: 0; min-width: 100%;
  max-height: 320px; overflow-y: auto;
  background: var(--bg-base); border: 1px solid var(--border);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  z-index: 100;
  padding: 4px 0;
}
.country-select__item {
  display: flex; align-items: center; gap: 0;
  padding: 8px 12px; font-size: 13px; cursor: pointer;
  color: var(--text-primary);
  white-space: nowrap;
}
.country-select__item:hover { background: var(--bg-subtle); }
.country-select__item.is-selected { background: var(--brand-navy-100); color: var(--brand-navy-700); font-weight: 500; }

/* KPI grid */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-grid--small { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.kpi {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 16px 20px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 4px;
  cursor: pointer; transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi__label { font-size: 12px; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.kpi__value { font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi__delta { font-size: 13px; display: flex; align-items: center; gap: 4px; }
.kpi__delta--good { color: var(--status-green); }
.kpi__delta--bad  { color: var(--status-red); }
.kpi__delta--flat { color: var(--text-secondary); }

/* Charts */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 24px; margin-bottom: 24px; }
.charts-grid .card { margin-bottom: 0; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table {
  font-size: 13px;
  /* `border-collapse: collapse` (the historic default) BREAKS sticky <thead>
     in many browsers because each <th> ends up with no painted background.
     Switching to `separate` + `border-spacing: 0` lets every <th> paint its
     own opaque background, which is what makes the sticky header actually
     hide rows scrolling past it. Visual result is the same as collapse. */
  border-collapse: separate;
  border-spacing: 0;
}
/* Sticky thead — stays pinned at the top while rows scroll under it.
   MUST have an opaque background (no alpha) AND a z-index high enough to
   sit above any cell content (photo thumbnails, badges, sticky-col cells).
   Without this, semi-transparent per-th backgrounds (gold gradients on the
   Photo column etc.) let scrolled-past rows bleed through visually. */
.table thead { background: var(--bg-subtle); }
.table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  /* Force solid background on every header cell so no per-th alpha gradient
     can leak the rows underneath. The per-th `background:` inline style still
     paints over this — but here we guarantee a solid base. */
  background: var(--bg-subtle, #f4f1ea);
  /* Restore the bottom border that collapse used to draw for free */
  box-shadow: inset 0 -1px 0 var(--border, #e5e1d6);
}
/* sticky-col header cells need an even higher z-index — they intersect with
   sticky thead AND the left-sticking column, so they must paint above both. */
.table thead th.sticky-col { z-index: 5; }
.table th { text-align: center; font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
/* Force header centering even when th has .num (which makes cells right-aligned) */
.table thead th.num { text-align: center; }

/* ── Two-row sticky thead support ──────────────────────────────────────
   When a table has TWO header rows (e.g. Cost Saving: row 1 = labels +
   "Price by Month" colspan banner; row 2 = JAN/FEB/.../DEC), both rows
   are sticky. Without explicit offsets they would both pin at top:0 and
   overlap — leaving a gap in the non-rowspan columns where data rows
   bleed through visually.
   `--thead-row1-h` is measured by JS after render and set on the table
   element; falls back to 37px (typical row height with .table padding). */
.table thead tr:nth-child(2) th {
  top: var(--thead-row1-h, 37px);
}

/* table--centered: every th + td center-aligned (used by AI methods comparison) */
.table--centered thead th,
.table--centered tbody td { text-align: center !important; vertical-align: middle; }
.table--centered tbody td small { display: inline; }

/* DEFAULT: every td is center-aligned + vertically centered to match the centered headers.
   Numeric cells keep tabular-nums so digits still line up visually even when centered.
   For long text (names/descriptions) opt out per-cell with .text-left class. */
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  text-align: center;
}
.table td.text-left  { text-align: left; }
.table td.text-right { text-align: right; }
.table tbody tr { transition: background-color 150ms var(--ease); }
.table tbody tr:hover { background: var(--brand-cream-light); }
.table tbody tr.row-clickable { cursor: pointer; }
.table tbody tr.row-completed { opacity: .55; background: var(--bg-subtle); }
.table tbody tr:last-child td { border-bottom: none; }

/* ── PERF: content-visibility auto on heavy table rows ────────────────
   Tells the browser it can SKIP layout + paint for any row currently
   off-screen. For tables with hundreds of inputs (PO Tracking, Master
   Data Products, Cost Saving) this can cut paint cost by 70-90% because
   the browser only processes rows actually in the viewport.
   `contain-intrinsic-size` reserves a placeholder so the scrollbar
   doesn't jump when rows enter the viewport. */
.table tbody tr {
  content-visibility: auto;
  contain-intrinsic-size: auto 56px;  /* approx row height */
}
/* Numeric cells: center horizontally (matches header) but keep tabular digits + mono so columns of numbers visually align */
.table .num {
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.table .actions { display: flex; gap: 4px; justify-content: center; }
/* Inline content inside td (status pills, flags, buttons) auto-centers because td is text-align:center.
   For multi-element inline-flex chains, this wrapper keeps them tightly centered. */
.table td .cell-inline { display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.table tr.split-row td { padding-top: 4px; padding-bottom: 4px; background: var(--bg-subtle); border-top: 1px dashed var(--border-strong); border-bottom: 1px dashed var(--border-strong); font-size: 12px; }
.table tr.split-row td::before { content: '↳ '; color: var(--text-secondary); }

/* Status pill */
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--text-primary); white-space: nowrap; }
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--status-grey); }
.status-pill--blue::before   { background: var(--status-blue); }
.status-pill--yellow::before { background: var(--status-yellow); }
.status-pill--green::before  { background: var(--status-green); }
.status-pill--red::before    { background: var(--status-red); }
.status-pill--grey::before   { background: var(--status-grey); }

/* Online indicator */
.dot-online { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--status-green); margin-right: 6px; box-shadow: 0 0 0 3px rgba(31,174,106,.18); }
.dot-offline { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-disabled); margin-right: 6px; }

/* Filter bar */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filter-bar__search { flex: 1; min-width: 240px; height: 36px; padding: 0 12px; background: var(--bg-base); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--r-sm); }
.filter-bar select { height: 36px; padding: 0 28px 0 12px; background: var(--bg-base); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--r-sm); appearance: none; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m3 5 3 3 3-3' fill='none' stroke='%234f5a72' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 12px; }
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--brand-navy-500); outline: none; }
.filter-bar__hint { color: var(--text-secondary); font-size: 12px; padding: 0 8px; }
.filter-bar .check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); cursor: pointer; }

/* Segmented control — active = brand black for confident contrast */
.seg { display: inline-flex; gap: 0; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; background: var(--bg-base); }
.seg button { background: transparent; color: var(--text-secondary); border: none; padding: 7px 16px; font-size: 13px; font-weight: 500; transition: background-color 150ms var(--ease), color 150ms var(--ease); }
.seg button:hover { background: var(--brand-cream-light); color: var(--brand-black); }
.seg button:not(:last-child) { border-right: 1px solid var(--border); }
.seg button.active { background: var(--brand-black); color: #fff; }
.seg button.active:hover { background: var(--brand-gold-dark); }

/* Tabs (in-page) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tabs-row .tabs { border-bottom: none; margin-bottom: 0; flex: 1; min-width: 0; overflow-x: auto; }
.tabs-row > .btn { flex-shrink: 0; margin-bottom: 6px; }

/* Category sub-tabs (Goods / Shipping) — pill-style switcher */
.cat-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: 16px; }
.cat-tab {
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.cat-tab:hover { color: var(--text-primary); }
.cat-tab.active { background: var(--bg-base); color: var(--brand-navy-700); box-shadow: var(--shadow-sm); font-weight: 600; }
.tab { padding: 10px 16px; background: transparent; border: none; border-bottom: 2px solid transparent; color: var(--text-secondary); font-weight: 500; }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--brand-navy-700); border-bottom-color: var(--brand-navy-500); }
.tab-count { background: var(--bg-subtle); color: var(--text-secondary); padding: 1px 6px; border-radius: 999px; font-size: 11px; margin-left: 4px; }

/* Meta grid */
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 24px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px 20px; margin-bottom: 24px; }
.meta-grid__item label { display: block; font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.meta-grid__item div { font-size: 14px; font-weight: 500; }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 20px; padding: 8px 0; }
.timeline-step { display: grid; grid-template-columns: 32px 1fr; gap: 16px; position: relative; }
.timeline-step::before { content: ''; position: absolute; top: 32px; bottom: -20px; left: 15px; width: 2px; background: var(--border); }
.timeline-step:last-child::before { display: none; }
.timeline-dot {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--border-strong); background: var(--bg-base);
  display: flex; align-items: center; justify-content: center; z-index: 1;
}
.timeline-step--completed .timeline-dot { background: var(--status-green); border-color: var(--status-green); color: white; }
.timeline-step--completed::before { background: var(--status-green); }
.timeline-step--active .timeline-dot { background: var(--status-blue); border-color: var(--status-blue); color: white; animation: pulse 2s var(--ease) infinite; }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(44,123,229,.4); }
  50%     { box-shadow: 0 0 0 6px rgba(44,123,229,0); }
}
.timeline-info strong { display: block; font-weight: 600; color: var(--text-primary); }
.timeline-info span { color: var(--text-secondary); font-size: 12px; }
.timeline-step.editable .timeline-dot { cursor: pointer; }

/* Horizontal timeline variant — used in shipment detail (always-visible bar above tabs) */
.timeline-bar { margin-bottom: 16px; }
.timeline--horizontal {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0;
  padding: 16px 20px;
  overflow-x: auto;
}
.timeline--horizontal .timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1 1 0;
  min-width: 90px;
  position: relative;
  text-align: center;
  padding: 0 4px;
}
/* Connector line — drawn on the horizontal axis between dots
   Override the vertical timeline's ::before rule (top:32px, bottom:-20px, left:15px, width:2px) */
.timeline--horizontal .timeline-step::before {
  content: '';
  position: absolute;
  top: 13px;          /* center of the 28px dot (28/2 - 1 = 13) */
  bottom: auto;       /* reset vertical rule */
  left: 50%;          /* start at horizontal center of this step */
  right: auto;        /* reset */
  width: 100%;        /* span across to the next step's center */
  height: 3px;
  background: var(--border);
  z-index: 0;
  border-radius: 1px;
}
.timeline--horizontal .timeline-step:last-child::before { display: none; }
.timeline--horizontal .timeline-step--completed::before { background: var(--status-green); }
.timeline--horizontal .timeline-step--active::before { background: linear-gradient(to right, var(--status-green) 50%, var(--border) 50%); }
.timeline--horizontal .timeline-dot {
  position: relative;
  z-index: 1;
  width: 28px; height: 28px;
  background: var(--bg-base);
}
.timeline--horizontal .timeline-info { padding: 0; }
.timeline--horizontal .timeline-info strong {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}
.timeline--horizontal .timeline-info span {
  font-size: 10px;
  color: var(--text-secondary);
}
.timeline--horizontal .timeline-step--active .timeline-info strong { color: var(--brand-navy-700); }
.timeline-bar__card { overflow: hidden; }

/* Shipment Extras tabs (Quotation, Freight Calc, Invoice, Summary) */
.upload-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  padding: 28px 20px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 150ms var(--ease), background 150ms var(--ease);
}
.upload-zone:hover { border-color: var(--brand-navy-500); background: var(--brand-navy-100); color: var(--brand-navy-700); }
.upload-zone strong { font-size: 14px; color: var(--text-primary); }
.upload-zone small { font-size: 12px; }

.upload-done {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border: 1px solid var(--status-green);
  border-radius: var(--r-md);
  background: rgba(31, 174, 106, 0.08);
}
.upload-done > svg { color: var(--status-green); flex-shrink: 0; }
.upload-done > div { flex: 1; font-size: 13px; }
.upload-done > div strong { color: var(--text-primary); }

/* Summary KPI cards */
.summary-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.summary-kpi {
  padding: 14px 16px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-align: center;
}
.summary-kpi label { display: block; font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.summary-kpi strong { display: block; font-size: 22px; font-family: 'JetBrains Mono', monospace; color: var(--brand-navy-700); margin-bottom: 4px; }
.summary-kpi small { font-size: 11px; }

/* Diff verdicts */
.summary-verdicts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.summary-verdict {
  padding: 12px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-secondary);
  border-radius: var(--r-md);
  display: flex; flex-direction: column; gap: 4px;
}
.summary-verdict label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.summary-verdict .big { font-size: 18px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.summary-verdict.diff-up   { border-left-color: var(--status-red); }
.summary-verdict.diff-up   .big { color: var(--status-red); }
.summary-verdict.diff-down { border-left-color: var(--status-green); }
.summary-verdict.diff-down .big { color: var(--status-green); }

/* Inline diff highlight in tables */
.diff-up   { color: var(--status-red); font-weight: 600; }
.diff-down { color: var(--status-green); font-weight: 600; }

/* Invoice Summary editable field — input + pencil edit button */
/* Direct-edit field (currency/country) — dropdown IS the field, auto-saves on change */
.inv-field--direct .inv-field__select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  background: var(--bg-base, #fff);
  border: 1px solid var(--border, #e5e1d6);
  border-radius: var(--r-sm, 6px);
  color: var(--text-primary, #1f2937);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.inv-field--direct .inv-field__select:hover {
  border-color: var(--brand-gold, #AD9C82);
}
.inv-field--direct .inv-field__select:focus {
  outline: none;
  border-color: var(--brand-gold, #AD9C82);
  box-shadow: 0 0 0 3px rgba(173,156,130,.18);
}
.inv-field__row { display: flex; align-items: stretch; gap: 4px; }
.inv-field__row > input,
.inv-field__row > select,
.inv-field__row > .inv-edit-range { flex: 1 1 0; min-width: 0; }
.inv-field__row > select { height: 36px; padding: 0 10px; background: var(--bg-base); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text-primary); font-size: 14px; }
.inv-field__row > select:focus { border-color: var(--brand-navy-500); outline: none; }
.inv-field__btn { flex-shrink: 0; align-self: stretch; height: auto; }
.inv-field__btn--saving { color: var(--status-green); border-color: rgba(31, 174, 106, 0.4); background: rgba(31, 174, 106, 0.08); }
.inv-field__btn--saving:hover { background: rgba(31, 174, 106, 0.15); }

/* Date-range edit control (start → end) */
.inv-edit-range { display: flex; align-items: center; gap: 6px; }
.inv-edit-range > .dmy-date { flex: 1 1 0; min-width: 0; }
.inv-edit-range__sep { color: var(--text-secondary); font-size: 14px; flex-shrink: 0; }

/* Calculator page styles */
.calc-baseline-grid { padding: 16px 20px; display: flex; flex-direction: column; gap: 16px; }
.baseline-section__head {
  font-size: 12px; font-weight: 700; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .04em;
  margin: 0 0 8px;
}
.baseline-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.baseline-card {
  padding: 14px 14px 12px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  border-top: 3px solid var(--brand-navy-500);
  text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 92px;
}
.baseline-card label { display: block; font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; margin: 0; }
.baseline-card strong { display: block; font-size: 18px; font-family: 'JetBrains Mono', monospace; color: var(--brand-navy-700); margin: 0; }
.baseline-card small { display: block; font-size: 11px; color: var(--text-secondary); margin: 0; line-height: 1.35; }
.baseline-card--empty { border-top-color: var(--text-disabled); opacity: 0.6; }
.baseline-card--empty strong { color: var(--text-disabled); }

.calc-totals { display: flex; gap: 24px; padding: 12px 20px; background: var(--bg-subtle); border-top: 1px solid var(--border); }
.calc-totals__item { display: flex; flex-direction: column; gap: 2px; }
.calc-totals__item label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.calc-totals__item strong { font-size: 16px; font-family: 'JetBrains Mono', monospace; color: var(--brand-navy-700); }

.calc-estimate { padding: 16px 20px; }
.calc-est-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.calc-est-summary > div { padding: 12px 14px; background: var(--bg-base); border: 1px solid var(--border); border-radius: var(--r-md); }
.calc-est-summary label { display: block; font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.calc-est-summary strong { display: block; font-size: 15px; }
.calc-est-cost { font-size: 22px !important; font-family: 'JetBrains Mono', monospace; color: var(--brand-navy-700); }

.calc-ai-rec { padding: 16px 20px; }
.calc-ai-verdict { padding: 12px 16px; background: rgba(44, 123, 229, 0.08); border-left: 3px solid var(--status-blue); border-radius: var(--r-sm); font-size: 13px; margin-bottom: 16px; }
.calc-ai-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.calc-ai-grid--3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) {
  .calc-ai-grid--3 { grid-template-columns: 1fr; }
}
.calc-ai-card { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-base); }
.calc-ai-card label { display: block; font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.calc-ai-card strong { display: block; font-size: 14px; margin: 4px 0; }
.calc-ai-card__cost { font-size: 18px; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--brand-navy-700); margin: 4px 0; }
.calc-ai-card__note { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 12px; line-height: 1.5; color: var(--text-secondary); }
.calc-ai-card--cheapest { border-left: 4px solid var(--status-green); }
.calc-ai-card--fastest  { border-left: 4px solid var(--status-blue); }
.calc-ai-card--suitable {
  border-left: 4px solid #AD9C82;
  background: linear-gradient(180deg, rgba(173, 156, 130, 0.06), var(--bg-base) 50%);
}
.calc-ai-card--suitable label { color: #6d28d9; }

.calc-no-rate { padding: 16px; background: rgba(242, 169, 59, 0.08); border: 1px solid var(--status-yellow); border-radius: var(--r-md); color: #8b5d12; font-weight: 500; }

/* ───── Calc sub-tabs (Shipment Calculation / Loading Plan) ───── */
.tabs--calc { margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tabs--calc .tab { font-size: 14px; padding: 10px 16px; }

/* ───── Loading Plan ───── */
.lp-container-picker {
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 900px) { .lp-container-picker { grid-template-columns: 1fr; } }
.lp-container-btn {
  padding: 14px 16px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-primary);
  transition: all .15s;
}
.lp-container-btn strong { display: block; font-size: 15px; margin-bottom: 4px; color: var(--text-primary); }
.lp-container-btn small  { display: block; font-size: 11px; color: var(--text-secondary); font-family: 'JetBrains Mono', monospace; line-height: 1.5; }
.lp-container-btn:hover { border-color: var(--brand-navy-500); transform: translateY(-1px); }
.lp-container-btn.active {
  border-color: var(--brand-navy-700);
  background: linear-gradient(180deg, rgba(173, 156, 130, 0.06), var(--bg-base) 60%);
  box-shadow: 0 0 0 2px rgba(173, 156, 130, 0.12);
}
.lp-container-btn.active strong { color: var(--brand-navy-700); }

/* Click-to-move hint bar — appears between the 3D card header and the canvas */
.lp-hint {
  margin: 0 20px 8px;
  padding: 8px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand-navy-500);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  transition: background .2s, color .2s, border-color .2s;
}
.lp-hint--active {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.10), rgba(6, 182, 212, 0.03));
  border-color: #06b6d4;
  border-left-color: #06b6d4;
  color: #0e7490;
  font-weight: 600;
}

/* ── SOP page ─────────────────────────────────────────────────────────
   3 sub-tabs: Workflow steps · Incoterms reference · Roles & onboarding */

/* ───── Trilingual SOP document viewer ─────────────────────────────── */
.sop-doc {
  padding: 0 20px 24px;
  max-width: 1000px;
  margin: 0 auto;
  font-family: 'Inter', 'IBM Plex Sans Thai', system-ui, sans-serif;
}

/* Hero header — premium charcoal banner with gold accents */
.sop-doc-hero {
  background: linear-gradient(135deg, var(--brand-black) 0%, #2a2624 100%);
  color: #fff;
  padding: 32px 32px 28px;
  border-radius: var(--r-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
  margin: 16px 0 18px;
  box-shadow: 0 4px 20px rgba(24,24,24,0.18);
}
.sop-doc-hero::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--brand-gold), transparent);
}
.sop-doc-hero::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(173,156,130,0.40), transparent);
}
.sop-doc-hero__brand {
  font-size: 12px; font-weight: 700;
  letter-spacing: .18em;
  color: var(--brand-gold);
  margin-bottom: 14px;
}
.sop-doc-hero__title {
  font-size: 24px; font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: .02em;
  color: #fff;
}
.sop-doc-hero__subtitle {
  font-size: 14px; font-weight: 500;
  color: rgba(255,255,255,0.78);
  letter-spacing: .04em;
}
.sop-doc-hero__meta {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  margin-top: 10px;
  letter-spacing: .04em;
}

/* Hero controls row — Edit toggle + Language switcher sit side by side */
.sop-doc-hero__controls {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

/* When in edit mode every section/step shows a subtle pencil cue */
.sop-doc-section--editing .sop-doc-section__title::before,
.sop-doc-step--editing .sop-doc-step__label::before {
  content: '✏️';
  display: inline-block;
  margin-right: 6px;
  font-size: 13px;
  opacity: .65;
}
/* Hover an editing card to surface the editable areas */
.sop-doc-section--editing:hover { background: rgba(173,156,130,0.04); }
.sop-doc-step--editing:hover { background: rgba(173,156,130,0.06); }

/* Edit toggle button — gold when on, ghost when off */
.sop-edit-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(173,156,130,0.30);
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all .18s var(--ease);
  font-family: inherit;
}
.sop-edit-toggle:hover {
  background: rgba(255,255,255,0.14);
  border-color: var(--brand-gold);
  color: #fff;
}
.sop-edit-toggle.is-on {
  background: var(--brand-gold);
  color: var(--brand-black);
  border-color: var(--brand-gold);
  box-shadow: 0 2px 8px rgba(173,156,130,0.40);
}
.sop-edit-toggle.is-on:hover { background: var(--brand-gold-light); }

/* Edit mode hint bar */
.sop-edit-hint {
  margin-bottom: 14px;
  padding: 10px 14px;
  background: linear-gradient(90deg, rgba(173,156,130,0.10), rgba(173,156,130,0.04));
  border: 1px solid rgba(173,156,130,0.30);
  border-left: 3px solid var(--brand-gold);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--brand-black);
  display: flex; align-items: center; gap: 6px;
}
.sop-edit-hint strong { color: var(--brand-gold-dark); }

/* Inline editable inputs — minimal styling so they feel native */
.sop-edit-input {
  width: 100%;
  padding: 6px 10px;
  background: var(--bg-base);
  border: 1.5px solid var(--brand-gold);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: inherit;
  color: var(--text-primary);
  line-height: inherit;
  transition: border-color .15s, box-shadow .15s;
  display: block;
}
.sop-edit-input:focus {
  outline: none;
  border-color: var(--brand-gold-dark);
  box-shadow: 0 0 0 3px rgba(173,156,130,0.20);
}
.sop-edit-input--ml {
  min-height: 64px;
  resize: vertical;
  line-height: 1.55;
}
/* Edit-mode visual cue on each section + step */
.sop-doc--editing .sop-doc-section { border-color: rgba(173,156,130,0.30); }
.sop-doc-section--editing .sop-doc-section__title .sop-edit-input { font-size: 16px; font-weight: 700; padding: 4px 10px; }
.sop-doc-step--editing { background: rgba(173,156,130,0.03); }

/* Language switcher — 3 flag buttons */
.sop-lang-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(173,156,130,0.20);
  border-radius: 999px;
}
.sop-lang-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.75);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: background-color .18s, color .18s, transform .15s;
  font-family: inherit;
}
.sop-lang-btn img {
  width: 18px; height: 13px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.12);
}
.sop-lang-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sop-lang-btn.is-active {
  background: var(--brand-gold);
  color: var(--brand-black);
  box-shadow: 0 2px 8px rgba(173,156,130,0.40);
}
.sop-lang-btn.is-active img { box-shadow: 0 0 0 1px rgba(0,0,0,0.18); }

/* TOC chips — quick-nav to any section */
.sop-doc-toc {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 18px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.sop-doc-toc__chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11.5px; font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: all .15s var(--ease);
}
.sop-doc-toc__chip:hover {
  background: var(--brand-black);
  color: #fff;
  border-color: var(--brand-black);
  transform: translateY(-1px);
}

/* Section (collapsible) */
.sop-doc-section {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 14px;
  overflow: hidden;
  transition: box-shadow .2s;
}
.sop-doc-section[open] { box-shadow: 0 2px 10px rgba(24,24,24,0.04); }
.sop-doc-section__head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  background: linear-gradient(180deg, var(--bg-base), var(--brand-cream-light));
  border-bottom: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.sop-doc-section[open] .sop-doc-section__head {
  border-bottom-color: var(--border);
  background: linear-gradient(180deg, var(--brand-cream-light), var(--bg-base));
}
.sop-doc-section__head::-webkit-details-marker { display: none; }
.sop-doc-section__head:hover { background: var(--brand-cream-light); }
.sop-doc-section__icon {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-black);
  color: var(--brand-gold);
  border-radius: 50%;
  font-size: 16px;
  flex-shrink: 0;
}
.sop-doc-section__title {
  flex: 1;
  font-size: 16px; font-weight: 700;
  color: var(--brand-black);
  letter-spacing: .01em;
}
.sop-doc-section__caret {
  color: var(--brand-gold-dark);
  transition: transform .2s var(--ease);
  flex-shrink: 0;
}
.sop-doc-section[open] .sop-doc-section__caret { transform: rotate(180deg); }
.sop-doc-section__body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }

/* Individual step */
.sop-doc-step {
  display: flex; gap: 14px;
  padding: 12px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand-gold);
  border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
}
.sop-doc-step:hover {
  border-color: var(--brand-gold);
  box-shadow: 0 2px 8px rgba(173,156,130,0.08);
}
.sop-doc-step__num {
  width: 28px; height: 28px;
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-gold);
  color: var(--brand-black);
  border-radius: 50%;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; font-weight: 700;
}
.sop-doc-step__body { flex: 1; min-width: 0; }
.sop-doc-step__label {
  font-size: 14px; font-weight: 600;
  color: var(--brand-black);
  margin-bottom: 6px;
  letter-spacing: .01em;
}
.sop-doc-step__text {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.sop-doc-step__text--warn {
  background: rgba(184,90,82,0.04);
  border-left: 2px solid var(--status-red);
  padding: 8px 12px;
  border-radius: var(--r-sm);
}
.sop-doc-warn {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(184,90,82,0.08);
  border: 1px solid rgba(184,90,82,0.25);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--status-red);
  line-height: 1.5;
}

/* Tables inside SOP — refined "document" style */
.sop-table-wrap { margin: 10px 0 4px; overflow-x: auto; }
.sop-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.sop-table-caption {
  caption-side: top;
  padding: 8px 12px;
  font-size: 12px; font-weight: 700;
  color: var(--brand-black);
  background: var(--brand-cream-light);
  border-bottom: 1px solid var(--border);
  text-align: left;
  letter-spacing: .04em;
}
.sop-table thead th {
  padding: 10px 14px;
  background: var(--brand-black);
  color: var(--brand-gold);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  text-align: center;
  border-bottom: 2px solid var(--brand-gold);
  white-space: nowrap;
}
.sop-table tbody td {
  padding: 10px 14px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
.sop-table tbody tr:last-child td { border-bottom: none; }
.sop-table tbody tr:nth-child(even) td { background: var(--bg-elevated); }
.sop-table tbody tr:hover td { background: var(--brand-cream-light); }

/* Footer */
.sop-doc-footer {
  margin-top: 18px; padding: 14px;
  text-align: center;
  font-size: 11px;
  color: var(--text-disabled);
  letter-spacing: .04em;
  border-top: 1px solid var(--border);
}

/* SOP step (workflow) — numbered card with editable title + description */
.sop-steps { padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.sop-step {
  display: flex; gap: 14px; align-items: stretch;
  padding: 14px 16px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color .15s, box-shadow .15s;
}
.sop-step:hover {
  border-color: var(--brand-gold);
  box-shadow: 0 2px 8px rgba(173,156,130,0.08);
}
.sop-step__num {
  flex-shrink: 0;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-black); color: #fff;
  border-radius: 50%;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px; font-weight: 700;
  position: relative;
}
.sop-step__num::after {
  content: ''; position: absolute; inset: -3px;
  border: 1px solid var(--brand-gold); border-radius: 50%; opacity: .5;
}
.sop-step__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.sop-step__title {
  font-size: 14px; font-weight: 600; color: var(--brand-black);
  padding: 6px 10px; border: 1px solid transparent; border-radius: var(--r-sm);
  background: transparent; font-family: inherit;
  transition: background .15s, border-color .15s;
}
.sop-step__title:hover, .sop-step__title:focus {
  background: var(--bg-base); border-color: var(--border); outline: none;
}
.sop-step__title:focus { border-color: var(--brand-gold); }
.sop-step__desc {
  font-size: 12.5px; color: var(--text-secondary); line-height: 1.5;
  padding: 6px 10px; border: 1px solid transparent; border-radius: var(--r-sm);
  background: transparent; font-family: inherit; resize: vertical;
  min-height: 36px;
  transition: background .15s, border-color .15s;
}
.sop-step__desc:hover, .sop-step__desc:focus {
  background: var(--bg-base); border-color: var(--border); outline: none;
}
.sop-step__desc:focus { border-color: var(--brand-gold); }

/* Country×Incoterms — one row per destination country */
.country-incoterms { padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.country-incoterm-row {
  display: grid;
  grid-template-columns: 32px 1fr 220px 1fr 32px;
  gap: 12px; align-items: center;
  padding: 10px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color .15s;
}
.country-incoterm-row:hover { border-color: var(--brand-gold); }
.country-incoterm-row__flag { display: flex; }
.country-incoterm-row__flag img { width: 24px; height: 18px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,0.08); }
.country-incoterm-row__name strong { display: block; font-size: 13px; color: var(--brand-black); }
.country-incoterm-row__name small { display: block; font-size: 11px; color: var(--text-secondary); font-family: 'JetBrains Mono', monospace; }
.country-incoterm-row__select {
  height: 34px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-base); color: var(--text-primary);
  font-size: 12px; font-weight: 500;
  font-family: inherit;
}
.country-incoterm-row__select:focus {
  outline: none; border-color: var(--brand-gold);
  box-shadow: 0 0 0 3px rgba(173,156,130,0.18);
}
.country-incoterm-row__notes {
  height: 34px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-base); color: var(--text-primary);
  font-size: 12px; font-family: inherit;
}
.country-incoterm-row__notes:focus { outline: none; border-color: var(--brand-gold); box-shadow: 0 0 0 3px rgba(173,156,130,0.18); }

/* Incoterms 2020 reference grid */
.incoterms-grid {
  padding: 16px 20px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.incoterm-card {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.incoterm-card:hover {
  border-color: var(--brand-gold);
  box-shadow: 0 4px 14px rgba(173,156,130,0.12);
  transform: translateY(-2px);
}
.incoterm-card__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.incoterm-card__code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px; font-weight: 700;
  color: var(--brand-black);
  padding: 4px 10px;
  background: var(--brand-cream-light);
  border: 1px solid var(--brand-gold);
  border-radius: var(--r-sm);
  letter-spacing: .04em;
}
.incoterm-card__name { font-size: 13px; font-weight: 600; color: var(--brand-gold-dark); flex: 1; }
.incoterm-card__desc { font-size: 12.5px; line-height: 1.55; color: var(--text-primary); margin: 0; }
.incoterm-card__meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding-top: 8px; border-top: 1px dashed var(--border);
}
.incoterm-card__meta label {
  display: block; font-size: 10px; font-weight: 600;
  color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: 4px;
}
.incoterm-card__best {
  font-size: 11.5px; color: var(--text-secondary);
  padding: 6px 10px;
  background: var(--bg-subtle);
  border-radius: var(--r-sm);
  border-left: 2px solid var(--brand-gold);
}
.incoterm-card__best strong { color: var(--brand-black); }

/* Roles & Procedures */
.sop-roles { padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.sop-role {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.sop-role:hover { border-color: var(--brand-gold); box-shadow: 0 2px 10px rgba(173,156,130,0.08); }
.sop-role__head { display: flex; align-items: center; gap: 10px; }
.sop-role__title {
  flex: 1;
  font-size: 15px; font-weight: 600; color: var(--brand-black);
  padding: 8px 12px;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-base); font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.sop-role__title:focus { outline: none; border-color: var(--brand-gold); box-shadow: 0 0 0 3px rgba(173,156,130,0.18); }
.sop-role__label {
  font-size: 10px; font-weight: 700; letter-spacing: .06em;
  color: var(--text-secondary); text-transform: uppercase;
}
.sop-role__desc {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-base); color: var(--text-primary);
  font-family: inherit; font-size: 13px; line-height: 1.55;
  resize: vertical; min-height: 80px;
  transition: border-color .15s, box-shadow .15s;
}
.sop-role__desc:focus { outline: none; border-color: var(--brand-gold); box-shadow: 0 0 0 3px rgba(173,156,130,0.18); }

.sop-role__files {
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.sop-role__files-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.sop-role__files-head label {
  font-size: 11px; font-weight: 600; color: var(--brand-black);
}
.sop-role__file-list { display: flex; flex-direction: column; gap: 4px; }
.sop-role__file {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: var(--brand-cream-light);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12px;
}
.sop-role__file-name { flex: 1; font-family: 'JetBrains Mono', monospace; color: var(--brand-black); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sop-role__file-size { color: var(--text-secondary); font-size: 10.5px; font-family: 'JetBrains Mono', monospace; flex-shrink: 0; }
.sop-role__no-files {
  padding: 16px 12px; text-align: center;
  color: var(--text-secondary); font-size: 12px;
  background: var(--bg-subtle);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
}

/* ── 2-column split: 3D viewer (left) + AI chat advisor (right) ────── */
.lp-split {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  padding: 12px 20px 20px;
  align-items: stretch;
}
@media (max-width: 1100px) {
  .lp-split { grid-template-columns: 1fr; }
}

/* When inside .lp-split, the 3D wrap loses its centering margin so it fills its column */
.lp-3d-wrap--split {
  padding: 0;
  max-width: none;
  margin: 0;
}

/* ═══ SOP → Operation Manual ═════════════════════════════════════════════ */
.op-man-list { display: flex; flex-direction: column; gap: 16px; padding: 16px 20px 20px; }
.op-man-empty { padding: 40px 20px; text-align: center; color: var(--text-secondary); font-size: 13px; }
.op-man-card {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-base);
  overflow: hidden;
  transition: box-shadow .15s ease;
}
.op-man-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.04); }
.op-man-card__head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(173,156,130,.06), rgba(173,156,130,.02));
  border-bottom: 1px solid var(--border);
}
.op-man-card__id { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.op-man-card__seq {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  background: var(--brand-gold, #AD9C82);
  color: #fff;
  border-radius: 99px;
  letter-spacing: .04em;
  flex-shrink: 0;
}
.op-man-card__name {
  flex: 1;
  height: 28px;
  padding: 0 8px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  min-width: 0;
}
.op-man-card__name:focus, .op-man-card__name:hover {
  border-color: var(--border);
  background: var(--bg-base);
  outline: none;
}

.op-man-card__body {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(380px, 1.4fr);
  gap: 18px;
  padding: 16px;
}
@media (max-width: 1100px) {
  .op-man-card__body { grid-template-columns: 1fr; }
}

/* Left column */
.op-man-card__left { display: flex; flex-direction: column; gap: 14px; }
.op-man-card__image {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bg-subtle, #faf7f0);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.op-man-card__image img { width: 100%; height: 100%; object-fit: cover; }
.op-man-card__image-upload {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center;
  background: transparent; border: none; cursor: pointer;
  color: var(--text-secondary);
  transition: background .15s ease;
}
.op-man-card__image-upload:hover { background: rgba(173,156,130,.08); color: var(--brand-gold-dark, #7a6638); }
.op-man-card__image-upload small { font-size: 11px; font-weight: 500; }
.op-man-card__image-remove {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px;
  border-radius: 99px;
  border: none;
  background: rgba(0,0,0,.55);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.op-man-card__image-remove:hover { background: rgba(220,38,38,.85); }

.op-man-card__specs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.op-man-field { display: flex; flex-direction: column; gap: 4px; }
.op-man-field--wide { grid-column: 1 / -1; }
.op-man-field label {
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 600;
}
.op-man-field input, .op-man-field textarea {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-base);
  font-size: 12px;
  font-family: inherit;
}
.op-man-field textarea { height: auto; padding: 6px 8px; resize: vertical; min-height: 48px; }
.op-man-field input:focus, .op-man-field textarea:focus {
  outline: none;
  border-color: var(--brand-gold, #AD9C82);
  box-shadow: 0 0 0 2px rgba(173,156,130,.15);
}

/* Right column */
.op-man-card__right { display: flex; flex-direction: column; gap: 16px; }
.op-man-section header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 8px;
}
.op-man-section header strong { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-primary); }

.op-sp-list { display: flex; flex-direction: column; gap: 6px; }
.op-sp-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 80px 1.2fr 28px;
  gap: 6px;
  align-items: center;
}
.op-sp-row input {
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-base);
  font-size: 11px;
}
.op-sp-row input[type="number"] { font-family: 'JetBrains Mono', monospace; text-align: center; }

/* Files section */
.op-man-files { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .op-man-files { grid-template-columns: 1fr; } }
.op-file-block {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-subtle, #faf7f0);
}
.op-file-block--has { background: rgba(173,156,130,.06); border-color: rgba(173,156,130,.4); }
.op-file-block header { margin-bottom: 8px; }
.op-file-block header small { color: var(--text-secondary); font-family: 'JetBrains Mono', monospace; font-size: 10px; }
.op-file-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.op-file-name {
  flex: 1; min-width: 0;
  font-size: 11px; font-family: 'JetBrains Mono', monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--brand-gold-dark, #7a6638);
  text-decoration: none;
}
.op-file-name:hover { text-decoration: underline; }
.op-file-block video { width: 100%; max-height: 220px; border-radius: var(--r-sm); margin-bottom: 8px; background: #000; }
.op-file-upload-btn { width: 100%; justify-content: center; }

/* ═══ INVENTORY CONTROL ═══════════════════════════════════════════════════ */
.inv-util-card .card__head { gap: 12px; flex-wrap: wrap; }
.inv-dash {
  padding: 16px 20px 20px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .inv-dash { grid-template-columns: 1fr; }
}
.inv-dash__gauge { display: flex; flex-direction: column; gap: 10px; }
.inv-dash__gauge-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.inv-dash__gauge-head strong {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-secondary);
}
.inv-dash__pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px;
  font-weight: 700;
}
.inv-dash__track {
  height: 14px;
  background: var(--bg-subtle, #f5f1e8);
  border-radius: 99px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.06);
}
.inv-dash__fill {
  height: 100%;
  transition: width .35s cubic-bezier(.18,.89,.32,1.18);
  border-radius: 99px;
}
.inv-dash__legend {
  display: flex; gap: 18px; flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-secondary);
}
.inv-dash__legend strong { color: var(--text-primary); font-family: 'JetBrains Mono', monospace; }
.inv-dash__kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 600px) {
  .inv-dash__kpis { grid-template-columns: repeat(2, 1fr); }
}
.inv-dash__kpi {
  background: var(--bg-subtle, #faf7f0);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.inv-dash__kpi label {
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 600;
}
.inv-dash__kpi strong {
  font-size: 20px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
}
.inv-dash__kpi--warn { background: rgba(220, 38, 38, .06); border-color: rgba(220, 38, 38, .25); }
.inv-dash__kpi--warn strong { color: var(--status-red, #dc2626); }

/* ═══ TASKS PAGE — calendar + urgent panel + tasks table ════════════════ */
/* Top section: 2-column layout — calendar (wide) + urgent panel (narrow) */
.tasks-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 980px) { .tasks-layout { grid-template-columns: 1fr; } }
.tasks-cal-card .card__head { padding: 12px 16px; }
.tasks-cal-card .card__head h3 { font-size: 16px; }

/* Monthly grid (7 columns) */
.tasks-cal { padding: 12px 16px 16px; }
.tasks-cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.tasks-cal__weekday {
  text-align: center;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
  font-weight: 700;
  padding: 6px 0;
  background: var(--bg-subtle, #faf7f0);
  border-radius: var(--r-sm);
}
.tasks-cal__cell {
  min-height: 88px;
  padding: 6px 6px 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-base);
  display: flex; flex-direction: column; gap: 2px;
  overflow: hidden;
  transition: all .12s ease;
  cursor: pointer;
  position: relative;
}
.tasks-cal__cell:not(.tasks-cal__cell--blank):hover {
  border-color: var(--brand-gold, #AD9C82);
  background: rgba(173,156,130,.10);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  transform: translateY(-1px);
}
/* "+" hint on hover — subtle clue the day is clickable to add a task */
.tasks-cal__cell:not(.tasks-cal__cell--blank):hover::after {
  content: '+';
  position: absolute;
  top: 4px; left: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-gold, #AD9C82);
  line-height: 1;
}
.tasks-cal__cell--blank {
  background: transparent; border-color: transparent;
  cursor: default;
}
.tasks-cal__cell--blank:hover { transform: none; box-shadow: none; }

/* Calendar title is now clickable to open the month/year picker */
.tasks-cal__title--clickable {
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  transition: all .12s ease;
  display: inline-flex; align-items: center; gap: 6px;
}
.tasks-cal__title--clickable:hover {
  background: rgba(173,156,130,.12);
  border-color: rgba(173,156,130,.4);
}
.tasks-cal__title--clickable::after {
  content: '▾';
  font-size: 10px;
  color: var(--text-secondary);
  margin-left: 2px;
}
.tasks-cal__cell--has { border-color: rgba(173,156,130,.4); background: rgba(173,156,130,.04); }
.tasks-cal__cell--today {
  background: linear-gradient(135deg, rgba(173,156,130,.18), rgba(173,156,130,.06));
  border-color: var(--brand-gold, #AD9C82);
  border-width: 2px; padding: 5px 5px 3px;
}
.tasks-cal__cell--today .tasks-cal__num {
  color: var(--brand-gold-dark, #7a6638);
  font-weight: 800;
}
.tasks-cal__num {
  font-size: 11px; font-weight: 600;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
  margin-bottom: 2px;
}
.tasks-cal__chip {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--brand-navy-100, rgba(35,71,126,.1));
  color: var(--brand-navy-700, #23477e);
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.tasks-cal__chip--urgent {
  background: rgba(220,38,38,.15);
  color: #dc2626;
  font-weight: 700;
  animation: tasks-blink 1.4s ease-in-out infinite;
}
.tasks-cal__more {
  font-size: 9px; color: var(--text-secondary);
  text-align: center;
  font-style: italic;
}

/* Urgent panel */
.tasks-urgent-card .card__head { padding: 12px 16px; }
.tasks-urgent-card .card__head h3 { font-size: 16px; }
.tasks-urgent-list {
  padding: 8px 12px 12px;
  display: flex; flex-direction: column; gap: 8px;
  max-height: 540px;
  overflow-y: auto;
}
.tasks-urgent-empty {
  padding: 24px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}
.tasks-urgent-item {
  position: relative;
  padding: 10px 32px 10px 12px;
  background: linear-gradient(135deg, rgba(220,38,38,.06), rgba(220,38,38,.02));
  border: 1px solid rgba(220,38,38,.3);
  border-left: 3px solid #dc2626;
  border-radius: var(--r-md);
}
.tasks-urgent-item.is-overdue {
  background: linear-gradient(135deg, rgba(220,38,38,.14), rgba(220,38,38,.06));
  border-color: rgba(220,38,38,.55);
  box-shadow: 0 0 0 1px rgba(220,38,38,.2);
}
.tasks-urgent-item.is-done {
  background: rgba(0,0,0,.03);
  border-color: var(--border);
  border-left-color: #16a34a;
  opacity: .65;
}
.tasks-urgent-item__head {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  margin-bottom: 4px;
}
.tasks-urgent-item__head strong { font-size: 13px; flex: 1; min-width: 0; }
.tasks-urgent-item.is-done strong { text-decoration: line-through; color: var(--text-secondary); }
.tasks-urgent-item__head button { flex-shrink: 0; }
.tasks-urgent-item__meta { display: flex; flex-direction: column; gap: 2px; font-size: 11px; }
.tasks-urgent-item__meta small { line-height: 1.4; }
.tasks-urgent-item__remove {
  position: absolute; top: 6px; right: 6px;
  width: 20px; height: 20px;
  border: none; background: transparent;
  color: var(--text-secondary);
  cursor: pointer; font-size: 16px; line-height: 1;
  border-radius: 50%;
}
.tasks-urgent-item__remove:hover { background: rgba(220,38,38,.15); color: #dc2626; }

/* Blinking title — keeps user's attention on active urgent tasks */
.tasks-urgent-blink {
  color: #dc2626;
  animation: tasks-blink 1.2s ease-in-out infinite;
}
@keyframes tasks-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

/* Sidebar badge — urgent variant pulses red */
.sidebar__badge--urgent {
  background: #dc2626;
  animation: tasks-blink 1.2s ease-in-out infinite;
}

/* ═══ XIAOBAI TASKS PANEL — delegated work log ═══════════════════════════ */
.tasks-xiaobai-tasks-card { margin-bottom: 16px; }
.tasks-xiaobai-tasks-card .card__head h3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
}
.xiaobai-avatar--xs {
  width: 24px; height: 24px;
  font-size: 14px;
  border-width: 1.5px;
}
.xiaobai-task-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  background: var(--brand-gold, #AD9C82);
  color: #fff;
  padding: 2px 8px;
  border-radius: 99px;
  min-width: 24px;
  text-align: center;
}
.xiaobai-tasks-list {
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 600px;
  overflow-y: auto;
}

/* Active / History segmented toggle in Xiaobai Tasks card header */
.xb-tasks-seg {
  display: inline-flex;
  gap: 4px;
  margin-left: 12px;
  padding: 3px;
  background: var(--bg-subtle, #faf7f0);
  border: 1px solid var(--border);
  border-radius: 99px;
}
.xb-tasks-seg button {
  border: none;
  background: transparent;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 99px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all .15s ease;
}
.xb-tasks-seg button:hover {
  color: var(--text-primary);
  background: rgba(173,156,130,.08);
}
.xb-tasks-seg button.is-active {
  background: var(--brand-gold, #AD9C82);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.xb-tasks-seg__count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(0,0,0,.08);
}
.xb-tasks-seg button.is-active .xb-tasks-seg__count {
  background: rgba(255,255,255,.25);
}
.xiaobai-tasks-empty {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-secondary);
  font-size: 13px;
  background: var(--bg-subtle, #faf7f0);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
}
.xiaobai-tasks-empty strong {
  display: block;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.xiaobai-tasks-empty p { margin: 0; font-size: 12px; font-style: italic; }

/* Each delegated task is a card */
.xiaobai-task-card {
  background: var(--bg-base, #fff);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-gold, #AD9C82);
  border-radius: var(--r-md);
  padding: 12px 14px;
  transition: all .15s ease;
}
.xiaobai-task-card.is-processing {
  border-left-color: var(--brand-navy-700, #23477e);
  background: linear-gradient(135deg, rgba(35,71,126,.03), transparent);
}
.xiaobai-task-card.is-completed { border-left-color: #16a34a; }
.xiaobai-task-card.is-failed { border-left-color: #dc2626; }
.xiaobai-task-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

/* Card header — id, status badge, time, actions */
.xiaobai-task-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.xiaobai-task-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(0,0,0,.05);
  padding: 3px 7px;
  border-radius: var(--r-sm);
  letter-spacing: .03em;
}
.xiaobai-task-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
}
.xiaobai-task-status--processing {
  background: rgba(35,71,126,.12);
  color: var(--brand-navy-700, #23477e);
  animation: xiaobai-task-pulse 1.4s ease-in-out infinite;
}
.xiaobai-task-status--completed {
  background: rgba(22,163,74,.12);
  color: #15803d;
}
.xiaobai-task-status--failed {
  background: rgba(220,38,38,.12);
  color: #dc2626;
}
@keyframes xiaobai-task-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}
.xiaobai-task-time {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  margin-left: auto;
}
.xiaobai-task-actions {
  display: flex;
  gap: 4px;
}

/* Prompt — what the user asked Xiaobai to do */
.xiaobai-task-prompt {
  background: rgba(173,156,130,.06);
  border-left: 2px solid var(--brand-gold, #AD9C82);
  padding: 8px 12px;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  margin-bottom: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-primary);
}
.xiaobai-task-prompt strong {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
  margin-bottom: 3px;
  font-weight: 700;
}

/* Result block — collapsible */
.xiaobai-task-result-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: linear-gradient(135deg, rgba(22,163,74,.03), transparent);
}
.xiaobai-task-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  background: rgba(22,163,74,.06);
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 12px;
  text-align: left;
  color: var(--text-primary);
  transition: background .12s ease;
}
.xiaobai-task-toggle:hover { background: rgba(22,163,74,.10); }
.xiaobai-task-toggle strong { font-weight: 700; }
.xiaobai-task-toggle small { color: var(--text-secondary); font-family: 'JetBrains Mono', monospace; }
.xiaobai-task-toggle__arrow {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-secondary);
  transition: transform .15s ease;
}
.xiaobai-task-card.is-expanded .xiaobai-task-toggle__arrow { transform: rotate(180deg); }

.xiaobai-task-result {
  margin: 0;
  padding: 0 14px;
  max-height: 0;
  overflow: hidden;
  background: var(--bg-base, #fff);
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
  transition: max-height .2s ease, padding .2s ease;
}
.xiaobai-task-card.is-expanded .xiaobai-task-result {
  max-height: 600px;
  padding: 12px 14px;
  overflow-y: auto;
}

/* Processing state — show spinner inline */
.xiaobai-task-result--processing {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(35,71,126,.04);
  border: 1px dashed rgba(35,71,126,.25);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--brand-navy-700, #23477e);
  font-style: italic;
}
.xiaobai-task-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(35,71,126,.2);
  border-top-color: var(--brand-navy-700, #23477e);
  border-radius: 50%;
  animation: xiaobai-spin .8s linear infinite;
}
@keyframes xiaobai-spin {
  to { transform: rotate(360deg); }
}

/* ═══ 🧾 IMPORT TAX CALCULATOR — Master Data sub-page ═════════════════════ */

/* Country picker landing — grid of clickable country tiles */
.it-country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  padding: 14px 20px 20px;
}
.it-country-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-base, #fff);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  transition: all .15s ease;
  font-family: inherit;
  position: relative;
}
.it-country-tile:hover {
  border-color: var(--brand-gold, #AD9C82);
  background: rgba(173, 156, 130, .05);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .08);
}
.it-country-tile__flag {
  width: 40px; height: 30px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
  flex-shrink: 0;
  object-fit: cover;
}
.it-country-tile__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.it-country-tile__body strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.it-country-tile__body small {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}
.it-country-tile__stats {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.it-country-tile__chip {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(35, 71, 126, .1);
  color: var(--brand-navy-700, #23477e);
}
.it-country-tile__chip--saved {
  background: rgba(22, 163, 74, .12);
  color: #15803d;
}
.it-country-tile__arrow {
  flex-shrink: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--brand-gold, #AD9C82);
  transition: transform .15s ease;
}
.it-country-tile:hover .it-country-tile__arrow {
  transform: translateX(4px);
}

/* Breadcrumb when inside the calculator view */
.it-breadcrumb {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  padding: 10px 16px;
  background: var(--bg-subtle, #faf7f0);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.it-breadcrumb__active {
  display: flex;
  align-items: center;
  gap: 10px;
}
.it-breadcrumb__active img {
  width: 32px; height: 24px;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}
.it-breadcrumb__active strong { display: block; font-size: 14px; color: var(--text-primary); }
.it-breadcrumb__active small  { display: block; font-size: 11px; color: var(--text-secondary); font-family: 'JetBrains Mono', monospace; }

.it-card { margin-bottom: 14px; }
.it-card .card__head h3 { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; }
.it-items-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(0,0,0,.05);
  padding: 2px 8px;
  border-radius: 99px;
  margin-left: 4px;
}

/* Header form grid */
.it-header-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 16px;
  padding: 14px 20px 18px;
}
.it-field { display: flex; flex-direction: column; gap: 5px; }
.it-field label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.it-field label .it-curr-target { color: var(--brand-gold-dark, #7a6638); }
.it-field input, .it-field select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-base, #fff);
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  transition: all .12s ease;
}
.it-field input:focus, .it-field select:focus {
  outline: none;
  border-color: var(--brand-gold, #AD9C82);
  box-shadow: 0 0 0 3px rgba(173,156,130,.15);
}

/* Items table */
.it-table {
  width: 100%;
  font-size: 12.5px;
}
.it-table th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary);
  font-weight: 700;
  padding: 10px 8px;
  text-align: left;
  background: var(--bg-subtle, #faf7f0);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.it-table th.num { text-align: right; }
.it-table th.it-th-total {
  background: linear-gradient(135deg, rgba(22, 163, 74, .12), rgba(22, 163, 74, .04));
  color: #15803d;
}
.it-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.it-table td.num { text-align: right; }
.it-table .it-row-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: center;
}
.it-table .it-empty {
  text-align: center;
  padding: 32px;
  color: var(--text-secondary);
  font-style: italic;
}

.it-input {
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text-primary);
  transition: all .12s ease;
}
.it-input:hover  { background: rgba(0,0,0,.025); }
.it-input:focus  {
  outline: none;
  background: var(--bg-base, #fff);
  border-color: var(--brand-gold, #AD9C82);
  box-shadow: 0 0 0 2px rgba(173,156,130,.15);
}
.it-input.num    { text-align: right; font-family: 'JetBrains Mono', monospace; }
.it-input--name  { min-width: 180px; }
.it-input--duty  { max-width: 70px; font-weight: 700; color: #c2410c; }

/* Small product photo thumbnail — read-only display on Cost / Cost Saving pages */
.md-cost-photo-thumb {
  width: 32px; height: 32px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  cursor: zoom-in;
  flex-shrink: 0;
  transition: transform .12s ease, box-shadow .12s ease;
}
.md-cost-photo-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .15);
  border-color: var(--brand-gold, #AD9C82);
}

/* ── Product photo column (MASTER on Products page) ────────────────── */
.md-product-photo-cell { text-align: center; padding: 4px 6px !important; }
.md-product-photo-btn {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  width: 72px; height: 52px;
  background: #fff;
  border: 2px dashed var(--brand-gold, #AD9C82);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  color: var(--brand-gold-dark, #7a6638);
  transition: all .15s ease;
  overflow: hidden;
}
.md-product-photo-btn:hover {
  background: rgba(173,156,130,.10);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,.08);
}
.md-product-photo-btn--has {
  border-style: solid;
  border-color: var(--brand-gold, #AD9C82);
  padding: 0;
}
.md-product-photo-btn--has img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.md-product-photo-btn--has span {
  position: absolute;
  bottom: 2px; right: 2px;
  background: rgba(0,0,0,.75);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 99px;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.2;
}

/* ── Photo column: in-row thumbnail / add button ─────────────────────── */
.it-photo-cell {
  text-align: center;
  padding: 4px 6px !important;
  background: rgba(173, 156, 130, .04);
}
.it-photo-btn {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  width: 80px; height: 56px;
  background: #fff;
  border: 2px dashed var(--brand-gold, #AD9C82);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  color: var(--brand-gold-dark, #7a6638);
  transition: all .15s ease;
  overflow: hidden;
}
.it-photo-btn:hover {
  border-color: var(--brand-gold, #AD9C82);
  background: rgba(173,156,130,.1);
  color: var(--brand-gold-dark, #7a6638);
  transform: translateY(-1px);
}
.it-photo-btn--empty span { font-size: 10px; }
.it-photo-btn--has {
  border-style: solid;
  border-color: var(--brand-gold, #AD9C82);
  background: var(--bg-base, #fff);
  padding: 0;
}
.it-photo-thumb {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.it-photo-count {
  position: absolute;
  bottom: 2px; right: 2px;
  background: rgba(0,0,0,.7);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 99px;
  line-height: 1.2;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Photo manager modal — preview grid + add card ──────────────────── */
.it-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  padding: 4px;
}
.it-photo-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-subtle, #faf7f0);
  cursor: zoom-in;
}
.it-photo-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .2s ease;
}
.it-photo-card:hover img { transform: scale(1.05); }
.it-photo-card__remove {
  position: absolute;
  top: 6px; right: 6px;
  width: 24px; height: 24px;
  background: rgba(220, 38, 38, .9);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease;
}
.it-photo-card__remove:hover { transform: scale(1.15); background: #dc2626; }
.it-photo-card__idx {
  position: absolute;
  bottom: 6px; left: 6px;
  background: rgba(0,0,0,.7);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  font-family: 'JetBrains Mono', monospace;
}
.it-photo-add-card {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px dashed var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  color: var(--text-secondary);
  background: var(--bg-subtle, #faf7f0);
  transition: all .15s ease;
  padding: 12px;
  text-align: center;
}
.it-photo-add-card:hover {
  border-color: var(--brand-gold, #AD9C82);
  background: rgba(173,156,130,.08);
  color: var(--brand-gold-dark, #7a6638);
}
.it-photo-add-card--full {
  cursor: default;
  border-color: #16a34a;
  color: #15803d;
  background: rgba(22,163,74,.05);
}
.it-photo-add-card--full:hover { transform: none; background: rgba(22,163,74,.05); }
.it-photo-add-card strong { font-size: 13px; font-weight: 700; }
.it-photo-add-card small { font-size: 11px; }

/* ── Photo lightbox (reusable) — carousel + dots + counter ──────────── */
.photo-lightbox {
  position: fixed; inset: 0; z-index: 10500;
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}
.photo-lightbox.is-open { opacity: 1; pointer-events: auto; }
.photo-lightbox__overlay {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .88);
  backdrop-filter: blur(4px);
}
.photo-lightbox__frame {
  position: relative;
  width: min(90vw, 1200px);
  height: 90vh;
  margin: 5vh auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(.92);
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}
.photo-lightbox.is-open .photo-lightbox__frame { transform: scale(1); }
.photo-lightbox__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.photo-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px; height: 52px;
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 2px solid rgba(255,255,255,.25);
  border-radius: 50%;
  font-size: 28px;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s ease;
  backdrop-filter: blur(8px);
}
.photo-lightbox__nav:hover {
  background: rgba(255,255,255,.25);
  border-color: rgba(255,255,255,.5);
  transform: translateY(-50%) scale(1.1);
}
.photo-lightbox__nav--prev { left: 16px; }
.photo-lightbox__nav--next { right: 16px; }
.photo-lightbox__close {
  position: absolute;
  top: 12px; right: 12px;
  width: 40px; height: 40px;
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 2px solid rgba(255,255,255,.25);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s ease;
  backdrop-filter: blur(8px);
}
.photo-lightbox__close:hover {
  background: rgba(220,38,38,.7);
  border-color: rgba(220,38,38,.9);
  transform: scale(1.1);
}
.photo-lightbox__caption {
  position: absolute;
  bottom: 16px; left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  background: rgba(0,0,0,.6);
  color: #fff;
  border-radius: 99px;
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: center;
  backdrop-filter: blur(8px);
  white-space: nowrap;
  max-width: 80vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.photo-lightbox__counter {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  background: rgba(255,255,255,.15);
  padding: 2px 8px;
  border-radius: 99px;
}
.photo-lightbox__dots {
  position: absolute;
  bottom: 60px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}
.photo-lightbox__dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,.3);
  border: none;
  cursor: pointer;
  transition: all .15s ease;
  padding: 0;
}
.photo-lightbox__dot.is-active {
  background: #fff;
  transform: scale(1.4);
}
.photo-lightbox__dot:hover { background: rgba(255,255,255,.6); }

@media (max-width: 720px) {
  .photo-lightbox__nav { width: 40px; height: 40px; font-size: 22px; }
}

.it-readonly {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
  background: rgba(0,0,0,.02);
}
.it-cell-total {
  font-weight: 700;
  color: #15803d;
  background: rgba(22, 163, 74, .06) !important;
  border-radius: var(--r-sm);
}

/* Summary cards */
.it-summary-card { padding-bottom: 4px; }
.it-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  padding: 14px 20px 20px;
}
.it-sum-card {
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-base, #fff);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.it-sum-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.it-sum-card small {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
}
.it-sum-card strong {
  font-size: 22px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
  line-height: 1.2;
}
.it-sum-card strong span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: 4px;
}
.it-sum-card em {
  font-size: 11px;
  font-style: normal;
  color: var(--text-secondary);
  line-height: 1.4;
}

.it-sum-card--soft   { background: linear-gradient(135deg, rgba(173,156,130,.08), rgba(173,156,130,.02)); border-color: rgba(173,156,130,.3); }
.it-sum-card--blue   { background: linear-gradient(135deg, rgba(35,71,126,.08), rgba(35,71,126,.02));    border-color: rgba(35,71,126,.3); }
.it-sum-card--blue strong { color: #1e40af; }
.it-sum-card--orange { background: linear-gradient(135deg, rgba(249,115,22,.10), rgba(249,115,22,.02)); border-color: rgba(249,115,22,.3); }
.it-sum-card--orange strong { color: #c2410c; }
.it-sum-card--gold   { background: linear-gradient(135deg, rgba(251,191,36,.12), rgba(251,191,36,.02)); border-color: rgba(251,191,36,.4); }
.it-sum-card--gold strong { color: #b45309; }
.it-sum-card--grand  {
  background: linear-gradient(135deg, #16a34a, #15803d);
  border-color: #166534;
  color: #fff;
}
.it-sum-card--grand small  { color: rgba(255,255,255,.85); }
.it-sum-card--grand strong { color: #fff; font-size: 26px; }
.it-sum-card--grand strong span { color: rgba(255,255,255,.85); }
.it-sum-card--grand em     { color: rgba(255,255,255,.85); }

/* Protected account badge — shown next to permanent team members */
.protected-badge {
  display: inline-block;
  font-size: 13px;
  color: var(--brand-gold-dark, #7a6638);
  margin-left: 4px;
  cursor: help;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
}

/* ═══ 🛒 SHOP OPENING SET ════════════════════════════════════════════════ */
/* ── Item List (checklist builder) ──────────────────────────────────── */
.shopopen-share-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: linear-gradient(135deg, rgba(173,156,130,.08), rgba(173,156,130,.02));
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.shopopen-share-bar code {
  flex: 1;
  min-width: 280px;
  padding: 6px 10px;
  background: var(--bg-base, #fff);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--brand-navy-700, #23477e);
  word-break: break-all;
}
.shopopen-itemlist-table tbody tr.is-selected {
  background: rgba(22, 163, 74, .06);
}
.shopopen-itemlist-table tbody tr.is-selected td {
  border-bottom-color: rgba(22, 163, 74, .25);
}
.shopopen-empty-cell {
  text-align: center;
  color: var(--text-secondary);
}
.shopopen-empty-cell strong {
  display: block;
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.shopopen-check {
  width: 18px; height: 18px;
  cursor: pointer;
  accent-color: var(--brand-gold, #AD9C82);
}

/* Status chip near share link */
.shopopen-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 10px;
  background: rgba(22, 163, 74, .08);
  border: 1px solid rgba(22, 163, 74, .25);
  color: #15803d;
  border-radius: 99px;
  font-weight: 600;
  margin-left: auto;
}
.shopopen-status-chip.is-dirty {
  background: rgba(245, 158, 11, .08);
  border-color: rgba(245, 158, 11, .35);
  color: #92400e;
}
.shopopen-status-chip__warn { font-weight: 700; }
.shopopen-status-chip .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.shopopen-status-chip .dot--ok   { background: #16a34a; box-shadow: 0 0 0 2px rgba(22, 163, 74, .25); }
.shopopen-status-chip .dot--warn { background: #f59e0b; box-shadow: 0 0 0 2px rgba(245, 158, 11, .25); animation: tasks-blink 1.6s ease-in-out infinite; }

/* Save button gets a subtle pulse when there are unsaved changes */
#shopOpenSave.is-attention {
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .25);
  animation: shopopen-save-pulse 1.5s ease-in-out infinite;
}
@keyframes shopopen-save-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(245, 158, 11, .25); }
  50%      { box-shadow: 0 0 0 6px rgba(245, 158, 11, .15); }
}
#shopOpenSave.is-flashing {
  background: #16a34a;
  border-color: #16a34a;
  animation: none;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, .3);
}

/* Per-row status badges in the checklist */
.shopopen-row-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: .03em;
  display: inline-block;
  white-space: nowrap;
}
.shopopen-row-badge--saved { background: rgba(22, 163, 74, .12); color: #15803d; }
.shopopen-row-badge--new   { background: rgba(35, 71, 126, .12); color: #1e40af; }
.shopopen-row-badge--del   { background: rgba(220, 38, 38, .12); color: #b91c1c; text-decoration: line-through; }

/* ── Submitted Orders list ──────────────────────────────────────────── */
.shopopen-orders-list {
  padding: 14px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.shopopen-order-card {
  padding: 14px 16px;
  background: var(--bg-base, #fff);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-gold, #AD9C82);
  border-radius: var(--r-md);
  transition: transform .15s ease, box-shadow .15s ease;
}
.shopopen-order-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
}
.shopopen-order-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.shopopen-order-card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.shopopen-order-card__title img {
  width: 24px; height: 18px;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
  flex-shrink: 0;
}
.shopopen-order-card__title strong { font-size: 14px; }
.shopopen-order-card__meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.shopopen-order-card__id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(0,0,0,.05);
  padding: 3px 7px;
  border-radius: var(--r-sm);
}
.shopopen-order-card__sub {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-secondary);
}
.shopopen-order-card__qty {
  margin-left: auto;
  background: rgba(35,71,126,.1);
  color: var(--brand-navy-700, #23477e);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

/* Item-only entry — grid of item cards showing photo + specs */
.shopopen-order-card--items { border-left-color: var(--brand-navy-700, #23477e); }
.shopopen-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

/* ─── Presentation-quality product card (sales brochure feel) ─────────
   Used for "Add Items" entries — bigger photo, prominent name, clean
   icon-based specs. Looks like a catalogue you'd hand to a customer. */
.shopopen-presentation-card {
  background: #ffffff;
  border: 1px solid var(--border, #e5e1d6);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  transition: transform .15s ease, box-shadow .15s ease;
  cursor: pointer;
}
.shopopen-presentation-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(124,58,237,0.12), 0 2px 4px rgba(0,0,0,0.08);
}
.shopopen-presentation-card__photo {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #faf7f0 0%, #f3ede0 100%);
  overflow: hidden;
}
.shopopen-presentation-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s ease;
}
.shopopen-presentation-card:hover .shopopen-presentation-card__photo img {
  transform: scale(1.04);
}
.shopopen-presentation-card__photo-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: var(--brand-gold, #AD9C82);
  opacity: 0.4;
}
/* Code badge overlaid in top-left of photo */
.shopopen-presentation-card__code {
  position: absolute;
  top: 8px; left: 8px;
  padding: 4px 10px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(4px);
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-navy-700, #23477e);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  letter-spacing: 0.02em;
}
.shopopen-presentation-card__body {
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.shopopen-presentation-card__name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary, #1f2937);
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.shopopen-presentation-card__alt {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
  font-weight: 500;
  line-height: 1.4;
}
.shopopen-presentation-card__alt--cn { color: var(--brand-gold-dark, #7a6638); }
.shopopen-presentation-card__price {
  margin-top: 4px;
  padding: 6px 12px;
  background: linear-gradient(135deg, rgba(173,156,130,.10), rgba(173,156,130,.04));
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  color: var(--brand-navy-700, #23477e);
  width: fit-content;
}
.shopopen-presentation-card__price strong { font-weight: 800; }
.shopopen-presentation-card__price span {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-left: 4px;
}
.shopopen-presentation-card__specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px dashed var(--border, #e5e1d6);
}
.shopopen-presentation-card__spec {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-primary, #374151);
  min-width: 0;
}
.shopopen-presentation-card__spec-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.shopopen-presentation-card__spec-val {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Container override for presentation cards — wider min so big photos look right */
.shopopen-items-grid:has(.shopopen-presentation-card) {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ─── Category section (groups items within an order card by category) ──── */
.shopopen-cat-section {
  margin-top: 18px;
}
.shopopen-cat-section + .shopopen-cat-section {
  margin-top: 28px;
}
.shopopen-cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #faf7f0 0%, #f3ede0 100%);
  border-left: 4px solid var(--brand-gold, #AD9C82);
  border-radius: 8px;
}
.shopopen-cat-header__name {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand-navy-700, #23477e);
  letter-spacing: 0.01em;
}
.shopopen-cat-header__count {
  font-size: 12px;
  color: var(--brand-gold-dark, #7a6638);
  background: rgba(255,255,255,0.6);
  padding: 3px 10px;
  border-radius: 99px;
  font-weight: 600;
}

/* ─── Public Showcase (read-only catalogue at #showcase) ──────────────
   Designed to look like a premium product catalogue — soft pastels,
   generous whitespace, big product photos, sales-brochure typography. */
.showcase-sheet {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 32px 60px;
  background: linear-gradient(180deg, #faf7f0 0%, #ffffff 200px);
  min-height: 100vh;
}
.showcase-hero {
  text-align: center;
  padding: 30px 20px 40px;
  border-bottom: 2px solid var(--brand-gold, #AD9C82);
  margin-bottom: 40px;
}
.showcase-hero h1 {
  margin: 0 0 8px;
  font-size: 32px;
  font-weight: 800;
  color: var(--brand-navy-700, #23477e);
  letter-spacing: -0.02em;
}
.showcase-hero__sub {
  margin: 0 0 16px;
  font-size: 15px;
  color: var(--text-secondary, #6b7280);
  font-style: italic;
}
.showcase-hero__country {
  margin: 0 0 12px;
}
.showcase-country-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--brand-gold, #AD9C82);
  color: #fff;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(173,156,130,0.35);
}
.showcase-country-pill img {
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.showcase-hero__meta {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 6px 16px;
  background: rgba(173,156,130,0.08);
  border-radius: 99px;
  font-size: 13px;
  color: var(--brand-gold-dark, #7a6638);
}
.showcase-hero__meta strong { color: var(--brand-navy-700, #23477e); }

.showcase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

/* ─── Showcase category section (groups cards by product category) ──── */
.showcase-cat-section { margin-bottom: 40px; }
.showcase-cat-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--brand-gold, #AD9C82);
}
.showcase-cat-header__name {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--brand-navy-700, #23477e);
  letter-spacing: -0.01em;
}
.showcase-cat-header__count {
  font-size: 13px;
  color: var(--brand-gold-dark, #7a6638);
  background: linear-gradient(135deg, #fef9c3 0%, #fed7aa 100%);
  padding: 4px 14px;
  border-radius: 99px;
  font-weight: 700;
}

.showcase-card {
  background: #ffffff;
  border: 1px solid var(--border, #e5e1d6);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06);
  transition: transform .2s ease, box-shadow .2s ease;
}
.showcase-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px rgba(124,58,237,0.10), 0 4px 8px rgba(0,0,0,0.08);
}
.showcase-card__photo {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #faf7f0 0%, #f3ede0 100%);
  overflow: hidden;
  cursor: pointer;
}
.showcase-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.showcase-card:hover .showcase-card__photo img { transform: scale(1.05); }
.showcase-card__photo-empty {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 64px;
  color: var(--brand-gold, #AD9C82);
  opacity: 0.4;
}
.showcase-card__code {
  position: absolute;
  top: 12px; left: 12px;
  padding: 5px 12px;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(6px);
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-navy-700, #23477e);
  box-shadow: 0 2px 6px rgba(0,0,0,0.10);
  letter-spacing: 0.04em;
}
.showcase-card__body {
  padding: 20px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.showcase-card__name {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary, #1f2937);
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.showcase-card__alt {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary, #6b7280);
  font-weight: 500;
}
.showcase-card__price {
  margin-top: 4px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #fef9c3 0%, #fed7aa 100%);
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 800;
  color: var(--brand-navy-700, #23477e);
  width: fit-content;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
}
.showcase-card__price span {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-left: 4px;
}
.showcase-card__specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--border, #e5e1d6);
}
.showcase-card__spec {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-primary, #374151);
  min-width: 0;
}
.showcase-card__spec span:first-child { font-size: 14px; flex-shrink: 0; }
.showcase-card__spec span:last-child {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.showcase-footer {
  text-align: center;
  padding: 30px 20px;
  margin-top: 20px;
  border-top: 2px solid var(--brand-gold, #AD9C82);
}
.showcase-footer p {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--brand-navy-700, #23477e);
  font-weight: 600;
}
.showcase-footer__brand {
  display: inline-block;
  padding: 6px 20px;
  background: linear-gradient(135deg, var(--brand-gold, #AD9C82), var(--brand-gold-dark, #7a6638));
  color: #ffffff;
  border-radius: 99px;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 13px;
}

@media (max-width: 720px) {
  .showcase-sheet { padding: 24px 16px 40px; }
  .showcase-hero h1 { font-size: 24px; }
  .showcase-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .showcase-card__name { font-size: 14px; }
  .showcase-card__body { padding: 14px 12px; }
}
.shopopen-item-card {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-subtle, #faf7f0);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.shopopen-item-card__photo {
  flex-shrink: 0;
  width: 80px; height: 80px;
}
.shopopen-item-card__photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  cursor: zoom-in;
  transition: transform .12s ease, box-shadow .12s ease;
}
.shopopen-item-card__photo img:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.shopopen-item-card__photo-empty {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: var(--r-sm);
  font-size: 22px;
  opacity: .35;
}
.shopopen-item-card__body { flex: 1; min-width: 0; }
.shopopen-item-card__code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 700;
}
.shopopen-item-card__name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 2px 0;
  line-height: 1.3;
}
.shopopen-item-card__alt {
  font-size: 11px;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 4px;
}
.shopopen-item-card__specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
  margin-top: 6px;
  font-size: 11px;
}
.shopopen-item-card__specs > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.shopopen-item-card__specs label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
  display: flex;
  align-items: center;
  gap: 3px;
}
.shopopen-item-card__specs span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Submitted Orders empty state — matches the Item List empty state */
.shopopen-empty-state {
  margin: 16px 20px;
  padding: 40px 24px;
  text-align: center;
  color: var(--text-secondary);
  background: var(--bg-base, #fff);
  border: 2px dashed var(--border);
  border-radius: var(--r-md);
}
.shopopen-empty-state__icon {
  width: 60px; height: 60px;
  margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  background: var(--bg-subtle, #faf7f0);
  border-radius: 50%;
  border: 1px solid var(--border);
}
.shopopen-empty-state strong {
  display: block;
  font-size: 17px;
  color: var(--text-primary);
  margin-bottom: 10px;
}
.shopopen-empty-state p {
  font-size: 13px;
  line-height: 1.7;
  margin: 0 0 18px;
  color: var(--text-secondary);
}
.shopopen-empty-state p strong {
  display: inline;
  font-size: inherit;
  color: var(--brand-gold-dark, #7a6638);
  margin: 0;
}

/* "Manual entry" chip on order cards */
.shopopen-manual-chip {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(35, 71, 126, .1);
  color: var(--brand-navy-700, #23477e);
  letter-spacing: .03em;
}

/* ── "+ Add Items" modal — checklist layout (mirrors Item List page) ──── */
.ai-modal-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--bg-subtle, #faf7f0);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.ai-modal-controls .card__head-select,
.ai-modal-controls .filter-bar__search {
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: #fff;
  padding: 0 10px;
  font-size: 13px;
  font-family: inherit;
}
.ai-modal-controls .filter-bar__search { flex: 1; min-width: 200px; }
.ai-modal-controls__count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  background: rgba(35, 71, 126, .1);
  color: var(--brand-navy-700, #23477e);
  border-radius: 99px;
  font-family: 'JetBrains Mono', monospace;
}

/* Per-row qty input — small, inline in the table */
.ao-row-qty {
  width: 70px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
  color: var(--brand-navy-700, #23477e);
  background: #fff;
  transition: all .12s ease;
}
.ao-row-qty:disabled {
  background: var(--bg-subtle, #faf7f0);
  color: var(--text-secondary);
  opacity: .5;
  cursor: not-allowed;
}
.ao-row-qty:focus {
  outline: none;
  border-color: var(--brand-gold, #AD9C82);
  box-shadow: 0 0 0 2px rgba(173, 156, 130, .18);
}

/* Collapsible "optional shop info" details */
.ai-modal-details {
  background: var(--bg-subtle, #faf7f0);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0 14px;
}
.ai-modal-details summary {
  list-style: none;
  padding: 10px 0;
}
.ai-modal-details summary::-webkit-details-marker { display: none; }
.ai-modal-details summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 6px;
  transition: transform .15s ease;
  color: var(--brand-gold, #AD9C82);
}
.ai-modal-details[open] summary::before { transform: rotate(90deg); }
.ai-modal-details summary small {
  color: var(--text-secondary);
  font-size: 11px;
}

/* Detail modal */
.shopopen-detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  padding: 12px;
  background: var(--bg-subtle, #faf7f0);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.shopopen-detail-meta > div { display: flex; flex-direction: column; gap: 2px; }
.shopopen-detail-meta label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.shopopen-detail-meta strong { font-size: 13px; color: var(--text-primary); }
.shopopen-detail-signature {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--bg-base, #fff);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.shopopen-detail-signature h4 { margin: 0 0 10px; font-size: 13px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.shopopen-detail-signature img {
  max-width: 100%;
  border: 1px dashed var(--border);
  border-radius: var(--r-sm);
  background: #fff;
  padding: 8px;
}

/* ── Public order form ──────────────────────────────────────────────── */
.shopopen-public { padding: 28px 32px; }
.shopopen-public__head {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--brand-gold, #AD9C82);
  margin-bottom: 20px;
}
.shopopen-public__head img {
  width: 40px; height: 30px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,.15);
}
.shopopen-public__head h1 { margin: 0; font-size: 22px; color: var(--text-primary); }
.shopopen-public__head p  { margin: 4px 0 0; font-size: 12px; color: var(--text-secondary); }
.shopopen-public__intro {
  padding: 12px 14px;
  background: rgba(173, 156, 130, .08);
  border: 1px solid rgba(173, 156, 130, .3);
  border-radius: var(--r-md);
  margin-bottom: 18px;
  font-size: 13px;
}

/* Items grid */
.shopopen-public__items {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.shopopen-public-item {
  display: grid;
  grid-template-columns: 90px 1fr 170px;
  gap: 14px;
  align-items: center;
  padding: 12px;
  background: var(--bg-base, #fff);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.shopopen-public-item:hover { border-color: var(--brand-gold, #AD9C82); box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.shopopen-public-item__photo { width: 90px; height: 90px; }
.shopopen-public-item__photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: var(--r-sm);
  cursor: zoom-in;
  border: 1px solid var(--border);
}
.shopopen-public-item__photo-empty {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-subtle, #faf7f0);
  border: 1px dashed var(--border);
  border-radius: var(--r-sm);
  font-size: 28px;
  opacity: .4;
}
.shopopen-public-item__info { min-width: 0; }
.shopopen-public-item__code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 700;
}
.shopopen-public-item__name { font-size: 14px; font-weight: 600; margin: 2px 0; }
.shopopen-public-item__alt  { font-size: 12px; color: var(--text-secondary); }
.shopopen-public-item__meta {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
}
.shopopen-public-item__price {
  color: var(--brand-navy-700, #23477e);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.shopopen-public-item__qty {
  display: flex; flex-direction: column; gap: 4px;
  align-items: flex-end;
}
.shopopen-public-item__qty label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.shopopen-public-item__qty input {
  width: 140px;
  height: 40px;
  padding: 0 12px;
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  font-size: 16px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
  color: var(--brand-navy-700, #23477e);
}
.shopopen-public-item__qty input:focus {
  outline: none;
  border-color: var(--brand-gold, #AD9C82);
  box-shadow: 0 0 0 3px rgba(173,156,130,.18);
}
.shopopen-public-item__line-total {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
}

/* Totals strip */
.shopopen-public__totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(35,71,126,.06), rgba(35,71,126,.02));
  border: 1px solid rgba(35,71,126,.2);
  border-radius: var(--r-md);
  margin-bottom: 20px;
}
.shopopen-public__totals > div { display: flex; flex-direction: column; gap: 3px; text-align: center; }
.shopopen-public__totals label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.shopopen-public__totals strong {
  font-size: 18px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--brand-navy-700, #23477e);
}

/* Customer details form */
.shopopen-public__form h3 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text-primary);
}
.shopopen-public__form .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px 14px;
}
.shopopen-public__form .form-row label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.shopopen-public__form input,
.shopopen-public__form textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-family: inherit;
}
.shopopen-public__form input:focus,
.shopopen-public__form textarea:focus {
  outline: none;
  border-color: var(--brand-gold, #AD9C82);
  box-shadow: 0 0 0 3px rgba(173,156,130,.15);
}

/* Signature pad */
.shopopen-public__sig {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.shopopen-public__sig canvas {
  width: 100%;
  max-width: 600px;
  height: 180px;
  background: #fff;
  border: 2px dashed var(--brand-gold, #AD9C82);
  border-radius: var(--r-md);
  cursor: crosshair;
  touch-action: none;
}

/* Submit button area */
.shopopen-public__foot {
  margin-top: 24px;
  text-align: center;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.shopopen-public__foot .btn--lg {
  padding: 14px 40px;
  font-size: 16px;
  font-weight: 700;
}

@media (max-width: 720px) {
  .shopopen-public-item { grid-template-columns: 70px 1fr; }
  .shopopen-public-item__qty { grid-column: 1 / -1; align-items: stretch; }
  .shopopen-public-item__qty input { width: 100%; }
  .shopopen-public__totals { grid-template-columns: 1fr; }
}

/* ═══ 🍓 GLOBAL COMPLETION TICKER — fruit cartoon banner ═══════════════════ */
/* Fixed at the top of the page (below topbar), visible across ALL pages.
   Slides in when someone (anyone) in the org completes a task. Cycles
   through queued events 5s each. Uses a random fruit theme per banner. */
.completion-ticker {
  position: fixed;
  top: 78px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  z-index: 9500;
  pointer-events: none;
  opacity: 0;
  width: min(560px, 92vw);
  transition: opacity .35s ease, transform .35s cubic-bezier(.34, 1.56, .64, 1);
}
.completion-ticker.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.completion-ticker__banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 70px;
  background: linear-gradient(135deg, var(--fruit-bg, #fef3c7) 0%, #fff 60%, var(--fruit-bg, #fef3c7) 100%);
  border: 2px solid var(--fruit-color, #f97316);
  border-radius: 24px;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.15),
    0 0 0 4px rgba(255, 255, 255, .6),
    inset 0 -2px 0 rgba(0, 0, 0, .04);
  position: relative;
  overflow: visible;
}
/* Tiny upward arrow pointing to topbar — looks like a thought bubble */
.completion-ticker__banner::before {
  content: '';
  position: absolute;
  top: -8px; left: 50px;
  width: 14px; height: 14px;
  background: linear-gradient(135deg, var(--fruit-bg, #fef3c7), #fff);
  border-top: 2px solid var(--fruit-color, #f97316);
  border-left: 2px solid var(--fruit-color, #f97316);
  transform: rotate(45deg);
  border-radius: 3px 0 0 0;
}

/* Big fruit emoji on the left — bouncing cartoon-style */
.completion-ticker__fruit {
  position: absolute;
  left: 8px; top: 50%;
  transform: translateY(-50%);
  width: 54px; height: 54px;
  display: flex; align-items: center; justify-content: center;
  background: var(--fruit-color, #f97316);
  border-radius: 50%;
  box-shadow: 0 4px 12px var(--fruit-color, #f97316), inset 0 -3px 0 rgba(0, 0, 0, .15);
  animation: ticker-fruit-bounce 1.4s ease-in-out infinite;
}
@keyframes ticker-fruit-bounce {
  0%, 100% { transform: translateY(-50%) scale(1) rotate(-5deg); }
  50%      { transform: translateY(-55%) scale(1.08) rotate(5deg); }
}
.completion-ticker__fruit-main {
  font-size: 32px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .25));
}
/* Mini fruit decorations orbiting the main one */
.completion-ticker__fruit-mini {
  position: absolute;
  font-size: 14px;
  opacity: 0;
  animation: ticker-fruit-orbit 2s ease-in-out infinite;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .2));
}
.completion-ticker__fruit-mini--1 {
  top: -8px; right: -6px;
  animation-delay: 0s;
}
.completion-ticker__fruit-mini--2 {
  bottom: -6px; left: -6px;
  animation-delay: .7s;
}
@keyframes ticker-fruit-orbit {
  0%, 100% { opacity: 0; transform: scale(.5) rotate(0deg); }
  30%      { opacity: 1; transform: scale(1.1) rotate(15deg); }
  60%      { opacity: 1; transform: scale(1) rotate(-10deg); }
}

/* Message text */
.completion-ticker__text {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}
.completion-ticker__text strong {
  color: var(--fruit-color, #f97316);
  font-weight: 800;
}
.completion-ticker__text em {
  font-style: italic;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(255, 255, 255, .65);
  padding: 1px 6px;
  border-radius: 6px;
}

/* Dismiss button */
.completion-ticker__close {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border: none;
  background: rgba(0, 0, 0, .06);
  color: var(--text-secondary);
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: all .15s ease;
}
.completion-ticker__close:hover {
  background: var(--fruit-color, #f97316);
  color: #fff;
  transform: scale(1.1);
}

/* Sparkle background — subtle moving shimmer */
.completion-ticker__banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .5) 50%, transparent 70%);
  background-size: 200% 100%;
  border-radius: 24px;
  pointer-events: none;
  animation: ticker-shimmer 2.5s ease-in-out infinite;
}
@keyframes ticker-shimmer {
  0% { background-position: -100% 0; }
  100% { background-position: 100% 0; }
}

/* Responsive */
@media (max-width: 720px) {
  .completion-ticker { top: 64px; }
  .completion-ticker__banner { padding-left: 62px; }
  .completion-ticker__fruit { width: 46px; height: 46px; }
  .completion-ticker__fruit-main { font-size: 26px; }
  .completion-ticker__text { font-size: 12.5px; }
}

/* Inline mini grape icon — drop-in replacement for 🍇 emoji inside text. */
.grapezy-inline-icon {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  vertical-align: -3px;
  margin: 0 1px;
  filter: drop-shadow(0 1px 1px rgba(124, 58, 237, 0.18));
}

/* ═══ 🍇 GRAPEZY animated SVG character ══════════════════════════════════ */
/* Drop-in replacement for the 🍇 emoji used in avatar circles. Self-sizes
   to fill its parent. Idle bob + blink animations are always on; mood
   classes (set by startGrapezyMoodCycle in app.js) swap face elements. */
.grapezy-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  animation: grapezy-bob 2.6s ease-in-out infinite;
  transform-origin: center bottom;
  filter: drop-shadow(0 2px 4px rgba(124, 58, 237, 0.15));
}

/* Real PNG image variant — uses the same bob animation so the character feels alive.
   Container should have border-radius:50% if you want it clipped to a circle. */
.grapezy-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  animation: grapezy-bob 2.6s ease-in-out infinite;
  transform-origin: center bottom;
  filter: drop-shadow(0 2px 4px rgba(124, 58, 237, 0.18));
  user-select: none;
  -webkit-user-drag: none;
}
@keyframes grapezy-bob {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50%      { transform: translateY(-2px) rotate(1.5deg); }
}

/* Leaf wiggle — subtle independent motion */
.grapezy-leaf-group {
  transform-origin: 60px 22px;
  animation: grapezy-leaf-wiggle 3.2s ease-in-out infinite;
}
@keyframes grapezy-leaf-wiggle {
  0%, 100% { transform: rotate(-3deg); }
  50%      { transform: rotate(3deg); }
}

/* Right arm waving — greeting motion */
.grapezy-arm--right {
  transform-origin: 108px 50px;
  animation: grapezy-wave 1.8s ease-in-out infinite;
}
@keyframes grapezy-wave {
  0%, 100% { transform: rotate(-8deg); }
  50%      { transform: rotate(10deg); }
}

/* Left arm small sway */
.grapezy-arm--left {
  transform-origin: 11px 74px;
  animation: grapezy-sway-arm 2.6s ease-in-out infinite;
}
@keyframes grapezy-sway-arm {
  0%, 100% { transform: rotate(4deg); }
  50%      { transform: rotate(-4deg); }
}

/* Tiny sparkles twinkle around the character */
.grapezy-sparkles {
  animation: grapezy-twinkle 1.6s ease-in-out infinite;
  transform-origin: center;
}
@keyframes grapezy-twinkle {
  0%, 100% { opacity: .25; transform: scale(.85); }
  50%      { opacity: 1;   transform: scale(1.15); }
}

/* Feet tiny step bounce */
.grapezy-feet {
  animation: grapezy-feet-step 2.6s ease-in-out infinite;
  transform-origin: center bottom;
}
@keyframes grapezy-feet-step {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-1px); }
}

/* Blink — both eyes every 4s */
.grapezy-eye {
  transform-origin: center;
  animation: grapezy-blink 4s ease-in-out infinite;
}
@keyframes grapezy-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95%, 97%      { transform: scaleY(.1); }
}

/* Cheek subtle pulse */
.grapezy-cheek {
  animation: grapezy-cheek-pulse 3s ease-in-out infinite;
}
@keyframes grapezy-cheek-pulse {
  0%, 100% { opacity: .55; }
  50%      { opacity: .8; }
}

/* ─── Mood variants ─────────────────────────────────────────────────────── */

/* WINK — right eye closes (full mouth shape kept) */
.grapezy-mood--wink .grapezy-eye--right {
  animation: grapezy-wink-hold 1.4s ease-out forwards;
}
@keyframes grapezy-wink-hold {
  0% { transform: scaleY(1); }
  20%, 100% { transform: scaleY(.1); }
}

/* EXCITED — eyes squint into joyful arches + slight scale */
.grapezy-mood--excited .grapezy-eye ellipse { transform: scaleY(.55); transform-origin: center; }
.grapezy-mood--excited .grapezy-mouth { transform: scale(1.3); transform-origin: center; }

/* SLEEPY — both eyes close to slits */
.grapezy-mood--sleepy .grapezy-eye {
  animation: none;
  transform: scaleY(.12);
  transform-origin: center;
}

/* ANGRY — eyes narrow + mouth shifts */
.grapezy-mood--angry .grapezy-eye ellipse { transform: scaleY(.7) scaleX(.9); transform-origin: center; }
.grapezy-mood--angry .grapezy-cheek { opacity: .15; }

/* CONFUSED — head tilts back & forth */
.grapezy-mood--confused {
  animation: grapezy-tilt 1.4s ease-in-out infinite;
}
@keyframes grapezy-tilt {
  0%, 100% { transform: rotate(-6deg); }
  50%      { transform: rotate(6deg); }
}

/* LOVE — extra bounce */
.grapezy-mood--love {
  animation: grapezy-love-bounce 1.4s ease-in-out infinite;
}
@keyframes grapezy-love-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-3px) scale(1.05); }
}

/* Avatar containers — circular frame holding the SVG character. Container
   clips with border-radius + overflow:hidden. SVG fills 100% of the box,
   preserveAspectRatio centers it. Background is a soft purple gradient so
   the cluster sits on a complementary tone. */
.xb-widget__avatar,
.xb-login-popup__avatar,
.xiaobai-avatar {
  background: radial-gradient(circle at 35% 28%, #fdf4ff 0%, #fae8ff 55%, #f3e8ff 100%) !important;
  overflow: hidden !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  position: relative;
}
.xb-widget__avatar svg.grapezy-svg,
.xb-login-popup__avatar svg.grapezy-svg,
.xiaobai-avatar svg.grapezy-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Avatar sizes — keep emoji fallback the same size as SVG */
.xb-widget__bubble .xb-widget__avatar { width: 54px; height: 54px; font-size: 32px; }
.xb-widget__head .xb-widget__avatar  { width: 36px; height: 36px; font-size: 20px; }
.xb-login-popup__avatar { width: 64px; height: 64px; font-size: 36px; }
.xiaobai-avatar { width: 38px; height: 38px; font-size: 22px; }
.xiaobai-avatar--sm { width: 26px; height: 26px; font-size: 14px; }
.xiaobai-avatar--xs { width: 24px; height: 24px; font-size: 13px; }

/* ═══ 🎉 CELEBRATION POPUP — fires when an urgent task is completed ════════ */
/* Modern teen vibe: gradient card, animated fruit-tea cup, confetti burst,
   sparkles. Brand-themed for JianCha (simplified illustration of a tea cup
   built entirely in CSS — no images needed). */
.celebrate-popup {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.celebrate-popup.is-open { opacity: 1; pointer-events: auto; }
.celebrate-popup.is-closing { opacity: 0; }
.celebrate-popup__overlay {
  position: absolute; inset: 0;
  background: radial-gradient(circle at center, rgba(255, 200, 100, .25), rgba(20, 20, 30, .55));
  backdrop-filter: blur(8px);
}

.celebrate-popup__card {
  position: relative;
  width: min(420px, 92vw);
  padding: 32px 28px 24px;
  background: linear-gradient(155deg, #fff 0%, #fff8eb 55%, #ffeed1 100%);
  border-radius: 28px;
  box-shadow:
    0 30px 80px rgba(0,0,0,.35),
    0 0 0 1px rgba(255,200,100,.35),
    inset 0 1px 0 rgba(255,255,255,.6);
  text-align: center;
  overflow: hidden;
  transform: translateY(40px) scale(.85) rotate(-2deg);
  transition: transform .5s cubic-bezier(.34, 1.56, .64, 1);
}
.celebrate-popup.is-open .celebrate-popup__card { transform: translateY(0) scale(1) rotate(0); }

/* Decorative gradient ring around card */
.celebrate-popup__card::before {
  content: '';
  position: absolute; inset: -2px;
  background: linear-gradient(135deg, #f97316, #ec4899, #a855f7, #3b82f6, #10b981, #fbbf24);
  border-radius: 28px;
  z-index: -1;
  opacity: .4;
  filter: blur(8px);
  animation: celebrate-rotate-bg 4s linear infinite;
}
@keyframes celebrate-rotate-bg {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ─── Confetti burst behind the cup ─── */
.celebrate-popup__confetti {
  position: absolute; inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.celebrate-confetti-bit {
  position: absolute;
  top: -15px;
  width: 8px; height: 12px;
  border-radius: 2px;
  opacity: 0;
  animation: celebrate-fall 2s ease-out forwards;
}
@keyframes celebrate-fall {
  0%   { opacity: 0; transform: translateY(-20px) rotate(0deg) scale(.5); }
  10%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(380px) rotate(720deg) scale(1); }
}

/* ─── Grape-character variant (PNG) — replaces the CSS cup with Grapezy
   sipping boba. Animations: rocking head while sipping + sparkle eyes ─── */
.celebrate-popup__drink--grape {
  width: 140px;
  height: 140px;
  position: relative;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.celebrate-popup__grape-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 6px 16px rgba(124,58,237,0.25));
}
.celebrate-popup__grape-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  animation: celebrate-grape-sip 1.6s ease-in-out infinite;
  transform-origin: 50% 85%;
  user-select: none;
  -webkit-user-drag: none;
}
@keyframes celebrate-grape-sip {
  0%, 100% { transform: rotate(-3deg) translateY(0); }
  35%      { transform: rotate(2deg)  translateY(-2px); }
  60%      { transform: rotate(-1deg) translateY(-3px) scaleY(0.985); } /* slight squeeze = mid-sip */
  80%      { transform: rotate(2deg)  translateY(-1px); }
}
/* Rising bubbles inside the straw — appear at bottom, float up + fade */
.celebrate-popup__sip-bubbles {
  position: absolute;
  left: 41%; bottom: 28%;
  width: 6px; height: 30px;
  pointer-events: none;
}
.celebrate-popup__sip-bubbles span {
  position: absolute;
  bottom: 0; left: 0;
  width: 5px; height: 5px;
  background: #fff;
  border-radius: 50%;
  opacity: 0;
  box-shadow: 0 0 4px rgba(255,255,255,0.8);
  animation: celebrate-sip-bubble 1.4s ease-in infinite;
}
.celebrate-popup__sip-bubbles span:nth-child(1) { animation-delay: 0s;    }
.celebrate-popup__sip-bubbles span:nth-child(2) { animation-delay: 0.35s; }
.celebrate-popup__sip-bubbles span:nth-child(3) { animation-delay: 0.70s; }
.celebrate-popup__sip-bubbles span:nth-child(4) { animation-delay: 1.05s; }
@keyframes celebrate-sip-bubble {
  0%   { opacity: 0; transform: translateY(0)     scale(0.5); }
  20%  { opacity: 1; transform: translateY(-6px)  scale(1); }
  100% { opacity: 0; transform: translateY(-26px) scale(0.4); }
}
/* Eye sparkles — twinkle overlay positioned approximately on the grape's eyes */
.celebrate-popup__eye-sparkle {
  position: absolute;
  font-size: 14px;
  pointer-events: none;
  animation: celebrate-eye-twinkle 1.8s ease-in-out infinite;
  text-shadow: 0 0 8px rgba(255,248,176,0.9);
}
.celebrate-popup__eye-sparkle--l { left: 32%; top: 38%; animation-delay: 0s;   }
.celebrate-popup__eye-sparkle--r { left: 56%; top: 36%; animation-delay: 0.4s; }
@keyframes celebrate-eye-twinkle {
  0%, 100% { opacity: 0; transform: scale(0.3) rotate(-20deg); }
  40%      { opacity: 1; transform: scale(1.2) rotate(15deg);  }
  60%      { opacity: 1; transform: scale(1)   rotate(-5deg);  }
}

/* ─── Fruit-tea cup illustration (pure CSS, no image) — kept for back-compat ─── */
.celebrate-popup__drink {
  position: relative;
  width: 110px;
  margin: 0 auto 16px;
  height: 130px;
}
.celebrate-popup__cup {
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 90px; height: 110px;
  background: linear-gradient(180deg, rgba(255,255,255,.45) 0%, rgba(255,255,255,.15) 50%);
  border: 3px solid #fff;
  border-top: none;
  border-radius: 8px 8px 26px 26px;
  box-shadow: 0 8px 20px rgba(0,0,0,.15), inset -8px 0 12px rgba(0,0,0,.06);
  overflow: hidden;
  animation: celebrate-cup-bob 2.5s ease-in-out infinite;
}
@keyframes celebrate-cup-bob {
  0%, 100% { transform: translateX(-50%) translateY(0) rotate(-2deg); }
  50%      { transform: translateX(-50%) translateY(-4px) rotate(2deg); }
}
.celebrate-popup__liquid {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 78%;
  background: linear-gradient(180deg,
    #fb923c 0%,    /* orange top */
    #f97316 30%,
    #ea580c 60%,
    #c2410c 100%); /* deeper orange bottom */
  border-radius: 0 0 24px 24px;
}
/* Wavy top of liquid */
.celebrate-popup__liquid::before {
  content: '';
  position: absolute; top: -6px; left: -2px; right: -2px;
  height: 12px;
  background: radial-gradient(ellipse at center top, #fbbf24 0%, #fb923c 60%);
  border-radius: 50%;
  animation: celebrate-liquid-wave 2s ease-in-out infinite alternate;
}
@keyframes celebrate-liquid-wave {
  from { transform: translateX(-3px); }
  to   { transform: translateX(3px); }
}
/* Bubbles rising in the drink */
.celebrate-popup__bubbles {
  position: absolute; inset: 0;
  pointer-events: none;
}
.celebrate-popup__bubbles span {
  position: absolute;
  bottom: 8px;
  width: 8px; height: 8px;
  background: rgba(255,255,255,.65);
  border-radius: 50%;
  animation: celebrate-bubble 2.5s ease-in infinite;
}
.celebrate-popup__bubbles span:nth-child(1) { left: 15%; animation-delay: 0s;   width: 6px; height: 6px; }
.celebrate-popup__bubbles span:nth-child(2) { left: 40%; animation-delay: .5s;  width: 10px; height: 10px; }
.celebrate-popup__bubbles span:nth-child(3) { left: 60%; animation-delay: 1s;   width: 7px; height: 7px; }
.celebrate-popup__bubbles span:nth-child(4) { left: 78%; animation-delay: 1.5s; width: 5px; height: 5px; }
.celebrate-popup__bubbles span:nth-child(5) { left: 28%; animation-delay: 2s;   width: 9px; height: 9px; }
@keyframes celebrate-bubble {
  0%   { transform: translateY(0); opacity: 0; }
  10%  { opacity: .9; }
  100% { transform: translateY(-80px); opacity: 0; }
}
/* Straw poking out the top */
.celebrate-popup__straw {
  position: absolute;
  top: -16px; left: 58%;
  width: 8px; height: 60px;
  background: linear-gradient(180deg, #ec4899 0%, #ec4899 50%, #fff 50%, #fff 60%, #ec4899 60%, #ec4899 100%);
  background-size: 100% 14px;
  border-radius: 2px;
  transform: rotate(12deg);
  z-index: 2;
}
/* Lemon slice + leaves garnish */
.celebrate-popup__lemon {
  position: absolute;
  top: -8px; left: -10px;
  font-size: 28px;
  transform: rotate(-15deg);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.2));
  animation: celebrate-garnish 3s ease-in-out infinite;
  z-index: 3;
}
.celebrate-popup__leaves {
  position: absolute;
  top: -14px; left: 32%;
  font-size: 20px;
  transform: rotate(20deg);
  z-index: 3;
  animation: celebrate-garnish 3s ease-in-out infinite reverse;
}
@keyframes celebrate-garnish {
  0%, 100% { transform: rotate(-15deg) translateY(0); }
  50%      { transform: rotate(-5deg) translateY(-3px); }
}
/* Sparkles floating around the cup */
.celebrate-popup__sparkles {
  position: absolute; inset: 0;
  pointer-events: none;
}
.celebrate-popup__sparkles span {
  position: absolute;
  font-size: 18px;
  animation: celebrate-sparkle 2.4s ease-in-out infinite;
  opacity: 0;
}
.celebrate-popup__sparkles span:nth-child(1) { top: 10%;  left: -5%;  animation-delay: 0s;   }
.celebrate-popup__sparkles span:nth-child(2) { top: 30%;  right: -5%; animation-delay: .6s;  font-size: 22px; }
.celebrate-popup__sparkles span:nth-child(3) { top: 70%;  left: -8%;  animation-delay: 1.2s; }
.celebrate-popup__sparkles span:nth-child(4) { top: 55%;  right: -10%; animation-delay: 1.8s; font-size: 16px; }
@keyframes celebrate-sparkle {
  0%, 100% { opacity: 0; transform: scale(.5) rotate(0deg); }
  50%      { opacity: 1; transform: scale(1.2) rotate(20deg); }
}

/* ─── Text content ─── */
.celebrate-popup__title {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, #f97316, #ec4899, #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: celebrate-title-pop .6s cubic-bezier(.34, 1.56, .64, 1) .3s both;
}
@keyframes celebrate-title-pop {
  from { transform: scale(.5); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.celebrate-popup__body {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.7;
  color: #4b3a1f;
  font-weight: 500;
}
.celebrate-popup__body strong {
  color: #c2410c;
  font-weight: 800;
  background: linear-gradient(90deg, transparent 0%, rgba(251,191,36,.4) 50%, transparent 100%);
  padding: 1px 4px;
  border-radius: 4px;
}
.celebrate-popup__task {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-family: 'JetBrains Mono', monospace;
  background: rgba(0,0,0,.04);
  padding: 4px 10px;
  border-radius: 99px;
  display: inline-block;
}
.celebrate-popup__btn {
  margin-top: 4px;
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 700;
  background: linear-gradient(135deg, #f97316, #ec4899);
  border: none;
  border-radius: 99px;
  color: #fff;
  box-shadow: 0 4px 14px rgba(236, 72, 153, .35);
  transition: transform .15s ease, box-shadow .15s ease;
}
.celebrate-popup__btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 18px rgba(236, 72, 153, .45);
}
.celebrate-popup__brand {
  margin-top: 14px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .15em;
  color: var(--text-secondary);
  text-transform: uppercase;
  opacity: .7;
}

/* ═══ XIAOBAI · 小白 — login popup, floating widget, settings ═════════════ */

/* ── Login popup — centered with burst animation ──────────────────────── */
.xb-login-popup {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease;
}
.xb-login-popup.is-open { opacity: 1; pointer-events: auto; }
.xb-login-popup__overlay {
  position: absolute; inset: 0;
  background: rgba(20, 20, 30, 0.55);
  backdrop-filter: blur(6px);
}
.xb-login-popup__card {
  position: relative;
  width: min(560px, 90vw);
  max-height: 86vh;
  background: linear-gradient(180deg, #fff 0%, #faf7f0 100%);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,.35), 0 0 0 1px rgba(173,156,130,.3);
  overflow: hidden;
  display: flex; flex-direction: column;
  transform: translateY(20px) scale(.95);
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
}
.xb-login-popup.is-open .xb-login-popup__card { transform: translateY(0) scale(1); }
/* Decorative burst ring behind the avatar */
.xb-login-popup__burst {
  position: absolute; top: -60px; left: 50%; transform: translateX(-50%);
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(173,156,130,.25) 0%, transparent 60%);
  border-radius: 50%;
  pointer-events: none;
}
.xb-login-popup__head {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 24px 24px 12px;
}
.xb-login-popup__avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fff, #faf0e0);
  border: 3px solid var(--brand-gold, #AD9C82);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(173,156,130,.4);
  animation: xb-bounce 1.2s ease-out;
}
@keyframes xb-bounce {
  0%   { transform: scale(0) rotate(-180deg); opacity: 0; }
  60%  { transform: scale(1.1) rotate(10deg); opacity: 1; }
  80%  { transform: scale(.95) rotate(-5deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.xb-login-popup__head h2 { margin: 0; font-size: 22px; line-height: 1.2; color: var(--text-primary); }
.xb-login-popup__head small { color: var(--text-secondary); font-size: 12px; }
.xb-login-popup__head .icon-btn { margin-left: auto; flex-shrink: 0; }

.xb-login-popup__body {
  flex: 1; overflow-y: auto;
  padding: 8px 24px 20px;
}
.xb-popup-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin: 8px 0 18px;
}
.xb-popup-stat {
  text-align: center;
  padding: 12px 6px;
  background: var(--bg-base, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: transform .2s ease;
}
.xb-popup-stat:hover { transform: translateY(-2px); }
.xb-popup-stat strong { display: block; font-size: 24px; font-weight: 800; color: var(--text-primary); font-family: 'JetBrains Mono', monospace; }
.xb-popup-stat small  { font-size: 10px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.xb-popup-stat.is-red    { background: rgba(220,38,38,.06); border-color: rgba(220,38,38,.3); }
.xb-popup-stat.is-red strong { color: #dc2626; }
.xb-popup-stat.is-gold   { background: rgba(173,156,130,.08); border-color: rgba(173,156,130,.4); }
.xb-popup-stat.is-gold strong { color: var(--brand-gold-dark, #7a6638); }

.xb-popup-section { margin-bottom: 14px; }
.xb-popup-section h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-secondary); margin: 0 0 6px; font-weight: 700;
}
.xb-popup-section ul { list-style: none; padding: 0; margin: 0; }
.xb-popup-section li {
  padding: 8px 12px;
  background: var(--bg-base, #fff);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand-gold, #AD9C82);
  border-radius: var(--r-sm);
  margin-bottom: 5px;
  font-size: 12.5px;
}
.xb-popup-section--urgent li { border-left-color: #dc2626; background: rgba(220,38,38,.03); }
.xb-popup-section li.more { font-style: italic; color: var(--text-secondary); border-left-color: transparent; background: transparent; }
.xb-popup-section li.blink { animation: tasks-blink 1.4s ease-in-out infinite; }
.xb-popup-empty {
  text-align: center; padding: 24px 12px;
  color: var(--text-secondary); font-size: 14px; font-style: italic;
}
.xb-popup-encourage {
  text-align: center; padding: 12px;
  background: linear-gradient(135deg, rgba(173,156,130,.10), rgba(35,71,126,.06));
  border-radius: var(--r-md);
  font-size: 13px; color: var(--text-primary); font-weight: 500;
  margin-top: 10px;
}
.xb-login-popup__foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: rgba(173,156,130,.04);
}

/* ── Floating widget — corner bubble + expandable mini chat ────────────── */
.xb-widget {
  position: fixed; z-index: 8500;
  font-family: inherit;
}
.xb-widget--bl { bottom: 20px; left: 20px; }
.xb-widget--br { bottom: 20px; right: 20px; }
.xb-widget__bubble {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #fff, #faf0e0);
  border: 3px solid var(--brand-gold, #AD9C82);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  position: relative;
  transition: all .2s ease;
}
.xb-widget__bubble:hover {
  transform: scale(1.08) rotate(-5deg);
  box-shadow: 0 10px 28px rgba(0,0,0,.25);
}
.xb-widget__avatar { font-size: inherit; }
.xb-widget__badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 22px; height: 22px; padding: 0 6px;
  background: #dc2626; color: #fff;
  border-radius: 99px;
  font-size: 11px; font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  animation: tasks-blink 1.4s ease-in-out infinite;
}
/* Mini chat panel */
.xb-widget__panel {
  position: absolute;
  bottom: 76px;
  width: 340px; max-width: 90vw;
  height: 460px; max-height: 70vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: xb-panel-in .22s cubic-bezier(.34,1.56,.64,1);
}
/* IMPORTANT — explicit display: flex overrides [hidden] from the UA stylesheet,
   so we re-assert hidden = none here. Same for the badge. */
.xb-widget__panel[hidden],
.xb-widget__badge[hidden],
.xb-widget[hidden] { display: none !important; }
/* When the widget is collapsed (panel closed), make sure the panel really is hidden */
.xb-widget--collapsed .xb-widget__panel { display: none; }
.xb-widget--bl .xb-widget__panel { left: 0; }
.xb-widget--br .xb-widget__panel { right: 0; }
@keyframes xb-panel-in {
  from { transform: translateY(20px) scale(.9); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.xb-widget__head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(173,156,130,.12), rgba(35,71,126,.06));
  border-bottom: 1px solid var(--border);
}
.xb-widget__head-title {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 10px;
}
.xb-widget__head-title .xb-widget__avatar {
  width: 36px; height: 36px;
  font-size: 22px;
  border-width: 2px;
  background: linear-gradient(135deg, #fff, #faf0e0);
  border: 2px solid var(--brand-gold, #AD9C82);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(173,156,130,.25);
}
.xb-widget__head-title strong { font-size: 14px; }
.xb-widget__body {
  flex: 1; overflow-y: auto;
  padding: 12px;
  background: var(--bg-subtle, #faf7f0);
  display: flex; flex-direction: column; gap: 8px;
}
.xb-widget__body .xiaobai-bubble { font-size: 12px; padding: 6px 10px; }
.xb-widget__chips {
  display: flex; gap: 5px; flex-wrap: wrap;
  padding: 8px 12px;
  background: #fff;
  border-top: 1px solid var(--border);
}
.xb-widget__input {
  display: flex; gap: 6px;
  padding: 8px 12px 12px;
  background: #fff;
}
.xb-widget__input input {
  flex: 1; min-width: 0;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--bg-subtle, #faf7f0);
  font-size: 12px;
}
.xb-widget__input input:focus {
  outline: none;
  border-color: var(--brand-gold, #AD9C82);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(173,156,130,.15);
}
.xb-widget__input button {
  width: 32px; height: 32px; padding: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ── Settings: Xiaobai integrations page styles ─────────────────────────── */
.xb-set-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  padding: 14px 20px 20px;
}
@media (max-width: 720px) { .xb-set-grid { grid-template-columns: 1fr; } }
.xb-set-grid .form-row { display: flex; flex-direction: column; gap: 5px; }
.xb-set-grid .form-row label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.xb-set-grid input, .xb-set-grid select, .xb-set-grid textarea {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-base, #fff); font-size: 13px; font-family: inherit;
}
.xb-set-status {
  font-size: 11px; font-weight: 700; padding: 3px 9px;
  border-radius: 99px;
  background: rgba(0,0,0,.05); color: var(--text-secondary);
}
.xb-set-status.is-on { background: rgba(22,163,74,.15); color: #15803d; }

.xb-auto-task-list { padding: 12px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.xb-auto-empty {
  text-align: center; padding: 30px 16px;
  background: var(--bg-subtle, #faf7f0);
  border: 1px dashed var(--border); border-radius: var(--r-md);
  color: var(--text-secondary);
}
.xb-auto-empty strong { display: block; font-size: 14px; color: var(--text-primary); margin-bottom: 4px; }
.xb-auto-empty p { margin: 0; font-size: 12px; font-style: italic; }
.xb-auto-item {
  padding: 12px 14px;
  background: var(--bg-base, #fff);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-gold, #AD9C82);
  border-radius: var(--r-md);
}
.xb-auto-item__head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.xb-auto-item__head strong { flex: 1; min-width: 0; font-size: 13px; }
.xb-auto-item p { margin: 0; font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.xb-auto-chip {
  font-size: 10px; font-weight: 700; padding: 3px 8px;
  border-radius: 99px;
  background: rgba(173,156,130,.15);
  color: var(--brand-gold-dark, #7a6638);
}

/* Wide variant of the urgent panel — used when it sits below the calendar */
.tasks-urgent-card--wide { margin-bottom: 16px; }
.tasks-urgent-list--wide {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
  padding: 12px 16px 16px;
  max-height: none;
}
.tasks-urgent-list--wide .tasks-urgent-empty { grid-column: 1 / -1; }

/* ═══ XIAOBAI · 小白 AI CHAT PANEL ════════════════════════════════════════ */
.tasks-xiaobai-card {
  display: flex;
  flex-direction: column;
  min-height: 540px;
  max-height: 720px;
  overflow: hidden;
}
.xiaobai-head {
  padding: 12px 16px !important;
  background: linear-gradient(135deg, rgba(173,156,130,.10), rgba(35,71,126,.06));
  border-bottom: 1px solid var(--border);
}
.xiaobai-head__title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.xiaobai-head h3 {
  font-size: 16px !important;
  margin: 0;
  line-height: 1.2;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.xiaobai-cn {
  font-size: 14px;
  color: var(--brand-gold-dark, #7a6638);
  font-weight: 600;
  font-family: 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
}
.xiaobai-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.xiaobai-dot {
  display: inline-block;
  width: 7px; height: 7px;
  background: #16a34a;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(22,163,74,.2);
  animation: xiaobai-pulse 2s ease-in-out infinite;
}
@keyframes xiaobai-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 2px rgba(22,163,74,.2); }
  50%      { opacity: .7; box-shadow: 0 0 0 4px rgba(22,163,74,.1); }
}

/* Round mascot avatar — friendly + cute */
.xiaobai-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fff, #faf0e0);
  border: 2px solid var(--brand-gold, #AD9C82);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(173,156,130,.25);
}
.xiaobai-avatar--sm {
  width: 26px; height: 26px;
  font-size: 14px;
  border-width: 1.5px;
  box-shadow: 0 1px 3px rgba(173,156,130,.2);
}

/* Chat message list — scrolls */
.xiaobai-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-subtle, #faf7f0);
}

/* Auto-generated insight banner at the top of the chat */
.xiaobai-insight {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(220,38,38,.06);
  border: 1px dashed rgba(220,38,38,.3);
  border-radius: var(--r-md);
  margin-bottom: 4px;
}
.xiaobai-insight--good {
  background: rgba(22,163,74,.06);
  border-color: rgba(22,163,74,.3);
  font-size: 12px;
  color: #15803d;
  font-weight: 600;
}
.xiaobai-stat {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--bg-base, #fff);
}
.xiaobai-stat--red  { color: #dc2626; border: 1px solid rgba(220,38,38,.4); }
.xiaobai-stat--gold { color: var(--brand-gold-dark, #7a6638); border: 1px solid var(--brand-gold, #AD9C82); }

/* Individual chat messages */
.xiaobai-msg {
  display: flex;
  gap: 8px;
  max-width: 100%;
}
.xiaobai-msg--user {
  justify-content: flex-end;
}
.xiaobai-msg--bot {
  justify-content: flex-start;
  align-items: flex-end;
}
.xiaobai-bubble {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 12.5px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.xiaobai-msg--bot .xiaobai-bubble {
  background: var(--bg-base, #fff);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: 11.5px;
}
.xiaobai-msg--user .xiaobai-bubble {
  background: linear-gradient(135deg, var(--brand-gold, #AD9C82), #8a7a5e);
  color: #fff;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

/* Typing indicator — 3 bouncing dots while Xiaobai is "thinking" */
.xb-typing {
  display: inline-flex !important;
  gap: 4px;
  padding: 10px 14px !important;
  background: #fff !important;
  border: 1px solid var(--border) !important;
}
.xb-typing span {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand-gold, #AD9C82);
  animation: xb-typing-bounce 1.2s ease-in-out infinite;
}
.xb-typing span:nth-child(2) { animation-delay: 0.15s; }
.xb-typing span:nth-child(3) { animation-delay: 0.30s; }
@keyframes xb-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* Quick-action chips */
.xiaobai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 10px 14px 4px;
  border-top: 1px solid var(--border);
  background: var(--bg-base, #fff);
}
.xiaobai-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  background: var(--bg-subtle, #faf7f0);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: all .12s ease;
  white-space: nowrap;
}
.xiaobai-chip:hover {
  background: var(--brand-gold, #AD9C82);
  color: #fff;
  border-color: var(--brand-gold, #AD9C82);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

/* Chat input bar */
.xiaobai-input {
  display: flex;
  gap: 8px;
  padding: 10px 14px 14px;
  background: var(--bg-base, #fff);
  border-top: 1px solid var(--border);
}
.xiaobai-input input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--bg-subtle, #faf7f0);
  font-size: 12px;
  font-family: inherit;
  color: var(--text-primary);
  transition: all .12s ease;
}
.xiaobai-input input:focus {
  outline: none;
  border-color: var(--brand-gold, #AD9C82);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(173,156,130,.15);
}
.xiaobai-input input::placeholder {
  color: var(--text-secondary);
  font-style: italic;
}
.xiaobai-input button {
  flex-shrink: 0;
  width: 34px; height: 34px;
  padding: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ═══ PERF TASK TABLE — CARD-STYLE 3-ROW LAYOUT ═════════════════════════ */
/* Each task is its own <tbody class="perf-task-card"> containing 3 rows:
     • title (full width, prominent)
     • meta strip (all fields in a clean grid)
     • notes (full width)
   The card has a status-coloured left accent and gentle shadow. Title and
   Notes use auto-growing <textarea> so multi-line text stays visible. */
.perf-task-table--cards {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  width: 100%;
  background: transparent;
}
/* Section heading above the cards */
.perf-task-table--cards thead .perf-task-thead {
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(173,156,130,.08), rgba(173,156,130,.02));
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 700;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.perf-task-thead__icon { font-size: 14px; }
.perf-task-thead__text { letter-spacing: .02em; }

.perf-task-empty {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-secondary);
  font-size: 13px;
  font-style: italic;
  background: var(--bg-subtle, #faf7f0);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
}

/* ── Card container (one <tbody> per task) ─────────────────────────────── */
.perf-task-card {
  /* tbody is a row-group; we visually treat the 3 child rows as one card. */
  display: table-row-group;
}
.perf-task-table--cards .perf-task-card-row--title td,
.perf-task-table--cards .perf-task-card-row--meta td,
.perf-task-table--cards .perf-task-card-row--notes td {
  padding: 0;
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-left-style: solid;
}
/* Status-driven accent colour on the left border */
.perf-task-card--progress .perf-task-card-row td { border-left-color: var(--brand-gold, #AD9C82); }
.perf-task-card--overdue  .perf-task-card-row td { border-left-color: #dc2626; }
.perf-task-card--late     .perf-task-card-row td { border-left-color: #d97706; }
.perf-task-card--done     .perf-task-card-row td { border-left-color: #16a34a; }

/* Stack the 3 rows into a single visual card with rounded top/bottom */
.perf-task-card-row--title td {
  border-bottom: none;
  border-top-left-radius: var(--r-md);
  border-top-right-radius: var(--r-md);
  padding: 14px 18px 10px !important;
}
.perf-task-card-row--meta td {
  border-bottom: none;
  border-top: none;
  padding: 6px 18px 10px !important;
}
.perf-task-card-row--notes td {
  border-top: none;
  border-bottom-left-radius: var(--r-md);
  border-bottom-right-radius: var(--r-md);
  padding: 8px 18px 14px !important;
}
/* Space between consecutive cards — extra padding-top on title row of card 2+ */
.perf-task-card + .perf-task-card .perf-task-card-row--title td {
  padding-top: 26px !important;
}

/* Gentle hover lift — the whole card brightens */
.perf-task-card:hover .perf-task-card-row td {
  background: linear-gradient(0deg, rgba(173,156,130,.04), rgba(173,156,130,.04)), var(--card-bg, #fff);
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

/* ── Row 1: Title ──────────────────────────────────────────────────────── */
.perf-task-card-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: nowrap;
}
.perf-task-card-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(0,0,0,.05);
  padding: 5px 8px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
  letter-spacing: .03em;
}
.perf-task-title-input {
  flex: 1;
  min-width: 0;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  resize: none;
  overflow: hidden;
  font-family: inherit;
  transition: all .15s ease;
}
.perf-task-title-input::placeholder { color: var(--text-secondary); font-weight: 400; font-style: italic; }
.perf-task-title-input:hover { background: rgba(0,0,0,.025); }
.perf-task-title-input:focus {
  outline: none;
  background: var(--bg-base, #fff);
  border-color: var(--brand-gold, #AD9C82);
  box-shadow: 0 0 0 3px rgba(173,156,130,.15);
}
.perf-task-card-status {
  flex-shrink: 0;
  align-self: center;
  font-size: 11px;
  padding: 4px 10px;
  white-space: nowrap;
  /* Lock pill width so all 4 statuses ('On time' / 'Late' / 'Overdue' /
     'In progress') render at the same footprint — otherwise the chip
     and buttons after this pill shift left/right per row. */
  min-width: 110px;
  text-align: center;
  margin-left: auto;
}
.perf-task-card-delete {
  flex-shrink: 0;
  align-self: center;
  opacity: .4;
  transition: opacity .15s ease;
}
.perf-task-card-adjust {
  flex-shrink: 0;
  align-self: center;
}
.perf-task-card:hover .perf-task-card-delete { opacity: 1; }

/* ── Row 2: Meta grid ──────────────────────────────────────────────────── */
.perf-task-card-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 14px;
  align-items: end;
}
.perf-task-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.perf-task-field__label {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}
.perf-task-field__input,
.perf-task-field input[type="date"] {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-base, #fff);
  font-size: 12px;
  font-family: inherit;
  color: var(--text-primary);
  width: 100%;
  box-sizing: border-box;
  transition: all .12s ease;
}
.perf-task-field input[type="date"] {
  font-family: 'JetBrains Mono', monospace;
}
.perf-task-field__input:hover,
.perf-task-field input[type="date"]:hover {
  border-color: rgba(173,156,130,.5);
}
.perf-task-field__input:focus,
.perf-task-field input[type="date"]:focus {
  outline: none;
  border-color: var(--brand-gold, #AD9C82);
  box-shadow: 0 0 0 2px rgba(173,156,130,.15);
}
.perf-task-field__readonly {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  background: rgba(0,0,0,.03);
  border: 1px dashed rgba(0,0,0,.08);
  border-radius: var(--r-sm);
}
/* Highlight the Due Date — it's the most important field */
.perf-task-field--highlight input[type="date"] {
  font-weight: 700;
  color: var(--brand-navy-700, #23477e);
  background: rgba(35,71,126,.04);
  border-color: rgba(35,71,126,.25);
}
.perf-task-field--highlight .perf-task-field__label {
  color: var(--brand-navy-700, #23477e);
}

/* ── Row 3: Notes ──────────────────────────────────────────────────────── */
.perf-task-notes {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(0,0,0,.02);
  border: 1px solid rgba(0,0,0,.05);
  border-radius: var(--r-sm);
  padding: 8px 12px;
}
.perf-task-notes__label {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  padding-top: 6px;
  min-width: 60px;
}
.perf-task-notes__input {
  flex: 1;
  min-width: 0;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  font-size: 12px;
  font-family: inherit;
  line-height: 1.45;
  color: var(--text-primary);
  resize: none;
  overflow: hidden;
  transition: all .12s ease;
}
.perf-task-notes__input::placeholder { color: var(--text-secondary); font-style: italic; }
.perf-task-notes__input:hover { background: rgba(255,255,255,.5); }
.perf-task-notes__input:focus {
  outline: none;
  background: var(--bg-base, #fff);
  border-color: var(--brand-gold, #AD9C82);
  box-shadow: 0 0 0 2px rgba(173,156,130,.15);
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .perf-task-card-meta { grid-template-columns: repeat(2, 1fr); }
  .perf-task-card-title { flex-wrap: wrap; }
  .perf-task-card-status { order: 3; }
  .perf-task-card-delete { order: 2; }
}

/* ═══ FEEDBACK / ISSUE TRACKER ═══════════════════════════════════════════ */
/* Sidebar badge — count of active issues */
.sidebar__badge {
  margin-left: auto;
  min-width: 18px; height: 18px; padding: 0 6px;
  background: #dc2626; color: #fff;
  border-radius: 99px;
  font-size: 10px; font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  display: inline-flex; align-items: center; justify-content: center;
}
.seg .seg-count {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  background: rgba(0,0,0,.08);
  border-radius: 99px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}
.seg button.active .seg-count { background: rgba(255,255,255,.25); }

/* Detail modal — status row + meta grid */
.fb-status-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--bg-subtle, #faf7f0);
  border-radius: var(--r-md);
  margin-bottom: 16px;
}
.fb-status-row > div:first-child { flex: 1; display: flex; align-items: center; gap: 10px; }
.fb-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding: 14px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 16px;
}
@media (max-width: 720px) { .fb-meta-grid { grid-template-columns: 1fr; } }
.fb-meta-grid > div { display: flex; flex-direction: column; gap: 2px; }
.fb-meta-grid label { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.fb-meta-grid strong { font-size: 13px; color: var(--text-primary); }
.fb-meta-grid small { font-size: 11px; color: var(--text-secondary); }
.fb-meta-grid p { margin: 0; font-size: 13px; line-height: 1.5; }

.fb-item-card {
  padding: 14px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand-gold, #AD9C82);
  border-radius: var(--r-md);
  margin-bottom: 10px;
}
.fb-item-card__head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.fb-item-card__head h4 { margin: 0; font-size: 14px; color: var(--text-primary); flex: 1; min-width: 200px; }
.fb-item-card h4 { margin: 0 0 6px; font-size: 14px; color: var(--text-primary); }

/* Product-category pill — coloured chip used in detail modal + admin list */
.fb-cat-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  min-height: 20px;
  background: var(--brand-gold, #AD9C82);
  color: #fff;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), inset 0 -1px 0 rgba(0, 0, 0, 0.08);
  vertical-align: middle;
}
.fb-cat-pill--sm {
  padding: 3px 9px;
  font-size: 9px;
  min-height: 18px;
  letter-spacing: .05em;
}
.fb-cat-row { display: flex; gap: 4px; flex-wrap: wrap; margin: 4px 0; }
.fb-cat-row--center { justify-content: center; }

/* Inline status editor in the Support Center table — admin clicks to change
   issue status without opening the detail modal. Styled to match a pill. */
.fb-status-editor {
  display: inline-block;
  position: relative;
}
.fb-status-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 5px 26px 5px 12px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  background-color: var(--bg-subtle, #faf7f0);
  color: var(--text-primary);
  /* Caret arrow */
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: all .15s ease;
}
.fb-status-select:hover  { filter: brightness(0.95); transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,.08); }
.fb-status-select:focus  { outline: none; box-shadow: 0 0 0 3px rgba(173,156,130,.18); }
.fb-status-select.is-pending  { background-color: #fef3c7; color: #92400e; border-color: rgba(245, 158, 11, .25); }
.fb-status-select.is-reviewed { background-color: #dbeafe; color: #1e40af; border-color: rgba(30, 64, 175, .2); }
.fb-status-select.is-resolved { background-color: #d1fae5; color: #065f46; border-color: rgba(6, 95, 70, .25); }

/* Items cell — neatly centered stack: count → pill(s) → titles */
.fb-items-cell {
  text-align: center;
  vertical-align: middle;
  padding: 10px 8px !important;
}
.fb-items-cell .fb-items-count {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.fb-items-cell .fb-items-count strong {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
}
.fb-items-cell .fb-cat-row { margin: 0 0 6px; }
.fb-items-cell .fb-items-titles {
  font-size: 11px;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.4;
  max-width: 220px;
  margin: 0 auto;
  word-break: break-word;
}
.fb-item-card .fb-cause { margin: 4px 0 8px; font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.fb-photo-strip {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 8px;
}
.fb-photo-strip a {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-base);
}
.fb-photo-strip img { display: block; width: 88px; height: 66px; object-fit: cover; }
.fb-photo-strip a:hover { border-color: var(--brand-gold, #AD9C82); }
.fb-await {
  padding: 16px;
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
  background: rgba(217, 119, 6, .05);
  border: 1px dashed rgba(217, 119, 6, .4);
  border-radius: var(--r-md);
}

/* Public form — issue items list */
.fb-item-row {
  padding: 14px;
  background: var(--bg-subtle, #faf7f0);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 10px;
}
.fb-item-row__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.fb-item-row__head strong { color: var(--brand-gold-dark, #7a6638); }
.fb-photo-preview { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.fb-photo-thumb {
  position: relative;
  width: 72px; height: 54px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-base);
}
.fb-photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fb-photo-remove {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(220,38,38,.85); color: #fff;
  cursor: pointer;
  font-size: 12px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}

/* Video upload preview */
.fb-video-preview {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 6px;
  padding: 8px;
  background: rgba(0,0,0,.03);
  border-radius: var(--r-sm);
}
.fb-video-preview video {
  width: 100%; max-height: 220px;
  border-radius: var(--r-sm);
  background: #000;
}
.fb-video-info {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.fb-video-info small { color: var(--text-secondary); font-size: 11px; font-family: 'JetBrains Mono', monospace; }

/* Issues header in the form (above the "Add Another" button) */
.fb-issues-header {
  display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.fb-issues-header h3 { margin: 0; font-size: 14px; color: var(--brand-gold-dark, #7a6638); }
.fb-issues-header small { color: var(--text-secondary); font-size: 12px; }

/* Form footer with submit button */
.fb-form-foot {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end;
}

/* ═══ PUBLIC QUOTE SUBMISSION VIEW (no-login forwarder portal) ════════════ */
.public-quote {
  min-height: 100vh;
  background: linear-gradient(135deg, #faf7f0 0%, #f0ebe1 100%);
  padding: 32px 16px;
  overflow-y: auto;
}
.public-quote__sheet {
  max-width: 1100px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--border, #e5e2d8);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.08);
  overflow: hidden;
}
.public-quote__head {
  padding: 24px 32px;
  background: linear-gradient(135deg, #181818 0%, #2a2a2a 100%);
  color: #fff;
  border-bottom: 4px solid #AD9C82;
}
.public-quote__brand {
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .7;
  margin-bottom: 8px;
}
.public-quote__title h1 {
  margin: 0 0 4px;
  font-size: 26px;
  letter-spacing: .02em;
  font-weight: 700;
}
.public-quote__title p {
  margin: 0;
  font-size: 13px;
  opacity: .8;
}
.public-quote__title strong { color: #AD9C82; font-family: 'JetBrains Mono', monospace; }

.public-quote__section {
  padding: 24px 32px;
  border-top: 1px solid var(--border, #ececec);
}
.public-quote__section:first-of-type { border-top: 0; }
.public-quote__section h2 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #7a6638;
  letter-spacing: .03em;
}
.public-quote__intro {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-secondary, #545351);
  line-height: 1.5;
}

.public-quote__meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px;
  background: #faf7f0;
  border-radius: 8px;
  margin-bottom: 16px;
}
@media (max-width: 720px) { .public-quote__meta-grid { grid-template-columns: 1fr 1fr; } }
.public-quote__meta-grid > div {
  display: flex; flex-direction: column; gap: 2px;
}
.public-quote__meta-grid label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-secondary, #545351);
  font-weight: 600;
}
.public-quote__meta-grid strong {
  font-size: 14px;
  color: #181818;
  font-family: 'JetBrains Mono', monospace;
}

.public-quote__table { margin: 0; }
.public-quote__table table { font-size: 11px; width: 100%; border-collapse: collapse; }
.public-quote__table th, .public-quote__table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #ececec; }
.public-quote__table th { background: #faf7f0; font-weight: 600; color: #545351; text-transform: uppercase; letter-spacing: .03em; font-size: 10px; }
.public-quote__table .num { text-align: right; }
.public-quote__table .font-mono { font-family: 'JetBrains Mono', monospace; }

.public-quote__form { margin-top: 8px; }
.public-quote__form .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .public-quote__form .form-grid { grid-template-columns: 1fr; } }
.public-quote__form .form-row { display: flex; flex-direction: column; gap: 4px; }
.public-quote__form label { font-size: 11px; color: #545351; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.public-quote__form .req { color: #dc2626; }
.public-quote__form input,
.public-quote__form select,
.public-quote__form textarea {
  height: 36px;
  padding: 0 12px;
  font-size: 14px;
  border: 1px solid #d4cfc1;
  border-radius: 6px;
  background: #fff;
  color: #181818;
  font-family: inherit;
}
.public-quote__form textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; }
.public-quote__form input:focus,
.public-quote__form select:focus,
.public-quote__form textarea:focus {
  outline: none;
  border-color: #AD9C82;
  box-shadow: 0 0 0 3px rgba(173, 156, 130, .2);
}
.public-quote__form-foot { margin-top: 20px; text-align: right; }
.public-quote__submit-btn {
  background: #AD9C82 !important;
  color: #fff !important;
  border: none !important;
  height: 44px !important;
  padding: 0 28px !important;
  font-size: 14px !important;
  font-weight: 600;
  letter-spacing: .03em;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(173, 156, 130, .35);
  transition: all .15s ease;
}
.public-quote__submit-btn:hover {
  background: #8d8068 !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(173, 156, 130, .45);
}

.public-quote__thanks {
  text-align: center;
  padding: 40px 24px;
  background: linear-gradient(135deg, rgba(22,163,74,.05), rgba(22,163,74,.02));
  border: 2px solid rgba(22,163,74,.3);
  border-radius: 12px;
}
.public-quote__thanks h3 { margin: 4px 0 8px; color: #16a34a; font-size: 18px; }
.public-quote__thanks p { margin: 0 0 16px; color: var(--text-secondary, #545351); max-width: 460px; margin-left: auto; margin-right: auto; line-height: 1.5; font-size: 13px; }

.public-quote__error {
  margin: 32px;
  padding: 32px;
  text-align: center;
  background: rgba(220, 38, 38, .04);
  border: 1px solid rgba(220, 38, 38, .25);
  border-radius: 8px;
}
.public-quote__error h2 { color: #dc2626; margin: 0 0 8px; font-size: 18px; }
.public-quote__error p { color: var(--text-secondary, #545351); margin: 0 0 12px; font-size: 13px; }
.public-quote__error code { background: rgba(0,0,0,.05); padding: 2px 6px; border-radius: 4px; font-family: 'JetBrains Mono', monospace; }

.public-quote__foot {
  padding: 16px 32px 24px;
  border-top: 1px solid #ececec;
  background: #faf7f0;
}
.public-quote__foot small { color: var(--text-secondary, #545351); font-size: 11px; }

/* ═══ FORWARDER QUOTE REQUEST ═══════════════════════════════════════════ */
/* Inline cell on Shipment table: forwarder name input + quote button */
.ship-fwd-cell {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 180px;
}
.ship-fwd-cell__input {
  flex: 1;
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-base);
  min-width: 0;
}
.ship-fwd-cell__input[readonly] {
  background: rgba(22,163,74,.06);
  border-color: rgba(22,163,74,.4);
  color: #16a34a;
  font-weight: 600;
  cursor: default;
}
.ship-fwd-cell__input:focus {
  outline: none;
  border-color: var(--brand-gold, #AD9C82);
  box-shadow: 0 0 0 2px rgba(173,156,130,.18);
}
.ship-fwd-cell__btn {
  position: relative;
  width: 28px; height: 28px;
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(173,156,130,.5);
  border-radius: var(--r-sm);
  background: rgba(173,156,130,.1);
  color: #AD9C82;
  cursor: pointer;
  transition: all .15s ease;
}
.ship-fwd-cell__btn:hover {
  background: var(--brand-gold, #AD9C82);
  color: #fff;
  border-color: transparent;
  transform: scale(1.05);
}
.ship-fwd-cell__btn.has-quotes {
  border-color: rgba(22,163,74,.5);
  background: rgba(22,163,74,.1);
  color: #16a34a;
}
.ship-fwd-cell__btn.has-quotes:hover { background: #16a34a; color: #fff; }
.ship-fwd-cell__count {
  position: absolute;
  top: -6px; right: -6px;
  min-width: 14px; height: 14px;
  padding: 0 3px;
  background: var(--brand-gold, #AD9C82);
  color: #fff;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  display: flex; align-items: center; justify-content: center;
}
.ship-fwd-cell__btn.has-quotes .ship-fwd-cell__count { background: #16a34a; }

/* Quote modal — share link row */
.fq-share-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.fq-share-row input {
  flex: 1;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-subtle, #faf7f0);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
}
.fq-share-row input:focus { outline: none; border-color: var(--brand-gold, #AD9C82); background: var(--bg-base); color: var(--text-primary); }

/* Quote rows */
.fq-quote-list { display: flex; flex-direction: column; gap: 10px; }
.fq-empty {
  padding: 24px; text-align: center;
  color: var(--text-secondary); font-size: 12px;
  background: var(--bg-subtle, #faf7f0); border-radius: var(--r-md);
  border: 1px dashed var(--border);
}
.fq-quote-row {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  background: var(--bg-base);
  transition: all .15s ease;
}
.fq-quote-row--cheapest {
  border-color: #16a34a;
  background: linear-gradient(135deg, rgba(22,163,74,.04), transparent);
  box-shadow: 0 0 0 1px rgba(22,163,74,.18);
}
.fq-quote-row--selected {
  border-color: var(--brand-gold, #AD9C82);
  background: linear-gradient(135deg, rgba(173,156,130,.06), transparent);
}
.fq-quote-row__head {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 10px;
}
.fq-quote-row__name {
  flex: 1; height: 32px; padding: 0 10px;
  font-size: 14px; font-weight: 600;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-base);
}
.fq-cheapest-badge {
  padding: 3px 10px;
  background: #16a34a; color: #fff;
  border-radius: 99px;
  font-size: 10px; font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.fq-quote-row__grid {
  display: grid;
  grid-template-columns: 1fr 1fr 90px 1fr;
  gap: 8px;
}
@media (max-width: 720px) { .fq-quote-row__grid { grid-template-columns: 1fr 1fr; } }
.fq-quote-row__grid input,
.fq-quote-row__grid select {
  height: 28px; padding: 0 8px; font-size: 12px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-base);
}
.fq-quote-row__grid input[type="number"] { font-family: 'JetBrains Mono', monospace; text-align: right; }
.fq-quote-row__grid label { font-size: 10px; }
.fq-quote-row__usd {
  margin-top: 8px; padding: 6px 10px;
  background: rgba(173,156,130,.08); border-radius: var(--r-sm);
  font-size: 12px; color: var(--text-secondary);
}
.fq-quote-row__usd strong { color: var(--brand-gold-dark, #7a6638); font-family: 'JetBrains Mono', monospace; }

/* AI analysis */
.fq-ai-analysis { display: flex; flex-direction: column; gap: 12px; }
.fq-ai-msg {
  padding: 14px;
  background: var(--bg-subtle, #faf7f0);
  border: 1px dashed var(--border); border-radius: var(--r-md);
  color: var(--text-secondary); font-size: 12px;
  text-align: center;
}
.fq-ai-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
@media (max-width: 720px) { .fq-ai-cards { grid-template-columns: repeat(2, 1fr); } }
.fq-ai-card {
  padding: 10px 12px;
  background: var(--bg-base);
  border: 1px solid var(--border); border-radius: var(--r-md);
  display: flex; flex-direction: column; gap: 2px;
}
.fq-ai-card small { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.fq-ai-card strong { font-size: 14px; color: var(--text-primary); }
.fq-ai-card span { font-size: 12px; color: var(--text-secondary); font-family: 'JetBrains Mono', monospace; }
.fq-ai-card--good   { border-color: rgba(22,163,74,.4); background: rgba(22,163,74,.04); }
.fq-ai-card--good strong { color: #16a34a; }
.fq-ai-card--bad    { border-color: rgba(220,38,38,.3); background: rgba(220,38,38,.03); }
.fq-ai-card--bad strong { color: #dc2626; }
.fq-ai-card--accent { border-color: rgba(173,156,130,.5); background: rgba(173,156,130,.08); }
.fq-ai-card--accent strong { color: var(--brand-gold-dark, #7a6638); font-family: 'JetBrains Mono', monospace; font-size: 16px; }
.fq-ai-recommend {
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(173,156,130,.08), rgba(173,156,130,.02));
  border: 1px solid rgba(173,156,130,.3);
  border-left: 3px solid var(--brand-gold, #AD9C82);
  border-radius: var(--r-md);
  font-size: 13px;
  line-height: 1.5;
}

/* Confirm box */
.fq-confirm-box { display: flex; flex-direction: column; gap: 10px; }
.fq-confirm-row {
  display: flex; gap: 8px; align-items: end; flex-wrap: wrap;
}
.fq-confirm-row label {
  font-size: 11px; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
  width: 100%;
}
.fq-confirm-row select {
  flex: 1; min-width: 240px;
  height: 36px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-base); font-size: 13px;
}
.fq-confirmed-msg {
  padding: 10px 14px;
  background: rgba(22,163,74,.08);
  border: 1px solid rgba(22,163,74,.3);
  border-left: 3px solid #16a34a;
  border-radius: var(--r-md);
  font-size: 13px;
  color: #15803d;
}

/* Cargo table — slightly narrower padding to fit lots of columns */
.table--cargo th, .table--cargo td { padding: 6px 8px !important; font-size: 11px; }
.table--cargo tfoot td { background: var(--bg-subtle, #faf7f0); border-top: 2px solid var(--brand-gold, #AD9C82); padding: 10px 8px !important; }

/* Per-line packing-method dropdown inside cargo table */
.fq-packing-select {
  width: 100%;
  height: 28px;
  padding: 0 8px;
  font-size: 11px;
  border: 1px solid var(--border, #ececec);
  border-radius: 4px;
  background: var(--bg-base, #fff);
  cursor: pointer;
  font-family: inherit;
}
.fq-packing-select:hover  { border-color: var(--brand-gold, #AD9C82); }
.fq-packing-select:focus  { outline: none; border-color: var(--brand-gold, #AD9C82); box-shadow: 0 0 0 2px rgba(173,156,130,.15); }
.fq-packing-detail {
  display: flex; flex-direction: column; gap: 1px;
  margin-top: 6px;
  padding: 6px 8px;
  background: rgba(173,156,130,.06);
  border-left: 2px solid var(--brand-gold, #AD9C82);
  border-radius: 3px;
}
.fq-packing-detail small { font-size: 10px; line-height: 1.4; }
.fq-packing-detail small strong { color: var(--brand-gold-dark, #7a6638); font-family: 'JetBrains Mono', monospace; }

/* Editable pallet/crate count — small input + label + optional reset */
.fq-packing-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.fq-packing-count-input {
  width: 48px;
  height: 22px;
  padding: 0 4px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  text-align: center;
  border: 1px solid var(--border, #d4cfc1);
  border-radius: 4px;
  background: #fff;
  color: var(--brand-gold-dark, #7a6638);
}
.fq-packing-count-input:hover { border-color: var(--brand-gold, #AD9C82); }
.fq-packing-count-input:focus {
  outline: none;
  border-color: var(--brand-gold, #AD9C82);
  box-shadow: 0 0 0 2px rgba(173,156,130,.18);
  background: #fffdf8;
}
.fq-packing-count small { font-size: 10px; color: var(--text-secondary); }
.fq-packing-count-reset {
  width: 16px; height: 16px;
  padding: 0;
  border: none;
  background: rgba(173,156,130,.15);
  color: var(--brand-gold-dark, #7a6638);
  border-radius: 50%;
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 2px;
  transition: all .12s ease;
}
.fq-packing-count-reset:hover { background: var(--brand-gold, #AD9C82); color: #fff; }

/* ═══ SHIPMENT PLAN — group GPO lines into Normal/Special split ═══════════ */
/* History count badge on the toolbar button */
.sp-history-count {
  margin-left: 6px;
  padding: 1px 7px;
  background: var(--brand-gold, #AD9C82);
  color: #fff;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  font-family: 'JetBrains Mono', monospace;
}

/* Step 1 — toolbar with search + bulk + counter */
.sp-toolbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin: 12px 0 10px;
}
.sp-toolbar input[type="search"] {
  flex: 1; min-width: 200px; height: 32px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-base); font-size: 13px;
}
.sp-selected-count { font-size: 11px; color: var(--text-secondary); margin-left: auto; }

/* Step 1 — list of GPO checkboxes */
/* The modal body already provides vertical scroll — don't add a nested
   max-height/overflow here, otherwise rows at the bottom get clipped and
   the user can't reach them with either scrollbar. */
.sp-gpo-list { display: flex; flex-direction: column; gap: 6px; padding: 2px; }
.sp-gpo-row {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--bg-base); cursor: pointer;
  transition: all .12s ease;
}
.sp-gpo-row:hover { border-color: var(--brand-gold, #AD9C82); background: rgba(173,156,130,.04); }
.sp-gpo-row input[type="checkbox"] { flex-shrink: 0; width: 18px; height: 18px; cursor: pointer; accent-color: var(--brand-gold, #AD9C82); }
.sp-gpo-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sp-gpo-row__head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.sp-gpo-row__head strong { font-size: 13px; color: var(--brand-gold-dark, #7a6638); }
.sp-gpo-row__country { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-secondary); }
.sp-gpo-row__meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--text-secondary); }
.sp-gpo-row__meta strong { color: var(--text-primary); }

/* Step 2 — per-GPO sections with line tables */
.sp-step2-toolbar {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 0; margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.sp-step2-list { display: flex; flex-direction: column; gap: 16px; padding: 2px; }
.sp-step2-group {
  border: 1px solid var(--border); border-radius: var(--r-md);
  overflow: hidden; background: var(--bg-base);
}
.sp-step2-group__head {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 14px;
  background: var(--bg-subtle, #faf7f0);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.sp-step2-group__head .font-mono { color: var(--brand-gold-dark, #7a6638); font-size: 13px; }
.sp-step2-group__country { display: inline-flex; align-items: center; gap: 4px; color: var(--text-secondary); }
.sp-step2-group__count { margin-left: auto; color: var(--text-secondary); font-size: 11px; }
.sp-step2-group__subtotal {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 3px 8px;
  background: rgba(173,156,130,.1);
  border-radius: 99px;
  white-space: nowrap;
}
.sp-step2-group__subtotal strong {
  font-family: 'JetBrains Mono', monospace;
  color: var(--brand-gold-dark, #7a6638);
  font-size: 11px;
}
.sp-step2-toolbar__grand {
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: 14px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}
.sp-step2-table { width: 100%; border-collapse: collapse; }
.sp-step2-table th, .sp-step2-table td { padding: 8px 12px; text-align: left; font-size: 12px; }
.sp-step2-table th { background: rgba(0,0,0,.02); border-bottom: 1px solid var(--border); font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .03em; font-size: 10px; }
.sp-step2-table th.num, .sp-step2-table td.num { text-align: right; font-family: 'JetBrains Mono', monospace; }
.sp-step2-table tr + tr { border-top: 1px solid var(--border-soft, #f0ebe1); }

/* Method toggle pills */
.sp-method-toggle { display: inline-flex; gap: 4px; padding: 2px; background: var(--bg-subtle, #faf7f0); border-radius: 99px; }
.sp-method-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all .12s ease;
}
.sp-method-pill input { display: none; }
.sp-method-pill:hover { color: var(--text-primary); }
.sp-method-pill.is-active.sp-method-pill--normal  { background: #16a34a; color: #fff; box-shadow: 0 1px 4px rgba(22,163,74,.3); }
.sp-method-pill.is-active.sp-method-pill--special { background: #9333ea; color: #fff; box-shadow: 0 1px 4px rgba(147,51,234,.3); }

/* Summary view */
.sp-sum-meta {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  padding: 14px; margin-bottom: 16px;
  background: var(--bg-subtle, #faf7f0); border-radius: var(--r-md);
}
@media (max-width: 720px) { .sp-sum-meta { grid-template-columns: 1fr 1fr; } }
.sp-sum-meta > div { display: flex; flex-direction: column; gap: 2px; }
.sp-sum-meta label { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.sp-sum-meta strong { font-size: 13px; color: var(--text-primary); font-family: 'JetBrains Mono', monospace; }

.sp-sum-bucket {
  border: 1px solid var(--border); border-radius: var(--r-md);
  margin-bottom: 12px; background: var(--bg-base); overflow: hidden;
}
.sp-sum-bucket header {
  display: flex; gap: 8px; align-items: baseline;
  padding: 10px 14px;
  background: var(--bg-subtle, #faf7f0);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.sp-sum-bucket header small { color: var(--text-secondary); font-size: 11px; }
.sp-sum-bucket--normal  header { border-left: 3px solid #16a34a; }
.sp-sum-bucket--special header { border-left: 3px solid #9333ea; }
.sp-sum-gpo { padding: 10px 14px; border-top: 1px solid var(--border-soft, #f0ebe1); }
.sp-sum-gpo:first-child { border-top: 0; }
.sp-sum-gpo__head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.sp-sum-gpo__head .font-mono { color: var(--brand-gold-dark, #7a6638); font-size: 12px; }
.sp-sum-gpo__country { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-secondary); }
.sp-sum-lines { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.sp-sum-lines li {
  display: grid;
  grid-template-columns: 90px minmax(140px, 1fr) 110px 140px 140px;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  background: var(--bg-base);
  border-radius: var(--r-sm);
  font-size: 12px;
}
@media (max-width: 720px) {
  .sp-sum-lines li { grid-template-columns: 1fr 1fr; }
}
.sp-sum-line-name { color: var(--text-secondary); }
.sp-sum-line-qty { font-family: 'JetBrains Mono', monospace; text-align: right; font-size: 12px; color: var(--text-primary); }
.sp-sum-line-price { font-family: 'JetBrains Mono', monospace; text-align: right; color: var(--text-secondary); }
.sp-sum-line-price small { font-size: 11px; }
.sp-sum-line-total {
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
  font-size: 13px;
  color: var(--brand-gold-dark, #7a6638);
}

/* GPO sub-total chip in summary */
.sp-sum-gpo__subtotal {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 2px 8px;
  background: rgba(173,156,130,.1);
  border-radius: 99px;
}
.sp-sum-gpo__subtotal strong { font-family: 'JetBrains Mono', monospace; color: var(--brand-gold-dark, #7a6638); }
/* Bucket-level total in bucket header */
.sp-sum-bucket__total {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 3px 10px;
  background: rgba(173,156,130,.08);
  border-radius: 99px;
}
.sp-sum-bucket__total strong { font-family: 'JetBrains Mono', monospace; }
/* Plan-wide grand total in meta panel — span 3 columns and stand out */
.sp-sum-meta__grand {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}
.sp-sum-meta__grand label { color: var(--text-primary); font-weight: 700; }
.sp-sum-meta__grand strong {
  color: var(--brand-gold-dark, #7a6638) !important;
  font-size: 16px !important;
}

/* ═══ Document upload status — colors the Invoice No / Shipment No cell ══
   • default (no class)        → black (no docs uploaded)
   • .doc-status--partial      → amber + slow pulse (some uploaded, not all)
   • .doc-status--complete     → green, no animation                          */
.doc-status--partial .font-mono {
  color: #d97706;            /* amber-600 */
  font-weight: 700;
  animation: doc-blink 1.4s ease-in-out infinite;
}
.doc-status--complete .font-mono {
  color: #16a34a;            /* green-600 */
  font-weight: 700;
}
@keyframes doc-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}
/* Subtle background tint on the whole cell so it stands out in dense tables */
.doc-status--partial  { background: linear-gradient(90deg, rgba(217,119,6,0.06), transparent 70%); }
.doc-status--complete { background: linear-gradient(90deg, rgba(22,163,74,0.06), transparent 70%); }

/* ═══ COST SAVING — editable price-history table ═════════════════════════ */
.table--cost-saving th { font-size: 11px; }
.table--cost-saving .cs-cell { padding: 2px 4px !important; min-width: 80px; }
.cs-cell__input {
  width: 100%;
  height: 28px;
  padding: 0 6px;
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-primary);
  transition: all .12s ease;
}
.cs-cell__input:hover {
  border-color: var(--border);
  background: var(--bg-base);
}
.cs-cell__input:focus {
  outline: none;
  border-color: var(--brand-gold, #AD9C82);
  background: var(--bg-base);
  box-shadow: 0 0 0 2px rgba(173,156,130,.18);
}
.cs-cell__input::placeholder { color: var(--text-disabled, #c7c2b6); font-style: italic; }
.cs-saving { background: rgba(0,0,0,.02); }
.cs-saving--good strong { color: #16a34a; }   /* green — we're saving */
.cs-saving--bad  strong { color: #dc2626; }   /* red   — paying more */

/* ═══ BRAND SWITCHER (2-tier picker) ══════════════════════════════════════ */
.brand-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.brand-group {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-base);
}
.brand-group--active { border-color: var(--brand-gold, #AD9C82); }
.brand-group__head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-subtle, #faf7f0);
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background .12s ease;
}
.brand-group__head:hover { background: rgba(173,156,130,.08); }
.brand-group__mark {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  color: #fff; font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  letter-spacing: .04em;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
}
.brand-group__body { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.brand-group__body strong { font-size: 14px; color: var(--text-primary); }
.brand-group__caret {
  color: var(--text-secondary);
  transition: transform .18s ease;
}
.brand-group__subs {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-base);
}
.brand-group__subs.is-collapsed { display: none; }

.brand-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg-base);
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  transition: all .15s ease;
  position: relative;
  width: 100%;
  font-family: inherit;
}
.brand-card:hover {
  border-color: var(--brand-gold, #AD9C82);
  background: rgba(173,156,130,.04);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
}
.brand-card--active {
  border-color: var(--brand-gold, #AD9C82);
  background: linear-gradient(135deg, rgba(173,156,130,.08), rgba(173,156,130,.02));
  cursor: default;
}
.brand-card--active:hover {
  transform: none;
  box-shadow: none;
}
.brand-card--sub { padding: 10px 12px; }
.brand-card__mark {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: .03em;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.brand-card__mark--sm { width: 38px; height: 38px; font-size: 12px; }
.brand-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.brand-card__body strong { font-size: 14px; color: var(--text-primary); display: flex; align-items: center; gap: 6px; }
.brand-card__body small { font-size: 11px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-card__tagline { font-style: italic; opacity: .8; }
.brand-card__active { color: var(--brand-gold-dark, #7a6638); font-weight: 600; }
.brand-card__check {
  position: absolute;
  top: 12px;
  right: 12px;
}
.brand-card__master-badge {
  display: inline-block;
  padding: 1px 7px;
  background: var(--brand-gold, #AD9C82);
  color: #fff;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* Account modal — Brand chips picker */
.acc-brand-strip { padding: 8px 0 4px; display: flex; flex-direction: column; gap: 14px; }
.acc-brand-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.acc-brand-chip {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding-left: 4px !important;
}
.acc-brand-chip__mark {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 6px;
  color: #fff;
  font-weight: 700;
  font-size: 9px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: .03em;
  flex-shrink: 0;
}
.acc-default-brand { display: flex; flex-direction: column; gap: 4px; max-width: 360px; }
.acc-default-brand label {
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 600;
}
.acc-default-brand select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-base);
  font-size: 13px;
}

/* Topbar brand area becomes interactive (clickable) */
.topbar__brand:hover .logo-mark {
  transform: scale(1.05);
  transition: transform .15s ease;
}

/* Stock Summary card — tiles per product */
.inv-stock-card .card__head { gap: 12px; flex-wrap: wrap; }
.inv-stock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  padding: 16px 20px 20px;
}
.inv-stock-tile {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all .15s ease;
}
.inv-stock-tile:hover {
  border-color: rgba(173,156,130,.5);
  box-shadow: 0 4px 12px rgba(173,156,130,.12);
}
.inv-stock-tile--low { border-color: rgba(217, 119, 6, .45); background: rgba(217, 119, 6, .03); }
.inv-stock-tile--empty { border-color: rgba(220, 38, 38, .35); background: rgba(220, 38, 38, .03); opacity: .8; }
.inv-stock-tile__head { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.inv-stock-tile__code {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-gold-dark, #7a6638);
  letter-spacing: .04em;
}
.inv-stock-tile__head strong {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}
.inv-stock-tile__head small { font-size: 11px; color: var(--text-secondary); }
.inv-stock-tile__nums {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--border-soft, #ececec);
  border-bottom: 1px solid var(--border-soft, #ececec);
}
.inv-stock-tile__num { display: flex; flex-direction: column; gap: 2px; }
.inv-stock-tile__num label {
  font-size: 9px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 600;
}
.inv-stock-tile__num strong {
  font-size: 20px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
}
.inv-stock-tile--low .inv-stock-tile__num strong { color: var(--status-yellow, #d97706); }
.inv-stock-tile--empty .inv-stock-tile__num strong { color: var(--status-red, #dc2626); }
.inv-stock-tile__flow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.inv-stock-tile__flow small { font-size: 10px; font-family: 'JetBrains Mono', monospace; }
.inv-stock-tile__in  { color: #16a34a; }
.inv-stock-tile__out { color: #dc2626; }

/* Deduct Stock modal — per-product row */
.inv-deduct-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px 2px;
}
.inv-deduct-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(280px, 1.6fr);
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-subtle, #faf7f0);
  align-items: center;
}
.inv-deduct-row:hover { background: var(--bg-base); }
.inv-deduct-row__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.inv-deduct-row__info strong { font-size: 11px; color: var(--brand-gold-dark, #7a6638); }
.inv-deduct-row__info span { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-deduct-row__inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.inv-deduct-row__inputs input {
  height: 30px;
  padding: 0 8px;
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-base);
  font-size: 13px;
}
.inv-deduct-row__inputs input:focus {
  outline: none;
  border-color: var(--brand-gold, #AD9C82);
  box-shadow: 0 0 0 2px rgba(173,156,130,.15);
}

.inv-remark {
  display: inline-block;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
  vertical-align: middle;
  font-size: 11px;
}

/* Add/Edit Product → Import Tax & Remark by Country rows */
.duty-row { transition: background .12s ease; }
.duty-row:hover { background: rgba(173,156,130,.05); }
.duty-row .form-row label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .03em; }
.duty-row input[type="number"], .duty-row input[type="text"] {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-base);
}
.duty-row input[type="text"]:focus, .duty-row input[type="number"]:focus {
  outline: none;
  border-color: var(--brand-gold, #AD9C82);
  box-shadow: 0 0 0 2px rgba(173,156,130,.15);
}

/* Products table — per-row Import Tax country picker */
.prod-tax-country {
  cursor: pointer;
}
.prod-tax-val { color: var(--brand-gold-dark, #7a6638); font-weight: 600; font-size: 12px; }
.prod-tax-remark {
  display: inline-block;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
  font-size: 11px;
  vertical-align: middle;
}

/* AI Chat panel */
.lp-chat {
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  min-height: 480px;
  max-height: 540px;
}

/* AI Auto-arrange (Guru) button — gold gradient + sparkle icon + version pill */
.lp-ai-pack-btn {
  background: linear-gradient(135deg, #AD9C82 0%, #C7B594 50%, #AD9C82 100%);
  background-size: 200% 100%;
  border: none;
  color: #fff;
  font-weight: 600;
  letter-spacing: .015em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  box-shadow: 0 1px 0 rgba(0,0,0,.08), 0 0 0 1px rgba(173,156,130,.35);
  transition: all .18s ease;
}
.lp-ai-pack-btn:hover {
  background-position: 100% 0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(173,156,130,.45), 0 0 0 1px rgba(173,156,130,.5);
}
.lp-ai-pack-btn:active { transform: translateY(0); }
.lp-ai-pack-btn .lp-ai-icon {
  display: inline-block;
  font-size: 13px;
  filter: drop-shadow(0 0 3px rgba(255,255,255,.6));
}
.lp-ai-pack-btn .lp-ai-count {
  margin-left: 4px;
  padding: 1px 7px;
  background: rgba(255,255,255,.22);
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  font-family: 'JetBrains Mono', monospace;
}
.lp-ai-pack-btn.is-pulsing { animation: lp-ai-pop 600ms cubic-bezier(.18,.89,.32,1.28); }
@keyframes lp-ai-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(173,156,130,.35), 0 4px 12px rgba(173,156,130,.45); }
  100% { transform: scale(1); box-shadow: 0 1px 0 rgba(0,0,0,.08), 0 0 0 1px rgba(173,156,130,.35); }
}

/* Undo / Redo ghost buttons next to the AI button */
.btn[data-action="lp-undo"]:not([disabled]),
.btn[data-action="lp-redo"]:not([disabled]) {
  color: var(--brand-gold-dark, #7a6638);
}
.btn[data-action="lp-undo"][disabled],
.btn[data-action="lp-redo"][disabled] {
  opacity: .4;
  cursor: not-allowed;
}
.lp-chat__head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(173, 156, 130,0.06), rgba(6,182,212,0.05));
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.lp-chat__avatar {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-navy-500);
  color: #fff;
  border-radius: 8px;
  flex-shrink: 0;
}
.lp-chat__head strong {
  display: block; font-size: 13px; color: var(--text-primary); line-height: 1.2;
}
.lp-chat__head small {
  display: block; font-size: 11px; color: var(--text-secondary); margin-top: 2px;
}
.lp-chat__head > div { flex: 1; min-width: 0; }
.lp-chat__status {
  color: #10b981;
  font-size: 14px;
  animation: lp-chat-pulse 2s ease-in-out infinite;
}
@keyframes lp-chat-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

/* Message stream */
.lp-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-subtle);
  scrollbar-width: thin;
}
.lp-chat__messages::-webkit-scrollbar { width: 6px; }
.lp-chat__messages::-webkit-scrollbar-thumb { background: rgba(173, 156, 130,0.25); border-radius: 3px; }

.lp-chat-msg {
  display: flex; flex-direction: column;
  max-width: 92%;
}
.lp-chat-msg--ai   { align-self: flex-start; }
.lp-chat-msg--user { align-self: flex-end; align-items: flex-end; }
.lp-chat-msg__bubble {
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-primary);
  word-wrap: break-word;
  white-space: normal;
}
.lp-chat-msg--ai   .lp-chat-msg__bubble {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
}
.lp-chat-msg--user .lp-chat-msg__bubble {
  background: var(--brand-navy-500);
  color: #fff;
  border-top-right-radius: 4px;
}
.lp-chat-msg--user .lp-chat-msg__bubble strong { color: #fff; }
.lp-chat-msg__bubble strong { color: var(--brand-navy-700); }
.lp-chat-msg__bubble em {
  display: inline-block;
  padding: 2px 8px;
  margin-bottom: 4px;
  background: rgba(6,182,212,0.12);
  color: #0e7490;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.lp-chat-msg__meta {
  font-size: 10px;
  color: var(--text-disabled);
  margin-top: 3px;
  padding: 0 4px;
}

/* Suggestion chips above the input */
.lp-chat__suggestions {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 12px;
  background: var(--bg-base);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.lp-chat-chip {
  padding: 5px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
  white-space: nowrap;
}
.lp-chat-chip:hover {
  background: var(--brand-navy-500);
  color: #fff;
  border-color: var(--brand-navy-500);
}

/* Input row */
.lp-chat__form {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px;
  background: var(--bg-base);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.lp-chat__input {
  flex: 1; min-width: 0;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-subtle);
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.lp-chat__input:focus {
  border-color: var(--brand-navy-500);
  box-shadow: 0 0 0 3px rgba(173, 156, 130,0.12);
  background: var(--bg-base);
}
.lp-chat__send {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: none;
  background: var(--brand-navy-500);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, transform .15s;
}
.lp-chat__send:hover { background: var(--brand-navy-700); transform: scale(1.08); }
.lp-chat__send:active { transform: scale(0.95); }

.lp-3d-wrap {
  position: relative;
  padding: 12px 20px 20px;
  max-width: 1320px;           /* expanded — keeps slim gutters on very wide screens for page scrolling */
  margin: 0 auto;
}
#lp3dCanvas {
  width: 100%;
  height: 480px;
  display: block;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: #f8fafc;
  cursor: grab;
}
#lp3dCanvas:active { cursor: grabbing; }
.lp-3d-legend {
  position: absolute;
  top: 22px; right: 30px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px;
  max-width: 240px;
  backdrop-filter: blur(4px);
}
.lp-legend-item { display: flex; align-items: center; gap: 6px; }
.lp-color-chip {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.lp-totals { padding: 16px 20px; }
.lp-spec-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 900px) { .lp-spec-grid { grid-template-columns: 1fr; } }
.lp-spec-row {
  padding: 12px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-align: center;
}
.lp-spec-row label { display: block; font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.lp-spec-row strong { display: block; font-size: 16px; font-family: 'JetBrains Mono', monospace; color: var(--brand-navy-700); margin-bottom: 2px; }
.lp-spec-row small { display: block; font-size: 11px; color: var(--text-secondary); }

.lp-bars { display: flex; flex-direction: column; gap: 12px; }
.lp-bar { display: flex; flex-direction: column; gap: 6px; }
.lp-bar__label { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.lp-bar__label strong { font-family: 'JetBrains Mono', monospace; color: var(--brand-navy-700); }
.lp-bar__label strong small { font-weight: 400; color: var(--text-secondary); margin-left: 4px; }
.lp-bar__track {
  height: 10px;
  background: var(--bg-subtle);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.lp-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, #AD9C82, #8c7d68);
  transition: width .25s;
}
.lp-bar__fill--over { background: linear-gradient(90deg, #ef4444, #b91c1c); }
.lp-bar__remaining { font-size: 12px; color: var(--text-secondary); }
.lp-bar__remaining strong { color: var(--brand-navy-700); font-family: 'JetBrains Mono', monospace; }

.lp-warning {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-left: 3px solid #ef4444;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: #991b1b;
}

/* ───── Per-line documents card (Shipment Detail → Documents tab) ───── */
.doc-line-card {
  padding: 16px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 16px;
  border-left: 4px solid var(--border);
}
.doc-line-card--green  { border-left-color: var(--status-green); }
.doc-line-card--yellow { border-left-color: var(--status-yellow); }
.doc-line-card--grey   { border-left-color: var(--text-disabled); }
.doc-line-card--blue   { border-left-color: var(--status-blue); }
.doc-line-card:last-child { margin-bottom: 0; }

.doc-line-card__head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.doc-line-card__title {
  display: flex; gap: 12px; align-items: flex-start;
  flex: 1; min-width: 0;
}
.doc-line-card__meta {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-top: 4px;
}
.doc-line-card__actions {
  display: inline-flex; gap: 6px; flex-shrink: 0;
}

/* ───── AI Verify button (Shipment / Invoice lists) ───── */
.ai-verify-btn {
  margin-left: 4px;
  width: 24px; height: 24px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(173, 156, 130, 0.10), rgba(196, 182, 154, 0.10));
  border: 1px solid rgba(173, 156, 130, 0.4);
  border-radius: var(--r-sm);
  color: #AD9C82;
  cursor: pointer;
  transition: all .15s;
}
.ai-verify-btn:hover {
  background: linear-gradient(135deg, #AD9C82, #AD9C82);
  color: #fff;
  border-color: transparent;
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(173, 156, 130, 0.35);
}
.ai-verify-btn svg { width: 14px; height: 14px; }

/* AI-verified state — turn the shield green when documents are complete and
   the AI verification passes. No animation; the green shield itself signals
   "ready". Hover stays green but darkens slightly. */
.ai-verify-btn--verified {
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.14), rgba(22, 163, 74, 0.18));
  border-color: rgba(22, 163, 74, 0.55);
  color: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.10);
}
.ai-verify-btn--verified:hover {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(22, 163, 74, 0.45);
}

/* Shipment info "i" button — sits next to docs/AI verify icons on each row.
   Default: subtle grey ring (no notes). When notes exist: navy filled with dot pulse. */
.ship-info-btn {
  margin-left: 4px;
  width: 24px; height: 24px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .15s;
  position: relative;
}
.ship-info-btn svg { width: 14px; height: 14px; }
.ship-info-btn:hover {
  background: var(--brand-navy-500);
  color: #fff;
  border-color: var(--brand-navy-500);
  transform: scale(1.08);
}
.ship-info-btn.has-details {
  background: rgba(173, 156, 130, 0.10);
  color: var(--brand-navy-500);
  border-color: rgba(173, 156, 130, 0.30);
}
.ship-info-btn.has-details::after {
  /* Tiny dot in the top-right corner indicating "there are notes" */
  content: '';
  position: absolute;
  top: -2px; right: -2px;
  width: 7px; height: 7px;
  background: var(--status-blue, #2c7be5);
  border: 1.5px solid var(--bg-base);
  border-radius: 50%;
}
.ship-info-btn.has-details:hover {
  background: var(--brand-navy-500);
  color: #fff;
}

/* ───── AI Verification result modal — grouped issues ───── */
.verify-group {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-left: 3px solid var(--status-yellow);
  border-radius: var(--r-md);
}
.verify-group:last-child { margin-bottom: 0; }
.verify-group h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-navy-700);
  display: flex; align-items: center; gap: 8px;
}
.verify-group__count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 6px;
  background: var(--status-yellow);
  color: #6a4500;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.verify-group ul {
  margin: 0; padding: 0 0 0 18px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-primary);
}
.verify-group ul li::marker { color: var(--status-red); }

/* ───── Per-line document icon button (Shipment Info → Lines table) ───── */
.line-doc-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  padding: 0;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all .12s;
}
.line-doc-btn:hover { transform: scale(1.08); }
.line-doc-btn--grey   { color: var(--text-disabled); border-style: dashed; }
.line-doc-btn--grey:hover  { color: var(--brand-navy-500); border-color: var(--brand-navy-500); border-style: solid; }
.line-doc-btn--blue   { color: var(--status-blue);   border-color: var(--status-blue);   background: rgba(44, 123, 229, 0.08); }
.line-doc-btn--yellow { color: #b07712;              border-color: var(--status-yellow); background: rgba(242, 169, 59, 0.12); }
.line-doc-btn--green  { color: #15803d;              border-color: var(--status-green);  background: rgba(34, 197, 94, 0.12); }

/* ───── Item picker inside Documents modal ───── */
.doc-item-picker {
  margin: 10px 0 16px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.doc-item-picker__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13px;
}
.doc-item-picker__chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.doc-item-chip {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all .12s;
}
.doc-item-chip:hover { border-color: var(--brand-navy-500); }
.doc-item-chip input { margin-top: 2px; flex-shrink: 0; }
.doc-item-chip strong { font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.doc-item-chip small  { font-size: 11px; }
.doc-item-chip:has(input:checked) {
  border-color: var(--brand-navy-700);
  background: linear-gradient(180deg, rgba(173, 156, 130, 0.04), var(--bg-base) 60%);
}

/* ───── Share modal — scope of items being shared ───── */
.share-scope {
  margin: 12px 0;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border-left: 3px solid var(--brand-navy-500);
  border-radius: var(--r-sm);
  font-size: 13px;
}
.share-scope > .form-row__label,
.share-scope > label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
}
.share-scope-row {
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}
.share-scope-row:last-child { border-bottom: none; }

/* ───── Performance / KPI Dashboard page ───── */
.perf-employee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  padding: 16px 20px;
}
.perf-emp-card {
  padding: 14px 16px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  border-left: 4px solid var(--border);
}
.perf-emp-card--good { border-left-color: var(--status-green); }
.perf-emp-card--flat { border-left-color: var(--status-blue); }
.perf-emp-card--bad  { border-left-color: var(--status-red); }

.perf-emp-card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.perf-emp-card__head > .avatar { flex-shrink: 0; }
.perf-emp-card__head > div:nth-child(2) { flex: 1; min-width: 0; }
.perf-emp-card__head strong { display: block; font-size: 14px; }
.perf-emp-card__head small  { display: block; font-size: 11px; }
.perf-emp-card__score { text-align: right; }
.perf-emp-card__score-val {
  font-size: 22px; font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--brand-navy-700);
  line-height: 1;
}
.perf-emp-card--good .perf-emp-card__score-val { color: var(--status-green); }
.perf-emp-card--bad  .perf-emp-card__score-val { color: var(--status-red); }

.perf-emp-card__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.perf-emp-card__stats > div {
  padding: 6px 8px;
  background: var(--bg-subtle);
  border-radius: var(--r-sm);
  text-align: center;
}
.perf-emp-card__stats label {
  display: block; font-size: 9px; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .04em;
}
.perf-emp-card__stats strong {
  display: block; font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--brand-navy-700);
  margin-top: 2px;
}

.perf-emp-card__bar-row {
  display: flex; height: 8px;
  border-radius: 4px; overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
}
.perf-bar-seg { display: block; height: 100%; }
.perf-bar-seg--green  { background: var(--status-green); }
.perf-bar-seg--yellow { background: var(--status-yellow); }
.perf-bar-seg--red    { background: var(--status-red); }
.perf-bar-seg--grey   { background: var(--text-disabled); }
.perf-emp-card__bar-legend {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 6px;
  font-size: 11px;
}
.perf-emp-card__bar-legend small {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--text-secondary);
}
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot--green  { background: var(--status-green); }
.dot--yellow { background: var(--status-yellow); }
.dot--red    { background: var(--status-red); }
.dot--grey   { background: var(--text-disabled); }

/* ───── Share Invoice modal — modern card layout ───── */
.share-card {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* Hero summary banner with invoice info */
.share-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  background: linear-gradient(135deg, rgba(173, 156, 130,0.08) 0%, rgba(173, 156, 130,0.02) 100%);
  border: 1px solid rgba(173, 156, 130,0.18);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}
.share-hero::before {
  content: '';
  position: absolute; top: 0; right: 0; width: 160px; height: 100%;
  background: radial-gradient(circle at top right, rgba(173, 156, 130,0.10), transparent 70%);
  pointer-events: none;
}
.share-hero__icon {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-navy-500);
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 14px rgba(173, 156, 130,0.28);
  flex-shrink: 0;
  font-size: 22px;
}
.share-hero__meta { flex: 1; min-width: 0; z-index: 1; }
.share-hero__label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--brand-navy-700, #AD9C82);
  margin-bottom: 2px;
}
.share-hero__no {
  font-family: 'JetBrains Mono', monospace;
  font-size: 19px; font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.01em;
}
.share-hero__sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
}
.share-hero__chips {
  display: flex; gap: 6px; flex-shrink: 0; z-index: 1;
}
.share-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(173, 156, 130,0.15);
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  color: var(--brand-navy-700, #AD9C82);
  white-space: nowrap;
}

/* Section blocks (Recipients / Message / Attachment) */
.share-section {
  display: flex; flex-direction: column; gap: 12px;
}
.share-section__title {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-primary);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.share-section__num {
  width: 22px; height: 22px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-navy-500); color: #fff;
  border-radius: 50%;
  font-size: 11px; font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.share-section__hint {
  margin-left: auto;
  font-size: 11px; font-weight: 500;
  color: var(--text-secondary);
  text-transform: none; letter-spacing: 0;
}

/* Field with icon + badge */
.share-field { display: flex; flex-direction: column; gap: 6px; }
.share-field__label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
}
.share-field__label svg {
  color: var(--brand-navy-500);
  width: 14px; height: 14px;
  flex-shrink: 0;
}
.share-field__req { color: var(--status-red, #dc2626); font-weight: 700; }
.share-field__badge {
  margin-left: auto;
  padding: 3px 9px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 10px; font-weight: 600;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  transition: all .15s;
}
.share-field__badge--active {
  background: rgba(173, 156, 130,0.10);
  border-color: rgba(173, 156, 130,0.30);
  color: var(--brand-navy-700, #AD9C82);
}
.share-field__input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-base);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  transition: border-color .15s, box-shadow .15s;
}
.share-field__input::placeholder { color: var(--text-disabled); }
.share-field__input:hover {
  border-color: rgba(173, 156, 130,0.30);
}
.share-field__input:focus {
  outline: none;
  border-color: var(--brand-navy-500);
  box-shadow: 0 0 0 3px rgba(173, 156, 130,0.14);
}
textarea.share-field__input {
  min-height: 180px;
  resize: vertical;
  line-height: 1.55;
  font-family: inherit;
}
.share-field__hint {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 5px;
  padding-left: 2px;
}
.share-field__hint svg {
  width: 12px; height: 12px;
  color: var(--text-disabled);
  flex-shrink: 0;
}

/* Attachment card — premium feel */
.share-attach-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--bg-base);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
  position: relative;
}
.share-attach-card:hover {
  border-color: var(--brand-navy-500);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.share-attach-card.is-included {
  border-color: var(--brand-navy-500);
  background: linear-gradient(135deg, rgba(173, 156, 130,0.04), transparent 70%);
}
.share-attach-card__icon {
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(173, 156, 130,0.10);
  color: var(--brand-navy-500);
  border-radius: 10px;
  flex-shrink: 0;
}
.share-attach-card__icon svg { width: 22px; height: 22px; }
.share-attach-card__body { flex: 1; min-width: 0; }
.share-attach-card__name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; font-weight: 600;
  color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.share-attach-card__meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 3px;
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.share-attach-card__meta span { display: inline-flex; align-items: center; gap: 3px; }
.share-attach-card__meta .sep { color: var(--text-disabled); }
.share-attach-card__switch {
  display: inline-flex; align-items: center; gap: 8px;
  flex-shrink: 0;
  padding: 6px 12px 6px 6px;
  background: var(--bg-subtle);
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
}
.share-attach-card.is-included .share-attach-card__switch {
  background: rgba(173, 156, 130,0.10);
  color: var(--brand-navy-700, #AD9C82);
}
.share-attach-card__switch input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--brand-navy-500);
  cursor: pointer;
  margin: 0;
}

/* Footer buttons in share modal */
.share-foot-info {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 5px;
  margin-right: auto;
}
.share-foot-info svg { width: 13px; height: 13px; color: var(--text-disabled); }

/* ───── Account edit modal — sectioned layout ───── */
.acc-edit { display: flex; flex-direction: column; gap: 20px; }

/* Identity hero */
.acc-hero {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(173, 156, 130,0.07) 0%, rgba(173, 156, 130,0.02) 100%);
  border: 1px solid rgba(173, 156, 130,0.18);
  border-radius: 12px;
}
.acc-hero__avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--brand-navy-500);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
  letter-spacing: .02em;
  box-shadow: 0 6px 14px rgba(173, 156, 130,0.28);
  flex-shrink: 0;
}
.acc-hero__meta { flex: 1; min-width: 0; }
.acc-hero__name {
  font-size: 16px; font-weight: 700;
  color: var(--text-primary);
}
.acc-hero__sub {
  font-size: 12px; color: var(--text-secondary);
  margin-top: 2px;
}
.acc-hero__status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}
.acc-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
}
.acc-status-dot.is-active   { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,0.18); }
.acc-status-dot.is-inactive { background: #9ca3af; box-shadow: 0 0 0 3px rgba(156,163,175,0.18); }

/* Sections */
.acc-section { display: flex; flex-direction: column; gap: 12px; }
.acc-section__title {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-primary);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.acc-section__num {
  width: 22px; height: 22px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-navy-500); color: #fff;
  border-radius: 50%;
  font-size: 11px; font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.acc-section__hint {
  margin-left: auto;
  font-size: 11px; font-weight: 500;
  color: var(--text-secondary);
  text-transform: none; letter-spacing: 0;
}

/* Grid for fields */
.acc-grid { display: grid; gap: 14px; }
.acc-grid--3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 720px) { .acc-grid--3 { grid-template-columns: 1fr; } }

.acc-field { display: flex; flex-direction: column; gap: 6px; }
.acc-field > label {
  font-size: 11px; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .04em;
}
.acc-input {
  width: 100%;
  padding: 10px 13px;
  background: var(--bg-base);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  transition: border-color .15s, box-shadow .15s;
}
.acc-input:hover:not([readonly]) { border-color: rgba(173, 156, 130,0.30); }
.acc-input:focus {
  outline: none;
  border-color: var(--brand-navy-500);
  box-shadow: 0 0 0 3px rgba(173, 156, 130,0.14);
}
.acc-input[readonly] {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  cursor: not-allowed;
}

/* Countries — single long horizontal scrollable row */
.acc-countries-strip {
  position: relative;
  padding: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.acc-country-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  /* Vertical padding gives chips room for hover lift + focus ring without clipping */
  padding: 10px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(173, 156, 130,0.30) transparent;
}
.acc-country-chips::-webkit-scrollbar { height: 6px; }
.acc-country-chips::-webkit-scrollbar-track { background: transparent; }
.acc-country-chips::-webkit-scrollbar-thumb {
  background: rgba(173, 156, 130,0.30);
  border-radius: 3px;
}
.acc-country-chips::-webkit-scrollbar-thumb:hover { background: var(--brand-navy-500); }

/* Right-edge fade hint that more chips exist (above the scrollbar) */
.acc-countries-strip::after {
  content: '';
  position: absolute;
  top: 6px; right: 6px; bottom: 12px; width: 32px;
  pointer-events: none;
  background: linear-gradient(to right, transparent, var(--bg-subtle) 70%);
  border-radius: 0 8px 8px 0;
}

.acc-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  background: var(--bg-base);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-size: 12px; font-weight: 500;
  font-family: inherit;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  outline: none;                    /* kill browser default red/blue ring */
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .15s;
}
.acc-chip:hover {
  border-color: var(--brand-navy-500);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(173, 156, 130,0.14);
}
.acc-chip:focus-visible {
  border-color: var(--brand-navy-500);
  box-shadow: 0 0 0 3px rgba(173, 156, 130,0.20);
}
.acc-chip:active { transform: translateY(0); }
.acc-chip.is-active {
  background: var(--brand-navy-700, #AD9C82);
  border-color: var(--brand-navy-700, #AD9C82);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(173, 156, 130,0.30);
}
.acc-chip.is-active:hover {
  box-shadow: 0 4px 12px rgba(173, 156, 130,0.40);
}
.acc-chip .flag { border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,0.08); }
.acc-chip.is-active .flag { box-shadow: 0 0 0 1px rgba(255,255,255,0.30); }
.acc-chip--all svg { opacity: .8; }
.acc-chip--all.is-active svg { opacity: 1; }

/* Status toggle — two cards side by side */
.acc-status-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.acc-status-btn {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 4px;
  padding: 12px 16px;
  background: var(--bg-base);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px; font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all .15s;
  text-align: left;
}
.acc-status-btn > span:first-of-type {
  display: inline-flex; align-items: center; gap: 6px;
}
.acc-status-btn svg { color: var(--text-disabled); flex-shrink: 0; }
.acc-status-btn small {
  font-size: 11px; font-weight: 400;
  color: var(--text-secondary);
  padding-left: 20px;
}
.acc-status-btn:hover { border-color: var(--brand-navy-500); }

/* Active state — green for "Active" / red for "Deactivate" */
.acc-status-toggle[data-active="1"] #accSetActive {
  background: linear-gradient(135deg, rgba(22,163,74,0.10), rgba(22,163,74,0.03));
  border-color: #16a34a;
  color: #14532d;
}
.acc-status-toggle[data-active="1"] #accSetActive svg { color: #16a34a; }
.acc-status-toggle[data-active="1"] #accSetActive small { color: #166534; }

.acc-status-toggle[data-active="0"] #accSetInactive {
  background: linear-gradient(135deg, rgba(220,38,38,0.10), rgba(220,38,38,0.03));
  border-color: #dc2626;
  color: #7f1d1d;
}
.acc-status-toggle[data-active="0"] #accSetInactive svg { color: #dc2626; }
.acc-status-toggle[data-active="0"] #accSetInactive small { color: #991b1b; }

/* ───── Sales Invoice editor — Total Amount cell wide enough for big numbers ───── */
.sinv-amount-cell {
  text-align: right;
  white-space: nowrap;
  min-width: 130px;
  padding-right: 14px !important;
  color: var(--brand-navy-700);
}

/* ───── Sales Invoice editor totals + commercial invoice preview ───── */
.sinv-totals { display: inline-flex; gap: 18px; align-items: center; }
.sinv-totals > div {
  padding: 6px 12px;
  background: var(--bg-subtle);
  border-radius: var(--r-sm);
  text-align: center;
}
.sinv-totals label {
  display: block; font-size: 10px; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .04em;
}
.sinv-totals strong { font-family: 'JetBrains Mono', monospace; font-size: 14px; }

/* Commercial invoice document (preview / print) */
.commercial-invoice {
  background: white;
  color: #000;
  padding: 32px 40px;
  font-family: 'Times New Roman', Georgia, serif;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  max-width: 820px;
  margin: 0 auto;
}
.ci-header { text-align: center; margin-bottom: 8px; }
.ci-header h1 { font-size: 18px; font-weight: 800; margin: 0 0 6px; letter-spacing: .02em; }
.ci-header p  { margin: 2px 0; font-size: 12px; }
.ci-title {
  text-align: center;
  font-weight: 700;
  margin: 14px 0;
  font-size: 13px;
  line-height: 1.4;
}
.ci-meta-row {
  display: flex; gap: 24px;
  margin-bottom: 16px;
  font-size: 12px;
}
.ci-meta-left  { flex: 1; line-height: 1.6; }
.ci-meta-right { flex: 1; line-height: 1.6; text-align: right; }
.ci-meta-row strong { font-weight: 700; }

.ci-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-bottom: 16px;
}
.ci-table th, .ci-table td {
  border: 1px solid #444;
  padding: 5px 8px;
}
.ci-table th {
  background: #f3f4f6;
  font-weight: 700;
  text-align: center;
  font-size: 10px;
}
.ci-table td.num { text-align: right; font-family: 'JetBrains Mono', monospace; }
.ci-table tfoot td { background: #fef3c7; font-weight: 700; }

.ci-summary {
  display: flex; justify-content: flex-end; gap: 32px;
  padding-top: 12px;
  border-top: 2px solid #444;
  font-size: 12px;
}
.ci-summary > div { text-align: right; }
.ci-summary label {
  display: block; font-size: 10px; color: #444;
  text-transform: uppercase; letter-spacing: .04em;
}
.ci-summary strong { font-family: 'JetBrains Mono', monospace; font-size: 14px; }

/* Print styles — show only the invoice when user prints */
@media print {
  body * { visibility: hidden; }
  .modal-root, .modal-root * { visibility: visible; }
  .modal__head, .modal__foot { display: none !important; }
  .modal-root .modal { box-shadow: none; border: none; max-width: 100%; }
  .commercial-invoice { border: none; padding: 0; }
}

/* ───── Web Integrations cards (Settings → Function Links) ───── */
.web-integrations-list {
  padding: 12px 20px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.web-int-card {
  padding: 16px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  border-left: 4px solid #AD9C82;
}
.web-int-card__head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.web-int-card__title { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.web-int-card__icon { font-size: 28px; line-height: 1; }
.web-int-card__title strong { font-size: 15px; }
.web-int-card__title small  { font-size: 11px; }

.web-int-card__fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 16px;
  margin-bottom: 14px;
}
@media (max-width: 800px) { .web-int-card__fields { grid-template-columns: 1fr; } }
.web-int-card__fields .form-row { margin: 0; }
.web-int-card__fields input,
.web-int-card__fields select {
  width: 100%; height: 32px; padding: 0 10px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
}
.web-int-card__pwd {
  display: flex; gap: 4px; align-items: center;
}
.web-int-card__pwd input { flex: 1; }

.web-int-card__tasks { margin-bottom: 14px; }
.web-int-card__tasks-label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: 8px;
}

.web-int-card__actions {
  display: flex; gap: 8px; align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* Add-Person dropdown for JD/KPI evaluation list */
.perf-jd-add-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 100;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  padding: 6px;
}
.perf-jd-add-dropdown__head {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 8px 10px 4px;
}
.perf-jd-add-dropdown__item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
}
.perf-jd-add-dropdown__item:hover { background: var(--bg-subtle); }
.perf-jd-add-dropdown__item strong { font-size: 13px; }
.perf-jd-add-dropdown__item small  { font-size: 11px; }

/* JD / KPI bulleted list (per-employee, add / remove items) */
.jd-list {
  display: flex; flex-direction: column; gap: 6px;
}
.jd-item {
  display: flex; align-items: center; gap: 6px;
}
.jd-item__bullet {
  flex-shrink: 0;
  color: var(--brand-navy-500);
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
}
.jd-item input {
  flex: 1; min-width: 0;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-base);
  font-size: 12px;
  font-family: inherit;
}
.jd-item input:focus {
  outline: 2px solid rgba(173, 156, 130,0.2);
  border-color: var(--brand-navy-500);
}
.jd-add-btn {
  align-self: flex-start;
  margin-top: 4px;
  font-size: 11px !important;
  padding: 4px 10px !important;
  color: var(--brand-navy-700) !important;
  border: 1px dashed var(--border) !important;
}
.jd-add-btn:hover {
  border-color: var(--brand-navy-500) !important;
  background: var(--bg-subtle) !important;
}

/* Performance JD/KPI per-row Save button — disabled/saved/dirty/flashing states */
.perf-jd-save-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.perf-jd-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 90px;
  justify-content: center;
  transition: background .2s, color .2s, transform .15s, box-shadow .15s;
}
/* Default state — no edits yet → "Saved" with a green check, disabled */
.perf-jd-save-btn:disabled {
  background: var(--bg-subtle) !important;
  color: var(--status-green, #16a34a) !important;
  border: 1px solid rgba(22,163,74,0.30) !important;
  cursor: default;
  opacity: 1;
}
.perf-jd-save-btn:disabled .perf-jd-save-icon { color: var(--status-green, #16a34a); }
/* Dirty state — user has edited → become prominent navy "Save" */
.perf-jd-save-btn.is-dirty {
  background: var(--brand-navy-500) !important;
  color: #fff !important;
  border-color: var(--brand-navy-500) !important;
  box-shadow: 0 2px 8px rgba(173, 156, 130,0.25);
}
.perf-jd-save-btn.is-dirty:hover {
  background: var(--brand-navy-700) !important;
  border-color: var(--brand-navy-700) !important;
  transform: translateY(-1px);
}
.perf-jd-save-btn.is-dirty .perf-jd-save-icon { color: #fff; }
/* Brief flash animation right after saving — confirms the click registered */
.perf-jd-save-btn.is-flashing {
  animation: perf-jd-save-pulse .8s cubic-bezier(.4, 0, .2, 1);
}
@keyframes perf-jd-save-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(22,163,74,0.50); }
  60%  { box-shadow: 0 0 0 10px rgba(22,163,74,0.00); }
  100% { box-shadow: 0 0 0 0 rgba(22,163,74,0.00); }
}
/* "Unsaved changes" hint that appears below the button when dirty */
.perf-jd-dirty-hint {
  font-size: 10px;
  font-weight: 600;
  color: var(--status-yellow, #d97706);
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

/* AI Insights list */
.perf-ai-insights {
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 8px;
}
.perf-insight {
  padding: 10px 14px;
  border-radius: var(--r-sm);
  border-left: 3px solid var(--border);
  background: var(--bg-base);
  font-size: 13px;
  line-height: 1.5;
}
.perf-insight--good { border-left-color: var(--status-green); background: rgba(34, 197, 94, 0.06); }
.perf-insight--warn { border-left-color: var(--status-yellow); background: rgba(242, 169, 59, 0.08); }
.perf-insight--bad  { border-left-color: var(--status-red);    background: rgba(239, 68, 68, 0.06); }
.perf-insight--info { border-left-color: var(--status-blue);   background: rgba(44, 123, 229, 0.06); }

/* ───── Original-price annotation (shown below converted prices) ───── */
.og-price {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-style: italic;
  color: var(--status-red);
  margin-top: 2px;
  white-space: nowrap;
}

/* ───── FX cross-rate form (Settings → Countries) ───── */
.fx-cross-form { font-size: 13px; }
.fx-cross-row {
  display: inline-flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  padding: 8px 0;
}
.fx-cross-tok {
  font-size: 18px; font-weight: 700;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
}
.fx-cross-select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-base);
  font-size: 14px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: var(--brand-navy-700);
  min-width: 90px;
}
.fx-cross-amt {
  width: 130px;
  height: 34px;
  padding: 0 10px;
  text-align: right;
  border: 1px solid var(--brand-navy-500);
  border-radius: var(--r-sm);
  background: var(--bg-base);
  font-size: 15px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--brand-navy-700);
}
.fx-cross-amt:focus { outline: 2px solid rgba(173, 156, 130,0.25); }
.fx-cross-inverse {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.fx-cross-inverse strong { color: var(--text-primary); }
.fx-cross-via { margin-top: 4px; font-size: 12px; }

/* Flash animation when a saved cross-rate is loaded into the form */
@keyframes fxCrossFlashAnim {
  0%   { background: rgba(173, 156, 130, 0.22); box-shadow: 0 0 0 3px rgba(173, 156, 130, 0.35); }
  100% { background: var(--bg-subtle);           box-shadow: 0 0 0 0   rgba(173, 156, 130, 0);    }
}
.fx-cross-flash {
  animation: fxCrossFlashAnim 1.4s ease-out;
}

/* ───── Saved cross-rates list ───── */
.fx-cross-saved {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.fx-cross-saved:empty { display: none; }
.fx-cross-saved__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
}
.fx-cross-saved__head strong { color: var(--brand-navy-700); }
.fx-cross-saved__list {
  display: flex; flex-direction: column; gap: 6px;
}
.fx-cross-saved__row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-left: 3px solid #AD9C82;
  border-radius: var(--r-sm);
  font-size: 13px;
}
.fx-cross-saved__pair {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 0;
}
.fx-cross-saved__eq { color: var(--text-secondary); font-weight: 600; }
.fx-cross-saved__actions {
  display: inline-flex; gap: 6px; align-items: center; flex-shrink: 0;
}

/* ───── Master Data → Cost (landed cost) table ───── */
.table--cost { font-size: 12px; }
.table--cost thead th { vertical-align: middle; padding: 8px 10px; }
.table--cost thead tr:first-child th[colspan] {
  background: linear-gradient(180deg, rgba(173, 156, 130,0.06), transparent);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 11px;
  color: var(--brand-navy-700);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.table--cost tbody td { padding: 10px 10px; vertical-align: middle; }

/* CBM picker cell — radio + value + unit label, click anywhere on the cell to pick */
.cbm-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-base);
  cursor: pointer;
  transition: all .12s;
  font-size: 12px;
}
.cbm-cell:hover { border-color: var(--brand-navy-500); }
.cbm-cell--active {
  background: linear-gradient(180deg, rgba(173, 156, 130,0.08), var(--bg-base) 60%);
  border-color: var(--brand-navy-700);
  box-shadow: 0 0 0 2px rgba(173, 156, 130,0.12);
}
.cbm-cell--active .cbm-cell__val { color: var(--brand-navy-700); }
.cbm-cell--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--bg-subtle);
}
.cbm-cell input[type="radio"] {
  margin: 0;
  cursor: inherit;
  accent-color: var(--brand-navy-700);
}
.cbm-cell__val {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  min-width: 56px;
  text-align: right;
}

/* ───── Cost Forecast ───── */
.cf-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 20px;
}
.cf-filter-grid .form-row--wide { grid-column: 1 / -1; }
@media (max-width: 900px) { .cf-filter-grid { grid-template-columns: 1fr; } }

.cf-country-chips,
.cf-month-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
/* History — Refresh button with live countdown pill */
.hist-refresh-btn {
  display: inline-flex; align-items: center; gap: 8px;
  margin-left: auto;       /* push to the far right of the filter bar */
}
.hist-refresh-btn .hist-refresh-icon {
  transition: transform .25s var(--ease, ease);
}
.hist-refresh-btn:hover .hist-refresh-icon {
  transform: rotate(-90deg);
}
.hist-refresh-btn.is-refreshing .hist-refresh-icon {
  animation: hist-refresh-spin .7s cubic-bezier(.4, 0, .2, 1);
}
@keyframes hist-refresh-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.hist-refresh-countdown {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px;
  padding: 2px 8px;
  background: rgba(173, 156, 130,0.10);
  color: var(--brand-navy-700, #AD9C82);
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: background .2s, color .2s;
  white-space: nowrap;
}
/* When countdown ≤ 10s — orange warning tone so user notices the imminent refresh */
.hist-refresh-countdown.is-soon {
  background: rgba(217, 119, 6, 0.12);
  color: #c2410c;
}

/* History page — Pick Months row sits between the filter bar and the table */
.hist-months-row {
  display: flex; flex-direction: column; gap: 8px;
  padding: 4px 4px 16px;
}
.hist-months-row > label {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .04em;
}
.cf-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-primary);
  cursor: pointer;
  transition: all .12s;
}
.cf-chip:hover { border-color: var(--brand-navy-500); }
.cf-chip.active {
  background: var(--brand-navy-700);
  border-color: var(--brand-navy-700);
  color: #fff;
}
.cf-chip.active .flag { filter: brightness(1.2); }

/* Items column — stack each item code on its own line */
.items-stacked { display: block; line-height: 1.5; font-family: 'JetBrains Mono', monospace; font-size: 12px; }
/* Item line — height matches Ex. Rate row (input 26px + 6px margin = 32px) so columns line up */
.item-line {
  height: 26px;
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  line-height: 1.2;
}
.item-line:last-child { margin-bottom: 0; }
/* Item Prices column: align right + center vertically per line */
#payTable td.num .item-line { justify-content: flex-end; }

/* Money cell with editable amount + currency picker */
.money-cell { display: inline-flex; align-items: center; gap: 4px; justify-content: flex-end; min-width: 130px; }
.money-cell__readonly { display: inline-flex; align-items: baseline; gap: 4px; }
.money-cell__amt { font-family: 'JetBrains Mono', monospace; font-weight: 500; }
.money-cell__ccy { color: var(--text-secondary); font-size: 11px; font-weight: 400; }
.money-cell__edit { display: inline-flex; align-items: center; gap: 4px; }
.money-cell__amt-input {
  width: 80px; height: 26px; padding: 0 6px;
  text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 12px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg-base);
}
.money-cell__ccy-btn {
  display: inline-flex; align-items: center; gap: 4px;
  height: 26px; padding: 0 6px;
  text-transform: uppercase;
  font-size: 11px; font-weight: 600;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg-base);
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
}
.money-cell__ccy-btn:hover { border-color: var(--brand-navy-500); }
.money-cell__amt-input:focus { border-color: var(--brand-navy-500); outline: none; }

/* Currency picker popover */
.currency-popover { padding: 12px 14px; }
.currency-popover .popover__list { flex: 1; overflow-y: auto; min-height: 0; }
.currency-popover .popover__group-label {
  font-size: 10px; font-weight: 700; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .04em;
  padding: 8px 4px 4px; margin-top: 4px;
  border-top: 1px solid var(--border);
}
.currency-popover .popover__group-label:first-child { border-top: none; margin-top: 0; }
.currency-popover .ccy-item {
  display: flex; align-items: baseline; gap: 10px;
  width: 100%; padding: 8px 10px;
  background: transparent; border: none; border-radius: var(--r-sm);
  cursor: pointer;
  text-align: left;
}
.currency-popover .ccy-item:hover { background: var(--bg-subtle); }
.currency-popover .ccy-item.is-selected { background: var(--brand-navy-100); color: var(--brand-navy-700); font-weight: 600; }
.currency-popover .ccy-code { font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 12px; min-width: 40px; }
.currency-popover .ccy-name { font-size: 12px; color: var(--text-secondary); flex: 1; }
.currency-popover .ccy-item.is-selected .ccy-name { color: var(--brand-navy-700); }
.money-cell__btn { width: 22px; height: 22px; flex-shrink: 0; }
.money-cell__btn svg { width: 11px; height: 11px; }

/* Pay-date cell */
.td-pay-date .dmy-date { width: 130px; }

/* Payment table — keep code-style cells (Invoice no, GPO/Shipment no) on one line */
#payTable th, #payTable td { white-space: nowrap; }
#payTable td .font-mono { white-space: nowrap; }
/* Allow stacked content (items list, item prices, party names) to wrap normally */
#payTable td .items-stacked,
#payTable td .party-input { white-space: normal; }

/* Seller / Buyer / Consignee combobox cells (datalist auto-complete + auto-learn) */
.td-party,
.td-consignee { min-width: 160px; max-width: 220px; }
.party-input {
  width: 100%; height: 28px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-base); color: var(--text-primary);
  font-size: 12px;
}
.party-input:focus { border-color: var(--brand-navy-500); outline: none; }
.party-input:hover { border-color: var(--brand-navy-300); }

/* Exchange rate cell — one row per item; horizontal layout: [rate] + date (red) + 📅 */
.td-ex-rate { min-width: 200px; padding: 6px 10px !important; vertical-align: top; }
.ex-rate-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 6px;
  white-space: nowrap;
}
.ex-rate-row:last-child { margin-bottom: 0; }
.ex-rate-row > input[type="number"] {
  width: 80px; height: 26px; padding: 0 6px;
  text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 11px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-base);
}
.ex-rate-row > input[type="number"]:focus { border-color: var(--brand-navy-500); outline: none; }
.ex-rate-date-text {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--status-red);
  font-weight: 600;
  letter-spacing: .02em;
}
.ex-rate-date-input {
  position: absolute; opacity: 0; pointer-events: none;
  width: 1px; height: 1px;
}
.ex-rate-cal-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; padding: 0;
  color: var(--status-red);
  cursor: pointer;
}
.ex-rate-cal-btn:hover { color: var(--brand-navy-500); }

/* Payment workflow status — pill-style button (clickable) */
.pay-status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px; font-weight: 500;
  cursor: pointer;
  background: var(--bg-base);
  white-space: nowrap;
  transition: filter 120ms var(--ease);
}
.pay-status:hover { filter: brightness(0.96); }
.pay-status__dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.pay-status__dot--blue   { background: var(--status-blue); }
.pay-status__dot--yellow { background: var(--status-yellow); }
.pay-status__dot--green  { background: var(--status-green); }
.pay-status__dot--grey   { background: var(--text-secondary); }
.pay-status--grey   { background: rgba(107, 114, 128, 0.10); color: #4b5563;              border-color: rgba(107, 114, 128, 0.30); }
.pay-status--grey   .pay-status__dot { background: #9ca3af; }
.pay-status--blue   { background: rgba(44, 123, 229, 0.10);  color: var(--status-blue);   border-color: rgba(44, 123, 229, 0.25); }
.pay-status--blue   .pay-status__dot { background: var(--status-blue); }
.pay-status--yellow { background: rgba(242, 169, 59, 0.12);  color: #8b5d12;              border-color: rgba(242, 169, 59, 0.30); }
.pay-status--yellow .pay-status__dot { background: var(--status-yellow); }
.pay-status--orange { background: rgba(234, 88, 12, 0.10);   color: #c2410c;              border-color: rgba(234, 88, 12, 0.30); }
.pay-status--orange .pay-status__dot { background: #ea580c; }
.pay-status--green  { background: rgba(31, 174, 106, 0.12);  color: #14724a;              border-color: rgba(31, 174, 106, 0.30); }
.pay-status--green  .pay-status__dot { background: var(--status-green); }
/* Match dot tone in popover items */
.pay-status__dot--grey   { background: #9ca3af !important; }
.pay-status__dot--blue   { background: var(--status-blue) !important; }
.pay-status__dot--yellow { background: var(--status-yellow) !important; }
.pay-status__dot--orange { background: #ea580c !important; }
.pay-status__dot--green  { background: var(--status-green) !important; }

/* Pay-status popover items */
.pay-status-popover { padding: 6px; min-width: 200px; }
.pay-status-item { display: flex; align-items: center; gap: 8px; }
.pay-status-item.is-selected { background: var(--brand-navy-100); color: var(--brand-navy-700); font-weight: 600; }

/* Document checklist */
.docs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.doc-item { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; background: var(--bg-base); border: 1px solid var(--border); border-radius: var(--r-md); }
.doc-item__topline { display: flex; align-items: center; gap: 12px; width: 100%; }
.doc-item__files { display: flex; flex-direction: column; gap: 4px; padding-left: 32px; }
.doc-item__file-chip {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px;
  background: var(--bg-subtle, #faf7f0);
  border: 1px solid var(--border, #e5e1d6);
  border-radius: var(--r-sm, 6px);
  font-size: 11px;
}
.doc-item__file-name {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary, #6b7280);
}
.icon-btn--xs {
  padding: 2px 4px !important;
  height: 22px !important; width: 22px !important;
  min-height: 0 !important;
}
.icon-btn--xs:hover { background: rgba(0,0,0,0.05); }
.icon-btn--xs.icon-btn--danger:hover { background: rgba(239,68,68,0.10); color: #dc2626; }
.doc-item__icon { width: 36px; height: 36px; border-radius: var(--r-sm); background: var(--bg-subtle); display: flex; align-items: center; justify-content: center; color: var(--text-secondary); flex-shrink: 0; font-weight: 700; }
.doc-item--green   .doc-item__icon { background: rgba(31,174,106,.12); color: var(--status-green); }
.doc-item--yellow  .doc-item__icon { background: rgba(242,169,59,.12); color: var(--status-yellow); }
.doc-item--blue    .doc-item__icon { background: rgba(44,123,229,.10); color: var(--status-blue); }
.doc-item__info { flex: 1; min-width: 0; }
.doc-item__info strong { display: block; }
.doc-item__info span { color: var(--text-secondary); font-size: 12px; }

/* Per-doc + button — circular icon at the bottom-right of every doc-item */
.doc-item--has-add { position: relative; padding-right: 40px; }
.doc-item__add-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--status-yellow, #d97706);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, transform .15s, box-shadow .15s;
  padding: 0;
}
.doc-item__add-btn:hover {
  background: rgba(217, 119, 6, 0.14);
  color: #b45309;
  transform: scale(1.08);
}
.doc-item__add-btn:active {
  transform: scale(0.95);
}
.doc-item__add-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.30);
}
/* Green/verified doc → + tinted green (it means "add another file") */
.doc-item--green  .doc-item__add-btn { color: var(--status-green, #16a34a); }
.doc-item--green  .doc-item__add-btn:hover { background: rgba(22,163,74,0.12); color: #15803d; }
/* Yellow/pending doc → + stays warm (default) */

/* Drawer */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--bg-elevated); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; z-index: 70; transform: translateX(0); transition: transform 260ms var(--ease); }
.drawer.hidden { transform: translateX(100%); display: flex !important; pointer-events: none; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer__head h3 { font-size: 16px; }
.drawer__head .topbar__icon { color: var(--text-secondary); }
.drawer__head .topbar__icon:hover { background: var(--bg-subtle); color: var(--text-primary); }
.drawer__tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.drawer__list { flex: 1; overflow-y: auto; padding: 4px 0; }
.drawer__foot { padding: 12px 16px; border-top: 1px solid var(--border); }

.notif-item { display: grid; grid-template-columns: 24px 1fr; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-item:hover { background: var(--bg-subtle); }
.notif-item:last-child { border-bottom: none; }
.notif-item__dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--status-grey); }
.notif-item--unread .notif-item__dot { background: var(--brand-navy-500); }
.notif-item--critical .notif-item__dot { background: var(--status-red); }
.notif-item--warning .notif-item__dot { background: var(--status-yellow); }
.notif-item--info .notif-item__dot { background: var(--status-blue); }
.notif-item__body strong { display: block; font-weight: 600; }
.notif-item__body p { margin: 2px 0; color: var(--text-secondary); font-size: 13px; }
.notif-item__body time { font-size: 11px; color: var(--text-disabled); }

/* Audit-log entries */
.audit-item { padding: 12px 20px; border-bottom: 1px solid var(--border); font-size: 13px; }
.audit-item time { color: var(--text-disabled); font-size: 11px; }
.audit-item .actor { font-weight: 600; }
.audit-item .action-tag { display: inline-block; padding: 1px 6px; border-radius: 999px; font-size: 11px; font-weight: 600; margin: 0 4px; }
.audit-item .action-tag--create { background: rgba(31,174,106,.12); color: var(--status-green); }
.audit-item .action-tag--update { background: rgba(44,123,229,.12); color: var(--status-blue); }
.audit-item .action-tag--delete { background: rgba(224,70,62,.12); color: var(--status-red); }
.audit-item .action-tag--upload { background: rgba(242,169,59,.12); color: var(--status-yellow); }
.audit-item .action-tag--approve, .audit-item .action-tag--confirm { background: rgba(31,174,106,.12); color: var(--status-green); }
.audit-item .action-tag--sync { background: var(--bg-subtle); color: var(--text-secondary); }
.audit-item .action-tag--move_to_history { background: var(--bg-subtle); color: var(--text-secondary); }
.audit-item .diff { margin-top: 4px; padding: 6px 8px; background: var(--bg-base); border-radius: var(--r-sm); font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-secondary); white-space: pre-wrap; word-break: break-all; }

/* Overlay */
.overlay { position: fixed; inset: 0; background: rgba(11,26,51,.5); z-index: 65; animation: fadeIn 200ms var(--ease); }
@keyframes fadeIn { from { opacity: 0; } }

/* Modal */
.modal-root { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-root .overlay { z-index: -1; }
.modal {
  position: relative;
  width: 100%; max-width: 720px; max-height: calc(100vh - 48px);
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal--lg { max-width: 960px; }
.modal--xl { max-width: 1280px; }
.modal--sm { max-width: 480px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal__body { padding: 20px; overflow-y: auto; flex: 1; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); }

/* Form */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; overflow: visible; }
.form-row label .req { color: var(--status-red); }
.form-row label small { text-transform: none; }    /* helper text shouldn't be uppercase */
.form-row { min-width: 0; }                          /* allow inputs to shrink in grid cells when label overflows */
.form-row > input,
.form-row > select,
.form-row > textarea,
.form-row > .currency-cell,
.form-row > .qty-with-unit,
.form-row > .dim-three,
.form-row > .country-tags,
.form-row > .check-grid,
.form-row > .dmy-date {
  align-self: stretch;   /* ensure inputs align even when adjacent labels wrap */
}
.form-row input, .form-row select, .form-row textarea {
  height: 38px; padding: 0 14px;
  background: var(--bg-base); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 14px;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.form-row textarea { height: auto; min-height: 80px; padding: 10px 14px; resize: vertical; line-height: 1.5; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  border-color: var(--brand-gold);
  outline: none;
  box-shadow: 0 0 0 3px rgba(173,156,130,0.18);
}
.form-row input[disabled], .form-row input[readonly] { background: var(--bg-subtle); color: var(--text-secondary); cursor: not-allowed; }
.form-row .help { font-size: 12px; color: var(--text-secondary); }
.form-section { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.form-section:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.form-section h4 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); }
.locked-hint { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--status-blue); font-weight: 500; }

/* Dropzone (doc upload) */
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--r-md); padding: 32px 24px; text-align: center; color: var(--text-secondary); cursor: pointer; transition: border-color 200ms var(--ease), background-color 200ms var(--ease); }
.dropzone:hover,
.dropzone--hover { border-color: var(--brand-navy-500); background: var(--brand-navy-100); color: var(--brand-navy-700); }
.dropzone--hover { border-style: solid; }
.dropzone strong { display: block; font-size: 15px; color: var(--text-primary); margin-bottom: 4px; }

/* Popover (RC details) */
.popover {
  position: absolute; z-index: 75;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 12px 14px;
  min-width: 280px; max-width: 360px;
  animation: fadeIn 150ms var(--ease);
}
.popover__head { font-weight: 600; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.popover .row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.popover .row span:first-child { color: var(--text-secondary); }
.popover__search { width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg-base); color: var(--text-primary); font-size: 13px; margin-bottom: 8px; box-sizing: border-box; }
.popover__search:focus { border-color: var(--brand-navy-500); outline: none; }
.popover__list { flex: 1; overflow-y: auto; min-height: 0; }
.popover__item { display: flex; align-items: center; width: 100%; padding: 8px 10px; background: transparent; border: none; border-radius: var(--r-sm); color: var(--text-primary); cursor: pointer; font-size: 13px; text-align: left; }
.popover__item:hover { background: var(--bg-subtle); }
.popover__foot { padding-top: 8px; margin-top: 8px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* Period badge in chart card */
.subnav + .filter-bar { margin-top: -4px; }

/* AI message — missing docs */
.ai-warn { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: rgba(242,169,59,.10); border: 1px solid rgba(242,169,59,.4); border-radius: var(--r-md); color: #8b5d12; font-weight: 500; margin-top: 16px; }
.ai-ok { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: rgba(31,174,106,.10); border: 1px solid rgba(31,174,106,.4); border-radius: var(--r-md); color: #14724a; font-weight: 500; margin-top: 16px; }

/* Settings table */
.permission-cell {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 600;
  padding: 4px 8px; border-radius: var(--r-sm);
  display: inline-block; min-width: 40px;
  text-align: center;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .12s;
}

/* ───── Permission info icon + hover tooltip ───── */
.perm-info-wrap {
  position: relative;
  display: inline-block;
  margin-left: 6px;
  vertical-align: middle;
}
/* Grouped permissions table — group header row + sub-function rows */
.perm-grouped-table .perm-group-header td {
  background: linear-gradient(90deg, var(--brand-black), #2a2624);
  color: var(--brand-gold);
  font-size: 12px;
  padding: 10px 18px;
  letter-spacing: .04em;
  border-top: 2px solid var(--brand-gold);
}
.perm-grouped-table .perm-group-header strong {
  color: #fff;
  font-size: 13px;
  letter-spacing: .03em;
}
.perm-grouped-table .perm-group-header small {
  color: rgba(255,255,255,0.55) !important;
  font-weight: 400;
  font-size: 11px;
}
.perm-group-header__icon {
  display: inline-block;
  margin-right: 6px;
  font-size: 14px;
  filter: saturate(0.9);
}
.perm-grouped-table .perm-group-row td {
  padding-left: 28px !important;
  text-align: left !important;
  border-bottom: 1px solid var(--border);
}
.perm-grouped-table .perm-resource-cell {
  font-weight: 500;
  color: var(--text-primary);
  padding-left: 36px !important;
  position: relative;
}
.perm-grouped-table .perm-resource-cell::before {
  content: '└';
  position: absolute;
  left: 16px;
  color: var(--brand-gold-dark);
  font-family: 'JetBrains Mono', monospace;
  opacity: .5;
}
.perm-select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.perm-select:hover { border-color: var(--brand-gold); }
.perm-select:focus {
  outline: none;
  border-color: var(--brand-gold);
  box-shadow: 0 0 0 3px rgba(173,156,130,0.18);
}

.perm-info-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: help;
  padding: 0;
  transition: all .12s;
}
.perm-info-icon:hover,
.perm-info-icon:focus {
  background: var(--brand-navy-500);
  color: #fff;
  border-color: var(--brand-navy-700);
  outline: none;
}
.perm-info-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  z-index: 1000;
  width: 320px;
  padding: 12px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.perm-info-tooltip--left  { left: -8px; }
.perm-info-tooltip--right { right: -8px; }
.perm-info-wrap:hover .perm-info-tooltip,
.perm-info-wrap:focus-within .perm-info-tooltip {
  display: block;
}
.perm-info-tooltip h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-navy-700);
}
.perm-info-tooltip hr {
  border: 0;
  border-top: 1px dashed var(--border);
  margin: 8px 0;
}
.perm-info-tooltip .perm-info-legend {
  display: flex; flex-direction: column; gap: 5px;
}
.perm-info-tooltip .perm-info-legend > div {
  display: flex; align-items: center; gap: 6px;
}
.perm-info-tooltip code {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-subtle);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  min-width: 28px;
  text-align: center;
  display: inline-block;
}
.perm-info-tooltip .permission-cell {
  cursor: default !important;
  pointer-events: none;
}

/* ───── Permission matrix — group section header rows ───── */
.perm-group-row td {
  background: linear-gradient(180deg, rgba(173, 156, 130,0.07), rgba(173, 156, 130,0.02));
  padding: 10px 16px !important;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--brand-navy-700);
  border-top: 2px solid var(--brand-navy-500);
}

/* ───── Quick Role Editor — group cards with inline selects ───── */
.role-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
}
.role-editor-group {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.role-editor-group__head {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--brand-navy-700);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}
.role-editor-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}
.role-editor-row:last-child { border-bottom: none; }
.role-editor-row__resource {
  flex: 1; min-width: 0;
  font-size: 13px;
  color: var(--text-primary);
}
.role-editor-row select:disabled {
  background: var(--bg-subtle) !important;
  color: var(--text-disabled);
  cursor: not-allowed;
}
button.permission-cell:hover:not(:disabled) {
  transform: scale(1.06);
  border-color: var(--brand-navy-500);
}
button.permission-cell:disabled {
  cursor: not-allowed;
  opacity: 0.75;
}
.perm-CRUD { background: rgba(31,174,106,.15); color: var(--status-green); }
.perm-RU { background: rgba(44,123,229,.15); color: var(--status-blue); }
.perm-R { background: var(--bg-subtle); color: var(--text-secondary); }
.perm-tick { background: rgba(31,174,106,.15); color: var(--status-green); }
.perm-dash { background: transparent; color: var(--text-disabled); }

/* Notif full list */
.notif-list-full .notif-item { padding: 16px 20px; }

/* ── Supplier row (in Add Product modal) ───────────────────────────────────── */
.supplier-row {
  padding: 12px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.supplier-row__main {
  display: grid;
  /* name | price | currency(+btn) | tax% | preTax | remove */
  grid-template-columns: minmax(160px, 1.6fr) 96px 132px 84px 116px 32px;
  gap: 10px;
  align-items: end;
}
.supplier-row__extra {
  display: grid;
  /* city | province | transit time */
  grid-template-columns: minmax(160px, 1.3fr) minmax(160px, 1.3fr) minmax(140px, 1fr);
  gap: 10px;
  align-items: end;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.supplier-row .form-row { min-width: 0; }   /* allow grid item to shrink */
.supplier-row .form-row input,
.supplier-row .form-row select { width: 100%; min-width: 0; padding: 0 10px; }
/* Truncate long supplier names with ellipsis when not focused */
.supplier-row .form-row input[data-field="name"] {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.supplier-row .form-row input[data-field="preTax"] {
  background: var(--bg-subtle);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  text-align: right;
  color: var(--text-secondary);
}
.supplier-row .form-row input[data-field="tax"] { text-align: right; padding: 0 8px; }
.supplier-row .form-row input[data-field="price"] { text-align: right; }

.supplier-row .currency-cell { display: flex; gap: 4px; align-items: stretch; min-width: 0; }
.supplier-row .currency-cell select { flex: 1; min-width: 0; padding: 0 8px; }
.supplier-row .currency-add-btn {
  flex-shrink: 0;
  width: 32px; height: 36px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
}
.supplier-row .currency-add-btn:hover { background: var(--brand-navy-100); color: var(--brand-navy-700); }
.supplier-row .supplier-remove-btn { margin-bottom: 4px; }

/* Grouped column headers in Shipping Master — Sea / Truck colour bands */
.col-group {
  text-align: center !important;
  font-weight: 600;
  border-left: 2px solid var(--border);
  border-right: 2px solid var(--border);
}
.col-group--sea    { background: rgba(44, 123, 229, 0.10); color: var(--brand-navy-700); }
.col-group--truck  { background: rgba(242, 169, 59, 0.12); color: #8b5d12; }
.col-group--reefer { background: rgba(14, 165, 233, 0.13); color: #0c4a6e; }
.col-group--air    { background: rgba(156, 91, 210, 0.12); color: #6e3b9c; }
.col-group--rail   { background: rgba(31, 174, 106, 0.12); color: #18804d; }
/* Per-Product Freight: "Freight Used" column — highlighted (chosen rate) */
.col-used { background: rgba(13, 148, 136, 0.10); border-left: 2px solid var(--brand-navy-500); }
thead .col-used { color: var(--brand-navy-700); }
.table--wide thead tr:first-child .col-group--sea + .col-group { border-left: 2px solid var(--border-strong); }

/* Methods checkbox grid (Add Forwarder modal) */
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
/* Inline variant: lays chips side-by-side (used inside form-row, e.g. Service Type) */
/* nowrap + min-width:0 keeps chips on one row even when the parent column shrinks */
.check-grid--inline {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
}
.check-grid--inline .method-chip {
  padding: 6px 10px;
  font-size: 12px;
  flex: 1 1 0;            /* equal share of available width */
  min-width: 0;
  white-space: nowrap;
  justify-content: center;
}
.method-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-base);
  cursor: pointer;
  font-size: 13px;
  user-select: none;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.method-chip:hover { background: var(--bg-subtle); }
.method-chip:has(input:checked) {
  background: var(--brand-navy-100);
  border-color: var(--brand-navy-500);
  color: var(--brand-navy-700);
  font-weight: 500;
}
.method-chip input[type="checkbox"] { accent-color: var(--brand-navy-500); }

/* Inline info button (ⓘ) — used in column headers to open detail popups */
.info-btn {
  background: transparent;
  border: none;
  color: var(--brand-navy-500);
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}
.info-btn svg { width: 14px; height: 14px; }
.info-btn:hover { background: var(--brand-navy-100); color: var(--brand-navy-700); }

/* ── Real flag images (PNG from flagcdn.com) ─────────────────────────────────
   Avoids the Windows issue where emoji 🇹🇭 renders as "TH" letters. */
.flag {
  display: inline-block;
  vertical-align: middle;
  width: 18px;
  height: 13px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
  flex-shrink: 0;
}
.flag--lg { width: 24px; height: 18px; }
.flag--sm { width: 14px; height: 10px; }

/* Loading skeleton shown for a single animation frame while the heavy
   init() of a route runs in the background. Keeps navigation feeling
   instant even with 600+ products in master data. */
.page-skeleton { padding: 16px 0; display: flex; flex-direction: column; gap: 14px; }
.page-skeleton__row {
  height: 40px;
  background: linear-gradient(90deg,
    rgba(173,156,130,.05) 0%,
    rgba(173,156,130,.12) 50%,
    rgba(173,156,130,.05) 100%);
  background-size: 200% 100%;
  border-radius: var(--r-md);
  animation: page-skeleton-shimmer 1.2s ease-in-out infinite;
}
.page-skeleton__row:first-child { height: 60px; }   /* mimics filter bar */
.page-skeleton__row:nth-child(2) { height: 48px; }  /* mimics card header */
.page-skeleton__row:nth-child(3) { height: 280px; } /* mimics table area */
@keyframes page-skeleton-shimmer {
  0%, 100% { background-position: 200% 0; }
  50%      { background-position:   0% 0; }
}

/* Wide table — many columns, horizontal scroll, sticky first column.
   We use `table-layout: auto` so columns size to fit content, with explicit
   `min-width` on each header to prevent collapse. The previous `fixed` mode
   was clipping content (e.g. "020001" code → "020...") whenever a column
   needed slightly more than its declared width. */
.table--wide { min-width: 2400px; }
.table--wide th { white-space: nowrap; }
.table--wide td { vertical-align: top; }
.table--wide td small, .table--wide td strong { white-space: normal; word-break: break-word; }
/* ⚠ EXCEPTION: product codes / IDs (monospace fonts) must NEVER wrap.
   Wrapping breaks "020001" into "0200\n01" which looks broken. The rules above
   force-wrap all <small>/<strong> inside .table--wide — re-assert nowrap for
   anything tagged as a code (class="font-mono" OR inline JetBrains Mono style). */
.table--wide td .font-mono,
.table--wide td [style*="JetBrains Mono"] {
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
}
.table--wide .sticky-col {
  position: sticky;
  left: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  z-index: 1;
  min-width: 110px;          /* guarantees room for 6-digit code + photo thumb on one line */
}

/* Matrix variant: auto-fit to content (no fixed min-width) — used for Markup Settings */
.table--wide.table--matrix { min-width: auto; width: auto; }
.table--wide.table--matrix .sticky-col { min-width: 200px; max-width: 280px; padding-right: 16px; }
.table--wide.table--matrix th, .table--wide.table--matrix td { padding-left: 12px; padding-right: 12px; }

/* Shipped cell — multi-round editor (Qty + Date per round, side by side) */
/* The column auto-expands as more rounds are added (one ship-cell per round). */
.th-shipped { min-width: 160px; text-align: center; }
.td-shipped { padding-top: 8px !important; padding-bottom: 8px !important; }

/* Wrapper for one or more rounds — stacked VERTICALLY so each new split
   batch lands below the previous one (matches Required column layout).
   Was previously a horizontal flex row, but a 2nd batch falling to the
   right kept getting cut off by the cell width — vertical stacking is
   easier to scan and matches the Required column the user expects. */
.ship-rounds {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  max-width: 100%;
  padding: 2px;
}
/* Required column: same cell design — VERTICAL stack (each round below the previous) */
.req-rounds {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px;
}
.td-required { padding-top: 8px !important; padding-bottom: 8px !important; min-width: 160px; }
.td-shipped  { padding-top: 8px !important; padding-bottom: 8px !important; min-width: 160px; }

.ship-cell-empty { padding: 6px 12px; min-width: 80px; text-align: center; }

/* Round number badge ("#1", "#2", ...) */
.ship-cell__round-no {
  font-size: 9px; font-weight: 700;
  color: var(--brand-navy-500);
  background: var(--brand-navy-100);
  padding: 1px 6px;
  border-radius: 999px;
  align-self: flex-start;
  letter-spacing: .04em;
}

.ship-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 140px;
  flex-shrink: 0;
  padding: 4px 6px;
  border: 1px dashed var(--border);
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.01);
}
.ship-cell:has(.ship-cell__qty-input[readonly]) { border-style: solid; background: rgba(31, 174, 106, 0.04); }

/* Method row inside a round cell — bottom row, picker or icon-display */
.ship-cell__row--method { gap: 4px; }
.ship-cell__method-select {
  flex: 1 1 0;
  min-width: 0;
  height: 24px;
  padding: 0 5px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-base);
  color: var(--text-primary);
}
.ship-cell__method-select:focus { border-color: var(--brand-navy-500); outline: none; }
.ship-cell__method-display {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--brand-navy-100);
  color: var(--brand-navy-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ship-cell__method-display .method-icon { font-size: 13px; flex-shrink: 0; }
.ship-cell__method-display .method-text { overflow: hidden; text-overflow: ellipsis; }
.ship-cell__row {
  display: flex;
  align-items: center;
  gap: 3px;
}
.ship-cell__qty-input,
.ship-cell__date-input {
  flex: 1 1 0;
  min-width: 0;
  height: 24px;
  padding: 0 5px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-base);
  color: var(--text-primary);
}
.ship-cell__date-input { text-align: left; font-family: inherit; font-size: 10.5px; padding: 0 4px; }

/* Shipment line — error state for over-quantity warning */
.input-error {
  border-color: var(--status-red) !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15) !important;
  background: rgba(239, 68, 68, 0.04) !important;
}
.input-error:focus { outline: none; }
.ship-line__warn {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--status-red);
  font-weight: 500;
  padding: 4px 8px;
  background: rgba(239, 68, 68, 0.08);
  border-radius: var(--r-sm);
  border-left: 3px solid var(--status-red);
}

/* Standalone DD/MM/YYYY date input (used in modals/forms outside ship cells) */
.dmy-date {
  position: relative;
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 10px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color 150ms var(--ease);
}
.dmy-date:hover { border-color: var(--brand-navy-300); }
.dmy-date:focus-within { border-color: var(--brand-navy-500); outline: none; }
.dmy-date__native {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
}
.dmy-date__text {
  flex: 1 1 0;
  min-width: 0;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dmy-date__text.is-empty { color: var(--text-disabled); font-weight: 400; }
.dmy-date__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 0;
  margin-left: 6px;
  color: var(--text-secondary);
  cursor: pointer;
}
.dmy-date__btn:hover { color: var(--brand-navy-500); }

/* Compact date input inside table cells */
table .dmy-date { height: 26px; padding: 0 6px; font-size: 11px; min-width: 110px; }
table .dmy-date .dmy-date__text { font-size: 11px; }
table .dmy-date .dmy-date__btn svg { width: 11px; height: 11px; }
table .dmy-date .dmy-date__btn { margin-left: 4px; }
.td-actual-arrival { width: 130px; min-width: 130px; max-width: 140px; padding-top: 4px !important; padding-bottom: 4px !important; }
/* Date input inside the meta grid (shipment detail) — match the surrounding text size */
.meta-grid__item .dmy-date { height: 32px; padding: 0 10px; font-size: 13px; max-width: 220px; }

/* Custom date display: native date input is visually hidden, our DD/MM/YYYY span shows */
.ship-cell__date-wrap { position: relative; flex: 1 1 0; min-width: 0; }
.ship-cell__date-input--hidden {
  position: absolute; inset: 0; opacity: 0;
  pointer-events: none;   /* Picker is opened via the calendar button — input doesn't intercept clicks */
  width: 100%; height: 100%;
}
.ship-cell__date-text {
  display: block;
  height: 24px;
  padding: 0 5px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 22px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
.ship-cell__date-text.is-empty { color: var(--text-disabled); font-weight: 400; }
/* When the underlying input is readonly (date locked) — match the readonly look of qty input */
.ship-cell__date-input--hidden[readonly] ~ .ship-cell__date-text { background: var(--bg-subtle); color: var(--text-secondary); }
.ship-cell__qty-input:focus,
.ship-cell__date-input:focus { border-color: var(--brand-navy-500); outline: none; }
.ship-cell__qty-input[readonly],
.ship-cell__date-input[readonly] { background: var(--bg-subtle); color: var(--text-secondary); cursor: default; }
.ship-cell__btn {
  width: 20px; height: 20px; padding: 0; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-base); color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease);
}
.ship-cell__btn:hover { background: var(--bg-subtle); color: var(--text-primary); }
.ship-cell__btn--confirm { color: var(--status-green); border-color: rgba(31, 174, 106, 0.4); }
.ship-cell__btn--confirm:hover { background: rgba(31, 174, 106, 0.1); }
.ship-cell__btn--edit { color: var(--brand-navy-500); border-color: rgba(44, 123, 229, 0.4); }
.ship-cell__btn--edit:hover { background: rgba(44, 123, 229, 0.1); }
.ship-cell__btn--cal { color: var(--text-secondary); }
.ship-cell__btn--cal.is-locked { color: var(--brand-navy-500); border-color: rgba(44, 123, 229, 0.4); }
/* Hide the native date picker indicator (we use our own button) */
.ship-cell__date-input::-webkit-calendar-picker-indicator { display: none; }

/* Pricing table: multi-column sticky (Code + Category + Name pinned to the left) */
/* Override the 2200px min-width — pricing table sizes naturally based on column count */
.table--wide.table--pricing-sticky { min-width: auto; }
.table--pricing-sticky .sticky-col--1 { left: 0;     min-width: 80px;  max-width: 80px;  width: 80px; }
.table--pricing-sticky .sticky-col--2 { left: 80px;  min-width: 160px; max-width: 160px; width: 160px; }
.table--pricing-sticky .sticky-col--3 { left: 240px; min-width: 220px; max-width: 220px; width: 220px; border-right: 2px solid var(--border-strong); }
/* Compact widths for non-sticky columns so the table doesn't stretch */
.table--pricing-sticky th:nth-child(4),
.table--pricing-sticky td:nth-child(4) { width: 180px; min-width: 180px; max-width: 180px; overflow: hidden; }   /* Cost (Supplier) */
.table--pricing-sticky th:nth-child(5),
.table--pricing-sticky td:nth-child(5) { width: 120px; min-width: 120px; max-width: 130px; }   /* Cost Price */
.table--pricing-sticky th:nth-child(6),
.table--pricing-sticky td:nth-child(6) { width: 110px; min-width: 110px; max-width: 130px; }   /* Pack Size */
.table--pricing-sticky th:nth-child(n+7),
.table--pricing-sticky td:nth-child(n+7) { width: 120px; min-width: 120px; max-width: 140px; } /* Country columns */
/* Cost (Supplier) cell content — truncate dropdown / text with ellipsis */
.table--pricing-sticky td:nth-child(4) > * { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table--pricing-sticky td:nth-child(4) select {
  width: 100%; max-width: 100%; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  /* Ensure native <select> respects width and clips overflow text */
  text-indent: 0;
}
.table--pricing-sticky td:nth-child(4) small { display: inline-block; max-width: 100%; }
/* All sticky cells need to layer above scrolling content */
.table--pricing-sticky tbody .sticky-col { z-index: 2; background: var(--bg-elevated); }
.table--pricing-sticky thead .sticky-col { z-index: 5; background: var(--bg-subtle); }
.table--pricing-sticky tbody tr:hover .sticky-col { background: var(--brand-cream-light); }
.table--wide thead .sticky-col {
  background: var(--bg-subtle);
  z-index: 3;
}
.table--wide tbody tr:hover .sticky-col { background: var(--brand-cream-light); }

/* Viewport-bound scroll wrap: keeps the horizontal scrollbar visible near the
   bottom of the viewport without requiring the user to scroll the page first.
   Vertical scroll happens INSIDE the wrap; the table header stays sticky. */
.table-wrap.table-wrap--scroll {
  max-height: calc(100vh - var(--topbar-h) - 240px);
  overflow: auto;
}
.table-wrap--scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-subtle);
}
.table-wrap--scroll thead .sticky-col { z-index: 4; }

/* ── Country tags (pills) — "Used in Countries" ─────────────────────────────── */
.country-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 36px;
  padding: 4px 6px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.country-tags:focus-within { border-color: var(--brand-navy-500); }
.country-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.country-pill .code { font-family: 'JetBrains Mono', monospace; }
.pill-remove {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
}
.pill-remove svg { width: 10px; height: 10px; }
.pill-remove:hover { background: var(--bg-subtle); color: var(--status-red); }

.country-add-btn {
  width: 26px; height: 26px;
  border: 1px dashed var(--border-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}
.country-add-btn svg { width: 14px; height: 14px; }
.country-add-btn:hover { border-color: var(--brand-navy-500); border-style: solid; color: var(--brand-navy-500); background: var(--brand-navy-100); }

/* ── Custom combobox (replaces native HTML5 datalist filtering) ─────────────── */
/* Native <input list="..."> filters options based on typed text — that means
   clicking the dropdown arrow after typing only shows matching items. We
   upgrade those inputs into a custom combobox where the arrow always shows
   the FULL list. Typing still filters within the list visually. */
.combobox { position: relative; display: flex; min-width: 0; width: 100%; }
.combobox > input { flex: 1; min-width: 0; padding-right: 28px !important; width: 100%; }
.combobox-arrow {
  position: absolute;
  right: 2px; top: 50%;
  transform: translateY(-50%);
  width: 26px; height: 28px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  cursor: pointer;
  z-index: 1;
}
.combobox-arrow:hover { color: var(--text-primary); background: var(--bg-subtle); }
.combobox-arrow svg { width: 12px; height: 12px; }
.combobox-list {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  min-width: 100%;
  max-width: 360px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  z-index: 200;
}
.combobox-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  white-space: nowrap;
}
.combobox-item:last-child { border-bottom: none; }
.combobox-item:hover { background: var(--brand-navy-100); }
.combobox-item__helper {
  color: var(--text-secondary);
  font-size: 11px;
  flex-shrink: 0;
}

/* Clickable cert tiles in Add Product modal */
.cert-tile { cursor: pointer; transition: border-color 150ms var(--ease), transform 150ms var(--ease); }
.cert-tile:hover { border-color: var(--brand-navy-500); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.cert-tile:focus-visible { border-color: var(--brand-navy-500); outline-offset: 2px; }

/* Generic input + unit combobox (qty-with-unit) */
.qty-with-unit {
  display: flex;
  gap: 4px;
  min-width: 0;
}
.qty-with-unit > input[type="number"] { flex: 2 1 0; min-width: 0; padding: 0 10px; text-align: right; }
.qty-with-unit > input[type="text"]:not([data-cb-input]) { flex: 1 1 0; min-width: 0; padding: 0 8px; }
.qty-with-unit > .combobox { flex: 1 1 0; min-width: 0; }

/* Dimension three-input row (W × L × H + unit) */
.dim-three {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
}
.dim-three > input[type="number"] { flex: 1 1 0; min-width: 0; text-align: center; padding: 0 6px; }
.dim-three > span { color: var(--text-secondary); font-weight: 600; flex: 0 0 auto; }
.dim-three > .combobox { flex: 0 0 84px; min-width: 0; }

/* Wrap rows on narrow modals (mobile / split screen) */
@media (max-width: 720px) {
  .supplier-row__main {
    grid-template-columns: 1fr 1fr 32px;
    grid-template-areas:
      'name name remove'
      'price currency currency'
      'vat pretax pretax';
    row-gap: 12px;
  }
  .supplier-row__main .form-row:nth-child(1) { grid-area: name; }
  .supplier-row__main .form-row:nth-child(2) { grid-area: price; }
  .supplier-row__main .form-row:nth-child(3) { grid-area: currency; }
  .supplier-row__main .form-row:nth-child(4) { grid-area: vat; }
  .supplier-row__main .form-row:nth-child(5) { grid-area: pretax; }
  .supplier-row__main .supplier-remove-btn { grid-area: remove; align-self: end; }

  .supplier-row__extra { grid-template-columns: 1fr; }
}

/* ── Shipment Review modal ─────────────────────────────────────────────── */
.rev-grid {
  display: grid;
  gap: 14px;
}
.rev-row {
  padding: 14px 16px;
  background: var(--bg-subtle, #faf7f0);
  border: 1px solid var(--border, #e5e1d6);
  border-radius: var(--r-md, 10px);
  transition: border-color 160ms var(--ease), background-color 160ms var(--ease);
}
.rev-row:hover { border-color: var(--brand-gold, #AD9C82); background: #fff; }
.rev-row__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.rev-row__icon { font-size: 20px; line-height: 1; }
.rev-row__label {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary, #181818);
  flex: 1;
}
.rev-row__score {
  font-size: 13px;
  color: var(--text-secondary, #545351);
  font-family: 'JetBrains Mono', monospace;
}
.rev-row__score strong {
  color: var(--brand-gold-dark, #8c7d68);
  font-size: 18px;
  margin-right: 2px;
}
.rev-row__dots {
  display: flex;
  gap: 5px;
  flex-wrap: nowrap;
}
.rev-dot {
  flex: 1 1 auto;
  min-width: 0;
  height: 32px;
  border: 1px solid var(--border, #d9d4c4);
  background: #fff;
  color: var(--text-secondary, #545351);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: background-color 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease), transform 120ms var(--ease);
}
.rev-dot:hover {
  border-color: var(--brand-gold, #AD9C82);
  color: var(--brand-gold-dark, #8c7d68);
  transform: translateY(-1px);
}
.rev-dot.is-active {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border-color: #f59e0b;
  color: #fff;
  box-shadow: 0 1px 3px rgba(245,158,11,0.4);
}
.rev-dot.is-active:hover {
  background: linear-gradient(135deg, #fcd34d, #fbbf24);
}

/* ── Revenue Summary dashboard (Payment Summary page) ──────────────── */
.rev-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.rev-detail-scroll {
  max-height: 320px;
  overflow-y: auto;
}
.rev-detail-grid .card__head h3 { font-size: 14px; }

/* ── Admin score-adjustment modal ─────────────────────────────────── */
.adj-score-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 12px;
  align-items: stretch;
}
.adj-score-tile {
  padding: 14px 16px;
  background: var(--bg-subtle, #faf7f0);
  border: 1px solid var(--border, #e5e1d6);
  border-radius: var(--r-md, 10px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.adj-score-tile small { font-size: 11px; color: var(--text-secondary); }
.adj-score-tile strong {
  font-size: 28px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
  margin: 4px 0;
}
.adj-score-tile strong.good    { color: #18804d; }
.adj-score-tile strong.bad     { color: #b8332c; }
.adj-score-tile strong.neutral { color: var(--text-secondary, #545351); }
.adj-score-tile--editable { background: #fff; border-color: var(--brand-gold, #AD9C82); box-shadow: 0 2px 6px rgba(173,156,130,0.18); }
.adj-score-tile--final    { background: linear-gradient(135deg, #fef9c3, #fde68a); border-color: #f59e0b; }
.adj-stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
}
.adj-stepper input {
  width: 60px;
  height: 32px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid var(--border, #e5e1d6);
  border-radius: 6px;
}
/* ✏ Adjust button on the Task card */
.perf-task-card-adjust { color: var(--brand-gold-dark, #8c7d68); }
.perf-task-card-adjust:hover { color: var(--brand-gold, #AD9C82); background: rgba(173,156,130,0.12); }
.task-score-chip__adj {
  margin-left: 4px;
  padding: 1px 5px;
  background: rgba(0,0,0,0.06);
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 600;
}

/* ── Task delivery-score chip ─────────────────────────────────────────
   Shown on each Task card next to the status pill, and also drives the
   Performance leaderboard. Color: green for + scores, red for − scores.
   `min-width` keeps the chip's footprint consistent across rows so the
   pending '—' chip lines up with the '+2 pts' / '−3 pts' chips in
   adjacent rows. */
.task-score-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  min-width: 64px;
  height: 22px;
  box-sizing: border-box;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: center;
}
/* Reserves the same footprint as the ✏ Adjust button so rows where the
   admin button is hidden (task not yet delivered) still line up with
   rows where it shows. */
.perf-task-card-adjust-placeholder {
  display: inline-block;
  width: 26px;
  height: 26px;
  visibility: hidden;
  pointer-events: none;
}
.task-score-chip--good     { background: rgba(31,174,106,0.13); color: #18804d; border: 1px solid rgba(31,174,106,0.35); }
.task-score-chip--bad      { background: rgba(224,70,62,0.13);  color: #b8332c; border: 1px solid rgba(224,70,62,0.35); }
.task-score-chip--neutral  { background: var(--bg-subtle, #f4f1ea); color: var(--text-secondary, #545351); border: 1px solid var(--border, #e5e1d6); }
.task-score-chip--pending  { background: transparent; color: var(--text-disabled, #b0a995); border: 1px dashed var(--border, #e5e1d6); }
.task-score-chip--compact  { padding: 2px 6px; font-size: 10px; }

/* Employee card — Delivery Score row */
.perf-emp-card__score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  margin-top: 10px;
  background: linear-gradient(135deg, rgba(173,156,130,0.08), rgba(173,156,130,0.02));
  border-radius: var(--r-sm, 6px);
  border-left: 3px solid var(--brand-gold, #AD9C82);
}
.perf-emp-card__score-row__label strong { display: block; font-size: 12px; }
.perf-emp-card__score-row__label small  { font-size: 10px; }
.perf-emp-card__score-row__val {
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
}
.perf-emp-card__score-row__val strong { display: block; font-size: 22px; line-height: 1; }
.perf-emp-card__score-row__val strong.good    { color: #18804d; }
.perf-emp-card__score-row__val strong.bad     { color: #b8332c; }
.perf-emp-card__score-row__val strong.neutral { color: var(--text-secondary, #545351); }
.perf-emp-card__score-row__val small { font-size: 10px; }
.perf-emp-card__score-bd {
  display: flex;
  justify-content: space-around;
  gap: 8px;
  padding: 6px 10px 0;
  font-size: 10.5px;
  color: var(--text-secondary);
}
.perf-emp-card__score-bd .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.perf-emp-card__score-bd .dot--green { background: #1fae6a; }
.perf-emp-card__score-bd .dot--red   { background: #e0463e; }

/* ── Shipment NO cell layout ──────────────────────────────────────────
   Number on top, all 4 action icons (docs / AI verify / info / review)
   on one horizontal row below — so the icons never wrap onto two lines
   when the column is narrow. */
.ship-no-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}
.ship-no-cell__no {
  display: inline-block;
}
.ship-no-cell__icons {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;        /* keep all 4 on one row even on narrow columns */
}

/* ⭐ Review-status star button in the shipments list */
.rev-star {
  color: #d1d5db;            /* grey outline when not reviewed */
  transition: color 160ms var(--ease, ease), transform 120ms var(--ease, ease), filter 160ms var(--ease, ease);
}
.rev-star:hover {
  color: #fbbf24;            /* preview gold on hover */
  transform: scale(1.12);
}
.rev-star.is-reviewed {
  color: #f59e0b;            /* gold fill when reviewed */
  filter: drop-shadow(0 1px 2px rgba(245,158,11,0.45));
}
.rev-star.is-reviewed:hover {
  color: #f97316;            /* deeper amber hover */
  transform: scale(1.12);
}

/* Thank-you toast that pops after submit */
.rev-thanks-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translate(-50%, 30px);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  background: linear-gradient(135deg, #fef9c3, #fde68a);
  color: #854d0e;
  font-weight: 700;
  font-size: 14px;
  border-radius: 99px;
  box-shadow: 0 8px 24px rgba(245,158,11,0.35);
  z-index: 9999;
  opacity: 0;
  transition: opacity 320ms var(--ease, ease), transform 320ms var(--ease, ease);
  pointer-events: none;
}
.rev-thanks-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Responsive */
@media (max-width: 768px) {
  .app { grid-template-areas: "topbar" "main"; grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform 260ms var(--ease); z-index: 40; }
  .app.sidebar-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .topbar__brand span { display: none; }
  .topbar__user-name { display: none; }
  .topbar__search { display: none; }
  .main { padding: 16px; }
  .page-head h1 { font-size: 22px; }
}
@media (max-width: 480px) {
  .topbar__country { display: none; }
}
