/* ============================================================
   Zaad design tokens (PROJECT_SPEC.md section 2).
   Loaded on every page, auth flow included. No template should
   hardcode a raw hex color — everything pulls from these tokens
   or the Tailwind color aliases mapped onto them in head-assets.php.
   ============================================================ */

:root {
  --color-brand: #2563EB;
  --color-brand-hover: #1D4ED8;
  --color-brand-light: #DBEAFE;
  --color-brand-rgb: 37, 99, 235;
  --color-bg-page: #F5F6FA;
  --color-bg-surface: #FFFFFF;
  --color-text-default: #1B1F3B;
  --color-text-subtle: #7A7F9A;
  --color-border: #E5E7F0;
  --color-status-instore: #1FAF7C;
  --color-status-issued: #E0A72E;
  --color-status-maintenance: var(--color-brand);
  --color-status-alert: #E24C4C;
  --color-status-neutral: #7A7F9A;
  --color-chip-teal: #17B0A7;
  --color-chip-amber: #F0A868;
  --color-chip-rose: #E88BA0;
  --gradient-brand: linear-gradient(135deg, #2563EB, #60A5FA);

  --shadow-card: 0 1px 2px rgba(27, 31, 59, 0.04), 0 8px 24px rgba(27, 31, 59, 0.06);
  --shadow-card-lg: 0 4px 12px rgba(27, 31, 59, 0.06), 0 16px 40px rgba(27, 31, 59, 0.10);
  --radius-card: 1rem;
}

* {
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--color-bg-page);
  color: var(--color-text-default);
}

a {
  color: inherit;
}

/* ---------- Surfaces ---------- */

.card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.text-subtle {
  color: var(--color-text-subtle);
}

.page-heading {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text-default);
  letter-spacing: -0.01em;
}

@media (min-width: 768px) {
  .page-heading {
    font-size: 1.5rem;
  }
}

/* ---------- Forms ---------- */
/* Rounded-lg inputs, soft navy focus ring, 44px minimum touch height. */

.form-label {
  display: block;
  color: var(--color-text-default);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  border: 1.5px solid var(--color-border);
  border-radius: 0.625rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  color: var(--color-text-default);
  background-color: var(--color-bg-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-textarea {
  min-height: 88px;
  resize: vertical;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(var(--color-brand-rgb), 0.15);
}

.form-input:disabled,
.form-select:disabled {
  background-color: var(--color-bg-page);
  color: var(--color-text-subtle);
  cursor: not-allowed;
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--color-text-subtle);
  margin-top: 0.375rem;
}

/* ---------- Radio option group ---------- */
/* Touch-friendly stacked radio rows (44px min height), matching the */
/* form-input border/focus language rather than bare native radios. */

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 44px;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--color-border);
  border-radius: 0.625rem;
  cursor: pointer;
  font-size: 0.9375rem;
  color: var(--color-text-default);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.radio-option input[type="radio"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--color-brand);
  flex-shrink: 0;
}

.radio-option:has(input:checked) {
  border-color: var(--color-brand);
  background-color: var(--color-brand-light);
}

/* ---------- Checkbox option group ---------- */
/* Mirrors .radio-group/.radio-option — used for the "Compatible Weapon */
/* Types" multi-select on the ammunition weapon-type form. */

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  max-height: 14rem;
  overflow-y: auto;
  padding: 0.375rem;
  border: 1.5px solid var(--color-border);
  border-radius: 0.625rem;
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 44px;
  padding: 0.5rem 0.625rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.9375rem;
  color: var(--color-text-default);
  transition: background-color 0.15s ease;
}

.checkbox-option:hover {
  background-color: var(--color-bg-page);
}

.checkbox-option input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--color-brand);
  flex-shrink: 0;
}

/* ---------- Quick-Add Dropdown (section 2 / Change Request 01 Part C) ---------- */

.qa-field-row {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.qa-field-row .form-select {
  flex: 1;
  min-width: 0;
}

.weapon-type-picker {
  display: grid;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.weapon-type-category-toggles,
.weapon-type-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.weapon-type-category-toggle {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--color-text-subtle);
}

.weapon-type-category-toggle input {
  accent-color: var(--color-brand);
}

.weapon-type-list {
  min-width: 0;
  max-height: 11rem;
  overflow-y: auto;
  padding: 0.5rem;
  border: 1.5px solid var(--color-border);
  border-radius: 0.625rem;
  background-color: var(--color-bg-surface);
}

.weapon-type-list.hidden {
  display: none;
}

.weapon-type-list-title {
  display: block;
  margin-bottom: 0.375rem;
  color: var(--color-text-subtle);
  font-size: 0.75rem;
  font-weight: 700;
}

.weapon-type-option {
  display: block;
  width: 100%;
  padding: 0.5rem 0.625rem;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--color-text-default);
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}

.weapon-type-option:hover,
.weapon-type-option.is-selected {
  background-color: var(--color-brand-light);
  color: var(--color-brand);
}

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

.qa-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 0.625rem;
  border: 1.5px solid var(--color-border);
  background-color: var(--color-bg-surface);
  color: var(--color-brand);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.qa-trigger:hover {
  background-color: var(--color-brand-light);
  border-color: var(--color-brand);
}

/* Popover: bottom sheet on mobile, centered panel on desktop (section 2 */
/* "Modals/dropdowns" mobile-first requirement). display:none/flex is */
/* driven by :not(.hidden) rather than a bare rule so it can't lose to */
/* the Tailwind CDN's .hidden utility on cascade order. */
.qa-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 20, 42, 0.5);
  z-index: 60;
  align-items: flex-end;
  justify-content: center;
  display: none;
}

.qa-overlay:not(.hidden) {
  display: flex;
}

.qa-panel {
  width: 100%;
  max-width: 26rem;
  max-height: 88vh;
  overflow-y: auto;
  background-color: var(--color-bg-surface);
  border-radius: 1.25rem 1.25rem 0 0;
  box-shadow: var(--shadow-card-lg);
}

@media (min-width: 768px) {
  .qa-overlay {
    align-items: center;
  }

  .qa-panel {
    border-radius: var(--radius-card);
    max-height: 85vh;
  }
}

.qa-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
}

.qa-panel-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-text-default);
}

.qa-panel-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-text-subtle);
  cursor: pointer;
}

.qa-panel-close:hover {
  background-color: var(--color-bg-page);
}

.qa-panel-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.qa-panel-footer {
  display: flex;
  gap: 0.75rem;
  padding-top: 0.25rem;
}

.qa-error {
  background-color: rgba(226, 76, 76, 0.08);
  color: var(--color-status-alert);
  border: 1px solid rgba(226, 76, 76, 0.25);
  border-radius: 0.75rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.8125rem;
}

.qa-optional {
  font-weight: 400;
  color: var(--color-text-subtle);
}

/* ---------- Repeatable line-item rows (Inventory IN batch / OUT form) ---------- */

.line-item-row {
  background-color: var(--color-bg-page);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 1rem;
}

.line-item-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.line-item-row-title {
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-subtle);
}

.line-item-row-remove {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 36px;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--color-status-alert);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.line-item-row-remove:hover:not(:disabled) {
  background-color: rgba(226, 76, 76, 0.06);
}

.line-item-row-remove:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.ammo-fields {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--color-border);
}

/* ---------- Alerts ---------- */

.alert-error {
  background-color: rgba(226, 76, 76, 0.08);
  color: var(--color-status-alert);
  border: 1px solid rgba(226, 76, 76, 0.25);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
}

.alert-success {
  background-color: rgba(31, 175, 124, 0.08);
  color: var(--color-status-instore);
  border: 1px solid rgba(31, 175, 124, 0.25);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
}

/* ---------- Buttons ---------- */
/* Primary = solid pill navy. Secondary = white pill, light border. */
/* Destructive = red text/border only, no solid fill. All share a 44px */
/* minimum tap height per the mobile-first touch-target requirement. */

.btn-primary,
.btn-secondary,
.btn-destructive {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.625rem 1.5rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--color-brand);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(var(--color-brand-rgb), 0.28);
}

.btn-primary:hover {
  background-color: var(--color-brand-hover);
}

.btn-primary:disabled {
  background-color: var(--color-status-neutral);
  box-shadow: none;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: var(--color-bg-surface);
  color: var(--color-text-default);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--color-brand-light);
  background-color: var(--color-bg-page);
}

/* Icon-only action buttons (list tables). 44px tap target, navy stroke. */
.action-icon-row {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 9999px;
  border: 1.5px solid var(--color-border);
  background-color: var(--color-bg-surface);
  color: var(--color-brand);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background-color: var(--color-brand-light);
  border-color: var(--color-brand-light);
}

.icon-btn-danger {
  color: var(--color-status-alert);
}

.icon-btn-danger:hover {
  background-color: rgba(226, 76, 76, 0.1);
  border-color: rgba(226, 76, 76, 0.25);
}

.icon-btn-disabled,
.icon-btn:disabled {
  color: var(--color-status-neutral);
  cursor: not-allowed;
  opacity: 0.55;
  background-color: var(--color-bg-page);
}

.icon-btn .icon {
  width: 1.125rem;
  height: 1.125rem;
}

.btn-destructive {
  background-color: transparent;
  color: var(--color-status-alert);
  border-color: var(--color-status-alert);
}

.btn-destructive:hover {
  background-color: rgba(226, 76, 76, 0.06);
}

/* ---------- Status badges ---------- */
/* Rounded-full pill, ~10% opacity token background, full-opacity text. */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.2;
}

.badge-instore {
  background-color: rgba(31, 175, 124, 0.12);
  color: var(--color-status-instore);
}

.badge-issued {
  background-color: rgba(224, 167, 46, 0.16);
  color: #9C7415;
}

.badge-maintenance {
  background-color: rgba(var(--color-brand-rgb), 0.10);
  color: var(--color-status-maintenance);
}

.badge-alert {
  background-color: rgba(226, 76, 76, 0.12);
  color: var(--color-status-alert);
}

.badge-neutral {
  background-color: rgba(122, 127, 154, 0.14);
  color: var(--color-status-neutral);
}

/* ---------- Voided records (Change Request 02) ---------- */
/* Kept visible in lists for the audit trail, but visually de-emphasized. */

.row-voided {
  opacity: 0.55;
}

.row-voided td {
  font-style: italic;
}

/* ---------- Avatars ---------- */

.avatar-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background-color: var(--color-brand-light);
  color: var(--color-brand);
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================================
   Auth shell (login / TOTP setup / TOTP verify) — two-panel layout.
   ============================================================ */

.auth-shell {
  min-height: 100vh;
  display: flex;
}

.auth-left {
  flex: 0 0 45%;
  max-width: 45%;
  background: var(--gradient-brand);
  color: #FFFFFF;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 3rem;
}

.auth-left::before {
  content: "";
  position: absolute;
  inset: -20%;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.07) 0, rgba(255, 255, 255, 0.07) 2px, transparent 2px),
    radial-gradient(circle at 85% 30%, rgba(255, 255, 255, 0.05) 0, transparent 45%),
    radial-gradient(circle at 30% 85%, rgba(255, 255, 255, 0.06) 0, transparent 40%);
  background-size: 34px 34px, 100% 100%, 100% 100%;
  pointer-events: none;
}

.auth-left-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 22rem;
}

.auth-crest {
  display: block;
  height: 7.5rem;
  width: 11.25rem;
  margin: 0 auto 1.5rem;
}

/* The legacy raster is composited over the shared token, so its blue stays
   aligned with the rest of the application without a second hex value. */
.brand-crest {
  display: inline-block;
  background-color: var(--color-brand);
  border-radius: 0.625rem;
  overflow: hidden;
  isolation: isolate;
}

.brand-crest img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: screen;
}

.auth-system-name {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.625rem;
}

.auth-tagline {
  font-size: 0.9375rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.5;
}

.auth-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background-color: var(--color-bg-surface);
}

.auth-form-wrap {
  width: 100%;
  max-width: 24rem;
}

.auth-mobile-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.auth-mobile-logo .brand-crest {
  height: 4rem;
  width: 6rem;
}

.auth-heading {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-default);
  margin-bottom: 0.375rem;
}

.auth-subheading {
  font-size: 0.9375rem;
  color: var(--color-text-subtle);
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

.auth-footer-link {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.875rem;
}

.auth-footer-link a {
  color: var(--color-brand);
  font-weight: 600;
  text-decoration: none;
}

.auth-footer-link a:hover {
  text-decoration: underline;
}

/* ============================================================
   Layout shell — sidebar, topbar, mobile drawer, FAB.
   ============================================================ */

.sidebar-desktop {
  width: 15rem;
  flex-shrink: 0;
  background-color: var(--color-bg-surface);
  border-right: 1px solid var(--color-border);
  box-shadow: 1px 0 0 rgba(27, 31, 59, 0.02);
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 1.25rem 1.25rem 1rem;
}

.sidebar-brand .brand-crest {
  height: 2.25rem;
  width: 3.375rem;
  flex: 0 0 auto;
  border-radius: 0.375rem;
}

.sidebar-brand span {
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--color-text-default);
  letter-spacing: -0.01em;
}

.sidebar-cta {
  margin: 0 1.25rem 1rem;
  width: auto;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0.875rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0.5rem 0.875rem;
  border-radius: 9999px;
  color: var(--color-text-subtle);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background-color: var(--color-bg-page);
  color: var(--color-text-default);
}

.nav-item-active,
.nav-item-active:hover {
  background-color: var(--color-brand-light);
  color: var(--color-brand);
}

.nav-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.icon {
  width: 1.25rem;
  height: 1.25rem;
}

/* ---------- Mobile drawer ---------- */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 20, 42, 0.5);
  z-index: 40;
}

.mobile-drawer {
  position: fixed;
  inset: 0 20% 0 0;
  max-width: 320px;
  background-color: var(--color-bg-surface);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  box-shadow: var(--shadow-card-lg);
}

.mobile-drawer.drawer-open {
  transform: translateX(0);
}

.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.5rem 0.5rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
}

.mobile-drawer-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
}

.mobile-drawer-user-meta {
  min-width: 0;
}

.mobile-drawer-user-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text-default);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-drawer-user-rank {
  font-size: 0.8125rem;
  color: var(--color-text-subtle);
}

.mobile-drawer-logout {
  margin-top: 0.75rem;
}

.mobile-drawer-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.drawer-close-btn,
.topbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  color: var(--color-text-subtle);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.drawer-close-btn:hover,
.topbar-icon-btn:hover {
  background-color: var(--color-bg-page);
  color: var(--color-text-default);
}

/* ---------- FAB ---------- */

.fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 9999px;
  background-color: var(--color-brand);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(var(--color-brand-rgb), 0.4);
  z-index: 30;
  text-decoration: none;
}

.fab:hover {
  background-color: var(--color-brand-hover);
}

.fab .icon {
  width: 1.75rem;
  height: 1.75rem;
}

/* ---------- Topbar ---------- */

.topbar {
  height: 4rem;
  flex-shrink: 0;
  background-color: var(--color-bg-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
}

@media (min-width: 768px) {
  .topbar {
    padding: 0 1.5rem;
  }
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.topbar-search {
  align-items: center;
  gap: 0.625rem;
  background-color: var(--color-bg-page);
  border: 1.5px solid transparent;
  border-radius: 9999px;
  padding: 0 1rem;
  height: 42px;
  width: 100%;
  max-width: 22rem;
  color: var(--color-text-subtle);
}

.topbar-search:focus-within {
  border-color: var(--color-brand);
  background-color: var(--color-bg-surface);
}

.topbar-search-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.875rem;
  color: var(--color-text-default);
  width: 100%;
  min-height: 40px;
}

.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 44px;
  padding: 0.25rem 0.5rem 0.25rem 0.25rem;
  border-radius: 9999px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.topbar-user-btn:hover {
  background-color: var(--color-bg-page);
}

.topbar-user-meta {
  text-align: left;
  line-height: 1.25;
}

.topbar-user-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-default);
}

.topbar-user-rank {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-subtle);
}

.topbar-logout-btn {
  width: 100%;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-status-alert);
  padding: 0.625rem 0.75rem;
  border-radius: 0.625rem;
  min-height: 44px;
  background: transparent;
  border: none;
  cursor: pointer;
}

.topbar-logout-btn:hover {
  background-color: rgba(226, 76, 76, 0.06);
}

.main-content {
  flex: 1;
  min-width: 0;
  background-color: var(--color-bg-page);
}

.main-content-inner {
  padding: 1.25rem 1rem 6rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .main-content-inner {
    padding: 1.75rem 2rem 2.5rem;
    gap: 1.5rem;
  }
}

/* ---------- Toggle switch ---------- */
/* Pill-shaped, gray track off / brand track on, white sliding thumb.  */
/* The label wraps the visible track in extra padding so the tap target */
/* comfortably exceeds the 44px minimum even though the track is small. */

.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0.5rem 0.25rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.9375rem;
  color: var(--color-text-default);
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 2.75rem;
  height: 1.5rem;
  background-color: var(--color-status-neutral);
  opacity: 0.35;
  border-radius: 9999px;
  transition: background-color 0.15s ease, opacity 0.15s ease;
  flex-shrink: 0;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.25rem;
  height: 1.25rem;
  background-color: #FFFFFF;
  border-radius: 9999px;
  box-shadow: 0 1px 3px rgba(27, 31, 59, 0.35);
  transition: transform 0.15s ease;
}

.toggle-switch input:checked + .toggle-track {
  background-color: var(--color-brand);
  opacity: 1;
}

.toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(1.25rem);
}

.toggle-switch input:focus-visible + .toggle-track {
  box-shadow: 0 0 0 3px rgba(var(--color-brand-rgb), 0.25);
}

.toggle-side-label {
  color: var(--color-text-subtle);
  font-weight: 500;
}

.toggle-side-label.toggle-side-label-active {
  color: var(--color-text-default);
  font-weight: 700;
}

/* ============================================================
   Stat cards, chart cards, gradient highlight card.
   ============================================================ */

.stat-card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1.25rem;
  position: relative;
}

.stat-icon-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  margin-bottom: 0.875rem;
}

.stat-icon-chip .icon {
  width: 1.375rem;
  height: 1.375rem;
}

.stat-icon-chip-brand {
  background-color: var(--color-brand-light);
  color: var(--color-brand);
}

.stat-icon-chip-teal {
  background-color: rgba(23, 176, 167, 0.14);
  color: var(--color-chip-teal);
}

.stat-icon-chip-amber {
  background-color: rgba(240, 168, 104, 0.2);
  color: #B96E1F;
}

.stat-icon-chip-rose {
  background-color: rgba(232, 139, 160, 0.18);
  color: #C15574;
}

.stat-card-value {
  color: var(--color-text-default);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-card-label {
  color: var(--color-text-subtle);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

a.stat-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

a.stat-card:hover {
  box-shadow: var(--shadow-card-lg);
}

.type-card-badge {
  margin-top: 0.75rem;
}

.sidebar-brand span {
  font-size: 0.9375rem;
  line-height: 1.2;
}

.chart-card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .chart-card {
    padding: 1.5rem;
  }
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.chart-card-title {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--color-text-default);
}

.chart-card-filter {
  font-size: 0.8125rem;
  color: var(--color-text-subtle);
  border: 1px solid var(--color-border);
  border-radius: 9999px;
  padding: 0.375rem 0.75rem;
  min-height: 36px;
  background-color: var(--color-bg-surface);
}

.chart-container {
  position: relative;
  width: 100%;
  height: 240px;
}

@media (min-width: 768px) {
  .chart-container {
    height: 270px;
  }
}

.chart-container-sm {
  position: relative;
  width: 100%;
  height: 64px;
}

.gradient-card {
  background: var(--gradient-brand);
  color: #FFFFFF;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.25rem;
  position: relative;
  overflow: hidden;
}

.gradient-card::before {
  content: "";
  position: absolute;
  top: -30%;
  right: -20%;
  width: 60%;
  padding-bottom: 60%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 70%);
  pointer-events: none;
}

.gradient-card-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.gradient-card-value {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 0.375rem;
  letter-spacing: -0.01em;
}

/* ============================================================
   Dashboard and weapon-type management layout.
   ============================================================ */

.dashboard-hero {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: var(--radius-card);
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: var(--shadow-card-lg);
}

.dashboard-hero h2,
.dashboard-panel h2,
.weapon-type-management-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.dashboard-hero h2 { font-size: 1.35rem; }
.dashboard-hero > div > p:last-child { margin-top: .4rem; color: rgba(255,255,255,.8); font-size: .875rem; }
.dashboard-kicker, .weapon-type-management-eyebrow { margin: 0 0 .25rem; font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-subtle); }
.dashboard-hero .dashboard-kicker { color: rgba(255,255,255,.72); }
.dashboard-quick-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.dashboard-quick-action { display: inline-flex; min-width: 4.25rem; min-height: 3.75rem; flex: 1 1 4.5rem; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; padding: .45rem .6rem; border: 1px solid rgba(255,255,255,.48); border-radius: .75rem; color: #fff; text-align: center; text-decoration: none; background: rgba(255,255,255,.12); font-size: .6875rem; font-weight: 700; line-height: 1.1; transition: background-color .15s ease, transform .15s ease; }
.dashboard-quick-action .icon { width: 1.25rem; height: 1.25rem; }
.dashboard-quick-action:hover { color: #fff; background: rgba(255,255,255,.23); transform: translateY(-1px); }

.dashboard-panel {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1.25rem;
}
.dashboard-panel-header, .weapon-type-management-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.dashboard-count-pill { flex: 0 0 auto; border: 1px solid var(--color-brand-light); border-radius: 9999px; padding: .3rem .6rem; background: var(--color-brand-light); color: var(--color-brand); font-size: .75rem; font-weight: 700; white-space: nowrap; }
.dashboard-inventory-chart { height: 280px; }
.dashboard-chart-note { display: flex; align-items: center; gap: .4rem; margin: .75rem 0 0; font-size: .75rem; color: var(--color-text-subtle); }
.dashboard-chart-note span { display: inline-block; width: .65rem; height: .65rem; border-radius: .2rem; background: rgba(226, 76, 76, .82); }
.dashboard-trend-chart { height: 280px; }
.dashboard-approval-total { margin: -.35rem 0 1rem; font-weight: 700; color: var(--color-brand); }
.dashboard-queue-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 0; border-top: 1px solid var(--color-border); text-decoration: none; }
.dashboard-queue-row strong { font-size: .8125rem; }
.dashboard-queue-row p { margin: .15rem 0 0; font-size: .75rem; color: var(--color-text-subtle); }
.dashboard-queue-row > span { color: var(--color-text-subtle); font-size: .75rem; white-space: nowrap; }

.weapon-type-management-card .table-card { border: 0; box-shadow: none; border-radius: 0; }
.weapon-type-management-card .data-table th:nth-child(2), .weapon-type-management-card .data-table td:nth-child(2) { min-width: 7rem; white-space: normal; }

@media (min-width: 768px) {
  .dashboard-hero { flex-direction: row; align-items: center; padding: 1.5rem; }
  .dashboard-hero h2 { font-size: 1.5rem; }
  .dashboard-panel { padding: 1.5rem; }
}

/* ============================================================
   Tables & the shared table/card-list responsive pattern.
   ============================================================ */

.table-card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.125rem 1.375rem;
  border-bottom: 1px solid var(--color-border);
}

.table-card-title {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--color-text-default);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

table.data-table thead th {
  background-color: var(--color-bg-page);
  color: var(--color-text-subtle);
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.75rem 1.375rem;
  border-bottom: 1px solid var(--color-border);
}

table.data-table tbody td {
  padding: 0.875rem 1.375rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-default);
  vertical-align: middle;
}

table.data-table tbody tr:last-child td {
  border-bottom: none;
}

table.data-table tbody tr:hover td {
  background-color: var(--color-bg-page);
}

/* Stacked card list — the mobile counterpart of .data-table, rendered */
/* from the exact same row data via render_data_list() in functions.php. */

.card-list-item {
  display: block;
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1rem 1.125rem;
  text-decoration: none;
  color: inherit;
}

.card-list-title {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--color-text-default);
  margin-bottom: 0.5rem;
  overflow-wrap: anywhere;
}

.card-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.3125rem 0;
  font-size: 0.875rem;
}

.card-list-label {
  color: var(--color-text-subtle);
  flex-shrink: 0;
}

.card-list-value {
  color: var(--color-text-default);
  font-weight: 500;
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
}

.card-list-actions {
  margin-top: 0.625rem;
  padding-top: 0.625rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
