/* Tazejah UI 5.0.0 — Saudi Electric Green */
:root {
  --brand-bg: #060f08;
  --brand-card: #0a100b;
  --brand-primary: #22c55e;
  --brand-text: #fafafa;
  --brand-gold: #f5a800;
  --brand-lime: #66ff33;
  --brand-border: #1e2b20;
  --phthalo-1000: #060f08;
  --phthalo-950: #0a100b;
  --phthalo-900: #102416;
  --phthalo-850: #14532d;
  --phthalo-800: #15803d;
  --phthalo-700: #16a34a;
  --phthalo-600: #22c55e;
  --phthalo-500: #4ade80;
  --warm-beige: #f5a800;
  --warm-beige-2: #ffd15a;
  --warm-beige-3: #ffe8a3;
  --warm-beige-4: #fff7dd;
  --accent-sand: #f5a800;
  --accent-mint: #66ff33;
  --page: #f4faf6;
  --page-elevated: #f8fcf9;
  --surface: rgba(255, 255, 255, .92);
  --surface-solid: #ffffff;
  --surface-muted: #edf6f0;
  --surface-strong: #dfeee3;
  --ink: #0d1a10;
  --muted: #5a6b5e;
  --line: #d1ded4;
  --line-strong: #aabfac;
  --green-900: var(--phthalo-900);
  --green-800: var(--phthalo-800);
  --green-700: var(--phthalo-700);
  --green-600: var(--brand-primary);
  --green-100: #e4f8e9;
  --canvas: var(--page);
  --warning: #8a5b00;
  --warning-bg: #fff3cf;
  --danger: #b4232e;
  --danger-bg: #ffe8ea;
  --shadow-xs: 0 1px 2px rgba(6, 15, 8, .05);
  --shadow-sm: 0 8px 22px rgba(6, 15, 8, .08);
  --shadow: 0 18px 50px rgba(6, 15, 8, .10);
  --shadow-lg: 0 32px 90px rgba(6, 15, 8, .18);
  --radius-sm: 11px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 30px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light;
}

html[data-theme="dark"] {
  --page: #060f08;
  --page-elevated: #08130a;
  --surface: rgba(10, 16, 11, .94);
  --surface-solid: #0a100b;
  --surface-muted: #0e1710;
  --surface-strong: #132118;
  --ink: #fafafa;
  --muted: #a8b5aa;
  --line: #1e2b20;
  --line-strong: #2a3b2d;
  --green-100: #102416;
  --canvas: var(--page);
  --warning: #f5a800;
  --warning-bg: #2b2209;
  --danger: #ff7a85;
  --danger-bg: #2a1114;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .28);
  --shadow-sm: 0 10px 26px rgba(0, 0, 0, .32);
  --shadow: 0 22px 60px rgba(0, 0, 0, .40);
  --shadow-lg: 0 38px 100px rgba(0, 0, 0, .56);
  color-scheme: dark;
}

html { scroll-behavior: smooth; background: var(--page); }
body {
  color: var(--ink);
  background:
    radial-gradient(circle at 88% -10%, color-mix(in srgb, var(--warm-beige) 40%, transparent), transparent 28rem),
    radial-gradient(circle at -5% 35%, color-mix(in srgb, var(--phthalo-500) 8%, transparent), transparent 34rem),
    var(--page);
  font-family: "Segoe UI Variable", "Segoe UI", Tahoma, Arial, sans-serif;
  font-feature-settings: "ss01" 1, "cv02" 1;
  text-rendering: optimizeLegibility;
}
html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 88% -12%, rgba(53, 165, 132, .12), transparent 31rem),
    radial-gradient(circle at -8% 45%, rgba(232, 220, 200, .05), transparent 35rem),
    var(--page);
}
::selection { color: #fff; background: var(--phthalo-700); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--phthalo-500) 55%, transparent); outline-offset: 3px; }
img { max-width: 100%; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button, a, summary { touch-action: manipulation; }

/* Shared surfaces */
.card,
.stat-card,
.priority-orders-panel,
.priority-customer-section,
.anomaly-panel,
.user-account-card,
.partner-form,
.form-section,
.finance-summary,
.executive-card,
.delivery-job-hero,
.intelligence-hero,
.forecast-card,
.note-card,
.settings-panel,
.security-card {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
}
.card { border-radius: var(--radius-lg); }
.card:hover { border-color: var(--line-strong); }
.card h1, .card h2, .card h3, .page-heading h1, .page-heading h2 { color: var(--ink); }
.muted, label small, td small, .card-heading p { color: var(--muted); }
.eyebrow { color: var(--phthalo-700); letter-spacing: .04em; }
html[data-theme="dark"] .eyebrow { color: var(--accent-mint); }

input, select, textarea,
.review-table select, .review-table input,
.catalog-input {
  color: var(--ink);
  background: color-mix(in srgb, var(--surface-solid) 94%, transparent);
  border-color: var(--line-strong);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
input:focus, select:focus, textarea:focus {
  border-color: var(--phthalo-500);
  background: var(--surface-solid);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--phthalo-500) 16%, transparent);
}
label { color: var(--ink); }

.button {
  border-radius: 12px;
  letter-spacing: -.01em;
  transition: transform .2s var(--ease-out), box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.button:hover { transform: translateY(-2px); }
.button-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--phthalo-700), var(--phthalo-900));
  box-shadow: 0 12px 24px rgba(11, 59, 46, .22), inset 0 1px 0 rgba(255,255,255,.18);
}
.button-primary:hover { box-shadow: 0 16px 30px rgba(11, 59, 46, .28); }
.button-secondary {
  color: var(--phthalo-900);
  background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
  border-color: var(--line-strong);
}
html[data-theme="dark"] .button-secondary { color: var(--warm-beige); }
.button-ghost { color: var(--phthalo-800); background: color-mix(in srgb, var(--warm-beige) 38%, transparent); }
html[data-theme="dark"] .button-ghost { color: #dbeee5; background: rgba(255,255,255,.07); }
.button-danger { background: #a93c46; }

.alert { display: flex; align-items: center; gap: 10px; border-radius: 14px; }
.alert .app-icon { width: 19px; }
.badge { border: 1px solid transparent; }
html[data-theme="dark"] .badge-success { color: #a8e6c7; background: rgba(37, 130, 85, .2); border-color: rgba(87, 195, 139, .2); }
html[data-theme="dark"] .badge-info { color: #9ed9e6; background: rgba(34, 119, 145, .2); border-color: rgba(87, 173, 199, .2); }
html[data-theme="dark"] .badge-warning { color: #f0cd8c; background: rgba(166, 105, 21, .2); border-color: rgba(224, 162, 76, .2); }
html[data-theme="dark"] .badge-danger { color: #f0a4aa; background: rgba(166, 47, 51, .22); border-color: rgba(226, 101, 108, .2); }
html[data-theme="dark"] .badge-neutral { color: #b4c5be; background: rgba(255,255,255,.07); border-color: var(--line); }

/* Theme control */
.theme-toggle,
.landing-theme-toggle {
  position: relative;
  display: inline-flex;
  min-width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface-solid) 84%, transparent);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.theme-toggle .app-icon { width: 18px; height: 18px; }
.theme-icon { display: grid; place-items: center; transition: transform .35s var(--ease-out), opacity .2s ease; }
.theme-icon-moon { position: absolute; opacity: 0; transform: translateY(18px) rotate(25deg); }
html[data-theme="dark"] .theme-icon-sun { opacity: 0; transform: translateY(-18px) rotate(-25deg); }
html[data-theme="dark"] .theme-icon-moon { opacity: 1; transform: none; }
.theme-toggle-label { font-size: 11px; font-weight: 800; }
.landing-theme-toggle { width: 39px; min-width: 39px; height: 39px; padding: 0; color: inherit; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); box-shadow: none; }
.landing-theme-toggle .theme-moon { display: none; }
html[data-theme="dark"] .landing-theme-toggle .theme-sun { display: none; }
html[data-theme="dark"] .landing-theme-toggle .theme-moon { display: inline; }

/* Application shell */
.authenticated-body { min-height: 100vh; background: transparent; }
.app-sidebar {
  width: 286px;
  padding: 18px 14px 16px;
  color: #edf5f1;
  background:
    linear-gradient(180deg, rgba(255,255,255,.04), transparent 18%),
    radial-gradient(circle at 15% 0, rgba(142, 215, 183, .13), transparent 20rem),
    linear-gradient(165deg, #102416, #060f08 72%);
  border-inline-end: 1px solid rgba(232,220,200,.1);
  box-shadow: 22px 0 60px rgba(3, 23, 18, .12);
}
html[data-theme="dark"] .app-sidebar { background: linear-gradient(165deg, #0a100b, #060f08 74%); }
.sidebar-brand {
  min-height: 70px;
  gap: 12px;
  padding: 9px 11px 15px;
  border-bottom: 1px solid rgba(232,220,200,.1);
}
.sidebar-brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  padding: 5px;
  background: var(--warm-beige);
  border-radius: 15px;
  box-shadow: inset 0 0 0 1px rgba(11,59,46,.08), 0 8px 20px rgba(0,0,0,.15);
}
.sidebar-brand img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-brand > span:last-child strong { color: #fff; font-size: 16px; }
.sidebar-brand > span:last-child small { color: rgba(232,220,200,.62); letter-spacing: .12em; }
.sidebar-nav { gap: 4px; padding: 14px 0; }
.sidebar-section-label { padding: 13px 12px 6px; color: rgba(232,220,200,.48); font-size: 9px; letter-spacing: .13em; }
.sidebar-nav a {
  min-height: 44px;
  padding: 7px 10px;
  color: rgba(237,245,241,.76);
  border: 1px solid transparent;
  border-radius: 12px;
}
.sidebar-nav a i { color: rgba(232,220,200,.72); background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.045); }
.sidebar-nav a:hover { color: #fff; background: rgba(232,220,200,.085); border-color: rgba(232,220,200,.08); }
.sidebar-nav a.active {
  color: #102416;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-color: rgba(255,255,255,.28);
  box-shadow: 0 10px 28px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.5);
}
.sidebar-nav a.active::before { display: none; }
.sidebar-nav a.active i { color: #fff; background: var(--phthalo-800); box-shadow: 0 5px 14px rgba(11,59,46,.26); }
.sidebar-user {
  padding: 10px;
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(232,220,200,.09);
  border-radius: 15px;
}
.sidebar-user > span { color: var(--phthalo-900); background: var(--warm-beige); }
.sidebar-user small { color: rgba(232,220,200,.58); }

.app-topbar {
  inset-inline: 286px 0;
  height: 76px;
  justify-content: flex-start;
  padding: 11px 30px;
  color: var(--ink);
  background: color-mix(in srgb, var(--page-elevated) 82%, transparent);
  border-color: var(--line);
  box-shadow: 0 8px 30px rgba(6,31,24,.035);
  backdrop-filter: blur(24px) saturate(1.25);
}
.topbar-title { min-width: 150px; flex-direction: column; align-items: flex-start; gap: 2px; }
.topbar-title span { color: var(--muted); font-size: 9px; letter-spacing: .1em; }
.topbar-title strong { color: var(--ink); font-size: 14px; }
.topbar-command {
  display: flex;
  width: min(460px, 37vw);
  height: 46px;
  align-items: center;
  gap: 10px;
  margin-inline: auto;
  padding: 0 12px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-solid) 72%, transparent);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
  text-align: start;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.topbar-command:hover { color: var(--ink); background: var(--surface-solid); border-color: var(--line-strong); transform: translateY(-1px); }
.topbar-command .app-icon { width: 18px; }
.topbar-command span { flex: 1; font-size: 12px; }
kbd { display: inline-flex; min-width: 24px; min-height: 22px; align-items: center; justify-content: center; padding: 2px 6px; color: var(--muted); background: var(--surface-muted); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 7px; font: 700 10px/1 "Segoe UI", sans-serif; }
.topbar-actions { gap: 8px; }
.topbar-actions .language-switch { height: 42px; align-items: center; background: color-mix(in srgb, var(--surface-solid) 75%, transparent); }
.topbar-actions .notification-button { color: var(--ink); background: color-mix(in srgb, var(--surface-solid) 75%, transparent); border-color: var(--line); }
.topbar-actions .topbar-logout { min-height: 42px; }
.authenticated-body .app-shell { margin-inline-start: 286px; padding: 104px 34px 84px; }
.page-heading { margin-bottom: 26px; }
.page-heading h1 { color: var(--ink); font-weight: 850; letter-spacing: -.035em; }

/* Command palette */
.command-palette { position: fixed; z-index: 500; inset: 0; display: grid; place-items: start center; padding: min(14vh, 120px) 18px 30px; }
.command-palette[hidden] { display: none !important; }
.command-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; background: rgba(3, 23, 18, .56); border: 0; backdrop-filter: blur(12px); }
.command-dialog {
  position: relative;
  width: min(680px, 100%);
  max-height: min(660px, 76vh);
  overflow: hidden;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface-solid) 95%, transparent);
  border: 1px solid color-mix(in srgb, var(--warm-beige) 38%, var(--line));
  border-radius: 22px;
  box-shadow: 0 38px 120px rgba(0,0,0,.33);
  animation: commandIn .24s var(--ease-out) both;
}
.command-dialog > header { display: grid; grid-template-columns: 34px 1fr 38px; align-items: center; gap: 8px; padding: 14px; border-bottom: 1px solid var(--line); }
.command-symbol { display: grid; place-items: center; color: var(--phthalo-700); }
.command-symbol .app-icon { width: 22px; height: 22px; }
.command-dialog label { display: block; }
.command-dialog input { min-height: 48px; padding: 0 8px; font-size: 17px; background: transparent; border: 0; box-shadow: none; }
.command-dialog input:focus { box-shadow: none; }
.command-dialog header > button { display: grid; width: 36px; height: 36px; place-items: center; color: var(--muted); background: var(--surface-muted); border: 0; border-radius: 10px; }
.command-dialog header > button .app-icon { width: 18px; }
.command-hint { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; color: var(--muted); background: color-mix(in srgb, var(--surface-muted) 70%, transparent); border-bottom: 1px solid var(--line); font-size: 10px; }
.command-hint > span:last-child { display: flex; align-items: center; gap: 5px; }
.command-results { display: grid; gap: 5px; max-height: 470px; padding: 10px; overflow-y: auto; }
.command-item { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 11px; min-height: 58px; padding: 8px 10px; color: var(--ink); background: transparent; border: 1px solid transparent; border-radius: 13px; text-align: start; }
.command-item:hover, .command-item.active { background: var(--surface-muted); border-color: var(--line); }
.command-item-icon { display: grid; width: 40px; height: 40px; place-items: center; color: #fff; background: linear-gradient(135deg, var(--phthalo-700), var(--phthalo-900)); border-radius: 12px; }
.command-item-icon .app-icon { width: 18px; }
.command-item strong { display: block; font-size: 13px; }
.command-item small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.command-item > .app-icon { width: 16px; color: var(--muted); }
.command-empty { padding: 30px 20px; color: var(--muted); text-align: center; }
body.command-open { overflow: hidden; }
@keyframes commandIn { from { opacity: 0; transform: translateY(-16px) scale(.975); } }

/* Login */
.guest-body { background: var(--page); }
.guest-controls {
  position: fixed;
  z-index: 40;
  top: 18px;
  inset-inline-end: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.guest-controls .language-switch { min-height: 42px; align-items: center; background: color-mix(in srgb, var(--surface-solid) 88%, transparent); box-shadow: var(--shadow-sm); }
.login-shell {
  min-height: 100dvh;
  display: block;
  padding: 20px;
  background:
    radial-gradient(circle at 86% 8%, rgba(199,168,120,.19), transparent 24rem),
    radial-gradient(circle at 10% 80%, rgba(33,135,109,.1), transparent 28rem),
    var(--page);
}
.login-experience {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr);
  width: min(1320px, 100%);
  min-height: calc(100dvh - 40px);
  margin: 0 auto;
  overflow: hidden;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--shadow-lg);
}
.login-showcase {
  position: relative;
  display: flex;
  min-height: 690px;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 72px 62px 50px;
  color: #fff;
  background:
    radial-gradient(circle at 76% 18%, rgba(142,215,183,.17), transparent 20rem),
    radial-gradient(circle at 16% 82%, rgba(232,220,200,.12), transparent 24rem),
    linear-gradient(145deg, #102416, #060f08 72%);
}
.login-showcase-grid { position: absolute; inset: 0; opacity: .1; background-image: linear-gradient(rgba(255,255,255,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.12) 1px, transparent 1px); background-size: 48px 48px; mask-image: linear-gradient(to bottom, #000, transparent 88%); }
.login-showcase-orb { position: absolute; border: 1px solid rgba(232,220,200,.14); border-radius: 50%; }
.login-showcase-orb-one { width: 420px; height: 420px; top: -210px; inset-inline-end: -80px; }
.login-showcase-orb-two { width: 240px; height: 240px; bottom: -95px; inset-inline-start: -70px; }
.login-showcase-copy { position: relative; z-index: 2; max-width: 610px; margin-top: 8vh; }
.login-showcase-badge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; color: var(--warm-beige); background: rgba(255,255,255,.07); border: 1px solid rgba(232,220,200,.15); border-radius: 999px; font-size: 11px; font-weight: 800; }
.login-showcase-badge .app-icon { width: 16px; }
.login-showcase h2 { margin: 24px 0 17px; color: #fff; font-size: clamp(38px, 4vw, 64px); line-height: 1.08; letter-spacing: -.045em; }
.login-showcase-copy p { max-width: 560px; margin: 0; color: rgba(232,220,200,.72); font-size: 15px; line-height: 1.9; }
.login-showcase-widgets { position: relative; z-index: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.login-showcase-widgets article { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 11px; min-width: 0; padding: 14px; background: rgba(255,255,255,.065); border: 1px solid rgba(232,220,200,.12); border-radius: 16px; backdrop-filter: blur(12px); }
.login-showcase-widgets article > span { display: grid; width: 40px; height: 40px; place-items: center; color: var(--phthalo-900); background: var(--warm-beige); border-radius: 12px; }
.login-showcase-widgets .app-icon { width: 18px; }
.login-showcase-widgets small, .login-showcase-widgets strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-showcase-widgets small { color: rgba(232,220,200,.56); font-size: 9px; }
.login-showcase-widgets strong { margin-top: 4px; color: #fff; font-size: 11px; }
.login-showcase-widgets b { color: rgba(232,220,200,.35); font-size: 12px; }
.login-card {
  align-self: center;
  width: min(520px, calc(100% - 60px));
  margin: 60px auto;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.login-brand { display: flex; align-items: center; gap: 10px; width: fit-content; }
.login-brand .login-logo { width: 92px; height: 54px; margin: 0; object-fit: contain; }
.login-brand > span { padding-inline-start: 10px; color: var(--muted); border-inline-start: 1px solid var(--line); font-size: 10px; font-weight: 800; letter-spacing: .06em; }
.login-card-heading { margin-top: 36px; }
.login-card h1 { margin: 8px 0 10px; color: var(--ink); font-size: clamp(28px, 3vw, 38px); letter-spacing: -.035em; }
.login-card .form-stack { gap: 18px; margin-top: 8px; }
.input-with-icon { position: relative; display: block; }
.input-with-icon > .app-icon { position: absolute; z-index: 2; top: 50%; inset-inline-start: 14px; width: 18px; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.input-with-icon input { min-height: 52px; padding-inline-start: 44px; }
.login-submit { min-height: 54px; justify-content: space-between; margin-top: 2px; padding-inline: 18px; }
.login-submit .app-icon { width: 18px; }
[dir="rtl"] .login-submit .app-icon { transform: rotate(180deg); }
.login-security-note { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 18px 0 0; color: var(--muted); font-size: 10px; }
.login-security-note .app-icon { width: 14px; }
.guest-body:not(:has(.login-experience)) .login-shell { display: grid; place-items: center; }
.guest-body:not(:has(.login-experience)) .login-card { width: min(520px, 100%); margin: 70px auto; padding: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.guest-body:not(:has(.login-experience)) .login-logo { width: 150px; height: 90px; }

/* Dashboard */
.dashboard-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr);
  min-height: 390px;
  align-items: center;
  gap: 30px;
  margin-bottom: 24px;
  padding: 42px 46px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 78% 38%, rgba(142,215,183,.18), transparent 25rem),
    linear-gradient(135deg, #14532d, #060f08 78%);
  border: 1px solid rgba(232,220,200,.12);
  border-radius: 28px;
  box-shadow: 0 30px 80px rgba(6,31,24,.22);
}
.dashboard-hero-mesh { position: absolute; inset: 0; opacity: .11; background-image: linear-gradient(rgba(255,255,255,.1) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.1) 1px, transparent 1px); background-size: 46px 46px; mask-image: radial-gradient(circle at 80% 40%, #000, transparent 62%); }
.dashboard-hero-copy { position: relative; z-index: 2; }
.dashboard-live-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; color: #d9efe6; background: rgba(255,255,255,.07); border: 1px solid rgba(232,220,200,.14); border-radius: 999px; font-size: 10px; font-weight: 800; }
.dashboard-live-pill i { width: 7px; height: 7px; background: #66ff33; border-radius: 50%; box-shadow: 0 0 0 5px rgba(105,212,157,.12); animation: livePulse 1.8s ease infinite; }
.dashboard-date { min-height: 14px; margin: 20px 0 0; color: rgba(232,220,200,.62); font-size: 11px; }
.dashboard-hero h1 { margin: 8px 0 14px; color: #fff; font-size: clamp(34px, 4vw, 57px); line-height: 1.08; letter-spacing: -.045em; }
.dashboard-hero h1 em { color: var(--warm-beige); font-style: normal; }
.dashboard-hero-copy > p:last-of-type { max-width: 650px; margin: 0; color: rgba(232,220,200,.73); font-size: 14px; line-height: 1.85; }
.dashboard-hero-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 25px; }
.dashboard-hero-actions .button { min-height: 50px; }
.dashboard-primary-action { color: var(--phthalo-900); background: linear-gradient(135deg, #22c55e, #16a34a); box-shadow: 0 14px 30px rgba(0,0,0,.16); }
.dashboard-primary-action .app-icon { width: 18px; }
.dashboard-primary-action .app-icon:last-child { margin-inline-start: 14px; }
[dir="rtl"] .dashboard-primary-action .app-icon:last-child { transform: rotate(180deg); }
.dashboard-secondary-action { color: #fff; background: rgba(255,255,255,.06); border-color: rgba(232,220,200,.18); }
.dashboard-hero-focus { position: relative; z-index: 2; display: grid; min-height: 290px; place-items: center; }
.focus-orbit { position: absolute; width: 250px; height: 250px; border: 1px dashed rgba(232,220,200,.22); border-radius: 50%; animation: orbitSpin 24s linear infinite; }
.focus-orbit::before, .focus-orbit::after { content: ""; position: absolute; top: 50%; width: 8px; height: 8px; background: var(--warm-beige); border-radius: 50%; box-shadow: 0 0 0 7px rgba(232,220,200,.08); }
.focus-orbit::before { left: -4px; }.focus-orbit::after { right: -4px; }
.focus-core { position: relative; z-index: 2; display: grid; width: 180px; height: 180px; place-items: center; align-content: center; background: radial-gradient(circle at 35% 25%, rgba(255,255,255,.13), rgba(255,255,255,.045)); border: 1px solid rgba(232,220,200,.18); border-radius: 50%; box-shadow: inset 0 0 45px rgba(255,255,255,.03), 0 20px 50px rgba(0,0,0,.15); backdrop-filter: blur(12px); }
.focus-core small, .focus-core span { color: rgba(232,220,200,.62); font-size: 9px; }
.focus-core strong { margin: 3px 0; color: var(--warm-beige); font-size: 58px; line-height: 1; }
.focus-chip { position: absolute; z-index: 3; display: flex; align-items: center; gap: 9px; min-width: 150px; padding: 10px 12px; color: var(--phthalo-900); background: rgba(247,242,233,.94); border: 1px solid rgba(255,255,255,.5); border-radius: 14px; box-shadow: 0 16px 35px rgba(0,0,0,.18); backdrop-filter: blur(12px); animation: chipFloat 4s ease-in-out infinite; }
.focus-chip > .app-icon { width: 20px; color: var(--phthalo-700); }
.focus-chip small, .focus-chip b { display: block; }
.focus-chip small { color: #65776f; font-size: 8px; }
.focus-chip b { margin-top: 2px; font-size: 14px; }
.focus-chip-top { top: 14px; inset-inline-start: 0; }.focus-chip-bottom { bottom: 7px; inset-inline-end: 0; animation-delay: -2s; }
.dashboard-alert { padding: 13px 15px; }
.dashboard-alert span { flex: 1; }
.dashboard-alert a { color: inherit; font-size: 11px; font-weight: 900; text-decoration: underline; }
.workflow-overview { margin-bottom: 20px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-sm); backdrop-filter: blur(18px); }
.workflow-overview > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.workflow-overview h2 { margin: 4px 0 0; font-size: 20px; }
.workflow-overview > header > a { display: inline-flex; align-items: center; gap: 7px; color: var(--phthalo-700); font-size: 11px; font-weight: 900; }
html[data-theme="dark"] .workflow-overview > header > a { color: var(--accent-mint); }
.workflow-overview > header > a .app-icon { width: 15px; }
[dir="rtl"] .workflow-overview > header > a .app-icon { transform: rotate(180deg); }
.workflow-track { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.workflow-track::before { content: ""; position: absolute; z-index: 0; top: 26px; inset-inline: 10% 10%; height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); }
.workflow-step { position: relative; z-index: 1; display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 11px; min-height: 92px; padding: 14px; background: color-mix(in srgb, var(--surface-muted) 55%, transparent); border: 1px solid var(--line); border-radius: 16px; transition: transform .2s var(--ease-out), border-color .2s ease, background .2s ease; }
.workflow-step:hover { transform: translateY(-4px); background: var(--surface-solid); border-color: var(--line-strong); }
.workflow-step > span { display: grid; width: 50px; height: 50px; place-items: center; color: #fff; background: linear-gradient(135deg, var(--phthalo-700), var(--phthalo-900)); border: 4px solid color-mix(in srgb, var(--surface-solid) 75%, transparent); border-radius: 15px; box-shadow: 0 10px 24px rgba(11,59,46,.18); }
.workflow-step > span .app-icon { width: 20px; }
.workflow-step small, .workflow-step strong, .workflow-step b { display: block; }
.workflow-step small { color: var(--muted); font-size: 8px; letter-spacing: .1em; }
.workflow-step strong { margin-top: 3px; font-size: 10px; }
.workflow-step b { margin-top: 5px; color: var(--phthalo-700); font-size: 24px; }
html[data-theme="dark"] .workflow-step b { color: var(--accent-mint); }
.dashboard-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; margin-bottom: 20px; }
.metric-glance { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 13px; min-height: 128px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm); }
.metric-glance-icon { display: grid; width: 48px; height: 48px; place-items: center; color: var(--phthalo-800); background: color-mix(in srgb, var(--warm-beige) 50%, transparent); border-radius: 14px; }
.metric-glance-icon .app-icon { width: 21px; }
.metric-glance small, .metric-glance strong, .metric-glance p { display: block; }
.metric-glance > div > small { color: var(--muted); font-size: 9px; }
.metric-glance strong { margin-top: 4px; font-size: 28px; letter-spacing: -.04em; }
.metric-glance strong b { margin-inline-start: 2px; color: var(--muted); font-size: 12px; }
.metric-glance p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.metric-glance > i[data-progress-ring] { --p: calc(var(--progress) * 1%); display: grid; width: 46px; height: 46px; place-items: center; background: conic-gradient(var(--phthalo-600) var(--p), var(--surface-muted) 0); border-radius: 50%; }
.metric-glance > i[data-progress-ring]::after { content: ""; width: 34px; height: 34px; background: var(--surface-solid); border-radius: 50%; }
.metric-glance > a { display: grid; width: 40px; height: 40px; place-items: center; color: var(--phthalo-700); background: var(--surface-muted); border-radius: 12px; }
.metric-glance > a .app-icon { width: 17px; }
[dir="rtl"] .metric-glance > a .app-icon { transform: rotate(180deg); }
.dashboard-priority { margin-bottom: 20px; padding: 22px; border-radius: 22px; }
.section-count { display: grid; min-width: 42px; height: 42px; place-items: center; color: var(--phthalo-900); background: var(--warm-beige); border-radius: 13px; font-weight: 900; }
.priority-order-card { background: var(--surface-solid); border-color: var(--line); border-radius: 16px; box-shadow: none; }
html[data-theme="dark"] .priority-order-card { color: var(--ink); background: var(--surface-muted); }
.recent-orders-card { padding: 22px; }
.inline-table-search { position: relative; display: flex; width: min(330px, 100%); align-items: center; }
.inline-table-search > .app-icon { position: absolute; z-index: 2; inset-inline-start: 12px; width: 17px; color: var(--muted); }
.inline-table-search input { min-height: 42px; padding-inline: 39px 70px; font-size: 11px; }
.inline-table-search span { position: absolute; inset-inline-end: 10px; color: var(--muted); font-size: 9px; }
.modern-table { border-color: var(--line); border-radius: 15px; }
.modern-table table { background: var(--surface-solid); }
.modern-table th { color: var(--muted); background: var(--surface-muted); font-size: 10px; letter-spacing: .02em; }
.modern-table td { border-color: var(--line); }
.modern-table tbody tr { transition: background .15s ease; }
.modern-table tbody tr:hover { background: color-mix(in srgb, var(--warm-beige) 20%, transparent); }

/* Catalog / product library */
.catalog-heading { padding: 6px 4px 0; }
.catalog-heading-orbit { display: grid; grid-template-columns: 44px auto; grid-template-rows: 1fr 1fr; align-items: center; min-width: 150px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 17px; box-shadow: var(--shadow-sm); }
.catalog-heading-orbit > span { grid-row: 1 / 3; display: grid; width: 42px; height: 42px; place-items: center; color: #fff; background: linear-gradient(135deg, var(--phthalo-700), var(--phthalo-900)); border-radius: 13px; }
.catalog-heading-orbit .app-icon { width: 19px; }
.catalog-heading-orbit b { font-size: 19px; line-height: 1; }
.catalog-heading-orbit small { color: var(--muted); font-size: 9px; }
.modern-create-card { padding: 0; overflow: hidden; }
.modern-create-card > summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 22px; cursor: pointer; list-style: none; }
.modern-create-card > summary::-webkit-details-marker { display: none; }
.modern-create-card > summary > div:first-child { display: flex; align-items: center; gap: 14px; }
.create-product-icon { display: grid; width: 50px; height: 50px; place-items: center; color: #fff; background: linear-gradient(135deg, var(--phthalo-700), var(--phthalo-900)); border-radius: 15px; box-shadow: 0 10px 24px rgba(11,59,46,.2); }
.create-product-icon .app-icon { width: 22px; }
.modern-create-card h2 { margin: 3px 0; font-size: 18px; }
.modern-create-card .code-preview { min-width: 180px; background: var(--surface-muted); }
.create-product-form { padding: 22px; border-top: 1px solid var(--line); }
.product-library-shell { min-width: 0; }
.product-search-console {
  position: sticky;
  z-index: 25;
  top: 88px;
  margin-bottom: 18px;
  padding: 14px;
  background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: 19px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(1.2);
}
.product-search-main { position: relative; display: grid; grid-template-columns: 22px 1fr auto auto; align-items: center; gap: 9px; }
.product-search-main > .app-icon { width: 20px; color: var(--phthalo-700); }
html[data-theme="dark"] .product-search-main > .app-icon { color: var(--accent-mint); }
.product-search-main input { min-height: 50px; padding: 0 8px; font-size: 14px; background: transparent; border: 0; box-shadow: none; }
.product-search-main input:focus { box-shadow: none; }
.product-search-main .button { min-height: 42px; }
.product-filter-bar { display: flex; align-items: flex-end; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.product-filter-bar label { display: grid; min-width: 160px; gap: 4px; }
.product-filter-bar label span { color: var(--muted); font-size: 9px; }
.product-filter-bar select { min-height: 38px; padding-block: 7px; font-size: 11px; }
.product-filter-bar > p { margin: 0 0 9px auto; color: var(--muted); font-size: 10px; }
.product-filter-bar > p strong { color: var(--ink); font-size: 14px; }
.product-view-toggle { display: inline-flex; padding: 3px; background: var(--surface-muted); border: 1px solid var(--line); border-radius: 11px; }
.product-view-toggle button { display: grid; width: 34px; height: 32px; place-items: center; color: var(--muted); background: transparent; border: 0; border-radius: 8px; font-size: 17px; }
.product-view-toggle button.active { color: #fff; background: var(--phthalo-800); box-shadow: var(--shadow-xs); }
.product-library-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.product-library-card { position: relative; display: flex; min-width: 0; flex-direction: column; padding: 17px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); backdrop-filter: blur(18px); transition: transform .25s var(--ease-out), border-color .2s ease, box-shadow .25s ease; }
.product-library-card::before { content: ""; position: absolute; width: 130px; height: 130px; top: -76px; inset-inline-end: -55px; background: radial-gradient(circle, color-mix(in srgb, var(--warm-beige) 62%, transparent), transparent 68%); border-radius: 50%; pointer-events: none; }
.product-library-card:hover { transform: translateY(-5px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.product-library-card.product-code-missing { border-color: color-mix(in srgb, #c88722 35%, var(--line)); }
.product-card-header { position: relative; z-index: 1; display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: start; gap: 11px; }
.product-monogram { display: grid; width: 46px; height: 46px; place-items: center; color: var(--warm-beige); background: linear-gradient(145deg, var(--phthalo-700), var(--phthalo-950)); border-radius: 14px; box-shadow: 0 9px 20px rgba(11,59,46,.2); font-size: 18px; font-weight: 900; }
.product-card-title { min-width: 0; }
.product-card-title small { display: block; color: var(--phthalo-700); font-size: 9px; font-weight: 900; }
html[data-theme="dark"] .product-card-title small { color: var(--accent-mint); }
.product-card-title h3 { margin: 4px 0 2px; overflow: hidden; color: var(--ink); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.product-card-title p { margin: 0; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.product-code-state { display: inline-flex; align-items: center; gap: 4px; padding: 5px 7px; border-radius: 999px; font-size: 8px; font-weight: 900; white-space: nowrap; }
.product-code-state .app-icon { width: 11px; }
.product-code-state.complete { color: #176246; background: #e4f4ec; }
.product-code-state.missing { color: #8b5c17; background: #fff2d7; }
html[data-theme="dark"] .product-code-state.complete { color: #a7e4c5; background: rgba(42,136,91,.2); }
html[data-theme="dark"] .product-code-state.missing { color: #efca88; background: rgba(159,101,18,.22); }
.product-card-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.product-card-codes > span { min-width: 0; padding: 9px; background: color-mix(in srgb, var(--surface-muted) 72%, transparent); border: 1px solid var(--line); border-radius: 11px; }
.product-card-codes small { display: block; margin-bottom: 4px; color: var(--muted); font-size: 8px; }
.product-card-codes code { display: block; padding: 0; overflow: hidden; color: var(--ink); background: transparent; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.product-card-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin: 13px 0; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 13px; }
.product-card-metrics > div { padding: 10px; background: var(--surface-solid); }
.product-card-metrics dt { color: var(--muted); font-size: 8px; }
.product-card-metrics dd { margin: 4px 0 0; color: var(--ink); font-size: 12px; font-weight: 900; }
.product-card-metrics dd small { color: var(--muted); font-size: 8px; font-weight: 600; }
.product-card-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; }
.product-card-actions > .button, .product-card-actions > form { flex: 1; }
.product-card-actions > form .button { width: 100%; }
.product-card-actions .button { min-height: 38px; font-size: 9px; }
.product-card-actions .app-icon { width: 14px; }
.product-card-editor { flex: 1 1 100%; }
.product-card-editor > summary { display: flex; min-height: 38px; align-items: center; justify-content: center; gap: 6px; color: var(--phthalo-800); background: var(--surface-muted); border: 1px solid var(--line); border-radius: 10px; font-size: 9px; font-weight: 900; cursor: pointer; list-style: none; }
html[data-theme="dark"] .product-card-editor > summary { color: var(--warm-beige); }
.product-card-editor > summary::-webkit-details-marker { display: none; }
.product-card-editor[open] > summary { border-end-start-radius: 0; border-end-end-radius: 0; }
.product-editor-panel { padding: 14px; background: var(--surface-muted); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 13px 13px; }
.product-editor-heading { margin-bottom: 12px; }
.product-editor-heading strong, .product-editor-heading small { display: block; }
.product-editor-heading strong { font-size: 12px; }
.product-editor-heading small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.product-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.product-editor-grid label { gap: 4px; font-size: 9px; }
.product-editor-grid input, .product-editor-grid select { min-width: 0; min-height: 38px; padding: 8px; font-size: 11px; }
.product-editor-actions { display: flex; gap: 7px; justify-content: flex-end; margin-top: 12px; }
.product-editor-actions form { margin: 0; }
.product-library-grid[data-view="list"] { grid-template-columns: 1fr; }
.product-library-grid[data-view="list"] .product-library-card { display: grid; grid-template-columns: minmax(280px, 1.2fr) minmax(280px, 1fr) minmax(300px, 1fr); align-items: center; gap: 14px; }
.product-library-grid[data-view="list"] .product-card-codes,
.product-library-grid[data-view="list"] .product-card-metrics { margin: 0; }
.product-library-grid[data-view="list"] .product-card-actions { margin: 0; }
.product-library-grid[data-view="list"] .product-card-editor { grid-column: 1 / -1; }
.product-library-empty { grid-column: 1 / -1; display: grid; min-height: 260px; place-items: center; align-content: center; padding: 30px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 20px; text-align: center; }
.product-library-empty .app-icon { width: 34px; color: var(--phthalo-700); }
.product-library-empty h2 { margin: 12px 0 4px; color: var(--ink); }
.product-library-empty p { margin: 0; }

/* Tables and legacy modules in both themes */
.table-wrap { border-color: var(--line); }
table { color: var(--ink); background: var(--surface-solid); }
th { color: var(--phthalo-800); background: var(--surface-muted); }
html[data-theme="dark"] th { color: var(--warm-beige); }
td { border-color: var(--line); }
tbody tr:hover { background: color-mix(in srgb, var(--warm-beige) 13%, transparent); }
.review-row { background: color-mix(in srgb, #e7aa43 10%, var(--surface-solid)); }
.upload-box, .paste-order-box, .product-create-card, .history-import-card { background: color-mix(in srgb, var(--surface-muted) 72%, transparent); border-color: var(--line-strong); }
.paste-divider span { background: var(--page); border-color: var(--line-strong); }
.code-preview, code { color: var(--phthalo-800); background: var(--surface-muted); }
html[data-theme="dark"] code { color: var(--accent-mint); }
.language-switch { background: var(--surface-muted); border-color: var(--line); }
.language-switch a { color: var(--muted); }
.language-switch a.active { color: #fff; background: var(--phthalo-800); }
.assistant-panel { color: var(--ink); background: var(--surface-solid); border-color: var(--line); }
.assistant-messages, .assistant-welcome, .assistant-message.assistant, .assistant-panel > form { background: var(--surface-solid); border-color: var(--line); }
.assistant-quick button { color: var(--phthalo-700); background: var(--surface-muted); border-color: var(--line); }
html[data-theme="dark"] .assistant-quick button { color: var(--accent-mint); }
.sticky-actions { background: color-mix(in srgb, var(--surface-solid) 94%, transparent); border-color: var(--line); }

/* Landing */
.landing-body { --landing-green: var(--phthalo-900); --landing-orange: var(--accent-sand); color: var(--ink); background: var(--page); }
.landing-header {
  top: 14px;
  inset-inline: max(16px, calc((100vw - 1280px) / 2));
  width: auto;
  height: 68px;
  padding: 8px 10px 8px 14px;
  color: #fff;
  background: rgba(6,31,24,.72);
  border: 1px solid rgba(232,220,200,.15);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(3,23,18,.18);
  backdrop-filter: blur(24px) saturate(1.3);
}
.landing-header.scrolled { background: rgba(6,31,24,.9); }
.landing-brand { width: 112px; height: 50px; padding: 5px; background: var(--warm-beige); border-radius: 13px; }
.landing-brand img { width: 100%; height: 100%; object-fit: contain; }
.landing-header nav a { color: rgba(255,255,255,.72); }
.landing-header nav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.landing-lang { color: #fff; border-color: rgba(232,220,200,.18); background: rgba(255,255,255,.06); }
.landing-login { color: var(--phthalo-900); background: linear-gradient(135deg, #22c55e, #16a34a); box-shadow: 0 8px 20px rgba(0,0,0,.16); }
.landing-hero {
  min-height: 850px;
  padding: 150px 0 80px;
  color: #fff;
  background:
    radial-gradient(circle at 12% 92%, rgba(142,215,183,.14), transparent 28rem),
    radial-gradient(circle at 88% 12%, rgba(232,220,200,.12), transparent 24rem),
    linear-gradient(145deg, #102416, #060f08 68%);
}
.landing-hero::before { content: ""; position: absolute; inset: 0; opacity: .08; background-image: linear-gradient(rgba(255,255,255,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.12) 1px, transparent 1px); background-size: 54px 54px; mask-image: linear-gradient(to bottom, #000, transparent 86%); }
.hero-grid { position: relative; z-index: 2; grid-template-columns: .92fr 1.08fr; gap: 42px; }
.landing-kicker { color: var(--warm-beige); }
.landing-kicker i { background: var(--accent-mint); }
.hero-copy h1 { max-width: 690px; color: #fff; font-size: clamp(44px, 5.2vw, 76px); }
.hero-copy h1 em { color: var(--warm-beige); }
.hero-copy > p { color: rgba(232,220,200,.72); }
.landing-cta { border-radius: 14px; }
.landing-cta-primary { color: var(--phthalo-900); background: linear-gradient(135deg, #22c55e, #16a34a); box-shadow: 0 16px 36px rgba(0,0,0,.18); }
.landing-cta-secondary { color: #fff; background: rgba(255,255,255,.055); border-color: rgba(232,220,200,.18); }
.hero-trust { color: rgba(232,220,200,.62); }
.hero-visual { min-height: 590px; }
.hero-saas-glow { position: absolute; width: 430px; height: 430px; top: 65px; inset-inline-start: 80px; background: rgba(53,165,132,.18); border-radius: 50%; filter: blur(70px); }
.hero-saas-window { position: absolute; z-index: 1; top: 55px; inset-inline: 15px 25px; overflow: hidden; color: #132118; background: rgba(247,242,233,.95); border: 1px solid rgba(255,255,255,.55); border-radius: 22px; box-shadow: 0 38px 90px rgba(0,0,0,.3); transform: perspective(1200px) rotateY(-7deg) rotateX(3deg); transform-origin: center; animation: saasWindowFloat 7s ease-in-out infinite; backdrop-filter: blur(20px); }
[dir="rtl"] .hero-saas-window { transform: perspective(1200px) rotateY(7deg) rotateX(3deg); }
.hero-saas-window > header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 13px 15px; border-bottom: 1px solid rgba(11,59,46,.1); }
.window-dots { display: flex; gap: 4px; }
.window-dots i { width: 7px; height: 7px; background: #bd9d6c; border-radius: 50%; }.window-dots i:nth-child(2) { opacity: .65; }.window-dots i:nth-child(3) { opacity: .35; }
.hero-saas-window header strong { font-size: 10px; text-align: center; }
.hero-saas-window header b { justify-self: end; display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; color: #17684e; background: #e4f2eb; border-radius: 999px; font-size: 8px; }
.hero-saas-window header b i { width: 5px; height: 5px; background: #2aad73; border-radius: 50%; box-shadow: 0 0 0 3px rgba(42,173,115,.12); }
.hero-saas-body { padding: 15px; }
.hero-saas-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hero-saas-metrics > span { padding: 10px; background: #fffdf9; border: 1px solid rgba(11,59,46,.09); border-radius: 11px; }
.hero-saas-metrics small, .hero-saas-metrics strong, .hero-saas-metrics em { display: block; }
.hero-saas-metrics small { color: #77877f; font-size: 7px; }
.hero-saas-metrics strong { margin-top: 4px; font-size: 16px; }
.hero-saas-metrics em { margin-top: 3px; color: #25845f; font-size: 7px; font-style: normal; }
.hero-saas-chart { display: grid; grid-template-columns: 130px 1fr; align-items: end; gap: 12px; margin-top: 9px; padding: 12px; background: #fffdf9; border: 1px solid rgba(11,59,46,.09); border-radius: 12px; }
.hero-saas-chart small, .hero-saas-chart strong { display: block; }.hero-saas-chart small { color: #77877f; font-size: 7px; }.hero-saas-chart strong { margin-top: 7px; font-size: 18px; }.hero-saas-chart strong span { color: #77877f; font-size: 7px; font-weight: 600; }
.hero-saas-chart ol { display: flex; height: 70px; align-items: flex-end; gap: 6px; margin: 0; padding: 0; list-style: none; }
.hero-saas-chart li { flex: 1; height: var(--h); background: linear-gradient(to top, #1b6d56, #7fc9aa); border-radius: 5px 5px 2px 2px; animation: chartGrow 1.2s var(--ease-out) both; transform-origin: bottom; }.hero-saas-chart li.active { background: linear-gradient(to top, #b58d55, #f5a800); }
.hero-saas-feed { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 9px; }
.hero-saas-feed p { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 7px; margin: 0; padding: 8px; background: #fffdf9; border: 1px solid rgba(11,59,46,.09); border-radius: 11px; }
.hero-saas-feed p > span { grid-row: 1 / 3; display: grid; width: 29px; height: 29px; place-items: center; color: #fff; background: #1c6d56; border-radius: 9px; }.hero-saas-feed svg { width: 15px; }
.hero-saas-feed b { overflow: hidden; font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }.hero-saas-feed small { color: #77877f; font-size: 6px; }
.hero-produce-orb { position: absolute; z-index: 3; width: 235px; height: 235px; inset-inline-end: -5px; bottom: 8px; }
.hero-produce-orb .hero-orbit-one { inset: -22px; }.hero-produce-orb .hero-orbit-two { inset: 8px; }
.hero-produce-orb .hero-image-card { inset: 18px; background: radial-gradient(circle, rgba(53,165,132,.34), transparent 66%); border-radius: 50%; }
.hero-produce-orb .hero-image-card img { width: 145%; height: 145%; }
.floating-badge { color: var(--phthalo-900); background: rgba(247,242,233,.94); border: 1px solid rgba(255,255,255,.5); border-radius: 13px; }
.floating-badge span small, .floating-badge span b { display: block; }.floating-badge span small { color: #708078; font-size: 7px; }.floating-badge span b { margin-top: 2px; font-size: 10px; }
.floating-badge-quality { top: 22px; inset-inline-start: -8px; }.floating-badge-cold { right: auto; inset-inline-start: 55px; bottom: 33px; }
.landing-numbers { background: var(--warm-beige); }
.section-heading-light span, .section-heading-light h2 { color: var(--phthalo-900); }
.number-grid article { color: var(--phthalo-900); border-color: rgba(11,59,46,.16); }
.number-grid article > span { color: rgba(11,59,46,.65); }
.landing-about, .landing-steps { background: var(--page-elevated); }
.about-copy h2, .section-heading h2 { color: var(--ink); }
.about-copy p, .section-heading p { color: var(--muted); }
.about-stamp { color: var(--phthalo-900); background: var(--warm-beige); }
.landing-products { background: color-mix(in srgb, var(--warm-beige) 42%, var(--page)); }
.landing-product-card { background: var(--surface-solid); border-color: var(--line); border-radius: 21px; box-shadow: var(--shadow-sm); }
.product-card-image { background: color-mix(in srgb, var(--warm-beige) 42%, var(--surface-muted)) !important; }
.product-carousel-controls button { color: var(--phthalo-900); background: var(--surface-solid); border-color: var(--line); }
.landing-why { color: #fff; background: linear-gradient(145deg, #102416, #060f08); }
.landing-why .section-heading-light span, .landing-why .section-heading-light h2 { color: #fff; }
.why-grid article { background: rgba(255,255,255,.055); border-color: rgba(232,220,200,.12); }
.contact-card { background: linear-gradient(135deg, var(--warm-beige), #d9c4a3); }
.contact-card h2, .contact-card p { color: var(--phthalo-900); }
.landing-footer { background: #041813; }
html[data-theme="dark"] .landing-about,
html[data-theme="dark"] .landing-products,
html[data-theme="dark"] .landing-steps { background: var(--page); }
html[data-theme="dark"] .landing-numbers { background: #c9b18e; }
html[data-theme="dark"] .landing-product-card { background: var(--surface-solid); }
html[data-theme="dark"] .about-visual { border-color: var(--line); }

@keyframes livePulse { 50% { opacity: .55; box-shadow: 0 0 0 9px rgba(105,212,157,.03); } }
@keyframes chipFloat { 50% { transform: translateY(-7px); } }
@keyframes saasWindowFloat { 50% { transform: perspective(1200px) rotateY(-5deg) rotateX(1deg) translateY(-8px); } }
[dir="rtl"] .hero-saas-window { animation-name: saasWindowFloatRtl; }
@keyframes saasWindowFloatRtl { 50% { transform: perspective(1200px) rotateY(5deg) rotateX(1deg) translateY(-8px); } }
@keyframes chartGrow { from { transform: scaleY(.05); opacity: .25; } }

/* Page entrance and reduced motion */
.authenticated-body .app-shell > * { animation: pageRise .42s var(--ease-out) both; }
.authenticated-body .app-shell > *:nth-child(2) { animation-delay: 35ms; }
.authenticated-body .app-shell > *:nth-child(3) { animation-delay: 70ms; }
.authenticated-body .app-shell > *:nth-child(4) { animation-delay: 105ms; }
@keyframes pageRise { from { opacity: 0; transform: translateY(10px); } }

/* Responsive */
@media (max-width: 1280px) {
  .topbar-command { width: min(370px, 32vw); }
  .dashboard-hero { grid-template-columns: 1.1fr .9fr; padding-inline: 32px; }
  .product-library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .landing-header { inset-inline: 16px; }
}
@media (max-width: 1180px) {
  .app-sidebar { width: min(310px, calc(100vw - 42px)); }
  .app-topbar { inset-inline: 0; }
  .authenticated-body .app-shell { margin-inline-start: 0; }
  .topbar-command { width: min(430px, 42vw); }
  .login-experience { grid-template-columns: 1fr minmax(390px, .82fr); }
  .login-showcase { padding-inline: 42px; }
  .dashboard-hero { grid-template-columns: 1fr; }
  .dashboard-hero-focus { position: absolute; width: 360px; inset-inline-end: 20px; opacity: .7; }
  .dashboard-hero-copy { max-width: 65%; }
}
@media (max-width: 980px) {
  .topbar-command { width: 44px; padding: 0; justify-content: center; }
  .topbar-command span, .topbar-command kbd { display: none; }
  .theme-toggle-label { display: none; }
  .login-experience { grid-template-columns: 1fr; }
  .login-showcase { display: none; }
  .login-card { width: min(520px, calc(100% - 40px)); }
  .workflow-track { grid-template-columns: 1fr 1fr; }
  .workflow-track::before { display: none; }
  .dashboard-metrics { grid-template-columns: 1fr 1fr; }
  .dashboard-metrics .metric-glance:last-child { grid-column: 1 / -1; }
  .product-library-grid[data-view="list"] .product-library-card { grid-template-columns: 1fr 1fr; }
  .product-library-grid[data-view="list"] .product-card-actions { grid-column: 1 / -1; }
  .landing-hero { min-height: auto; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-copy { text-align: center; }
  .hero-visual { width: min(680px, 100%); margin: 0 auto; }
}
@media (max-width: 720px) {
  .guest-controls { top: max(10px, env(safe-area-inset-top)); inset-inline-end: 10px; }
  .guest-controls .theme-toggle-label { display: none; }
  .login-shell { padding: 10px; }
  .login-experience { min-height: calc(100dvh - 20px); border-radius: 22px; }
  .login-card { width: calc(100% - 32px); margin: 100px auto 36px; }
  .login-brand .login-logo { width: 78px; }
  .app-topbar { height: calc(68px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 10px 0; gap: 7px; }
  .authenticated-body .app-shell { padding: calc(88px + env(safe-area-inset-top)) 10px calc(90px + env(safe-area-inset-bottom)); }
  .topbar-title { min-width: 0; flex: 1; }
  .topbar-title span { display: none; }
  .topbar-title strong { width: 100%; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-command { order: 2; width: 42px; height: 42px; flex: 0 0 42px; }
  .topbar-actions { order: 3; }
  .topbar-actions .language-switch, .topbar-actions .topbar-logout, .topbar-actions form { display: none; }
  .theme-toggle, .notification-button, .sidebar-toggle { width: 42px; min-width: 42px; height: 42px; padding: 0; }
  .dashboard-hero { min-height: 455px; padding: 27px 20px; border-radius: 22px; }
  .dashboard-hero-copy { max-width: 100%; align-self: start; }
  .dashboard-hero h1 { font-size: 36px; }
  .dashboard-hero-focus { width: 320px; min-height: 230px; right: 50%; bottom: -24px; transform: translateX(50%) scale(.82); opacity: .82; }
  [dir="ltr"] .dashboard-hero-focus { right: auto; left: 50%; transform: translateX(-50%) scale(.82); }
  .dashboard-hero-actions { position: relative; z-index: 5; }
  .dashboard-primary-action, .dashboard-secondary-action { flex: 1; }
  .workflow-overview { padding: 16px; }
  .workflow-overview > header { align-items: flex-start; flex-direction: column; }
  .workflow-track { grid-template-columns: 1fr 1fr; gap: 8px; }
  .workflow-step { grid-template-columns: 42px 1fr; min-height: 82px; padding: 10px; }
  .workflow-step > span { width: 42px; height: 42px; }
  .dashboard-metrics { grid-template-columns: 1fr; }
  .dashboard-metrics .metric-glance:last-child { grid-column: auto; }
  .recent-orders-card { padding: 14px; }
  .inline-table-search { width: 100%; }
  .product-search-console { top: calc(74px + env(safe-area-inset-top)); padding: 10px; border-radius: 15px; }
  .product-search-main { grid-template-columns: 20px 1fr auto; }
  .product-search-main kbd { display: none; }
  .product-search-main .button { padding-inline: 12px; }
  .product-filter-bar { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; }
  .product-filter-bar label { min-width: 0; }
  .product-filter-bar > p { grid-column: 1 / -1; margin: 0; }
  .product-library-grid { grid-template-columns: 1fr; }
  .product-library-grid[data-view="list"] .product-library-card { display: flex; }
  .modern-create-card > summary { align-items: flex-start; flex-direction: column; }
  .modern-create-card .code-preview { width: 100%; }
  .product-editor-grid { grid-template-columns: 1fr; }
  .command-palette { padding: 8px; align-items: start; }
  .command-dialog { margin-top: 7vh; border-radius: 18px; }
  .command-hint > span:last-child { display: none; }
  .landing-header { top: 8px; inset-inline: 8px; height: 62px; border-radius: 15px; }
  .landing-brand { width: 86px; height: 44px; }
  .landing-header-actions { gap: 5px; }
  .landing-theme-toggle, .landing-lang { width: 36px; min-width: 36px; height: 36px; }
  .landing-login { min-height: 36px; padding-inline: 11px; font-size: 10px; }
  .landing-hero { padding-top: 120px; }
  .hero-copy h1 { font-size: clamp(38px, 11vw, 54px); }
  .hero-visual { min-height: 470px; }
  .hero-saas-window { inset-inline: 0; top: 40px; transform: none; animation: mobileWindowFloat 6s ease-in-out infinite; }
  [dir="rtl"] .hero-saas-window { transform: none; animation-name: mobileWindowFloat; }
  @keyframes mobileWindowFloat { 50% { transform: translateY(-7px); } }
  .hero-saas-chart { grid-template-columns: 100px 1fr; }
  .hero-produce-orb { width: 185px; height: 185px; bottom: 0; }
  .floating-badge-quality { inset-inline-start: 0; }
  .floating-badge-cold { inset-inline-start: 10px; bottom: 8px; }
}
@media (max-width: 460px) {
  .dashboard-hero { min-height: 500px; }
  .dashboard-hero-actions { flex-direction: column; }
  .workflow-track { grid-template-columns: 1fr; }
  .product-card-header { grid-template-columns: 42px minmax(0, 1fr); }
  .product-code-state { grid-column: 2; width: fit-content; }
  .product-filter-bar { grid-template-columns: 1fr 1fr; }
  .product-view-toggle { grid-column: 1 / -1; width: fit-content; }
  .hero-saas-metrics > span:nth-child(3) { display: none; }
  .hero-saas-metrics { grid-template-columns: 1fr 1fr; }
  .hero-saas-feed { grid-template-columns: 1fr; }
  .hero-saas-feed p:nth-child(2) { display: none; }
  .hero-produce-orb { width: 150px; height: 150px; }
  .floating-badge { transform: scale(.9); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media print {
  .theme-toggle, .topbar-command, .command-palette, .guest-controls { display: none !important; }
}
.login-product-name { display: block; margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .04em; }

/* v4.3.1 — theme consistency, readable contrast, complete navigation control */
:root {
  --success-ink: #12613f;
  --success-surface: #e5f6ed;
  --info-ink: #155f78;
  --info-surface: #e2f2f7;
  --warning-ink: #855a12;
  --warning-surface: #fff1d8;
  --danger-ink: #9a343b;
  --danger-surface: #fde9eb;
}
html[data-theme="dark"] {
  --success-ink: #a8e6c7;
  --success-surface: rgba(37,130,85,.20);
  --info-ink: #9ed9e6;
  --info-surface: rgba(34,119,145,.20);
  --warning-ink: #f0cd8c;
  --warning-surface: rgba(166,105,21,.22);
  --danger-ink: #f0a4aa;
  --danger-surface: rgba(166,47,51,.23);
}

/* Icon-only theme control prevents label/icon overlap in either language. */
.theme-toggle {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  flex: 0 0 42px;
}
.theme-toggle .theme-icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.theme-toggle .theme-icon-moon { transform: translateY(18px) rotate(25deg); }
html[data-theme="dark"] .theme-toggle .theme-icon-sun { transform: translateY(-18px) rotate(-25deg); }
html[data-theme="dark"] .theme-toggle .theme-icon-moon { transform: none; }

/* Desktop and mobile sidebar can both be opened and closed. */
.app-sidebar,
.app-topbar,
.authenticated-body .app-shell {
  transition: transform .28s var(--ease-out), inset-inline-start .28s var(--ease-out), margin-inline-start .28s var(--ease-out), padding .28s var(--ease-out);
}
.sidebar-toggle {
  display: grid !important;
  min-width: 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--ink);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}
.sidebar-close {
  position: absolute;
  z-index: 3;
  top: 28px;
  inset-inline-end: 14px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  color: rgba(237,245,241,.82);
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(232,220,200,.11);
  border-radius: 10px;
}
.sidebar-close:hover { color: #fff; background: rgba(255,255,255,.14); }
.sidebar-close .app-icon { width: 18px; height: 18px; }
.sidebar-brand { padding-inline-end: 48px; }
@media (min-width: 1181px) {
  .authenticated-body.sidebar-collapsed .app-sidebar { transform: translateX(-102%); }
  [dir="rtl"] .authenticated-body.sidebar-collapsed .app-sidebar { transform: translateX(102%); }
  .authenticated-body.sidebar-collapsed .app-topbar { inset-inline-start: 0; }
  .authenticated-body.sidebar-collapsed .app-shell { margin-inline-start: 0; }
}
@media (max-width: 1180px) {
  .sidebar-close { top: 20px; }
}

/* Prevent English labels and action text from overflowing their components. */
:where(.app-topbar, .app-sidebar, .card, .page-heading, .form-grid, .dashboard-layout, .product-library-card, .finance-summary, .document-summary, .workflow-grid, .user-account-card) > * { min-width: 0; }
.button, button, summary, .sidebar-nav a, .language-switch a {
  overflow-wrap: anywhere;
}
.button { white-space: normal; text-align: center; line-height: 1.25; }
.sidebar-nav a > span { min-width: 0; line-height: 1.3; }
html[dir="ltr"] .sidebar-nav a > span { white-space: normal; overflow-wrap: anywhere; }
html[dir="ltr"] .sidebar-nav a { min-height: 46px; }
html[dir="ltr"] .sidebar-section-label { line-height: 1.35; }
html[dir="ltr"] :where(.card h1, .card h2, .card h3, .page-heading h1, .page-heading h2, .product-card-title strong, .product-card-title small, .form-section-title h2, .form-section-title p) {
  overflow-wrap: anywhere;
  hyphens: auto;
}
html[dir="ltr"] .topbar-title { min-width: 120px; max-width: min(28vw, 360px); }
html[dir="ltr"] .topbar-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
input, select, textarea { min-width: 0; }

/* All legacy light surfaces now inherit the active theme instead of staying white. */
.topbar,
.app-topbar {
  color: var(--ink);
  background: color-mix(in srgb, var(--surface-solid) 90%, transparent);
  border-color: var(--line);
}
html[data-theme="dark"] .app-topbar,
html[data-theme="dark"] .topbar {
  background: rgba(6,25,20,.91);
  box-shadow: 0 10px 30px rgba(0,0,0,.16);
}

:where(
  .stat-card,
  .file-card,
  .executive-kpi,
  .mini-stats article,
  .form-section,
  .report-tabs,
  .error-card,
  .user-account-card,
  .branch-profile,
  .notification-card,
  .delivery-stats a,
  .delivery-job-hero,
  .priority-order-card,
  .priority-customer-card,
  .data-health > div:not(:first-child),
  .workflow-grid a,
  .document-summary > div,
  .invoice-live-totals > div,
  .invoice-totals-card > div,
  .user-card-section,
  .decision-item,
  .priority-branch-list header,
  .assistant-welcome,
  .assistant-message.assistant,
  .assistant-panel > form
) {
  color: var(--ink);
  background: var(--surface-solid);
  border-color: var(--line);
}

:where(
  .workflow-grid a,
  .user-card-section,
  .document-summary > div,
  .invoice-live-totals > div,
  .invoice-totals-card > div,
  .branch-profile dl div,
  .priority-toggle,
  .manual-lines-table .product-search-input,
  .finance-lines-table output,
  .assistant-messages,
  .empty-chart
) {
  color: var(--ink);
  background: var(--surface-muted);
  border-color: var(--line);
}

.product-search { color: var(--ink) !important; background: var(--surface-solid) !important; border-color: var(--line-strong) !important; }
html[data-theme="dark"] .product-search { background: #0b251e !important; }
.review-table select, .review-table input, .catalog-input { color: var(--ink); background: var(--surface-solid); border-color: var(--line-strong); }
select option { color: var(--ink); background: var(--surface-solid); }

html[data-theme="dark"] tbody tr:hover { background: rgba(232,220,200,.055); }
html[data-theme="dark"] .review-row,
html[data-theme="dark"] .delivery-row-printed,
html[data-theme="dark"] .delivery-row-confirming,
html[data-theme="dark"] .priority-order { background: rgba(166,105,21,.13); }
html[data-theme="dark"] .delivery-row-rejected { background: rgba(166,47,51,.14); }
html[data-theme="dark"] .inventory-movement-card,
html[data-theme="dark"] .product-create-card,
html[data-theme="dark"] .paste-order-box,
html[data-theme="dark"] .upload-box { background: var(--surface-muted); border-color: var(--line-strong); }
html[data-theme="dark"] .form-footer,
html[data-theme="dark"] .sticky-actions { background: rgba(8,31,25,.94); border-color: var(--line); }

/* Explicit readable semantic states in both modes. */
.alert-success, .positive-state, .service-status-enabled, .service-status-help.service-status-ready { color: var(--success-ink); background: var(--success-surface); border-color: color-mix(in srgb, var(--success-ink) 28%, transparent); }
.alert-warning, .service-status-disabled, .service-status-help, .form-note { color: var(--warning-ink); background: var(--warning-surface); border-color: color-mix(in srgb, var(--warning-ink) 28%, transparent); }
.alert-error, .password-admin-form { color: var(--danger-ink); background: var(--danger-surface); border-color: color-mix(in srgb, var(--danger-ink) 28%, transparent); }
.current-account-badge, .account-state-active { color: var(--success-ink); background: var(--success-surface); }
.account-state-disabled { color: var(--danger-ink); background: var(--danger-surface); }

html[data-theme="dark"] :where(
  .executive-kpi strong,
  .workflow-grid strong,
  .rank-row b,
  .data-health strong,
  .mini-stats strong,
  .invoice-live-totals strong,
  .invoice-totals-card strong,
  .delivery-stats strong,
  .delivery-customer strong,
  .branch-profile h3,
  .priority-order-card b,
  .priority-customer-card h3,
  .partner-form h2,
  .user-account-title h3
) { color: var(--ink); }

html[data-theme="dark"] .kpi-icon,
html[data-theme="dark"] .rank-index,
html[data-theme="dark"] .notification-symbol,
html[data-theme="dark"] .branch-profile > div span,
html[data-theme="dark"] .forecast-mini-list em,
html[data-theme="dark"] .priority-expand-label i {
  color: var(--accent-mint);
  background: rgba(53,165,132,.15);
}
html[data-theme="dark"] .executive-kpi-amber .kpi-icon,
html[data-theme="dark"] .notification-symbol { color: var(--warning-ink); background: var(--warning-surface); }
html[data-theme="dark"] .executive-kpi-red .kpi-icon { color: var(--danger-ink); background: var(--danger-surface); }
html[data-theme="dark"] .executive-kpi-navy .kpi-icon,
html[data-theme="dark"] .executive-kpi-teal .kpi-icon { color: var(--info-ink); background: var(--info-surface); }

/* Keep the printable label intentionally paper-white, but guarantee dark readable ink. */
.barcode-label { color: #102c24; background: #fffefa; }
.barcode-label h1, .barcode-label p, .barcode-label strong, .barcode-label code { color: #102c24; }

/* English table labels for responsive finance cards. */
@media (max-width: 760px) {
  html[dir="ltr"] .pricing-lines-table td:first-child::before { content: "Product"; }
  html[dir="ltr"] .pricing-lines-table td:nth-child(2)::before { content: "Unit"; }
  html[dir="ltr"] .pricing-lines-table td:nth-child(3)::before { content: "Price (SAR)"; }
  html[dir="ltr"] .pricing-lines-table td:nth-child(4)::before { content: "Note"; }
  html[dir="ltr"] .invoice-lines-table td:first-child::before { content: "Product"; }
  html[dir="ltr"] .invoice-lines-table td:nth-child(2)::before { content: "Quantity"; }
  html[dir="ltr"] .invoice-lines-table td:nth-child(3)::before { content: "Unit"; }
  html[dir="ltr"] .invoice-lines-table td:nth-child(4)::before { content: "Unit price/cost"; }
  html[dir="ltr"] .invoice-lines-table td:nth-child(5)::before { content: "Discount %"; }
  html[dir="ltr"] .invoice-lines-table td:nth-child(6)::before { content: "Tax %"; }
  html[dir="ltr"] .invoice-lines-table td:nth-child(7)::before { content: "Total"; }
}

@media print {
  .sidebar-close { display: none !important; }
  .barcode-label { color: #000 !important; background: #fff !important; }
}

/* v4.3.1 dark-mode specificity fixes for legacy modules */
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .file-card,
html[data-theme="dark"] .executive-kpi,
html[data-theme="dark"] .mini-stats article,
html[data-theme="dark"] .form-section,
html[data-theme="dark"] .report-tabs,
html[data-theme="dark"] .error-card,
html[data-theme="dark"] .user-account-card,
html[data-theme="dark"] .branch-profile,
html[data-theme="dark"] .notification-card,
html[data-theme="dark"] .delivery-stats a,
html[data-theme="dark"] .delivery-job-hero,
html[data-theme="dark"] .priority-order-card,
html[data-theme="dark"] .priority-customer-card,
html[data-theme="dark"] .data-health > div:not(:first-child),
html[data-theme="dark"] .workflow-grid a,
html[data-theme="dark"] .document-summary > div,
html[data-theme="dark"] .invoice-live-totals > div,
html[data-theme="dark"] .invoice-totals-card > div,
html[data-theme="dark"] .user-card-section,
html[data-theme="dark"] .decision-item,
html[data-theme="dark"] .priority-branch-list header,
html[data-theme="dark"] .assistant-welcome,
html[data-theme="dark"] .assistant-message.assistant,
html[data-theme="dark"] .assistant-panel > form,
html[data-theme="dark"] .metric-glance,
html[data-theme="dark"] .catalog-heading-orbit,
html[data-theme="dark"] .product-library-card,
html[data-theme="dark"] .modern-create-card,
html[data-theme="dark"] .workflow-overview,
html[data-theme="dark"] .recent-orders-card,
html[data-theme="dark"] .data-health {
  color: var(--ink);
  background: var(--surface-solid);
  border-color: var(--line);
}

html[data-theme="dark"] .workflow-grid a,
html[data-theme="dark"] .user-card-section,
html[data-theme="dark"] .document-summary > div,
html[data-theme="dark"] .invoice-live-totals > div,
html[data-theme="dark"] .invoice-totals-card > div,
html[data-theme="dark"] .branch-profile dl div,
html[data-theme="dark"] .priority-toggle,
html[data-theme="dark"] .manual-lines-table .product-search-input,
html[data-theme="dark"] .finance-lines-table output,
html[data-theme="dark"] .assistant-messages,
html[data-theme="dark"] .empty-chart,
html[data-theme="dark"] .metric-glance-icon,
html[data-theme="dark"] .metric-glance > a,
html[data-theme="dark"] .product-card-codes,
html[data-theme="dark"] .product-card-metrics {
  color: var(--ink);
  background: var(--surface-muted);
  border-color: var(--line);
}

html[data-theme="dark"] .empty-chart {
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.015), rgba(255,255,255,.015) 39px, rgba(232,220,200,.05) 40px);
}
html[data-theme="dark"] .chart-axis { stroke: rgba(232,220,200,.16); }
html[data-theme="dark"] .sales-chart text { fill: var(--muted); }
html[data-theme="dark"] .chart-point { fill: var(--surface-solid); }
html[data-theme="dark"] .rank-track { background: rgba(232,220,200,.10); }
html[data-theme="dark"] .alert-list a:hover { background: var(--surface-muted); }
html[data-theme="dark"] .priority-branch-list > a:hover { background: var(--surface-muted); }
html[data-theme="dark"] .priority-customer-card {
  border-color: color-mix(in srgb, var(--priority) 38%, var(--line));
  box-shadow: 0 10px 25px rgba(0,0,0,.18);
}
html[data-theme="dark"] .priority-order-card { border-color: var(--line); }
html[data-theme="dark"] .data-health { background: var(--surface); }
html[data-theme="dark"] .delivery-job-hero,
html[data-theme="dark"] .delivery-stats a { box-shadow: var(--shadow-sm); }
html[data-theme="dark"] .user-password-reset summary { color: var(--ink); background: var(--surface-muted); border-color: var(--line); }
html[data-theme="dark"] .service-status-help code { background: rgba(255,255,255,.07); }

/* v4.3.1 — exhaustive dark-mode compatibility for legacy modules */
html[data-theme="dark"] .button-light {
  color: var(--warm-beige);
  background: rgba(232, 220, 200, .10);
  border: 1px solid rgba(232, 220, 200, .22);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
}
html[data-theme="dark"] .button-light:hover {
  color: #fff;
  background: rgba(232, 220, 200, .17);
  border-color: rgba(232, 220, 200, .34);
}
html[data-theme="dark"] table,
html[data-theme="dark"] .report-tabs,
html[data-theme="dark"] .intelligence-tabs,
html[data-theme="dark"] .smart-customer-strip,
html[data-theme="dark"] .assistant-panel,
html[data-theme="dark"] .assistant-panel > form,
html[data-theme="dark"] .delivery-decision-actions details form,
html[data-theme="dark"] .delivery-confirm-guide > div,
html[data-theme="dark"] .order-anomaly,
html[data-theme="dark"] .role-card,
html[data-theme="dark"] .role-option,
html[data-theme="dark"] .recovery-methods label {
  color: var(--ink);
  background: var(--surface-solid);
  border-color: var(--line);
}
html[data-theme="dark"] tbody tr:hover,
html[data-theme="dark"] .smart-customer-card,
html[data-theme="dark"] .decision-item,
html[data-theme="dark"] .delivery-performance span,
html[data-theme="dark"] .delivery-inline-card,
html[data-theme="dark"] .delivery-job-hero dl div,
html[data-theme="dark"] .role-option:has(input:checked),
html[data-theme="dark"] .recovery-methods label:has(input:checked),
html[data-theme="dark"] .finance-lines-table tr,
html[data-theme="dark"] .branch-edit-fields input:last-child,
html[data-theme="dark"] .delivery-edit-table tr:not(.delivery-variance) [data-variance-reason] {
  color: var(--ink);
  background: var(--surface-muted);
  border-color: var(--line-strong);
}
html[data-theme="dark"] .role-card strong,
html[data-theme="dark"] .delivery-performance b,
html[data-theme="dark"] .delivery-customer strong,
html[data-theme="dark"] .priority-customer-heading > strong,
html[data-theme="dark"] .priority-branch-list header,
html[data-theme="dark"] .priority-branch-list > a,
html[data-theme="dark"] .smart-customer-card strong,
html[data-theme="dark"] .decision-item strong {
  color: var(--ink);
}
html[data-theme="dark"] .intelligence-tabs a {
  color: var(--muted);
}
html[data-theme="dark"] .intelligence-tabs a:hover {
  color: var(--ink);
  background: rgba(232, 220, 200, .07);
}
html[data-theme="dark"] .intelligence-tabs a.active {
  color: #fff;
  background: linear-gradient(135deg, var(--phthalo-600), var(--phthalo-800));
}
html[data-theme="dark"] .smart-customer-card {
  background: linear-gradient(135deg, var(--surface-muted), var(--surface-solid));
}
html[data-theme="dark"] .smart-customer-card > span,
html[data-theme="dark"] .decision-item > span,
html[data-theme="dark"] .notification-symbol,
html[data-theme="dark"] .order-anomaly > span,
html[data-theme="dark"] .priority-expand-label i,
html[data-theme="dark"] .assistant-feedback button,
html[data-theme="dark"] .assistant-quick button {
  color: var(--warning-ink);
  background: var(--warning-surface);
  border-color: color-mix(in srgb, var(--warning-ink) 25%, transparent);
}
html[data-theme="dark"] .assistant-panel,
html[data-theme="dark"] .assistant-messages {
  background: var(--surface-solid);
  border-color: var(--line);
}
html[data-theme="dark"] .assistant-quick button,
html[data-theme="dark"] .assistant-feedback button {
  color: var(--accent-mint);
  background: rgba(53, 165, 132, .13);
  border-color: rgba(142, 215, 183, .18);
}
html[data-theme="dark"] .priority-customer-card dl div,
html[data-theme="dark"] .priority-expand-label,
html[data-theme="dark"] .priority-branch-list > a,
html[data-theme="dark"] .delivery-performance span {
  color: var(--ink);
  background: color-mix(in srgb, var(--surface-muted) 86%, var(--priority, var(--phthalo-600)) 14%);
  border: 1px solid var(--line);
}
html[data-theme="dark"] .priority-customer-card dt,
html[data-theme="dark"] .priority-customer-card > summary > small,
html[data-theme="dark"] .priority-branch-list > a small,
html[data-theme="dark"] .delivery-performance span {
  color: var(--muted);
}
html[data-theme="dark"] .priority-customer-card dd,
html[data-theme="dark"] .priority-customer-heading > span,
html[data-theme="dark"] .priority-expand-label,
html[data-theme="dark"] .priority-branch-list > a b {
  color: color-mix(in srgb, var(--priority, var(--accent-mint)) 68%, var(--ink));
}
html[data-theme="dark"] .priority-branch-list {
  border-color: var(--line);
}
html[data-theme="dark"] .priority-branch-list header {
  background: var(--surface-solid);
}
html[data-theme="dark"] .priority-branch-list > a:hover {
  color: var(--ink);
  background: var(--surface-strong);
}
html[data-theme="dark"] .delivery-performance b { color: var(--ink); }
html[data-theme="dark"] .manual-review-row,
html[data-theme="dark"] .review-row,
html[data-theme="dark"] .delivery-row-printed,
html[data-theme="dark"] .delivery-row-confirming,
html[data-theme="dark"] .priority-order,
html[data-theme="dark"] .delivery-variance {
  color: var(--ink);
  background: rgba(166, 105, 21, .14) !important;
}
html[data-theme="dark"] .delivery-row-rejected {
  color: var(--ink);
  background: rgba(166, 47, 51, .16);
}
html[data-theme="dark"] .matrix-wrap th:first-child,
html[data-theme="dark"] .matrix-wrap td:first-child,
html[data-theme="dark"] .empty-cell {
  color: var(--muted);
  background: var(--surface-solid);
}
html[data-theme="dark"] .positive-state,
html[data-theme="dark"] .current-account-badge,
html[data-theme="dark"] .account-state-active,
html[data-theme="dark"] .badge-success {
  color: #b8efd2;
}
html[data-theme="dark"] .topbar-logout {
  color: var(--ink);
  background: rgba(232, 220, 200, .08);
  border: 1px solid var(--line);
}
html[data-theme="dark"] .topbar-logout:hover {
  color: #fff;
  background: rgba(232, 220, 200, .14);
}
html[data-theme="dark"] .sidebar-brand-mark,
html[data-theme="dark"] .sidebar-brand img {
  background: color-mix(in srgb, var(--warm-beige) 88%, var(--surface-solid));
}

/* Mixed Arabic/English names must stay inside their cards instead of widening the page. */
.smart-customer-strip,
.smart-customer-grid,
.smart-customer-card,
.smart-customer-card > div,
.priority-customer-card,
.priority-customer-card summary,
.priority-customer-heading,
.priority-branch-list > a > span {
  min-width: 0;
}
.smart-customer-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  max-width: 100%;
  overflow: hidden;
}
.smart-customer-card {
  grid-template-columns: 32px minmax(0, 1fr) minmax(0, auto);
  max-width: 100%;
  overflow: hidden;
}
.smart-customer-card strong,
.smart-customer-card small,
.smart-customer-card b {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.smart-customer-card b {
  max-width: 96px;
}
html[dir="ltr"] .smart-customer-card strong,
html[dir="ltr"] .smart-customer-card small,
html[dir="ltr"] .priority-branch-list > a strong,
html[dir="ltr"] .priority-branch-list > a small {
  direction: auto;
  unicode-bidi: plaintext;
}

/* Keep compact controls readable without allowing labels to sit over icons. */
.theme-toggle-label.visually-hidden { display: block !important; position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.theme-toggle .theme-icon,
.landing-theme-toggle .theme-icon { pointer-events: none; }

/* v4.3.1 — contrast corrections for analytics, finance, and compact states */
html[data-theme="dark"] .intelligence-hero,
html[data-theme="dark"] .customer-intelligence-hero {
  color: #fff;
  background:
    radial-gradient(circle at 15% 20%, rgba(113, 216, 158, .22), transparent 30%),
    linear-gradient(125deg, #102416, #15803d 58%, #22c55e);
  border-color: rgba(142, 215, 183, .20);
  box-shadow: 0 18px 45px rgba(0, 0, 0, .26);
}
html[data-theme="dark"] .intelligence-hero h1,
html[data-theme="dark"] .customer-intelligence-hero h1 {
  color: #fff;
}
html[data-theme="dark"] .intelligence-hero p,
html[data-theme="dark"] .customer-intelligence-hero p,
html[data-theme="dark"] .hero-orb small {
  color: #d2ebe3;
}
html[data-theme="dark"] .intelligence-hero .eyebrow,
html[data-theme="dark"] .customer-intelligence-hero .eyebrow {
  color: #66ff33;
}
html[data-theme="dark"] .hero-orb {
  color: #fff;
  background: rgba(255, 255, 255, .11);
  border-color: rgba(255, 255, 255, .22);
}
html[data-theme="dark"] .executive-kpi {
  color: var(--ink);
  background: linear-gradient(145deg, var(--surface-solid), var(--surface-muted));
  border-color: var(--line-strong);
}
html[data-theme="dark"] .executive-kpi > span {
  color: #bed1c9;
}
html[data-theme="dark"] .executive-kpi > strong,
html[data-theme="dark"] .executive-kpi > strong small,
html[data-theme="dark"] .stat-card strong,
html[data-theme="dark"] .finance-stats .stat-card strong {
  color: #f7efe4;
}
html[data-theme="dark"] .executive-kpi > small,
html[data-theme="dark"] .stat-card > small {
  color: #a9beb5;
}
html[data-theme="dark"] .smart-customer-card b {
  color: #f1cf91;
}
html[data-theme="dark"] .positive-state,
html[data-theme="dark"] .current-account-badge,
html[data-theme="dark"] .account-state-active,
html[data-theme="dark"] .badge-success {
  color: #d4f8e5;
  background: rgba(37, 130, 85, .27);
  border-color: rgba(111, 214, 160, .25);
}
html[data-theme="dark"] .button-ghost {
  color: #edf7f2;
  background: rgba(232, 220, 200, .10);
  border-color: rgba(232, 220, 200, .16);
}
html[data-theme="dark"] .button-ghost:hover {
  color: #fff;
  background: rgba(232, 220, 200, .17);
}
html[data-theme="dark"] .field-label,
html[data-theme="dark"] .field-help,
html[data-theme="dark"] .user-card-section-heading p {
  color: var(--muted);
}
html[data-theme="dark"] .field-label {
  color: var(--ink);
}
html[data-theme="dark"] .service-status-help code {
  color: #b8efd2;
  background: rgba(255, 255, 255, .08);
  border: 1px solid var(--line);
}
html[data-theme="dark"] .alert-warning,
html[data-theme="dark"] .service-status-disabled,
html[data-theme="dark"] .service-status-help,
html[data-theme="dark"] .form-note {
  color: #f6dcaa;
}

/* v4.3.1 — keep decorative stat artwork behind readable content in both LTR and RTL */
.stat-card::after {
  left: auto;
  right: auto;
  inset-inline-end: -25px;
  pointer-events: none;
  z-index: 0;
}
.stat-card > * {
  position: relative;
  z-index: 1;
}


/* v5.0.0 — Saudi Electric Green enterprise palette */
html[data-theme="dark"] body {
  color: #fafafa;
  background:
    radial-gradient(circle at 88% -10%, rgba(34, 197, 94, .12), transparent 30rem),
    radial-gradient(circle at -6% 42%, rgba(102, 255, 51, .06), transparent 34rem),
    #060f08;
}

html[data-theme="dark"] .app-sidebar {
  color: #fafafa;
  background:
    radial-gradient(circle at 14% 0, rgba(34, 197, 94, .14), transparent 22rem),
    linear-gradient(165deg, #0a100b, #060f08 76%);
  border-color: #1e2b20;
}

html[data-theme="dark"] .app-topbar,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .command-palette,
html[data-theme="dark"] .command-dialog {
  background: color-mix(in srgb, #0a100b 94%, transparent);
  border-color: #1e2b20;
}

.button-primary,
.dashboard-primary-action,
.landing-login,
.landing-cta-primary,
.sidebar-nav a.active,
.language-switch a.active,
.intelligence-tabs a.active,
html[data-theme="dark"] .intelligence-tabs a.active {
  color: #060f08 !important;
  background: linear-gradient(135deg, #22c55e, #16a34a) !important;
  border-color: rgba(102, 255, 51, .30) !important;
  box-shadow: 0 12px 28px rgba(34, 197, 94, .22) !important;
}

.button-primary:hover,
.dashboard-primary-action:hover,
.landing-login:hover,
.landing-cta-primary:hover,
.sidebar-nav a.active:hover {
  background: linear-gradient(135deg, #66ff33, #22c55e) !important;
  box-shadow: 0 16px 34px rgba(34, 197, 94, .30) !important;
}

.sidebar-nav a.active i,
html[data-theme="dark"] .sidebar-nav a.active i {
  color: #060f08;
  background: #66ff33;
  border-color: rgba(6, 15, 8, .18);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .priority-orders-panel,
html[data-theme="dark"] .priority-customer-section,
html[data-theme="dark"] .anomaly-panel,
html[data-theme="dark"] .user-account-card,
html[data-theme="dark"] .partner-form,
html[data-theme="dark"] .form-section,
html[data-theme="dark"] .finance-summary,
html[data-theme="dark"] .executive-card,
html[data-theme="dark"] .delivery-job-hero,
html[data-theme="dark"] .forecast-card,
html[data-theme="dark"] .note-card,
html[data-theme="dark"] .settings-panel,
html[data-theme="dark"] .security-card,
html[data-theme="dark"] table,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  color: #fafafa;
  background-color: #0a100b;
  border-color: #1e2b20;
}

html[data-theme="dark"] th,
html[data-theme="dark"] .surface-muted,
html[data-theme="dark"] .command-hint,
html[data-theme="dark"] kbd {
  color: #fafafa;
  background-color: #0e1710;
  border-color: #1e2b20;
}

html[data-theme="dark"] .muted,
html[data-theme="dark"] small,
html[data-theme="dark"] .field-help,
html[data-theme="dark"] .card-heading p {
  color: #a8b5aa;
}

html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] code,
html[data-theme="dark"] .assistant-quick button,
html[data-theme="dark"] .positive-state,
html[data-theme="dark"] .badge-success,
html[data-theme="dark"] .account-state-active {
  color: #66ff33;
}

html[data-theme="dark"] a:hover,
html[data-theme="dark"] .sidebar-nav a:hover,
html[data-theme="dark"] .topbar-command:hover {
  border-color: #2a3b2d;
}

.dashboard-hero,
.landing-hero,
.landing-why,
html[data-theme="dark"] .intelligence-hero,
html[data-theme="dark"] .customer-intelligence-hero {
  color: #fafafa;
  background:
    radial-gradient(circle at 78% 30%, rgba(34, 197, 94, .18), transparent 26rem),
    radial-gradient(circle at 12% 90%, rgba(102, 255, 51, .07), transparent 24rem),
    linear-gradient(145deg, #102416, #060f08 76%) !important;
  border-color: #1e2b20;
}

.dashboard-hero h1 em,
.hero-copy h1 em,
.landing-kicker,
.focus-orbit::before,
.focus-orbit::after {
  color: #f5a800;
}

.focus-orbit::before,
.focus-orbit::after {
  background: #f5a800;
  box-shadow: 0 0 0 7px rgba(245, 168, 0, .10);
}

.dashboard-live-pill i,
.hero-saas-window header b i {
  background: #66ff33;
  box-shadow: 0 0 0 5px rgba(102, 255, 51, .12);
}

.landing-header,
.landing-header.scrolled,
.landing-footer {
  background: color-mix(in srgb, #060f08 92%, transparent);
  border-color: #1e2b20;
}

html[data-theme="dark"] .landing-about,
html[data-theme="dark"] .landing-products,
html[data-theme="dark"] .landing-steps,
html[data-theme="dark"] .landing-body {
  background: #060f08;
}

html[data-theme="dark"] .landing-product-card,
html[data-theme="dark"] .hero-saas-metrics > span,
html[data-theme="dark"] .hero-saas-chart,
html[data-theme="dark"] .hero-saas-feed p,
html[data-theme="dark"] .hero-saas-window,
html[data-theme="dark"] .floating-badge {
  color: #fafafa;
  background: #0a100b;
  border-color: #1e2b20;
}

.landing-numbers,
html[data-theme="dark"] .landing-numbers,
.contact-card {
  background: linear-gradient(135deg, #f5a800, #d88f00);
}

.landing-numbers *,
.contact-card h2,
.contact-card p,
.section-heading-light span,
.section-heading-light h2 {
  color: #060f08;
}

.product-card-image {
  background: color-mix(in srgb, #22c55e 12%, var(--surface-muted)) !important;
}

::selection {
  color: #060f08;
  background: #66ff33;
}

:focus-visible {
  outline-color: #66ff33;
}

/* Tazejah 5.0 — advanced operations, analytics, delivery and data governance */
.button-primary,
html[data-theme="dark"] .button-primary {
  color: #061108;
  background: #22c55e;
  border-color: #38d970;
  font-weight: 800;
  text-shadow: none;
  box-shadow: 0 12px 28px rgba(34, 197, 94, .22), inset 0 1px 0 rgba(255,255,255,.34);
}
.button-primary:hover,
html[data-theme="dark"] .button-primary:hover { color: #030a04; background: #4ade80; border-color: #66ff33; }

.advanced-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 7px;
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
  scrollbar-width: thin;
}
.advanced-tabs a {
  flex: 0 0 auto;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 11px;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}
.advanced-tabs a:hover { color: var(--ink); background: var(--surface-muted); }
.advanced-tabs a.active { color: #061108; background: var(--brand-primary); box-shadow: 0 8px 18px rgba(34,197,94,.2); }

.advanced-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 24px;
}
.advanced-metric {
  position: relative;
  min-width: 0;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 19px;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}
.advanced-metric::after {
  content: "";
  position: absolute;
  inset-inline-end: -28px;
  inset-block-end: -38px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--metric-accent, var(--brand-primary)) 11%, transparent);
  pointer-events: none;
  z-index: 0;
}
.advanced-metric > * { position: relative; z-index: 1; min-width: 0; }
.advanced-metric > span { color: var(--muted); font-size: .82rem; font-weight: 750; }
.advanced-metric > strong {
  display: block;
  color: var(--ink);
  font-size: clamp(1.28rem, 2.15vw, 2rem);
  line-height: 1.12;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.advanced-metric > small { color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.advanced-metric.green { --metric-accent: #22c55e; }
.advanced-metric.teal { --metric-accent: #2dd4bf; }
.advanced-metric.navy { --metric-accent: #60a5fa; }
.advanced-metric.gold { --metric-accent: #f5a800; }
.advanced-metric.red { --metric-accent: #fb7185; }
.advanced-metric.purple { --metric-accent: #c084fc; }
.advanced-metric::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 4px;
  background: var(--metric-accent, var(--brand-primary));
}

.smart-file-narrative,
.purchase-recommendation,
.business-warning,
.route-suggestion {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 18px 20px;
  margin: 16px 0;
  color: var(--ink);
  background: color-mix(in srgb, var(--brand-primary) 10%, var(--surface-solid));
  border: 1px solid color-mix(in srgb, var(--brand-primary) 36%, var(--line));
  border-radius: 17px;
  overflow: hidden;
}
.smart-file-narrative > span,
.purchase-recommendation > span { flex: 0 0 auto; color: var(--brand-primary); font-size: 1.35rem; }
.smart-file-narrative strong,
.purchase-recommendation p,
.business-warning p,
.route-suggestion p { min-width: 0; margin: 0; line-height: 1.7; overflow-wrap: anywhere; }
.business-warning { background: color-mix(in srgb, var(--brand-gold) 11%, var(--surface-solid)); border-color: color-mix(in srgb, var(--brand-gold) 42%, var(--line)); }

.branch-cards,
.route-suggestions-grid,
.decision-grid,
.kpi-grid,
.plan-grid,
.task-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 24px;
}
.branch-intel-card,
.decision-card,
.kpi-card,
.plan-card,
.task-card {
  min-width: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.branch-intel-card { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px 14px; text-decoration: none; }
.branch-intel-card:hover { border-color: var(--brand-primary); transform: translateY(-2px); }
.branch-intel-card div { min-width: 0; }
.branch-intel-card strong, .branch-intel-card span { display: block; overflow-wrap: anywhere; }
.branch-intel-card span, .branch-intel-card small { color: var(--muted); }
.branch-intel-card b { color: var(--brand-primary); white-space: nowrap; }

.advanced-columns { align-items: start; }
.advanced-columns > * { min-width: 0; }
.wrap-cell { min-width: 240px; max-width: 480px; white-space: normal; overflow-wrap: anywhere; }
.empty-cell { padding: 28px !important; text-align: center; color: var(--muted); }

.forecast-filter-grid,
.route-create-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
  padding: 18px;
}
.forecast-filter-grid label,
.route-create-form label { min-width: 0; }
.forecast-filter-grid .button,
.route-create-form .button { min-height: 44px; }

.bar-chart-list { display: grid; gap: 14px; }
.bar-chart-list article { min-width: 0; }
.bar-chart-list article > div:first-child { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 7px; }
.bar-chart-list strong { min-width: 0; overflow-wrap: anywhere; }
.bar-chart-list span { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track, .kpi-progress { height: 9px; overflow: hidden; background: var(--surface-strong); border-radius: 999px; }
.bar-track i, .kpi-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-primary), var(--brand-lime)); }
.kpi-progress { margin-top: 12px; }
.kpi-progress.gold span { background: var(--brand-gold); }
.kpi-progress.red span { background: #fb7185; }
.svg-chart { min-width: 0; overflow: hidden; color: var(--brand-primary); }
.svg-chart svg { display: block; width: 100%; min-width: 520px; height: auto; overflow: visible; }
.svg-chart circle { fill: var(--surface-solid); stroke: currentColor; stroke-width: 4; }
.chart-axis { display: flex; justify-content: space-between; min-width: 520px; color: var(--muted); font-size: .74rem; }

.executive-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(240px, .5fr);
  gap: 20px;
  padding: 26px;
  color: #fafafa;
  background: linear-gradient(135deg, #060f08 0%, #0a1d0f 56%, #14532d 100%);
  border: 1px solid #1e2b20;
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.executive-hero h1, .executive-hero p { color: inherit; }
.executive-score { display: flex; flex-direction: column; justify-content: center; align-items: center; min-width: 0; padding: 20px; background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.12); border-radius: 18px; text-align: center; }
.executive-score strong { color: #66ff33; font-size: clamp(2.1rem, 5vw, 4.4rem); line-height: 1; overflow-wrap: anywhere; }
.executive-score span { color: #c9d5cb; margin-top: 8px; }
.decision-card { border-inline-start: 4px solid var(--brand-primary); }
.decision-card.warning { border-inline-start-color: var(--brand-gold); }
.decision-card.danger { border-inline-start-color: #fb7185; }
.decision-card h3, .kpi-card h3, .plan-card h3, .task-card h3 { margin: 0; overflow-wrap: anywhere; }
.decision-card p, .kpi-card p, .plan-card p, .task-card p { color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }

.kpi-card header,
.plan-card header,
.task-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; min-width: 0; }
.kpi-card header > div,
.plan-card header > div,
.task-card header > div { min-width: 0; }
.kpi-card .kpi-value { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 16px; }
.kpi-card .kpi-value strong { font-size: 1.7rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.plan-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 14px 0; }
.plan-metrics div { min-width: 0; padding: 10px; background: var(--surface-muted); border-radius: 11px; }
.plan-metrics span, .plan-metrics strong { display: block; overflow-wrap: anywhere; }
.plan-metrics span { color: var(--muted); font-size: .75rem; }
.inline-plan-update,
.task-card form { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; gap: 8px; margin-top: 14px; }

.period-switch { display: flex; gap: 6px; flex-wrap: wrap; }
.period-switch a { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); text-decoration: none; }
.period-switch a.active { color: #061108; background: var(--brand-primary); border-color: var(--brand-primary); font-weight: 800; }

.map-card { padding: 0; overflow: hidden; }
[data-route-map], #delivery-route-map { width: 100%; min-height: 480px; background: var(--surface-muted); }
.route-suggestions-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.driver-stops-list { display: grid; gap: 15px; margin-top: 18px; }
.driver-stop-card {
  min-width: 0;
  padding: 19px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-inline-start: 5px solid var(--brand-primary);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}
.driver-stop-card header { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 14px; }
.driver-stop-card header > b { display: grid; place-items: center; width: 38px; height: 38px; color: #061108; background: var(--brand-primary); border-radius: 50%; }
.driver-stop-card h3 { margin: 0; overflow-wrap: anywhere; }
.stop-meta, .task-context { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; color: var(--muted); }
.stop-meta span, .task-context span { padding: 6px 9px; background: var(--surface-muted); border-radius: 9px; overflow-wrap: anywhere; }
.stop-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.proof-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; padding-top: 15px; margin-top: 15px; border-top: 1px solid var(--line); }
.proof-form canvas { width: 100%; height: 180px; touch-action: none; background: #fafafa; border: 1px solid var(--line-strong); border-radius: 13px; }
.proof-form .full-width { grid-column: 1 / -1; }
.proof-complete { color: var(--brand-primary); font-weight: 800; }

.task-card.critical { border-color: color-mix(in srgb,#fb7185 55%,var(--line)); }
.task-card.high { border-color: color-mix(in srgb,var(--brand-gold) 45%,var(--line)); }
.task-card.completed { opacity: .72; }
.task-context span { font-size: .78rem; }
.danger-zone { border-color: color-mix(in srgb,#fb7185 38%,var(--line)); }

.public-proof-page { width: min(1180px, calc(100% - 28px)); margin: 28px auto; }
.public-proof-page > header { display: grid; grid-template-columns: 90px minmax(0,1fr) auto; align-items: center; gap: 18px; padding: 22px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.public-proof-page > header img { width: 78px; }
.public-proof-page h1 { margin: 4px 0; overflow-wrap: anywhere; }
.proof-public-card { padding: 22px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.proof-public-card > img { max-width: 440px; max-height: 220px; object-fit: contain; background: #fff; border-radius: 12px; }
.proof-images { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-top: 14px; }
.proof-images img { width: 100%; height: 220px; object-fit: cover; border-radius: 13px; border: 1px solid var(--line); }
.public-proof-lock { text-align: center; color: var(--muted); }

/* Global resilience for bilingual layouts and large business numbers */
.app-shell *, .app-sidebar *, .app-topbar * { min-inline-size: 0; }
h1,h2,h3,h4,p,a,button,label,th,td,strong,small,span { overflow-wrap: anywhere; }
table { width: 100%; }
td, th { max-width: 420px; }
td > strong, td > small { display: block; }
[dir="ltr"] .sidebar-nav a span, [dir="ltr"] .topbar-title, [dir="ltr"] .card-heading { text-align: left; }
[dir="rtl"] .sidebar-nav a span, [dir="rtl"] .topbar-title, [dir="rtl"] .card-heading { text-align: right; }

@media (max-width: 1280px) {
  .advanced-metrics-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .forecast-filter-grid, .route-create-form { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .advanced-metrics-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .branch-cards,.decision-grid,.kpi-grid,.plan-grid,.task-grid,.route-suggestions-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .forecast-filter-grid,.route-create-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .executive-hero { grid-template-columns: 1fr; }
  [data-route-map], #delivery-route-map { min-height: 390px; }
}
@media (max-width: 620px) {
  .advanced-metrics-grid,.branch-cards,.decision-grid,.kpi-grid,.plan-grid,.task-grid,.route-suggestions-grid,.forecast-filter-grid,.route-create-form { grid-template-columns: 1fr; }
  .advanced-metric { min-height: 116px; }
  .advanced-metric > strong { font-size: 1.45rem; }
  .executive-hero { padding: 19px; }
  .driver-stop-card header { grid-template-columns: auto minmax(0,1fr); }
  .driver-stop-card header > :last-child { grid-column: 1 / -1; }
  .proof-form { grid-template-columns: 1fr; }
  .proof-form .full-width { grid-column: auto; }
  .inline-plan-update,.task-card form { grid-template-columns: 1fr; }
  .public-proof-page > header { grid-template-columns: 60px minmax(0,1fr); }
  .public-proof-page > header > :last-child { grid-column: 1 / -1; }
  .public-proof-page > header img { width: 56px; }
  .proof-images { grid-template-columns: 1fr; }
  .wrap-cell { min-width: 200px; }
}


/* v5.0.0 — dense analytics layout safeguards */
.forecast-trend-card .mini-line-chart { min-height: 240px; }
.forecast-diagnostics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.table-scroll-panel { max-height: 620px; overflow: auto; overscroll-behavior: contain; }
.table-scroll-panel thead { position: sticky; top: 0; z-index: 2; }
.table-scroll-panel th { box-shadow: 0 1px 0 var(--line); }
.metric-card strong,
.stat-card strong,
.executive-score strong,
.kpi-card strong,
.smart-stat strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-variant-numeric: tabular-nums;
  line-height: 1.12;
}
.metric-card,
.stat-card,
.kpi-card,
.smart-stat { min-width: 0; }
@media (max-width: 920px) {
  .forecast-diagnostics-grid { grid-template-columns: 1fr; }
  .table-scroll-panel { max-height: 520px; }
}

/* Service surveys and reliable proof-of-delivery signing — v5.1 */
.delivery-proof-entry { overflow: visible; }
.delivery-proof-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.delivery-proof-grid label { min-width: 0; }
.delivery-proof-grid .full-width { grid-column: 1 / -1; }
.signature-field canvas,
[data-signature-canvas] {
  display: block;
  width: 100%;
  min-height: 180px;
  max-height: 280px;
  margin-top: 8px;
  background: #fff !important;
  border: 2px dashed color-mix(in srgb, var(--brand-primary) 58%, var(--line));
  border-radius: 16px;
  cursor: crosshair;
  touch-action: none !important;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: contain;
}
.signature-field canvas:focus-visible,
[data-signature-canvas]:focus-visible { border-style: solid; box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-primary) 18%, transparent); }
.signature-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.signature-actions span { color: var(--muted); font-size: .86rem; }
.signature-actions span.signed { color: var(--brand-primary); font-weight: 800; }

.survey-metrics .advanced-metric strong { max-width: 100%; overflow-wrap: anywhere; }
.survey-rating-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.survey-rating-summary > div { display: grid; gap: 8px; min-width: 0; padding: 14px; border-radius: 14px; background: var(--surface-muted); border: 1px solid var(--line); }
.survey-rating-summary > div > span { color: var(--muted); font-size: .85rem; }
.survey-stars { display: inline-flex; align-items: center; gap: 2px; direction: ltr; white-space: nowrap; max-width: 100%; }
.survey-stars b { color: var(--brand-gold); letter-spacing: .08em; }
.survey-stars i { color: color-mix(in srgb, var(--muted) 32%, transparent); font-style: normal; letter-spacing: .08em; }
.survey-stars small { margin-inline-start: 6px; color: var(--muted); }
.survey-filters { display: grid; grid-template-columns: 1fr 1.5fr 1fr 1fr 1fr auto; gap: 12px; align-items: end; }
.survey-filters label { min-width: 0; }
.survey-actions { flex-wrap: wrap; min-width: 190px; }

.public-survey-page { width: min(760px, calc(100% - 28px)); margin: 32px auto; display: grid; gap: 20px; }
.public-survey-brand { display: flex; align-items: center; gap: 14px; padding: 10px 4px; }
.public-survey-brand img { width: 64px; height: 64px; object-fit: contain; }
.public-survey-brand p { margin: 0; color: var(--brand-primary); font-weight: 900; }
.public-survey-brand strong { color: var(--ink); font-size: 1.05rem; }
.public-survey-card {
  color: var(--ink);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
  padding: clamp(22px, 5vw, 44px);
  overflow: hidden;
}
.public-survey-card h1 { margin: 6px 0 12px; color: var(--ink); font-size: clamp(1.8rem, 5vw, 3rem); overflow-wrap: anywhere; }
.public-survey-card > p { color: var(--muted); line-height: 1.8; }
.public-survey-card footer { display: flex; justify-content: space-between; gap: 16px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.public-survey-identity, .public-rating-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
.public-survey-identity button, .public-rating-form > button, .public-rating-form .full-width { grid-column: 1 / -1; }
.survey-rating-card { width: 100%; }
.star-rating-field { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-muted); }
.star-rating-field legend { padding: 0 8px; color: var(--ink); font-weight: 800; }
.star-rating-options { display: inline-flex; flex-direction: row; direction: rtl; justify-content: flex-end; gap: 4px; }
.star-rating-options input { position: absolute; opacity: 0; pointer-events: none; }
.star-rating-options label { color: color-mix(in srgb, var(--muted) 35%, transparent); cursor: pointer; font-size: clamp(2rem, 8vw, 3.2rem); line-height: 1; transition: color .15s ease, transform .15s ease; }
.star-rating-options label:hover,
.star-rating-options label:hover ~ label,
.star-rating-options input:checked ~ label { color: var(--brand-gold); transform: translateY(-2px); }
.star-rating-field small { display: block; margin-top: 8px; color: var(--muted); }
.survey-thanks { text-align: center; }
.survey-thanks > span { display: grid; place-items: center; width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 50%; color: #061108; background: var(--brand-primary); font-size: 2.2rem; font-weight: 900; }
.survey-thanks .survey-stars { justify-content: center; margin: 16px auto; }

@media (max-width: 1000px) {
  .survey-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .survey-filters .button { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .delivery-proof-grid,
  .public-survey-identity,
  .public-rating-form,
  .survey-rating-summary { grid-template-columns: 1fr; }
  .delivery-proof-grid .full-width,
  .public-survey-identity button,
  .public-rating-form > button,
  .public-rating-form .full-width { grid-column: 1; }
  .survey-filters { grid-template-columns: 1fr; }
  .survey-filters .button { grid-column: 1; }
  .signature-actions { align-items: stretch; flex-direction: column; }
  [data-signature-canvas] { min-height: 210px; }
  .public-survey-page { margin: 14px auto 28px; }
  .public-survey-card { border-radius: 22px; }
}

/* Granular user access editor — v5.1 */
.access-role-panel { display: grid; gap: 10px; }
.permission-editor { display: grid; gap: 16px; margin-top: 16px; }
.permission-mode-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.permission-mode-switch > label { min-width: 0; display: flex; align-items: flex-start; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-muted); cursor: pointer; }
.permission-mode-switch > label:has(input:checked) { border-color: var(--brand-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 14%, transparent); }
.permission-mode-switch input { margin-top: 4px; accent-color: var(--brand-primary); }
.permission-mode-switch span { min-width: 0; display: grid; gap: 4px; }
.permission-mode-switch strong { color: var(--ink); overflow-wrap: anywhere; }
.permission-mode-switch small { color: var(--muted); line-height: 1.55; overflow-wrap: anywhere; }
.permission-groups { display: grid; gap: 12px; }
.permission-group { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-solid); }
.permission-group > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; cursor: pointer; }
.permission-group > summary::-webkit-details-marker { display: none; }
.permission-group > summary span { min-width: 0; display: grid; gap: 4px; }
.permission-group > summary strong { color: var(--ink); overflow-wrap: anywhere; }
.permission-group > summary small { color: var(--muted); font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.permission-group > summary b { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; color: var(--brand-primary); background: color-mix(in srgb, var(--brand-primary) 12%, transparent); font-size: .78rem; }
.permission-group-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 16px 12px; }
.permission-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 16px 16px; }
.permission-option { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-muted); cursor: pointer; }
.permission-option:has(input:checked) { border-color: color-mix(in srgb, var(--brand-primary) 65%, var(--line)); background: color-mix(in srgb, var(--brand-primary) 8%, var(--surface-muted)); }
.permission-option input { margin-top: 4px; accent-color: var(--brand-primary); }
.permission-option span { min-width: 0; display: grid; gap: 4px; }
.permission-option strong { color: var(--ink); font-size: .92rem; overflow-wrap: anywhere; }
.permission-option small { color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.permission-option em { align-self: start; white-space: nowrap; padding: 3px 7px; border-radius: 999px; color: var(--muted); background: var(--surface-solid); font-size: .68rem; font-style: normal; }
.permission-option.permission-risk em { color: var(--danger); }
.permission-editor:not(.permission-editor-exact) .permission-groups { opacity: .72; }
.permission-editor:not(.permission-editor-exact) .permission-group-actions { display: none; }
.access-form-footer { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.access-form-footer .user-state-field { min-width: 180px; }
.new-user-permissions { margin-block: 8px; }
.new-user-permissions > summary { color: var(--brand-primary); font-weight: 800; cursor: pointer; }
@media (max-width: 880px) { .permission-options, .permission-mode-switch { grid-template-columns: 1fr; } }

.delivery-assignment-card .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) auto; align-items: end; }
.delivery-proof-summary-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .65fr); gap: 20px; align-items: stretch; }
.delivery-proof-summary-grid dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.delivery-proof-summary-grid dl > div { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-muted); }
.delivery-proof-summary-grid dt { color: var(--muted); font-size: .78rem; }
.delivery-proof-summary-grid dd { margin: 6px 0 0; color: var(--ink); font-weight: 800; overflow-wrap: anywhere; }
.delivery-proof-summary-grid figure { min-width: 0; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.delivery-proof-summary-grid figcaption { margin-bottom: 8px; color: #17312b; font-weight: 800; }
.delivery-proof-summary-grid img { display: block; width: 100%; max-height: 150px; object-fit: contain; }
.proof-file-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.delivery-note-create-step { border-color: color-mix(in srgb, var(--brand-primary) 55%, var(--line)); }
@media (max-width: 850px) {
  .delivery-assignment-card .form-grid, .delivery-proof-summary-grid, .delivery-proof-summary-grid dl { grid-template-columns: 1fr; }
}


/* v5.1.0 — final contrast and compact control safeguards */
html[data-theme="dark"] .metric-inline { color: var(--ink); }
.theme-toggle { overflow: hidden; }
.theme-toggle-label.visually-hidden {
  position: absolute !important;
  inline-size: 1px !important;
  block-size: 1px !important;
  clip-path: inset(50%) !important;
  clip: rect(0 0 0 0) !important;
  overflow: hidden !important;
  white-space: nowrap !important;
}
.long-number,
.metric-value,
.stat-card strong,
.advanced-metric strong,
.financial-value,
.kpi-value {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-variant-numeric: tabular-nums;
}

/* v5.1.0 — multilingual catalog readability */
html[data-theme="dark"] .code-preview strong { color: var(--ink); }
.product-card-title h3 {
  display: -webkit-box;
  min-height: 2.7em;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  text-overflow: ellipsis;
}

/* v5.2 — simplified delivery cycle and dual persistent signatures */
.delivery-receipt-card { overflow: visible; }
.delivery-cycle-confirm {
  display: grid;
  gap: 5px;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--brand-primary) 45%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--brand-primary) 9%, var(--surface));
}
.delivery-cycle-confirm strong { color: var(--ink); }
.delivery-cycle-confirm span { color: var(--muted); line-height: 1.7; }
.delivery-signature-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  min-width: 0;
}
.delivery-signature-pair figure {
  margin: 0;
  min-width: 0;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
}
.delivery-signature-pair figcaption { margin-bottom: 8px; color: var(--muted); font-weight: 800; }
.delivery-signature-pair img {
  display: block;
  width: 100%;
  height: 130px;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
}
.public-proof-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; }
.public-proof-details p { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .delivery-proof-grid,
  .delivery-signature-pair,
  .public-proof-details { grid-template-columns: 1fr; }
  [data-signature-canvas] { min-height: 220px; }
}
