/* ═══════════════════════════════════════════════════════════════
   DAWARCY POS — Production-grade Pharmacy ERP
   Architecture: Vanilla JS SPA · LocalStorage · Supabase sync
   Theme: Teal/Emerald medical palette
   ═══════════════════════════════════════════════════════════════ */

/* ─── Design tokens ─────────────────────────────────────────── */
:root {
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono",
    "Courier New", monospace;

  --bg:           #f3f4f6;
  --bg-soft:      #f8fafb;
  --surface:      #ffffff;
  --surface-2:    #f4f7fa;

  --text:         #0d1b2a;
  --text-muted:   #64748b;
  --text-dim:     #94a3b8;

  --border:       #e2e8f0;
  --border-soft:  #eef2f7;
  --table-row-alt:   #f8fafc;
  --table-row-hover: #f1f7fb;

  /* Primary — Teal */
  --primary:        #0d7a6b;
  --primary-strong: #085e52;
  --primary-soft:   #e6f4f2;
  --primary-light:  #b2ddd8;
  --accent:         #10a88f;

  /* Status */
  --success:        #059669;
  --success-soft:   #ecfdf5;
  --warning:        #b45309;
  --warning-soft:   #fffbeb;
  --danger:         #dc2626;
  --danger-soft:    #fef2f2;
  --danger-strong:  #b91c1c;
  --info:           #0068b3;
  --info-soft:      #e0f2fe;

  /* Sidebar */
  --sidebar-w:          clamp(186px, 15vw, 220px);
  --sidebar-bg:         #0a1628;
  --sidebar-bg2:        #0f2040;
  --sidebar-border:     rgba(255,255,255,0.07);
  --sidebar-text:       rgba(255,255,255,0.70);
  --sidebar-text-dim:   rgba(255,255,255,0.38);
--sidebar-active-bg:  rgba(0,104,179,0.14);
  --sidebar-hover-bg:   #eef5ff;

  /* Radius */
  --r-xl: 0.5em;
  --r-lg: 0.5em;
  --r-md: 0.5em;
  --r-sm: 0.5em;
  --card-radius: 0.5em;

  /* Shadow */
  --shadow-sm: 0 1px 3px rgba(13,27,42,0.06), 0 1px 2px rgba(13,27,42,0.04);
  --shadow:    0 4px 16px rgba(13,27,42,0.08), 0 2px 4px rgba(13,27,42,0.04);
  --shadow-md: 0 8px 32px rgba(13,27,42,0.10), 0 4px 8px rgba(13,27,42,0.06);
  --shadow-lg: 0 20px 48px rgba(13,27,42,0.14), 0 8px 16px rgba(13,27,42,0.08);
}

@view-transition {
  navigation: auto;
}
::view-transition-group(root),
::view-transition-old(root),
::view-transition-new(root) {
  animation: none !important;
}

/* ─── Dark mode — matte black ───────────────────────────────── */
[data-theme="dark"] {
  --bg:          #121212;
  --bg-soft:     #161616;
  --surface:     #1a1a1a;
  --surface-2:   #202020;

  --text:        #f1f5f9;
  --text-muted:  #94a3b8;
  --text-dim:    #475569;

  --border:      #2a2a2a;
  --border-soft: #242424;
  --table-row-alt:   #181818;
  --table-row-hover: #202020;

  --primary:       #10b89d;
  --primary-strong:#0d9882;
  --primary-soft:  #0d2820;
  --primary-light: #134a3e;
  --accent:        #14d4b4;

  --success:      #10b981;
  --success-soft: #042b1a;
  --warning:      #f59e0b;
  --warning-soft: #2a1a00;
  --danger:       #ef4444;
  --danger-soft:  #2a0a0a;
  --danger-strong:#f87171;
  --info:         #38bdf8;
  --info-soft:    #082030;

  --sidebar-bg:  #2c2c2c;
  --sidebar-bg2: #2c2c2c;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow:    0 4px 16px rgba(0,0,0,0.5);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.6);
  --shadow-lg: 0 20px 48px rgba(0,0,0,0.7);
}

/* ─── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; scroll-behavior: smooth; }
html {
  font-size: 14.5px;
  font-family: var(--font-sans);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}
h1,h2,h3,h4,h5 {
  margin: 0;
  line-height: 1.25;
  font-weight: 700;
  color: var(--text);
}
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ─── Keyframes ──────────────────────────────────────────────── */
@keyframes sectionIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideInRight {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes pulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ═══════════════════════════════════════════════════════════════
   BOOT LOADER
   ═══════════════════════════════════════════════════════════════ */
.boot-loader {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #0a1628 0%, #0d7a6b 50%, #0a1628 100%);
  display: grid; place-items: center;
  flex-direction: column; gap: 16px;
  transition: opacity 0.3s ease;
}
body:not(.app-booting) .boot-loader {
  opacity: 0; pointer-events: none;
  animation: none;
  display: none;
}
body.app-booting .app-shell { opacity: 0; pointer-events: none; }
.boot-loader-card {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.boot-spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #5eead4;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.boot-loader p { color: #ccfbf1; font-weight: 600; font-size: 1rem; margin: 0; }

/* ═══════════════════════════════════════════════════════════════
   AUTH SCREEN
   ═══════════════════════════════════════════════════════════════ */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  background: #f7faff;
  color: #0f172a;
  overflow: hidden;
}
.auth-overlay.open { display: block; }
.auth-screen {
  height: 100dvh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(560px, 1.12fr) minmax(420px, 0.88fr);
}
.auth-brand-panel {
  position: relative;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  color: #f8fbff;
  background:
    radial-gradient(circle at 80% 0%, rgba(37, 99, 235, 0.28), transparent 34%),
    radial-gradient(circle at 10% 105%, rgba(14, 165, 233, 0.18), transparent 32%),
    linear-gradient(135deg, #03162f 0%, #05234a 46%, #082f67 100%);
}
.auth-brand-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(147, 197, 253, 0.2) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.18;
}
.auth-brand-panel::after {
  content: "";
  position: absolute;
  right: -22%;
  bottom: -16%;
  width: 78%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(147, 197, 253, 0.16);
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.04));
  box-shadow: inset 0 0 80px rgba(96, 165, 250, 0.12);
}
.auth-brand-content {
  position: relative;
  z-index: 2;
  width: min(620px, calc(100% - 112px));
  margin: 0 auto;
  padding: clamp(24px, 4vh, 38px) 0;
}
.auth-brand-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}
.auth-brand-lockup h1 {
  color: #f8fbff;
  font-size: clamp(1.75rem, 2.55vw, 2.65rem);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.auth-brand-lockup p {
  margin-top: 7px;
  color: rgba(226, 232, 240, 0.88);
  font-size: clamp(1.05rem, 1.35vw, 1.42rem);
  line-height: 1.1;
}
.auth-brand-rule {
  width: 62px;
  height: 4px;
  margin-bottom: 22px;
  border-radius: 999px;
  background: #2563eb;
}
.auth-brand-panel h2 {
  position: relative;
  z-index: 2;
  max-width: 760px;
  color: #f8fbff;
  font-size: clamp(1.95rem, 2.95vw, 3.1rem);
  line-height: 1.12;
  letter-spacing: -0.045em;
  font-weight: 800;
}
.auth-brand-copy {
  max-width: 690px;
  margin-top: 12px;
  color: rgba(226, 232, 240, 0.92);
  font-size: clamp(0.94rem, 1.06vw, 1.08rem);
  line-height: 1.42;
}
.auth-feature-list {
  display: grid;
  gap: 10px;
  max-width: 520px;
  margin-top: 20px;
}
.auth-feature-item {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 16px;
  align-items: center;
}
.auth-feature-item + .auth-feature-item div {
  padding-top: 10px;
  border-top: 1px solid rgba(147, 197, 253, 0.18);
}
.auth-feature-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(147, 197, 253, 0.32);
  border-radius: 16px;
  background: rgba(15, 42, 88, 0.52);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.auth-feature-icon svg {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: #f8fbff;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.auth-feature-item h3 {
  color: #f8fbff;
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.auth-feature-item p {
  color: rgba(226, 232, 240, 0.9);
  font-size: 0.86rem;
  line-height: 1.28;
}
.auth-illustration {
  position: absolute;
  right: -4%;
  bottom: 0;
  z-index: 1;
  width: 42%;
  height: 54%;
  opacity: 0.28;
  background:
    linear-gradient(180deg, rgba(96, 165, 250, 0.38), rgba(15, 23, 42, 0.38)),
    linear-gradient(90deg, transparent 0 12%, rgba(191, 219, 254, 0.34) 12% 14%, transparent 14% 100%);
  border-radius: 130px 0 0 0;
  border-left: 1px solid rgba(147, 197, 253, 0.24);
}
.auth-illustration div {
  position: absolute;
  left: 18%;
  right: 8%;
  height: 13%;
  border-radius: 8px;
  background: rgba(191, 219, 254, 0.26);
}
.auth-illustration div:nth-child(1) { top: 22%; }
.auth-illustration div:nth-child(2) { top: 43%; }
.auth-illustration div:nth-child(3) { top: 64%; }
.auth-form-panel {
  height: 100dvh;
  min-height: 100dvh;
  padding: clamp(18px, 2.4vw, 32px) clamp(24px, 3.4vw, 48px) 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  background:
    radial-gradient(circle at 86% 8%, rgba(219, 234, 254, 0.58), transparent 28%),
    linear-gradient(180deg, #f8fbff 0%, #f3f7fc 100%);
}
.auth-card {
  width: min(424px, 100%);
  margin: 0 auto;
  padding: clamp(24px, 2.8vw, 32px);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #d8e2ef;
  border-radius: 0.85em;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.1);
  animation: modalIn 0.3s ease;
}
.auth-logo {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  box-shadow: 0 12px 28px rgba(14, 165, 233, 0.22);
}
.auth-logo-large {
  width: 66px;
  height: 66px;
  margin: 0;
  border-radius: 16px;
}
.auth-logo svg {
  width: 27px;
  height: 27px;
  color: white;
}
.auth-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
}
.auth-logo-large svg {
  width: 34px;
  height: 34px;
}
.auth-card h2 {
  text-align: center;
  color: #111827;
  font-size: clamp(1.55rem, 1.7vw, 1.9rem);
  line-height: 1.15;
  margin-bottom: 8px;
  letter-spacing: -0.035em;
  font-weight: 800;
}
.auth-subtitle {
  text-align: center;
  color: #526385;
  font-size: 0.98rem;
  margin-bottom: 22px;
}
.auth-form-group {
  margin-bottom: 14px;
}
.auth-form-group .form-label {
  color: #0f172a;
  font-size: 0.88rem;
  font-weight: 800;
  margin-bottom: 6px;
}
.auth-input-wrap {
  position: relative;
}
.auth-input-wrap svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.auth-input-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  color: #7080a0;
  stroke-width: 1.9;
  pointer-events: none;
}
.auth-input.input {
  height: 48px;
  padding-left: 58px;
  padding-right: 54px;
  border-radius: 0.65em;
  border: 1px solid #cbd8e8;
  background: #fbfdff;
  color: #111827;
  font-size: 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.auth-input.input::placeholder {
  color: #687899;
}
.auth-input.input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}
.auth-password-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #7080a0;
  border-radius: 0.5em;
}
.auth-password-toggle:hover {
  background: #eef5ff;
  color: #2563eb;
}
.auth-password-toggle svg {
  width: 19px;
  height: 19px;
  stroke-width: 2;
}
.auth-form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 0 18px;
  color: #0f172a;
  font-size: 0.92rem;
  font-weight: 700;
}
.auth-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.auth-checkbox input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #2563eb;
}
.auth-link {
  color: #0b5cff;
  font-weight: 800;
}
.auth-signin-btn.btn {
  width: 100%;
  min-height: 50px;
  justify-content: center;
  border: 0;
  border-radius: 0.6em;
  color: #ffffff;
  background: linear-gradient(135deg, #155dfc 0%, #0b5cff 100%);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.24);
  font-size: 1rem;
  font-weight: 800;
}
.auth-signin-btn.btn:hover {
  background: linear-gradient(135deg, #0f54e8 0%, #034fe5 100%);
  transform: translateY(-1px);
}
.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  margin: 18px 0;
  color: #64748b;
  font-weight: 700;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: #e2e8f0;
}
.auth-sso-btn {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #0f172a;
  background: #ffffff;
  border: 1px solid #cbd8e8;
  border-radius: 0.6em;
  font-size: 1rem;
  font-weight: 800;
}
.auth-sso-btn:hover {
  border-color: #9db5d3;
  background: #f8fbff;
}
.auth-sso-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #1e3a8a;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.auth-security-note {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 16px 22px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid #d8e2ef;
  border-radius: 0.85em;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.05);
}
.auth-security-note > span {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: #3b63b3;
  background: #eef5ff;
  border-radius: 50%;
}
.auth-security-note svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.auth-security-note strong {
  display: block;
  color: #10172a;
  font-weight: 800;
  margin-bottom: 4px;
}
.auth-security-note p {
  color: #526385;
  font-size: 0.86rem;
  line-height: 1.35;
}
.auth-footer {
  width: min(720px, 100%);
  margin: 2px auto 0;
  padding-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid #dbe5f1;
  color: #526385;
  font-size: 0.78rem;
}
.auth-footer nav {
  display: inline-flex;
  gap: 28px;
}
.auth-footer a {
  color: #0b5cff;
  font-weight: 700;
}
.auth-error {
  background: var(--danger-soft); color: var(--danger);
  border: 1px solid rgba(220,38,38,0.2);
  border-radius: var(--r-md); padding: 10px 14px;
  font-size: 0.8667rem; font-weight: 600;
  margin-bottom: 16px; display: none;
}
.auth-error.is-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 22%, transparent);
}
.auth-error.show { display: block; animation: slideUp 0.2s ease; }
.auth-lockout {
  background: var(--warning-soft); color: var(--warning);
  border: 1px solid rgba(217,119,6,0.2);
  border-radius: var(--r-md); padding: 10px 14px;
  font-size: 0.8667rem; font-weight: 600;
  margin-bottom: 16px; display: none; text-align: center;
}
.auth-lockout.show { display: block; }

@media (max-width: 1180px) {
  .auth-screen {
    grid-template-columns: minmax(420px, 46vw) minmax(480px, 1fr);
  }
  .auth-brand-content {
    width: calc(100% - 72px);
  }
  .auth-feature-item {
    grid-template-columns: 70px 1fr;
  }
  .auth-feature-icon {
    width: 70px;
    height: 70px;
    border-radius: 18px;
  }
  .auth-feature-icon svg {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 980px) {
  .auth-overlay {
    overflow-y: auto;
  }
  .auth-screen {
    grid-template-columns: 1fr;
  }
  .auth-brand-panel {
    min-height: auto;
  }
  .auth-brand-content {
    width: min(720px, calc(100% - 40px));
    padding: 34px 0;
  }
  .auth-brand-panel h2,
  .auth-brand-copy,
  .auth-feature-list {
    display: none;
  }
  .auth-brand-lockup {
    margin-bottom: 0;
  }
  .auth-brand-rule,
  .auth-illustration {
    display: none;
  }
  .auth-form-panel {
    min-height: auto;
    padding: 28px 20px;
  }
}

@media (max-width: 640px) {
  .auth-card,
  .auth-security-note {
    padding: 24px 20px;
  }
  .auth-form-options,
  .auth-footer {
    align-items: flex-start;
    flex-direction: column;
  }
  .auth-footer nav {
    gap: 18px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   APP SHELL
   Layout contract: see ../LAYOUT_CONTRACT.md before changing shell heights,
   scroll containers, page identity classes, or table overflow behavior.
   ═══════════════════════════════════════════════════════════════ */
.app-shell {
  display: flex;
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

/* ─── Desktop sidebar ────────────────────────────────────────── */
.desktop-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg2) 100%);
  border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column;
  position: sticky; top: 0;
  height: 100dvh; overflow: hidden;
  z-index: 40;
  box-shadow: 4px 0 24px rgba(0,0,0,0.22);
  transition: width 0.28s cubic-bezier(0.22,1,0.36,1), box-shadow 0.28s cubic-bezier(0.22,1,0.36,1);
}
.desktop-sidebar.is-collapsed { width: 76px; }
.sidebar-app-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 54px;
  padding: 12px 14px;
  background: var(--primary);
  color: #fff;
  flex-shrink: 0;
}
.sidebar-app-brand-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 0;
}
.sidebar-app-brand-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-app-brand-name {
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-tenant-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-tenant-logo-card {
  width: 92px;
  height: 92px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--primary);
}
.sidebar-tenant-logo-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 2px;
}
.sidebar-tenant-logo-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--primary);
}
.sidebar-tenant-name {
  width: 100%;
  min-width: 0;
  color: var(--sidebar-text);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-collapse-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--sidebar-border);
  background: transparent;
  color: var(--sidebar-text);
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  flex-shrink: 0; cursor: pointer;
  margin-left: auto;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.sidebar-collapse-btn svg {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.sidebar-collapse-btn:hover {
  background: var(--sidebar-hover-bg);
  color: var(--primary);
  border-color: var(--primary);
}
.sidebar-logo {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center; flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.2);
}
.sidebar-logo.has-image {
  background: transparent;
  border-color: transparent;
}
.sidebar-logo svg { width: 22px; height: 22px; color: white; }
.sidebar-brand-text { min-width: 0; flex: 1; }
.sidebar-brand-text h1 {
  font-size: 0.8667rem; font-weight: 800;
  color: rgba(255,255,255,0.95); line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-brand-text p {
  font-size: 0.8667rem; color: var(--sidebar-text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-nav-label {
  font-size: 0.8667rem; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--sidebar-text-dim);
  padding: 14px 18px 5px; flex-shrink: 0;
}
.sidebar-nav {
  display: flex; flex-direction: column; gap: 2px;
  padding: 4px 10px; flex: 1;
  min-height: 0;
  overflow-y: auto; overflow-x: hidden; scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }
.nav-btn {
  display: flex; align-items: center; gap: 11px;
  width: 100%; border: none; background: transparent;
  color: var(--sidebar-text); font-size: 0.8667rem; font-weight: 600;
  padding: 10px 12px; border-radius: var(--r-sm);
  text-align: left; white-space: nowrap; overflow: hidden;
  transition: background 0.18s, color 0.18s;
  position: relative;
}
.nav-btn svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.72; transition: opacity 0.18s; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-btn > span:not(.nav-badge) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-btn:hover { background: var(--sidebar-hover-bg); color: rgba(255,255,255,0.95); }
.nav-btn:hover svg { opacity: 1; }
.nav-btn.active { background: var(--sidebar-active-bg); color: #fff; box-shadow: none; }
.nav-btn.active svg { opacity: 1; }
.nav-btn .nav-badge {
  flex: 0 0 auto; margin-left: auto; min-width: 20px; height: 20px;
  background: var(--danger); color: white;
  border-radius: 99px; font-size: 0.8667rem; font-weight: 700;
  padding: 0 5px; display: grid; place-items: center;
}
/* Submenu */
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-head { display: flex; align-items: center; gap: 4px; }
.nav-group-head .nav-btn { flex: 1; min-width: 0; }
.nav-group-toggle {
  width: 28px; height: 28px; border: none; background: transparent;
  color: var(--sidebar-text); border-radius: var(--r-sm);
  display: grid; place-items: center; cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.nav-group-toggle:hover { background: var(--sidebar-hover-bg); color: rgba(255,255,255,0.95); }
.nav-group-toggle svg {
  width: 14px; height: 14px; fill: none; stroke: currentColor;
  stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round;
  transition: transform 0.2s ease;
}
.nav-group.is-open .nav-group-toggle svg { transform: rotate(180deg); }
.nav-submenu {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s cubic-bezier(0.4,0,0.2,1), opacity 0.2s;
  opacity: 0; padding: 0 0 0 30px;
}
.nav-submenu > div { overflow: hidden; display: flex; flex-direction: column; gap: 2px;
  border-left: 1px solid rgba(255,255,255,0.12); padding-left: 10px; }
.nav-group.is-open .nav-submenu { grid-template-rows: 1fr; opacity: 1; padding: 2px 0 4px 30px; }
.nav-sub-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; border: none; background: transparent;
  color: rgba(255,255,255,0.65); font: inherit; font-size: 0.8667rem; font-weight: 600;
  text-align: left; padding: 8px 10px; border-radius: var(--r-sm);
  cursor: pointer; transition: background 0.18s, color 0.18s, transform 0.15s;
}
.nav-sub-btn:hover { background: rgba(255,255,255,0.10); color: rgba(255,255,255,0.95); transform: translateX(2px); }
.nav-sub-btn.active { background: var(--sidebar-active-bg); color: #fff; }
.nav-sub-icon {
  width: 14px; height: 14px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
}
.nav-sub-label { flex: 1; min-width: 0; line-height: 1.2; }
.nav-sub-pill {
  flex: 0 0 auto;
  font-size: 1rem; font-weight: 700; letter-spacing: 0;
  color: #3b2f1e; background: #f2e7cb;
  border-radius: 999px; padding: 2px 8px;
}
[data-theme="dark"] .nav-sub-pill {
  color: #3b2f1e;
  background: #e8d9b1;
}

.desktop-sidebar.is-collapsed .sidebar-brand {
  justify-content: flex-start;
  padding-left: 8px;
  padding-right: 8px;
  gap: 8px;
}
.desktop-sidebar.is-collapsed .sidebar-app-brand {
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
}
.desktop-sidebar.is-collapsed .sidebar-app-brand-main {
  gap: 0;
}
.desktop-sidebar.is-collapsed .sidebar-app-brand-name {
  display: none;
}
.desktop-sidebar.is-collapsed .sidebar-collapse-btn {
  display: grid;
  margin-left: 0;
}
.desktop-sidebar.is-collapsed .sidebar-tenant-brand {
  align-items: center;
  padding-left: 8px;
  padding-right: 8px;
}
.desktop-sidebar.is-collapsed .sidebar-tenant-name {
  display: none;
}
.desktop-sidebar.is-collapsed .sidebar-tenant-logo-card {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}
.desktop-sidebar.is-collapsed .sidebar-brand-text,
.desktop-sidebar.is-collapsed .sidebar-nav-label,
.desktop-sidebar.is-collapsed .nav-btn > span:not(.nav-badge),
.desktop-sidebar.is-collapsed .nav-sub-btn,
.desktop-sidebar.is-collapsed .nav-group-toggle,
.desktop-sidebar.is-collapsed .sidebar-footer-btn > span:not(.sync-dot) {
  display: none;
}
.desktop-sidebar.is-collapsed .sidebar-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}
.desktop-sidebar.is-collapsed .sidebar-logo img {
  width: 34px !important;
  height: 34px !important;
  border-radius: 10px !important;
}
.desktop-sidebar.is-collapsed .sidebar-nav {
  padding-left: 8px;
  padding-right: 8px;
}
.desktop-sidebar.is-collapsed .nav-btn,
.desktop-sidebar.is-collapsed .sidebar-footer-btn {
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
}
.desktop-sidebar.is-collapsed .nav-btn .nav-badge {
  position: absolute;
  top: 4px;
  right: 4px;
}
.desktop-sidebar.is-collapsed .nav-submenu {
  padding: 0 !important;
}

.sidebar-footer {
  display: none;
}
.sidebar-footer-btn {
  display: flex; align-items: center; gap: 11px;
  width: 100%; border: none; background: transparent;
  color: var(--sidebar-text-dim); font: inherit; font-size: 0.8667rem; font-weight: 600;
  padding: 9px 12px; border-radius: var(--r-sm);
  cursor: pointer; text-align: left;
  transition: background 0.18s, color 0.18s;
  min-width: 0;
}
.sidebar-footer-btn svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-footer-btn > span:not(.sync-dot) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer-btn:hover { background: var(--sidebar-hover-bg); color: rgba(255,255,255,0.80); }
.sidebar-footer-btn.active { background: var(--sidebar-active-bg); color: #fff; }
.sidebar-logout-btn { color: var(--danger); }
.sidebar-logout-btn:hover { background: var(--danger-soft); color: var(--danger); }

/* Sync dot */
.sync-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-dim); transition: background 0.3s;
}
.sync-dot.ok { background: var(--success); }
.sync-dot.syncing { background: var(--warning); animation: pulse 1.2s ease-in-out infinite; }
.sync-dot.error { background: var(--danger); }

/* ─── App body ───────────────────────────────────────────────── */
.app-body {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  height: 100dvh; overflow: hidden;
}
.topbar {
  display: none;
  height: 56px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px; align-items: center; gap: 12px;
  flex-shrink: 0; position: sticky; top: 0; z-index: 30;
  box-shadow: var(--shadow-sm);
}
.topbar-brand { font-size: 1rem; font-weight: 800; color: var(--primary); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.topbar-icon-btn {
  width: 36px; height: 36px; border: none; background: transparent;
  border-radius: var(--r-sm); color: var(--text-muted);
  display: grid; place-items: center; transition: background 0.15s, color 0.15s;
  position: relative;
}
.topbar-icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topbar-icon-btn:hover { background: var(--surface-2); color: var(--text); }
.topbar-notify-btn {
  color: var(--text);
}
.topbar-notify-btn .notify-bell-icon {
  width: 19px;
  height: 19px;
  stroke-width: 2;
}
.badge-dot {
  position: absolute; top: 2px; right: 2px;
  min-width: 18px; height: 18px; border-radius: 99px;
  background: var(--danger); color: #fff;
  font-size: 0.65rem; font-weight: 700;
  padding: 0 4px; display: grid; place-items: center;
  line-height: 1;
}
.topbar-alert-wrap { position: relative; display: inline-flex; }
.dash-notify-wrap { position: relative; display: inline-flex; }
.topbar-alert-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  right: auto;
  display: flex;
  flex-direction: column;
  width: min(320px, calc(100vw - 24px));
  max-height: 400px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16), 0 6px 16px rgba(15, 23, 42, 0.08);
  z-index: 1200;
  overflow: visible;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(-12px) scaleY(0.88);
  transform-origin: top center;
  clip-path: inset(-14px 0 100% 0 round var(--card-radius));
  transition:
    opacity 0.18s ease,
    transform 0.26s cubic-bezier(0.22, 1, 0.36, 1),
    clip-path 0.26s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 0.26s;
  will-change: transform, opacity, clip-path;
}
.topbar-alert-dropdown::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: 14px;
  height: 14px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: translateX(-50%) rotate(45deg);
  box-shadow: -2px -2px 6px rgba(15, 23, 42, 0.04);
  pointer-events: none;
}
.topbar-alert-dropdown.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) scaleY(1);
  clip-path: inset(-14px 0 0 0 round var(--card-radius));
  transition-delay: 0s;
}
.topbar-alert-dropdown.closing {
  opacity: 0;
  visibility: visible;
  pointer-events: none;
  transform: translateX(-50%) translateY(-10px) scaleY(0.9);
  clip-path: inset(-14px 0 100% 0 round var(--card-radius));
}
.topbar-alert-header {
  padding: 12px 16px;
  font-weight: 700;
  font-size: 0.8667rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-radius: var(--card-radius) var(--card-radius) 0 0;
}
.topbar-alert-mark-read {
  background: none;
  border: 1px solid transparent;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.topbar-alert-mark-read:hover {
  background: var(--primary-soft);
  border-color: var(--primary-light);
  color: var(--primary-strong);
}
.topbar-alert-actions {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}
.topbar-alert-actions .topbar-alert-mark-read,
.topbar-alert-view-all {
  background: none;
  border: 1px solid transparent;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.topbar-alert-actions .topbar-alert-mark-read:hover,
.topbar-alert-view-all:hover {
  background: var(--primary-soft);
  border-color: var(--primary-light);
  color: var(--primary-strong);
  text-decoration: none;
}
.topbar-alert-actions .topbar-alert-mark-read + .topbar-alert-view-all::before {
  content: "|";
  display: inline-block;
  margin-right: 8px;
  color: var(--border);
  font-weight: 400;
}
.topbar-alert-footer {
  padding: 8px 16px 12px;
  display: flex;
  justify-content: center;
  border-top: 1px solid var(--border-soft);
}
.topbar-alert-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 0 0 var(--card-radius) var(--card-radius);
}
.topbar-alert-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.topbar-alert-item:last-child { border-bottom: none; }
.topbar-alert-item:hover { background: linear-gradient(90deg, rgba(37, 99, 235, 0.08), rgba(37, 99, 235, 0.03)); }
.topbar-alert-item.critical { border-left: 3px solid var(--danger); }
.topbar-alert-item.warning { border-left: 3px solid var(--warning); }
.topbar-alert-item.unread { background: color-mix(in srgb, var(--surface-2) 64%, transparent); }
.topbar-alert-item.unread .topbar-alert-title { font-weight: 700; }
.topbar-alert-title {
  font-weight: 600;
  font-size: 0.8667rem;
  margin-bottom: 2px;
}
.topbar-alert-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.topbar-alert-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8667rem;
  background: var(--surface);
  border-radius: var(--card-radius);
}

/* Notification center modal */
.notifications-main-content .page-header .page-header-row > div:first-child { display: block; }
.notifications-main-content .page-header .page-header-row { justify-content: space-between; }
.notifications-main-content .page-header { margin-bottom: 16px; }
.notification-center-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.notification-center-tabs {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 3px;
}
.notification-center-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.notification-center-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.notification-center-list {
  max-height: min(560px, calc(100dvh - 230px));
  overflow-y: auto;
  padding: 8px;
}
.notification-center-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 12px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.notification-center-item + .notification-center-item {
  border-top: 1px solid var(--border-soft);
}
.notification-center-item:hover {
  background: var(--surface-2);
  border-color: var(--border);
}
.notification-center-item.unread {
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
}
.notification-center-item.critical { border-left-color: var(--danger); }
.notification-center-item.warning { border-left-color: var(--warning); }
.notification-center-item.read .notification-center-item-title { font-weight: 500; color: var(--text-muted); }
.notification-center-item.read .notification-center-item-sub { color: var(--text-muted); }
.notification-center-item-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.notification-center-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
  background: var(--border);
}
.notification-center-item.unread .notification-center-item-dot { background: var(--primary); }
.notification-center-item.critical .notification-center-item-dot { background: var(--danger); }
.notification-center-item.warning .notification-center-item-dot { background: var(--warning); }
.notification-center-item-content { flex: 1; min-width: 0; }
.notification-center-item-title {
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 3px;
  line-height: 1.35;
}
.notification-center-item-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 6px;
}
.notification-center-item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
}
.notification-center-item-type {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.notification-center-item-type.critical { color: var(--danger); }
.notification-center-item-type.warning { color: var(--warning); }
.notification-center-item-time { color: var(--text-muted); }
.notification-center-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.notification-center-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.notification-center-empty .empty-state-icon {
  margin: 0 auto 12px;
  color: var(--text-muted);
}
.notification-center-empty h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}
.notification-center-empty p { font-size: 0.85rem; margin: 0; }

.main-content {
  flex: 1; padding: 10px 16px 20px;
  min-height: 0; overflow-y: auto; overflow-x: hidden;
  background: #ffffff;
}
.main-content.stock-page {
  overflow: hidden;
  padding-bottom: 8px;
  display: flex;
  flex-direction: column;
}
.main-content.stock-page > section:not(.hidden) {
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-height: 0;
  overflow: hidden;
}
.main-content.stock-page > #adjListPanel:not(.hidden) > .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--r-md);
  box-shadow: inset 0 -1px 0 var(--border);
}
.main-content.stock-page > #adjListPanel:not(.hidden) > .table-wrap > .table-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
}
.main-content.stock-page > #adjListPanel:not(.hidden) > .table-wrap > .data-table {
  width: 100%;
  min-width: 640px;
  border-collapse: separate;
  border-spacing: 0;
}
.main-content.stock-page > #adjListPanel:not(.hidden) > .table-wrap > .data-table th,
.main-content.stock-page > #adjListPanel:not(.hidden) > .table-wrap > .data-table td {
  padding: 8px 10px;
  line-height: 1.25;
  border-bottom: 1px solid var(--border);
}
.main-content.stock-page > #adjListPanel:not(.hidden) > .table-wrap > .data-table th + th,
.main-content.stock-page > #adjListPanel:not(.hidden) > .table-wrap > .data-table td + td {
  border-left: 1px solid var(--border-soft);
}
.main-content.stock-page > #adjListPanel:not(.hidden) > .table-wrap > .data-table th:last-child,
.main-content.stock-page > #adjListPanel:not(.hidden) > .table-wrap > .data-table td:last-child {
  border-right: 1px solid var(--border);
}
.main-content.stock-page > #adjListPanel:not(.hidden) > .table-wrap > .data-table tbody tr:not(.finance-table-empty):not(.table-fill-row):not(.finance-table-filler) td {
  height: auto;
}
.main-content.stock-page > #adjListPanel:not(.hidden) > .table-wrap > .data-table tbody tr:last-child td {
  border-bottom: 1px solid var(--border);
}
.main-content.stock-page > #adjListPanel:not(.hidden) > .table-wrap > .data-table tbody tr.table-fill-row td {
  padding: 0;
  border: 0 !important;
  box-shadow: none;
  background: var(--surface) !important;
}
[data-theme="dark"] .main-content {
  background: var(--bg);
}
.main-content.finance-page {
  overflow: hidden;
  padding-bottom: 8px;
}
.main-content.finance-page > .finance-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}
.main-content.finance-page .finance-panel {
  min-height: 0;
}
.main-content.finance-page .finance-panel:not(.hidden) {
  flex: 1 1 auto;
}
.main-content.finance-page #financeSummaryPanel {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.main-content.finance-page #financeSummaryPanel .finance-summary-grid {
  flex: 1 1 auto;
  min-height: 0;
}
.main-content.finance-page #financeSummaryPanel .finance-summary-trend-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.main-content.finance-page #financeSummaryPanel .finance-summary-chart {
  flex: 0 0 auto;
  min-height: 0;
}
.main-content.finance-page #financeSummaryPanel .finance-summary-meta-list {
  min-height: 0;
}
.main-content.finance-page #financePettyPanel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.main-content.finance-page :is(
  #financeExpensesPanel,
  #financePnlPanel,
  #financeCashPanel,
  #financeReceivablesPanel,
  #financeVatPanel,
  #financePayablesPanel,
  #financeReportsPanel
) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.main-content.finance-page :is(
  #financeExpensesPanel,
  #financePnlPanel,
  #financeCashPanel,
  #financeReceivablesPanel,
  #financeVatPanel,
  #financePayablesPanel,
  #financeReportsPanel
) > .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
}
.main-content.finance-page :is(
  #financeExpensesPanel,
  #financePnlPanel,
  #financeCashPanel,
  #financeReceivablesPanel,
  #financeVatPanel,
  #financePayablesPanel,
  #financeReportsPanel
) > .table-wrap > .data-table,
.main-content.finance-page #financePayablesPanel .finance-payables-table {
  width: 100%;
}
.main-content.purchases-workbench-mode {
  overflow: hidden;
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
}
#mainContent.purchases-workbench-mode {
  overflow: hidden;
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
}
#mainContent.purchases-workbench-mode > #purchaseEntryPanel:not(.hidden) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}
#mainContent.purchases-workbench-mode > #purchaseEntryPanel:not(.hidden) > .purchase-workbench {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}
#mainContent.stocktake-workbench-mode {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#mainContent.stocktake-workbench-mode > #takeEntryPanel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 6px 16px 2px;
}
#mainContent.stocktake-workbench-mode > #takeEntryPanel > .page-header {
  flex-shrink: 0;
  margin-bottom: 0;
  padding-bottom: 4px;
  display: block;
}
#mainContent.stocktake-workbench-mode > #takeEntryPanel > .page-header .page-header-row {
  justify-content: flex-start;
}
#mainContent.stocktake-workbench-mode > #takeEntryPanel > .page-header .page-header-row > div:first-child {
  display: block;
}
#mainContent.stocktake-workbench-mode > #takeEntryPanel > .table-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  max-height: none;
}
#mainContent.stocktake-workbench-mode > #takeEntryPanel > .table-wrap > .table-toolbar {
  position: sticky;
  top: 0;
  z-index: 7;
  padding: 6px 10px;
}
#mainContent.stocktake-workbench-mode > #takeEntryPanel > .table-wrap .data-table {
  border-collapse: separate;
  border-spacing: 0;
}
#mainContent.stocktake-workbench-mode > #takeEntryPanel > .table-wrap .data-table thead th {
  position: sticky;
  top: var(--sticky-offset, 53px);
  z-index: 6;
}
#mainContent.stocktake-workbench-mode > #takeEntryPanel > .table-wrap .data-table td {
  border-bottom: 1px solid var(--border-soft);
  border-right: none;
}
#mainContent.stocktake-workbench-mode > #takeEntryPanel > .table-wrap .data-table th {
  border-bottom: 2px solid var(--border);
  border-right: none;
}
#mainContent.stocktake-workbench-mode > #takeEntryPanel > .table-wrap .data-table th:not(:last-child),
#mainContent.stocktake-workbench-mode > #takeEntryPanel > .table-wrap .data-table td:not(:last-child) {
  border-right: 1px solid var(--border-soft);
}
#mainContent.stocktake-workbench-mode > #takeEntryPanel > .table-wrap .data-table tr:last-child td {
  border-bottom: 1px solid var(--border-soft);
}
#mainContent.stocktake-report-mode {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#mainContent.stocktake-report-mode > #takeReportPanel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#mainContent.stocktake-report-mode > #takeReportPanel > #takeReportContent {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.stocktake-report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
  flex: 0 0 auto;
}
.stocktake-report-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stocktake-report-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.stocktake-report-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.stocktake-report-loading {
  min-height: 160px;
  display: grid;
  place-items: center;
}
.stocktake-report-loading-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}
.stocktake-report-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: auto;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--r-md);
  box-shadow: inset 0 -1px 0 var(--border);
}
#takeListPanel .badge,
#takeEntryPanel .badge,
#mainContent.stocktake-report-mode .badge {
  background: transparent;
  border: 0;
  padding: 0;
  border-radius: 0;
}
#takeListPanel .badge-gray,
#takeEntryPanel .badge-gray,
#mainContent.stocktake-report-mode .badge-gray {
  color: var(--text-muted);
}
.main-content.ledger-main-content {
  padding-top: 6px;
  padding-bottom: 8px;
  overflow: hidden;
}
.main-content.ledger-scroll-locked {
  display: flex;
  flex-direction: column;
}
.main-content.ledger-scroll-locked .ledger-table-wrap {
  flex: 1 1 0%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: none;
}
.main-content.ledger-scroll-locked .ledger-table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
  overscroll-behavior: contain;
}
.main-content.dashboard-scroll-locked {
  overflow: hidden;
  padding-bottom: 8px;
  display: flex;
  flex-direction: column;
}
.main-content.dashboard-scroll-locked .page-header,
.main-content.dashboard-scroll-locked .kpi-grid,
.main-content.dashboard-scroll-locked .quick-actions-grid {
  flex: 0 0 auto;
}
.main-content.dashboard-scroll-locked #dashBottomGrid {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}
.main-content.dashboard-scroll-locked #dashBottomGrid > .card {
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.main-content.dashboard-scroll-locked #dashBottomGrid > .card > .card-body,
.main-content.dashboard-scroll-locked #dashRecentSales {
  flex: 1 1 auto;
  min-height: 0;
}
.main-content.dashboard-scroll-locked #dashStockAlertList,
.main-content.dashboard-scroll-locked #dashRecentSales {
  overflow-y: auto;
  overflow-x: hidden;
}
.main-content.dashboard-scroll-locked #dashRecentSales {
  display: flex;
  flex-direction: column;
}

/* ─── Desktop global bar ────────────────────────────────────── */
.desktop-global-bar-wrap {
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 6px 20px;
  z-index: 28;
}
.dashboard-global-shell {
  display: flex; align-items: center; gap: 12px;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}
.dashboard-global-search-wrap {
  flex: 1; min-width: 0; max-width: min(760px, 64vw); position: relative;
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--bg-soft);
  padding: 0 8px;
}
.dashboard-global-search-icon {
  width: 15px; height: 15px; flex-shrink: 0;
  color: var(--text-dim); fill: none; stroke: currentColor; stroke-width: 2;
}
.dashboard-global-search-input {
  width: 100%; min-width: 0;
  border: none; outline: none; background: transparent;
  color: var(--text); font-size: 0.8667rem; font-weight: 600;
  padding: 6px 2px;
}
.dashboard-global-search-input::placeholder { color: var(--text-dim); font-weight: 500; }
.dashboard-global-search-clear {
  width: 24px; height: 24px; border: none; background: transparent;
  color: var(--text-dim); border-radius: 50%;
  display: grid; place-items: center; transition: background 0.15s, color 0.15s;
}
.dashboard-global-search-clear svg {
  width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round;
}
.dashboard-global-search-clear:hover { background: var(--surface-2); color: var(--text); }
.dashboard-global-search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--shadow-md);
  overflow: hidden; max-height: 320px; overflow-y: auto;
}
.dashboard-search-item {
  width: 100%; border: none; background: transparent;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 12px; text-align: left;
  color: var(--text); border-bottom: 1px solid var(--border-soft);
  transition: background 0.15s;
}
.dashboard-search-item:last-child { border-bottom: none; }
.dashboard-search-item:hover,
.dashboard-search-item.active { background: var(--primary-soft); }
.dashboard-search-item-name {
  font-size: 0.8667rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dashboard-search-item-kind {
  font-size: 0.8667rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em;
  flex-shrink: 0;
}
.dashboard-search-empty {
  font-size: 0.8667rem; color: var(--text-muted);
  padding: 12px;
}
.dashboard-global-actions {
  display: flex; align-items: center; gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}
.dashboard-user-menu {
  position: relative;
  flex-shrink: 0;
}
.dashboard-icon-btn {
  width: 24px; height: 24px; border: none;
  border-radius: 0; background: transparent;
  color: var(--text-muted); display: grid; place-items: center;
  transition: color 0.15s;
  position: relative;
}
.dashboard-icon-btn:hover {
  background: transparent;
  color: var(--primary);
}
.dashboard-icon-btn svg {
  width: 14px; height: 14px;
  fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.dashboard-notify-btn {
  width: 30px;
  height: 30px;
  color: var(--text);
}
.dashboard-notify-btn .notify-bell-icon {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}
.dashboard-notify-btn .badge-dot {
  top: -4px;
  right: -8px;
  min-width: 17px;
  height: 17px;
  font-size: 0.62rem;
  padding: 0 3px;
}
.dashboard-user-chip {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px 3px 3px;
  color: var(--text); background: var(--surface);
  min-width: 0; max-width: 190px;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  font: inherit;
  text-align: left;
}
.dashboard-user-chip:hover,
.dashboard-user-chip[aria-expanded="true"] {
  background: var(--primary-soft);
  border-color: var(--primary-light);
}
.dashboard-user-chip-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; font-size: 0.8667rem; font-weight: 800;
  display: grid; place-items: center; flex-shrink: 0;
}
.dashboard-user-chip-name {
  font-size: 0.8667rem; font-weight: 700;
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dashboard-user-chip-caret {
  width: 14px; height: 14px; flex-shrink: 0;
  margin-left: 2px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  color: var(--text-dim);
  transition: transform 0.15s ease, color 0.15s ease;
}
.dashboard-user-chip[aria-expanded="true"] .dashboard-user-chip-caret {
  transform: rotate(180deg);
  color: var(--text-muted);
}
.dashboard-user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 248px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 1200;
  flex-direction: column;
}
.dashboard-user-dropdown.open { display: flex; }
.dashboard-user-dropdown-item {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  transition: background 0.15s, color 0.15s;
}
.dashboard-user-dropdown-item:hover { background: var(--surface-2); }
.dashboard-user-dropdown-item.danger { color: var(--danger); }
.dashboard-user-dropdown-item.danger:hover { background: var(--danger-soft); }
.dashboard-user-dropdown-label {
  font-size: 0.8667rem;
  font-weight: 700;
  line-height: 1.2;
}
.dashboard-user-dropdown-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.2;
}
.dashboard-user-dropdown-item.danger .dashboard-user-dropdown-meta {
  color: inherit;
  opacity: 0.82;
}
.dashboard-user-dropdown-separator {
  height: 1px;
  margin: 4px 2px;
  background: var(--border-soft);
}

/* ─── Bottom mobile nav ──────────────────────────────────────── */
.mobile-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 60px; background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 200; padding: 0 4px;
  align-items: center; justify-content: space-around;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
}
.mobile-nav-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; border: none; background: transparent;
  color: var(--text-muted); font-size: 0.94rem; font-weight: 600;
  padding: 6px 10px; border-radius: var(--r-md);
  transition: color 0.18s, background 0.18s; min-width: 52px;
}
.mobile-nav-item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mobile-nav-item.active { color: var(--primary); background: var(--primary-soft); }

/* ─── Shared module navigation ───────────────────────────────── */
.module-nav {
  flex-shrink: 0;
  min-height: 46px;
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--surface-2) 92%, var(--text) 8%);
  border: 1px solid var(--border);
  border-bottom: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  overflow: visible;
  position: relative;
}
.module-nav::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--border);
  pointer-events: none;
}
.module-nav.hidden { display: none; }
.module-nav-inner {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}
.module-nav-scroll-shell {
  position: relative;
  display: flex;
  align-items: stretch;
  flex: 1 1 auto;
  min-width: 0;
}
.module-nav-identity {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 0 16px;
  color: #64748b;
  background: #eef2f7;
  border-right: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.module-nav-identity svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.module-nav-track {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
  padding: 0 16px;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
.module-nav-context {
  display: inline-flex;
  align-items: center;
  align-self: center;
  flex: 0 0 auto;
  margin-left: auto;
  margin-right: 16px;
}
.module-nav-track::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.module-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 46px;
  min-width: 72px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-bottom: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.96rem;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.18s, background-color 0.18s, border-color 0.18s, box-shadow 0.18s;
  position: relative;
  z-index: 1;
}
.module-nav-link--utility {
  margin-left: 18px;
  padding-left: 22px;
}
.module-nav-link--utility::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 24px;
  background: color-mix(in srgb, var(--text) 18%, var(--border) 82%);
  transform: translateY(-50%);
  pointer-events: none;
}
.module-nav-link:hover {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 7%, transparent);
}
.module-nav-link.active {
  color: var(--info);
  background: transparent;
  border-color: transparent;
  font-weight: 700;
  box-shadow: inset 0 -2px 0 0 var(--info);
}
.module-nav-link--utility.active::before {
  opacity: 1;
}
.module-nav-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -3px;
  border-radius: 4px;
}

/* ============================================================
   COMPLIANCE MODULE NAVIGATION
   ============================================================ */

#moduleNav:has([data-module-child-id="complianceRegister"])
  .module-nav-track {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
}

#moduleNav:has([data-module-child-id="complianceRegister"])
  .module-nav-link {
  white-space: nowrap;
}

/* Pending state remains noticeable without looking like a second active tab. */
#moduleNav
  [data-module-child-id="complianceApprovals"].has-pending:not(.active) {
  color: var(--danger);
}

#moduleNav
  [data-module-child-id="complianceApprovals"].has-pending:not(.active):hover {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 6%, transparent);
}

#moduleNav
  [data-module-child-id="complianceApprovals"].active
  .ctrl-tab-count {
  background: var(--danger);
  color: #fff;
}

@media (max-width: 760px) {
  #moduleNav:has([data-module-child-id="complianceRegister"])
    .module-nav-link {
    flex: 0 0 auto;
    min-width: max-content;
    padding-inline: 14px;
  }
}
.catalogue-menu {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  flex: 0 0 auto;
}
.catalogue-menu__trigger {
  gap: 8px;
}
.catalogue-menu__chevron {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transform-origin: center;
  transition: transform 180ms ease;
}
.catalogue-menu.is-open .catalogue-menu__chevron {
  transform: rotate(225deg) translateY(-1px);
}
.catalogue-menu__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  min-width: 200px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.10), 0 2px 6px rgba(15, 23, 42, 0.06);
}
.catalogue-menu__panel[hidden] {
  display: none;
}
.catalogue-menu.is-open .catalogue-menu__panel {
  display: block;
}
.catalogue-menu__item {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  color: var(--text);
  background: transparent;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 160ms ease, background-color 160ms ease;
}
.catalogue-menu__item:hover,
.catalogue-menu__item:focus-visible {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  outline: none;
}
.catalogue-menu__item[aria-current="page"],
.catalogue-menu__item.is-active {
  color: var(--info);
  background: color-mix(in srgb, var(--info) 10%, var(--surface));
  font-weight: 700;
}
.module-tab-indicator {
  display: none;
  position: absolute;
  left: 0;
  top: 4px;
  bottom: -2px;
  width: 0;
  background: #ffffff;
  border: 1px solid #d7e4ec;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 2px 0 #ffffff, 0 -1px 3px rgba(15, 23, 42, 0.03);
  transform: translateX(0);
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1), width 240ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease;
  opacity: 0;
  pointer-events: none;
}
.module-tab-indicator::before,
.module-tab-indicator::after {
  content: "";
  position: absolute;
  bottom: 1px;
  width: 0.75em;
  height: 0.75em;
  pointer-events: none;
}
.module-tab-indicator::before {
  left: -0.75em;
  border-bottom-right-radius: 0.75em;
  box-shadow: 0.375em 0.375em 0 0.375em #ffffff;
}
.module-tab-indicator::after {
  right: -0.75em;
  border-bottom-left-radius: 0.75em;
  box-shadow: -0.375em 0.375em 0 0.375em #ffffff;
}

/* Sidebar hierarchy tweaks */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 10px 10px;
}
.sidebar-nav-label {
  padding: 12px 10px 8px;
  letter-spacing: 0.05em;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
}
.nav-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.nav-btn:hover {
  background: var(--sidebar-hover-bg);
  color: var(--text);
}
.nav-btn.active {
  background: var(--sidebar-active-bg);
  color: #fff;
}
.sidebar-divider {
  height: 1px;
  margin: 8px 10px;
  background: var(--sidebar-border);
}
.sidebar-end-of-day-wrap {
  margin-top: auto;
  padding: 0 0 8px;
}
.sidebar-end-of-day {
  margin: 0 10px;
}
.sidebar-end-of-day.active {
  color: #fff;
}

/* Mobile drawer hierarchy */
.mobile-sidebar-head {
  padding: 18px 16px 12px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.mobile-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.mobile-sidebar-brand-name {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: visible;
  text-overflow: ellipsis;
}
.mobile-sidebar-brand-sub {
  font-size: 0.72rem;
  color: var(--sidebar-text-dim);
}
.mobile-sidebar-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--sidebar-border);
  background: transparent;
  border-radius: 10px;
  color: var(--sidebar-text-dim);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.mobile-sidebar-close:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text);
}
.mobile-sidebar-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.mobile-sidebar-section {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mobile-sidebar-secondary {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--sidebar-border);
}
.mobile-sidebar-link {
  width: 100%;
  justify-content: flex-start;
}
.mobile-sidebar-link.active {
  color: #fff;
}
.mobile-sidebar-link.active svg {
  opacity: 1;
}
.mobile-sidebar-link span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mobile-sidebar .sidebar-app-brand {
  min-height: 52px;
  padding: 12px 16px;
}
.mobile-sidebar .sidebar-app-brand-main {
  justify-content: flex-start;
}
.mobile-sidebar-head {
  align-items: flex-start;
}
.mobile-sidebar-brand.sidebar-tenant-brand {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 auto;
  gap: 9px;
  min-width: 0;
  padding: 0;
  border-bottom: 0;
}
.mobile-sidebar .sidebar-tenant-logo-card {
  width: 50px;
  height: 50px;
}
.mobile-sidebar .sidebar-tenant-name {
  color: var(--sidebar-text);
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.mobile-sidebar .sidebar-app-brand {
  min-height: 52px;
  padding: 12px 16px;
}

.mobile-sidebar .sidebar-app-brand-main {
  justify-content: flex-start;
}

.mobile-sidebar-head {
  align-items: flex-start;
}

.mobile-sidebar-brand.sidebar-tenant-brand {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 auto;
  gap: 9px;
  min-width: 0;
  padding: 0;
  border-bottom: 0;
}

.mobile-sidebar .sidebar-tenant-logo-card {
  width: 50px;
  height: 50px;
}

.mobile-sidebar .sidebar-tenant-name {
  color: var(--sidebar-text);
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Mobile sidebar */
.mobile-sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 200;
  opacity: 0; visibility: hidden; transition: opacity 0.25s;
  backdrop-filter: blur(2px);
}
.mobile-sidebar-backdrop.open { opacity: 1; visibility: visible; }
.mobile-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 280px;
  background: var(--sidebar-bg); z-index: 201;
  display: flex; flex-direction: column;
  box-shadow: 6px 0 32px rgba(0,0,0,0.3);
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.22,1,0.36,1);
  overflow-y: auto;
}
.mobile-sidebar.open { transform: translateX(0); }

/* ═══════════════════════════════════════════════════════════════
   SECTIONS
   ═══════════════════════════════════════════════════════════════ */
.view-section { display: none; }
.view-section.active { display: block; }
.view-section.active.enter-right { animation: none; }

.page-header { margin-bottom: 14px; }
.page-header h2 { font-size: 1.35rem; font-weight: 800; }
.page-header p { color: var(--text-muted); font-size: 0.8667rem; margin-top: 2px; }
.page-header-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* Hide duplicate section title block in content area (keep action buttons) */
.main-content .page-header .page-header-row > div:first-child { display: none; }
.main-content .page-header .page-header-row { justify-content: flex-end; min-height: 0; }
.main-content .page-header { margin-bottom: 10px; }
.main-content .page-header:has(.page-header-row > :only-child) { display: none; }
.main-content .page-header.toolbar-action-relocated { display: none; }

.account-main-content {
  overflow-y: auto;
}
.account-page-stack {
  display: grid;
  gap: 16px;
  max-width: 920px;
}
.account-section .card-header {
  justify-content: space-between;
}
.account-section-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.account-support-tabs {
  display: flex;
  gap: 6px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.account-support-tab {
  position: relative;
  padding: 12px 2px 11px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.account-support-tab + .account-support-tab { margin-left: 18px; }
.account-support-tab::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--primary);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.account-support-tab:hover,
.account-support-tab.active { color: var(--primary); }
.account-support-tab.active::after { opacity: 1; }
.account-support-panel.hidden { display: none; }
.account-password-wrap {
  position: relative;
}
.account-password-input {
  padding-right: 46px;
}
.account-password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: 0.5em;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.account-password-toggle:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.account-password-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.account-password-toggle[aria-pressed="true"] {
  color: var(--primary);
}
.account-ticket-table-wrap {
  min-height: min(420px, calc(100dvh - 260px));
}
.access-level-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
  min-height: 420px;
}
.access-level-roles {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.access-level-create-role {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.access-level-create-role .input {
  min-width: 0;
  flex: 1;
}
.access-level-role-btn {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.access-level-role-btn:hover { background: var(--surface-2); }
.access-level-role-btn.active {
  border-color: var(--primary-light);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px rgba(13,122,107,0.08);
}
.access-level-role-name {
  font-size: 0.8667rem;
  font-weight: 800;
}
.access-level-role-note {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.access-level-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 16px;
  min-width: 0;
}
.access-level-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.access-level-panel-header h4 {
  font-size: 1rem;
  margin-bottom: 3px;
}
.access-level-panel-header p {
  font-size: 0.8667rem;
  color: var(--text-muted);
}
.access-level-badge {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid var(--primary-light);
  border-radius: 999px;
  padding: 5px 10px;
  white-space: nowrap;
}
.access-level-group {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--bg-soft);
}
.access-level-group:last-child { margin-bottom: 0; }
.access-level-group-title {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.access-level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.access-level-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 0.8667rem;
  font-weight: 600;
  color: var(--text);
}
.access-level-item input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex-shrink: 0;
}
.access-level-item.disabled {
  opacity: 0.75;
  background: var(--surface-2);
}
.access-level-empty {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 0.8667rem;
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════════
   STAT / KPI CARDS
   ═══════════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 20px;
}
.kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--card-radius); padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  cursor: default;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary-light); }
.kpi-card:nth-child(1) { background: color-mix(in srgb, #1db854 12%, var(--surface)); border-color: color-mix(in srgb, #1db854 20%, var(--border)); }
.kpi-card:nth-child(1) .kpi-label { color: #1db854; }
.kpi-card:nth-child(1) .kpi-value { color: #1db854; }
.kpi-card:nth-child(2) { background: color-mix(in srgb, #1e90ff 12%, var(--surface)); border-color: color-mix(in srgb, #1e90ff 20%, var(--border)); }
.kpi-card:nth-child(2) .kpi-label { color: #1e90ff; }
.kpi-card:nth-child(2) .kpi-value { color: #1e90ff; }
.kpi-card:nth-child(3) { background: color-mix(in srgb, #9c27b0 12%, var(--surface)); border-color: color-mix(in srgb, #9c27b0 20%, var(--border)); }
.kpi-card:nth-child(3) .kpi-label { color: #9c27b0; }
.kpi-card:nth-child(3) .kpi-value { color: #9c27b0; }
.kpi-card-icon {
  width: 40px; height: 40px; border-radius: var(--r-md);
  display: grid; place-items: center; margin-bottom: 14px;
}
.kpi-card-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kpi-label { font-size: 0.8667rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.kpi-value { font-size: clamp(1.4rem, 2.5vw, 2rem); font-weight: 800; color: var(--text); line-height: 1.1; letter-spacing: -0.02em; }
.kpi-note { font-size: 0.8667rem; color: var(--text-muted); margin-top: 4px; }
.finance-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 16px;
  margin-top: 16px;
}
.finance-summary-chart {
  min-height: 0;
  overflow: hidden;
  padding: 0;
}
.finance-trend-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.finance-trend-card-header .finance-trend-legend {
  justify-content: flex-end;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  min-width: max-content;
}
.finance-trend-widget {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.finance-trend-chart-wrap {
  position: relative;
  flex: 0 0 auto;
  min-height: 240px;
  max-height: 300px;
  padding: 10px 8px 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, var(--primary) 4%) 0%, var(--surface) 100%);
  overflow: hidden;
}
.finance-trend-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}
.finance-trend-chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 2;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, var(--primary) 4%) 0%, var(--surface) 100%);
  border-radius: 20px;
}
.finance-trend-chart-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid color-mix(in srgb, var(--primary) 20%, transparent);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: financeChartSpin 0.8s linear infinite;
}
@keyframes financeChartSpin {
  to { transform: rotate(360deg); }
}
@media (max-width: 640px) {
  .finance-trend-chart-wrap { min-height: 220px; max-height: 260px; padding: 8px 4px 16px; }
}
.finance-trend-legend,
.finance-trend-highlights {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.finance-trend-highlights {
  justify-content: center;
  padding-top: 4px;
}
.finance-trend-legend-item,
.finance-trend-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 85%, var(--surface) 15%);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
}
.finance-trend-chip {
  color: var(--text-muted);
  font-weight: 600;
}
.finance-trend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
.finance-trend-swatch.is-revenue {
  background: linear-gradient(180deg, #38bdf8 0%, #0068b3 100%);
}
.finance-trend-swatch.is-expense {
  background: linear-gradient(180deg, #fda4af 0%, #ef4444 100%);
}
.finance-trend-swatch.is-profit {
  background: linear-gradient(180deg, #6ee7b7 0%, #10b981 100%);
}
.finance-trend-shell {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}
.finance-trend-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 0 38px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: right;
}
.finance-trend-plot {
  position: relative;
  min-height: 272px;
  padding: 18px 16px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, var(--primary) 4%) 0%, var(--surface) 100%);
  overflow: hidden;
}
.finance-trend-gridline {
  position: absolute;
  left: 16px;
  right: 16px;
  height: 1px;
  background: color-mix(in srgb, var(--border) 86%, transparent);
  pointer-events: none;
}
.finance-trend-groups {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  gap: 14px;
  min-width: max-content;
  height: 100%;
}
.finance-trend-group {
  width: 112px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border: 1px solid transparent;
}
.finance-trend-group.is-current {
  border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}
.finance-trend-columns {
  width: 100%;
  height: 190px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}
.finance-trend-column {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-height: 0;
}
.finance-trend-column-value {
  min-width: 54px;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.96);
  border: 1px solid color-mix(in srgb, var(--border) 84%, transparent);
  color: var(--text);
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}
.finance-trend-bar {
  width: 100%;
  min-height: 6px;
  border-radius: 14px 14px 6px 6px;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}
.finance-trend-bar.is-revenue {
  background: linear-gradient(180deg, #67e8f9 0%, #0068b3 100%);
}
.finance-trend-bar.is-expense {
  background: linear-gradient(180deg, #fda4af 0%, #ef4444 100%);
}
.finance-trend-bar.is-profit {
  background: linear-gradient(180deg, #86efac 0%, #10b981 100%);
}
.finance-trend-bar.is-loss {
  background: linear-gradient(180deg, #fca5a5 0%, #dc2626 100%);
}
.finance-trend-bar.is-zero {
  opacity: 0.2;
  box-shadow: none;
}
.finance-trend-label {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.01em;
}
.finance-trend-note {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}
.finance-trend-note.is-positive {
  color: var(--success);
}
.finance-trend-note.is-negative {
  color: var(--danger);
}
.finance-trend-empty {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-2) 72%, var(--surface));
  color: var(--text-muted);
  text-align: left;
}
.finance-trend-empty-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  color: var(--primary);
  font-size: 1.25rem;
  font-weight: 800;
}
.finance-trend-empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}
.finance-trend-empty p {
  margin: 0;
}
@media (max-width: 900px) {
  .finance-trend-widget {
    min-width: 0;
  }
}
.finance-summary-meta-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.finance-summary-meta-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
}
.finance-summary-meta-item span {
  color: var(--text-muted);
  font-size: 0.8667rem;
  font-weight: 600;
}
.finance-summary-meta-item strong {
  font-size: 0.933rem;
  font-weight: 800;
  color: var(--text);
}
.finance-summary-meta-item.is-revenue {
  border-color: color-mix(in srgb, var(--info) 22%, var(--border));
  background: color-mix(in srgb, var(--surface-2) 62%, var(--info-soft));
}
.finance-summary-meta-item.is-revenue span,
.finance-summary-meta-item.is-revenue strong {
  color: var(--info);
}
.finance-summary-meta-item.is-expense {
  border-color: color-mix(in srgb, var(--danger) 22%, var(--border));
  background: color-mix(in srgb, var(--surface-2) 62%, var(--danger-soft));
}
.finance-summary-meta-item.is-expense span,
.finance-summary-meta-item.is-expense strong {
  color: var(--danger);
}
.finance-summary-meta-item.is-profit {
  border-color: color-mix(in srgb, var(--success) 22%, var(--border));
  background: color-mix(in srgb, var(--surface-2) 62%, var(--success-soft));
}
.finance-summary-meta-item.is-profit span,
.finance-summary-meta-item.is-profit strong {
  color: var(--success);
}
.finance-tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.finance-tabs-row #financeTabs {
  flex: 1 1 auto;
  min-width: 0;
}
#financeTabs.settings-tabs {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
#financeTabs .settings-tab {
  width: auto;
  min-width: 0;
  padding: 0 16px;
  height: 34px;
  border-radius: 12px;
  border: 0;
  text-align: center;
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 800;
  color: var(--text);
  background: transparent;
  margin-bottom: 0;
}
#financeTabs .settings-tab:hover {
  color: var(--primary);
  background: rgba(2, 132, 199, 0.08);
}
#financeTabs .settings-tab.active {
  background: color-mix(in srgb, var(--surface-2) 92%, var(--text) 8%);
  color: white;
}
.finance-export-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}
.finance-export-actions .btn {
  height: 34px;
  white-space: nowrap;
}
.finance-export-actions .btn.icon-btn {
  width: 38px;
  min-width: 38px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.finance-export-actions .btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.finance-reports-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.finance-export-separator {
  color: var(--text-muted);
  font-weight: 700;
  line-height: 1;
  margin: 0 2px 0 6px;
}
.finance-petty-sheet-header {
  display: grid;
  grid-template-columns: 110px 110px minmax(280px, 1fr) 220px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.finance-petty-sheet-cell,
.finance-petty-sheet-title,
.finance-petty-sheet-note {
  min-height: 58px;
  padding: 10px 12px;
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.finance-petty-sheet-header > *:last-child {
  border-right: none;
}
.finance-petty-sheet-cell span {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}
.finance-petty-sheet-cell strong {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.finance-petty-sheet-title {
  align-items: center;
  text-align: center;
  font-size: clamp(1.15rem, 1.8vw, 1.55rem);
  font-weight: 800;
  color: var(--text);
}
.finance-petty-sheet-note {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: left;
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  font-size: 0.9rem;
}
.finance-petty-sheet-note > div {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 0;
}
.finance-petty-sheet-note > div + div {
  border-top: 1px solid var(--border-soft);
}
.finance-petty-sheet-note strong {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}
.finance-petty-table tbody tr[data-petty-id] {
  cursor: pointer;
}
.finance-petty-table-wrap {
  flex: 1 1 auto;
  min-height: 260px;
  max-height: none;
  overflow-x: hidden;
  border-top: 0;
  border-radius: 0 0 var(--r-md) var(--r-md);
}
.finance-petty-table {
  width: 100%;
  table-layout: fixed;
}
.finance-petty-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
.finance-petty-table th {
  padding: 7px 8px;
  font-size: 0.72rem;
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}
.finance-petty-table .th-stack {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.05;
}
.finance-petty-table td {
  padding: 6px 8px;
  line-height: 1.15;
  vertical-align: middle;
  font-size: 0.76rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.finance-petty-table th:nth-child(1),
.finance-petty-table td:nth-child(1) { width: 7%; }
.finance-petty-table th:nth-child(2),
.finance-petty-table td:nth-child(2) { width: 7.5%; }
.finance-petty-table th:nth-child(3),
.finance-petty-table td:nth-child(3) { width: 10%; }
.finance-petty-table th:nth-child(4),
.finance-petty-table td:nth-child(4) { width: 12%; }
.finance-petty-table th:nth-child(5),
.finance-petty-table td:nth-child(5) { width: 11%; }
.finance-petty-table th:nth-child(6),
.finance-petty-table td:nth-child(6) { width: 8%; }
.finance-petty-table th:nth-child(7),
.finance-petty-table td:nth-child(7) { width: 9%; }
.finance-petty-table th:nth-child(8),
.finance-petty-table td:nth-child(8) { width: 8%; }
.finance-petty-table th:nth-child(9),
.finance-petty-table td:nth-child(9) { width: 10%; }
.finance-petty-table th:nth-child(10),
.finance-petty-table td:nth-child(10) { width: 8.5%; }
.finance-petty-table th:nth-child(11),
.finance-petty-table td:nth-child(11) { width: 4%; }
.finance-petty-table td strong {
  font-weight: 800;
}
.finance-petty-table td span {
  line-height: 1.1;
}
.finance-petty-table td:nth-child(4) {
  white-space: normal;
}
.finance-petty-table td:nth-child(4) strong,
.finance-petty-table td:nth-child(4) span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.finance-petty-table td:nth-child(4) strong {
  font-size: 0.76rem;
}
.finance-petty-table td:nth-child(4) span {
  margin-top: 1px;
  font-size: 0.68rem;
}
.finance-petty-table .finance-petty-empty td {
  color: var(--text-muted);
  text-align: center;
  padding: 14px 12px;
}
.finance-petty-table .finance-petty-filler td {
  color: transparent;
  height: 28px;
}
.finance-table-empty td {
  text-align: center;
  color: var(--text-muted);
  padding: 18px 12px;
  background: var(--surface);
  border-bottom-color: var(--border);
}
.finance-table-filler td {
  color: transparent;
  height: 42px;
  background: var(--surface);
  border-bottom-color: var(--border);
}
.main-content.finance-page .finance-table-filler:last-child td {
  box-shadow: inset 0 -1px 0 var(--border);
}
.main-content.finance-page #financeReceivablesPanel .table-wrap .data-table tbody {
  background: var(--surface);
}
.main-content.finance-page #financePettyPanel .finance-petty-table {
  width: 100%;
}
.main-content.finance-page :is(
  #financeExpensesPanel,
  #financePnlPanel,
  #financeCashPanel,
  #financeReceivablesPanel,
  #financeVatPanel,
  #financePayablesPanel,
  #financeReportsPanel
) > .table-wrap .data-table,
.main-content.finance-page #financePayablesPanel .finance-payables-table-wrap .data-table {
  min-width: 100%;
}

.finance-payables-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.finance-payables-actions .btn {
  white-space: nowrap;
}
.finance-payment-summary {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.finance-payment-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}
.finance-payment-summary-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}
.finance-payment-summary-row span {
  color: var(--text-muted);
  font-weight: 600;
}
.finance-payment-summary-row strong {
  color: var(--text);
  font-weight: 800;
  text-align: right;
}
.finance-payments-history {
  margin-top: 16px;
}
.kpi-note.good { color: var(--success); font-weight: 600; }
.kpi-note.warn { color: var(--warning); font-weight: 600; }
.kpi-note.bad  { color: var(--danger); font-weight: 600; }

/* Icon color variants */
.icon-teal    { background: #e6f4f2; color: var(--primary); }
.icon-green   { background: var(--success-soft); color: var(--success); }
.icon-amber   { background: var(--warning-soft); color: var(--warning); }
.icon-red     { background: var(--danger-soft); color: var(--danger); }
.icon-blue    { background: var(--info-soft); color: var(--info); }
.icon-violet  { background: #f3f0ff; color: #7c3aed; }

[data-theme="dark"] .icon-teal   { background: #0d2820; }
[data-theme="dark"] .icon-green  { background: #042b1a; }
[data-theme="dark"] .icon-amber  { background: #2a1a00; }
[data-theme="dark"] .icon-red    { background: #2a0a0a; }
[data-theme="dark"] .icon-blue   { background: #082030; }
[data-theme="dark"] .icon-violet { background: #1e0a40; }

/* ═══════════════════════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════════════════════ */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label {
  font-size: 0.8667rem; font-weight: 500; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; padding: 0.4rem 0.8667rem;
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md); font: inherit; font-size: 1rem; line-height: 1.5;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  outline: none;
}
.input, .select { min-height: 2.5rem; }
.input::placeholder, .textarea::placeholder { color: var(--text-dim); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,122,107,0.12);
}
.input.error, .select.error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,0.10); }
.input-icon-wrap { position: relative; }
.input-icon-wrap .input { padding-left: 38px; }
.input-icon-wrap .input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); pointer-events: none;
  width: 16px; height: 16px;
}
.select { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.textarea { resize: vertical; min-height: 80px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-row { display: flex; gap: 12px; align-items: flex-end; }
.form-error { font-size: 0.8667rem; color: var(--danger); font-weight: 600; }
.form-hint { font-size: 0.8667rem; color: var(--text-muted); }

/* Toggle switch */
.toggle { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  width: 40px; height: 22px; background: var(--border);
  border-radius: 99px; transition: background 0.2s;
  flex-shrink: 0; position: relative;
}
.toggle-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: white; position: absolute;
  top: 3px; left: 3px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle input:checked ~ .toggle-track { background: var(--primary); }
.toggle input:checked ~ .toggle-track .toggle-thumb { transform: translateX(18px); }
.toggle-label { font-size: 0.8667rem; font-weight: 500; color: var(--text); }

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: var(--r-md);
  font: inherit; font-size: 0.8667rem; font-weight: 700;
  border: 1.5px solid transparent; cursor: pointer;
  transition: background 0.18s, box-shadow 0.18s, transform 0.12s, border-color 0.18s, color 0.18s;
  white-space: nowrap;
}
.btn[hidden],
button[hidden],
[hidden].btn {
  display: none !important;
}
.btn:active { transform: scale(0.975); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-sm { padding: 5px 10px; font-size: 0.8667rem; border-radius: var(--r-sm); }
.btn-lg { padding: 12px 24px; font-size: 1rem; border-radius: var(--r-md); }
.btn-icon { padding: 9px; }
.btn-icon.btn-sm { padding: 6px; }

.btn-primary { background: var(--primary); color: white; box-shadow: none; }
.btn-primary:hover { background: var(--primary-strong); box-shadow: none; }
.btn-success { background: var(--success); color: white; box-shadow: 0 2px 8px rgba(5,150,105,0.3); }
.btn-success:hover { background: #047857; box-shadow: 0 4px 16px rgba(5,150,105,0.4); }
.btn-danger { background: var(--danger); color: white; box-shadow: 0 2px 8px rgba(220,38,38,0.25); }
.btn-danger:hover { background: var(--danger-strong); }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #b45309; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--primary); }
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-success,
[data-theme="dark"] .btn-warning {
  color: #07111f;
}
[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .btn-success:hover,
[data-theme="dark"] .btn-warning:hover {
  color: #07111f;
}
.finance-past-payments-btn {
  min-width: 140px;
  justify-content: center;
  white-space: nowrap;
  font-weight: 700;
  color: var(--primary);
  border-color: rgba(13, 133, 203, 0.22);
  background: rgba(13, 133, 203, 0.06);
}
.finance-past-payments-btn:hover {
  color: var(--primary-strong);
  border-color: rgba(13, 133, 203, 0.38);
  background: rgba(13, 133, 203, 0.12);
}
.finance-past-payments-btn span {
  font-size: 1.15em;
  line-height: 1;
}
.btn-loading { opacity: 0.75; pointer-events: none; }
.btn-loading::after {
  content: ''; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: white;
  border-radius: 50%; animation: spin 0.7s linear infinite;
}

/* ═══════════════════════════════════════════════════════════════
   CARDS & PANELS
   ═══════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--card-radius); box-shadow: var(--shadow-sm);
}
.card-body { padding: 16px; }
.card-header {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-header h3 { font-size: 1rem; font-weight: 700; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); }

/* ═══════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════ */
.ledger-table th:nth-child(7),
.ledger-table th:nth-child(8),
.ledger-table th:nth-child(9),
.ledger-table th:nth-child(10) { text-align: left; }
.ledger-table-wrap .table-toolbar { background: var(--surface); }
.main-content.ledger-scroll-locked .ledger-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
.ledger-table thead th { background: var(--surface-2); box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.ledger-table-wrap { overflow-x: auto; }
.ledger-table { width: 100%; table-layout: auto; }
.ledger-table col.col-date-time { width: 10%; }
.ledger-table col.col-sku { width: 8.5%; }
.ledger-table col.col-item { width: 29%; }
.ledger-table col.col-batch { width: 7%; }
.ledger-table col.col-opening { width: 6%; }
.ledger-table col.col-qty-in { width: 5%; }
.ledger-table col.col-qty-out { width: 6%; }
.ledger-table col.col-balance { width: 6%; }
.ledger-table col.col-movement { width: 8%; }
.ledger-table col.col-reference { width: 10%; }
.ledger-table col.col-user { width: 7.5%; }
.data-table.ledger-table th,
.data-table.ledger-table td { padding: 7px 10px; font-size: 0.8667rem; line-height: 1.2; }
.data-table.ledger-table th {
  font-size: 0.8667rem;
  letter-spacing: 0.05em;
  text-align: left;
  vertical-align: middle;
}
.data-table.ledger-table tbody td {
  white-space: nowrap;
}
.ledger-table th,
.data-table.ledger-table tbody td,
.ledger-table .ledger-summary-drill-btn,
.ledger-ref-clamp {
  overflow: visible;
  text-overflow: clip;
}
.ledger-ref-clamp {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  line-height: 1.2;
}
.ledger-ref-link {
  display: block;
  max-width: 100%;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  border: none;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-weight: 400;
  padding: 0;
  margin: 0;
  text-align: left;
  text-decoration: none;
}
.ledger-table .ledger-summary-drill-btn {
  max-width: 100%;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  vertical-align: middle;
  color: var(--primary);
  font-weight: 400;
  text-decoration: none;
}
.ledger-table .ledger-summary-drill-btn:hover,
.ledger-table .ledger-summary-drill-btn:focus-visible {
  color: var(--primary-strong);
  text-decoration: underline;
}
.ledger-ref-link:hover,
.ledger-ref-link:focus-visible {
  color: var(--primary-strong);
}
.ledger-movement-text {
  color: var(--text);
  font-weight: 400;
}
.data-table.ledger-table th + th,
.data-table.ledger-table td + td {
  border-left: 0.5px solid var(--border-soft);
}
.data-table.ledger-table.ledger-focused-detail tbody tr:last-child td {
  border-bottom: 1px solid var(--border-soft) !important;
}
.ledger-table td .badge { background: transparent; cursor: pointer; }
.ledger-table td .badge:hover { opacity: 0.75; }
.main-content.batch-movement-scroll-locked {
  overflow-y: hidden;
  overflow-x: hidden;
  padding-bottom: 16px;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: 100%;
  max-height: 100%;
  min-height: 0;
}
.main-content.batch-movement-scroll-locked > div {
  flex: 1 1 auto;
  height: 100%;
  max-height: 100%;
  min-height: 0;
}
.main-content.batch-movement-scroll-locked .batch-movement-grid {
  flex: 1 1 auto;
  min-height: 0;
}
.main-content.batch-movement-scroll-locked .table-wrap {
  min-height: 0;
  height: 100%;
  max-height: none !important;
}
.batch-movement-detail-table {
  width: 100%;
  table-layout: fixed;
}
.batch-movement-panel {
  overflow-x: hidden;
}
.batch-movement-item-table thead th {
  height: 34px;
  vertical-align: middle;
  padding: 4px 8px;
  font-size: 0.7333rem;
}
.batch-movement-detail-table thead th {
  height: 40px;
  padding: 6px 10px !important;
  font-size: 0.8rem;
  vertical-align: middle;
}
.batch-movement-detail-table col.bm-col-batch { width: 15%; }
.batch-movement-detail-table col.bm-col-date { width: 19%; }
.batch-movement-detail-table col.bm-col-qty { width: 12%; }
.batch-movement-detail-table col.bm-col-balance { width: 12%; }
.batch-movement-detail-table col.bm-col-reference { width: 20%; }
.batch-movement-detail-table col.bm-col-view { width: 10%; }
.batch-movement-detail-table th:nth-child(7),
.batch-movement-detail-table td:nth-child(7) {
  text-align: center !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.batch-movement-detail-table thead th + th,
.batch-movement-detail-table tbody td + td {
  border-left: 0.5px solid var(--border-soft);
}
.batch-movement-detail-table .batch-movement-view-btn {
  width: 46px;
  min-width: 46px;
  margin: 0 auto;
  display: inline-flex;
  justify-content: center;
  min-height: 24px;
  line-height: 1.1;
  padding: 0 8px;
  font-size: 0.8rem;
}
.batch-movement-detail-table td {
  padding: 6px 10px !important;
  font-size: 0.8rem;
  line-height: 1.2;
  vertical-align: middle;
}
.batch-movement-detail-table tbody tr {
  height: 36px;
}
.batch-movement-item-table tbody tr:last-child td,
.batch-movement-detail-table tbody tr:last-child td {
  border-bottom: 1px solid var(--border-soft) !important;
}
.batch-movement-detail-table th:nth-child(1),
.batch-movement-detail-table td:nth-child(1),
.batch-movement-detail-table th:nth-child(2),
.batch-movement-detail-table td:nth-child(2),
.batch-movement-detail-table th:nth-child(3),
.batch-movement-detail-table td:nth-child(3),
.batch-movement-detail-table th:nth-child(4),
.batch-movement-detail-table td:nth-child(4),
.batch-movement-detail-table th:nth-child(5),
.batch-movement-detail-table td:nth-child(5),
.batch-movement-detail-table th:nth-child(6),
.batch-movement-detail-table td:nth-child(6) {
  text-align: center !important;
}
.batch-movement-detail-table td:nth-child(2),
.batch-movement-detail-table td:nth-child(6) {
  white-space: nowrap;
}
.batch-movement-batch-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  text-align: center;
}
.batch-movement-batch-head .select {
  min-height: auto;
  padding: 2px 22px 2px 6px;
  font-size: 0.7333rem;
  width: 100%;
  min-width: 0;
  text-align: center;
  text-align-last: center;
}
.batch-movement-batch-head .select {
  max-width: 100%;
  min-width: 0;
  height: 28px;
  min-height: 28px;
  padding: 0 22px 0 6px;
  font-size: 0.7333rem;
  line-height: 1.1;
}
.past-sale-item:hover { background: var(--surface-2); }
@media (max-width: 768px) {
  .full-sales-header { display: none !important; }
  .full-sales-row-desktop { display: none !important; }
  .full-sales-row-mobile { display: flex !important; }
}
.pricelist-input {
  background: var(--surface) !important;
  border-color: rgba(148,163,184,0.45) !important;
  border-width: 0.5px !important;
  box-shadow: inset 0 0 0 1px rgba(148,163,184,0.05) !important;
  border-radius: 0.25em !important;
}
.pricelist-input::-webkit-outer-spin-button,
.pricelist-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pricelist-input[type=number] { -moz-appearance: textfield; }
.pricelist-input:focus { background: var(--surface) !important; border-color: var(--primary) !important; box-shadow: 0 0 0 2px rgba(13,122,107,0.12) !important; }
.pricelist-input:hover { border-color: var(--primary-light) !important; }
.pricelist-input:disabled {
  background: var(--surface-2) !important;
  border-color: var(--border) !important;
  color: var(--text-muted) !important;
  opacity: 1 !important;
}
.table-wrap {
  /* Guard: table pages must follow LAYOUT_CONTRACT.md. Avoid ad-hoc max-height
     overrides unless direct load and soft navigation have both been checked. */
  position: relative;
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100dvh - 240px);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.table-wrap:has(.app-select-wrap.open) {
  overflow: visible;
}
.table-toolbar {
  padding: 10px 12px; display: flex; align-items: center;
  gap: 8px; border-bottom: 1px solid var(--border);
  background: var(--surface); border-radius: var(--r-md) var(--r-md) 0 0;
  flex-wrap: wrap;
}
.table-toolbar .toolbar-action-btn { margin-left: 2px; white-space: nowrap; }
.table-toolbar #newGrnBtn.toolbar-action-btn { order: 1; margin-left: auto; }
.table-toolbar #newPurchaseBtn.toolbar-action-btn { order: 1; margin-left: auto; }
.table-toolbar .input,
.table-toolbar .select { padding-top: 8px; padding-bottom: 8px; font-size: 0.8667rem; }
.ledger-toolbar { gap: 6px; padding: 8px; align-items: center; flex-wrap: nowrap; }
.ledger-toolbar .input,
.ledger-toolbar .select { padding-top: 6px; padding-bottom: 6px; font-size: 0.8667rem; }
.ledger-toolbar .ledger-filter-item { flex: 0 1 138px; width: 138px; min-width: 0; max-width: 180px; }
.ledger-toolbar #ledgerDirectionFilter { flex: 0 1 150px; width: 150px; min-width: 0; max-width: 178px; }
.ledger-toolbar .ledger-date-input { flex: 0 0 136px; width: 136px; min-width: 136px; max-width: 136px; }
.ledger-toolbar .ledger-search-wrap { margin-left: 0; flex: 1 1 420px; min-width: 260px; max-width: none; }
#ledgerBatchMovementBtn:hover,
#ledgerBatchMovementBtn:focus-visible {
  color: var(--primary) !important;
  border-color: var(--primary) !important;
  background: var(--surface-2) !important;
}

@media (max-width: 980px) {
  .ledger-toolbar { flex-wrap: wrap; }
  .ledger-toolbar .ledger-search-wrap {
    margin-left: 0;
    flex: 1 1 100%;
    min-width: 220px;
    max-width: none;
  }
}

@media (max-width: 780px) {
  .ledger-toolbar #ledgerDirectionFilter,
  .ledger-toolbar .ledger-date-input,
  .ledger-toolbar .ledger-search-wrap {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    max-width: none;
  }
}
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.data-table th {
  text-align: left; padding: 8px 10px;
  font-size: 0.8667rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
  border-bottom: 1px solid var(--border); background: var(--surface-2); line-height: 1.25;
  white-space: nowrap;
}
.data-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--border-soft);
  font-size: 0.8667rem; line-height: 1.25; vertical-align: middle;
}
.data-table tbody tr:not(.finance-table-empty):not(.table-fill-row):not(.finance-table-filler):not(.finance-petty-filler) td {
  height: auto;
}
.data-table tbody tr.table-fill-row td,
.data-table tbody tr.finance-table-filler td,
.data-table tbody tr.finance-petty-filler td {
  height: 52px;
  padding: 0;
  color: transparent;
  background: var(--surface) !important;
  border: 0 !important;
  box-shadow: none;
}
.data-table tbody tr.table-fill-row:last-child td,
.data-table tbody tr.finance-table-filler:last-child td {
  box-shadow: none;
}
.main-content:not(.stock-page) > section:not(.hidden) > .table-wrap:has(> .data-table),
.main-content:not(.stock-page) > section:not(.hidden) > div:not(.hidden) > .table-wrap:has(> .data-table) {
  min-height: min(560px, calc(100dvh - 240px));
}
.main-content:has(#adjListPanel:not(.hidden)),
.main-content:has(#takeListPanel:not(.hidden)),
.main-content:has(#takeEntryPanel:not(.hidden)),
.main-content:has(#returnsListPanel:not(.hidden)),
.main-content:has(#returnsEntryPanel:not(.hidden)),
.main-content:has(#transferTotal),
.main-content:has(#pastReturnsSearchInput) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.main-content:has(#adjListPanel:not(.hidden)) > #adjListPanel,
.main-content:has(#takeListPanel:not(.hidden)) > #takeListPanel,
.main-content:has(#takeEntryPanel:not(.hidden)) > #takeEntryPanel,
.main-content:has(#returnsListPanel:not(.hidden)) > #returnsListPanel,
.main-content:has(#returnsEntryPanel:not(.hidden)) > #returnsEntryPanel,
.main-content:has(#transferTotal) > section,
.main-content:has(#pastReturnsSearchInput) > div[style*="display:flex"] {
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-height: 0;
  overflow: hidden;
}
#adjListPanel {
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-height: 0;
  overflow: hidden;
}
#adjListPanel > .page-header {
  flex-shrink: 0;
}
#adjListPanel > .table-wrap {
  flex: 1 1 0%;
  min-height: 0;
  max-height: calc(100dvh - 200px);
  height: 0;
}
#adjListPanel > .empty-state {
  flex: 1 1 auto;
}
#takeListPanel,
#takeEntryPanel {
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-height: 0;
  overflow: hidden;
}
#takeListPanel > .page-header,
#takeEntryPanel > .page-header {
  flex-shrink: 0;
}
#takeEntryPanel > .settings-tabs {
  flex-shrink: 0;
}
#takeListPanel > .table-wrap,
#takeEntryPanel > .table-wrap {
  flex: 1 1 0%;
  min-height: 0;
  max-height: calc(100dvh - 200px);
  height: 0;
}

.main-content.stock-page > #takeListPanel:not(.hidden) > .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: auto;
}

.main-content.stock-page > #takeListPanel:not(.hidden) > .table-wrap > .table-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
}
#takeListPanel > .empty-state {
  flex: 1 1 auto;
}
.main-content.stock-page > section {
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-height: 0;
  overflow: hidden;
}
.main-content.stock-page > section > .page-header {
  flex-shrink: 0;
}
.main-content.stock-page > section > .kpi-grid {
  flex-shrink: 0;
}
.main-content.stock-page > section > .table-wrap:not(#transferLocationBalancesWrap),
.main-content:has(#transferTotal) > section > .table-wrap:not(#transferLocationBalancesWrap),
.main-content:has(#pastReturnsSearchInput) > div[style*="display:flex"] + .table-wrap {
  flex: 1 1 0%;
  min-height: 0;
  max-height: calc(100dvh - 200px);
  height: 0;
}
.main-content.stock-page > section > .empty-state {
  flex: 1 1 auto;
}
#returnsListPanel,
#returnsEntryPanel {
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-height: 0;
  overflow: hidden;
}
#returnsListPanel > .table-wrap,
#returnsEntryPanel > .table-wrap {
  flex: 1 1 0%;
  min-height: 0;
  max-height: calc(100dvh - 200px);
  height: 0;
}
.main-content.stock-page > #returnsListPanel:not(.hidden) > .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: auto;
}
.main-content.stock-page > #returnsListPanel:not(.hidden) > .table-wrap > .table-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
}
#returnsListPanel > .empty-state {
  flex: 1 1 auto;
}
@media (min-width: 768px) {
  #returnsEntryPanel .returns-entry-grid {
    grid-template-columns: minmax(260px, 1.2fr) minmax(170px, 0.7fr) minmax(320px, 1.4fr);
    align-items: end;
  }
  #returnsEntryPanel > #customerReturnFormPanel:not(.hidden),
  #returnsEntryPanel > #supplierReturnFormPanel:not(.hidden) {
    display: flex;
    flex: 1 1 0%;
    min-height: 0;
  }
  #returnsEntryPanel > #customerReturnFormPanel:not(.hidden) > .table-wrap,
  #returnsEntryPanel > #supplierReturnFormPanel:not(.hidden) > .table-wrap {
    display: flex;
    flex: 1 1 0%;
    flex-direction: column;
    min-height: 0;
    max-height: none;
    overflow: hidden;
  }
  #returnsEntryPanel > #customerReturnFormPanel:not(.hidden) > .table-wrap > .table-wrap,
  #returnsEntryPanel > #supplierReturnFormPanel:not(.hidden) > .table-wrap > .table-wrap {
    flex: 0 0 auto;
    min-height: 0;
    overflow: auto;
  }
  #returnsEntryPanel > #customerReturnFormPanel:not(.hidden) > .table-wrap > .table-wrap > .data-table,
  #returnsEntryPanel > #supplierReturnFormPanel:not(.hidden) > .table-wrap > .table-wrap > .data-table {
    height: auto;
  }
}
.main-content.stock-page > div[style*="display:flex"] {
  flex-shrink: 0;
}
.main-content.stock-page > div[style*="display:flex"] + .table-wrap {
  flex: 1 1 0%;
  min-height: 0;
  max-height: calc(100dvh - 200px);
  height: 0;
}
.main-content.stock-page > .empty-state {
  flex: 1 1 auto;
}
.data-table th:not(:last-child),
.data-table td:not(:last-child) { border-right: 1px solid var(--border-soft); }
.data-table th:last-child,
.data-table td:last-child { border-right: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: 1px solid var(--border-soft); }
.data-table tbody tr { transition: background 0.14s; }
.main-content:not(.pos-page) .data-table tbody tr:nth-child(even) td { background: var(--table-row-alt); }
.main-content:not(.pos-page) .data-table tbody tr:hover td { background: var(--table-row-hover); }
.products-admin-page #productsManageItemsBody tr td { background: var(--surface) !important; }
.products-admin-page #productsManageItemsBody tr:hover td { background: var(--primary-soft) !important; }

#rxLogSection .table-toolbar .input,
#rxLogSection .table-toolbar .select { height: 28px; padding-top: 0; padding-bottom: 3px; font-size: 0.8rem; }
.main-content.rx-page,
.main-content.rx-page #pendingCollectionPanel,
.main-content.rx-page #longTermPatientsPanel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.main-content.rx-page :is(#rxLogSection, #pendingCollectionPanel, #longTermPatientsPanel):not(.hidden) {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.main-content.rx-page {
  overflow: hidden;
  padding-bottom: 8px;
}
.main-content.rx-page :is(#rxLogSection, #pendingCollectionListSection, #longTermPatientsListSection) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.main-content.rx-page :is(#rxLogSection, #pendingCollectionListSection, #longTermPatientsListSection) > .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: auto;
}
.main-content.rx-page :is(#rxLogSection, #pendingCollectionListSection, #longTermPatientsListSection) > .table-wrap > .data-table {
  width: 100%;
}
.main-content.rx-page :is(#rxLogSection, #pendingCollectionListSection, #longTermPatientsListSection) > .table-wrap .data-table tbody {
  background: var(--surface);
}
.main-content.rx-page :is(#rxLogSection, #pendingCollectionListSection, #longTermPatientsListSection) .finance-table-filler:last-child td {
  box-shadow: inset 0 -1px 0 var(--border);
}
#rxLogSection .table-wrap {
  position: relative;
}
#rxLogSection .table-wrap::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  border-bottom: 1px solid var(--border);
  pointer-events: none;
}
#rxLogSection .table-toolbar .app-select-wrap {
  flex: 0 0 132px;
  width: 132px !important;
}
#rxLogSection .table-toolbar .app-select-wrap.open {
  z-index: 700;
}
#rxLogSection .table-toolbar .app-select-button {
  min-height: 38px;
  height: 38px;
  padding: 0 12px 0 14px;
  font-size: 0.8667rem;
}
#rxLogSection .table-toolbar .app-select-menu {
  min-width: 100%;
  width: 238px;
  max-height: 260px;
  z-index: 800;
}
#rxLogSection .table-toolbar .search-wrap .input { height: 28px; }
#rxLogSection .table-toolbar .search-icon { top: 50%; transform: translateY(-50%); }
#rxLogSection .pending-collection-toggle { color: var(--primary); }
#rxLogSection .pending-collection-toggle:hover { color: var(--primary-strong); }
#rxModal .input,
#rxModal .select { height: 28px; padding-top: 0; padding-bottom: 0; font-size: 0.8rem; }
#posBulkAddBtn { height: var(--pos-btn-toolbar); line-height: 1; }
.pos-search-bar .input { height: var(--pos-btn-toolbar); min-height: var(--pos-btn-toolbar); }
.pos-search-bar .btn { height: var(--pos-btn-toolbar); line-height: 1; }

.supplier-mapping-table th {
  padding: 7px 10px;
  font-size: 0.8rem;
}
.supplier-mapping-table td {
  padding: 6px 10px;
}
.supplier-mapping-table .supplier-mapping-sub {
  display: block;
  margin-top: 1px;
  font-size: 0.7333rem;
  color: var(--text-dim);
  line-height: 1.2;
}
.supplier-mapping-table .map-price-input {
  width: 110px;
  min-height: 2rem;
  height: 2rem;
  padding: 2px 8px;
  font-size: 0.82rem;
}
.supplier-map-workspace {
  padding-bottom: 10px;
}
.supplier-map-workspace-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr);
  gap: 12px;
  align-items: start;
}
.supplier-map-product-search {
  max-width: 320px;
}
.supplier-map-left-card,
.supplier-map-right-card {
  border-radius: var(--r-lg);
  overflow: hidden;
}
.supplier-map-panel {
  max-height: calc(100dvh - 260px);
  overflow-y: auto;
  overflow-x: hidden;
}
.supplier-map-product-table thead th,
.supplier-map-supplier-table thead th {
  height: 34px;
  vertical-align: middle;
  padding: 6px 10px;
  font-size: 0.75rem;
}
.supplier-map-product-table td,
.supplier-map-supplier-table td {
  padding: 6px 10px;
  font-size: 0.82rem;
}
.supplier-map-product-row {
  cursor: pointer;
}
.supplier-map-product-row.active td {
  background: var(--primary-soft) !important;
}
.supplier-map-product-name {
  font-weight: 700;
  color: var(--text);
}
.supplier-map-product-sub {
  display: block;
  margin-top: 1px;
  font-size: 0.7333rem;
  color: var(--text-dim);
}
.supplier-map-right-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-2);
}
.supplier-map-selected-product {
  font-size: 0.8667rem;
  font-weight: 700;
  color: var(--text);
}
.supplier-map-supplier-search {
  max-width: 280px;
  min-width: 220px;
}
.supplier-map-supplier-name {
  font-weight: 700;
  color: var(--text);
}
.supplier-map-supplier-sub {
  display: block;
  margin-top: 1px;
  font-size: 0.7333rem;
  color: var(--text-dim);
}
.supplier-map-price-input {
  width: 124px;
  min-height: 2rem;
  height: 2rem;
  padding: 2px 8px;
  font-size: 0.82rem;
  text-align: right;
}
.supplier-map-vat-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
}
.supplier-map-star-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  width: 28px;
  height: 28px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.8667rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.supplier-map-star-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.supplier-map-star-btn.is-silver {
  background: #eef2f7;
  color: #64748b;
  border-color: #cbd5e1;
}
.supplier-map-star-btn.is-gold {
  background: #fef3c7;
  color: #b45309;
  border-color: #f59e0b;
}
@media (max-width: 1080px) {
  .supplier-map-workspace-grid {
    grid-template-columns: 1fr;
  }
  .supplier-map-panel {
    max-height: 48vh;
  }
  .supplier-map-supplier-search {
    max-width: none;
    min-width: 0;
    width: 100%;
  }
  .supplier-map-right-head {
    flex-direction: column;
    align-items: stretch;
  }
}
.products-supplier-map-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.products-supplier-map-toolbar .input {
  flex: 1 1 220px;
}
.products-supplier-map-list {
  max-height: 270px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}
.products-supplier-map-list .data-table th {
  padding: 6px 10px;
  font-size: 0.75rem;
}
.products-supplier-map-list .data-table td {
  padding: 6px 10px;
}
.products-supplier-map-list .products-map-supplier-name {
  font-weight: 700;
}
.products-supplier-map-list .products-map-supplier-sub {
  display: block;
  margin-top: 1px;
  font-size: 0.7333rem;
  color: var(--text-dim);
  line-height: 1.2;
}
.products-supplier-map-list .map-price-input {
  width: 120px;
  min-height: 2rem;
  height: 2rem;
  padding: 2px 8px;
  font-size: 0.82rem;
}
.products-supplier-map-list .products-map-vat-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
}

/* ═══════════════════════════════════════════════════════════════
   PRODUCTS PAGE — COMPACT ADMIN INVENTORY
   ═══════════════════════════════════════════════════════════════ */
.products-admin-page {
  --prod-bg: #f5f7fb;
  --prod-panel: #ffffff;
  --prod-elev: #f8fafc;
  --prod-row: #ffffff;
  --prod-row-alt: #fbfdff;
  --prod-row-hover: #f1f5f9;
  --prod-row-selected: #e8f1ff;
  --prod-divider: rgba(15, 23, 42, 0.08);
  --prod-text: #0f172a;
  --prod-text-muted: #64748b;
  --prod-green: #16a37a;
  padding: 10px 12px 56px;
  background: var(--prod-bg);
  color: var(--prod-text);
}
[data-theme="dark"] .products-admin-page {
  --prod-bg: #111b21;
  --prod-panel: #1f2c33;
  --prod-elev: #202c33;
  --prod-row: #1a262d;
  --prod-row-alt: #1c2a31;
  --prod-row-hover: #24343d;
  --prod-row-selected: #22333b;
  --prod-divider: rgba(255, 255, 255, 0.07);
  --prod-text: #e9edef;
  --prod-text-muted: #9aa4b2;
  --prod-green: #16a37a;
}
.products-admin-surface {
  display: grid;
  gap: 8px;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 0;
  color: var(--prod-text);
}
.products-admin-page .empty-state h3 { color: var(--prod-text); }
.products-admin-page .empty-state p { color: var(--prod-text-muted); }
.products-control-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
#productSubTabs.products-tab-group.settings-tabs {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  margin: 0;
  border: 0;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
#productSubTabs .settings-tab {
  padding: 0 16px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1;
  border-radius: 12px;
  border: 0;
  font-size: 0.875rem;
  font-weight: 800;
  color: var(--prod-text);
  background: transparent;
  margin-bottom: 0;
  transition: background 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}
#productSubTabs .settings-tab:hover {
  color: var(--primary);
  background: rgba(2, 132, 199, 0.08);
}
#productSubTabs .settings-tab.active {
  background: color-mix(in srgb, var(--surface-2) 92%, var(--text) 8%);
  color: white;
}
.products-control-select {
  min-width: 210px;
  max-width: 300px;
}
.products-control-add { margin-left: auto; }
.products-control-row .btn,
.products-control-row .select {
  height: 34px;
}
.products-control-row .select {
  padding-top: 6px;
  padding-bottom: 6px;
  line-height: 1.25;
}
.products-control-row .products-control-batches {
  display: inline-flex;
  align-items: center;
}
.products-admin-page .select,
.products-admin-page .input,
.products-admin-page .textarea {
  background-color: var(--prod-panel);
  border-color: var(--prod-divider);
  color: var(--prod-text);
}
.products-admin-page .input::placeholder { color: var(--prod-text-muted); }
.products-admin-page .search-icon { color: var(--prod-text-muted); }
.products-filter-row {
  padding: 8px 10px;
  border-bottom-color: var(--prod-divider);
  background: var(--prod-elev);
  gap: 8px;
  flex-wrap: wrap;
}
.products-filter-search {
  flex: 1;
  min-width: 230px;
  max-width: 380px;
}
.products-filter-row .select { width: 170px; min-width: 170px; }
.products-filter-summary {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.products-filter-summary-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 132px;
  padding: 8px 12px;
  border: 1px solid var(--prod-divider);
  border-radius: 10px;
  background: var(--surface);
}
.products-filter-summary-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--prod-text-muted);
}
.products-filter-summary-value {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--prod-text);
  white-space: nowrap;
}
.products-pricelist-bulk {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.products-pricelist-bulk .select {
  width: 128px;
  min-width: 128px;
}
.products-pricelist-bulk .input {
  width: 82px;
  min-width: 82px;
}
.products-pricelist-bulk .btn {
  height: 34px;
  white-space: nowrap;
}
.products-pricelist-export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.products-pricelist-export .btn {
  height: 34px;
  white-space: nowrap;
}
.products-pricelist-export .btn.icon-btn {
  width: 38px;
  min-width: 38px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.products-pricelist-export .btn.icon-btn svg {
  width: 19px;
  height: 19px;
}
#priceListExportPdfBtn svg {
  width: 21px;
  height: 21px;
}
#priceListExportPdfBtn .price-pdf-badge {
  min-width: 24px;
  height: 22px;
  padding: 0 3px;
  border-radius: 4px;
  background: #dc2626;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7333rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  margin: 0 auto;
}
#financeExportPdfBtn .price-pdf-badge {
  min-width: 24px;
  height: 22px;
  padding: 0 3px;
  border-radius: 4px;
  background: #dc2626;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7333rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  margin: 0 auto;
}
#priceListExportCsvBtn .price-xls-badge {
  min-width: 24px;
  height: 22px;
  padding: 0 3px;
  border-radius: 4px;
  background: #047857;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7333rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  margin: 0 auto;
}
#financeExportExcelBtn .price-xls-badge {
  min-width: 24px;
  height: 22px;
  padding: 0 3px;
  border-radius: 4px;
  background: #047857;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7333rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  margin: 0 auto;
}
#priceListExportCsvBtn {
  color: #047857;
}
#priceListExportPdfBtn {
  color: #dc2626;
}
#financeExportExcelBtn {
  color: #047857;
}
#financeExportPdfBtn {
  color: #dc2626;
}
[data-theme="dark"] #priceListExportCsvBtn {
  color: #34d399;
}
[data-theme="dark"] #priceListExportCsvBtn .price-xls-badge {
  background: #10b981;
  color: #fff;
}
[data-theme="dark"] #priceListExportPdfBtn {
  color: #f87171;
}
[data-theme="dark"] #priceListExportPdfBtn .price-pdf-badge {
  background: #ef4444;
  color: #fff;
}
[data-theme="dark"] #financeExportExcelBtn {
  color: #34d399;
}
[data-theme="dark"] #financeExportExcelBtn .price-xls-badge {
  background: #10b981;
  color: #fff;
}
[data-theme="dark"] #financeExportPdfBtn {
  color: #f87171;
}
[data-theme="dark"] #financeExportPdfBtn .price-pdf-badge {
  background: #ef4444;
  color: #fff;
}
.products-admin-page .products-table-wrap.table-wrap {
  border: 1px solid var(--prod-divider);
  border-radius: 10px;
  background: var(--prod-panel);
  overflow-x: hidden;
  overflow-y: visible;
  scrollbar-gutter: stable;
}
.products-admin-page .products-table.data-table {
  background: transparent;
  table-layout: fixed;
  width: 100%;
}
.products-admin-page .products-table.data-table th:nth-child(1),
.products-admin-page .products-table.data-table td:nth-child(1) { width: 28%; }
.products-admin-page .products-table.data-table th:nth-child(2),
.products-admin-page .products-table.data-table td:nth-child(2) { width: 16%; }
.products-admin-page .products-table.data-table th:nth-child(3),
.products-admin-page .products-table.data-table td:nth-child(3) { width: 10%; }
.products-admin-page .products-table.data-table th:nth-child(4),
.products-admin-page .products-table.data-table td:nth-child(4) { width: 14%; }
.products-admin-page .products-table.data-table th:nth-child(5),
.products-admin-page .products-table.data-table td:nth-child(5) { width: 12%; }
.products-admin-page .products-table.data-table th:nth-child(6),
.products-admin-page .products-table.data-table td:nth-child(6) { width: 12%; }
.products-admin-page #productsListPanel .products-table.data-table th:nth-child(1),
.products-admin-page #productsListPanel .products-table.data-table td:nth-child(1) { width: 3%; }
.products-admin-page #productsListPanel .products-table.data-table th:nth-child(2),
.products-admin-page #productsListPanel .products-table.data-table td:nth-child(2) { width: 9%; }
.products-admin-page #productsListPanel .products-table.data-table th:nth-child(3),
.products-admin-page #productsListPanel .products-table.data-table td:nth-child(3) { width: 26%; }
.products-admin-page #productsListPanel .products-table.data-table th:nth-child(4),
.products-admin-page #productsListPanel .products-table.data-table td:nth-child(4) { width: 12%; }
.products-admin-page #productsListPanel .products-table.data-table th:nth-child(5),
.products-admin-page #productsListPanel .products-table.data-table td:nth-child(5) { width: 8%; }
.products-admin-page #productsListPanel .products-table.data-table th:nth-child(6),
.products-admin-page #productsListPanel .products-table.data-table td:nth-child(6) { width: 12%; }
.products-admin-page #productsListPanel .products-table.data-table th:nth-child(7),
.products-admin-page #productsListPanel .products-table.data-table td:nth-child(7) { width: 10%; }
.products-admin-page #productsListPanel .products-table.data-table th:nth-child(8),
.products-admin-page #productsListPanel .products-table.data-table td:nth-child(8) { width: 11%; }
.products-admin-page #productsListPanel .products-table.data-table th:nth-child(9),
.products-admin-page #productsListPanel .products-table.data-table td:nth-child(9) { width: 9%; }
.products-admin-page #productsPriceListPanel .products-table.data-table th:nth-child(1),
.products-admin-page #productsPriceListPanel .products-table.data-table td:nth-child(1) { width: 4%; }
.products-admin-page #productsPriceListPanel .products-table.data-table th:nth-child(2),
.products-admin-page #productsPriceListPanel .products-table.data-table td:nth-child(2) { width: 22%; }
.products-admin-page #productsPriceListPanel .products-table.data-table th:nth-child(3),
.products-admin-page #productsPriceListPanel .products-table.data-table td:nth-child(3) { width: 12%; }
.products-admin-page #productsPriceListPanel .products-table.data-table th:nth-child(4),
.products-admin-page #productsPriceListPanel .products-table.data-table td:nth-child(4) { width: 15%; }
.products-admin-page #productsPriceListPanel .products-table.data-table th:nth-child(5),
.products-admin-page #productsPriceListPanel .products-table.data-table td:nth-child(5) { width: 12%; }
.products-admin-page #productsPriceListPanel .products-table.data-table th:nth-child(6),
.products-admin-page #productsPriceListPanel .products-table.data-table td:nth-child(6) { width: 7%; }
.products-admin-page #productsPriceListPanel .products-table.data-table th:nth-child(7),
.products-admin-page #productsPriceListPanel .products-table.data-table td:nth-child(7) { width: 7%; }
.products-admin-page #productsPriceListPanel .products-table.data-table th:nth-child(8),
.products-admin-page #productsPriceListPanel .products-table.data-table td:nth-child(8) { width: 10.5%; }
.products-admin-page #productsPriceListPanel .products-table.data-table th:nth-child(9),
.products-admin-page #productsPriceListPanel .products-table.data-table td:nth-child(9) { width: 10.5%; }
.products-admin-page #productsPriceListPanel .products-table thead th:nth-child(9),
.products-admin-page #productsPriceListPanel .products-table tbody td:nth-child(9) {
  border-left: 1px solid var(--prod-divider);
}
.products-admin-page #productsPriceListPanel .products-table thead th:nth-child(8),
.products-admin-page #productsPriceListPanel .products-table tbody td:nth-child(8) {
  border-left: 1px solid var(--prod-divider);
}
.products-admin-page .products-table.data-table th {
  background: var(--prod-elev);
  color: var(--prod-text-muted);
  border-bottom: 1px solid var(--prod-divider);
  padding: 7px 10px;
  font-size: 0.8667rem;
  letter-spacing: 0.05em;
}
.products-admin-page #productsPriceListPanel .products-table thead th {
  position: sticky;
  top: var(--pricelist-sticky-offset, 52px);
  z-index: 6;
  background: var(--prod-elev);
}
.products-admin-page #productsPriceListPanel .products-table-wrap {
  --pricelist-sticky-offset: 52px;
  height: auto;
  max-height: none;
  overflow-y: auto;
}
.products-admin-page #productsListPanel .products-table-wrap {
  --products-list-sticky-offset: 52px;
  height: auto;
  max-height: none;
  overflow-y: visible;
}
.products-admin-page #productsListPanel .products-filter-row {
  position: sticky;
  top: 0;
  z-index: 7;
}
.products-admin-page #productsListPanel .products-table thead th {
  position: sticky;
  top: var(--products-list-sticky-offset, 52px);
  z-index: 6;
  background: var(--prod-elev);
}
.products-admin-page #productsPriceListPanel .products-table th:nth-child(4),
.products-admin-page #productsPriceListPanel .products-table td:nth-child(4) {
  padding-right: 18px;
}
.products-admin-page #productsPriceListPanel .products-table th:nth-child(5),
.products-admin-page #productsPriceListPanel .products-table td:nth-child(5) {
  padding-left: 18px;
}
.products-admin-page #productsPriceListPanel .products-table .price-select-col,
.products-admin-page #productsPriceListPanel .products-table .price-select-cell {
  text-align: center;
  padding-left: 6px;
  padding-right: 6px;
}
.products-admin-page #productsPriceListPanel .products-table .price-select-col input,
.products-admin-page #productsPriceListPanel .products-table .price-select-cell input {
  width: 14px;
  height: 14px;
  accent-color: #0b3d91;
}
[data-theme="dark"] .products-admin-page #productsPriceListPanel .products-table .price-select-col input,
[data-theme="dark"] .products-admin-page #productsPriceListPanel .products-table .price-select-cell input {
  accent-color: #7dd3fc;
}
.products-admin-page #productsPriceListPanel .products-table .price-sell-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.products-admin-page #productsPriceListPanel .products-table .price-calc-inline-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  border-radius: 6px;
  border: none;
  box-shadow: none;
  background: transparent;
  color: #0b3d91;
}
.products-admin-page #productsPriceListPanel .products-table .price-calc-inline-btn:hover {
  color: #0b3d91;
  background: transparent !important;
  box-shadow: none;
}
.products-admin-page #productsPriceListPanel .products-table .price-calc-inline-btn:focus,
.products-admin-page #productsPriceListPanel .products-table .price-calc-inline-btn:active {
  background: transparent !important;
  box-shadow: none;
}
.products-admin-page #productsPriceListPanel .products-table .price-calc-inline-btn svg {
  width: 22px;
  height: 22px;
}
[data-theme="dark"] .products-admin-page #productsPriceListPanel .products-table .price-history-btn,
[data-theme="dark"] .products-admin-page #productsPriceListPanel .products-table .price-calc-inline-btn {
  color: #7dd3fc;
}
[data-theme="dark"] .products-admin-page #productsPriceListPanel .products-table .price-calc-inline-btn {
  color: #7dd3fc;
}
[data-theme="dark"] .products-admin-page #productsPriceListPanel .products-table .price-calc-inline-btn:hover {
  color: #bae6fd;
  background: transparent !important;
  box-shadow: none;
}
.products-admin-page #productsPriceListPanel .products-table .price-product-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.products-admin-page #productsPriceListPanel .products-table .price-history-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border: none;
  box-shadow: none;
  background: transparent;
  color: #0b3d91;
}
.products-admin-page #productsPriceListPanel .products-table .price-history-btn:hover {
  color: #0b3d91;
  background: transparent !important;
  box-shadow: none;
}
.products-admin-page #productsPriceListPanel .products-table .price-history-btn:focus,
.products-admin-page #productsPriceListPanel .products-table .price-history-btn:active {
  background: transparent !important;
  box-shadow: none;
}
.products-admin-page #productsPriceListPanel .products-table .price-history-btn svg {
  width: 16px;
  height: 16px;
}
.products-admin-page #productsPriceListPanel .products-filter-row {
  position: sticky;
  top: 0;
  z-index: 7;
}
.products-pricelist-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  margin-top: 6px;
  border: 1px solid var(--prod-divider);
  border-radius: 10px;
  background: var(--prod-panel);
}
.products-pricelist-draftbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--prod-divider);
  border-radius: 10px;
  background: rgba(14, 116, 144, 0.08);
}
.products-pricelist-draft-info {
  font-size: 0.8667rem;
  color: var(--prod-text);
  font-weight: 700;
}
.products-pricelist-draft-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.price-validation-list {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.price-validation-badge-emoji {
  display: inline-flex;
  align-items: center;
  font-size: 1rem;
  line-height: 1;
  cursor: help;
}
.price-validation-badge-emoji.red {
  filter: hue-rotate(-30deg) saturate(3) brightness(0.8);
}
.price-validation-icon {
  display: inline-flex;
  align-items: center;
  font-size: 1.1rem;
  line-height: 1;
  cursor: help;
  font-weight: 700;
  margin-right: 4px;
}
.price-validation-icon.red {
  color: #dc2626;
}
.price-validation-icon.orange {
  color: #f59e0b;
}
.price-validation-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.4;
}
.price-validation-badge.warning {
  color: #a16207;
  background: rgba(245, 158, 11, 0.18);
}
.price-validation-badge.danger {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.16);
}
.products-pricelist-page-info {
  font-size: 0.8667rem;
  color: var(--prod-text-muted);
  font-weight: 600;
}
.products-pricelist-page-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.products-pricelist-page-count {
  min-width: 108px;
  text-align: center;
  font-size: 0.8667rem;
  color: var(--prod-text-muted);
  font-weight: 700;
}
.main-content.products-admin-page.pricelist-scroll-locked {
  overflow: hidden;
  padding-bottom: 8px;
}
.main-content.products-admin-page.pricelist-scroll-locked .products-admin-surface {
  height: 100%;
  min-height: 0;
  grid-template-rows: auto 1fr;
}
.main-content.products-admin-page.pricelist-scroll-locked #productsPriceListPanel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.main-content.products-admin-page.pricelist-scroll-locked #productsPriceListPanel .products-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
}
.main-content.products-admin-page.expiry-scroll-locked {
  overflow: hidden;
  padding-bottom: 8px;
  display: flex;
  flex-direction: column;
}
.main-content.products-admin-page.expiry-scroll-locked .products-admin-surface {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
}
.main-content.products-admin-page.expiry-scroll-locked #productsExpiryPanel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.main-content.products-admin-page.expiry-scroll-locked #productsExpiryPanel .products-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: auto;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--r-md);
  box-shadow: inset 0 -1px 0 var(--border);
}
.main-content.products-admin-page.expiry-scroll-locked #productsExpiryPanel .products-table-wrap > .table-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
}
.main-content.products-admin-page.expiry-scroll-locked #productsExpiryPanel .products-table-wrap:has(.app-select-wrap.open) {
  overflow: visible;
}
.main-content.products-admin-page.list-scroll-locked {
  overflow: hidden;
  padding-bottom: 8px;
  height: calc(100dvh - var(--topbar-height, 72px));
}
.main-content.products-admin-page.list-scroll-locked .products-admin-surface {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.main-content.products-admin-page.list-scroll-locked #productsListPanel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  height: auto;
  grid-row: 1 / -1;
  overflow: hidden;
}
.main-content.products-admin-page.list-scroll-locked #productsListPanel .products-table-wrap {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  max-height: none;
  overflow-y: auto !important;
  overflow-x: hidden;
}
.main-content.products-admin-page.list-scroll-locked #productsListPanel .products-table-wrap .table-toolbar {
  flex: 0 0 auto;
}
.main-content.products-admin-page.list-scroll-locked #productsListPanel .products-table {
  flex: 0 0 auto;
  min-height: 0;
  margin-bottom: auto;
}
.main-content.products-admin-page.add-scroll-locked {
  overflow: hidden;
  padding-bottom: 8px;
}
.main-content.products-admin-page.bulk-scroll-locked {
  overflow: hidden;
  padding-bottom: 8px;
}
.main-content.products-admin-page.add-scroll-locked .products-admin-surface {
  height: 100%;
  min-height: 0;
  grid-template-rows: auto 1fr;
}
.main-content.products-admin-page.bulk-scroll-locked .products-admin-surface {
  height: 100%;
  min-height: 0;
  grid-template-rows: auto 1fr;
}
.main-content.products-admin-page.add-scroll-locked #productsAddPanel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.main-content.products-admin-page.bulk-scroll-locked #productsBulkImportPanel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}
.main-content.products-admin-page.add-scroll-locked #productsAddPanel > .products-table-wrap {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.main-content.products-admin-page.bulk-scroll-locked #productsBulkImportPanel > .products-table-wrap {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  gap: 12px;
}
.main-content.products-admin-page.add-scroll-locked #productsAddPanel .product-editor-search-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr);
  gap: 14px;
  align-items: flex-end;
  margin-bottom: 14px;
}
.main-content.products-admin-page.bulk-scroll-locked #productsBulkImportPanel .products-table-wrap .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
}
.main-content.products-admin-page.bulk-scroll-locked #productsBulkImportPanel > .products-table-wrap > div:last-child {
  margin-top: auto;
}
.main-content.products-admin-page.add-scroll-locked #productsAddPanel .product-editor-split {
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 8px;
  overflow: hidden;
}
.main-content.products-admin-page.add-scroll-locked #productsAddPanel .product-editor-items-card.table-wrap {
  min-height: 0;
  height: 100%;
  align-self: stretch;
  display: flex;
  flex-direction: column;
}
.main-content.products-admin-page.add-scroll-locked #productsAddPanel .product-editor-settings-card {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.main-content.products-admin-page.add-scroll-locked #productsAddPanel .product-editor-settings-card .product-editor-card-body {
  height: calc(100dvh - 218px);
  overflow-y: auto;
  overflow-x: hidden;
}
.main-content.products-admin-page.add-scroll-locked #productsAddPanel .product-editor-items-panel {
  height: calc(100dvh - 218px);
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
}
.main-content.products-admin-page.manage-scroll-locked {
  overflow: hidden;
  padding-bottom: 8px;
}
.main-content.products-admin-page.manage-scroll-locked .products-admin-surface {
  height: 100%;
  min-height: 0;
  grid-template-rows: auto 1fr;
}
.main-content.products-admin-page.manage-scroll-locked #productsManagePanel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.main-content.products-admin-page.manage-scroll-locked #productsManagePanel > div {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}
.main-content.products-admin-page.manage-scroll-locked #productsManagePanel > div > div:last-child {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch !important;
}
.main-content.products-admin-page.manage-scroll-locked #productsManagePanel > div > div:last-child > .table-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-height: none;
}
.main-content.products-admin-page.manage-scroll-locked #productsManagePanel .batch-movement-panel {
  height: 100% !important;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
}
.main-content.products-admin-page.manage-scroll-locked #productsManagePanel .table-wrap {
  overflow: hidden;
}
.products-admin-page .products-table.data-table td {
  background: var(--prod-row);
  color: var(--prod-text);
  border-bottom: 1px solid var(--prod-divider);
  padding: 8px 10px;
  font-size: 0.8667rem;
  line-height: 1.2;
}
.products-admin-page #productsListPanel .products-table.data-table th,
.products-admin-page #productsListPanel .products-table.data-table td {
  padding-left: 7px;
  padding-right: 7px;
}
.products-admin-page #productsListPanel .products-table.data-table th,
.products-admin-page #productsListPanel .products-table.data-table td,
.products-admin-page #productsListPanel .products-table.data-table td * {
  min-width: 0;
}
.products-row-no-cell,
.products-sku-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.products-row-no-cell {
  text-align: center;
  color: var(--prod-text-muted);
  font-weight: 700;
}
.products-sku-cell {
  color: var(--prod-text-muted);
  font-size: 0.82rem;
}
.products-admin-page #productsListPanel .products-actions-col,
.products-admin-page #productsListPanel .products-actions-cell {
  text-align: center;
  padding-right: 14px;
}
.products-admin-page #productsListPanel .product-row-actions {
  justify-content: center;
}
.products-admin-page .products-table.data-table tbody tr:nth-child(even) td { background: var(--prod-row-alt); }
.products-admin-page .products-table.data-table tbody tr:hover td { background: var(--prod-row-hover); }
.products-admin-page .products-table.data-table tbody tr.product-row-selected td {
  background: var(--prod-row-selected);
}
.products-admin-page #productsExpiryPanel .products-table th.expiry-qty-col,
.products-admin-page #productsExpiryPanel .products-table td.expiry-qty-col {
  text-align: center !important;
}
.products-table .products-name-primary {
  font-size: 0.8667rem;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--prod-text);
}
.products-table .products-name-secondary {
  font-size: 0.8667rem;
  color: var(--prod-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.products-category-pill {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  color: var(--text);
}
.products-muted-cell { color: var(--prod-text-muted); }
.products-price-cell,
.products-stock-primary { font-weight: 700; color: var(--prod-text); }
.products-stock-secondary {
  margin-top: 1px;
  font-size: 0.8667rem;
  color: var(--prod-text-muted);
}
.products-stock-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8667rem;
  font-weight: 600;
  color: var(--prod-text-muted);
}
.products-stock-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64748b;
}
.products-stock-status.is-in { color: var(--prod-green); }
.products-stock-status.is-in .products-stock-dot { background: var(--prod-green); }
.products-stock-status.is-low { color: #d8c9a0; }
.products-stock-status.is-low .products-stock-dot { background: #b28d3a; }
.products-stock-status.is-out { color: #e3b0b0; }
.products-stock-status.is-out .products-stock-dot { background: #c05a5a; }
.products-actions-col { width: 64px; }
.products-actions-cell {
  width: 64px;
  text-align: right;
}
.product-row-actions {
  position: relative;
  display: inline-flex;
}
.product-row-menu-trigger {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--prod-text-muted);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.product-row-menu-trigger:hover,
.product-row-menu-trigger[aria-expanded="true"] {
  color: var(--prod-text);
  border-color: var(--prod-divider);
  background: var(--prod-row-hover);
}
.product-row-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 5px);
  min-width: 120px;
  border-radius: 8px;
  border: 1px solid var(--prod-divider);
  background: var(--prod-elev);
  box-shadow: 0 10px 24px rgba(0,0,0,0.32);
  z-index: 30;
  overflow: hidden;
}
.product-row-menu-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--prod-text);
  text-align: left;
  font-size: 0.8667rem;
  font-weight: 600;
  padding: 8px 10px;
}
.product-row-menu-item:hover { background: var(--prod-row-hover); color: var(--primary); }
.past-sale-cell-action:hover { color: var(--primary) !important; background: var(--surface-2); }
a:hover { color: var(--primary); }
.product-row-menu-item.danger { color: #f0a3a3; }
.product-row-menu-item.danger:hover { background: rgba(220,38,38,0.18); }
.products-admin-page .btn-primary {
  background: var(--prod-green);
  border-color: transparent;
}
.products-admin-page .btn-primary:hover { background: #138b68; }
[data-theme="dark"] .products-admin-page .products-table.data-table th {
  background: #202c33;
}
[data-theme="dark"] .products-admin-page .products-table.data-table td {
  background: var(--prod-row);
}
[data-theme="dark"] .products-admin-page #productsPriceListPanel .products-table .price-history-btn:hover {
  color: #bae6fd;
  background: transparent !important;
  box-shadow: none;
}

.price-history-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 280;
}
.price-history-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.price-history-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(640px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  transform: translateX(102%);
  transition: transform 0.24s cubic-bezier(0.22,1,0.36,1);
  z-index: 290;
  display: flex;
  flex-direction: column;
}
.price-history-drawer.open {
  transform: translateX(0);
}
.price-history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
}
.price-history-eyebrow {
  font-size: 0.8667rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.price-history-header h3 {
  margin: 2px 0 2px;
  font-size: 1rem;
}
.price-history-meta {
  font-size: 0.8667rem;
  color: var(--text-muted);
}
.price-history-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 14px 14px;
}
.price-history-table-wrap {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: auto;
}
.price-history-table th,
.price-history-table td {
  white-space: nowrap;
}

@media (max-width: 1220px) {
  .products-control-row { flex-wrap: wrap; }
  .products-control-select { flex: 1 1 260px; max-width: none; min-width: 220px; }
  .products-control-add { margin-left: 0; }
  .products-filter-search { max-width: none; min-width: 220px; }
  .products-filter-row .select { flex: 1 1 150px; min-width: 140px; width: auto; }
  .products-pricelist-bulk {
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
  }
  .products-pricelist-export {
    width: 100%;
    flex-wrap: wrap;
  }
  .products-pricelist-bulk .select,
  .products-pricelist-bulk .input {
    flex: 1 1 120px;
    width: auto;
    min-width: 110px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0; border-radius: 0;
  background: transparent;
  border: none;
  font-size: 0.8667rem; font-weight: 700; white-space: nowrap;
}
.badge-green  { background: transparent; color: #065f46; }
.badge-red    { background: transparent; color: var(--danger); }
.badge-amber  { background: transparent; color: #92400e; }
.badge-blue   { background: transparent; color: var(--info); }
.badge-gray   { background: transparent; color: var(--text-muted); border: none; }
.badge-teal   { background: transparent; color: var(--primary-strong); }
.finance-pnl-margin {
  display: inline;
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-size: 0.8667rem;
  font-weight: 700;
  white-space: nowrap;
}
.finance-pnl-margin.is-positive { color: #065f46; }
.finance-pnl-margin.is-negative { color: var(--danger); }

[data-theme="dark"] .badge-green  { background: transparent; color: #34d399; }
[data-theme="dark"] .badge-amber  { background: transparent; color: #fbbf24; }
[data-theme="dark"] .badge-red    { background: transparent; color: #f87171; }
[data-theme="dark"] .badge-blue   { background: transparent; color: #38bdf8; }
[data-theme="dark"] .badge-gray   { background: transparent; color: var(--text-muted); }
[data-theme="dark"] .badge-teal   { background: transparent; color: var(--primary); }
[data-theme="dark"] .finance-pnl-margin.is-positive { color: #34d399; }
[data-theme="dark"] .finance-pnl-margin.is-negative { color: #f87171; }

/* ═══════════════════════════════════════════════════════════════
   QUOTATION CARDS  (Sales > Quotations full-page list)
   ═══════════════════════════════════════════════════════════════ */
.qp-list-wrap {
  height: calc(100dvh - 300px);
  max-height: calc(100dvh - 300px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px;
}
.qp-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.qp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "head    head"
    "meta    actions";
  column-gap: 16px;
  row-gap: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  position: relative;
  min-width: 0;
}
.qp-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.qp-card-head {
  grid-area: head;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.qp-card-id-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.qp-card-id {
  font-weight: 800;
  font-size: 0.95rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  letter-spacing: 0.2px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qp-card-customer {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 360px;
}
.qp-card-customer::before {
  content: "•";
  margin-right: 6px;
  color: var(--text-muted);
  opacity: 0.6;
}
.qp-card-status { flex-shrink: 0; }
.qp-card-meta {
  grid-area: meta;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 18px;
  min-width: 0;
  align-items: center;
}
.qp-meta-item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.qp-meta-icon {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.qp-meta-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}
.qp-meta-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 2px;
}
.qp-meta-value {
  font-size: 0.86rem;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qp-meta-value--strong { font-weight: 700; }
.qp-meta-value--muted { color: var(--text-muted); font-weight: 500; }
.qp-meta-value--danger { color: var(--danger); font-weight: 600; }
.qp-card-foot {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-top: 4px;
  border-top: 1px dashed var(--border-soft);
}
.qp-card-foot-icon {
  width: 13px; height: 13px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}
.qp-card-foot strong { color: var(--text); font-weight: 600; }
.qp-card-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  align-self: center;
}
.qp-action-label-mobile { display: none; }
.qp-action-danger { color: var(--danger); }
.qp-action-danger:hover {
  background: var(--danger-soft) !important;
  color: var(--danger) !important;
}
.qp-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}
@media (max-width: 720px) {
  .qp-list { gap: 12px; }

  .qp-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    transform: none;
  }
  .qp-card:hover { transform: none; box-shadow: none; }

  .qp-card-head { align-items: center; gap: 10px; }
  .qp-card-id-block { flex: 1 1 auto; min-width: 0; }
  .qp-card-id { font-size: 0.95rem; }
  .qp-card-status { flex: 0 0 auto; }

  .qp-card-customer { max-width: 100%; }

  .qp-card-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px 18px;
    padding: 14px 0;
    border-top: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
  }
  .qp-meta-item { align-items: flex-start; gap: 8px; }
  .qp-meta-label { margin-bottom: 4px; font-size: 0.65rem; }
  .qp-meta-value { font-size: 0.88rem; white-space: normal; }

  .qp-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
  }
  .qp-card-actions .btn {
    min-width: 0;
    min-height: 44px;
    width: 100%;
    justify-content: center;
    white-space: nowrap;
  }
  .qp-action-convert { grid-column: 1 / -1; grid-row: 1; }
  .qp-action-print { grid-column: 1; }
  .qp-action-cancel { grid-column: 2; }

  .qp-card-actions.no-primary-action .qp-action-print { grid-column: 1; }
  .qp-card-actions.no-primary-action .qp-action-cancel { grid-column: 2; }
  .qp-card-actions.no-primary-action .qp-action-print:only-child { grid-column: 1 / -1; }

  .qp-action-label-desktop { display: none; }
  .qp-action-label-mobile { display: inline; }
}

/* ═══════════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(3px);
  display: none; place-items: center; padding: 20px;
  animation: fadeIn 0.2s ease;
}
.modal-backdrop.open { display: grid; }
.modal {
  background: var(--surface); border-radius: var(--r-xl);
  width: 100%; max-height: calc(100dvh - 40px);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  animation: modalIn 0.25s cubic-bezier(0.16,1,0.3,1);
}
.modal-sm  { max-width: 440px; }
.modal-md  { max-width: 580px; }
.modal-lg  { max-width: 720px; }
.modal-xl  { max-width: 900px; }
.dispensing-modal {
  max-width: min(1600px, calc(100vw - 24px)) !important;
  height: min(760px, calc(100dvh - 24px));
  max-height: calc(100dvh - 24px) !important;
}
.dispensing-modal .modal-body { overflow-y: auto; }
.modal-header {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border: none; background: var(--surface-2);
  border-radius: var(--r-sm); color: var(--text-muted);
  display: grid; place-items: center; transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-close svg { width: 16px; height: 16px; }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 22px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  flex-shrink: 0;
}

/* Stock take modal (bulk count layout) */
.stocktake-modal-shell {
  max-width: min(1120px, calc(100vw - var(--sidebar-w) - 56px));
  min-height: min(760px, calc(100dvh - 24px));
  border-radius: var(--r-xl);
}
.stocktake-modal-backdrop {
  padding-left: calc(var(--sidebar-w) + 20px);
}
.stocktake-modal-header {
  border-bottom-color: var(--border);
}
.stocktake-modal-header h3 {
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 800;
}
.stocktake-modal-body {
  padding: 18px 18px 10px;
}
.stocktake-search-wrap {
  margin-bottom: 14px;
}
.stocktake-search-wrap .form-label {
  color: var(--text);
  font-size: 0.8667rem;
  font-weight: 700;
  margin-bottom: 8px;
  display: inline-block;
}
.stocktake-search-input {
  max-width: 520px;
}
.stocktake-grid-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  max-height: min(500px, calc(100dvh - 310px));
  overflow-y: auto;
  background: var(--surface);
}
.stocktake-modal-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: var(--surface);
}
.stocktake-modal-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  color: var(--text-muted);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.8667rem;
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.stocktake-modal-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.8667rem;
  vertical-align: middle;
}
.stocktake-modal-table td,
.stocktake-modal-table th {
  white-space: nowrap;
}
.stocktake-modal-table td:nth-child(1),
.stocktake-modal-table td:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
}
.stocktake-modal-table th:nth-child(1),
.stocktake-modal-table td:nth-child(1) {
  width: 32%;
}
.stocktake-modal-table th:nth-child(2),
.stocktake-modal-table td:nth-child(2) {
  width: 16%;
}
.stocktake-modal-table th:nth-child(3),
.stocktake-modal-table td:nth-child(3) {
  width: 10%;
}
.stocktake-modal-table th:nth-child(4),
.stocktake-modal-table td:nth-child(4) {
  width: 22%;
}
.stocktake-modal-table th:nth-child(5),
.stocktake-modal-table td:nth-child(5) {
  width: 15%;
}
.stocktake-modal-table th:nth-child(2),
.stocktake-modal-table td:nth-child(2) {
  text-align: center;
}
.stocktake-modal-table th:nth-child(3),
.stocktake-modal-table td:nth-child(3) {
  text-align: center;
}
.stocktake-modal-table th:nth-child(4),
.stocktake-modal-table td:nth-child(4) {
  text-align: center;
}
.stocktake-modal-table th:nth-child(4) {
  padding-left: 0;
  padding-right: 0;
}
.stocktake-modal-table td:nth-child(4),
.stocktake-modal-table td.stocktake-count-cell {
  padding-left: 14px !important;
  padding-right: 14px !important;
}
.stocktake-modal-table th:nth-child(5),
.stocktake-modal-table td:nth-child(5) {
  text-align: right;
}
.stocktake-modal-table tbody tr:hover {
  background: var(--surface-2);
}
.stocktake-modal-table tbody tr:last-child td {
  border-bottom: none;
}
.stocktake-count-input {
  display: block;
  width: clamp(125px, 60%, 170px) !important;
  min-width: 125px !important;
  max-width: 170px !important;
  margin-inline: auto !important;
  min-height: 36px;
  padding: 6px 10px;
  box-sizing: border-box;
}
.stocktake-modal-table td:nth-child(4) .stocktake-count-input {
  box-sizing: border-box;
  width: clamp(125px, 60%, 170px) !important;
  min-width: 125px !important;
  max-width: 170px !important;
  margin: 0 auto !important;
}
.stocktake-var-positive { color: var(--success); font-weight: 700; }
.stocktake-var-negative { color: var(--danger); font-weight: 700; }
.stocktake-var-neutral  { color: var(--text-muted); font-weight: 700; }
.stocktake-empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 22px 12px;
}
.stocktake-modal-footer {
  border-top-color: var(--border);
  justify-content: flex-end;
  padding: 14px 16px 16px;
}
.stocktake-apply-btn {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 3px 12px rgba(13,122,107,0.35);
}
.stocktake-apply-btn:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}
.stocktake-close-btn {
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.stocktake-close-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ═══════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════ */
.toast-stack {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column-reverse; gap: 8px;
  z-index: 600; pointer-events: none;
  width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  background: #1e293b; color: #f1f5f9;
  padding: 11px 18px; border-radius: 99px;
  font-size: 0.8667rem; font-weight: 600;
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  opacity: 0; transform: translateY(12px);
  transition: opacity 0.22s, transform 0.22s;
  box-shadow: var(--shadow-md);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); }
[data-theme="dark"] .toast { background: #1e293b; }

/* ═══════════════════════════════════════════════════════════════
   SEARCH
   ═══════════════════════════════════════════════════════════════ */
.search-wrap { position: relative; }
.search-wrap .input { padding-left: 36px; }
.search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-dim); pointer-events: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
}

/* Dark mode — stronger hint visibility */
[data-theme="dark"] .input::placeholder,
[data-theme="dark"] .textarea::placeholder,
[data-theme="dark"] .dashboard-global-search-input::placeholder {
  color: #a9b9cd;
  opacity: 1;
}
[data-theme="dark"] .search-icon,
[data-theme="dark"] .dashboard-global-search-icon,
[data-theme="dark"] .dashboard-global-search-clear {
  color: #93a7c3;
}

/* ═══════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════ */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; text-align: center; gap: 12px;
}
.empty-state-icon {
  width: 56px; height: 56px; border-radius: var(--r-lg);
  background: var(--surface-2); color: var(--text-dim);
  display: grid; place-items: center; margin-bottom: 4px;
}
.empty-state-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.empty-state h3 { font-size: 1rem; font-weight: 700; }
.empty-state p { color: var(--text-muted); font-size: 0.8667rem; max-width: 320px; }
.main-content .empty-state:not(.basket-empty-state),
.main-content .table-wrap + .empty-state,
.main-content section > .empty-state {
  display: none !important;
}
/* POS's "No products yet" / "No drugs found" states are the primary content
   of the results panel (not a redundant fallback next to a table), so they
   need to stay visible — otherwise an empty catalogue shows a blank panel. */
.main-content .pos-results .empty-state,
.main-content .drug-results-body .empty-state {
  display: flex !important;
}

/* ═══════════════════════════════════════════════════════════════
   POS — POINT OF SALE
   ═══════════════════════════════════════════════════════════════ */
.main-content.pos-page {
  padding-bottom: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.main-content:has(.pos-layout) {
  --pos-btn-compact: 28px;
  --pos-btn-row: 32px;
  --pos-btn-filter: 28px;
  --pos-btn-toolbar: 40px;
  --pos-btn-primary: 48px;
  padding-top: 12px;
}
.main-content:has(.pos-layout) .page-header {
  margin-bottom: 6px;
}
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  height: calc(100dvh - 60px);
  overflow: hidden;
}
.basket-popup-backdrop {
  display: none;
}
.pos-left {
  display: flex; flex-direction: column; gap: 10px;
  overflow: hidden;
}
.pos-search-bar {
  display: flex; gap: 10px; flex-shrink: 0;
}
.pos-search-bar .input-icon-wrap { flex: 1; }
.pos-search-wrap .input {
  padding-right: 42px;
}
.pos-search-clear {
  position: absolute;
  right: 9px;
  top: 50%;
  width: 28px;
  height: 28px;
  transform: translateY(-50%);
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  display: inline-grid;
  place-items: center;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.pos-search-clear:hover,
.pos-search-clear:focus-visible {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--danger);
  outline: none;
}
.pos-search-clear[hidden] {
  display: none;
}
.pos-search-bar .btn {
  min-height: var(--pos-btn-toolbar);
  height: var(--pos-btn-toolbar);
  border-radius: var(--r-md);
  font-weight: 800;
}
#posBulkAddBtn {
  border-color: rgba(2, 132, 199, 0.22);
  background: color-mix(in srgb, var(--info) 9%, var(--surface));
  color: var(--info);
  box-shadow: none;
}
#posBulkAddBtn:hover {
  border-color: rgba(2, 132, 199, 0.38);
  background: color-mix(in srgb, var(--info) 14%, var(--surface));
}
#posSearchInput:focus {
  box-shadow: none;
  border-color: var(--primary);
  background: var(--surface);
}
.pos-category-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: visible;
  padding: 0 0 2px;
  flex-shrink: 0;
  scrollbar-width: none;
}
.pos-category-strip::-webkit-scrollbar { display: none; }
.pos-category-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--pos-btn-filter);
  height: var(--pos-btn-filter);
  padding: 4px 12px;
  max-width: 180px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: #28456f;
  font-size: 0.8667rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.14s, border-color 0.14s, color 0.14s, box-shadow 0.14s;
}
.pos-category-chip:hover {
  border-color: rgba(37, 99, 235, 0.35);
  background: #eef5ff;
  color: var(--primary);
}
.pos-category-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.14);
}
.pos-category-more {
  position: relative;
}
.pos-category-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pos-category-more-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pos-category-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  max-height: 220px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  z-index: 90;
  display: none;
}
.pos-category-menu::-webkit-scrollbar {
  width: 8px;
}
.pos-category-menu::-webkit-scrollbar-track {
  background: transparent;
}
.pos-category-menu::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.55);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.pos-category-more.open .pos-category-menu {
  display: grid;
  gap: 4px;
}
.pos-category-menu-item {
  width: 100%;
  min-height: var(--pos-btn-filter);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: #28456f;
  cursor: pointer;
  font-size: 0.8667rem;
  font-weight: 700;
  padding: 4px 10px;
  text-align: left;
}
.pos-category-menu-item:hover,
.pos-category-menu-item.active {
  background: #eef5ff;
  color: var(--primary);
}
.pos-results {
  --pos-scrollbar-w: 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--card-radius);
  background: var(--surface);
  box-shadow: inset 0 -1px 0 var(--border);
}

.drug-results-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  border-top: 1px solid var(--border-soft);
  scrollbar-gutter: auto;
  scrollbar-color: var(--border) var(--surface-2);
}
.drug-results-body::-webkit-scrollbar {
  width: 10px;
  height: 0;
}
.drug-results-body::-webkit-scrollbar-track {
  background: var(--surface-2);
  margin: 10px 0;
  border-radius: 999px;
}
.drug-results-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.drug-results-body::-webkit-scrollbar-button {
  width: 0;
  height: 0;
  display: none;
}
.drug-results-body::-webkit-scrollbar-corner {
  background: transparent;
}
.drug-results-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 122px 92px;
  align-items: center;
  gap: 8px;
  padding: 8px calc(12px + var(--pos-scrollbar-w)) 8px 12px;
  border-bottom: 2px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.8667rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.1;
  text-transform: uppercase;
  flex-shrink: 0;
}
.drug-results-head span:nth-child(2) { text-align: center; }
.drug-results-head span:nth-child(3) { text-align: right; }
.drug-results-head span:nth-child(4) { text-align: center; }
.drug-result-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 122px 92px;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
  cursor: pointer; transition: background 0.14s, border-color 0.14s;
}
.drug-result-item:last-child { border-bottom: none; }
.drug-result-item:hover { background: color-mix(in srgb, var(--info) 5%, var(--surface)); }
.drug-result-item:hover .drug-result-name { color: var(--primary); }
.drug-result-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.drug-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f8fcff;
  border: 1px solid rgba(8, 174, 210, 0.42);
  color: #07a7cc;
  display: grid; place-items: center; flex-shrink: 0;
  font-family: Georgia, serif;
  font-size: 1.16rem;
  font-style: italic;
  font-weight: 900;
}
.drug-icon svg { display: none; }
.drug-icon::before {
  content: "i";
  transform: translateY(-1px);
}
.drug-result-info { flex: 1; min-width: 0; }
.drug-result-name { font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drug-result-sub { font-size: 0.82rem; color: var(--text-muted); margin-top: 0; }
.drug-result-qty-wrap { text-align: left; justify-self: center; min-width: 0; }
.drug-result-qty {
  font-weight: 400;
  font-size: 0.8667rem;
  color: var(--text);
  line-height: 1.05;
}
.drug-result-price { font-weight: 400; font-size: 0.8667rem; color: var(--text); text-align: right; }
.drug-result-stock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  font-size: 0.78rem;
  font-weight: 800;
  margin-top: 0;
  white-space: nowrap;
}
.stock-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  flex: 0 0 auto;
}
.drug-result-action {
  display: flex;
  align-self: stretch;
  width: 100%;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  cursor: pointer;
  user-select: none;
}
.drug-quick-add {
  min-width: 76px;
  height: var(--pos-btn-row);
  border: 1px solid rgba(37, 99, 235, 0.32);
  border-radius: 8px;
  background: #fff;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
  font-size: 0.8667rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, color 0.14s, transform 0.14s;
  position: relative;
  user-select: none;
}
.drug-quick-add:hover {
  /* hover effect disabled */
}
}
.drug-quick-add span {
  font-size: 1.05rem;
  line-height: 1;
}
.drug-quick-add-label {
  min-width: 24px;
  font-size: 0.8667rem !important;
  line-height: 1;
}
.drug-quick-add:hover .drug-quick-add-label {
  /* hover label disabled */
}
.drug-quick-add:hover .drug-quick-add-label::before {
  /* hover label disabled */
}
.drug-quick-add:focus-visible {
  outline: 2px solid rgba(4,122,61,0.35);
  outline-offset: 2px;
}
.drug-quick-add svg { width: 17px; height: 17px; display: block; }
.pos-page .drug-results-body.is-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: 12px;
  align-content: start;
  align-items: stretch;
  padding: 12px;
}
.pos-page .drug-results-body.is-grid .drug-result-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  min-height: 240px;
  height: 100%;
  padding: 16px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}
.pos-page .drug-results-body.is-grid .drug-result-item:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.08);
  transform: translateY(-1px);
}
.pos-page .drug-results-body.is-grid .drug-result-main {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-width: 0;
}
.pos-page .drug-results-body.is-grid .drug-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #edf8fb;
  border-color: rgba(8, 174, 210, 0.22);
  font-size: 0.94rem;
  flex: 0 0 auto;
}
.pos-page .drug-results-body.is-grid .drug-result-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pos-page .drug-results-body.is-grid .drug-result-name {
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.35;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
.pos-page .drug-results-body.is-grid .drug-result-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
  white-space: normal;
  margin-top: 0;
}
.pos-page .drug-results-body.is-grid .drug-result-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-top: 2px;
}
.pos-page .drug-results-body.is-grid .drug-result-stock {
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.pos-page .drug-results-body.is-grid .drug-result-price {
  margin-left: auto;
  text-align: right;
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}
.pos-page .drug-results-body.is-grid .drug-result-separator {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  flex: 0 0 auto;
}
.pos-page .drug-results-body.is-grid .drug-result-action {
  margin-top: auto;
  min-height: 0;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  align-self: stretch;
  justify-content: stretch;
  width: 100%;
}
.pos-page .drug-results-body.is-grid .drug-quick-add {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 1px solid color-mix(in srgb, var(--primary) 32%, var(--border));
  border-radius: 10px;
  background: #fff;
  color: #426ad9;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  box-shadow: none;
}
.pos-page .drug-results-body.is-grid .drug-quick-add:hover {
  /* hover effect disabled */
}
.pos-page .drug-results-body.is-grid .drug-quick-add-label {
  min-width: 0;
}
.drug-info-popover {
  position: absolute;
  z-index: 410;
  width: 620px;
  max-width: min(620px, calc(100vw - 20px));
  max-height: min(76vh, 520px);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  padding: 14px 16px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.drug-info-popover.hidden { display: none; }
.drug-info-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 8px;
}
.drug-info-headrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.drug-info-head {
  font-size: 0.7333rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #5b7aa2;
}
.drug-info-title {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.3;
}
.drug-info-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 0.8667rem;
  color: var(--text-muted);
  font-weight: 600;
}
.drug-info-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.7333rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.drug-info-badge.verified {
  background: rgba(5, 150, 105, 0.1);
  color: #047857;
  border-color: rgba(5, 150, 105, 0.18);
}
.drug-info-badge.fallback {
  background: rgba(2, 132, 199, 0.1);
  color: #0369a1;
  border-color: rgba(2, 132, 199, 0.16);
}
.drug-info-badge.pending,
.drug-info-badge.loading {
  background: rgba(100, 116, 139, 0.12);
  color: #475569;
  border-color: rgba(148, 163, 184, 0.18);
}
.drug-info-columns {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 12px;
}
.drug-info-panel {
  min-width: 0;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 88%, var(--surface-2));
  padding: 12px;
}
.drug-info-panel-title {
  font-size: 0.7333rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #5b7aa2;
  margin-bottom: 10px;
}
.drug-info-panel-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.drug-info-subsection {
  font-size: 0.7333rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.drug-info-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}
.drug-info-list li,
.drug-info-note,
.drug-info-empty {
  font-size: 0.8333rem;
  line-height: 1.45;
  color: var(--text);
}
.drug-info-empty {
  color: var(--text-muted);
}
.drug-info-footer {
  border-top: 1px solid var(--border-soft);
  padding-top: 10px;
  display: grid;
  gap: 4px;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-muted);
}
.drug-info-grid {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  row-gap: 8px;
  column-gap: 8px;
}
.drug-info-content {
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}
.drug-info-content::-webkit-scrollbar { width: 8px; }
.drug-info-content::-webkit-scrollbar-track { background: transparent; }
.drug-info-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.drug-info-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.drug-info-value {
  font-size: 0.8333rem;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  line-height: 1.35;
}
.drug-info-dose {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drug-info-loading {
  font-size: 0.8333rem;
  color: var(--text-muted);
  font-weight: 600;
  padding: 6px 0 2px;
}
.drug-info-source {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
}
.drug-info-source:hover { text-decoration: underline; }
.drug-info-source.muted { color: var(--text-muted); pointer-events: none; }
.drug-info-value.muted { color: var(--text-muted); }
.stock-ok   { color: var(--success); }
.stock-low  { color: var(--warning); }
.stock-out  { color: var(--danger); }

@media (max-width: 720px) {
  .drug-info-popover {
    width: min(520px, calc(100vw - 16px));
    max-height: min(70vh, calc(100vh - 20px));
    padding: 12px;
  }
  .drug-info-columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ─── Compact Basket Rows ─────────────────────────────────────── */
.basket-row {
  border-bottom: 1px solid var(--border-soft);
  transition: background 0.14s;
}
.basket-row:hover { background: var(--surface-2); }
.basket-row:last-child { border-bottom: none; }

.basket-header {
  display: grid;
  grid-template-columns: minmax(0, 2.5fr) 80px 90px 90px auto;
  gap: 8px;
  padding: 5px 12px;
  align-items: center;
  background: var(--surface-2);
  border-bottom: 2px solid var(--border);
  font-size: 0.8667rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  position: sticky;
  top: 0;
  z-index: 1;
}
.basket-header span:nth-child(1) { text-align: left; }
.basket-header span:nth-child(2) { text-align: center; }
.basket-header span:nth-child(3),
.basket-header span:nth-child(4) { text-align: right; }

.basket-row-main {
  display: grid;
  grid-template-columns: minmax(0, 3fr) 70px 80px 80px auto;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
}

.basket-row-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
}
.basket-row-name {
  font-weight: 700;
  font-size: 0.8667rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.basket-row-strength {
  font-weight: 400;
  color: var(--text-muted);
}
.basket-row-instructions {
  font-size: 0.8667rem;
  color: var(--info);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
  line-height: 1.2;
}

.basket-row-main .qty-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  justify-self: center;
}
.basket-row-main .qty-btn {
  width: 22px;
  height: 22px;
  font-size: 0.8667rem;
  border: none;
  background: var(--surface-2);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  transition: background 0.14s, color 0.14s;
  cursor: pointer;
  padding: 0;
}
.basket-row-main .qty-btn:hover { background: var(--primary-soft); color: var(--primary); }
.basket-row-main .qty-display {
  width: 26px;
  text-align: center;
  font-size: 0.8667rem;
  font-weight: 700;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 0;
}

.basket-row-unit {
  font-size: 0.8667rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: right;
}
.basket-row-total {
  font-weight: 800;
  font-size: 0.8667rem;
  white-space: nowrap;
  text-align: right;
}
.basket-row-actions {
  display: flex;
  gap: 2px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.basket-row-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
}
.basket-row-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.basket-row-name {
  font-weight: 700;
  font-size: 0.8667rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.basket-row-instructions {
  font-size: 0.8667rem;
  color: var(--info);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}
.basket-row-total {
  font-weight: 800;
  font-size: 0.8667rem;
  white-space: nowrap;
  min-width: 72px;
  text-align: right;
}
.basket-header {
  display: grid;
  grid-template-columns: minmax(0, 3fr) 70px 80px 80px auto;
  gap: 8px;
  padding: 5px 12px;
  align-items: center;
  background: var(--surface-2);
  border-bottom: 2px solid var(--border);
  font-size: 0.8667rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  position: sticky;
  top: 0;
  z-index: 1;
}
.basket-row-main .qty-control {
  border-width: 1px;
  min-width: 92px;
  height: 34px;
}
.basket-row-main .qty-btn {
  width: 26px;
  height: 30px;
  font-size: 0.9rem;
}
.basket-row-main .qty-display {
  width: 40px;
  height: 30px;
  font-size: 0.9rem;
}

.basket-row-price { font-size: 0.8667rem; color: var(--text-muted); white-space: nowrap; text-align: right; }
.basket-price-input { background: transparent; border-color: var(--border-soft); width: 80px; min-height: 34px; padding: 3px 6px; font-size: 0.8667rem; text-align: right; }
.basket-price-input:focus { background: var(--surface); border-color: var(--primary); }
.basket-qty-input::-webkit-outer-spin-button,
.basket-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.basket-qty-input { -moz-appearance: textfield; }
.bulk-search-item:hover { background: var(--surface-2); }
.bulk-add-row:hover { background: var(--surface-2); }
.bulk-add-header span:nth-child(2),
.bulk-add-header span:nth-child(3),
.bulk-add-header span:nth-child(4) { text-align: center; }
.pos-right {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--card-radius); box-shadow: var(--shadow-sm), inset 0 -1px 0 var(--border); overflow: hidden;
}
.basket-header {
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.basket-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.basket-header .pos-basket-action {
  min-height: var(--pos-btn-row);
  height: var(--pos-btn-row);
  border-radius: var(--r-md);
  border-color: var(--border);
  color: #1f3760;
  background: #fff;
  font-weight: 800;
}
.basket-header .pos-basket-action:hover {
  border-color: rgba(37, 99, 235, 0.35);
  background: #eef5ff;
  color: var(--primary);
}
.basket-header .pos-basket-action.danger {
  color: var(--danger);
}
.basket-header .pos-basket-action.danger:hover {
  border-color: rgba(220, 38, 38, 0.22);
  background: var(--danger-soft);
  color: var(--danger-strong);
}
.basket-header > div:first-child,
.basket-header > div:last-child {
  display: flex;
  align-items: center;
}
.basket-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.basket-header .btn.btn-sm:not(.pos-basket-action) { height: 28px; padding-top: 0; padding-bottom: 0; }
.basket-count {
  background: var(--primary); color: white;
  border-radius: 99px; font-size: 0.8667rem; font-weight: 700;
  padding: 2px 7px; margin-left: 0;
}
.basket-items {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.basket-items-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: auto;
  scrollbar-color: var(--border) var(--surface-2);
}
.basket-items-body::-webkit-scrollbar {
  width: 10px;
  height: 0;
}
.basket-items-body::-webkit-scrollbar-track {
  background: var(--surface-2);
  margin: 10px 0;
  border-radius: 999px;
}
.basket-items-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.basket-items-body::-webkit-scrollbar-button {
  width: 0;
  height: 0;
  display: none;
}
.basket-items-body::-webkit-scrollbar-corner {
  background: transparent;
}
.basket-item {
  padding: 12px 16px; border-bottom: 1px solid var(--border-soft);
  animation: slideUp 0.18s ease;
}
.basket-item-name { font-weight: 700; font-size: 0.8667rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.basket-item-sub { font-size: 0.8667rem; color: var(--text-muted); margin-top: 1px; }
.basket-item-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 8px; }
.qty-control { display: flex; align-items: center; gap: 0; border: 1.5px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.qty-btn {
  width: var(--pos-btn-compact); height: var(--pos-btn-compact); border: none; background: var(--surface-2);
  color: var(--text-muted); font-size: 1rem;
  display: grid; place-items: center; transition: background 0.14s, color 0.14s;
}
.qty-btn:hover { background: var(--primary-soft); color: var(--primary); }
.qty-display { width: 36px; text-align: center; font-size: 0.8667rem; font-weight: 400; background: transparent; border: none; color: var(--text); }
.basket-item-price { font-weight: 400; font-size: 1rem; }
.basket-item-remove { width: var(--pos-btn-compact); height: var(--pos-btn-compact); color: var(--danger); background: none; border: none; padding: 4px; border-radius: var(--r-sm); transition: color 0.14s, background 0.14s; position: relative; }
.basket-item-remove:hover { color: var(--danger-strong); background: var(--danger-soft); }
.basket-item-remove svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.basket-item-remove::after { content: attr(data-tip); position: absolute; top: calc(100% + 4px); left: 50%; transform: translateX(-50%); background: #1e293b; color: #f1f5f9; font-size: 0.8667rem; font-weight: 600; padding: 3px 8px; border-radius: 4px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.1s; z-index: 100; }
.basket-item-remove:hover::after { opacity: 1; }
.basket-item-edit { width: var(--pos-btn-compact); height: var(--pos-btn-compact); color: var(--info); background: none; border: none; padding: 4px; border-radius: var(--r-sm); transition: color 0.14s, background 0.14s; cursor: pointer; position: relative; }
.basket-item-edit:hover { color: var(--info); background: var(--info-soft); }
.basket-item-edit svg { width: 14px; height: 14px; display: block; }
.basket-item-edit::after { content: attr(data-tip); position: absolute; top: calc(100% + 4px); left: 50%; transform: translateX(-50%); background: #1e293b; color: #f1f5f9; font-size: 0.8667rem; font-weight: 600; padding: 3px 8px; border-radius: 4px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.1s; z-index: 100; }
.basket-item-edit:hover::after { opacity: 1; }
.basket-item-dispense { width: var(--pos-btn-compact); height: var(--pos-btn-compact); color: var(--success); background: none; border: none; padding: 4px; border-radius: var(--r-sm); transition: color 0.14s, background 0.14s; cursor: pointer; position: relative; }
.basket-item-dispense:hover { color: var(--success); background: var(--success-soft); }
.basket-item-dispense svg { width: 14px; height: 14px; display: block; }
.basket-item-dispense::after { content: attr(data-tip); position: absolute; top: calc(100% + 4px); left: 50%; transform: translateX(-50%); background: #1e293b; color: #f1f5f9; font-size: 0.8667rem; font-weight: 600; padding: 3px 8px; border-radius: 4px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.1s; z-index: 100; }
.basket-item-dispense:hover::after { opacity: 1; }
.basket-instructions { font-size: 0.8667rem; color: var(--primary); margin-top: 4px; font-style: italic; }

/* Global in-app hint style (instant, basket-like) */
.app-hint { position: relative; }
.app-hint::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #f1f5f9;
  font-size: 0.7333rem;
  font-weight: 500;
  line-height: 1.15;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.08s linear;
  z-index: 1200;
}
.app-hint:hover::after,
.app-hint:focus-visible::after {
  opacity: 1;
  visibility: visible;
}


.basket-footer {
  padding: 14px 16px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.basket-summary {
  display: grid;
  gap: 8px;
  padding: 2px 0 10px;
  margin-bottom: 10px;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  border-radius: 0;
  background: transparent;
}
.basket-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8667rem;
  color: #314766;
}
.basket-summary-row strong {
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
}
.basket-total-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.basket-total-label { font-size: 1rem; color: var(--text); font-weight: 800; }
.basket-total-value { font-size: 1.55rem; font-weight: 900; color: var(--primary); letter-spacing: -0.02em; }
.basket-actions { display: flex; flex-direction: column; gap: 8px; }
.basket-actions .btn-lg {
  min-height: var(--pos-btn-primary);
  height: var(--pos-btn-primary);
  border-radius: var(--r-md);
  font-weight: 900;
}
.basket-actions .btn-lg:disabled {
  opacity: 0.55;
  filter: saturate(0.65);
  cursor: not-allowed;
}

/* Retail checkout mode: scoped to New Sale so the rest of Sales keeps its standard workspace. */
body.retail-pos-mode .main-content.pos-page {
  padding: 8px 12px 12px;
}
body.retail-pos-mode .desktop-sidebar {
  transition: width 380ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 380ms cubic-bezier(0.22, 1, 0.36, 1);
}
body.retail-pos-mode .desktop-sidebar .sidebar-app-brand-name,
body.retail-pos-mode .desktop-sidebar .sidebar-tenant-name,
body.retail-pos-mode .desktop-sidebar .sidebar-brand-text,
body.retail-pos-mode .desktop-sidebar .nav-btn > span:not(.nav-badge),
body.retail-pos-mode .desktop-sidebar .nav-group-toggle,
body.retail-pos-mode .desktop-sidebar .sidebar-footer-btn > span:not(.sync-dot) {
  display: block;
  min-width: 0;
  max-width: 180px;
  opacity: 1;
  transform: translateX(0);
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 260ms cubic-bezier(0.22, 1, 0.36, 1), opacity 150ms ease, transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}
body.retail-pos-mode .desktop-sidebar.is-collapsed .sidebar-app-brand-name,
body.retail-pos-mode .desktop-sidebar.is-collapsed .sidebar-tenant-name,
body.retail-pos-mode .desktop-sidebar.is-collapsed .sidebar-brand-text,
body.retail-pos-mode .desktop-sidebar.is-collapsed .nav-btn > span:not(.nav-badge),
body.retail-pos-mode .desktop-sidebar.is-collapsed .nav-group-toggle,
body.retail-pos-mode .desktop-sidebar.is-collapsed .sidebar-footer-btn > span:not(.sync-dot) {
  display: block;
  max-width: 0;
  opacity: 0;
  transform: translateX(-6px);
  pointer-events: none;
}
body.retail-pos-mode .pos-layout {
  grid-template-columns: minmax(0, 1.3fr) minmax(390px, 0.92fr);
  gap: 12px;
  height: auto;
  min-height: 0;
}
body.retail-pos-mode .pos-left {
  gap: 8px;
}
body.retail-pos-mode .pos-search-bar {
  gap: 8px;
}
body.retail-pos-mode .pos-search-bar .input,
body.retail-pos-mode .pos-search-bar .btn {
  min-height: 44px;
  height: 44px;
}
body.retail-pos-mode #posSearchInput {
  font-size: 1rem;
  font-weight: 600;
}
body.retail-pos-mode .pos-category-strip {
  gap: 7px;
  flex-wrap: wrap;
}
body.retail-pos-mode .pos-category-chip {
  min-height: 34px;
  height: 34px;
  font-size: 0.92rem;
}
body.retail-pos-mode .drug-result-item {
  min-height: 62px;
  padding-top: 8px;
  padding-bottom: 8px;
}
body.retail-pos-mode .drug-result-name { font-size: 0.98rem; }
body.retail-pos-mode .drug-result-sub { font-size: 0.86rem; }
body.retail-pos-mode .drug-result-stock { font-size: 0.84rem; }
body.retail-pos-mode .drug-result-price { font-size: 0.96rem; font-weight: 800; }
body.retail-pos-mode .basket-item-name { font-size: 0.95rem; }
body.retail-pos-mode .basket-item-sub,
body.retail-pos-mode .basket-summary-row { font-size: 0.9rem; }
.pos-page .pos-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}
.pos-page .pos-view-toggle-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: calc(var(--r-md) - 3px);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.pos-page .pos-view-toggle-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pos-page .pos-view-toggle-btn:hover { color: var(--primary); background: var(--primary-soft); }
.pos-page .pos-view-toggle-btn.active { color: #fff; background: var(--primary); }
  body.retail-pos-mode .drug-quick-add {
    min-width: 82px;
    min-height: 36px;
  height: 36px;
  font-weight: 800;
}
body.retail-pos-mode .pos-right {
  border-color: color-mix(in srgb, var(--primary) 22%, var(--border));
  box-shadow: var(--shadow-sm), inset 0 -1px 0 var(--border);
}
body.retail-pos-mode .basket-header {
  min-height: 54px;
  padding: 9px 14px;
}
body.retail-pos-mode .basket-footer {
  padding: 14px 16px 16px;
  background: color-mix(in srgb, var(--surface) 94%, var(--primary-soft));
}
body.retail-pos-mode .basket-total-value {
  font-size: 1.7rem;
}
body.retail-pos-mode .basket-actions .btn-lg {
  min-height: 52px;
  height: 52px;
  font-size: 1rem;
}
@media (max-width: 1040px) {
  body.retail-pos-mode .pos-layout { grid-template-columns: minmax(0, 1fr) minmax(350px, 0.86fr); }
}
@media (max-width: 767px) {
  body.retail-pos-mode .pos-layout { grid-template-columns: 1fr; }
  .pos-page .pos-view-toggle { display: none; }
}
.basket-empty-state,
.basket-items > .empty-state {
  min-height: 180px;
  padding: 28px 18px !important;
}
.basket-empty-state .empty-state-icon,
.basket-items > .empty-state .empty-state-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 10px;
}
.basket-empty-state p,
.basket-items > .empty-state p {
  margin: 0;
  font-weight: 800;
  color: var(--text);
}
.basket-empty-state small,
.basket-items > .empty-state small {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 0.86rem;
}
.basket-grid-head {
  background: color-mix(in srgb, var(--surface-2) 82%, var(--surface)) !important;
  border-bottom: 1px solid var(--border) !important;
}

[data-theme="dark"] .pos-category-chip {
  background: #252525;
  border-color: #484848;
  color: #cbd5e1;
}
[data-theme="dark"] .pos-category-chip:hover {
  background: #1f3340;
  border-color: rgba(56, 189, 248, 0.38);
  color: #7dd3fc;
}
[data-theme="dark"] .pos-category-chip.active {
  background: #38bdf8;
  border-color: #38bdf8;
  color: #07111f;
  box-shadow: none;
}
[data-theme="dark"] .pos-search-clear:hover,
[data-theme="dark"] .pos-search-clear:focus-visible {
  background: #252525;
  border-color: #484848;
  color: #f87171;
}
[data-theme="dark"] #posBulkAddBtn {
  background: #1f3340;
  border-color: rgba(56, 189, 248, 0.38);
  color: #7dd3fc;
}
[data-theme="dark"] #posBulkAddBtn:hover {
  background: #243b49;
  border-color: #38bdf8;
}
[data-theme="dark"] .pos-category-menu {
  background: #252525;
  border-color: #484848;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
}
[data-theme="dark"] .pos-category-menu-item {
  color: #d7e2f0;
}
[data-theme="dark"] .pos-category-menu-item:hover,
[data-theme="dark"] .pos-category-menu-item.active {
  background: #1f3340;
  color: #7dd3fc;
}
[data-theme="dark"] .pos-category-menu::-webkit-scrollbar-thumb {
  background: rgba(125, 211, 252, 0.55);
  border-color: transparent;
  background-clip: content-box;
}
[data-theme="dark"] .drug-icon {
  background: #202b31;
  border-color: #38bdf8;
  color: #38bdf8;
}
[data-theme="dark"] .drug-quick-add {
  background: #252525;
  border-color: rgba(56, 189, 248, 0.42);
  color: #38bdf8;
}
[data-theme="dark"] .drug-quick-add:hover {
  /* hover effect disabled */
}
[data-theme="dark"] .basket-header .pos-basket-action {
  background: #252525;
  border-color: #484848;
  color: #e2e8f0;
}
[data-theme="dark"] .basket-header .pos-basket-action:hover {
  background: #1f3340;
  border-color: rgba(56, 189, 248, 0.38);
  color: #7dd3fc;
}
[data-theme="dark"] .basket-header .pos-basket-action.danger {
  color: #f87171;
}
[data-theme="dark"] .basket-header .pos-basket-action.danger:hover {
  background: #2a0a0a;
  border-color: rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}
[data-theme="dark"] .basket-summary {
  background: #252525;
  border-color: #484848;
}
[data-theme="dark"] .basket-summary-row {
  color: #cbd5e1;
}
[data-theme="dark"] .basket-summary-row strong {
  color: #e2e8f0;
}
[data-theme="dark"] .main-content:has(.pos-layout) .btn-primary {
  color: #07111f;
}

/* Dispensing modal */
.dispensing-option-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.dispensing-chip {
  padding: 6px 12px; border-radius: 99px; font-size: 0.8667rem; font-weight: 600;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; transition: all 0.15s;
}
.dispensing-chip:hover { border-color: var(--primary); color: var(--primary); }
.dispensing-chip.selected { background: var(--primary); border-color: var(--primary); color: white; }
.dispensing-table {
  width: 100%;
  margin-bottom: 14px;
  table-layout: fixed;
  border-collapse: collapse;
  border: 1px solid var(--border);
}
.dispensing-table th {
  border: 1px solid rgba(255,255,255,.35);
  padding: 6px 8px;
  background: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
}
.dispensing-table th:nth-child(2),
.dispensing-table td:nth-child(2) { text-align: left; }
.dispensing-table td {
  border: 1px solid var(--border-soft);
  padding: 2px 8px;
  vertical-align: middle;
}
.dispensing-input {
  border: none;
  border-bottom: 1px dashed var(--border);
  border-radius: 0;
  background: transparent;
  font-size: 0.82rem;
  text-align: center;
  padding: 3px 6px;
  margin-top: 0;
  transform: translateY(6px);
  outline: none;
  color: var(--text);
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.16s, background 0.16s;
}
.dispensing-input:focus { border-bottom: 1px solid var(--primary); background: var(--surface-2); }
.dispensing-input[type="number"] { -moz-appearance: textfield; }
.dispensing-input[type="number"]::-webkit-inner-spin-button,
.dispensing-input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.dispensing-timing-cell {
  position: relative;
  z-index: 2;
  overflow: visible;
  white-space: nowrap;
}
.dispensing-timing-cell.dropdown-open { z-index: 90; }
.dispensing-timing-cell .dispensing-input {
  min-height: 42px;
  padding: 0 32px 0 10px;
  transform: none;
  text-align: left;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--surface-2);
}
.dispensing-timing-cell:hover .dispensing-input,
.dispensing-timing-cell.dropdown-open .dispensing-input {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 10%, transparent);
}
.dispensing-timing-cell.timing-disabled .dispensing-input {
  cursor: not-allowed;
  color: var(--text-muted);
  border-color: transparent;
  background: var(--surface-2);
  box-shadow: none;
}
.dispensing-chevron {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  line-height: 1;
  transition: transform 0.18s ease, color 0.18s ease;
}
.dispensing-timing-clear {
  position: absolute;
  right: 30px;
  top: 50%;
  width: 20px;
  height: 20px;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
.dispensing-timing-clear:hover,
.dispensing-timing-clear:focus-visible { background: var(--surface-2); color: var(--danger); outline: none; }
.dispensing-timing-clear.hidden { display: none; }
.dispensing-timing-cell.dropdown-open .dispensing-chevron {
  color: var(--primary);
  transform: translateY(-50%) rotate(180deg);
}
.dispensing-dropdown {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  min-width: 190px;
  width: max-content;
  max-width: 240px;
  max-height: 280px;
  padding: 6px;
  z-index: 100;
  overflow: auto;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18), 0 3px 10px rgba(15, 23, 42, 0.1);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
  scrollbar-width: thin;
}
.dispensing-dropdown.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.dispensing-dropdown-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 38px;
  padding: 8px 30px 8px 11px;
  position: relative;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.dispensing-dropdown-item:hover,
.dispensing-dropdown-item:focus-visible,
.dispensing-dropdown-item.selected {
  outline: none;
  background: color-mix(in srgb, var(--primary) 11%, var(--surface));
  color: var(--primary);
}
.dispensing-dropdown-item.selected::after {
  content: "✓";
  position: absolute;
  right: 11px;
  font-weight: 800;
}
.dispensing-safety-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: -4px 0 12px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--warning) 38%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--warning) 9%, var(--surface));
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.4;
}
.dispensing-safety-note strong { flex: 0 0 auto; color: var(--warning); }
.dispensing-safety-note.hidden { display: none; }
[data-theme="dark"] .dispensing-table th { background: var(--primary); }

/* Match non-POS pages to POS compact density */
body.density-compact .main-content .card-header { padding: 12px 16px; }
body.density-compact .main-content .card-body { padding: 16px; }
body.density-compact .main-content .card-footer { padding: 12px 16px; }
body.density-compact .main-content .input,
body.density-compact .main-content .select,
body.density-compact .main-content .textarea {
  font-size: 0.8667rem;
}
body.density-compact .main-content .input,
body.density-compact .main-content .select {
  min-height: 2.25rem;
}
body.density-compact .main-content .btn {
  padding: 6px 12px;
  font-size: 0.8667rem;
}
body.density-compact .main-content .btn-sm {
  padding: 4px 9px;
  font-size: 0.8667rem;
}
body.density-compact .main-content .data-table th {
  padding: 8px 10px;
  font-size: 0.8667rem;
}
body.density-compact .main-content .data-table td {
  padding: 8px 10px;
  font-size: 0.8667rem;
}
body.density-compact .main-content .page-header h2 { font-size: 1.2rem; }
body.density-compact .main-content .page-header p { font-size: 0.8667rem; }

/* ═══════════════════════════════════════════════════════════════
   STOCK — EXPIRY ALERTS
   ═══════════════════════════════════════════════════════════════ */
.expiry-alert-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-md); margin-bottom: 8px; }
.expiry-critical { background: var(--danger-soft); border: 1px solid rgba(220,38,38,0.2); }
.expiry-warning  { background: var(--warning-soft); border: 1px solid rgba(217,119,6,0.2); }

/* ═══════════════════════════════════════════════════════════════
   RECEIPT PREVIEW
   ═══════════════════════════════════════════════════════════════ */
.receipt-preview {
  font-family: "Courier New", Courier, monospace;
  font-size: 0.8667rem; line-height: 1.5;
  background: #fffef5; color: #1a1a1a;
  border: 1px dashed #ccc; border-radius: var(--card-radius);
  padding: 16px 14px; white-space: pre-wrap; overflow-wrap: break-word;
}
[data-theme="dark"] .receipt-preview { background: #1a1a12; color: #e8e8d0; border-color: #333; }

/* ═══════════════════════════════════════════════════════════════
   REPORT CHARTS
   ═══════════════════════════════════════════════════════════════ */
.chart-container {
  position: relative; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 20px; box-shadow: var(--shadow-sm);
}
.chart-title { font-size: 0.8667rem; font-weight: 700; margin-bottom: 14px; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; }
.bar { width: 100%; border-radius: 4px 4px 0 0; background: var(--primary); min-height: 4px; transition: height 0.4s cubic-bezier(0.4,0,0.2,1); }
.bar-label { font-size: 0.8667rem; color: var(--text-muted); white-space: nowrap; }

/* ═══════════════════════════════════════════════════════════════
   SETTINGS TABS
   ═══════════════════════════════════════════════════════════════ */
.settings-shell {
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  background: var(--surface);
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  overflow: hidden;
}
.main-content:has(.settings-shell) {
  display: flex;
  flex-direction: column;
}
.main-content:has(.settings-shell) .settings-shell {
  flex: 1;
  min-height: 0;
}
.settings-nav {
  border-right: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 14px;
}
.settings-tabs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-tab-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
  opacity: 0.5;
}
.settings-tab {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.8667rem;
  font-weight: 700;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, color 0.16s;
  opacity: 0.65;
}
.settings-tab:hover {
  opacity: 1;
  color: var(--text);
  border-color: var(--primary-light);
  background: var(--surface-2);
}
.settings-tab.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  opacity: 1;
}

.settings-content-subtabs {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.subtab {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, color 0.16s;
  opacity: 0.65;
}
.subtab:hover {
  opacity: 1;
  color: var(--text);
  border-color: var(--primary-light);
  background: var(--surface-2);
}
.subtab.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  opacity: 1;
}

main.main-content:has(#rptExpiryPanel:not(.hidden)),
main.main-content:has(#rptDailyPanel:not(.hidden)),
main.main-content:has(#rptStockPanel:not(.hidden)),
main.main-content:has(#rptPurchasesPanel:not(.hidden)) {
  overflow: hidden;
  padding-bottom: 8px;
  display: flex;
  flex-direction: column;
}
.app-body:has(#rptExpiryPanel:not(.hidden)) > .page-header,
.app-body:has(#rptDailyPanel:not(.hidden)) > .page-header,
.app-body:has(#rptExpiryPanel:not(.hidden)) > #moduleNav,
.app-body:has(#rptDailyPanel:not(.hidden)) > #moduleNav,
.app-body:has(#rptStockPanel:not(.hidden)) > .page-header,
.app-body:has(#rptStockPanel:not(.hidden)) > #moduleNav,
.app-body:has(#rptPurchasesPanel:not(.hidden)) > .page-header,
.app-body:has(#rptPurchasesPanel:not(.hidden)) > #moduleNav {
  flex: 0 0 auto;
}
main.main-content:has(#rptExpiryPanel:not(.hidden)) #rptExpiryPanel,
main.main-content:has(#rptDailyPanel:not(.hidden)) #rptDailyPanel,
main.main-content:has(#rptStockPanel:not(.hidden)) #rptStockPanel,
main.main-content:has(#rptPurchasesPanel:not(.hidden)) #rptPurchasesPanel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
main.main-content:has(#rptExpiryPanel:not(.hidden)) #rptExpiryPanel .table-wrap,
main.main-content:has(#rptDailyPanel:not(.hidden)) #rptDailyPanel .table-wrap,
main.main-content:has(#rptStockPanel:not(.hidden)) #rptStockPanel .table-wrap,
main.main-content:has(#rptPurchasesPanel:not(.hidden)) #rptPurchasesPanel .table-wrap,
main.main-content:has(#rptActivityPanel:not(.hidden)) #rptActivityPanel .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

/* Returns page tab row */
#returnsTabs {
  display: flex;
  flex-direction: row;
  gap: 8px;
  flex-wrap: wrap;
}
#returnsTabs .settings-tab {
  width: auto;
  min-width: 170px;
  text-align: center;
}
.main-content:has(#ctrlRegisterPanel) {
  padding-top: 8px;
}
.main-content:has(#ctrlRegisterPanel) > .page-header {
  display: none;
}
.controlled-kpi-grid {
  gap: 10px;
}
.controlled-kpi-grid .kpi-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 8px 10px 9px;
  min-height: 96px;
}
.controlled-kpi-grid .kpi-card-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  margin-bottom: 0;
  border-radius: 8px;
}
.controlled-kpi-grid .kpi-card-icon svg {
  width: 14px;
  height: 14px;
}
.controlled-kpi-grid .kpi-text {
  min-width: 0;
  padding-right: 32px;
}
.controlled-kpi-grid .kpi-label {
  margin-bottom: 2px;
  font-size: 0.76rem;
}
.controlled-kpi-grid .kpi-value {
  font-size: clamp(0.98rem, 1.45vw, 1.28rem);
  line-height: 1.04;
}
.controlled-kpi-grid .kpi-note {
  margin-top: 2px;
  font-size: 0.74rem;
  line-height: 1.15;
}
.controlled-kpi-grid #ctrlLastBy {
  font-size: clamp(0.92rem, 1.3vw, 1.12rem);
}
.controlled-kpi-grid #ctrlLastDate {
  font-size: 0.72rem;
}
#ctrlTabs .settings-tab {
  padding: 11px 12px;
  min-height: 46px;
}
#ctrlRegisterPanel .table-toolbar .input,
#ctrlRegisterPanel .table-toolbar .search-wrap .input,
#ctrlRegisterPanel .ctrl-register-drug-filter .app-select-button {
  height: 28px;
  min-height: 28px;
  padding-top: 0;
  padding-bottom: 0;
}
.ctrl-register-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.ctrl-register-drug-filter {
  width: 168px;
}
#ctrlRegisterPanel .ctrl-register-drug-filter .app-select-wrap,
#ctrlRegisterPanel .ctrl-register-drug-filter .app-select-button {
  width: 100%;
}
.controlled-approval-target.is-focused td {
  background: rgba(2, 132, 199, 0.12) !important;
  box-shadow: inset 3px 0 0 #0068b3;
}
[data-theme="dark"] .controlled-approval-target.is-focused td {
  background: rgba(56, 189, 248, 0.12) !important;
  box-shadow: inset 3px 0 0 #38bdf8;
}
#ctrlRegisterPanel .table-wrap {
  overflow: visible;
}
#ctrlRegisterPanel .ctrl-register-scroll {
  max-height: calc(100dvh - 240px);
  overflow: hidden auto;
  scrollbar-gutter: auto;
}
#ctrlRegisterPanel .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 -1px 0 var(--border);
}
.ctrl-tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-left: 8px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}
.settings-content-area {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.settings-content-header {
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}
.settings-content-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
}
.settings-content-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
}
.data-table .badge {
  background: transparent !important;
}
.settings-content-scroll .card {
  border-radius: var(--r-lg);
  flex-shrink: 0;
}
.settings-content-scroll .table-wrap {
  flex: 1 1 0%;
  min-height: 0;
  max-height: none;
  height: 0;
}
.settings-bottom-actions {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  background: var(--surface);
  padding: 10px 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.settings-bottom-actions .btn {
  min-width: 120px;
}

[data-theme="dark"] .settings-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  opacity: 1;
}

.settings-panel { display: none; }
.settings-panel.active { display: block; }

/* Products — Manage accordion */
.manage-products-accordion {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}
.manage-products-toggle {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.8667rem;
  font-weight: 700;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}
.manage-products-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.16s ease;
}
.manage-products-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.manage-products-panel {
  border-top: 1px solid var(--border);
  padding: 10px 12px;
}
.manage-products-panel-standalone {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0;
}
.manage-products-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.manage-products-card {
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 10px;
  background: var(--surface);
}
.manage-products-card h3 {
  font-size: 0.8667rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.manage-products-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.manage-products-row .select {
  min-width: 180px;
  flex: 1 1 220px;
}
.product-row-selected {
  background: var(--primary-soft) !important;
}

/* ═══════════════════════════════════════════════════════════════
   CONFIRM DIALOG
   ═══════════════════════════════════════════════════════════════ */
.confirm-dialog {
  background: var(--surface); border-radius: var(--r-xl);
  padding: 28px; max-width: 400px; width: 100%;
  text-align: center; box-shadow: var(--shadow-lg);
  animation: modalIn 0.22s ease;
}
.confirm-icon {
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; margin: 0 auto 16px;
}
.confirm-icon.danger { background: var(--danger-soft); color: var(--danger); }
.confirm-icon.warning { background: var(--warning-soft); color: var(--warning); }
.confirm-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.confirm-dialog h3 { font-size: 1rem; margin-bottom: 8px; }
.confirm-dialog p { color: var(--text-muted); font-size: 0.8667rem; margin-bottom: 22px; line-height: 1.5; }
.confirm-dialog .btn-row { display: flex; gap: 10px; justify-content: center; }

.prompt-dialog { text-align: center; }
.prompt-dialog h3 { margin-bottom: 8px; }
.prompt-dialog p { color: var(--text-muted); font-size: 0.8667rem; margin-bottom: 16px; line-height: 1.5; }
.prompt-input-wrap { margin-bottom: 4px; }
.prompt-input-wrap .input { width: 100%; text-align: center; }

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD QUICK ACTIONS
   ═══════════════════════════════════════════════════════════════ */
.quick-actions-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 20px; }
.quick-action-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--card-radius); padding: 18px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  cursor: pointer; transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  text-align: center;
}
.quick-action-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--primary-light); }
.quick-action-card:active { transform: scale(0.97); }
.quick-action-card svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--primary); }
.quick-action-card span { font-size: 0.8667rem; font-weight: 700; color: var(--text); }

/* Alert cards */
.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid;
}
.alert-item.critical { background: var(--danger-soft); border-color: rgba(220,38,38,0.2); }
.alert-item.warning  { background: var(--warning-soft); border-color: rgba(217,119,6,0.2); }
.alert-item.info     { background: var(--info-soft); border-color: rgba(0,104,179,0.2); }
.alert-item-icon { width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; flex-shrink: 0; }
.alert-item-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.alert-item.critical .alert-item-icon { background: var(--danger-soft); color: var(--danger); }
.alert-item.warning  .alert-item-icon { background: var(--warning-soft); color: var(--warning); }
.alert-item-text { flex: 1; min-width: 0; }
.alert-item-text strong { font-size: 0.8667rem; display: block; }
.alert-item-text span { font-size: 0.8667rem; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════ */
.hidden { display: none !important; }

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

@media (prefers-reduced-motion: no-preference) {
  .main-content > section:not(.hidden),
  .main-content > div:not(.hidden),
  .products-admin-surface > div:not(.hidden),
  .settings-panel:not(.hidden),
  .finance-panel:not(.hidden),
  .report-panel:not(.hidden),
  .stock-panel:not(.hidden) {
    animation: appTabPanelIn 160ms ease-out both;
  }
}
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.8667rem; }
.font-bold { font-weight: 700; }
.font-mono { font-family: var(--font-mono); }

/* ─── UI typography utilities ─────────────────────────────── */
.ui-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--text-muted);
}
.ui-value {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}
.ui-value-strong {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}
.numeric-value,
.currency-value,
.qty-value,
.stock-value,
.kpi-value,
.total-value {
  font-variant-numeric: tabular-nums;
}

/* ─── UI icon utilities ──────────────────────────────────── */
.ui-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  stroke-width: 1.8;
  color: currentColor;
}
.ui-icon-sm { width: 14px; height: 14px; }
.ui-icon-md { width: 18px; height: 18px; }
.ui-icon-lg { width: 20px; height: 20px; }
.ui-icon-muted { color: var(--text-muted); }
.ui-icon-danger { color: var(--danger); }
.ui-icon-success { color: var(--success); }
.ui-icon-warning { color: var(--warning); }

/* ─── UI meta item pattern ──────────────────────────────── */
.ui-meta-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.ui-meta-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.ui-meta-item > .ui-icon { align-self: center; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; } .mb-6 { margin-bottom: 24px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
}

.main-content.soft-nav-loading { opacity: 1; }
.soft-nav-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  padding: 56px 16px;
}
.soft-nav-loading-shell {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 92%, var(--primary) 8%);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}
.soft-nav-loading-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--primary) 20%, var(--border));
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
  flex: 0 0 auto;
}
.soft-nav-loading-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.soft-nav-loading-copy-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}
.soft-nav-loading-copy-subtitle {
  font-size: 0.8667rem;
  color: var(--text-dim);
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .quick-actions-grid { grid-template-columns: repeat(2,1fr); }
  .pos-layout { grid-template-columns: 1fr 1fr; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
  .soft-nav-loading-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .manage-products-grid { grid-template-columns: 1fr; }
  .settings-shell { grid-template-columns: 190px minmax(0, 1fr); }
  .finance-summary-grid { grid-template-columns: 1fr; }
}

@media (max-height: 720px) and (min-width: 901px) {
  .sidebar-brand { padding: 14px 14px 11px; gap: 9px; }
  .sidebar-app-brand { min-height: 48px; padding-top: 10px; padding-bottom: 10px; }
  .sidebar-tenant-brand { padding: 11px 14px 9px; gap: 7px; }
  .sidebar-tenant-logo-card { width: 72px; height: 72px; border-radius: 12px; }
  .sidebar-logo { width: 36px; height: 36px; border-radius: 10px; }
  .sidebar-app-brand-icon,
  .sidebar-logo svg { width: 20px; height: 20px; }
  .sidebar-tenant-name { font-size: 0.8667rem; }
  .sidebar-brand-text h1 { font-size: 0.8667rem; }
  .sidebar-brand-text p { font-size: 0.8667rem; }
  .sidebar-nav-label { padding: 9px 16px 3px; font-size: 0.8667rem; }
  .sidebar-nav { padding: 3px 10px; gap: 1px; }
  .nav-btn { padding: 7px 11px; gap: 10px; font-size: 0.8667rem; }
  .nav-btn svg { width: 17px; height: 17px; }
  .sidebar-footer { padding: 6px 10px 8px; gap: 0; }
  .sidebar-footer-btn,
  .theme-pill-btn { padding: 7px 11px; gap: 10px; font-size: 0.8667rem; }
  .theme-pill { padding: 2px 7px 2px 4px; }
  .sidebar-user-card { padding: 8px 10px; }
  .sidebar-user-avatar { width: 29px; height: 29px; }
  .sidebar-user-name { font-size: 0.8667rem; }
  .sidebar-user-role { font-size: 0.8667rem; }
}

@media (max-height: 620px) and (min-width: 901px) {
  .sidebar-brand { padding-top: 11px; padding-bottom: 9px; }
  .sidebar-app-brand { min-height: 44px; padding-top: 8px; padding-bottom: 8px; }
  .sidebar-tenant-brand { padding-top: 9px; padding-bottom: 8px; }
  .sidebar-nav-label { padding-top: 7px; }
  .nav-btn { padding-top: 6px; padding-bottom: 6px; }
  .sidebar-footer-btn,
  .theme-pill-btn { padding-top: 6px; padding-bottom: 6px; }
  .sidebar-footer { padding-bottom: 6px; }
  .sidebar-user-role { display: none; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .desktop-sidebar { display: none; }
  .desktop-global-bar-wrap { display: none; }
  .topbar { display: flex; }
  .mobile-bottom-nav { display: flex; }
  .main-content { padding-bottom: 80px; }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .main-content { padding: 16px 14px 80px; }
  .main-content.finance-page { padding-bottom: 8px; }
  .soft-nav-loading-grid { grid-template-columns: 1fr; }
  .manage-products-row .select { flex-basis: 100%; min-width: 0; }

  .kpi-grid { grid-template-columns: repeat(2,1fr); gap: 10px; }
  .quick-actions-grid { grid-template-columns: repeat(2,1fr); gap: 10px; }

  .form-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; justify-content: center; }
  .stocktake-modal-backdrop { padding-left: 0; }
  .stocktake-modal-shell { min-height: calc(100dvh - 8px); max-width: calc(100vw - 10px); }
  .stocktake-modal-body { padding: 14px 10px 8px; }
  .stocktake-grid-wrap { max-height: calc(100dvh - 280px); }
  .stocktake-modal-footer { flex-direction: column-reverse; }
  .stocktake-modal-footer .btn { width: 100%; }
  .stocktake-count-input { width: 100%; }
  .data-table th:nth-child(n+5),
  .data-table td:nth-child(n+5) { display: none; }

  .page-header-row { flex-direction: column; align-items: flex-start; }
  .settings-shell { display: block; min-height: auto; }
  .settings-nav { border-right: none; border-bottom: 1px solid var(--border); padding: 10px; }
  .settings-tabs { flex-direction: row; gap: 8px; overflow-x: auto; }
  .settings-tab { flex: 0 0 auto; min-width: 132px; }
  .settings-content-header { padding: 12px 14px; }
  .settings-content-header h2 { font-size: 1.2rem; }
  .settings-content-scroll { padding: 12px; }
  .settings-bottom-actions { flex-direction: column-reverse; padding: 10px; }
  .settings-bottom-actions .btn { width: 100%; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-value { font-size: 1.2rem; }
  .modal { border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .finance-summary-grid { grid-template-columns: 1fr; }
  .finance-summary-chart { min-height: 180px; }
  .main-content.finance-page { padding-bottom: 8px; }
}

/* ═══════════════════════════════════════════════════════════════
   DARK MODE OVERRIDES
   ═══════════════════════════════════════════════════════════════ */
[data-theme="dark"] .data-table th { background: #1a1a1a; }

/* ─── Compact data-table variant ─────────────────────────────── */
.data-table.compact th { padding: 8px 10px !important; font-size: 0.8667rem !important; }
.data-table.compact td { padding: 8px 10px !important; font-size: 0.8667rem !important; }
.data-table.compact .btn-sm { font-size: 0.8667rem !important; padding: 4px 9px !important; }
[data-theme="dark"] .select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
[data-theme="dark"] .receipt-preview { background: #1a1a10; border-color: #333; }

/* ═══════════════════════════════════════════════════════════════
   THEME PILL — animated sun/moon toggle
   ═══════════════════════════════════════════════════════════════ */
.theme-pill-btn {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: none; cursor: pointer;
  padding: 9px 12px; border-radius: var(--r-sm); width: 100%;
  color: var(--sidebar-text-dim);
  transition: background 0.18s, color 0.18s;
}
.theme-pill-btn:hover { background: var(--sidebar-hover-bg); color: rgba(255,255,255,0.8); }

.theme-pill {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 99px; padding: 3px 8px 3px 4px;
  transition: background 0.3s, border-color 0.3s;
  flex-shrink: 0;
}
.theme-pill[data-mode="dark"] {
  background: rgba(99,102,241,0.25);
  border-color: rgba(99,102,241,0.5);
}
.theme-pill-track {
  width: 28px; height: 16px; border-radius: 99px;
  background: rgba(255,255,255,0.15);
  position: relative; flex-shrink: 0;
  transition: background 0.3s;
}
.theme-pill[data-mode="dark"] .theme-pill-track { background: #6366f1; }
.theme-pill-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: white; position: absolute; top: 2px; left: 2px;
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1), box-shadow 0.25s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.theme-pill[data-mode="dark"] .theme-pill-thumb {
  transform: translateX(12px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.theme-pill svg { flex-shrink: 0; opacity: 0.85; transition: opacity 0.2s; }
.theme-pill:hover svg { opacity: 1; }

/* Topbar theme button */
.topbar-theme-toggle {
  width: 36px; height: 36px; border: none;
  background: var(--surface-2); border-radius: var(--r-sm);
  color: var(--text-muted); display: grid; place-items: center;
  cursor: pointer; transition: background 0.15s, color 0.15s, transform 0.2s;
  border: 1px solid var(--border);
}
.topbar-theme-toggle:hover { background: var(--primary-soft); color: var(--primary); transform: rotate(12deg); }
.topbar-theme-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR USER CARD
   ═══════════════════════════════════════════════════════════════ */
.sidebar-user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin: 0 2px;
  border-radius: var(--card-radius);
  border: 1px solid var(--sidebar-border);
  background: rgba(255,255,255,0.04);
}
.sidebar-user-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white; font-size: 0.8667rem; font-weight: 800;
  display: grid; place-items: center;
  border: 2px solid rgba(255,255,255,0.2);
}
.sidebar-user-info { min-width: 0; flex: 1; }
.sidebar-user-name {
  font-size: 0.8667rem; font-weight: 700;
  color: rgba(255,255,255,0.9);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 0.8667rem; font-weight: 600; text-transform: capitalize;
  color: var(--sidebar-text-dim); margin-top: 1px;
}

/* ═══════════════════════════════════════════════════════════════
   BORDER HIERARCHY — subtle card hairlines
   ═══════════════════════════════════════════════════════════════ */
:root {
  --border:      #d2deeb;
  --border-soft: #e7eef6;
}

/* Keep hard refreshes tenant-safe: application content is revealed only after
   core.js has confirmed the active workspace/session. */
html[data-pharma-ui="booting"] .app-body {
  visibility: hidden;
  pointer-events: none;
}
[data-theme="dark"] {
  --border:      #484848;
  --border-soft: #383838;
}
/* Table borders extra visible */
.data-table th { border-bottom: 2px solid var(--border); }
.data-table td { border-bottom: 1px solid var(--border); }
.table-wrap {
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  box-shadow: inset 0 -1px 0 var(--border);
}

/* Table viewport contract — standalone list, register, and report panels. */
main.main-content:has(#purchasesListPanel:not(.hidden)),
main.main-content:has(#purchaseDraftsPanel:not(.hidden)),
main.main-content:has(#pastPurchasesPanel:not(.hidden)),
main.main-content:has(#suppliersListPanel:not(.hidden)),
main.main-content:has(#rptProfitPanel:not(.hidden)),
main.main-content:has(#rptCashiersPanel:not(.hidden)),
main.main-content:has(#rptSuppliersPanel:not(.hidden)),
main.main-content:has(#rptCustomersPanel:not(.hidden)),
main.main-content:has(#rptTaxPanel:not(.hidden)),
main.main-content:has(#rptReorderPanel:not(.hidden)),
main.main-content:has(#rptBranchPanel:not(.hidden)),
main.main-content:has(#rptInventoryAuditPanel:not(.hidden)),
main.main-content:has(#rptStatementsPanel:not(.hidden)),
main.main-content:has(#rptActivityPanel:not(.hidden)),
main.main-content:has(#pastReturnsSearchInput) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 8px;
}

main.main-content > :is(
  #purchasesListPanel,
  #purchaseDraftsPanel,
  #pastPurchasesPanel,
  #suppliersListPanel,
  #rptProfitPanel,
  #rptCashiersPanel,
  #rptSuppliersPanel,
  #rptCustomersPanel,
  #rptTaxPanel,
  #rptReorderPanel,
  #rptBranchPanel,
  #rptInventoryAuditPanel,
  #rptStatementsPanel,
  #rptActivityPanel
):not(.hidden) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

main.main-content > :is(
  #purchasesListPanel,
  #purchaseDraftsPanel,
  #pastPurchasesPanel,
  #suppliersListPanel,
  #rptProfitPanel,
  #rptCashiersPanel,
  #rptSuppliersPanel,
  #rptCustomersPanel,
  #rptTaxPanel,
  #rptReorderPanel,
  #rptBranchPanel,
  #rptInventoryAuditPanel,
  #rptStatementsPanel,
  #rptActivityPanel
):not(.hidden) > .table-wrap,
main.main-content:has(#pastReturnsSearchInput) > .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: auto;
}

main.main-content > :is(
  #purchasesListPanel,
  #purchaseDraftsPanel,
  #pastPurchasesPanel,
  #suppliersListPanel,
  #rptProfitPanel,
  #rptCashiersPanel,
  #rptSuppliersPanel,
  #rptCustomersPanel,
  #rptTaxPanel,
  #rptReorderPanel,
  #rptBranchPanel,
  #rptInventoryAuditPanel,
  #rptStatementsPanel,
  #rptActivityPanel
):not(.hidden) > .table-wrap > .table-toolbar,
main.main-content:has(#pastReturnsSearchInput) > .table-wrap > .table-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
}

/* Goods Receipt keeps its register in the remaining viewport after pending POs. */
main.main-content:has(#grnListPanel:not(.hidden)) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 8px;
}
main.main-content > #grnListPanel:not(.hidden) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
main.main-content > #grnListPanel:not(.hidden) > .table-wrap {
  flex: 0 0 auto;
  min-height: 0;
}
main.main-content > #grnListPanel:not(.hidden) > .table-wrap:last-of-type {
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 0;
  overflow: auto;
}

/* Customer records keep both registers inside the available work area. */
main.main-content:has(#customersTableBody) {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  padding-bottom: 8px;
}
main.main-content:has(#customersTableBody) > .kpi-grid,
main.main-content:has(#customersTableBody) > #loyaltyRulesCard,
main.main-content:has(#customersTableBody) > #customersEmptyState {
  flex: 0 0 auto;
  margin-bottom: 0 !important;
}
main.main-content:has(#customersTableBody) > .table-wrap:not(#loyaltyActivityCard) {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: auto;
  margin-bottom: 0 !important;
}
main.main-content:has(#customersTableBody) > #loyaltyActivityCard:not(.hidden) {
  flex: 0 1 35%;
  min-height: 160px;
  max-height: 36%;
  overflow: auto;
}
main.main-content:has(#customersTableBody) > .table-wrap > .table-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
}

/* Controlled-drugs registers use the same full-height table contract on every tab. */
main.main-content:has(#ctrlRegisterPanel:not(.hidden)),
main.main-content:has(#ctrlApprovalsPanel:not(.hidden)),
main.main-content:has(#ctrlStockPanel:not(.hidden)),
main.main-content:has(#ctrlBalancePanel:not(.hidden)) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 8px;
}
main.main-content:has(#ctrlRegisterPanel:not(.hidden)) > .controlled-kpi-grid,
main.main-content:has(#ctrlApprovalsPanel:not(.hidden)) > .controlled-kpi-grid,
main.main-content:has(#ctrlStockPanel:not(.hidden)) > .controlled-kpi-grid,
main.main-content:has(#ctrlBalancePanel:not(.hidden)) > .controlled-kpi-grid {
  flex: 0 0 auto;
}
main.main-content > :is(#ctrlRegisterPanel, #ctrlApprovalsPanel, #ctrlStockPanel, #ctrlBalancePanel):not(.hidden) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
main.main-content > :is(#ctrlApprovalsPanel, #ctrlStockPanel, #ctrlBalancePanel):not(.hidden) > .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: auto;
}
#ctrlRegisterPanel:not(.hidden) > .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: visible;
}
#ctrlRegisterPanel:not(.hidden) .ctrl-register-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}
main.main-content > :is(#ctrlRegisterPanel, #ctrlApprovalsPanel, #ctrlStockPanel, #ctrlBalancePanel):not(.hidden) .table-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
}
.card { border: 1px solid var(--border); }
.input, .select, .textarea { border-width: 1.5px; }
.modal { border: 1px solid var(--border); }

/* Hairline separators */
.topbar,
.desktop-sidebar,
.mobile-bottom-nav,
.table-toolbar,
.card-header,
.card-footer,
.data-table th,
.data-table td { border-color: var(--border); }
.card-header,
.card-footer { border-color: var(--border); }

/* Dark mode — quieter line hierarchy */
[data-theme="dark"] .data-table th {
  border-bottom-width: 1px;
  border-bottom-color: var(--border-soft);
  background: #292929;
}
[data-theme="dark"] .data-table td {
  border-bottom-color: var(--border-soft);
}
[data-theme="dark"] .table-wrap,
[data-theme="dark"] .card,
[data-theme="dark"] .modal,
[data-theme="dark"] .input,
[data-theme="dark"] .select,
[data-theme="dark"] .textarea,
[data-theme="dark"] .manage-products-card {
  border-width: 1px;
  border-color: var(--border-soft);
}
[data-theme="dark"] .topbar,
[data-theme="dark"] .desktop-global-bar-wrap,
[data-theme="dark"] .table-toolbar,
[data-theme="dark"] .dashboard-global-search-wrap {
  border-color: var(--border-soft);
}
[data-theme="dark"] .dashboard-global-search-wrap {
  background: #2f2f2f;
}

/* ═══════════════════════════════════════════════════════════════
   CONTROLLED DRUGS — red accent styling
   ═══════════════════════════════════════════════════════════════ */
.controlled-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: #fff0f0; color: #c00; border: 1px solid #fcc;
  border-radius: 99px; font-size: 0.8667rem; font-weight: 800;
  padding: 2px 7px; letter-spacing: 0.04em; text-transform: uppercase;
}
[data-theme="dark"] .controlled-badge { background: #2a0808; border-color: #5a1010; color: #f87171; }

.controlled-row td { background: rgba(220,38,38,0.03); border-right: 1px solid var(--border-soft); }
.controlled-row td:last-child { border-right: none; }
[data-theme="dark"] .controlled-row td { background: rgba(220,38,38,0.06); }
.controlled-row:hover td { background: rgba(220,38,38,0.07) !important; }

.controlled-log-entry {
  border-left: 3px solid var(--danger); padding: 12px 14px;
  margin-bottom: 8px; border-radius: 0 var(--r-md) var(--r-md) 0;
  background: var(--danger-soft);
}

/* ═══════════════════════════════════════════════════════════════
   ASSETS — logo / stamp / signature preview
   ═══════════════════════════════════════════════════════════════ */
.asset-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg); padding: 24px;
  text-align: center; cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--surface-2);
}
.asset-upload-zone:hover { border-color: var(--primary); background: var(--primary-soft); }
.asset-upload-zone input[type="file"] { display: none; }
.asset-preview {
  max-width: 180px; max-height: 120px; border-radius: var(--r-md);
  border: 1.5px solid var(--border); padding: 6px;
  background: var(--surface); object-fit: contain;
  display: block; margin: 10px auto 0;
}
.asset-preview-sig {
  max-width: 220px; max-height: 80px;
}
.asset-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--card-radius); padding: 18px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.asset-card-label {
  font-size: 0.8667rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
}
/* PHARMAerp theme port */
:root {
  --bg: #f3f4f6;
  --bg-soft: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f4f7fb;

  --text: #000000;
  --text-muted: #334155;
  --text-dim: #64748b;

  --border: #d2deeb;
  --border-soft: #e7eef6;

  --primary: #0068b3;
  --primary-strong: #0369a1;
  --primary-soft: rgba(0,104,179,0.1);
  --primary-light: #38bdf8;
  --accent: #38bdf8;

  --success: #15803d;
  --success-soft: rgba(21,128,61,0.16);
  --warning: #d97706;
  --warning-soft: rgba(217,119,6,0.1);
  --danger: #dc2626;
  --danger-soft: rgba(220,38,38,0.1);
  --danger-strong: #b91c1c;
  --info: #0068b3;
  --info-soft: rgba(0,104,179,0.12);

  --sidebar-bg: var(--surface);
  --sidebar-bg2: var(--surface);
  --sidebar-border: #a5b3c1;
  --sidebar-text: #111827;
  --sidebar-text-dim: #64748b;
  --sidebar-active-bg: rgba(0,104,179,0.12);
  --sidebar-hover-bg: rgba(0,104,179,0.08);

  --r-xl: 0.5em;
  --r-lg: 0.5em;
  --r-md: 0.5em;
  --r-sm: 0.5em;
  --card-radius: 0.5em;

  --shadow-sm: 0 2px 8px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow: 0 1px 3px rgba(15,23,42,0.08), 0 1px 2px rgba(15,23,42,0.05);
  --shadow-md: 0 4px 12px rgba(15,23,42,0.08), 0 2px 4px rgba(15,23,42,0.05);
  --shadow-lg: 0 16px 48px rgba(15,23,42,0.12), 0 4px 12px rgba(15,23,42,0.06);
}

[data-theme="dark"] {
  --bg: #121212;
  --bg-soft: #161616;
  --surface: #1a1a1a;
  --surface-2: #202020;

  --text: #dde1e7;
  --text-muted: #a8b0bc;
  --text-dim: #717b89;

  --border: #2a2a2a;
  --border-soft: #242424;

  --primary: #38bdf8;
  --primary-strong: #0ea5e9;
  --primary-soft: rgba(56,189,248,0.1);
  --primary-light: #7dd3fc;
  --accent: #66b2ff;

  --success: #059669;
  --success-soft: rgba(16,185,129,0.22);
  --warning: #f59e0b;
  --warning-soft: rgba(245,158,11,0.2);
  --danger: #ef4444;
  --danger-soft: rgba(239,68,68,0.2);
  --danger-strong: #f87171;
  --info: #38bdf8;
  --info-soft: rgba(56,189,248,0.18);

  --sidebar-bg: var(--surface);
  --sidebar-bg2: var(--surface);
  --sidebar-border: #404040;
  --sidebar-text: #dde1e7;
  --sidebar-text-dim: #a8b0bc;
  --sidebar-active-bg: rgba(56,189,248,0.1);
  --sidebar-hover-bg: rgba(56,189,248,0.08);

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.38), 0 1px 2px rgba(0,0,0,0.28);
  --shadow: 0 1px 3px rgba(0,0,0,0.35), 0 1px 2px rgba(0,0,0,0.25);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.25);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.6), 0 4px 12px rgba(0,0,0,0.35);
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
}

.desktop-sidebar {
  box-shadow: 2px 0 16px rgba(0,0,0,0.07), 1px 0 0 var(--sidebar-border);
}
[data-theme="dark"] .desktop-sidebar {
  box-shadow: 2px 0 20px rgba(0,0,0,0.45), 1px 0 0 var(--sidebar-border);
}

.sidebar-logo {
  border-color: var(--border);
}

.sidebar-brand-text h1 {
  color: var(--text);
}

.nav-btn:hover,
.nav-group-toggle:hover,
.sidebar-footer-btn:hover {
  color: #0d1b2a;
}

.nav-btn.active,
.nav-sub-btn.active,
.sidebar-footer-btn.active {
  background: var(--sidebar-active-bg);
  color: var(--primary);
}

.nav-submenu > div {
  border-left-color: var(--sidebar-border);
}

.nav-sub-btn {
  color: var(--sidebar-text-dim);
}

.nav-sub-btn:hover {
  background: var(--sidebar-hover-bg);
  color: #0d1b2a;
}

.card,
.manage-products-card,
.table-wrap,
.modal,
.desktop-global-bar-wrap,
.dashboard-global-search-wrap {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.card {
  border-color: var(--border);
}

/* PHARMAerp theme port - products module normalization */
.products-admin-page {
  --prod-bg: var(--bg);
  --prod-panel: var(--surface);
  --prod-elev: var(--surface-2);
  --prod-row: var(--surface);
  --prod-row-alt: var(--surface-2);
  --prod-row-hover: var(--primary-soft);
  --prod-row-selected: var(--primary-soft);
  --prod-divider: var(--border);
  --prod-text: var(--text);
  --prod-text-muted: var(--text-muted);
  --prod-green: var(--primary);
}

[data-theme="dark"] .products-admin-page {
  --prod-bg: var(--bg);
  --prod-panel: var(--surface);
  --prod-elev: var(--surface-2);
  --prod-row: var(--surface);
  --prod-row-alt: #303030;
  --prod-row-hover: rgba(56,189,248,0.1);
  --prod-row-selected: rgba(56,189,248,0.14);
  --prod-divider: var(--border);
  --prod-text: var(--text);
  --prod-text-muted: var(--text-muted);
  --prod-green: var(--primary);
}

.products-tab-group .settings-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.products-tab-group .settings-tab.active {
  background: color-mix(in srgb, var(--surface-2) 92%, var(--text) 8%);
  border-color: #0068b3;
  color: white;
}

.products-admin-page .btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}

.products-admin-page .btn-primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

/* Purchases workbench layout */
#purchaseEntryPanel .purchase-workbench {
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  height: 100%;
  overflow: hidden;
}
#purchaseEntryPanel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
#purchaseEntryPanel .purchase-workbench-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
#purchaseEntryPanel .purchase-workbench-top h3 {
  margin: 0;
  font-size: 1.2rem;
}
#purchaseEntryPanel .purchase-config-card {
  margin-top: 8px;
  padding: 4px 0 0;
  border: none;
  border-radius: 0;
  background: transparent;
}
#purchaseEntryPanel .purchase-config-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 2fr 1fr 1fr 1fr;
}
#purchaseEntryPanel .purchase-config-grid .form-group { margin: 0; }
#purchaseEntryPanel .purchase-config-grid .form-label { line-height: 1.25; }
#purchaseEntryPanel .purchase-config-grid .input,
#purchaseEntryPanel .purchase-config-grid .select { height: 40px; }
#purchaseEntryPanel .purchase-supplier-combo {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
#purchaseEntryPanel .purchase-entry-divider {
  height: 1px;
  background: var(--border);
  opacity: 0.9;
  margin: 12px 0;
}
#purchaseEntryPanel .purchase-workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 14px;
  flex: 1 1 auto;
  align-items: stretch;
  min-height: 0;
  overflow: hidden;
}
#purchaseEntryPanel .purchase-workbench-main {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#purchaseEntryPanel .purchase-items-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 8px;
}
#purchaseEntryPanel .purchase-items-header h4 { margin: 0; font-size: 1.2rem; }
#purchaseEntryPanel .purchase-quick-add {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
#purchaseEntryPanel .purchase-quick-picker {
  position: relative;
  flex: 1 1 auto;
}
#purchaseEntryPanel .purchase-quick-add .input { height: 34px; }
#purchaseEntryPanel .purchase-quick-search { width: 100%; }
#purchaseEntryPanel .purchase-aux-action {
  white-space: nowrap;
  height: 34px;
}
#purchaseEntryPanel .purchase-quick-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 45;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  padding: 4px;
}
#purchaseEntryPanel .purchase-quick-option {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  font-size: 0.8667rem;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}
#purchaseEntryPanel .purchase-quick-option:hover,
#purchaseEntryPanel .purchase-quick-option.active {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  color: var(--primary-strong);
}
#purchaseEntryPanel .purchase-quick-option.picked,
#purchaseEntryPanel .purchase-product-option.picked,
#purchaseBulkModal .purchase-bulk-row.picked {
  color: var(--text-muted);
}
#purchaseEntryPanel .purchase-quick-option:disabled,
#purchaseEntryPanel .purchase-product-option:disabled {
  cursor: not-allowed;
  opacity: 0.9;
}
#purchaseEntryPanel .purchase-quick-option.empty {
  color: var(--text-muted);
  cursor: default;
}
.purchase-picked-tag {
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  color: var(--primary);
  font-size: 0.72rem;
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0.04em;
}
.purchase-product-dropdown {
  position: fixed;
  z-index: 100;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  padding: 4px;
}
.purchase-product-dropdown .purchase-product-option {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  font-size: 0.8rem;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.purchase-product-dropdown .purchase-product-option:hover,
.purchase-product-dropdown .purchase-product-option.highlight {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  color: var(--primary-strong);
}
.purchase-product-dropdown .purchase-product-search {
  position: sticky;
  top: 0;
  z-index: 1;
  margin-bottom: 4px;
}
.purchase-product-dropdown .purchase-product-search .input {
  height: 32px;
  font-size: 0.8rem;
}
#purchaseEntryPanel .purchase-quick-add .btn {
  height: 34px;
  min-width: 34px;
  padding: 0 10px;
  font-weight: 800;
}
#purchaseEntryPanel .purchase-items-table-head,
#purchaseEntryPanel .purchase-item-row {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 92px 120px 78px 116px 30px 30px;
  gap: 8px;
  align-items: center;
}
#purchaseEntryPanel .purchase-items-table-head {
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--primary) 12%, var(--surface-2));
  color: var(--text);
  font-size: 0.8667rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
#purchaseEntryPanel .purchase-items-table-head span:nth-child(2),
#purchaseEntryPanel .purchase-items-table-head span:nth-child(3),
#purchaseEntryPanel .purchase-items-table-head span:nth-child(4) {
  text-align: left;
  padding-left: 8px;
}
#purchaseEntryPanel .purchase-items-table-head span:nth-child(5) {
  text-align: center;
  padding-right: 0;
}
#purchaseEntryPanel .purchase-items-scroll {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 10px;
  flex: 1 1 auto;
  min-height: 170px;
  max-height: none;
  overflow-y: auto;
  padding-right: 4px;
}
#purchaseEntryPanel .purchase-item-row {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: 6px 8px;
}
#purchaseEntryPanel .purchase-item-field { margin: 0; }
#purchaseEntryPanel .purchase-item-field .input,
#purchaseEntryPanel .purchase-item-field .select {
  height: 34px;
  padding-top: 5px;
  padding-bottom: 5px;
}
#purchaseEntryPanel .purchase-item-line-total {
  justify-self: stretch;
  text-align: center;
  padding-right: 0;
  font-weight: 800;
  color: var(--text);
}
#purchaseEntryPanel .purchase-item-remove {
  color: var(--danger);
  min-height: 34px;
  height: 34px;
  padding: 0 6px;
}
#purchaseEntryPanel .purchase-item-add {
  color: var(--primary);
  min-height: 34px;
  height: 34px;
  padding: 0 6px;
  font-weight: 800;
}
#purchaseEntryPanel .purchase-summary-card {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
#purchaseEntryPanel .purchase-summary-row,
#purchaseEntryPanel .purchase-summary-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}
#purchaseEntryPanel .purchase-summary-row { border-bottom: 1px dashed var(--border); }
#purchaseEntryPanel .purchase-summary-total {
  font-size: 1.2rem;
  color: var(--primary);
  font-weight: 900;
}
#purchaseEntryPanel .purchase-summary-preview {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 10px;
  min-height: 120px;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#purchaseEntryPanel .purchase-summary-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.8667rem;
  margin-bottom: 8px;
}
#purchaseEntryPanel .purchase-summary-preview > #purchaseSelectedPreviewText {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}
#purchaseEntryPanel .purchase-preview-empty {
  color: var(--text-muted);
}
#purchaseEntryPanel .purchase-preview-item {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-soft);
}
#purchaseEntryPanel .purchase-preview-item:last-child {
  border-bottom: none;
}
#purchaseEntryPanel .purchase-preview-name {
  font-weight: 700;
  color: var(--text);
}
#purchaseEntryPanel .purchase-preview-meta {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.8rem;
}
#purchaseEntryPanel .purchase-notes {
  margin-top: 12px;
}
#purchaseEntryPanel .purchase-notes .textarea {
  height: 72px;
  min-height: 72px;
  max-height: 140px;
  overflow-y: auto;
  resize: none;
}
#purchaseEntryPanel .purchase-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: auto;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 12px 0 4px;
  background: linear-gradient(180deg, transparent 0, var(--surface) 18px, var(--surface) 100%);
}
#purchaseBulkModal .purchase-bulk-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
#purchaseBulkModal .purchase-bulk-list {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  max-height: 340px;
  overflow-y: auto;
  padding: 6px;
}
#purchaseBulkModal .purchase-bulk-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
}
#purchaseBulkModal .purchase-bulk-row:hover {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}
#purchaseBulkModal .purchase-bulk-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  cursor: pointer;
  font-weight: 600;
}
#purchaseBulkModal .purchase-bulk-row input:disabled {
  cursor: not-allowed;
}
#purchaseBulkModal .purchase-bulk-empty {
  color: var(--text-muted);
  padding: 10px;
}

@media (max-width: 1300px) {
  #purchaseEntryPanel .purchase-config-grid { grid-template-columns: 2fr 1fr 1fr; }
  #purchaseEntryPanel .purchase-workbench-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  #purchaseEntryPanel .purchase-config-grid { grid-template-columns: 1fr; }
  #purchaseEntryPanel .purchase-items-table-head,
  #purchaseEntryPanel .purchase-item-row {
    grid-template-columns: minmax(170px, 1fr) 84px 110px 74px 100px 28px 28px;
  }
}

/* ─── Purchase Order Document (view modal + print) ──────────── */
.po-doc {
  font-family: 'Plus Jakarta Sans', Arial, sans-serif;
  color: #1a1a2e;
  max-width: 100%;
}
.po-doc .po-header { margin-bottom: 3mm; }
.po-doc .po-header-inner { display: flex; justify-content: space-between; align-items: flex-end; }
.po-doc .po-brand { display: flex; align-items: flex-end; gap: 12px; }
.po-doc .po-logo { flex-shrink: 0; }
.po-doc .po-brand-info h1 { font-size: 16px; font-weight: 800; color: var(--primary, #1a4b8c); margin: 0; }
.po-doc .po-brand-info p { font-size: 9.5pt; color: #000; line-height: 1.7; margin-top: 3px; }
.po-doc .po-id-box { text-align: right; }
.po-doc .po-title { font-size: 20px; font-weight: 800; color: var(--primary, #1a4b8c); letter-spacing: .02em; }
.po-doc .po-id-box table { margin-top: 6px; border: none; width: auto; margin-left: auto; }
.po-doc .po-id-box td { font-size: 9.5pt; padding: 2px 0 2px 12px; text-align: right; border: none; color: #000; }
.po-doc .po-divider { border: none; border-top: 1px solid #000; margin: 3mm 0; }
.po-doc .po-parties { display: flex; gap: 8mm; margin-bottom: 3mm; }
.po-doc .po-party-cell { padding: 6px 12px; flex: 1; }
.po-doc .po-party-ship { padding: 6px 12px; }
.po-doc .po-cell-body, .po-doc .po-party-inner { border-left: 3px solid var(--primary, #0e7c7b); padding-left: 8px; }
.po-doc .po-cell-label { font-size: 8pt; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--primary, #1a4b8c); margin-bottom: 4px; }
.po-doc .po-cell-value { font-size: 11pt; font-weight: 700; color: #1a1a2e; }
.po-doc .po-cell-sub { font-size: 9pt; color: #000; margin-top: 2px; }
.po-doc .po-delivery-strip { display: flex; gap: 6mm; flex-wrap: wrap; padding: 3mm 0; }
.po-doc .po-delivery-chip { display: flex; flex-direction: column; gap: 2px; }
.po-doc .po-chip-label { font-size: 7.5pt; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #000; }
.po-doc .po-chip-value { font-size: 9.5pt; font-weight: 600; border-bottom: 1px solid #b0b8c4; min-width: 36mm; padding-bottom: 2px; }
.po-doc .po-items-section { overflow-x: auto; }
.po-doc .po-items-table { width: 100%; border-collapse: collapse; margin: 6mm 0 0; border-bottom: 2px solid var(--primary, #1a4b8c); }
.po-doc .po-items-table thead tr { border-bottom: 2px solid var(--primary, #1a4b8c); }
.po-doc .po-items-table th { font-size: 8pt; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--primary, #1a4b8c); padding: 0 0 8px; text-align: left; }
.po-doc .po-items-table th.r,
.po-doc .po-items-table td.r { text-align: right; }
.po-doc .po-items-table td { padding: 7px 0; font-size: 10pt; vertical-align: middle; border-bottom: 1px dashed #000; }
.po-doc .po-items-table .num-col { width: 5%; }
.po-doc .po-items-table .item-col { width: 36%; font-weight: 600; }
.po-doc .po-items-table .qty-col { width: 8%; text-align: right; }
.po-doc .po-items-table .price-col { width: 14%; text-align: right; }
.po-doc .po-items-table .vat-col { width: 8%; text-align: right; }
.po-doc .po-items-table .total-col { width: 14%; text-align: right; }
.po-doc .po-totals-wrap { display: flex; justify-content: flex-end; padding: 2mm 0 0; }
.po-doc .po-totals-box { width: 72mm; margin-top: 4mm; }
.po-doc .po-totals-row { display: flex; justify-content: space-between; font-size: 10pt; padding: 4px 0; }
.po-doc .po-totals-row span:last-child { font-weight: 600; }
.po-doc .po-totals-grand { background: var(--primary, #1a4b8c); color: #fff; border-radius: 5px; padding: 8px 10px; margin-top: 4px; font-weight: 700; font-size: 12pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.po-doc .po-totals-grand span { color: #fff !important; }
.po-doc .po-notes-section { display: flex; gap: 8mm; padding: 8mm 0 4mm; }
.po-doc .po-notes-block { flex: 1; }
.po-doc .po-notes-label { font-size: 8pt; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--primary, #1a4b8c); margin-bottom: 4px; }
.po-doc .po-notes-body { font-size: 9pt; color: #000; line-height: 1.7; border-left: 3px solid var(--primary, #0e7c7b); padding-left: 8px; }
.po-doc .po-sig-row { display: flex; gap: 8mm; padding: 6mm 0 0; }
.po-doc .po-sig-box { flex: 1; border: 1px solid #b0b8c4; border-radius: 5px; height: 22mm; display: flex; flex-direction: column; justify-content: flex-end; padding: 6px 10px; }
.po-doc .po-sig-label { font-size: 7.5pt; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #000; border-top: 1px solid #b0b8c4; padding-top: 5px; margin-top: 6px; }
.po-doc .po-sig-box-sig .po-sig-label { border-top: none; }
.po-doc .po-sig-box-sig .po-sig-label::before { content: ""; display: block; width: 45%; border-top: 1px solid #b0b8c4; padding-bottom: 4px; }

.purchase-doc-container { max-width: 210mm; margin: 0 auto; padding: 6mm 8mm; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.08); border-radius: 4px; }
.purchase-preview-panel { margin: 0 auto 16px; max-width: 210mm; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08); overflow: hidden; }
.purchase-preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); background: #fff; }
.purchase-preview-toolbar h3 { margin: 0; font-size: 1rem; font-weight: 700; color: var(--text); }
.purchase-preview-body { min-height: 75vh; padding: 0; background: var(--surface-2); overflow: hidden; }
.purchase-preview-body iframe { display: block; width: 100%; height: 75vh; border: 0; background: #f3f4f6; }

.products-stock-status.is-low {
  color: var(--warning);
}

.products-stock-status.is-low .products-stock-dot {
  background: var(--warning);
}

.products-stock-status.is-out {
  color: var(--danger);
}

.products-stock-status.is-out .products-stock-dot {
  background: var(--danger);
}

.product-row-menu-item.danger {
  color: var(--danger);
}

.product-row-menu-item.danger:hover {
  background: var(--danger-soft);
}

[data-theme="dark"] .products-admin-page .products-table.data-table th {
  background: var(--surface-2);
}

.products-admin-page .product-editor-split {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr);
  gap: 14px;
  align-items: stretch;
}

.products-admin-page .product-editor-search-row {
  display: none;
}

.products-admin-page .product-editor-card.table-wrap {
  padding: 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 260px);
}

.products-admin-page .product-editor-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.products-admin-page .product-editor-card-head h4 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.products-admin-page .product-editor-card-body {
  padding: 12px;
  flex: 1;
  overflow: auto;
}

.products-admin-page .product-editor-items-card .product-editor-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.products-admin-page .product-editor-item-search {
  min-width: 0;
}

.products-admin-page .product-editor-items-shell {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.products-admin-page .product-editor-items-panel {
  flex: 0 1 auto;
  min-height: 300px;
  max-height: calc(100dvh - 330px);
  overflow-y: auto;
  border-bottom: 1px solid var(--border-soft);
}

.products-admin-page #productEditorItemsBody tr.product-editor-item-selected td {
  background: var(--primary-soft) !important;
}

.products-admin-page #productEditorItemsBody tr:last-child td {
  border-bottom: 1px solid var(--border-soft) !important;
}

.products-admin-page .product-editor-items-card.table-wrap {
  border-bottom: 1px solid var(--border);
  min-height: auto;
  align-self: start;
}

.products-admin-page .product-editor-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px 12px;
}

.products-admin-page .product-editor-grid .form-group {
  margin: 0;
}

.products-admin-page .product-editor-grid .pe-span-3 { grid-column: span 3; }
.products-admin-page .product-editor-grid .pe-span-6 { grid-column: 1 / -1; }

.products-admin-page .product-editor-grid-left {
  grid-template-columns: 1fr;
  gap: 10px;
}

.products-admin-page .product-editor-grid-left .pe-span-3,
.products-admin-page .product-editor-grid-left .pe-span-6 {
  grid-column: 1 / -1;
}

.products-admin-page .product-editor-actions {
  margin-top: 8px !important;
  margin-bottom: 12px !important;
}

.products-admin-page .product-editor-toggle-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.products-admin-page .product-editor-inline-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}

.products-admin-page .product-editor-inline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 10px;
}

.products-admin-page .product-editor-inline-head h4 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.products-admin-page .product-editor-card #scheduleRow {
  margin-top: 10px;
}

.products-admin-page .product-editor-mapping-card .product-editor-card-body {
  padding-top: 10px;
}

@media (max-width: 1280px) {
  .products-admin-page .product-editor-search-row {
    grid-template-columns: 1fr;
  }

  .products-admin-page .product-editor-split {
    grid-template-columns: 1fr;
  }

  .products-admin-page .product-editor-card.table-wrap {
    min-height: auto;
  }

  .main-content.products-admin-page.add-scroll-locked #productsAddPanel .product-editor-split {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .main-content.products-admin-page.add-scroll-locked #productsAddPanel .product-editor-search-row {
    grid-template-columns: 1fr;
  }

  .main-content.products-admin-page.add-scroll-locked #productsAddPanel .product-editor-settings-card {
    height: 100%;
  }

  .main-content.products-admin-page.add-scroll-locked #productsAddPanel .product-editor-items-card.table-wrap {
    height: 100%;
    min-height: 0;
  }

  .main-content.products-admin-page.add-scroll-locked #productsAddPanel .product-editor-settings-card .product-editor-card-body,
  .main-content.products-admin-page.add-scroll-locked #productsAddPanel .product-editor-items-panel {
    height: calc(100dvh - 218px);
    min-height: 0;
    max-height: none;
    overflow-y: auto;
  }
  .finance-petty-sheet-header {
    grid-template-columns: 1fr 1fr;
  }
  .finance-petty-sheet-title,
  .finance-petty-sheet-note {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .products-admin-page .product-editor-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .products-admin-page .product-editor-grid .pe-span-3,
  .products-admin-page .product-editor-grid .pe-span-6 {
    grid-column: 1 / -1;
  }

  .main-content.products-admin-page.add-scroll-locked #productsAddPanel .product-editor-items-card.table-wrap {
    min-height: 0;
  }

  .main-content.products-admin-page.add-scroll-locked #productsAddPanel .product-editor-settings-card .product-editor-card-body,
  .main-content.products-admin-page.add-scroll-locked #productsAddPanel .product-editor-items-panel {
    height: calc(100dvh - 218px);
    min-height: 0;
    max-height: none;
  }
}

/* Typography root — 1rem = 15px throughout the app */
/* font-size is intentionally NOT locked on body * so the type scale works */

.grn-meta-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* Products add/edit workbench: keep the list and settings panels stable and full-height. */
.main-content.products-admin-page.add-scroll-locked,
.main-content.products-admin-page.manage-scroll-locked {
  overflow: hidden;
}

.main-content.products-admin-page.add-scroll-locked .products-admin-surface,
.main-content.products-admin-page.manage-scroll-locked .products-admin-surface {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.main-content.products-admin-page.add-scroll-locked #productsAddPanel,
.main-content.products-admin-page.manage-scroll-locked #productsManagePanel,
.main-content.products-admin-page.add-scroll-locked .product-editor-workbench,
.main-content.products-admin-page.manage-scroll-locked .product-editor-workbench {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.main-content.products-admin-page .product-editor-toolbar-grid {
  flex: 0 0 auto;
}

.main-content.products-admin-page .product-editor-split-grid {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch !important;
  margin-bottom: 0 !important;
}

.main-content.products-admin-page .product-editor-card.table-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: auto;
  max-height: none;
}

.main-content.products-admin-page .product-editor-items-panel,
.main-content.products-admin-page .product-editor-settings-panel {
  flex: 1 1 auto;
  min-height: 0;
  height: auto !important;
  max-height: none !important;
  overflow-y: auto !important;
  overflow-x: hidden;
}

.main-content.products-admin-page .product-editor-settings-panel > div {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.main-content.products-admin-page .product-editor-settings-panel .product-editor-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: auto !important;
  margin-bottom: 0 !important;
  padding: 12px 0 0;
  background: var(--surface);
  border-top: 1px solid var(--border-soft);
}

@media (max-width: 900px) {
  .main-content.products-admin-page .product-editor-split-grid,
  .main-content.products-admin-page .product-editor-toolbar-grid {
    grid-template-columns: 1fr !important;
  }

  .main-content.products-admin-page .product-editor-split-grid {
    overflow-y: auto;
  }
}

@media (max-width: 1300px) {
  .grn-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .grn-meta-grid {
    grid-template-columns: 1fr;
  }
}

/* Dashboard React parity layer - scoped to the dashboard shell only */
.main-content.dashboard-scroll-locked {
  --dashboard-scrollbar-width: 10px;
  --dashboard-scrollbar-track: var(--bg-soft);
  --dashboard-scrollbar-thumb: rgba(183, 227, 255, 0.42);
  --dashboard-scrollbar-thumb-hover: #b7e3ff;
  padding: 10px 16px 20px;
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--dashboard-scrollbar-thumb) var(--dashboard-scrollbar-track);
  background: var(--app-bg);
}

.main-content.dashboard-scroll-locked:hover,
.main-content.dashboard-scroll-locked:focus-within {
  scrollbar-color: var(--dashboard-scrollbar-thumb-hover) var(--dashboard-scrollbar-track);
}

.main-content.dashboard-scroll-locked .page-header {
  display: none;
}

.main-content.dashboard-scroll-locked::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.main-content.dashboard-scroll-locked::-webkit-scrollbar-button {
  display: none;
}

.main-content.dashboard-scroll-locked::-webkit-scrollbar-track,
.main-content.dashboard-scroll-locked::-webkit-scrollbar-track-piece {
  background: var(--dashboard-scrollbar-track);
}

.main-content.dashboard-scroll-locked::-webkit-scrollbar-thumb {
  min-height: 48px;
  background: var(--dashboard-scrollbar-thumb);
  border: 2px solid var(--dashboard-scrollbar-track);
  border-radius: 999px;
}

.main-content.dashboard-scroll-locked:hover::-webkit-scrollbar,
.main-content.dashboard-scroll-locked:focus-within::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.main-content.dashboard-scroll-locked:hover::-webkit-scrollbar-track,
.main-content.dashboard-scroll-locked:hover::-webkit-scrollbar-track-piece,
.main-content.dashboard-scroll-locked:focus-within::-webkit-scrollbar-track,
.main-content.dashboard-scroll-locked:focus-within::-webkit-scrollbar-track-piece {
  background: var(--dashboard-scrollbar-track);
}

.main-content.dashboard-scroll-locked:hover::-webkit-scrollbar-thumb,
.main-content.dashboard-scroll-locked:focus-within::-webkit-scrollbar-thumb {
  background: var(--dashboard-scrollbar-thumb-hover);
  border: 2px solid var(--dashboard-scrollbar-track);
}

.main-content.dashboard-scroll-locked:hover::-webkit-scrollbar-thumb:hover,
.main-content.dashboard-scroll-locked:focus-within::-webkit-scrollbar-thumb:hover {
  background: var(--dashboard-scrollbar-thumb-hover);
}

.main-content.dashboard-scroll-locked.is-scrollbar-dragging,
.main-content.dashboard-scroll-locked.is-scrollbar-dragging * {
  user-select: none !important;
  -webkit-user-select: none !important;
  cursor: default !important;
}

.main-content.dashboard-scroll-locked.is-scrollbar-dragging ::selection,
.main-content.dashboard-scroll-locked.is-scrollbar-dragging *::selection {
  background: transparent;
  color: inherit;
}

.dashboard-hero-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(112px, auto));
  grid-template-areas:
    "calendar calendar calendar sales profit"
    "calendar calendar calendar expiring transactions";
  gap: 12px;
  margin-bottom: 0;
}

.dashboard-calendar-panel {
  grid-area: calendar;
  min-width: 0;
  padding: 14px;
  display: grid;
  grid-template-columns: 0.86fr 1.14fr;
  gap: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #f6faff 0%, #ffffff 26%);
  border: 1px solid var(--calendar-border, var(--border));
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
}

.dashboard-calendar-summary {
  min-width: 0;
  padding-right: 14px;
  border-right: 1px solid var(--calendar-border, var(--border));
  display: grid;
  align-content: start;
  gap: 10px;
}

.dashboard-calendar-summary h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.16rem;
  font-weight: 800;
  line-height: 1.12;
}

.dashboard-calendar-summary p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
}

.dashboard-calendar-stat-list {
  display: grid;
  gap: 8px;
}

.dashboard-calendar-stat {
  min-width: 0;
  min-height: 42px;
  padding: 7px 9px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--calendar-border, var(--border));
  border-radius: var(--card-radius);
}

.dashboard-calendar-stat-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
}

.dashboard-calendar-stat-icon.blue { background: var(--primary-soft); color: var(--primary); }
.dashboard-calendar-stat-icon.violet { background: #ede9fe; color: #7c3aed; }
.dashboard-calendar-stat-icon.green { background: var(--success-soft); color: var(--success); }

.dashboard-calendar-stat-icon svg,
.dashboard-calendar-controls svg,
.dashboard-mobile-accordion-toggle svg,
.card-title-with-icon svg,
.dashboard-mini-icon svg,
.dashboard-range-btn svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-calendar-stat-icon svg {
  width: 17px;
  height: 17px;
}

.dashboard-calendar-stat span span {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.15;
}

.dashboard-calendar-stat strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-calendar-month {
  min-width: 0;
  padding: 10px 10px 8px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 8px;
  background: linear-gradient(180deg, #eef5ff 0%, #ffffff 24%);
  border: 1px solid #dfe9f7;
  border-radius: var(--card-radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.dashboard-calendar-toolbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
}

.dashboard-calendar-toolbar strong {
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
}

.dashboard-calendar-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dashboard-calendar-controls button,
.dashboard-calendar-today {
  height: 28px;
  display: inline-grid;
  place-items: center;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--calendar-border, var(--border));
  border-radius: var(--card-radius);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.dashboard-calendar-controls button { width: 28px; }
.dashboard-calendar-controls svg { width: 16px; height: 16px; }
.dashboard-calendar-today { padding: 0 12px; font-size: 0.82rem; font-weight: 800; }

.dashboard-calendar-controls button:hover,
.dashboard-calendar-today:hover {
  background: var(--primary-soft);
  border-color: var(--primary-light);
  color: var(--primary-strong);
}

.dashboard-calendar-weekdays,
.dashboard-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.dashboard-calendar-weekdays {
  gap: 4px;
  padding: 8px 10px 10px;
  margin: 0 -10px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #e8f1ff 0%, #f5f9ff 100%);
  border-top: 1px solid rgba(191, 213, 242, 0.85);
  border-bottom: 1px solid rgba(210, 224, 244, 0.95);
}

.dashboard-calendar-weekdays span {
  text-align: center;
}

.dashboard-calendar-days {
  overflow: visible;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--calendar-grid-border, var(--border-soft));
  border-radius: var(--card-radius);
}

.dashboard-calendar-day {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  font: inherit;
  position: relative;
  min-width: 0;
  min-height: 25px;
  padding: 4px 5px;
  display: grid;
  align-content: start;
  gap: 2px;
  border-right: 1px solid var(--calendar-grid-border, var(--border-soft));
  border-bottom: 1px solid var(--calendar-grid-border, var(--border-soft));
  text-align: left;
  cursor: default;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
}

.dashboard-calendar-day.is-clickable {
  cursor: pointer;
}

.dashboard-calendar-day:nth-child(7n) { border-right: 0; }
.dashboard-calendar-day:nth-last-child(-n + 7) { border-bottom: 0; }
.dashboard-calendar-day:hover,
.dashboard-calendar-day:focus-visible {
  z-index: 3;
}

.dashboard-calendar-day-number {
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1;
}

.dashboard-calendar-day.muted .dashboard-calendar-day-number {
  color: var(--text-dim);
  font-weight: 400;
}

.dashboard-calendar-day.current .dashboard-calendar-day-number {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 8px;
  font-weight: 500;
}

.dashboard-calendar-event-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 8px;
}

.dashboard-calendar-event-dot,
.dashboard-calendar-tooltip-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  flex-shrink: 0;
  background: var(--primary);
}

.dashboard-calendar-event-dot.green,
.dashboard-calendar-tooltip-dot.green { background: var(--success); }
.dashboard-calendar-event-dot.violet,
.dashboard-calendar-tooltip-dot.violet { background: #7c3aed; }

.dashboard-calendar-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 30;
  width: min(180px, calc(100vw - 32px));
  min-width: 0;
  max-width: calc(100vw - 32px);
  padding: 8px 9px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--calendar-border, var(--border));
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 0);
  transition: opacity 0.12s ease;
}

.dashboard-calendar-day.is-top-row .dashboard-calendar-tooltip {
  top: calc(100% + 8px);
  bottom: auto;
  transform: translate(-50%, 0);
}

.dashboard-calendar-day.is-top-row .dashboard-calendar-tooltip::after {
  top: -5px;
  bottom: auto;
  border-right: 0;
  border-bottom: 0;
  border-left: 1px solid var(--calendar-border, var(--border));
  border-top: 1px solid var(--calendar-border, var(--border));
}

.dashboard-calendar-day.is-edge-left .dashboard-calendar-tooltip {
  left: 8px;
  transform: translate(0, 0);
}

.dashboard-calendar-day.is-edge-left .dashboard-calendar-tooltip::after {
  left: 18px;
}

.dashboard-calendar-day.is-edge-right .dashboard-calendar-tooltip {
  left: auto;
  right: 8px;
  transform: translate(0, 4px);
  transform: translate(0, 0);
}

.dashboard-calendar-day.is-edge-right .dashboard-calendar-tooltip::after {
  left: auto;
  right: 18px;
  transform: translateX(50%) rotate(45deg);
}

.dashboard-calendar-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% - 5px);
  width: 10px;
  height: 10px;
  background: var(--surface);
  border-right: 1px solid var(--calendar-border, var(--border));
  border-bottom: 1px solid var(--calendar-border, var(--border));
  transform: translateX(-50%) rotate(45deg);
  pointer-events: none;
}

.dashboard-calendar-day:hover .dashboard-calendar-tooltip,
.dashboard-calendar-day:focus-visible .dashboard-calendar-tooltip,
.dashboard-calendar-day.active .dashboard-calendar-tooltip {
  opacity: 1;
}

.dashboard-calendar-tooltip strong,
.dashboard-calendar-tooltip small {
  display: block;
  line-height: 1.15;
}

.dashboard-calendar-tooltip strong {
  font-size: 0.75rem;
  font-weight: 800;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.dashboard-calendar-tooltip small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 700;
  white-space: normal;
  overflow-wrap: anywhere;
}

.dashboard-hero-grid .kpi-card--sales { grid-area: sales; }
.dashboard-hero-grid .kpi-card--profit { grid-area: profit; }
.dashboard-hero-grid .kpi-card--expiring { grid-area: expiring; }
.dashboard-hero-grid .kpi-card--transactions { grid-area: transactions; }

.dashboard-hero-grid .kpi-card {
  position: relative;
  container-type: inline-size;
  min-height: 148px;
  padding: 14px 14px 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.dashboard-hero-grid .kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary-light);
}

.dashboard-hero-grid .kpi-card-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  position: relative;
  z-index: 1;
}

.dashboard-hero-grid .kpi-card-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kpi-card-copy {
  min-width: 0;
  max-width: 100%;
  display: grid;
  gap: 3px;
  position: relative;
  z-index: 1;
}

.kpi-card-art {
  position: absolute;
  top: 50%;
  right: 18px;
  width: 136px;
  height: 136px;
  color: rgba(255, 255, 255, 0.05);
  pointer-events: none;
  transform: translateY(-50%);
  z-index: 0;
}

.kpi-card-art svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-hero-grid .kpi-card--sales { background: linear-gradient(135deg, #2d8b96 0%, #286f7a 100%); }
.dashboard-hero-grid .kpi-card--profit { background: linear-gradient(135deg, #5a4aa0 0%, #4a3e83 100%); }
.dashboard-hero-grid .kpi-card--expiring { background: linear-gradient(135deg, #c95682 0%, #aa466e 100%); }
.dashboard-hero-grid .kpi-card--expiring { padding-bottom: 42px; }
.dashboard-hero-grid .kpi-card--transactions { background: linear-gradient(135deg, #3a9b67 0%, #317d57 100%); }

.dashboard-hero-grid .kpi-card--sales,
.dashboard-hero-grid .kpi-card--profit,
.dashboard-hero-grid .kpi-card--expiring,
.dashboard-hero-grid .kpi-card--transactions {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 22px rgba(32, 111, 122, 0.16);
}

.dashboard-hero-grid .kpi-card--sales::before,
.dashboard-hero-grid .kpi-card--profit::before,
.dashboard-hero-grid .kpi-card--expiring::before,
.dashboard-hero-grid .kpi-card--transactions::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 0% 100%, rgba(255, 255, 255, 0.1), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 55%);
  pointer-events: none;
}

.dashboard-hero-grid .kpi-card--sales .kpi-card-icon,
.dashboard-hero-grid .kpi-card--profit .kpi-card-icon,
.dashboard-hero-grid .kpi-card--expiring .kpi-card-icon,
.dashboard-hero-grid .kpi-card--transactions .kpi-card-icon {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.9);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.07));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 8px 16px rgba(0, 0, 0, 0.12);
}

.dashboard-hero-grid .kpi-card--sales .kpi-card-icon svg,
.dashboard-hero-grid .kpi-card--profit .kpi-card-icon svg,
.dashboard-hero-grid .kpi-card--expiring .kpi-card-icon svg,
.dashboard-hero-grid .kpi-card--transactions .kpi-card-icon svg {
  width: 22px;
  height: 22px;
}

.dashboard-hero-grid .kpi-card--sales .kpi-label,
.dashboard-hero-grid .kpi-card--profit .kpi-label,
.dashboard-hero-grid .kpi-card--expiring .kpi-label,
.dashboard-hero-grid .kpi-card--transactions .kpi-label {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.dashboard-hero-grid .kpi-card--sales .kpi-value,
.dashboard-hero-grid .kpi-card--profit .kpi-value,
.dashboard-hero-grid .kpi-card--expiring .kpi-value,
.dashboard-hero-grid .kpi-card--transactions .kpi-value {
  color: #fff;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.34rem, 1.45vw, 1.7rem);
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.dashboard-hero-grid .kpi-card--sales .kpi-note,
.dashboard-hero-grid .kpi-card--profit .kpi-note,
.dashboard-hero-grid .kpi-card--expiring .kpi-note,
.dashboard-hero-grid .kpi-card--transactions .kpi-note {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.82rem;
}

.kpi-card-mobile-new-sale,
.kpi-card-mobile-low-stock {
  display: none;
  text-decoration: none;
  color: inherit;
}

.kpi-card-action {
  grid-column: 1 / -1;
  justify-self: end;
  position: relative;
  z-index: 1;
}

.dashboard-hero-grid .kpi-card--expiring .kpi-card-action {
  position: absolute;
  right: 16px;
  bottom: 10px;
  min-height: 28px;
  height: 28px;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.26);
  color: #fff;
  line-height: 1;
  align-items: center;
}

.quick-actions-section {
  margin: 8px calc(-16px - var(--dashboard-scrollbar-width)) 16px -16px;
  padding: 12px calc(16px + var(--dashboard-scrollbar-width)) 12px 16px;
  background: transparent;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.main-content.dashboard-scroll-locked .quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.main-content.dashboard-scroll-locked .quick-action-card {
  min-height: 74px;
  padding: 14px 14px 14px 16px;
  display: grid;
  grid-template-columns: auto 1px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s, background 0.18s;
}

.main-content.dashboard-scroll-locked .quick-action-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary-light);
  background: #f9fcff;
}

.quick-action-card-icon,
.quick-action-arrow {
  display: grid;
  place-items: center;
  color: var(--primary);
}

.quick-action-card-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quick-action-arrow svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quick-action-separator {
  width: 1px;
  height: 40px;
  background: var(--border-soft);
}

.quick-action-card-title {
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.2;
}

.dashboard-analytics-grid,
.dashboard-data-grid,
.dashboard-summary-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.dashboard-analytics-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dashboard-data-grid { grid-template-columns: 1.25fr 1fr 1fr; }
.dashboard-summary-grid { grid-template-columns: 1fr; }

.dashboard-data-grid > .card {
  height: 276px;
  min-height: 276px;
  overflow: hidden;
}

.dashboard-data-grid > .card > .dashboard-mobile-accordion-body,
.dashboard-data-grid > .card > .dashboard-mobile-accordion-body > .dashboard-mobile-accordion-body-inner {
  height: 100%;
}

.dashboard-donut-layout.card-body,
.dashboard-activity-list.card-body {
  height: 100%;
  box-sizing: border-box;
}

.dashboard-data-grid .card-body {
  padding-top: 12px;
  padding-bottom: 12px;
}

.dashboard-data-grid .dashboard-shift-body {
  grid-template-columns: 1fr;
}
.dashboard-data-grid .dashboard-shift-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 12px;
}
.dashboard-data-grid .dashboard-shift-spacer {
  margin-top: 0;
}
.dashboard-data-grid .dashboard-shift-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-chart-card,
.dashboard-list-card,
.dashboard-table-card,
.dashboard-donut-card,
.dashboard-activity-card,
.dashboard-shift-card {
  min-width: 0;
}

.card-title-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.card-title-with-icon svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

.card-header-subtitle {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  margin-left: 2px;
}

.dashboard-chart-shell {
  padding-top: 6px;
  display: grid;
  gap: 10px;
}

.dashboard-chart-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.dashboard-chart-value {
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 800;
}

.dashboard-chart-label {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.dashboard-trend-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.dashboard-trend-btn {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.dashboard-trend-btn:hover {
  color: var(--text);
}

.dashboard-trend-btn.active {
  background: var(--surface);
  color: var(--primary-strong);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.16);
}

.dashboard-chart-wrap {
  position: relative;
}

.dashboard-chart {
  width: 100%;
  height: 190px;
  display: block;
  touch-action: pan-y;
}

.dashboard-chart-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 3.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-chart-line-projected {
  stroke-dasharray: 6 8;
  opacity: 0.48;
}

.dashboard-chart-area {
  opacity: 1;
}

.dashboard-chart-grid-line {
  stroke: var(--border-soft);
  stroke-width: 1;
}

.dashboard-chart-y-label {
  fill: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 700;
  text-anchor: end;
}

.dashboard-chart-dot {
  fill: #fff;
  stroke: var(--primary);
  stroke-width: 3;
}

.dashboard-chart-hover-line {
  stroke: var(--primary);
  stroke-width: 1.4;
  stroke-dasharray: 4 4;
  opacity: 0.5;
}

.dashboard-chart-hover-point {
  position: absolute;
  width: 12px;
  height: 12px;
  margin-left: 0;
  margin-top: 0;
  border-radius: 50%;
  background: var(--surface);
  border: 2.6px solid var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  pointer-events: none;
  z-index: 3;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
}

.dashboard-chart-axis {
  display: grid;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.dashboard-chart-axis span { text-align: center; }

.dashboard-chart-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-9999px, -9999px);
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--border);
  border-radius: 0.85em;
  box-shadow: var(--shadow-md);
  min-width: 96px;
  padding: 10px 12px;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.16s ease, transform 0.09s linear;
  will-change: transform;
}

.dashboard-chart-tooltip.show {
  opacity: 1;
}

.dashboard-chart-tooltip strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.1;
}

.dashboard-chart-tooltip span {
  display: block;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.15;
}

[data-theme="dark"] .dashboard-chart-tooltip {
  background: rgba(17, 24, 39, 0.96);
}

.dashboard-stack-list {
  display: grid;
}

.main-content.dashboard-scroll-locked #dashStockAlertList.dashboard-stack-list {
  overflow: visible;
}

.dashboard-stack-list-item {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  overflow: hidden;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.dashboard-stack-list-item--action {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  margin: 0;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dashboard-stack-list-item--action:focus-visible {
  z-index: 2;
  outline: 2px solid rgba(2, 132, 199, 0.32);
  outline-offset: -2px;
}

.dashboard-stack-list-item:hover {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.08) 0%, rgba(37, 99, 235, 0.035) 100%);
}

.dashboard-stack-list-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: transparent;
  transition: background-color 0.18s ease;
}

.dashboard-stack-list-item:hover::before {
  background: #93c5fd;
}

.dashboard-stack-list-item:last-child { border-bottom: 0; }

.dashboard-mini-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #64748b;
  background: #eef2f7;
  border-radius: 9px;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.dashboard-mini-icon svg {
  width: 16px;
  height: 16px;
}

.dashboard-stack-list-item:hover .dashboard-mini-icon {
  color: #2563eb;
  background: #dbeafe;
}

.dashboard-stack-list-title {
  display: block;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.25;
}

.dashboard-count-badge {
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  background: #eef2f7;
  border-radius: 9px;
  font-size: 0.74rem;
  font-weight: 800;
}

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
}

.dashboard-table thead th {
  text-align: left;
  padding: 0 0 10px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dashboard-table tbody td {
  padding: 11px 0;
  color: var(--text);
  border-top: 1px solid var(--border-soft);
  font-size: 0.86rem;
  vertical-align: middle;
}

.dashboard-table tbody tr:first-child td { border-top: 0; }
.dashboard-table tbody tr:hover td { background: rgba(37, 99, 235, 0.03); }

.dashboard-donut-layout {
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  gap: 14px;
  height: 100%;
  align-items: start;
  align-content: start;
}

.dashboard-donut {
  width: 142px;
  aspect-ratio: 1;
  margin: 0 auto 0 0;
  position: relative;
  border-radius: 50%;
  background: conic-gradient(#16a34a 0 26.5%, #2563eb 26.5% 89.4%, #7c3aed 89.4% 100%);
}

.dashboard-donut-hole {
  position: absolute;
  inset: 29%;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--border-soft);
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  line-height: 1.05;
  z-index: 1;
}
.dashboard-donut-hole strong {
  color: #111c3d;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: -0.02em;
  max-width: 54px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-donut-hole span {
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 800;
  text-transform: lowercase;
}

.dashboard-legend {
  display: grid;
  gap: 10px;
  height: 100%;
  min-width: 0;
  align-items: stretch;
  align-content: stretch;
  grid-auto-rows: 1fr;
}

.dashboard-legend-item {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  font-size: 0.82rem;
}

.dashboard-legend-key {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.dashboard-legend-label {
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.dashboard-legend-value {
  margin-left: auto;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  text-align: right;
}

.dashboard-legend-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 6px;
  margin-top: 4px;
  border-top: 1px solid var(--border-soft);
}

.dashboard-legend-total span {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.dashboard-legend-total strong {
  color: var(--primary);
  font-size: 0.94rem;
}

.dashboard-activity-list {
  display: grid;
  gap: 0;
  height: 100%;
  overflow-y: auto;
  align-items: start;
  align-content: start;
  grid-auto-rows: max-content;
  padding-top: 0;
}

.main-content.dashboard-scroll-locked #dashRecentSales.dashboard-activity-list {
  display: grid;
  overflow: hidden;
}

.dashboard-activity-item {
  display: grid;
  grid-template-columns: 58px auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--border-soft);
}

.dashboard-activity-item:first-child { border-top: 0; }

.dashboard-empty-note {
  padding: 18px 4px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}

.dashboard-activity-time {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.dashboard-activity-title {
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.15;
}

.dashboard-activity-meta {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.15;
}

.dashboard-activity-amount {
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.dashboard-activity-item .dashboard-mini-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
}

.dashboard-activity-item .dashboard-mini-icon svg {
  width: 14px;
  height: 14px;
}

.dashboard-shift-body {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  align-items: start;
}

.dashboard-shift-label {
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dashboard-shift-value {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 800;
}

.dashboard-shift-spacer { margin-top: 12px; }

.dashboard-shift-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-shift-stat {
  padding: 9px 12px;
  display: grid;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--card-radius);
}

.dashboard-shift-stat span {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.dashboard-shift-stat strong {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 800;
}

.dashboard-shift-stat.accent strong { color: var(--primary); }

.dashboard-mobile-accordion-body { display: block; }
.dashboard-mobile-accordion-toggle { display: none; }

[data-theme="dark"] .main-content.dashboard-scroll-locked::-webkit-scrollbar-track,
[data-theme="dark"] .main-content.dashboard-scroll-locked::-webkit-scrollbar-track-piece {
  background: var(--surface);
}

[data-theme="dark"] .main-content.dashboard-scroll-locked::-webkit-scrollbar-thumb {
  background: rgba(183, 227, 255, 0.32);
  border-color: var(--surface);
}

[data-theme="dark"] .main-content.dashboard-scroll-locked:hover::-webkit-scrollbar-track,
[data-theme="dark"] .main-content.dashboard-scroll-locked:hover::-webkit-scrollbar-track-piece,
[data-theme="dark"] .main-content.dashboard-scroll-locked:focus-within::-webkit-scrollbar-track,
[data-theme="dark"] .main-content.dashboard-scroll-locked:focus-within::-webkit-scrollbar-track-piece {
  background: var(--surface);
}

[data-theme="dark"] .main-content.dashboard-scroll-locked:hover::-webkit-scrollbar-thumb,
[data-theme="dark"] .main-content.dashboard-scroll-locked:focus-within::-webkit-scrollbar-thumb {
  background: rgba(183, 227, 255, 0.26);
  border-color: var(--surface);
}

[data-theme="dark"] .dashboard-calendar-panel,
[data-theme="dark"] .dashboard-calendar-month,
[data-theme="dark"] .dashboard-hero-grid .kpi-card--sales,
[data-theme="dark"] .dashboard-hero-grid .kpi-card--profit,
[data-theme="dark"] .dashboard-hero-grid .kpi-card--expiring,
[data-theme="dark"] .dashboard-hero-grid .kpi-card--transactions {
  background: linear-gradient(180deg, #262626 0%, #222222 100%);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .dashboard-hero-grid .kpi-card--sales .kpi-card-icon,
[data-theme="dark"] .dashboard-hero-grid .kpi-card--profit .kpi-card-icon,
[data-theme="dark"] .dashboard-hero-grid .kpi-card--expiring .kpi-card-icon,
[data-theme="dark"] .dashboard-hero-grid .kpi-card--transactions .kpi-card-icon {
  color: #60a5fa;
  background: #18283f;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .dashboard-hero-grid .kpi-card--sales .kpi-label,
[data-theme="dark"] .dashboard-hero-grid .kpi-card--profit .kpi-label,
[data-theme="dark"] .dashboard-hero-grid .kpi-card--expiring .kpi-label,
[data-theme="dark"] .dashboard-hero-grid .kpi-card--transactions .kpi-label,
[data-theme="dark"] .dashboard-hero-grid .kpi-card--sales .kpi-note,
[data-theme="dark"] .dashboard-hero-grid .kpi-card--profit .kpi-note,
[data-theme="dark"] .dashboard-hero-grid .kpi-card--expiring .kpi-note,
[data-theme="dark"] .dashboard-hero-grid .kpi-card--transactions .kpi-note {
  color: #94a3b8;
}

[data-theme="dark"] .dashboard-calendar-weekdays {
  background: linear-gradient(180deg, #252b34 0%, #202329 100%);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .dashboard-calendar-days {
  background: #202020;
}

[data-theme="dark"] .quick-actions-section {
  background: rgba(38, 38, 38, 0.58);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .main-content.dashboard-scroll-locked .quick-action-card:hover {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.32);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
  color: #f8fafc;
}

[data-theme="dark"] .main-content.dashboard-scroll-locked .quick-action-card:hover .quick-action-card-title {
  color: #f8fafc;
}

[data-theme="dark"] .dashboard-stack-list-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .dashboard-mini-icon,
[data-theme="dark"] .dashboard-count-badge {
  color: #cbd5e1;
  background: #263241;
}

[data-theme="dark"] .dashboard-stack-list-item:hover .dashboard-mini-icon,
[data-theme="dark"] .dashboard-stack-list-item:hover .dashboard-count-badge {
  color: #f8fafc;
  background: #334155;
}

@media (max-width: 1320px) {
  .dashboard-hero-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-areas:
      "calendar calendar sales profit"
      "calendar calendar expiring transactions";
  }

  .dashboard-calendar-panel {
    grid-template-columns: 1fr;
  }

  .dashboard-calendar-summary {
    padding-right: 0;
    padding-bottom: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .dashboard-data-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-activity-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1100px) {
  .main-content.dashboard-scroll-locked .quick-actions-grid,
  .dashboard-analytics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-action-card--reports,
  .dashboard-chart-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .dashboard-hero-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "sales profit"
      "expiring transactions"
      "low new-sale";
  }

  .dashboard-calendar-panel {
    display: none;
  }

  .kpi-card-mobile-low-stock {
    display: grid;
    grid-area: low;
  }

  .kpi-card-mobile-new-sale {
    display: grid;
    grid-area: new-sale;
  }

  .dashboard-analytics-grid,
  .dashboard-data-grid,
  .dashboard-summary-grid,
  .main-content.dashboard-scroll-locked .quick-actions-grid,
  .dashboard-shift-body,
  .dashboard-shift-stats {
    grid-template-columns: 1fr;
  }

  .quick-action-card--reports,
  .dashboard-chart-card,
  .dashboard-activity-card {
    grid-column: auto;
  }

  .dashboard-mobile-accordion-toggle {
    display: inline-grid;
    width: 30px;
    height: 30px;
    place-items: center;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1em;
  }

  .dashboard-mobile-accordion:not(.is-open) .dashboard-mobile-accordion-body {
    display: none;
  }
}

@media (max-width: 640px) {
  .main-content.dashboard-scroll-locked {
    padding: 10px 10px 74px;
  }

  .dashboard-hero-grid {
    grid-template-columns: 1fr;
    grid-template-areas: "sales" "profit" "expiring" "transactions" "low" "new-sale";
  }

  .quick-actions-section {
    margin-inline: -10px;
    padding-inline: 10px;
  }

  .dashboard-donut-layout,
  .dashboard-activity-item {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) {
  .kpi-card-mobile-low-stock,
  .kpi-card-mobile-new-sale {
    display: none !important;
  }
}

/* Navigation React parity layer */
:root {
  --sidebar-w: clamp(190px, 15vw, 224px);
  --sidebar-bg: #f9f9f9;
  --sidebar-bg2: #f9f9f9;
  --sidebar-border: rgba(15, 23, 42, 0.1);
  --sidebar-text: #000000;
  --sidebar-text-dim: #000000;
  --sidebar-active-bg: #0068b3;
  --sidebar-active-accent: #ffffff;
  --sidebar-hover-bg: rgba(117, 162, 211, 0.16);
}

[data-theme="dark"] {
  --sidebar-bg: #1a1a1a;
  --sidebar-bg2: #232323;
  --sidebar-border: rgba(255, 255, 255, 0.1);
  --sidebar-text: #ffffff;
  --sidebar-text-dim: rgba(255, 255, 255, 0.72);
  --sidebar-hover-bg: rgba(56, 189, 248, 0.12);
  --sidebar-active-bg: #38bdf8;
  --sidebar-active-accent: #38bdf8;
}

.desktop-sidebar {
  width: var(--sidebar-w);
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg2) 100%);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: none;
  transition: width 0.22s ease;
}

.desktop-sidebar.is-collapsed {
  width: 72px;
}

.sidebar-brand {
  gap: 8px;
  padding: 14px 12px 10px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: 0;
}

.sidebar-logo svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.sidebar-brand-text h1 {
  margin: 0;
  color: #111827;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.1;
}

[data-theme="dark"] .sidebar-brand-text h1 {
  color: #fff;
}

.sidebar-brand-text p {
  margin: 2px 0 0;
  color: var(--sidebar-text-dim);
  font-size: 0.82rem;
}

.sidebar-collapse-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--sidebar-text);
  transition: color 0.15s, background 0.15s;
}

.sidebar-collapse-btn:hover {
  color: var(--sidebar-active-accent);
  background: rgba(238, 245, 255, 0.7);
}

.sidebar-collapse-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.9;
}

.sidebar-nav {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 0 12px 12px 6px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  scrollbar-gutter: stable;
  user-select: none;
  -webkit-user-select: none;
}

.sidebar-nav::-webkit-scrollbar {
  width: 0;
}

.sidebar-nav:hover,
.sidebar-nav:focus-within {
  scrollbar-width: thin;
  scrollbar-color: #75a2d3 rgba(117, 162, 211, 0.26);
}

.sidebar-nav:hover::-webkit-scrollbar,
.sidebar-nav:focus-within::-webkit-scrollbar {
  width: 10px;
}

.sidebar-nav:hover::-webkit-scrollbar-track,
.sidebar-nav:focus-within::-webkit-scrollbar-track {
  background: rgba(117, 162, 211, 0.26);
  border-radius: 999px;
}

.sidebar-nav:hover::-webkit-scrollbar-thumb,
.sidebar-nav:focus-within::-webkit-scrollbar-thumb {
  background-color: #75a2d3;
  border: 2px solid rgba(7, 18, 38, 0.28);
  border-radius: 999px;
  background-clip: padding-box;
}

.sidebar-nav-label {
  display: block;
  padding: 10px 10px 4px;
  color: var(--sidebar-text-dim);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  user-select: none;
  -webkit-user-select: none;
}

.sidebar-nav-label--main-menu {
  color: #335f95;
}

.sidebar-nav-label--purchasing,
.sidebar-nav-label--inventory,
.sidebar-nav-label--customers,
.sidebar-nav-label--business,
.sidebar-nav-label--compliance,
.sidebar-nav-label--insights {
  color: #4774aa;
}

.sidebar-category-divider {
  height: 1px;
  margin: 6px 10px 2px;
  background: var(--sidebar-border);
  opacity: 0.95;
}

.nav-btn {
  position: relative;
  overflow: hidden;
  min-height: 28px;
  gap: 9px;
  padding: 4px 8px;
  color: var(--sidebar-text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.5em;
  font-size: 0.93rem;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.nav-btn svg {
  width: 14px;
  height: 14px;
  opacity: 1;
  fill: none;
  stroke: currentColor;
}

.nav-btn:hover {
  color: #0d1b2a;
  background: var(--sidebar-hover-bg);
  border-color: rgba(117, 162, 211, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .nav-btn:hover,
[data-theme="dark"] .nav-group-toggle:hover,
[data-theme="dark"] .nav-sub-btn:hover,
[data-theme="dark"] .sidebar-footer-btn:hover {
  color: #eaf6ff;
  background: var(--sidebar-hover-bg);
  border-color: rgba(56, 189, 248, 0.32);
}

[data-theme="dark"] .nav-btn:hover svg,
[data-theme="dark"] .nav-group-toggle:hover svg,
[data-theme="dark"] .nav-sub-btn:hover svg,
[data-theme="dark"] .sidebar-footer-btn:hover svg {
  color: #7dd3fc;
}

.nav-btn.active,
.nav-sub-btn.active,
.sidebar-footer-btn.active {
  color: var(--sidebar-active-accent);
  background: var(--sidebar-active-bg);
}

[data-theme="dark"] .nav-btn.active,
[data-theme="dark"] .nav-sub-btn.active,
[data-theme="dark"] .sidebar-footer-btn.active {
  color: #000;
}

[data-theme="dark"] .nav-btn.active::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 0;
  width: 4px;
  height: calc(100% - 14px);
  min-height: 14px;
  border-radius: 999px 0 0 999px;
  background: var(--sidebar-active-accent);
}

.sidebar-footer {
  height: 1px;
  min-height: 1px;
  margin: 0 12px 10px;
  padding: 0;
  background: var(--sidebar-border);
  border-top: 0;
}

.desktop-sidebar.is-collapsed .sidebar-brand {
  justify-content: center;
  gap: 0;
  padding: 14px 0 10px;
}

.desktop-sidebar.is-collapsed .sidebar-logo {
  display: none;
}

.desktop-sidebar.is-collapsed .sidebar-brand-text,
.desktop-sidebar.is-collapsed .sidebar-nav-label,
.desktop-sidebar.is-collapsed .nav-btn > span:not(.nav-badge),
.desktop-sidebar.is-collapsed .nav-sub-btn,
.desktop-sidebar.is-collapsed .nav-group-toggle,
.desktop-sidebar.is-collapsed .sidebar-footer-btn > span:not(.sync-dot) {
  display: none;
}

.desktop-sidebar.is-collapsed .sidebar-collapse-btn {
  margin-left: 0;
}

.desktop-sidebar.is-collapsed .nav-btn,
.desktop-sidebar.is-collapsed .sidebar-footer-btn {
  justify-content: center;
  gap: 0;
}

.mobile-sidebar-backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  transition: opacity 0.25s;
}

.mobile-sidebar {
  width: min(70vw, 208px);
  background: var(--sidebar-bg);
  box-shadow: 6px 0 32px rgba(0, 0, 0, 0.3);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.mobile-sidebar .sidebar-nav-label {
  padding: 10px 8px 4px;
}

.mobile-sidebar .nav-btn {
  min-height: 32px;
  padding: 6px 8px;
}

/* Modern dropdown treatment across native selects and custom menus. */
select:not([multiple]),
.select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  border-radius: 8px;
  border-color: color-mix(in srgb, var(--border) 82%, var(--text-muted));
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 16px 16px;
  padding-right: 38px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

select:not([multiple]):hover,
.select:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  background-color: color-mix(in srgb, var(--surface) 92%, var(--primary-soft));
}

select:not([multiple]):focus,
.select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent), 0 1px 2px rgba(15, 23, 42, 0.06);
}

select:not([multiple]):disabled,
.select:disabled {
  cursor: not-allowed;
  color: var(--text-dim);
  background-color: var(--surface-2);
  opacity: 0.75;
}

select option {
  color: var(--text);
  background: var(--surface);
}

.topbar-alert-dropdown,
.dashboard-user-dropdown,
.product-row-menu,
.pos-category-menu,
.dispensing-dropdown,
#purchaseEntryPanel .purchase-quick-dropdown,
.purchase-product-dropdown {
  border-radius: 8px;
  border-color: color-mix(in srgb, var(--border) 86%, var(--text-muted));
  background: var(--surface);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.08);
}

.product-row-menu-item,
.pos-category-menu-item,
.dispensing-dropdown-item,
#purchaseEntryPanel .purchase-quick-option,
.purchase-product-dropdown .purchase-product-option,
.dashboard-user-dropdown-item {
  border-radius: 6px;
}

.product-row-menu-item:hover,
.pos-category-menu-item:hover,
.pos-category-menu-item.active,
.dispensing-dropdown-item:hover,
#purchaseEntryPanel .purchase-quick-option:hover,
#purchaseEntryPanel .purchase-quick-option.active,
.purchase-product-dropdown .purchase-product-option:hover,
.purchase-product-dropdown .purchase-product-option.highlight,
.dashboard-user-dropdown-item:hover {
  background: color-mix(in srgb, var(--primary) 11%, var(--surface));
  color: var(--primary);
}

.pos-category-menu,
#purchaseEntryPanel .purchase-quick-dropdown,
.purchase-product-dropdown {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--primary) 42%, var(--border)) transparent;
}

[data-theme="dark"] select:not([multiple]),
[data-theme="dark"] .select {
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  border-color: color-mix(in srgb, var(--border) 82%, #94a3b8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] select:not([multiple]):hover,
[data-theme="dark"] .select:hover {
  background-color: color-mix(in srgb, var(--surface) 88%, var(--primary));
  border-color: color-mix(in srgb, var(--primary) 52%, var(--border));
}

[data-theme="dark"] .topbar-alert-dropdown,
[data-theme="dark"] .dashboard-user-dropdown,
[data-theme="dark"] .product-row-menu,
[data-theme="dark"] .pos-category-menu,
[data-theme="dark"] .dispensing-dropdown,
[data-theme="dark"] #purchaseEntryPanel .purchase-quick-dropdown,
[data-theme="dark"] .purchase-product-dropdown {
  border-color: color-mix(in srgb, var(--border) 78%, #94a3b8);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
}

.app-select-wrap {
  position: relative;
  display: inline-block;
  min-width: 0;
  vertical-align: middle;
}

.app-select-native {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.app-select-button {
  width: 100%;
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0.4rem 12px 0.4rem 14px;
  border: 1.5px solid color-mix(in srgb, var(--border) 82%, var(--text-muted));
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  line-height: 1.35;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.app-select-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-select-chevron {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--primary);
  transition: transform 0.16s ease;
}

.app-select-wrap.open .app-select-chevron {
  transform: rotate(180deg);
}

.app-select-button:hover,
.app-select-wrap.open .app-select-button {
  border-color: color-mix(in srgb, var(--primary) 52%, var(--border));
  background: color-mix(in srgb, var(--surface) 92%, var(--primary-soft));
  color: var(--primary);
}

.app-select-button:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent), 0 1px 2px rgba(15, 23, 42, 0.06);
}

.app-select-button:disabled {
  cursor: not-allowed;
  color: var(--text-dim);
  background: var(--surface-2);
  opacity: 0.75;
}

.app-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 500;
  display: none;
  min-width: max(100%, 190px);
  max-width: min(360px, calc(100vw - 24px));
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 4px 6px rgba(15, 23, 42, 0.06), 0 16px 36px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.08);
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--primary) 42%, var(--border)) transparent;
}

.app-select-wrap.open .app-select-menu,
.app-select-menu.is-open {
  display: grid;
  gap: 4px;
}

.app-select-option {
  width: 100%;
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #12345c;
  cursor: pointer;
  font: inherit;
  font-size: 0.8667rem;
  font-weight: 700;
  line-height: 1.25;
  padding: 6px 10px;
  text-align: left;
  white-space: nowrap;
}

.app-select-option:hover,
.app-select-option.active {
  background: #eef5ff;
  color: var(--primary);
}

.app-select-option:disabled {
  cursor: not-allowed;
  color: var(--text-dim);
  opacity: 0.65;
}

.checkout-payment-method-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.checkout-payment-pill {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--border) 82%, var(--text-muted));
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.checkout-payment-pill:hover,
.checkout-payment-pill.active {
  border-color: color-mix(in srgb, var(--primary) 54%, var(--border));
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 8%, transparent);
}

[data-theme="dark"] .checkout-payment-pill {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--border) 78%, #94a3b8);
  color: var(--text);
}

[data-theme="dark"] .checkout-payment-pill:hover,
[data-theme="dark"] .checkout-payment-pill.active {
  border-color: color-mix(in srgb, var(--primary) 52%, var(--border));
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
}

.table-toolbar .app-select-button,
body.density-compact .main-content .app-select-button {
  min-height: 2.25rem;
  font-size: 0.8667rem;
}

.products-filter-row .app-select-wrap {
  width: 170px;
  min-width: 170px;
}

.products-pricelist-bulk .app-select-wrap,
.manage-products-row .app-select-wrap {
  min-width: 160px;
}

[data-theme="dark"] .app-select-button {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--border) 78%, #94a3b8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .app-select-menu {
  border-color: var(--border);
  background: var(--surface);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.24), 0 18px 42px rgba(0, 0, 0, 0.36);
}

[data-theme="dark"] .app-select-option {
  color: var(--text);
}

[data-theme="dark"] .app-select-option:hover,
[data-theme="dark"] .app-select-option.active {
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
}

/* Long-Term Patients panel must be global because soft navigation swaps body content, not page <head> styles. */
#longTermPatientsPanel .ltp-dashboard-grid {
  display: grid;
  grid-template-columns: 1.7fr repeat(4, minmax(0, 0.82fr));
  gap: 10px;
  margin-bottom: 14px;
}

#longTermPatientsPanel .ltp-stat-card {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 12px 13px;
}

#longTermPatientsPanel .ltp-stat-label {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

#longTermPatientsPanel .ltp-stat-value {
  margin-top: 7px;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 800;
  color: var(--text);
}

#longTermPatientsPanel .ltp-stat-value.warning {
  color: var(--warning);
}

#longTermPatientsPanel .ltp-upcoming-card {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 12px 14px;
  margin-bottom: 0;
  grid-column: span 1;
}

#longTermPatientsPanel .ltp-upcoming-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}

#longTermPatientsPanel .ltp-upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#longTermPatientsPanel .ltp-upcoming-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--warning);
  border-radius: var(--r-md);
  padding: 10px 12px;
  background: var(--surface);
}

#longTermPatientsPanel .ltp-upcoming-name {
  font-weight: 800;
  color: var(--text);
  font-size: 0.9rem;
}

#longTermPatientsPanel .ltp-upcoming-drug {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

#longTermPatientsPanel .ltp-upcoming-days {
  font-size: 1rem;
  font-weight: 800;
  color: var(--warning);
  text-align: right;
  white-space: nowrap;
}

#longTermPatientsPanel .ltp-upcoming-date {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
  text-align: right;
  white-space: nowrap;
}

#pendingCollectionPanel .pc-drug-field,
#longTermPatientsPanel .ltp-drug-field {
  position: relative;
}

#pendingCollectionPanel .pc-drug-dropdown,
#longTermPatientsPanel .ltp-drug-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  max-height: 220px;
  overflow: auto;
  display: none;
}

#pendingCollectionPanel .pc-drug-dropdown.open,
#longTermPatientsPanel .ltp-drug-dropdown.open {
  display: block;
}

#pendingCollectionPanel .pc-drug-option,
#longTermPatientsPanel .ltp-drug-option {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border-soft);
  background: transparent;
  text-align: left;
  padding: 9px 12px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
}

#pendingCollectionPanel .pc-drug-option:last-child,
#longTermPatientsPanel .ltp-drug-option:last-child {
  border-bottom: none;
}

#pendingCollectionPanel .pc-drug-option:hover,
#longTermPatientsPanel .ltp-drug-option:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

#pendingCollectionPanel .pc-drug-empty,
#longTermPatientsPanel .ltp-drug-empty {
  padding: 10px 12px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

@media (max-width: 980px) {
  #longTermPatientsPanel .ltp-dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  #longTermPatientsPanel .ltp-dashboard-grid {
    grid-template-columns: 1fr;
  }

  #longTermPatientsPanel .ltp-upcoming-card {
    grid-column: span 1;
  }

  #longTermPatientsPanel .ltp-upcoming-item {
    flex-direction: column;
    align-items: flex-start;
  }

  #longTermPatientsPanel .ltp-upcoming-days,
  #longTermPatientsPanel .ltp-upcoming-date {
    text-align: left;
  }
}

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD REDESIGN
   ═══════════════════════════════════════════════════════════════ */
.main-content.dashboard-page {
  overflow: auto;
  padding: 18px 18px 24px;
  background:
    radial-gradient(circle at top right, rgba(31, 99, 255, 0.10), transparent 24%),
    radial-gradient(circle at 14% 0%, rgba(37, 99, 235, 0.08), transparent 18%),
    linear-gradient(180deg, #fbfdff 0%, #f5f8ff 100%);
}
.main-content.dashboard-page .dashboard-shell {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.main-content.dashboard-page .card {
  border-color: rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.main-content.dashboard-page .card-body {
  padding: 18px;
}
.dashboard-intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.95fr);
  gap: 16px;
  align-items: stretch;
}
.dashboard-intro {
  padding: 14px 2px;
}
.dashboard-eyebrow {
  color: #1f63ff;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.dashboard-intro h2 {
  font-size: clamp(1.6rem, 2.8vw, 2.45rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
}
.dashboard-intro p {
  color: var(--text-muted);
  font-size: 1rem;
  margin: 0 0 12px;
}
.dashboard-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: var(--text-muted);
  font-size: 0.96rem;
  font-weight: 600;
}
.dashboard-meta-row strong {
  color: var(--text);
  font-weight: 700;
}
.dashboard-card-header {
  padding: 14px 18px 10px;
}
.dashboard-card-header h3 {
  font-size: 1rem;
  font-weight: 800;
}
.dashboard-card-subtitle {
  color: var(--text-muted);
  font-size: 0.85em;
  font-weight: 600;
}
.dashboard-calendar-nav {
  display: flex;
  gap: 8px;
}
.dashboard-calendar-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: var(--surface);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.dashboard-calendar-btn:hover {
  transform: translateY(-1px);
  border-color: #1f63ff;
  color: #1f63ff;
  background: #e8f0ff;
}
.dashboard-calendar-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dashboard-calendar-body {
  padding-top: 4px !important;
}
.dashboard-calendar-weekdays,
.dashboard-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.dashboard-calendar-weekdays {
  padding: 0 2px 10px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.dashboard-calendar-day {
  min-height: 28px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--text);
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(148, 163, 184, 0.14);
  font-size: 0.82rem;
  font-weight: 700;
}
.dashboard-calendar-day.muted {
  background: transparent;
  border-color: transparent;
  color: transparent;
}
.dashboard-calendar-day.today {
  background: #1f63ff;
  border-color: #1f63ff;
  color: #fff;
  box-shadow: 0 10px 22px rgba(31, 99, 255, 0.22);
}
.dashboard-calendar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
}
.dashboard-calendar-footer-icon {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: #e8f0ff;
  color: #1f63ff;
}
.dashboard-calendar-footer-icon svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dashboard-kpi-grid {
  gap: 12px;
}
.main-content.dashboard-page .dashboard-kpi-grid .kpi-card {
  padding: 10px 18px 14px;
  min-height: 136px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.main-content.dashboard-page .dashboard-kpi-grid .kpi-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  margin-bottom: 12px;
}
.main-content.dashboard-page .dashboard-kpi-grid .kpi-label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.92rem;
  margin-bottom: 2px;
  color: var(--text-muted);
}
.main-content.dashboard-page .dashboard-kpi-grid .kpi-value {
  font-size: clamp(1.4rem, 2vw, 1.8rem);
}
.main-content.dashboard-page .dashboard-kpi-grid .kpi-note {
  margin-top: 8px;
  font-size: 0.82rem;
}
.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(290px, 0.82fr);
  gap: 16px;
  align-items: start;
}
.dashboard-main-col,
.dashboard-side-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dashboard-side-col .mb-5 {
  margin-bottom: 0 !important;
}
.dashboard-primary-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 16px;
}
.dashboard-trend-card .card-body {
  padding-top: 8px;
}
.dashboard-trend-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 700;
}
.dashboard-trend-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.line-swatch {
  width: 16px;
  height: 3px;
  border-radius: 999px;
  display: inline-block;
}
.line-swatch.today {
  background: linear-gradient(90deg, #1f63ff, #0f4ed8);
}
.line-swatch.yesterday {
  background: repeating-linear-gradient(90deg, #8da0c2 0 5px, transparent 5px 9px);
}
.dashboard-period-pill {
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  height: 30px;
  padding: 0 12px;
  font-size: 0.84rem;
  font-weight: 700;
}
.dashboard-chart-body {
  padding-top: 8px;
}
.dashboard-trend-chart {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}
.dashboard-chart-bg {
  fill: transparent;
}
.dashboard-chart-gridline {
  stroke: rgba(148, 163, 184, 0.18);
  stroke-width: 1;
}
.dashboard-chart-axis-label {
  fill: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}
.dashboard-chart-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dashboard-chart-line.today {
  stroke: #1f63ff;
}
.dashboard-chart-line.yesterday {
  stroke: #92a2c8;
  stroke-dasharray: 7 7;
  stroke-width: 2.5;
  opacity: 0.9;
}
.dashboard-chart-fill {
  fill: rgba(31, 99, 255, 0.05);
  stroke: none;
}
.dashboard-quick-actions {
  gap: 10px;
}
.dashboard-quick-actions .quick-action-card {
  border-radius: 16px;
  padding: 16px 12px;
  min-height: 96px;
  justify-content: center;
}
.dashboard-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr) minmax(0, 1.2fr);
  gap: 16px;
}
.dashboard-payment-body {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}
.dashboard-donut {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
}
.dashboard-donut::before {
  content: "";
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.28);
}
.dashboard-donut > div {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  text-align: center;
}
.dashboard-donut strong {
  font-size: 1rem;
  line-height: 1.15;
}
.dashboard-donut span {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  margin-top: 4px;
}
.dashboard-payment-legend {
  display: grid;
  gap: 10px;
}
.dashboard-legend-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.64);
}
.dashboard-legend-key {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}
.dashboard-legend-key i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dashboard-legend-item strong,
.dashboard-legend-item small {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--text);
}
.dashboard-legend-item small {
  color: var(--text-muted);
  min-width: 28px;
  text-align: right;
}
.dashboard-stack-list {
  display: grid;
  gap: 8px;
}
.dashboard-stack-list-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.66);
  margin-bottom: 10px;
}
.dashboard-mini-icon,
.dashboard-mini-icon svg {
  width: 34px;
  height: 34px;
}
.dashboard-mini-icon {
  border-radius: 12px;
  display: grid;
  place-items: center;
}
.dashboard-mini-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dashboard-mini-icon.red { color: var(--danger); background: var(--danger-soft); }
.dashboard-mini-icon.amber { color: var(--warning); background: var(--warning-soft); }
.dashboard-mini-icon.green { color: var(--success); background: var(--success-soft); }
.dashboard-mini-icon.blue { color: var(--primary); background: var(--primary-soft); }
.dashboard-mini-icon.violet { color: #7c3aed; background: #ede9fe; }
.dashboard-stack-list-copy {
  min-width: 0;
}
.dashboard-stack-list-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
}
.dashboard-stack-list-subtitle {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.35;
}
.dashboard-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.dashboard-count-badge.red { background: var(--danger-soft); color: var(--danger); }
.dashboard-count-badge.amber { background: var(--warning-soft); color: var(--warning); }
.dashboard-count-badge.green { background: var(--success-soft); color: var(--success); }
.dashboard-count-badge.blue { background: var(--primary-soft); color: var(--primary); }
.dashboard-count-badge.violet { background: #ede9fe; color: #7c3aed; }
.dashboard-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-size: 0.88rem;
  padding: 2px 0;
}
.dashboard-summary-row span {
  color: var(--text-muted);
  font-weight: 600;
}
.dashboard-summary-row strong {
  font-weight: 800;
}
.dashboard-summary-footer {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}
.dashboard-summary-key {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.dashboard-summary-value {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 800;
}
.dashboard-summary-total-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #e8f0ff;
  color: #143aa4;
  font-weight: 800;
}
.dashboard-stock-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) 70px 78px 72px auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.7);
  margin-bottom: 8px;
}
.dashboard-stock-name {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dashboard-stock-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
}
.dashboard-view-link {
  display: inline-flex;
  margin-top: 12px;
  color: #1f63ff;
  font-weight: 800;
  font-size: 0.86rem;
}
.dashboard-activity-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.66);
  margin-bottom: 8px;
}
.dashboard-activity-copy {
  min-width: 0;
}
.dashboard-activity-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
}
.dashboard-activity-meta {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.35;
}
.dashboard-empty-note {
  padding: 14px 12px;
  color: var(--text-muted);
  font-size: 0.86rem;
}
.dashboard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 4px 2px 8px;
}
.dashboard-global-search-wrap {
  max-width: min(840px, 66vw);
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  min-height: 44px;
  padding: 0 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}
.dashboard-global-search-input {
  font-size: 0.9rem;
  padding: 8px 2px;
}
.dashboard-global-actions {
  gap: 10px;
}
.dashboard-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
}
.dashboard-icon-btn:hover {
  background: transparent;
  border-color: transparent;
}
.dashboard-user-chip {
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  border-color: rgba(148, 163, 184, 0.26);
}
.dashboard-user-chip-avatar {
  width: 26px;
  height: 26px;
}

@media (max-width: 1200px) {
  .dashboard-intro-grid,
  .dashboard-layout,
  .dashboard-bottom-grid,
  .dashboard-payment-body,
  .dashboard-primary-row {
    grid-template-columns: 1fr;
  }
  .dashboard-divider-meta {
    flex-basis: auto;
  }
  .dashboard-payment-body {
    justify-items: start;
  }
  .dashboard-stock-row {
    grid-template-columns: minmax(0, 1fr) repeat(3, auto);
  }
}

@media (max-width: 768px) {
  .main-content.dashboard-page {
    padding: 16px 14px 80px;
  }
  .main-content.dashboard-page .card-body {
    padding: 16px;
  }
  .dashboard-intro h2 {
    font-size: 1.55rem;
  }
  .dashboard-meta-row {
    gap: 8px 12px;
  }
  .dashboard-footer {
    flex-direction: column;
    align-items: flex-start;
  }
  .dashboard-stock-row,
  .dashboard-activity-item,
  .dashboard-legend-item {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }
  .dashboard-legend-item small {
    text-align: left;
  }
  .dashboard-quick-actions .quick-action-card {
    min-height: 88px;
  }
}

/* Dashboard screenshot fidelity overrides */
.main-content.dashboard-page {
  padding: 18px 22px 24px;
  background: #f3f4f6;
}
.main-content.dashboard-page .dashboard-shell {
  max-width: none;
  width: 100%;
  gap: 10px;
}
.dashboard-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.54fr) minmax(320px, 1fr);
  column-gap: 16px;
  row-gap: 16px;
  align-items: start;
}
.dashboard-divider-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: auto;
  padding: 4px 2px 0;
  border-bottom: 0;
}
.dashboard-divider-copy {
  display: grid;
  gap: 8px;
}
.dashboard-divider-eyebrow {
  font-size: 0.92rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: #0c7fb9;
}
.dashboard-divider-row h2 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--text);
}
.dashboard-divider-meta {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-align: right;
}
.dashboard-divider-meta strong {
  font-size: 1.85rem;
  line-height: 1;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0;
}
.dashboard-divider-meta span {
  font-size: 0.96rem;
  line-height: 1.15;
  font-weight: 500;
  color: #475569;
  letter-spacing: 0;
}
.dashboard-main-col,
.dashboard-side-col {
  min-width: 0;
}
.dashboard-main-col {
  display: contents;
}
.dashboard-side-col {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.main-content.dashboard-page .card,
.main-content.dashboard-page .kpi-card {
  border-radius: 0.5em;
  border: 1px solid #e3e9f1;
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.dashboard-intro {
  padding: 0;
  min-height: 0;
  margin-bottom: 0 !important;
  padding-bottom: 8px !important;
  position: relative;
}
.dashboard-side-col {
  position: relative;
}
.dashboard-eyebrow {
  color: #0f1e46;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  margin-bottom: 0;
}
.dashboard-intro h2 {
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
  margin: 0 0 4px;
}
.dashboard-intro p {
  font-size: 13px;
  line-height: 1.25;
  margin-bottom: 8px;
}
.dashboard-meta-row {
  gap: 6px;
  font-size: 12px;
  color: #23396f;
}
.dashboard-meta-row span + span::before {
  content: "•";
  margin-right: 6px;
  color: #3b5b9a;
}
.dashboard-kpi-grid {
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 0;
  margin-bottom: 4px !important;
}
.main-content.dashboard-page .dashboard-kpi-grid .kpi-card {
  min-height: 84px;
  padding: 16px 18px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
}
.main-content.dashboard-page .dashboard-kpi-grid .kpi-card-icon {
  width: 46px;
  height: 46px;
  margin: 0;
  border-radius: 14px;
}
.main-content.dashboard-page .dashboard-kpi-grid .kpi-card-icon svg {
  width: 22px;
  height: 22px;
}
.main-content.dashboard-page .dashboard-kpi-grid .kpi-label {
  font-size: 12px;
  line-height: 1.2;
  color: #475569;
}
.main-content.dashboard-page .dashboard-kpi-grid .kpi-value {
  margin-top: 4px;
  font-size: 1.08rem;
  line-height: 1.2;
  color: #0f172a;
  font-weight: 800;
}
.main-content.dashboard-page .dashboard-kpi-grid .kpi-note {
  margin-top: 7px;
  font-size: 11px;
  line-height: 1.1;
  color: #0ea55a;
}
.main-content.dashboard-page .dashboard-kpi-grid .kpi-card:nth-child(2) .kpi-note {
  color: #ef1f27;
}
.dashboard-primary-row {
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1.54fr) minmax(320px, 1fr);
  align-items: stretch;
  gap: 16px;
  margin-bottom: 16px !important;
}
.dashboard-primary-row > .card {
  min-height: 308px;
}
.dashboard-card-header {
  min-height: 56px;
  padding: 16px 20px 10px;
}
.dashboard-card-header h3 {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0;
}
.dashboard-inline-label {
  font-size: 0.92rem;
  font-weight: 600;
  color: #475569;
}
.dashboard-trend-legend {
  gap: 16px;
  font-size: 11px;
}
.dashboard-period-pill {
  height: 26px;
  border-radius: 5px;
  font-size: 11px;
}
.dashboard-chart-body {
  padding: 0 12px 10px !important;
}
.dashboard-trend-chart {
  height: 232px;
}
.dashboard-chart-axis-label {
  font-size: 10px;
}
.dashboard-chart-summary {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
}
.dashboard-chart-value {
  color: #0f172a;
  font-size: 1.02rem;
  font-weight: 800;
}
.dashboard-chart-label {
  color: #475569;
  font-size: 0.88rem;
  font-weight: 500;
}
.dashboard-chart-shell {
  padding-top: 2px;
  gap: 14px;
}
.dashboard-trend-controls {
  padding: 2px;
  border-color: #d9e3ee;
  background: #fff;
  box-shadow: none;
}
.dashboard-trend-btn {
  color: #475569;
  font-size: 0.92rem;
  padding: 8px 16px;
}
.dashboard-trend-btn.active {
  background: linear-gradient(135deg, #0f91cf, #0a78b7);
  color: #fff;
  box-shadow: none;
}
.dashboard-chart {
  height: 205px;
}
.dashboard-actions-card .card-body {
  padding: 10px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dashboard-actions-card {
  min-height: auto !important;
  display: flex;
  flex-direction: column;
}
.dashboard-quick-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}
.dashboard-quick-actions .quick-action-card {
  min-height: 0;
  padding: 14px 16px;
  border-radius: 0.5em;
  gap: 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  justify-content: initial;
  background: #fff;
  border: 1px solid #dbe4ef;
  box-shadow: none;
  text-align: left;
}
.dashboard-quick-actions .quick-action-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.06);
}
.dashboard-quick-actions .quick-action-card-badge {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #f6f9fe;
  color: #1269f3;
  border: 1px solid #dfeaff;
}
.dashboard-quick-actions .quick-action-card-badge svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
}
.dashboard-quick-actions .quick-action-card-title {
  font-size: 0.98rem;
  color: #0f172a;
  font-weight: 700;
  line-height: 1.2;
}
.dashboard-quick-actions .quick-action-card-arrow {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: #64748b;
}
.dashboard-quick-actions .quick-action-card-arrow svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.1;
}
.dashboard-quick-actions .quick-action-card:first-child {
  background: linear-gradient(135deg, #0787c7, #0b72b4);
  border-color: #0a75b7;
}
.dashboard-quick-actions .quick-action-card:first-child .quick-action-card-badge {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.dashboard-quick-actions .quick-action-card:first-child .quick-action-card-title,
.dashboard-quick-actions .quick-action-card:first-child .quick-action-card-arrow {
  color: #fff;
}
.dashboard-actions-footer {
  display: none;
}
.dashboard-bottom-grid {
  grid-column: 1;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}
.dashboard-bottom-grid > .card {
  min-height: 0;
}
.dashboard-bottom-grid > .dashboard-payment-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 360px;
}
.dashboard-payment-body {
  grid-template-columns: 172px minmax(0, 1fr);
  gap: 18px;
  height: auto;
  align-items: center;
  align-content: center;
  padding: 18px 20px 16px !important;
}
.dashboard-payment-body.dashboard-donut-layout.card-body {
  height: auto;
  flex: 1 1 auto;
}
.dashboard-donut {
  width: 156px;
  height: auto;
  aspect-ratio: 1;
  margin: 0 auto 0 0;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}
.dashboard-donut::before {
  display: none;
}
.dashboard-donut-hole {
  position: relative;
  inset: auto;
  width: 44%;
  height: 44%;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--border-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.05;
  z-index: 1;
  box-sizing: border-box;
}
.dashboard-donut-hole strong {
  color: #111c3d;
  display: block;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: -0.03em;
  max-width: 52px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-donut-hole span {
  color: #64748b;
  display: block;
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}
.dashboard-payment-legend {
  display: grid;
  gap: 8px;
  height: auto;
  min-width: 0;
  width: 100%;
  align-items: stretch;
  align-content: start;
  grid-auto-rows: auto;
}
.dashboard-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 0 10px;
  border: 0;
  border-bottom: 1px solid #edf2f7;
  border-radius: 0;
  background: transparent;
  font-size: 0.82rem;
}
.dashboard-legend-item:last-of-type {
  padding-bottom: 0;
  border-bottom: 0;
}
.dashboard-legend-key {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.dashboard-legend-label {
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}
.dashboard-legend-value {
  margin-left: auto;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  text-align: right;
}
.dashboard-legend-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  margin-top: 2px;
  border-top: 1px solid #edf2f7;
}
.dashboard-legend-total span {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}
.dashboard-legend-total strong {
  color: var(--primary);
  font-size: 0.94rem;
}
@media (max-width: 760px) {
  .dashboard-bottom-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-bottom-grid > .dashboard-payment-card {
    min-height: 0;
  }
}
@media (max-width: 520px) {
  .dashboard-payment-body {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .dashboard-payment-legend {
    max-width: 260px;
  }
}
.dashboard-stack-list {
  gap: 0;
}
.dashboard-stack-list-item {
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 9px;
  padding: 8px 12px;
  margin: 0;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid #edf2f8;
  background: transparent;
}
.dashboard-mini-icon {
  width: 24px;
  height: 24px;
  border-radius: 5px;
}
.dashboard-mini-icon svg {
  width: 15px;
  height: 15px;
}
.dashboard-stack-list-title,
.dashboard-activity-title {
  font-size: 11px;
}
.dashboard-stack-list-subtitle,
.dashboard-activity-meta {
  font-size: 10px;
}
.dashboard-count-badge {
  min-width: 44px;
  height: 20px;
  border-radius: 4px;
  font-size: 10px;
}
.dashboard-summary-panel {
  border-top: 1px solid #edf2f7;
}
.dashboard-summary-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 10px;
}
.dashboard-summary-panel-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
}
.dashboard-summary-body {
  padding: 0 20px 18px !important;
}
.dashboard-summary-row {
  min-height: 38px;
  padding: 6px 0;
  border-bottom: 1px solid #edf2f8;
  font-size: 0.94rem;
}
.dashboard-summary-total-row {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.98rem;
  background: #f8fafc;
}
.dashboard-calendar-card {
  min-height: 204px;
  display: flex;
  flex-direction: column;
}
.dashboard-calendar-card .dashboard-card-header {
  min-height: 0;
  padding-bottom: 8px;
}
.dashboard-calendar-body {
  padding: 2px 18px 16px !important;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}
.dashboard-calendar-weekdays,
.dashboard-calendar-grid {
  gap: 6px;
}
.dashboard-calendar-weekdays {
  padding-bottom: 8px;
  font-size: 0.84rem;
  color: #64748b;
}
.dashboard-calendar-day {
  min-height: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 12px;
  padding: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  color: var(--text);
}
.dashboard-calendar-day.has-events {
  cursor: pointer;
}
.dashboard-calendar-day-number {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 28px;
  padding: 0 6px;
  border-radius: 10px;
  line-height: 1;
}
.dashboard-calendar-day.current .dashboard-calendar-day-number {
  min-width: 42px;
  background: #0f8fcf;
  color: #fff;
  border: 1px solid #0f8fcf;
}
.dashboard-calendar-day.muted {
  color: transparent;
}
.dashboard-calendar-event-dots {
  display: flex;
  align-items: center;
  gap: 3px;
  min-height: 4px;
}
.dashboard-calendar-event-dot {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: #1f63ff;
}
.dashboard-calendar-event-dot.amber { background: #f59e0b; }
.dashboard-calendar-event-dot.red { background: #ef4444; }
.dashboard-calendar-event-dot.violet { background: #8b5cf6; }
.dashboard-calendar-event-dot.green { background: #22c55e; }
.dashboard-calendar-footer-link {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.dashboard-calendar-footer-link.is-empty {
  cursor: default;
}
.dashboard-calendar-footer {
  border-top: 1px solid #edf2f8;
  padding-top: 14px;
  margin-top: 10px;
  font-size: 12px;
}
.dashboard-stock-card {
  min-height: 140px;
  display: flex;
  flex-direction: column;
}
.dashboard-stock-card .card-body,
.dashboard-activity-card .card-body {
  padding: 0 18px 16px !important;
}
.dashboard-stock-card .card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}
.dashboard-stock-card .dashboard-stack-list {
  flex: 1 1 auto;
}
.dashboard-stock-row {
  grid-template-columns: minmax(0, 1.25fr) 56px 70px 58px 48px;
  gap: 8px;
  padding: 7px 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid #edf2f8;
  background: transparent;
}
.dashboard-stock-row-head {
  color: #66799d;
  font-size: 10px;
  font-weight: 800;
}
.dashboard-stock-name {
  font-size: 11px;
}
.dashboard-stock-name-text {
  display: block;
}
.dashboard-stock-mobile-meta,
.dashboard-stock-mobile-value,
.dashboard-header-link {
  display: none;
}
.dashboard-stock-meta {
  font-size: 10px;
}
.dashboard-stock-row .badge {
  justify-content: center;
  min-width: 44px;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 9px;
}
.dashboard-view-link {
  margin-top: 8px;
  font-size: 12px;
}
.dashboard-activity-card {
  display: none;
}
.dashboard-activity-item {
  grid-template-columns: 32px minmax(0, 1fr) 40px;
  gap: 8px;
  padding: 8px 8px;
  margin: 0;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid #edf2f8;
  background: transparent;
}
.dashboard-activity-time {
  color: #516790;
  font-size: 10px;
  font-weight: 700;
  text-align: right;
}
.dashboard-footer {
  display: none;
}

[data-theme="dark"] .main-content.dashboard-page {
  background: linear-gradient(180deg, #2c2c2c 0%, #252525 100%);
}
[data-theme="dark"] .main-content.dashboard-page .card,
[data-theme="dark"] .main-content.dashboard-page .kpi-card {
  background: var(--surface);
  border-color: var(--border-soft);
  box-shadow: var(--shadow);
}
[data-theme="dark"] .dashboard-divider-row {
  border-bottom-color: var(--border-soft);
}
[data-theme="dark"] .dashboard-divider-row h2 {
  color: #f8fafc;
}
[data-theme="dark"] .dashboard-divider-eyebrow {
  color: #38bdf8;
}
[data-theme="dark"] .dashboard-divider-meta strong {
  color: #f8fafc;
}
[data-theme="dark"] .dashboard-divider-meta span {
  color: #94a3b8;
}
[data-theme="dark"] .main-content.dashboard-page .dashboard-kpi-grid .kpi-label {
  color: #cbd5e1;
}
[data-theme="dark"] .main-content.dashboard-page .dashboard-kpi-grid .kpi-value {
  color: #f8fafc;
}
[data-theme="dark"] .main-content.dashboard-page .dashboard-kpi-grid .kpi-note {
  color: var(--success);
}
[data-theme="dark"] .main-content.dashboard-page .dashboard-kpi-grid .kpi-card:nth-child(2) .kpi-note {
  color: var(--danger);
}
[data-theme="dark"] .dashboard-quick-actions .quick-action-card {
  background: var(--surface);
  border-color: var(--border-soft);
}
[data-theme="dark"] .dashboard-quick-actions .quick-action-card-title {
  color: #e2e8f0;
}
[data-theme="dark"] .dashboard-quick-actions .quick-action-card-badge {
  background: #343434;
  border-color: #3f3f3f;
}
[data-theme="dark"] .dashboard-quick-actions .quick-action-card-arrow {
  color: #94a3b8;
}
[data-theme="dark"] .dashboard-quick-actions .quick-action-card:first-child {
  background: linear-gradient(135deg, #0b6ca4, #085a88);
  border-color: #1f8fd1;
}
[data-theme="dark"] .dashboard-quick-actions .quick-action-card:first-child .quick-action-card-badge {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.18);
}
[data-theme="dark"] .dashboard-donut-hole {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .dashboard-donut-hole strong {
  color: #f8fafc;
}
[data-theme="dark"] .dashboard-donut-hole span {
  color: #94a3b8;
}
[data-theme="dark"] .dashboard-summary-row {
  border-bottom-color: rgba(148, 163, 184, 0.14);
}
[data-theme="dark"] .dashboard-summary-row span {
  color: #cbd5e1;
}
[data-theme="dark"] .dashboard-summary-row strong {
  color: #f8fafc;
}
[data-theme="dark"] .dashboard-summary-total-row {
  background: var(--surface-2);
  color: #e2e8f0;
}
[data-theme="dark"] .dashboard-summary-total-row span {
  color: #cbd5e1;
}
[data-theme="dark"] .dashboard-summary-total-row strong {
  color: var(--primary);
}
[data-theme="dark"] .dashboard-summary-panel {
  border-top-color: var(--border-soft);
}
[data-theme="dark"] .dashboard-summary-panel-header h4 {
  color: #f8fafc;
}
[data-theme="dark"] .dashboard-calendar-card .dashboard-card-header,
[data-theme="dark"] .dashboard-card-header {
  border-bottom-color: var(--border-soft);
}
[data-theme="dark"] .dashboard-calendar-month {
  color: #f8fafc;
}
[data-theme="dark"] .dashboard-calendar-weekdays {
  background: var(--surface-2);
  border-color: var(--border-soft);
  color: #cbd5e1;
}
[data-theme="dark"] .dashboard-calendar-days {
  background: var(--surface-2);
  border-color: var(--border-soft);
}
[data-theme="dark"] .dashboard-calendar-day {
  color: #e2e8f0;
}
[data-theme="dark"] .dashboard-calendar-day.muted {
  color: #64748b;
}
[data-theme="dark"] .dashboard-calendar-day.current .dashboard-calendar-day-number {
  color: #fff;
}
[data-theme="dark"] .dashboard-calendar-footer {
  border-top-color: var(--border-soft);
  color: #cbd5e1;
}
[data-theme="dark"] .dashboard-stock-row,
[data-theme="dark"] .dashboard-activity-item {
  border-bottom-color: var(--border-soft);
}
[data-theme="dark"] .dashboard-stock-row-head {
  color: #94a3b8;
}
[data-theme="dark"] .dashboard-stock-name,
[data-theme="dark"] .dashboard-activity-title {
  color: #f8fafc;
}
[data-theme="dark"] .dashboard-stock-meta,
[data-theme="dark"] .dashboard-activity-meta,
[data-theme="dark"] .dashboard-activity-time {
  color: #94a3b8;
}
[data-theme="dark"] .dashboard-view-link {
  color: #38bdf8;
}
[data-theme="dark"] .dashboard-chart-value {
  color: #f8fafc;
}
[data-theme="dark"] .dashboard-chart-label,
[data-theme="dark"] .dashboard-chart-axis-label {
  color: #94a3b8;
}
[data-theme="dark"] .dashboard-period-pill {
  background: var(--surface-2);
  border-color: var(--border-soft);
  color: #cbd5e1;
}
[data-theme="dark"] .dashboard-period-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

@media (max-width: 1200px) {
  .dashboard-workspace {
    grid-template-columns: 1fr;
  }
  .dashboard-primary-row,
  .dashboard-bottom-grid,
  .dashboard-side-col {
    grid-column: 1;
  }
  .dashboard-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-side-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-activity-card {
    grid-column: 1 / -1;
  }
}
@media (max-width: 768px) {
  .dashboard-kpi-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-divider-row {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  .dashboard-divider-meta {
    align-items: flex-start;
    text-align: left;
  }
  .dashboard-divider-row h2 {
    font-size: 1.5rem;
  }
}

/* ─── Shell overrides for the redesigned navigation ─────────── */
.desktop-sidebar .sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 10px 10px;
}
.desktop-sidebar .nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
}
.desktop-sidebar .nav-btn:hover {
  background: var(--sidebar-hover-bg);
  color: var(--text);
}
.desktop-sidebar .nav-btn.active {
  background: var(--sidebar-active-bg);
  color: #fff;
}
.desktop-sidebar .nav-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.desktop-sidebar .sidebar-divider {
  height: 1px;
  margin: 8px 10px;
  background: var(--sidebar-border);
}
.desktop-sidebar .sidebar-end-of-day-wrap {
  margin-top: auto;
  padding-bottom: 8px;
}
.desktop-sidebar .sidebar-footer {
  display: none;
}
.module-nav {
  flex-shrink: 0;
  min-height: 46px;
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--surface-2) 92%, var(--text) 8%);
  border: 1px solid var(--border);
  border-bottom: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  overflow: hidden;
  position: relative;
}
.module-nav::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--border);
  pointer-events: none;
}
.module-nav.hidden {
  display: none;
}
.module-nav-inner {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}
.module-nav-identity {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 0 16px;
  color: #64748b;
  background: #eef2f7;
  border-right: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.module-nav-identity svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.module-nav-track {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
  padding: 0 16px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
.module-nav--scrollable .module-nav-track {
  padding-inline: 44px;
}
.module-nav-track::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
#moduleNav:has([data-module-child-id="overview"]) .module-nav-track {
  padding-left: 8px;
  padding-right: 44px;
}
.module-nav-scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, var(--border) 8%);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  z-index: 3;
  transition: opacity 0.18s, background-color 0.18s, color 0.18s;
}
.module-nav-scroll-btn:hover {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}
.module-nav-scroll-btn:disabled {
  opacity: 0;
  pointer-events: none;
}
.module-nav-scroll-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.module-nav-scroll-btn--left {
  left: 8px;
}
.module-nav-scroll-btn--right {
  right: 8px;
}
.module-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 46px;
  min-width: 72px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-bottom: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.96rem;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.18s, background-color 0.18s, border-color 0.18s, box-shadow 0.18s;
  position: relative;
  z-index: 1;
}
.module-nav-link:hover {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 7%, transparent);
}
.module-nav-link.active {
  color: var(--info);
  background: transparent;
  border-color: transparent;
  font-weight: 700;
  box-shadow: inset 0 -2px 0 0 var(--info);
}
.module-nav-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -3px;
  border-radius: 4px;
}
.module-tab-indicator {
  display: none;
  position: absolute;
  left: 0;
  top: 4px;
  bottom: -2px;
  width: 0;
  background: #ffffff;
  border: 1px solid #d7e4ec;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 2px 0 #ffffff, 0 -1px 3px rgba(15, 23, 42, 0.03);
  transform: translateX(0);
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1), width 240ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease;
  opacity: 0;
  pointer-events: none;
}
.module-tab-indicator::before,
.module-tab-indicator::after {
  content: "";
  position: absolute;
  bottom: 1px;
  width: 0.75em;
  height: 0.75em;
  pointer-events: none;
}
.module-tab-indicator::before {
  left: -0.75em;
  border-bottom-right-radius: 0.75em;
  box-shadow: 0.375em 0.375em 0 0.375em #ffffff;
}
.module-tab-indicator::after {
  right: -0.75em;
  border-bottom-left-radius: 0.75em;
  box-shadow: -0.375em 0.375em 0 0.375em #ffffff;
}
@media (prefers-reduced-motion: reduce) {
  .module-nav-link,
  .module-tab-indicator {
    transition: none !important;
  }
}
.mobile-sidebar-head {
  padding: 18px 16px 12px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.mobile-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.mobile-sidebar-brand-name {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mobile-sidebar-brand-sub {
  font-size: 0.72rem;
  color: var(--sidebar-text-dim);
}
.mobile-sidebar-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--sidebar-border);
  background: transparent;
  border-radius: 10px;
  color: var(--sidebar-text-dim);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.mobile-sidebar-close:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text);
}
.mobile-sidebar-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.mobile-sidebar-section {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mobile-sidebar-secondary {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--sidebar-border);
}
.mobile-sidebar-link {
  width: 100%;
  justify-content: flex-start;
}
.mobile-sidebar-link span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
