html[data-theme="light"] {
  color-scheme: light;
  --brand-primary: #20989e;
  --brand-deep: #142f35;
  --brand-gold: #f2b66d;
  --bg: #e8eef0;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --glass-border: rgba(255, 255, 255, 0.92);
  --rail: #142f35;
  --rail-ink: rgba(255, 255, 255, 0.78);
  --rail-active: #ffffff;
  --elevated: var(--glass-strong);
  --muted-surface: rgba(255, 255, 255, 0.55);
  --ink: #142f35;
  --muted: #5f7378;
  --line: rgba(20, 47, 53, 0.1);
  --line-strong: rgba(20, 47, 53, 0.16);
  --hover: rgba(32, 152, 158, 0.1);
  --active: #20989e;
  --active-ink: #ffffff;
  --accent: #f2b66d;
  --shadow: 0 12px 40px rgba(20, 47, 53, 0.1);
  --blur: 18px;
  --radius: 22px;
  --sidebar-w: 84px;
  --staff-pill-inset: 5px;
  --staff-pill-gap: 5px;
  --staff-pill-y: 0.45rem;
  --staff-pill-x: 0.95rem;
  --staff-pill-ring: 2px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --bs-body-bg: transparent;
  --bs-body-color: var(--ink);
  --bs-border-color: var(--line-strong);
  --bs-primary: #20989e;
  --bs-primary-rgb: 32, 152, 158;
  --bs-link-color: var(--ink);
  --bs-link-hover-color: var(--ink);
  --chart: #20989e;
  --chart-deep: #142f35;
  --chart-gold: #f2b66d;
  --chart-soft: rgba(32, 152, 158, 0.18);
  --chart-soft-deep: rgba(20, 47, 53, 0.14);
  --chart-soft-gold: rgba(242, 182, 109, 0.28);
  --chart-grid: rgba(20, 47, 53, 0.08);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --brand-primary: #20989e;
  --brand-deep: #142f35;
  --brand-gold: #f2b66d;
  --bg: #0d1a1d;
  --glass: rgba(20, 47, 53, 0.72);
  --glass-strong: rgba(24, 58, 64, 0.88);
  --glass-border: rgba(242, 182, 109, 0.14);
  --rail: #0f2428;
  --rail-ink: rgba(255, 255, 255, 0.72);
  --rail-active: #f2b66d;
  --elevated: var(--glass-strong);
  --muted-surface: rgba(255, 255, 255, 0.06);
  --ink: #eef6f7;
  --muted: #9bb4b8;
  --line: rgba(238, 246, 247, 0.1);
  --line-strong: rgba(238, 246, 247, 0.16);
  --hover: rgba(32, 152, 158, 0.16);
  --active: #20989e;
  --active-ink: #ffffff;
  --accent: #f2b66d;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  --blur: 20px;
  --radius: 22px;
  --sidebar-w: 84px;
  --staff-pill-inset: 5px;
  --staff-pill-gap: 5px;
  --staff-pill-y: 0.45rem;
  --staff-pill-x: 0.95rem;
  --staff-pill-ring: 2px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --bs-body-bg: transparent;
  --bs-body-color: var(--ink);
  --bs-border-color: var(--line-strong);
  --bs-primary: #20989e;
  --bs-primary-rgb: 32, 152, 158;
  --bs-link-color: var(--ink);
  --bs-link-hover-color: var(--ink);
  --chart: #20989e;
  --chart-deep: #142f35;
  --chart-gold: #f2b66d;
  --chart-soft: rgba(32, 152, 158, 0.24);
  --chart-soft-deep: rgba(20, 47, 53, 0.35);
  --chart-soft-gold: rgba(242, 182, 109, 0.32);
  --chart-grid: rgba(238, 246, 247, 0.1);
}

* { -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  color: var(--ink);
  font-family: "Manrope", "Segoe UI", sans-serif;
  min-height: 100vh;
  background:
    radial-gradient(920px 500px at 10% -4%, rgba(32, 152, 158, 0.18), transparent 55%),
    radial-gradient(760px 460px at 92% 4%, rgba(242, 182, 109, 0.16), transparent 50%),
    linear-gradient(180deg, #e9eef0 0%, #e3eaec 55%, #dbe4e6 100%);
  background-attachment: fixed;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(900px 480px at 8% -6%, rgba(32, 152, 158, 0.28), transparent 55%),
    radial-gradient(760px 440px at 94% 0%, rgba(242, 182, 109, 0.12), transparent 48%),
    linear-gradient(180deg, #0d1a1d 0%, #142f35 100%);
  background-attachment: fixed;
}

.staff-sidebar {
  position: fixed;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  z-index: 1040;
  width: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.85rem 0.55rem;
  background: var(--rail);
  border: 1px solid rgba(32, 152, 158, 0.28);
  border-radius: 999px;
  box-shadow: 0 18px 48px rgba(20, 47, 53, 0.28);
  transition: transform 0.24s var(--ease), opacity 0.24s var(--ease);
}

.staff-brand {
  display: grid;
  place-items: center;
  padding: 0.15rem 0 0.55rem;
}
.staff-mark {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--brand-primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(242, 182, 109, 0.35);
}

#staff-nav {
  overflow: visible;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
}
.nav-group-link {
  width: 44px;
  height: 44px;
  color: var(--rail-ink);
  text-decoration: none;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 0;
  position: relative;
}
.nav-group-link .nav-label {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  background: var(--rail);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s var(--ease);
  z-index: 5;
}
.nav-group-link:hover .nav-label,
.nav-group-link:focus-visible .nav-label { opacity: 1; }
.nav-group-link svg { width: 18px; height: 18px; stroke: currentColor; }
.nav-group-link:hover,
.nav-group-link.is-preview { background: rgba(255, 255, 255, 0.1); color: #fff; }
.nav-group-link.is-active {
  background: var(--brand-primary);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(242, 182, 109, 0.45);
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  margin-top: auto;
  padding-top: 0.55rem;
  width: 100%;
}
.sidebar-foot button { display: none; }
.sidebar-foot .nav-group-link { color: var(--rail-ink); }

.staff-shell {
  margin-left: var(--sidebar-w);
  min-width: 0;
  min-height: 100vh;
  background: transparent;
}

.staff-top {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem 0.85rem;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}
.staff-top__lead {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.staff-page-title {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  font-weight: 650;
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.staff-top__center {
  display: flex;
  justify-content: center;
  min-width: 0;
}

/* Shared pill track + items: equal inset on every side/corner */
.staff-pill-track,
.staff-subnav,
.nav-pills {
  display: flex;
  align-items: center;
  gap: var(--staff-pill-gap);
  padding: var(--staff-pill-inset);
  box-sizing: border-box;
  border-radius: 999px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--blur)) saturate(1.25);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.25);
}

.staff-pill,
.staff-subnav a,
.nav-pills .nav-link,
.badge {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  min-height: 0;
  padding: var(--staff-pill-y) var(--staff-pill-x);
  border-radius: 999px;
  border: 0;
  line-height: 1.2;
  white-space: nowrap;
}

.staff-pill.is-active,
.staff-subnav a.active,
.nav-pills .nav-link.active,
.badge {
  background: var(--brand-primary) !important;
  color: #fff !important;
  box-shadow: 0 0 0 var(--staff-pill-ring) var(--brand-gold);
}

.staff-subnav {
  justify-content: center;
  min-width: 0;
  max-width: min(720px, 70vw);
  overflow-x: auto;
  scrollbar-width: none;
}
.staff-subnav::-webkit-scrollbar { display: none; }
.staff-subnav__set {
  display: none;
  align-items: center;
  gap: var(--staff-pill-gap);
}
.staff-subnav__set.is-active { display: flex; }
.staff-subnav a {
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
}
.staff-subnav a:hover {
  color: var(--ink);
  background: var(--hover);
  box-shadow: none;
}

.staff-search { position: relative; width: min(180px, 22vw); }
.staff-search input {
  width: 100%;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-strong);
  color: var(--ink);
  padding: 0 0.85rem 0 2.1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  box-sizing: border-box;
}
.staff-search svg { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.staff-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--staff-pill-gap);
}
.icon-btn, .staff-user > summary {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-strong);
  color: var(--ink);
  display: inline-grid;
  place-items: center;
  padding: 0;
  list-style: none;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  box-sizing: border-box;
}
.icon-btn:hover, .staff-user > summary:hover { background: #fff; }
.staff-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--brand-deep);
  color: var(--brand-gold);
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(242, 182, 109, 0.35);
}
.staff-user { position: relative; }
.staff-user > summary::-webkit-details-marker { display: none; }
.staff-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  padding: 0.35rem;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  z-index: 20;
  backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: var(--shadow);
}
.staff-menu a {
  display: block;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.86rem;
}
.staff-menu a:hover { background: var(--hover); }

main.staff-main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0.35rem 1.25rem 2.5rem;
  background: transparent;
}

.card, .list-group, .modal-content, .op-staff-card {
  background: var(--glass-strong) !important;
  color: var(--ink);
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}
.card.is-interactive, .op-staff-card.is-interactive { transition: border-color 0.2s var(--ease), transform 0.2s var(--ease); }
.card.is-interactive:hover, .op-staff-card.is-interactive:hover { border-color: var(--line-strong) !important; transform: translateY(-1px); }
.list-group-item {
  background: transparent;
  color: var(--ink);
  border-color: var(--line) !important;
}
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--ink);
  --bs-table-hover-bg: var(--hover);
  --bs-table-hover-color: var(--ink);
  --bs-table-border-color: var(--line);
  margin-bottom: 0;
}
.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
  background: var(--muted-surface);
}
.table td, .table th { vertical-align: middle; padding-top: 0.55rem; padding-bottom: 0.55rem; }
th a.sort-link { color: inherit; text-decoration: none; }
th a.sort-link:hover { color: var(--ink); }

.form-control, .form-select, .input-group-text,
.staff-main input[type="text"],
.staff-main input[type="number"],
.staff-main input[type="email"],
.staff-main input[type="url"],
.staff-main input[type="password"],
.staff-main input[type="search"],
.staff-main input[type="date"],
.staff-main select,
.staff-main textarea,
.auth-card input {
  background: var(--muted-surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  min-height: 40px;
  box-shadow: none;
}
.form-control:focus, .form-select:focus,
.staff-main input:focus, .staff-main select:focus, .staff-main textarea:focus,
.auth-card input:focus {
  background: var(--muted-surface);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--chart-soft);
}
.form-label { font-size: 0.82rem; color: var(--muted); }
.btn { border-radius: 999px; font-weight: 600; }
.btn-primary,
.btn-dark {
  padding: var(--staff-pill-y) var(--staff-pill-x);
  border-radius: 999px;
  box-sizing: border-box;
}
.btn-primary { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
.btn-primary:hover, .btn-primary:focus {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
  color: #fff;
  box-shadow: 0 0 0 var(--staff-pill-ring) var(--brand-gold);
}
.btn-dark { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.btn-dark:hover, .btn-dark:focus {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
  box-shadow: 0 0 0 var(--staff-pill-ring) var(--brand-gold);
}
.flag-toggle[aria-pressed="true"] {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 var(--staff-pill-ring) var(--brand-gold);
}
.btn-outline-primary, .btn-outline-secondary, .btn-secondary, .btn-outline-danger {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-outline-primary:hover, .btn-outline-secondary:hover, .btn-secondary:hover {
  background: var(--hover);
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-outline-danger { color: #b42318; }
html[data-theme="dark"] .btn-outline-danger { color: #f0a8a2; }
.btn-outline-danger:hover { background: rgba(180, 35, 24, 0.1); color: #b42318; }
.nav-pills {
  flex-wrap: wrap;
  width: fit-content;
  max-width: 100%;
}
.nav-pills .nav-link {
  color: var(--muted);
  background: transparent;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
}
.nav-pills .nav-link:hover {
  color: var(--ink);
  background: var(--hover);
  box-shadow: none;
}
.badge {
  font-size: 0.72rem;
  font-weight: 650;
  padding: 0.28rem 0.55rem;
}
.alert { background: var(--elevated); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; }
.pagination .page-link { background: var(--elevated); color: var(--ink); border-color: var(--line); }
.page-item.active .page-link {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}
.progress { background: var(--hover); }
.progress-bar { background: var(--brand-primary); }
.text-muted { color: var(--muted) !important; }
.bg-light { background: var(--muted-surface) !important; color: var(--ink); }
h1, .h4, .display-6 { letter-spacing: -0.03em; }
.metric-value, .display-6 { font-weight: 650; letter-spacing: -0.04em; }
.chart-card canvas { max-height: 260px; }
.op-staff-card { height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.op-staff-card__media { aspect-ratio: 16 / 10; background: var(--muted-surface); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.op-staff-card__media img { width: 100%; height: 100%; object-fit: cover; }
.op-staff-card__media--logo img { width: auto; height: auto; max-width: 70%; max-height: 64px; object-fit: contain; }
.op-staff-card__body { padding: 0.9rem 1rem 1rem; flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }
.op-staff-card__title { font-size: 0.95rem; font-weight: 600; line-height: 1.3; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: min(420px, 100%); }
.auth-tools { position: fixed; top: 16px; right: 16px; }

.staff-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 16, 24, 0.42);
  backdrop-filter: blur(6px);
  z-index: 1030;
}
.staff-shell { overflow-x: clip; }
.table-responsive { -webkit-overflow-scrolling: touch; }

@media (max-width: 1199.98px) {
  main.staff-main { padding-inline: 1rem; }
}

@media (max-width: 991.98px) {
  .staff-sidebar {
    top: 0.75rem;
    left: 0.75rem;
    transform: translateY(0) translateX(calc(-100% - 1.5rem));
    height: auto;
    max-height: calc(100vh - 1.5rem);
  }
  .staff-sidebar.is-open { transform: translateY(0) translateX(0); }
  .staff-shell { margin-left: 0; }
  .staff-top {
    grid-template-columns: 1fr;
    justify-items: stretch;
    gap: 0.75rem;
    padding: 0.75rem;
  }
  .staff-top__center { justify-content: flex-start; width: 100%; }
  .staff-subnav {
    max-width: none;
    width: 100%;
    justify-content: flex-start;
  }
  .staff-actions { width: 100%; justify-content: flex-end; }
  .staff-search { width: min(220px, 50vw); }
  .staff-main > .d-flex,
  .staff-main .card-body.d-flex,
  .staff-main nav.d-flex {
    flex-wrap: wrap;
    gap: 0.55rem;
  }
  .nav-pills { flex-wrap: wrap; gap: var(--staff-pill-gap); }
  .staff-main .card > .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pagination { flex-wrap: wrap; }
  .modal-dialog { margin: 0.75rem; }
}

@media (max-width: 767.98px) {
  main.staff-main { padding: 0.85rem 0.7rem 2rem; }
  .staff-main [style*="min-width"],
  .staff-main [style*="max-width"] {
    min-width: 0 !important;
    max-width: none !important;
    width: 100%;
    flex: 1 1 100%;
  }
  .staff-main .list-group-item {
    flex-wrap: wrap;
    align-items: flex-start !important;
    gap: 0.45rem;
  }
  .staff-main .list-group-item .text-nowrap { white-space: normal !important; }
  .staff-main .btn { white-space: normal; }
  .table td.text-nowrap { white-space: normal; }
  .icon-btn, .staff-user > summary { min-width: 36px; min-height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .staff-sidebar, .staff-shell, .card.is-interactive, .op-staff-card.is-interactive {
    transition: none;
  }
}
