:root {
  --ui-radius-sm: 0.72rem;
  --ui-radius-md: 0.98rem;
  --ui-radius-lg: 1.2rem;
  --ui-radius-xl: 1.4rem;
  --ui-shadow-sm: 0 8px 22px rgba(15, 23, 42, 0.08);
  --ui-shadow-md: 0 14px 30px rgba(15, 23, 42, 0.12);
  --ui-shadow-lg: 0 22px 46px rgba(15, 23, 42, 0.16);
  --ui-focus: 0 0 0 3px color-mix(in srgb, var(--primary, #0f766e) 24%, transparent);
}

html {
  scroll-behavior: smooth;
}

body {
  letter-spacing: 0.01em;
}

.material-symbols-rounded {
  font-family: "Material Symbols Rounded";
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  display: inline-block;
  text-transform: none;
  letter-spacing: normal;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "liga";
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
}

::selection {
  background: color-mix(in srgb, var(--primary, #0f766e) 28%, white);
  color: #0b2134;
}

* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--primary, #0f766e) 38%, #94a3b8) #e7eff6;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: #e7eff6;
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--primary, #0f766e) 38%, #94a3b8);
  border-radius: 999px;
  border: 2px solid #e7eff6;
}

*::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--primary, #0f766e) 52%, #64748b);
}

.glass-panel,
.panel,
.dashboard-card,
.stat-card,
.modal-panel,
.modal-dialog,
.sale-modal-dialog,
.batch-group-card,
.product-card,
.card {
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-sm);
}

.dashboard-card,
.stat-card,
.panel,
.card {
  border-color: color-mix(in srgb, var(--card-border, #d6e3ee) 86%, white);
}

.btn-primary,
button[type="submit"] {
  border-radius: var(--ui-radius-md);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--button-fill, var(--primary, #0f766e)) 24%, transparent);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-primary:hover,
button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px color-mix(in srgb, var(--button-fill, var(--primary, #0f766e)) 28%, transparent);
}

.btn-primary:active,
button[type="submit"]:active {
  transform: translateY(0);
  filter: saturate(1.03);
}

.btn-outline,
button,
a.btn-outline {
  border-radius: var(--ui-radius-md);
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.btn-outline:hover,
button:hover,
a.btn-outline:hover {
  transform: translateY(-1px);
}

input,
select,
textarea,
button,
a,
[tabindex] {
  outline: none;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  box-shadow: var(--ui-focus);
}

input,
select,
textarea {
  min-height: 2.65rem;
}

label {
  letter-spacing: 0.04em;
}

table {
  border-collapse: collapse;
}

th {
  letter-spacing: 0.08em;
}

th,
td {
  line-height: 1.35;
}

tr:last-child td {
  border-bottom: 0;
}

.panel-head,
.top-navbar {
  backdrop-filter: blur(8px);
}

.modal-panel,
.modal-dialog,
.sale-modal-dialog {
  box-shadow: var(--ui-shadow-lg);
}

.sale-modal-backdrop,
#sidebarOverlay.active {
  backdrop-filter: blur(3px);
}

.quick-chips a,
.chip {
  border-radius: 999px;
}

.kpi-card,
.summary-cards article,
.stat-pill {
  position: relative;
  overflow: hidden;
}

.kpi-card::after,
.summary-cards article::after {
  content: "";
  position: absolute;
  right: -22px;
  top: -22px;
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary, #0f766e) 10%, transparent);
  pointer-events: none;
}

.top-navbar {
  border-radius: calc(var(--ui-radius-lg) + 0.3rem);
  box-shadow: var(--ui-shadow-md);
}

.mobile-bottom-nav {
  padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
}

.mobile-bottom-nav > div {
  gap: 0.4rem;
}

.mobile-bottom-nav .nav-item {
  min-height: 3.2rem;
}

/* Shared page hero */
.page-hero {
  margin: 0.15rem 0 0.9rem;
  border: 1px solid color-mix(in srgb, var(--primary, #0f766e) 32%, #ffffff 28%);
  border-radius: calc(var(--ui-radius-lg) + 0.08rem);
  background:
    radial-gradient(120% 180% at 10% 0%, color-mix(in srgb, var(--primary, #0f766e) 22%, transparent) 0%, transparent 52%),
    linear-gradient(132deg, color-mix(in srgb, var(--primary, #0f766e) 94%, #ffffff 6%), color-mix(in srgb, var(--primary-dark, #0b5f58) 88%, #0b3b68 12%));
  color: #f8fffd;
  box-shadow: 0 16px 30px color-mix(in srgb, var(--primary, #0f766e) 28%, transparent);
  padding: 0.9rem 1rem;
}

.page-hero-title {
  margin: 0;
  font-family: "Space Mono", monospace;
  font-size: 1rem;
  letter-spacing: 0.03em;
}

.page-hero-subtitle {
  margin: 0.28rem 0 0;
  max-width: 60rem;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.45;
}

@media (max-width: 767px) {
  .page-hero {
    padding: 0.82rem 0.86rem;
    margin-bottom: 0.72rem;
  }
}

/* Shared table usability helpers */
.table-shell {
  display: grid;
  gap: 0.55rem;
}

.table-shell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.table-shell-head p {
  margin: 0;
  color: var(--muted-text, var(--muted, #64748b));
  font-size: 0.78rem;
  line-height: 1.5;
}

.table-scroll-hint {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-text, var(--muted, #64748b));
}

.table-scroll-region {
  overflow-x: auto;
}

.table-scroll-region:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
  border-radius: 0.9rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Reusable workspace hero variants */
.page-hero.workspace-hero {
  --workspace-hero-main: 1.45fr;
  --workspace-hero-side-min: 16rem;
  --workspace-hero-side: 0.82fr;
  --workspace-hero-gap: 1rem;
  --workspace-hero-border: rgba(255, 255, 255, 0.46);
  --workspace-hero-shadow: 0 24px 48px rgba(15, 118, 110, 0.2);
  --workspace-hero-radial: rgba(14, 165, 233, 0.18);
  --workspace-hero-grad-start: rgba(15, 118, 110, 0.96);
  --workspace-hero-grad-mid: rgba(11, 95, 88, 0.92);
  --workspace-hero-grad-end: rgba(16, 185, 129, 0.9);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--workspace-hero-border);
  border-radius: 1.4rem;
  padding: 1.3rem 1.35rem 1.2rem;
  background:
    radial-gradient(circle at top right, var(--workspace-hero-radial), transparent 34%),
    linear-gradient(135deg, var(--workspace-hero-grad-start), var(--workspace-hero-grad-mid) 54%, var(--workspace-hero-grad-end));
  box-shadow: var(--workspace-hero-shadow);
}

.page-hero.workspace-hero::after {
  content: "";
  position: absolute;
  right: -2.5rem;
  bottom: -2.7rem;
  width: 11rem;
  height: 11rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 68%);
  pointer-events: none;
}

.workspace-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, var(--workspace-hero-main)) minmax(var(--workspace-hero-side-min), var(--workspace-hero-side));
  gap: var(--workspace-hero-gap);
  align-items: end;
}

.workspace-hero-copy,
.workspace-hero-meta {
  position: relative;
  z-index: 1;
}

.workspace-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.72rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ecfeff;
}

.workspace-hero-title {
  color: #fff;
  margin-top: 0.85rem;
}

.workspace-hero-subtitle {
  color: rgba(236, 254, 255, 0.86);
  max-width: 56rem;
}

.workspace-meta-card {
  padding: 1rem;
  border-radius: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(236, 254, 255, 0.1);
  backdrop-filter: blur(10px);
}

.workspace-meta-label {
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  color: rgba(236, 254, 255, 0.74);
}

.workspace-meta-value {
  margin-top: 0.32rem;
  font-size: 1rem;
  font-weight: 800;
  color: #ffffff;
}

.workspace-meta-card p {
  margin: 0.18rem 0 0;
  color: rgba(236, 254, 255, 0.82);
  line-height: 1.55;
}

.page-hero.workspace-hero--standard {
  --workspace-hero-radial: rgba(96, 165, 250, 0.18);
  --workspace-hero-grad-start: rgba(15, 118, 110, 0.96);
  --workspace-hero-grad-mid: rgba(13, 73, 117, 0.92);
  --workspace-hero-grad-end: rgba(37, 99, 235, 0.88);
}

.page-hero.workspace-hero--ops {
  --workspace-hero-radial: rgba(14, 165, 233, 0.18);
  --workspace-hero-grad-start: rgba(15, 118, 110, 0.96);
  --workspace-hero-grad-mid: rgba(11, 95, 88, 0.92);
  --workspace-hero-grad-end: rgba(16, 185, 129, 0.9);
}

.page-hero.workspace-hero--control {
  --workspace-hero-radial: rgba(14, 165, 233, 0.18);
  --workspace-hero-grad-start: rgba(15, 118, 110, 0.95);
  --workspace-hero-grad-mid: rgba(11, 95, 88, 0.92);
  --workspace-hero-grad-end: rgba(16, 185, 129, 0.9);
}

@media (min-width: 980px) {
  .page-hero.workspace-hero--wide {
    --workspace-hero-main: 1.6fr;
    --workspace-hero-side-min: 18rem;
    --workspace-hero-side: 0.9fr;
  }
}

@media (max-width: 960px) {
  .workspace-hero-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-hero.workspace-hero {
    padding: 1.15rem 1rem 1rem;
    border-radius: 1.2rem;
  }
}

/* Theme-level consistency */
body.batches-page,
body.sale-page {
  background-image:
    radial-gradient(720px 360px at 8% -8%, rgba(15, 118, 110, 0.08), transparent 58%),
    radial-gradient(640px 300px at 92% 12%, rgba(59, 130, 246, 0.08), transparent 56%);
  background-attachment: fixed;
}

body.theme-premium {
  background-image:
    radial-gradient(760px 420px at 10% -12%, rgba(196, 181, 253, 0.2), transparent 58%),
    radial-gradient(700px 360px at 94% 16%, rgba(167, 139, 250, 0.14), transparent 55%);
  background-attachment: fixed;
}

body.theme-dark,
body.theme-colorful {
  background-image:
    radial-gradient(760px 420px at 12% -12%, rgba(56, 189, 248, 0.12), transparent 58%),
    radial-gradient(680px 340px at 96% 18%, rgba(34, 211, 238, 0.08), transparent 55%);
  background-attachment: fixed;
}

/* Shared system header/menu */
.system-header-shell {
  position: sticky;
  top: 0.38rem;
  z-index: 88;
  margin: 0.42rem auto 0.92rem;
  max-width: 86rem;
  padding: 0 0.74rem;
}

.system-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.78rem;
  padding: 0.66rem 0.86rem;
  border-radius: 1.08rem;
  border: 1px solid color-mix(in srgb, var(--primary, #0f766e) 30%, #d6e3ee);
  background:
    radial-gradient(220px 100px at 8% 0%, color-mix(in srgb, var(--primary, #0f766e) 16%, transparent), transparent 72%),
    radial-gradient(260px 110px at 92% 0%, rgba(59, 130, 246, 0.1), transparent 76%),
    linear-gradient(135deg, color-mix(in srgb, var(--surface, #ffffff) 97%, #f8fcff), color-mix(in srgb, var(--surface, #ffffff) 91%, #e8f2fa));
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.13), 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

.system-topbar-main {
  display: flex;
  align-items: center;
  gap: 0.52rem;
  min-width: 0;
}

.system-topbar-main strong {
  font-size: 0.77rem;
  letter-spacing: 0.095em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--text, #10243a) 78%, #ffffff);
  white-space: nowrap;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--primary, #0f766e) 86%, #083c38),
    color-mix(in srgb, var(--primary, #0f766e) 68%, #2563eb)
  );
  border: 1px solid color-mix(in srgb, var(--primary, #0f766e) 38%, #99d8d2);
  border-radius: 999px;
  padding: 0.3rem 0.64rem;
  box-shadow: 0 10px 18px color-mix(in srgb, var(--primary, #0f766e) 28%, transparent);
}

.system-topbar-main .system-scope {
  max-width: 23rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.73rem;
  color: color-mix(in srgb, var(--muted-text, #64748b) 86%, #334155);
  font-family: "Space Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.system-hamburger {
  display: none;
  width: 2.18rem;
  min-width: 2.18rem;
  height: 2.18rem;
  border-radius: 0.75rem;
  border: 1px solid color-mix(in srgb, var(--primary, #0f766e) 22%, #d6e3ee);
  background: #fff;
  color: color-mix(in srgb, var(--text, #10243a) 85%, #0f766e);
}

.system-hamburger .material-symbols-rounded {
  font-size: 1.15rem;
}

.system-logout-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  justify-content: center;
  min-height: 2.05rem;
  padding: 0.38rem 0.78rem;
  border-radius: 0.76rem;
  border: 1px solid color-mix(in srgb, #ef4444 40%, #fecaca);
  background: linear-gradient(135deg, color-mix(in srgb, #ef4444 14%, #ffffff), #ffffff);
  color: color-mix(in srgb, #b91c1c 88%, #111827);
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 18px rgba(239, 68, 68, 0.16);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.system-logout-link .material-symbols-rounded {
  display: block;
  font-size: 1rem;
  line-height: 1;
  color: #b91c1c !important;
  font-variation-settings: "FILL" 1, "wght" 700, "GRAD" 0, "opsz" 24;
}

.system-logout-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 22px rgba(239, 68, 68, 0.2);
  filter: saturate(1.04);
}

.system-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0.44rem;
  margin-top: 0.5rem;
  padding: 0.42rem;
  border-radius: 0.98rem;
  border: 1px solid color-mix(in srgb, var(--primary, #0f766e) 15%, #d6e3ee);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(241, 248, 253, 0.9));
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.system-menu-desktop {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.system-link {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  min-height: 2.08rem;
  padding: 0.36rem 0.7rem;
  border-radius: 0.76rem;
  border: 1px solid color-mix(in srgb, var(--primary, #0f766e) 20%, #d6e3ee);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface, #ffffff) 97%, #eff6fb), color-mix(in srgb, var(--surface, #ffffff) 92%, #e9f3f9));
  color: color-mix(in srgb, var(--text, #10243a) 84%, #1f2937);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.012em;
  text-decoration: none;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.06);
  transition: transform 0.18s ease, box-shadow 0.22s ease, border-color 0.22s ease, background-color 0.22s ease, color 0.22s ease;
}

.system-menu-desktop .system-link {
  flex: 0 0 auto;
  white-space: nowrap;
}

.system-link:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--primary, #0f766e) 35%, #c8e5df);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.1);
}

.system-link.is-active {
  border-color: color-mix(in srgb, var(--primary, #0f766e) 48%, #9ad7cf);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary, #0f766e) 16%, #ffffff), color-mix(in srgb, var(--primary, #0f766e) 25%, #ffffff));
  color: color-mix(in srgb, var(--primary, #0f766e) 82%, #0f172a);
  box-shadow: 0 12px 20px color-mix(in srgb, var(--primary, #0f766e) 22%, transparent);
}

.system-link .material-symbols-rounded {
  font-size: 1rem;
}

.system-menu-secondary .system-link {
  font-size: 0.7rem;
  background: linear-gradient(135deg, #ffffff, #f4f9fd);
  color: color-mix(in srgb, var(--text, #10243a) 74%, #475569);
}

.system-mobile-bottom-nav {
  display: none;
}

.system-drawer-overlay,
.system-drawer {
  display: none;
}

.system-drawer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  margin-top: 0;
}

.system-drawer.show {
  display: block;
  position: fixed;
  left: 0.68rem;
  right: 0.68rem;
  bottom: 4.2rem;
  z-index: 97;
  max-height: 72vh;
  overflow: auto;
  border-radius: 1rem;
  border: 1px solid color-mix(in srgb, var(--primary, #0f766e) 18%, #d6e3ee);
  background: linear-gradient(155deg, #ffffff, #f4f9fd);
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.2);
  padding: 0.74rem;
}

.system-drawer-overlay.show {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 96;
  background: rgba(2, 8, 23, 0.45);
  backdrop-filter: blur(2px);
}

@media (max-width: 767px) {
  .system-header-shell {
    margin-top: 0.36rem;
    margin-bottom: 0.62rem;
    padding: 0 0.52rem;
  }

  .system-hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .system-topbar {
    gap: 0.55rem;
    padding: 0.56rem 0.62rem;
  }

  .system-topbar-main {
    gap: 0.36rem;
    flex: 1 1 auto;
    min-width: 0;
  }

  .system-topbar-main strong {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
  }

  .system-topbar-main .system-scope {
    max-width: 8.6rem;
    font-size: 0.66rem;
  }

  .system-scope-switch {
    display: none;
  }

  .system-scope-switch-drawer {
    display: flex;
    margin-bottom: 0.65rem;
  }

  .system-search,
  .system-command-bar,
  .system-menu {
    display: none !important;
  }

  .system-topbar-actions {
    gap: 0.34rem;
  }

  .system-topbar-actions .system-theme-button span:last-child {
    display: none;
  }

  .system-logout-link {
    width: 2.15rem;
    padding: 0;
  }

  .system-mobile-bottom-nav {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.74rem;
    z-index: 95;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.33rem;
    padding: 0.42rem;
    border-radius: 1rem;
    border: 1px solid color-mix(in srgb, var(--primary, #0f766e) 16%, #d6e3ee);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.15);
  }

  .system-mobile-link {
    display: grid;
    place-items: center;
    gap: 0.1rem;
    min-height: 2.84rem;
    border-radius: 0.66rem;
    border: 1px solid transparent;
    color: #4a5f77;
    background: #ffffff;
    font-size: 0.62rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
  }

  .system-mobile-link .material-symbols-rounded {
    font-size: 1.16rem;
  }

  .system-mobile-link.is-active {
    background: color-mix(in srgb, var(--primary, #0f766e) 13%, #ffffff);
    color: color-mix(in srgb, var(--primary, #0f766e) 80%, #0f172a);
    border-color: color-mix(in srgb, var(--primary, #0f766e) 24%, #d6e3ee);
  }

  .system-drawer-links {
    display: flex;
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  body.shared-nav-active {
    padding-left: 0;
  }

  .system-header-shell {
    position: sticky;
    top: 0.35rem;
    z-index: 72;
    margin: 0.38rem auto 0.8rem;
    max-width: 84rem;
    padding: 0 0.82rem;
  }

  .system-topbar {
    padding: 0.82rem 0.94rem;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.78rem;
  }

  .system-topbar-main {
    align-items: flex-start;
    gap: 0.5rem;
    min-width: 0;
  }

  .system-topbar-main strong {
    font-size: 0.84rem;
    letter-spacing: 0.08em;
  }

  .system-topbar-main .system-scope {
    max-width: 100%;
    white-space: normal;
    overflow: hidden;
    text-overflow: unset;
    line-height: 1.4;
  }

  .system-scope-switch {
    display: flex;
    grid-column: 1 / -1;
    margin-top: 0.1rem;
  }

  .system-scope-switch-drawer {
    display: none;
  }

  .system-search,
  .system-command-bar,
  .system-menu {
    display: none;
  }

  .system-hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    min-width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.95rem;
  }

  .system-topbar-actions {
    gap: 0.55rem;
    align-self: start;
  }

  .system-theme-button {
    min-height: 2.75rem;
    padding: 0.52rem 0.88rem;
    font-size: 0.76rem;
    border-radius: 0.95rem;
  }

  .system-theme-pill {
    font-size: 0.67rem;
  }

  .system-logout-link {
    min-height: 2.75rem;
    padding: 0.48rem 0.9rem;
    border-radius: 0.95rem;
  }

  .system-mobile-bottom-nav {
    display: none;
  }

  .system-drawer-overlay,
  .system-drawer {
    display: none;
  }

  .system-drawer-overlay.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(2, 8, 23, 0.34);
    z-index: 98;
  }

  .system-drawer.show {
    display: block;
    position: fixed;
    left: 0.9rem;
    top: 5.35rem;
    bottom: 1rem;
    width: min(24rem, calc(100vw - 1.8rem));
    max-height: none;
    overflow: auto;
    border-radius: 1.15rem;
    border: 1px solid color-mix(in srgb, var(--primary, #0f766e) 18%, #d6e3ee);
    background: linear-gradient(180deg, #ffffff, #f4f9fd);
    z-index: 99;
    box-shadow: 0 24px 42px rgba(15, 23, 42, 0.2);
    padding: 0.9rem;
  }

  .system-drawer-links {
    display: grid;
    gap: 0.62rem;
  }

  .system-nav-section {
    gap: 0.56rem;
  }

  .system-group-links {
    gap: 0.46rem;
  }

  .system-link {
    min-height: 2.2rem;
    justify-content: flex-start;
    font-size: 0.75rem;
  }
}

body.system-drawer-open {
  overflow: hidden;
}

@media (min-width: 1200px) {
  body.shared-nav-active {
    padding-left: 18.35rem;
  }

  .system-header-shell {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 17.6rem;
    max-width: 17.6rem;
    margin: 0;
    padding: 0.58rem 0.54rem 0.72rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid color-mix(in srgb, var(--primary, #0f766e) 14%, #d6e3ee);
    background:
      radial-gradient(280px 120px at 8% 0%, color-mix(in srgb, var(--primary, #0f766e) 12%, transparent), transparent 72%),
      linear-gradient(180deg, #f8fcff, #edf4fa);
    box-shadow: 12px 0 24px rgba(15, 23, 42, 0.08);
  }

  .system-topbar {
    padding: 0.62rem;
    border-radius: 1rem;
    display: grid;
    gap: 0.45rem;
    justify-content: stretch;
    align-content: start;
  }

  .system-topbar-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.34rem;
  }

  .system-topbar-main .system-scope {
    max-width: 100%;
    white-space: normal;
    line-height: 1.35;
  }

  .system-logout-link {
    width: 100%;
  }

  .system-menu.system-menu-desktop {
    margin-top: 0.38rem;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0.36rem;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    align-content: flex-start;
    padding-right: 0.3rem;
  }

  .system-menu-desktop .system-link {
    width: 100%;
    justify-content: flex-start;
  }

  .system-mobile-bottom-nav,
  .system-drawer-overlay,
  .system-drawer {
    display: none !important;
  }
}

/* Legacy compatibility class */
.system-mobile-nav {
  display: none;
}

/* Shared app shell */
.app-shell {
  --app-shell-max-width: 84rem;
  --app-shell-pad-top-desktop: 0;
  --app-shell-pad-x-desktop: 1rem;
  --app-shell-pad-bottom-desktop: 2.2rem;
  --app-shell-pad-top-mobile: 0.75rem;
  --app-shell-pad-x-mobile: 0.85rem;
  --app-shell-pad-bottom-mobile: 5.25rem;
  max-width: var(--app-shell-max-width);
  margin: 0 auto;
  padding: var(--app-shell-pad-top-mobile) var(--app-shell-pad-x-mobile) var(--app-shell-pad-bottom-mobile);
}

@media (min-width: 768px) {
  .app-shell {
    padding: var(--app-shell-pad-top-desktop) var(--app-shell-pad-x-desktop) var(--app-shell-pad-bottom-desktop);
  }
}

/* Unified nav mode across pages */
body.shared-nav-active .top-navbar,
body.shared-nav-active .mobile-bottom-nav,
body.shared-nav-active #sidebar,
body.shared-nav-active #sidebarOverlay,
body.shared-nav-active .sidebar,
body.shared-nav-active .sidebar-overlay {
  display: none !important;
}

/* Staff page aligned with shared theme */
.staff-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.82rem 0.85rem 6.4rem;
}

.staff-main {
  display: grid;
  gap: 0.92rem;
}

.hidden {
  display: none !important;
}

.staff-flash {
  display: flex;
  align-items: flex-start;
  gap: 0.58rem;
  border: 1px solid #b7e4d2;
  border-radius: 0.95rem;
  background: linear-gradient(135deg, #f2fffa, #e9fbf6);
  color: #0e5b55;
  padding: 0.75rem 0.85rem;
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.12);
}

.staff-flash.is-error {
  border-color: #fecaca;
  background: linear-gradient(135deg, #fff5f5, #fffafb);
  color: #b91c1c;
  box-shadow: 0 10px 22px rgba(239, 68, 68, 0.12);
}

.staff-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.4rem, 1fr));
  gap: 0.62rem;
}

.staff-kpi {
  border: 1px solid #d4e4ef;
  border-radius: 0.92rem;
  background: linear-gradient(150deg, #ffffff, #f4f9fd);
  padding: 0.72rem 0.8rem;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.staff-kpi p:first-child {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: #5f748b;
  font-weight: 800;
}

.staff-kpi p:last-child {
  margin: 0.2rem 0 0;
  font-size: 1.38rem;
  color: #10243a;
  font-weight: 800;
}

.staff-panel {
  border: 1px solid #d6e3ee;
  border-radius: 1.05rem;
  background: #fff;
  box-shadow: var(--ui-shadow-sm);
  padding: 0.95rem;
}

.staff-panel-head,
.staff-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.72rem;
  flex-wrap: wrap;
  margin-bottom: 0.72rem;
}

.staff-panel-head h2,
.staff-list-head h2 {
  margin: 0;
  font-size: 1rem;
}

.staff-panel-head p,
.staff-list-head p {
  margin: 0.2rem 0 0;
  color: #63788e;
  font-size: 0.79rem;
}

.staff-panel-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.staff-panel-actions button,
.staff-panel-actions a {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.staff-scope-form {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.staff-filters {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(170px, 220px) auto;
  gap: 0.62rem;
  align-items: end;
}

.staff-filter-actions {
  display: flex;
  align-items: flex-end;
}

.staff-create {
  margin-top: 0.86rem;
  border: 1px solid #d6e3ee;
  border-radius: 0.95rem;
  padding: 0.82rem;
  background: linear-gradient(150deg, #f9fcff, #f4f9fd);
}

.staff-create h3 {
  margin: 0 0 0.62rem;
  font-size: 0.92rem;
}

.staff-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.62rem;
}

.staff-form-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.52rem;
  flex-wrap: wrap;
}

.staff-empty {
  border: 1px dashed #c8d8e5;
  border-radius: 0.88rem;
  padding: 0.8rem;
  color: #60758d;
  background: #f7fbff;
}

.staff-cards {
  display: grid;
  gap: 0.74rem;
}

.staff-card {
  border: 1px solid #d6e3ee;
  border-radius: 0.95rem;
  background: #fff;
  padding: 0.82rem;
  display: grid;
  gap: 0.7rem;
}

.staff-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.62rem;
  flex-wrap: wrap;
}

.staff-card-head p:first-child {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
}

.staff-card-head p:last-child {
  margin: 0.18rem 0 0;
  color: #5e738a;
  font-family: "Space Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.73rem;
}

.staff-badges {
  display: flex;
  align-items: center;
  gap: 0.36rem;
  flex-wrap: wrap;
}

.staff-badges span {
  display: inline-flex;
  align-items: center;
  min-height: 1.55rem;
  padding: 0.2rem 0.58rem;
  border-radius: 999px;
  border: 1px solid #cde3f0;
  background: #f4f9ff;
  color: #23506f;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.staff-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.52rem;
}

.staff-card-grid > div {
  border: 1px solid #dbe7f1;
  border-radius: 0.74rem;
  background: linear-gradient(155deg, #ffffff, #f7fbff);
  padding: 0.5rem 0.58rem;
}

.staff-card-grid p:first-child {
  margin: 0;
  color: #60758d;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
}

.staff-card-grid p:last-child {
  margin: 0.2rem 0 0;
  color: #10243a;
  font-size: 0.79rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.staff-card-actions {
  display: flex;
  justify-content: flex-end;
}

.staff-modal {
  position: fixed;
  inset: 0;
  z-index: 92;
  display: grid;
  place-items: center;
  padding: 0.75rem;
}

.staff-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.56);
}

.staff-modal-wrap {
  position: relative;
  width: min(860px, 100%);
  max-height: calc(100dvh - 1.5rem);
}

.staff-modal-card {
  max-height: calc(100dvh - 1.5rem);
  overflow: auto;
  border-radius: 1rem;
  border: 1px solid #d6e3ee;
  background: #fff;
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.28);
  padding: 0.86rem;
}

.staff-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.72rem;
  margin-bottom: 0.65rem;
}

.staff-modal-head h3 {
  margin: 0;
  font-size: 0.95rem;
}

.staff-modal-head p {
  margin: 0.2rem 0 0;
  color: #60758d;
  font-size: 0.78rem;
/* Admin setup + offline finish */
body.login-surface {
  font-family: "Manrope", system-ui, -apple-system, Segoe UI, sans-serif;
  background-image:
    radial-gradient(700px 360px at 12% -12%, rgba(220, 38, 38, 0.1), transparent 60%),
    radial-gradient(620px 300px at 92% 8%, rgba(14, 165, 233, 0.12), transparent 56%),
    linear-gradient(180deg, #f7fbff, #eef5fb);
}

body.login-surface .vivid-auth-card {
  border-radius: 1.4rem;
  border: 1px solid #d6e3ee;
  box-shadow: 0 22px 42px rgba(15, 23, 42, 0.12);
}

@media (max-width: 900px) {
  .staff-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .staff-shell {
    padding: 0.68rem 0.55rem 6.3rem;
  }

  .staff-filters {
    grid-template-columns: 1fr;
  }

  .staff-filter-actions {
    justify-content: flex-start;
  }

  .staff-form-grid {
    grid-template-columns: 1fr;
  }

  .staff-card-grid {
    grid-template-columns: 1fr;
  }
}

/* Global clarity pass */
body {
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.panel,
.dashboard-card,
.stat-card,
.card,
.glass-panel,
.detail-card,
.chart-card,
.kpi-card,
.summary-cards article {
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,251,254,.98));
  border: 1px solid color-mix(in srgb, var(--card-border, #d6e3ee) 88%, white);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.panel-head,
.top-navbar {
  background: linear-gradient(180deg, rgba(251,253,255,.98), rgba(245,250,254,.96));
}

.btn-primary,
button[type="submit"] {
  font-weight: 800;
}

.btn-outline,
a.btn-outline {
  border: 1px solid color-mix(in srgb, var(--card-border, #d6e3ee) 88%, white);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(246,250,253,.98));
  color: color-mix(in srgb, var(--text, #10243a) 96%, #0f172a);
}

input,
select,
textarea {
  border-radius: var(--ui-radius-md);
  border: 1px solid color-mix(in srgb, var(--card-border, #d6e3ee) 88%, white);
  background: rgba(255,255,255,.98);
  color: color-mix(in srgb, var(--text, #10243a) 96%, #0f172a);
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

label,
.field-label {
  color: color-mix(in srgb, var(--muted-text, #64748b) 88%, #334155);
  font-weight: 800;
}

.page-hero {
  padding: 1rem 1.08rem;
  box-shadow: 0 18px 34px color-mix(in srgb, var(--primary, #0f766e) 24%, transparent);
}

.page-hero-title {
  font-size: 1.06rem;
}

.page-hero-subtitle {
  font-size: .84rem;
  line-height: 1.55;
}

.system-topbar {
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.12), 0 1px 0 rgba(255, 255, 255, 0.75) inset;
}

.system-link,
.system-mobile-link {
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.05);
}

tbody tr:hover td {
  background: color-mix(in srgb, var(--primary, #0f766e) 4%, white);
}

.panel h2,
.panel h3,
.detail-card h3,
.chart-card h3,
.session-title,
.audit-title {
  color: color-mix(in srgb, var(--text, #10243a) 96%, #0f172a);
}

.panel-subtitle,
.sub,
.meta,
.muted,
.session-sub,
.audit-sub {
  color: color-mix(in srgb, var(--muted-text, #64748b) 88%, #334155);
}

@media (max-width: 767px) {
  .page-hero {
    padding: .9rem .92rem;
  }
}
