html {
  font-size: 16px;
}

/* =============================================================
   ADMIN DESIGN SYSTEM (DESIGN.md)
   Style: Enterprise / data-dense (Ant-inspired)
   Typography scale: 12 / 14 / 16 / 20 / 24 / 32
   Spacing scale: 4 / 8 / 12 / 16 / 24 / 32
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@100;200;300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@200;300;400;500;600;700;800&display=swap');

:root {
  --page-bg: #f8fafc;
  --page-bg-2: #f1f5f9;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --surface-blue: #eff6ff;
  --line: #cbd5e1;
  --line-soft: #f1f5f9;
  --text: #0f172a;
  --muted: #475569;
  --muted-2: #64748b;
  --brand: #4f46e5;
  --brand-strong: #4338ca;
  --brand-soft: #eef2ff;
  --info: #3b82f6;
  --teal: #06b6d4;
  --green: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.03), 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 10px 15px -3px rgba(15, 23, 42, 0.03);
  --shadow-lift: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.08);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 12px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --size-12: 0.75rem;
  --size-14: 0.875rem;
  --size-16: 1rem;
  --size-20: 1.25rem;
  --size-24: 1.5rem;
  --size-32: 2rem;
  --font-body: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", monospace;
  --transition: 280ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 160ms cubic-bezier(0.4, 0, 0.2, 1);
  --bs-primary: #4f46e5;
  --bs-secondary: #8b5cf6;
  --bs-success: #10b981;
  --bs-warning: #f59e0b;
  --bs-danger: #f43f5e;
}

body {
  margin: 0;
  min-width: 320px;
  background: linear-gradient(180deg, var(--page-bg) 0%, var(--page-bg-2) 100%);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--size-16);
  letter-spacing: 0;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
}

a:hover {
  color: var(--brand-strong);
}

.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  flex: 0 0 284px;
  width: 284px;
  height: 100vh;
  padding: 18px 14px;
  overflow: visible;
  background: #ffffff;
  border-right: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.02);
  backdrop-filter: blur(12px);
}

.brand {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  min-height: 56px;
  padding: 8px 10px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.brand--logo-only {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-2);
  padding: var(--space-4) 12px 18px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand), #5B9FFF);
  box-shadow:
    0 4px 10px rgba(79, 70, 229, 0.28),
    0 1px 0 rgba(255,255,255,0.3) inset;
  font-size: 13px;
  font-weight: 800;
}

.brand-mark--logo {
  display: block;
  width: auto;
  height: 54px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.brand-mark--icon {
  display: none;
  width: 34px;
  height: 34px;
  max-width: 34px;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.sidebar-toggle {
  position: absolute;
  top: 112px;
  right: -10px;
  z-index: 12;
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 52px;
  padding: 0 2px;
  appearance: none;
  color: var(--brand);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.sidebar-toggle:hover,
.sidebar-toggle:focus {
  color: var(--brand-strong);
  background: transparent;
  box-shadow: none;
  transform: translateX(1px);
}

.sidebar-toggle i {
  font-size: 20px;
  line-height: 1;
}

.brand-title,
.brand-subtitle {
  display: block;
  line-height: 1.2;
}

.brand-title {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 650;
}

.sidebar-nav {
  padding: 4px 0 8px;
}

.sidebar-nav-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 2px;
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

.sidebar-nav-scroll::-webkit-scrollbar {
  display: none; /* Chrome, Safari and Opera */
}

.sidebar-user {
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
  margin-top: 10px;
  padding: 12px 10px 8px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: #ffffff;
}

.sidebar-user-name {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-menu .btn {
  width: 100%;
}

.sidebar-user-menu {
  position: relative;
}

.sidebar-user-menu .dropdown-menu {
  width: 100%;
  min-width: 100%;
  max-width: min(280px, calc(100vw - 24px));
  z-index: 1095;
}

.sidebar-nav .nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  padding: 8px 12px 8px 16px;
  margin: 4px 0;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
  transition: color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.sidebar-nav .nav-link .nav-link-icon {
  flex: 0 0 18px;
  width: 18px;
  text-align: center;
  font-size: 16px;
  color: var(--muted-2);
  opacity: 1;
  transition: transform var(--transition-fast) cubic-bezier(0.4, 0, 0.2, 1), color var(--transition-fast), opacity var(--transition-fast);
}

.sidebar-nav .nav-link .nav-link-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sidebar-nav .nav-link::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 0;
  border-radius: 0 4px 4px 0;
  background: var(--brand);
  transition: height var(--transition-fast) cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link:focus {
  color: var(--text);
  background: var(--page-bg-2);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.02),
    0 4px 12px rgba(0, 0, 0, 0.02);
}

.sidebar-nav .nav-link:hover .nav-link-icon,
.sidebar-nav .nav-link:focus .nav-link-icon {
  color: var(--text);
  opacity: 1;
  transform: scale(1.08);
}

.sidebar-nav .nav-link.active {
  color: var(--brand);
  background: var(--brand-soft);
  box-shadow:
    0 1px 3px rgba(79, 70, 229, 0.08),
    0 4px 12px rgba(79, 70, 229, 0.05),
    inset 0 0 0 1px rgba(79, 70, 229, 0.15);
}

.sidebar-nav .nav-link.active .nav-link-icon {
  color: var(--brand);
  opacity: 1;
}

.sidebar-nav .nav-link.active::before {
  height: 18px;
}

.sidebar-nav .nav-link-collapse {
  width: 100%;
  border: 0;
  background: transparent;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
}

.sidebar-nav .nav-link-collapse .nav-collapse-icon {
  font-size: 11px;
  transition: transform 0.16s ease;
}

.sidebar-nav .nav-link-collapse[aria-expanded="true"] .nav-collapse-icon {
  transform: rotate(180deg);
}

.sidebar-submenu .nav-link {
  padding-left: 32px;
  font-size: 13px;
}

.sidebar-submenu .nav-link::before {
  content: "";
  position: absolute;
  left: 20px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: transparent;
  transform: scale(0);
  transition: transform var(--transition-fast) ease, background var(--transition-fast) ease;
}

.sidebar-submenu .nav-link.active::before {
  background: var(--brand);
  transform: scale(1);
}

.sidebar-heading {
  margin: 18px 10px 7px;
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

@media (min-width: 821px) {
  .admin-sidebar,
  .admin-main {
    transition: width var(--transition), flex-basis var(--transition);
  }

  html.admin-sidebar-collapsed .admin-sidebar {
    flex-basis: 76px;
    width: 76px;
    padding-right: 10px;
    padding-left: 10px;
  }

  html.admin-sidebar-collapsed .brand--logo-only {
    padding-right: 0;
    padding-left: 0;
    padding-bottom: 18px;
  }

  html.admin-sidebar-collapsed .brand-mark--logo {
    display: none;
  }

  html.admin-sidebar-collapsed .brand-mark--icon {
    display: block;
    max-width: 34px;
    height: 34px;
  }

  html.admin-sidebar-collapsed .sidebar-nav-scroll {
    padding-right: 0;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  html.admin-sidebar-collapsed .sidebar-nav-scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }

  html.admin-sidebar-collapsed .sidebar-nav .nav-link {
    justify-content: center;
    min-height: 40px;
    padding: 9px;
  }

  html.admin-sidebar-collapsed .sidebar-nav .nav-link::before,
  html.admin-sidebar-collapsed .sidebar-heading,
  html.admin-sidebar-collapsed .sidebar-submenu,
  html.admin-sidebar-collapsed .sidebar-nav .nav-link > span:not(.nav-link-label),
  html.admin-sidebar-collapsed .sidebar-nav .nav-link-label span,
  html.admin-sidebar-collapsed .sidebar-nav .nav-collapse-icon,
  html.admin-sidebar-collapsed .sidebar-user-label,
  html.admin-sidebar-collapsed .sidebar-user-menu .dropdown-toggle::after {
    display: none;
  }

  html.admin-sidebar-collapsed .sidebar-nav .nav-link .nav-link-icon {
    flex-basis: 18px;
    width: 18px;
    font-size: 16px;
  }

  html.admin-sidebar-collapsed .sidebar-user {
    padding-right: 0;
    padding-left: 0;
  }

  html.admin-sidebar-collapsed .sidebar-user-menu .btn {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 40px;
    padding: 0;
  }

  html.admin-sidebar-collapsed .sidebar-user-icon {
    font-size: 17px;
  }

  html.admin-sidebar-collapsed .sidebar-user-menu .dropdown-menu {
    left: calc(100% + 10px) !important;
    right: auto !important;
    top: auto !important;
    bottom: 0 !important;
    width: 220px;
    min-width: 220px;
    margin-bottom: 0;
    transform: none !important;
  }

  html.admin-sidebar-collapsed .sidebar-toggle {
    right: -10px;
  }
}

.admin-main {
  flex: 1;
  min-width: 0;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 68px;
  padding: 12px 26px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(16px);
  box-shadow:
    0 1px 2px rgba(26, 43, 66, 0.04),
    0 4px 16px rgba(26, 43, 66, 0.05);
}

.admin-topbar form {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-kicker {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-title {
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
}

.signed-in {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.admin-content {
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
  padding: 26px;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 0px;
}

.page-kicker {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-note {
  max-width: 820px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.page-actions > * {
  flex: 0 0 auto;
}

.page-actions form {
  margin: 0;
}

.page-actions--toolbar {
  flex-wrap: nowrap;
  overflow: visible;
}

.page-actions.table-toolbar {
  width: auto;
  margin-bottom: 0;
}

.page-actions.table-toolbar .table-toolbar__group {
  margin-left: 0;
}

.page-actions--toolbar .dropdown {
  display: flex;
  align-items: center;
}

.page-actions--toolbar .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  white-space: nowrap;
}

.page-kicker,
.page-heading h1.h3.mb-1,
.page-heading .page-note.mb-0 {
  display: none !important;
}

.table-toolbar {
  display: flex !important;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  margin-bottom: 10px;
  overflow: visible;
}

.table-toolbar__group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 8px;
  margin-left: auto;
  min-width: max-content;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .table-toolbar {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .table-toolbar__group {
    flex-wrap: wrap;
    justify-content: flex-start;
    min-width: 0;
    white-space: normal;
    width: 100%;
    margin-left: 0;
  }

  .table-toolbar__group .btn,
  .table-toolbar .btn {
    white-space: nowrap;
  }
}

.table-toolbar__group > * {
  flex: 0 0 auto;
}

.table-toolbar__group > form {
  margin: 0;
}

.table-toolbar .dropdown {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.table-toolbar .btn,
.table-toolbar__group .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 12px;
  font-size: var(--size-14);
  line-height: 1.25;
  white-space: nowrap;
}

.table-toolbar .dropdown-toggle::after {
  margin-left: 8px;
}

.table-toolbar .dropdown-menu {
  min-width: 18rem;
}

.admin-breadcrumb-wrap {
  margin-bottom: 10px;
}

.brother-sku-page-start {
  margin-top: 0;
}

.admin-breadcrumb-wrap + .brother-sku-page-start {
  margin-top: 0;
}

.admin-breadcrumb {
  padding: 8px 12px;
  margin-bottom: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.85);
}

.admin-breadcrumb.mb-3 {
  margin-bottom: 0 !important;
}

.admin-breadcrumb .breadcrumb-item,
.admin-breadcrumb .breadcrumb-item a {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.admin-breadcrumb .breadcrumb-item.active {
  color: var(--text);
}

.bulk-toolbar-card .card-body {
  padding: 14px 16px;
}

h1,
h2,
h3,
.h3,
.h4,
.h5,
.h6 {
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0;
}

.card,
.panel,
.quick-action {
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.card {
  overflow: hidden;
}

/* Dropdown/combobox panel nằm absolute bên dưới ô; tránh bị cắt bởi overflow của .card */
.card:has(.table-toolbar .dropdown),
.card:has(.admin-filter-combobox),
.card.card-filter-overflow-visible {
  overflow: visible;
}

.card-body {
  padding: 18px;
}

.card.shadow-sm,
.shadow-sm {
  box-shadow: var(--shadow-sm) !important;
}

.admin-notice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  margin-bottom: 14px;
  border: 1px solid;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  font-weight: 700;
  line-height: 1.45;
}

.admin-notice-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 999px;
}

.admin-notice-success {
  color: #14532d;
  background: linear-gradient(180deg, #f2fff7, #ffffff);
  border-color: #bfe9cc;
}

.admin-notice-success .admin-notice-dot {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

.admin-notice-error {
  color: #8a1538;
  background: linear-gradient(180deg, #fff5f7, #ffffff);
  border-color: #f8c4d0;
}

.admin-notice-error .admin-notice-dot {
  background: var(--rose);
  box-shadow: 0 0 0 4px rgba(194, 65, 95, 0.12);
}

.device-qr-cell {
  width: 92px;
}

.device-qr {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  padding: 4px;
  border: 1px solid #d8deea;
  border-radius: 8px;
  background: #fff;
}

.device-qr-trigger {
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: zoom-in;
}

.device-qr-trigger:hover .device-qr,
.device-qr-trigger:focus-visible .device-qr {
  border-color: var(--brand);
  box-shadow: 0 8px 20px rgba(37, 56, 118, 0.18);
}

.device-qr svg {
  width: 100%;
  height: 100%;
  display: block;
}

.device-qr-modal .modal-body {
  display: grid;
  gap: 16px;
  justify-items: center;
}

.device-qr-modal-name {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.device-qr-large {
  width: min(72vw, 360px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 14px;
  border: 1px solid #d8deea;
  border-radius: 12px;
  background: #fff;
}

.device-qr-large svg {
  width: 100%;
  height: 100%;
  display: block;
}

.device-qr-modal-code {
  display: grid;
  gap: 4px;
  justify-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.device-qr-modal-code code {
  color: var(--text);
  font-size: 15px;
  user-select: all;
}

.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  line-height: 1.35;
  box-shadow: none;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand) 0%, #6366f1 100%);
  border-color: var(--brand);
  box-shadow:
    0 2px 4px rgba(79, 70, 229, 0.12),
    0 6px 16px rgba(79, 70, 229, 0.1);
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(135deg, var(--brand-strong) 0%, var(--brand) 100%);
  border-color: var(--brand-strong);
  box-shadow:
    0 3px 6px rgba(79, 70, 229, 0.15),
    0 8px 20px rgba(79, 70, 229, 0.15);
  transform: translateY(-1px);
}

.btn-outline-primary {
  color: var(--brand);
  border-color: rgba(79, 70, 229, 0.30);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.06);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand) 0%, #6366f1 100%);
  border-color: var(--brand);
  box-shadow:
    0 2px 6px rgba(79, 70, 229, 0.15),
    0 6px 16px rgba(79, 70, 229, 0.1);
}

.btn-outline-secondary {
  color: var(--muted);
  border-color: var(--line);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  color: var(--text);
  background: var(--surface-muted);
  border-color: var(--line);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.btn-outline-danger {
  color: var(--rose);
  border-color: rgba(244, 63, 94, 0.25);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(244, 63, 94, 0.06);
}

.btn-outline-danger:hover,
.btn-outline-danger:focus {
  color: #ffffff;
  background: var(--rose);
  border-color: var(--rose);
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.15);
}

.btn-outline-warning {
  color: var(--amber);
  border-color: rgba(245, 158, 11, 0.3);
  background: #ffffff;
}

.btn-outline-warning:hover,
.btn-outline-warning:focus {
  color: #ffffff;
  background: var(--amber);
  border-color: var(--amber);
}

.form-label {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.form-control,
.form-select {
  min-height: 38px;
  border-radius: var(--radius-sm);
  border-color: #cbd5e1;
  color: var(--text);
  background-color: #ffffff;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.02),
    0 2px 6px rgba(15, 23, 42, 0.02);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
  border-color: #6366f1;
  box-shadow:
    0 0 0 4px rgba(99, 102, 241, 0.15),
    0 1px 2px rgba(15, 23, 42, 0.02);
}

.form-check-input {
  border-color: #b8c5d6;
}

.form-check-input:checked {
  background-color: var(--brand);
  border-color: var(--brand);
}

.admin-active-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  width: 100%;
  margin-bottom: 0;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.admin-active-toggle .form-check-input {
  position: static;
  float: none;
  margin-left: 0;
  margin-top: 0;
}

.admin-active-toggle .form-check-label {
  margin-bottom: 0;
  color: var(--text);
  font-size: var(--size-14);
  font-weight: 650;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.form-grid .admin-active-toggle-cell {
  display: flex;
  align-items: flex-end;
}

.product-variant-panel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 14px;
  box-shadow:
    0 1px 2px rgba(26, 43, 66, 0.04),
    0 3px 8px rgba(26, 43, 66, 0.04);
}

.product-variant-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.product-variant-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.product-variant-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.product-variant-add-button {
  min-height: 38px;
  white-space: nowrap;
}

.product-multi-select {
  min-height: 168px;
}

.product-variant-selector-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.product-variant-selector {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 10px;
}

.product-variant-checkbox-list {
  max-height: 180px;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding-right: 2px;
}

.product-variant-tags {
  display: grid;
  gap: 10px;
}

.product-variant-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.product-variant-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-blue);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.product-variant-tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.12);
  color: #111827;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.product-variant-tag-remove:hover {
  background: rgba(220, 38, 38, 0.22);
  color: #991b1b;
}

.product-variant-summary {
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: #fff;
}

.product-variant-summary-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 6px;
}

.product-variant-table th,
.product-variant-table td {
  vertical-align: middle;
}

.admin-toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1080;
  display: grid;
  gap: 10px;
  max-width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.admin-toast {
  max-width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius);
  background: var(--text);
  color: #fff;
  box-shadow:
    0 4px 8px rgba(26, 43, 66, 0.16),
    0 16px 40px rgba(26, 43, 66, 0.22),
    0 1px 0 rgba(255,255,255,0.08) inset;
  font-size: 14px;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 200ms ease, transform 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.admin-toast-error {
  background: #7f1d1d;
}

.admin-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.admin-ajax-busy {
  opacity: 0.72;
}

.admin-ajax-busy button[type="submit"] {
  cursor: progress;
}

/* CRUD + trash modal surfaces (frontend only, no backend changes) */
.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1045;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(3px);
}

.admin-fullheight-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1050;
  width: min(820px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow:
    -10px 0 26px rgba(17, 24, 39, 0.15),
    -2px 0 8px rgba(17, 24, 39, 0.08);
}

.admin-fullheight-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.94);
}

.admin-fullheight-modal__header .btn-close {
  flex: 0 0 auto;
}

.admin-fullheight-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0 16px 16px;
  background: var(--surface-muted);
}

.admin-fullheight-modal__body > .card:first-child {
  margin-top: 10px;
}

.admin-floating-modal {
  position: fixed;
  inset: clamp(10px, 3vh, 24px) clamp(10px, 2vw, 24px);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow:
    0 8px 26px rgba(17, 24, 39, 0.14),
    0 24px 48px rgba(17, 24, 39, 0.18);
  overflow: hidden;
}

.admin-floating-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  background: var(--surface);
}

.admin-floating-modal--compact {
  inset: auto;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  width: min(560px, calc(100vw - 24px));
  max-height: min(88vh, 720px);
  transform: translate(-50%, -50%);
}

.admin-floating-modal--wide {
  inset: auto;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  width: 90%;
  max-height: min(88vh, 820px);
  transform: translate(-50%, -50%);
}

.admin-floating-modal--compact .admin-floating-modal__body {
  padding: 18px;
  padding-top: 48px; /* room for absolute close button */
  background: transparent;
}

.admin-floating-modal--wide .admin-floating-modal__body {
  padding: 18px;
  padding-top: 48px; /* room for absolute close button */
  background: transparent;
}

.admin-floating-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.filter-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.filter-header .h6 {
  font-size: 15px;
}

.filter-form {
  display: grid;
  gap: 14px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Searchable filter selects: text input + dropdown over hidden native <select> */
.admin-filter-combobox {
  position: relative;
  width: 100%;
}

.admin-filter-combobox .admin-combobox-select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
  opacity: 0;
}

.admin-combobox-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 1060;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-combobox-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  cursor: pointer;
}

.admin-combobox-option:hover,
.admin-combobox-option:focus-visible {
  background: var(--brand-soft);
  outline: none;
}

/* Device activations: filter toolbar on one row */
.filter-form-device-toolbar {
  gap: 0;
}

.filter-form-device-toolbar .filter-device-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.filter-form-device-toolbar .filter-device-field-grow {
  flex: 1 1 200px;
  min-width: 160px;
}

.filter-form-device-toolbar .filter-device-field-narrow {
  flex: 0 0 auto;
  width: 110px;
  max-width: 100%;
}

.filter-form-device-toolbar .filter-device-field-location {
  flex: 0 0 auto;
  width: 180px;
  max-width: 100%;
}

.filter-form-device-toolbar .filter-device-field-status {
  width: 165px;
}

.filter-form-device-toolbar .filter-device-field-keyword {
  flex-basis: 150px;
}

.filter-form-device-toolbar .filter-device-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 10px;
  margin-left: auto;
}

/* Device activation table: compact cell padding on small screens */
.device-activation-table > :not(caption) > * > * {
  padding: 0.72rem 0.75rem;
}

/* === Responsive: Tablet (≤ 768px) === */
@media (max-width: 768px) {
  .admin-fullheight-modal {
    width: 100vw;
  }

  /* Base floating modal: stretch to fill screen minus small margin */
  .admin-floating-modal {
    inset: 8px;
    border-radius: 10px;
  }

  /* Reset centered-modal positioning to full-screen inset */
  .admin-floating-modal--compact,
  .admin-floating-modal--wide {
    position: fixed;
    inset: 8px;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: none;
    transform: none;
  }

  /* Compact modal: give extra top padding so close btn doesn't overlap title */
  .admin-floating-modal--compact .admin-floating-modal__body,
  .admin-floating-modal--wide .admin-floating-modal__body {
    padding: 14px;
    padding-top: 48px;
    overflow-y: auto;
  }

  .admin-floating-modal__body {
    padding: 12px;
  }

  .product-variant-selector-grid {
    grid-template-columns: 1fr;
  }

  /* Device filter: 2-column grid on tablet */
  .filter-form-device-toolbar .filter-device-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .filter-form-device-toolbar .filter-device-field-narrow,
  .filter-form-device-toolbar .filter-device-field-location,
  .filter-form-device-toolbar .filter-device-field-status,
  .filter-form-device-toolbar .filter-device-field-grow,
  .filter-form-device-toolbar .filter-device-field-keyword {
    width: 100%;
    flex: none;
    min-width: 0;
  }

  .filter-form-device-toolbar .filter-device-actions {
    grid-column: 1 / -1;
    margin-left: 0;
    width: 100%;
  }

  .filter-form-device-toolbar .filter-device-actions .btn {
    flex: 1 1 0;
  }

  /* Device activation table: tighter padding */
  .device-activation-table > :not(caption) > * > * {
    padding: 0.5rem 0.6rem;
  }

  .device-activation-table .device-activation-action-cell {
    white-space: nowrap;
  }
}

/* === Responsive: Mobile (≤ 480px) === */
@media (max-width: 480px) {
  /* Device filter: single column on mobile */
  .filter-form-device-toolbar .filter-device-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .filter-form-device-toolbar .filter-device-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  /* Table: smaller text and padding */
  .device-activation-table > :not(caption) > * > * {
    padding: 0.4rem 0.5rem;
    font-size: 13px;
  }

  .device-activation-table thead th {
    font-size: 10px;
  }

  /* Filter card: tighter padding */
  .filter-form-device-toolbar + .card-body,
  .card-body:has(.filter-form-device-toolbar) {
    padding: 12px;
  }
}

.bulk-select-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.bulk-select-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.bulk-select-form {
  display: grid;
  gap: 14px;
}

.bulk-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.bulk-select-item {
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-muted);
  box-shadow: 0 1px 3px rgba(26, 43, 66, 0.04);
}

.bulk-select-item-wide {
  grid-column: 1 / -1;
}

.bulk-select-inline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.bulk-select-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.bulk-edit-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.bulk-edit-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.bulk-edit-table {
  min-width: 980px;
}

.bulk-edit-table td,
.bulk-edit-table th {
  vertical-align: middle;
}

.bulk-edit-index {
  white-space: nowrap;
  font-weight: 700;
}

.bulk-edit-table .form-control,
.bulk-edit-table .form-select {
  min-width: 160px;
}

.bulk-edit-check {
  display: flex;
  justify-content: center;
  margin: 0;
}

.bulk-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.table-responsive {
  border: 1px solid rgba(15, 23, 42, 0.05);
  border-radius: var(--radius);
  overflow-x: auto;
  overflow-y: visible;
}

.table {
  margin-bottom: 0;
  color: #334155;
}

.table > :not(caption) > * > * {
  padding: 0.72rem 0.75rem;
  border-bottom-color: var(--line-soft);
}

.table thead th {
  color: var(--muted);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--line-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.table-sort-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
}

.table-sort-link:hover {
  color: var(--brand);
}

.table-sort-indicator {
  min-width: 10px;
}

.table-check-cell {
  width: 44px;
  text-align: center;
}

.table-check-cell[data-bulk-select-header] {
  cursor: pointer;
  user-select: none;
}

.table tbody tr {
  transition: background var(--transition-fast);
}

.table tbody tr:hover {
  background: rgba(79, 70, 229, 0.02) !important;
}

.table td,
.table th {
  vertical-align: middle;
}

.table-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.table-actions.device-activation-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}

.device-activation-action-cell {
  width: 1%;
  white-space: nowrap;
}

.brother-system-toolbar-line {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brother-system-selection-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
}

.brother-selection-btn {
  min-height: 38px;
}

.brother-comparison-filter-group .btn {
  min-height: 38px;
  padding: 6px 12px;
  font-size: var(--size-14);
}

.brother-system-main-toolbar.table-toolbar {
  width: auto;
  margin-bottom: 0;
}

.brother-system-main-toolbar .table-toolbar__group {
  margin-left: 0;
}

.brother-preview-btn {
  min-width: 156px;
  white-space: nowrap;
}

.brother-preview-control-line {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
}

.brother-preview-page-size {
  min-width: 140px;
}

.brother-preview-column-toolbar.table-toolbar {
  width: auto;
  margin-bottom: 0;
}

.brother-preview-column-toolbar .table-toolbar__group {
  margin-left: 0;
}

@media (max-width: 992px) {
  .brother-system-toolbar-line {
    flex-wrap: wrap;
  }

  .brother-system-selection-actions {
    flex-wrap: wrap;
  }

  .brother-system-main-toolbar.table-toolbar {
    width: 100%;
  }

  .brother-system-main-toolbar .table-toolbar__group {
    width: 100%;
    justify-content: flex-start;
  }

.brother-preview-control-line {
  justify-content: flex-start;
  flex-wrap: wrap;
}
}

.redis-filter-toolbar {
  width: 100%;
}

.redis-filter-toolbar .table-toolbar__group {
  width: 100%;
  justify-content: flex-start;
}

.redis-reset-btn {
  text-align: center;
  line-height: 1;
}

/* ===== Redis admin page: responsive fixes ===== */

/* Long Redis keys / values must wrap, never overflow horizontally */
.redis-panel-dl {
  overflow-wrap: break-word;
  word-break: break-all;
}

.redis-panel-dl dt {
  font-weight: 700;
  color: var(--muted);
  font-size: 13px;
}

.redis-panel-dl dd {
  overflow-wrap: break-word;
  word-break: break-all;
  min-width: 0;
  margin-bottom: 8px;
}

/* Dashboard-grid used as Redis 2-panel layout:
   ensure min-width doesn't force horizontal scroll on phones */
.redis-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

/* Action buttons inside cache panel: always wrap cleanly */
.redis-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.redis-panel-actions .btn {
  white-space: nowrap;
}

/* Filter form on mobile: all inputs full-width */
@media (max-width: 640px) {
  /* Redis info grid: stack to 1 column */
  .redis-info-grid,
  section.dashboard-grid.mt-3 {
    grid-template-columns: 1fr;
  }

  /* Panel padding reduced */
  section.dashboard-grid.mt-3 > .panel {
    padding: 16px;
  }

  /* dl.row inside panels: switch to stacked layout */
  section.dashboard-grid.mt-3 .row.mb-0,
  section.panel .row.mb-0 {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  section.dashboard-grid.mt-3 .row.mb-0 > [class*="col-"],
  section.panel .row.mb-0 > [class*="col-"] {
    width: 100%;
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
    overflow-wrap: break-word;
    word-break: break-all;
  }

  /* Term (dt) styling in stacked mode */
  section.dashboard-grid.mt-3 .row.mb-0 dt,
  section.panel .row.mb-0 dt {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 2px;
  }

  /* Action buttons: full-width on mobile */
  .redis-panel-actions {
    flex-direction: column;
  }

  .redis-panel-actions .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  /* Filter form for device table: stack all to 1 col */
  section.panel.mt-3 > form.row.g-2 > [class*="col-"] {
    width: 100%;
    max-width: 100%;
  }
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.125rem;
  height: 2.125rem;
  padding: 0;
  line-height: 1;
}

.btn-icon i {
  font-size: 1.05rem;
  line-height: 1;
}

.table-footer {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.badge {
  border-radius: 999px;
  padding: 0.42em 0.72em;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.bg-success {
  background-color: #dff7e8 !important;
  color: #166534 !important;
}

.bg-secondary {
  background-color: #e9eef5 !important;
  color: #46566d !important;
}

.bg-danger {
  background-color: #ffe7ed !important;
  color: #b42342 !important;
}

.fgp-status-badge {
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
}

.fgp-status-badge--completed {
  background-color: #dff7e8 !important;
  border-color: #b7e4c7;
  color: #166534 !important;
}

.fgp-status-badge--active {
  background-color: #e3f0ff !important;
  border-color: #bfd8ff;
  color: #0f4c81 !important;
}

.fgp-status-badge--inactive {
  background-color: #eef2f7 !important;
  border-color: #d7dee8;
  color: #475569 !important;
}

.fgp-status-badge--deleted {
  background-color: #ffe7ed !important;
  border-color: #fecdd6;
  color: #b42342 !important;
}

.fgp-status-badge--neutral {
  background-color: #f8fafc !important;
  border-color: #e2e8f0;
  color: #475569 !important;
}

.bg-info {
  background-color: #e0f2fe !important;
  color: #075985 !important;
}

.admin-accounts__row--selected {
  background: linear-gradient(180deg, #dfeafe 0%, #d5e4ff 100%);
}

.admin-accounts__row--selected > * {
  color: var(--text);
}

.admin-accounts__row--selected .text-muted,
.admin-accounts__row--selected .small.text-muted {
  color: #5d7291 !important;
}

.admin-accounts__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 0.4rem 0.78rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
}

.admin-accounts__pill--role {
  color: #244774;
  background: #edf3fb;
  border-color: #cfdeef;
}

.admin-accounts__pill--active {
  color: #166534;
  background: #e5f7eb;
  border-color: #b7e4c7;
}

.admin-accounts__pill--inactive {
  color: #9a5b00;
  background: #fff4db;
  border-color: #f4d7a1;
}

.admin-accounts__pill--deleted {
  color: #7f1d1d;
  background: #fde8e8;
  border-color: #f6b8b8;
}

.admin-accounts__action-cell {
  width: 1%;
  white-space: nowrap;
}

.admin-accounts__table-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.admin-token-toggle {
  margin-top: 8px;
  white-space: nowrap;
}

/* Token API modal: inner table must scroll horizontally on small screens */
.admin-floating-modal--wide .table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Edit account action row: wrap buttons gracefully on mobile */
.admin-accounts__edit-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Card inside floating modal: reduce padding on small screens */
@media (max-width: 640px) {
  /* Token create form + table: stack vertically */
  .admin-floating-modal--wide .row.g-3 > [class*="col-"] {
    width: 100%;
  }

  /* Tighten card-body inside floating modals */
  .admin-floating-modal .card-body,
  .admin-floating-modal--compact .card-body,
  .admin-floating-modal--wide .card-body {
    padding: 14px;
  }

  /* Reset password buttons: full-width stack */
  .admin-floating-modal--compact .d-flex.gap-2 {
    flex-direction: column;
  }

  .admin-floating-modal--compact .d-flex.gap-2 .btn {
    width: 100%;
    justify-content: center;
  }

  /* Token modal close button stays visible */
  .admin-floating-modal--wide .admin-floating-modal__close,
  .admin-floating-modal--compact .admin-floating-modal__close {
    top: 8px;
    right: 8px;
  }
}

/* --- Trang đăng nhập quản trị --- */
.admin-shell:not(:has(.admin-sidebar)) .admin-main .admin-content {
  max-width: none;
  padding: 0;
}

.admin-login-view {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: clamp(24px, 5vw, 48px) 18px;
  overflow: hidden;
}

.admin-login-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1200px 800px at 15% 10%, rgba(42, 109, 217, 0.12), transparent 55%),
    radial-gradient(900px 700px at 85% 90%, rgba(12, 122, 124, 0.08), transparent 50%),
    linear-gradient(165deg, #E8EFF8 0%, #F2F6FC 42%, #EDF2F8 100%);
}

.admin-login-bg__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  pointer-events: none;
}

.admin-login-bg__orb--1 {
  width: min(420px, 55vw);
  height: min(420px, 55vw);
  top: -12%;
  right: -8%;
  background: rgba(23, 105, 224, 0.35);
}

.admin-login-bg__orb--2 {
  width: min(360px, 50vw);
  height: min(360px, 50vw);
  bottom: -10%;
  left: -6%;
  background: rgba(15, 139, 141, 0.22);
}

.admin-login-bg__grid {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(19, 34, 56, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(19, 34, 56, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 45%, #000 20%, transparent 72%);
}

.admin-login-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
}

.admin-login-card {
  padding: clamp(28px, 4vw, 40px);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(208, 218, 232, 0.90);
  border-radius: 18px;
  box-shadow:
    0 2px 4px rgba(26, 43, 66, 0.04),
    0 8px 20px rgba(26, 43, 66, 0.06),
    0 28px 60px rgba(26, 43, 66, 0.09),
    0 1px 0 rgba(255, 255, 255, 0.95) inset;
  backdrop-filter: blur(16px);
}

.admin-login-brand {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line-soft);
}

.admin-login-brand__logo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center;
}

.admin-login-heading {
  margin: 0 0 6px;
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
}

.admin-login-lead {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.admin-login-label {
  font-size: 12px;
  font-weight: 750;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.admin-login-input-group .input-group-text {
  background: var(--surface-muted);
  border-color: var(--line);
  color: var(--muted-2);
  padding-left: 14px;
  padding-right: 12px;
  border-radius: 10px 0 0 10px;
}

.admin-login-input-group .form-control {
  border-color: var(--line);
  border-radius: 0 10px 10px 0;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
  min-height: 46px;
}

.admin-login-input-group .form-control:focus {
  border-color: rgba(42, 109, 217, 0.45);
  box-shadow:
    0 0 0 3px rgba(42, 109, 217, 0.12),
    0 1px 3px rgba(26, 43, 66, 0.06);
}

.admin-login-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 48px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: var(--radius);
  border: none;
  background: linear-gradient(135deg, var(--brand) 0%, #4A90E2 100%);
  box-shadow:
    0 3px 6px rgba(42, 109, 217, 0.20),
    0 10px 28px rgba(42, 109, 217, 0.28),
    0 1px 0 rgba(255,255,255,0.15) inset;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.admin-login-submit:hover {
  transform: translateY(-2px);
  box-shadow:
    0 4px 8px rgba(42, 109, 217, 0.24),
    0 14px 36px rgba(42, 109, 217, 0.32);
  background: linear-gradient(135deg, var(--brand-strong) 0%, var(--brand) 100%);
}

.admin-login-submit:active {
  transform: translateY(0);
  box-shadow:
    0 2px 4px rgba(42, 109, 217, 0.20),
    0 6px 16px rgba(42, 109, 217, 0.22);
}

.admin-login-submit__icon {
  font-size: 1.35rem;
  margin-right: -4px;
  line-height: 1;
}

.admin-login-footnote {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--muted-2);
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.admin-login-footnote .bi {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--brand);
}

.admin-login-copy {
  margin: 20px 0 0;
  text-align: center;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted-2);
  letter-spacing: 0.04em;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.metric-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-grid-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metric-card {
  position: relative;
  min-height: 146px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  z-index: 1;
}

.metric-card-pending::before {
  background: var(--amber);
}

.metric-card-pending:hover {
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 12px 20px rgba(245, 158, 11, 0.08), var(--shadow-lift);
  transform: translateY(-4px);
}

.metric-card-inspections::before {
  background: var(--brand);
}

.metric-card-inspections:hover {
  border-color: rgba(79, 70, 229, 0.35);
  box-shadow: 0 12px 20px rgba(79, 70, 229, 0.08), var(--shadow-lift);
  transform: translateY(-4px);
}

.metric-card-online::before {
  background: var(--green);
}

.metric-card-online:hover {
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 12px 20px rgba(16, 185, 129, 0.08), var(--shadow-lift);
  transform: translateY(-4px);
}

.metric-card-defects::before {
  background: var(--rose);
}

.metric-card-defects:hover {
  border-color: rgba(244, 63, 94, 0.35);
  box-shadow: 0 12px 20px rgba(244, 63, 94, 0.08), var(--shadow-lift);
  transform: translateY(-4px);
}

.metric-card-open::before {
  background: var(--teal);
}

.metric-card-open:hover {
  border-color: rgba(6, 182, 212, 0.35);
  box-shadow: 0 12px 20px rgba(6, 182, 212, 0.08), var(--shadow-lift);
  transform: translateY(-4px);
}

.metric-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.metric-value {
  margin-top: 10px;
  color: var(--text);
  font-size: 38px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.metric-note {
  margin-top: 10px;
  color: var(--muted-2);
  font-size: 13px;
  line-height: 1.4;
}

.panel {
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 850;
}

.panel p {
  margin: 5px 0 0;
  color: var(--muted);
}

.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.quick-action {
  display: block;
  min-height: 112px;
  padding: 16px;
  color: var(--text);
  text-decoration: none;
}

.quick-action:hover,
.quick-action:focus {
  color: var(--text);
  border-color: rgba(79, 70, 229, 0.35);
  box-shadow: 0 10px 25px rgba(79, 70, 229, 0.08), var(--shadow-lift);
  transform: translateY(-4px);
}

.quick-action-title {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.quick-action-copy {
  display: block;
  color: var(--muted-2);
  font-size: 13px;
  line-height: 1.45;
}

.workflow-panel {
  background: linear-gradient(180deg, #ffffff, #f7fbff);
}

.workflow-list {
  padding: 0;
  margin: 16px 0 0;
  list-style: none;
  counter-reset: workflow;
}

.workflow-list li {
  counter-increment: workflow;
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
  color: #344054;
}

.workflow-list li::before {
  content: counter(workflow);
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(42, 109, 217, 0.12);
}

.line-group-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.line-group-select-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--size-14);
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.line-group-select-option:hover {
  border-color: rgba(22, 119, 255, 0.28);
  background: var(--brand-soft);
  box-shadow: 0 8px 20px rgba(22, 119, 255, 0.08);
}

.line-group-select-option .form-check-input {
  flex: 0 0 auto;
  margin-top: 2px;
}

.chart-panel {
  min-height: 390px;
}

.trend-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(44px, 1fr));
  gap: 12px;
  min-height: 250px;
  padding: 18px 8px 4px;
  border-radius: var(--radius-sm);
  background:
    repeating-linear-gradient(0deg, transparent, transparent 48px, rgba(208, 218, 232, 0.55) 49px),
    var(--surface-muted);
  border: 1px solid var(--line-soft);
}

.trend-day {
  display: grid;
  grid-template-rows: minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  min-width: 0;
}

.trend-bars {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 6px;
  height: 100%;
}

.trend-bar {
  display: block;
  width: 15px;
  min-height: 6px;
  border-radius: 5px 5px 2px 2px;
}

.trend-bar-inspections {
  background: linear-gradient(180deg, #74B0FF, var(--brand));
  border-radius: 5px 5px 2px 2px;
}

.trend-bar-defects {
  background: linear-gradient(180deg, #E87095, var(--rose));
  border-radius: 5px 5px 2px 2px;
}

.trend-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 999px;
}

.legend-blue {
  background: var(--brand);
}

.legend-rose {
  background: var(--rose);
}

.readiness-card {
  display: grid;
  gap: 18px;
  padding: 18px;
  border-radius: 8px;
  background: var(--surface-blue);
  border: 1px solid #cfe2ff;
}

.readiness-value {
  display: block;
  color: var(--brand-strong);
  font-size: 44px;
  line-height: 1;
  font-weight: 850;
}

.readiness-label {
  display: block;
  margin-top: 6px;
  color: #40516a;
  font-weight: 700;
}

.device-status-panel {
  display: grid;
  grid-template-columns: minmax(200px, 0.82fr) minmax(0, 1.18fr);
  gap: 20px;
  align-items: center;
}

.device-donut-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 240px);
  aspect-ratio: 1;
  margin: 0 auto;
}

.device-donut-chart {
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
}

.device-donut-track,
.device-donut-segment {
  fill: none;
  stroke-width: 22;
}

.device-donut-track {
  stroke: #e7edf5;
}

.device-donut-segment {
  stroke-linecap: round;
  transition: stroke-dasharray var(--transition-fast);
}

.device-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  pointer-events: none;
}

.device-donut-total {
  display: block;
  color: var(--text);
  font-size: 42px;
  line-height: 1;
  font-weight: 850;
}

.device-donut-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  font-weight: 750;
}

.device-status-legend {
  display: grid;
  gap: 12px;
}

.device-status-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
  padding: 12px 14px;
  background: var(--surface-muted);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.device-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}

.device-status-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  flex: 0 0 11px;
}

.device-status-approved {
  color: #0f8f4b;
  stroke: #16a34a;
  background: #16a34a;
}

.device-status-pending {
  color: #b45309;
  stroke: #d97706;
  background: #d97706;
}

.device-status-rejected {
  color: #9f1239;
  stroke: #e11d48;
  background: #e11d48;
}

.device-status-deactivated {
  color: #475569;
  stroke: #64748b;
  background: #64748b;
}

.device-status-default {
  color: var(--muted);
  stroke: #94a3b8;
  background: #94a3b8;
}

.device-status-online {
  color: #0f8f4b;
  stroke: #10b981;
  background: #10b981;
}

.device-status-legend-item-online {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(255, 255, 255, 0.96) 100%);
  border-color: rgba(16, 185, 129, 0.18);
}

.metric-card-muted {
  opacity: 0.72;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 18px;
}

.dashboard-grid-wide {
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.65fr);
}

.dashboard-overview-grid {
  align-items: stretch;
  grid-template-columns: minmax(0, 1.24fr) minmax(340px, 0.74fr);
}

.dashboard-audit-grid {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr);
}

.dashboard-chart-panel {
  min-height: 312px;
}

.dashboard-panel-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

/* =============================================
   Dashboard Settings – Defect Rate Mode Page
   ============================================= */

.dds-settings-section {
  max-width: 860px;
}

.dds-settings-panel {
  padding: 28px 32px;
}

.dds-settings-panel .panel-header {
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-soft);
}

.dds-settings-panel .panel-header h2 {
  font-size: 17px;
  margin-bottom: 4px;
}

.dds-settings-panel .panel-header p {
  margin: 0;
  font-size: 13px;
}

/* Active badge */
.dds-active-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  background: #dff7e8;
  color: #166534;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.dds-active-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.22);
  flex-shrink: 0;
}

/* Option cards */
.dds-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.dds-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px;
  border: 2px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.dds-option:hover {
  border-color: rgba(79, 70, 229, 0.3);
  background: rgba(79, 70, 229, 0.03);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.07);
}

.dds-option--selected {
  border-color: var(--brand);
  background: rgba(79, 70, 229, 0.04);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.08);
}

.dds-option--selected:hover {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.dds-option__radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Custom radio circle */
.dds-option__check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--surface);
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.dds-option--selected .dds-option__check {
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}

.dds-option--selected .dds-option__check::after {
  content: "";
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #fff;
  margin: 4px auto 0;
}

.dds-option__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.dds-option__title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.dds-option--selected .dds-option__title {
  color: var(--brand-strong);
}

.dds-option__desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

/* Footer row: meta info + submit */
.dds-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}

.dds-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

.dds-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.dds-meta-item i {
  font-size: 13px;
  opacity: 0.7;
}

.dds-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 22px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Responsive: tablet / mobile */
@media (max-width: 640px) {
  .dds-settings-panel {
    padding: 18px 16px;
  }

  .dds-settings-panel .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .dds-options {
    grid-template-columns: 1fr;
  }

  .dds-form-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .dds-submit-btn {
    width: 100%;
    justify-content: center;
  }
}

.traffic-chart-wrap {
  min-height: 160px;
  padding: 10px 4px 0;
  overflow-x: auto;
  max-width: 100%;
}

.traffic-line-chart {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 160px;
}

.traffic-chart-grid-line {
  stroke: var(--line-soft);
  stroke-width: 1;
  stroke-dasharray: 6 10;
}

.traffic-chart-day-line {
  stroke: var(--line-soft);
  stroke-width: 1;
  stroke-dasharray: 5 9;
}

.traffic-chart-area {
  fill: url(#trafficAreaGradient);
}

.traffic-chart-line {
  fill: none;
  stroke: var(--brand);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.traffic-chart-dot {
  fill: var(--brand);
  stroke: #ffffff;
  stroke-width: 3;
}

.traffic-chart-value {
  fill: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 800;
}

.traffic-chart-label {
  fill: var(--muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
}

.traffic-chart-axis {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  padding: 0 4px 4px;
}

@media (max-width: 1360px) {
  .device-status-panel {
    grid-template-columns: 1fr;
  }
}

.traffic-chart-axis-item {
  display: grid;
  gap: 2px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 750;
}

.traffic-chart-axis-value {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.dashboard-empty-state {
  display: grid;
  place-items: center;
  min-height: 128px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  background: var(--surface-muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.dashboard-event-card,
.dashboard-api-log-card {
  padding: 16px;
  background: var(--surface-muted);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.dashboard-event-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.dashboard-event-title,
.dashboard-api-log-route,
.dashboard-api-log-meta,
.dashboard-api-log-body-row,
.dashboard-event-stats,
.dashboard-event-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.dashboard-event-title,
.dashboard-api-log-route {
  flex-wrap: wrap;
  color: var(--text);
  font-weight: 850;
}

.dashboard-event-title code,
.dashboard-api-log-route code {
  color: var(--text);
  white-space: normal;
  word-break: break-word;
}

.dashboard-event-meta,
.dashboard-api-log-meta,
.dashboard-event-stats {
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.dashboard-event-stats {
  justify-content: flex-end;
  margin-top: 0;
}

.dashboard-api-log-card {
  display: grid;
  gap: 12px;
}

.dashboard-api-log-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-method {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  color: var(--brand-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  background: var(--brand-soft);
  border-radius: var(--radius-sm);
}

.dashboard-api-log-path {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.audit-body-trigger {
  appearance: none;
  padding: 0;
  color: inherit;
  text-align: inherit;
  background: transparent;
  border: 0;
  border-radius: 0;
  cursor: pointer;
}

.audit-body-trigger-inline {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.audit-body-trigger-block {
  display: block;
  width: 100%;
}

.audit-body-trigger code,
.audit-body-trigger .dashboard-api-log-path,
.audit-body-trigger .small {
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

.audit-body-trigger:hover code,
.audit-body-trigger:focus-visible code {
  color: var(--brand-strong);
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.audit-body-trigger:hover .dashboard-api-log-path,
.audit-body-trigger:focus-visible .dashboard-api-log-path,
.audit-body-trigger:hover .small,
.audit-body-trigger:focus-visible .small {
  color: var(--brand-strong);
}

.audit-body-trigger:focus-visible {
  outline: 2px solid rgba(79, 70, 229, 0.35);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.dashboard-api-log-trigger {
  text-align: left;
}

.audit-route-cell {
  text-align: left;
}

.dashboard-api-log-body-row {
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.dashboard-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 28px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-status-success {
  color: #166534;
  background: #dcfce7;
}

.dashboard-status-warning {
  color: #92400e;
  background: #fef3c7;
}

.dashboard-status-danger {
  color: #991b1b;
  background: #fee2e2;
}

.dashboard-status-muted {
  color: #475569;
  background: #e2e8f0;
}

.rank-list {
  display: grid;
  gap: 14px;
}

.rank-row {
  display: grid;
  gap: 7px;
}

.rank-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: #334155;
  font-size: 13px;
  font-weight: 750;
}

.rank-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-meta strong {
  color: var(--text);
}

.rank-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eff6;
}

.rank-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #4aa3ff);
}

.rank-list-rose .rank-track span {
  background: linear-gradient(90deg, var(--rose), #fb7185);
}

.report-bars {
  display: grid;
  gap: 13px;
}

.report-bar-row {
  display: grid;
  gap: 7px;
}

.report-bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: #334155;
  font-size: 13px;
  font-weight: 750;
}

.report-bar-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-bar-meta strong {
  color: var(--text);
}

.qc-report-table .collapse:not(.show) {
  display: none;
}

.empty-state {
  padding: 20px;
  color: var(--muted);
  background: var(--surface-muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
}

.account-security-panel {
  grid-column: 1 / -1;
}

.account-security-form {
  display: grid;
  gap: 16px;
}

.account-security-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}

.account-security-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.defect-row {
  background: #fbfdff;
  border-color: var(--line) !important;
}

@media (max-width: 1120px) {
  .metric-grid,
  .metric-grid-4,
  .metric-grid-5,
  .dashboard-grid,
  .dashboard-grid-wide,
  .dashboard-overview-grid,
  .dashboard-audit-grid {
    grid-template-columns: 1fr;
  }

  .device-status-panel {
    grid-template-columns: 1fr;
  }

  .dashboard-event-card,
  .dashboard-api-log-head {
    grid-template-columns: 1fr;
  }

  .dashboard-event-card {
    align-items: stretch;
  }

  .dashboard-api-log-head {
    display: grid;
  }

  .dashboard-event-stats {
    justify-content: flex-start;
  }

  .account-security-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}

.spl-settings-form.dashboard-grid {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.95fr);
  align-items: start;
}

.spl-settings-panel .panel-header {
  margin-bottom: 12px;
}

.spl-history-header {
  align-items: center;
}

.spl-history-title {
  flex: 1 1 auto;
  min-width: 0;
}

.spl-history-title h2 {
  white-space: nowrap;
}

.spl-history-toolbar.table-toolbar {
  flex: 0 0 auto;
  width: auto;
  margin-bottom: 0;
}

.spl-section-title {
  margin: 0;
  font-size: var(--size-16);
  font-weight: 850;
}

.spl-label-spacer {
  display: block;
  visibility: hidden;
}

.spl-switch-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--size-14);
  font-weight: 750;
  cursor: pointer;
}

.spl-switch-line .form-check-input {
  margin: 0;
}

.spl-check-panel {
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface), var(--surface-muted));
}

.spl-check-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.spl-check-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.spl-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}

.spl-check-grid-year-season {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.spl-check-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--size-14);
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.spl-check-option:hover {
  border-color: rgba(22, 119, 255, 0.45);
  background: var(--brand-soft);
  box-shadow: var(--shadow-sm);
}

.spl-check-option .form-check-input {
  flex: 0 0 auto;
  margin: 0;
}

@media (max-width: 1120px) {
  .spl-settings-form.dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .spl-check-panel__header {
    align-items: flex-start;
    flex-direction: column;
  }

  .spl-check-grid,
  .spl-check-grid-year-season {
    grid-template-columns: 1fr;
  }
}

.spl-preview-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.spl-preview-card {
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 247, 252, 0.92));
  box-shadow: var(--shadow-sm);
}

.spl-preview-card-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.spl-preview-card-value {
  margin-top: 6px;
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
}

.spl-preview-card-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.spl-preview-table td,
.spl-preview-table th {
  vertical-align: top;
}

.spl-preview-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.spl-preview-badge-valid {
  color: #17603a;
  background: #eaf8ef;
  border: 1px solid #b8e0c8;
}

.spl-preview-badge-warning {
  color: #8c4d00;
  background: #fff4df;
  border: 1px solid #f0d39b;
}

.spl-preview-badge-error {
  color: #9d1c34;
  background: #fdecef;
  border: 1px solid #f1b7c4;
}
.admin-mobile-header {
  display: none;
}
.admin-mobile-backdrop {
  display: none;
}

@media (max-width: 820px) {
  html.admin-mobile-sidebar-open {
    overflow: hidden;
  }

  .admin-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    height: 56px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    position: sticky;
    top: 0;
    z-index: 1040;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  .admin-mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
    transition: background 0.2s ease;
  }

  .admin-mobile-toggle:hover,
  .admin-mobile-toggle:focus {
    background: rgba(15, 23, 42, 0.05);
    outline: none;
  }

  .admin-mobile-brand {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
  }

  .admin-mobile-logo {
    height: 32px;
    width: auto;
  }

  .admin-mobile-user {
    display: none;
  }

  .admin-mobile-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  html.admin-mobile-sidebar-open .admin-mobile-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .admin-shell {
    display: block;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1060;
    width: 280px;
    height: 100%;
    height: 100dvh;
    max-height: none;
    flex: none;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(15, 23, 42, 0.1);
    border-right: 1px solid rgba(15, 23, 42, 0.08);
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  html.admin-mobile-sidebar-open .admin-sidebar {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: none;
  }

  .admin-topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 18px;
  }

  .admin-topbar form {
    width: 100%;
    justify-content: space-between;
  }

  .page-heading {
    flex-direction: column;
  }

  .page-actions {
    justify-content: flex-start;
  }

  .trend-chart {
    overflow-x: auto;
  }

  .admin-content {
    padding: 16px;
  }

  .quick-action-grid {
    grid-template-columns: 1fr;
  }

  .product-variant-grid {
    grid-template-columns: 1fr;
  }

  .product-variant-add-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .signed-in {
    display: none;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .card-body,
  .panel {
    padding: 14px;
  }
}

/* DESIGN.md Enterprise overrides */
.sidebar-heading,
.topbar-kicker,
.page-kicker,
.form-label,
.table thead th,
.metric-label,
.admin-login-label,
.admin-login-copy,
.spl-preview-card-label {
  font-family: var(--font-mono);
  font-size: var(--size-12);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.api-info-mono,
.api-down-checklist code,
code {
  font-family: var(--font-mono);
}

h1,
.topbar-title {
  font-size: var(--size-32);
}

h2,
.panel h2,
.admin-login-heading {
  font-size: var(--size-24);
}

h3,
.h3 {
  font-size: var(--size-20);
}

h4,
.h4,
.form-control,
.form-select,
.btn,
.page-note,
.quick-action-copy,
.metric-note,
.bulk-select-note,
.bulk-edit-note,
.account-security-note {
  font-size: var(--size-14);
}

.form-control,
.form-select,
.btn {
  border-radius: var(--radius-sm);
}

.btn-primary {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.24);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.btn-outline-primary {
  color: var(--brand);
  border-color: rgba(79, 70, 229, 0.35);
  background: var(--surface);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.btn-outline-danger {
  color: var(--rose);
  border-color: rgba(220, 38, 38, 0.32);
}

.btn-outline-warning {
  color: var(--amber);
  border-color: rgba(217, 119, 6, 0.35);
}

.btn-outline-warning:hover,
.btn-outline-warning:focus {
  color: #fff;
  background: var(--amber);
  border-color: var(--amber);
}

.admin-login-submit {
  background: var(--brand);
}

.admin-login-submit:hover {
  background: var(--brand-strong);
}

.admin-login-card {
  border-radius: var(--radius);
}

.table-sort-link:hover {
  color: var(--brand);
}

.bg-success {
  background-color: rgba(16, 185, 129, 0.08) !important;
  color: #065f46 !important;
  border: 1px solid rgba(16, 185, 129, 0.18) !important;
}

.bg-secondary {
  background-color: rgba(139, 92, 246, 0.08) !important;
  color: #5b21b6 !important;
  border: 1px solid rgba(139, 92, 246, 0.18) !important;
}

.bg-danger {
  background-color: rgba(244, 63, 94, 0.08) !important;
  color: #9f1239 !important;
  border: 1px solid rgba(244, 63, 94, 0.18) !important;
}

.bg-info {
  background-color: rgba(59, 130, 246, 0.08) !important;
  color: #1e3a8a !important;
  border: 1px solid rgba(59, 130, 246, 0.18) !important;
}

.admin-access-denied-icon {
  width: 56px;
  height: 56px;
}

.admin-event-page-size {
  width: 80px;
}

.admin-col-select {
  width: 64px;
}

.admin-col-order {
  width: 72px;
}

.admin-column-toggle-menu {
  min-width: 18rem;
}

/* ============================================================
   MODERN DROPDOWN OVERRIDES
   Sleek glassmorphic dark-aware dropdown for Bootstrap 5
   ============================================================ */

.dropdown-menu {
  padding: 6px;
  margin: 4px 0;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow:
    0 4px 6px -1px rgba(15, 23, 42, 0.06),
    0 10px 30px -4px rgba(15, 23, 42, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
  backdrop-filter: blur(12px);
  animation: dropdownFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: top center;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  transition: background var(--transition-fast), color var(--transition-fast);
  cursor: pointer;
}

.dropdown-item:hover,
.dropdown-item:focus {
  color: var(--brand);
  background: var(--brand-soft);
  outline: none;
}

.dropdown-item.active,
.dropdown-item:active {
  color: #ffffff;
  background: var(--brand);
}

.dropdown-item.text-danger {
  color: var(--rose);
}

.dropdown-item.text-danger:hover,
.dropdown-item.text-danger:focus {
  color: #ffffff;
  background: rgba(244, 63, 94, 0.1);
  color: var(--rose);
}

.dropdown-divider {
  margin: 4px 6px;
  border-color: var(--line-soft);
  opacity: 1;
}

.dropdown-header {
  padding: 6px 12px 4px;
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Sidebar user dropdown - dark variant */
.sidebar-user-menu .dropdown-menu {
  background: rgba(15, 23, 42, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.35),
    0 2px 6px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(14px);
}

.sidebar-user-menu .dropdown-item {
  color: #cbd5e1;
}

.sidebar-user-menu .dropdown-item:hover,
.sidebar-user-menu .dropdown-item:focus {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-user-menu .dropdown-item.active,
.sidebar-user-menu .dropdown-item:active {
  color: #ffffff;
  background: rgba(59, 130, 246, 0.25);
}

.sidebar-user-menu .dropdown-item.text-danger {
  color: #fca5a5;
}

.sidebar-user-menu .dropdown-item.text-danger:hover {
  background: rgba(244, 63, 94, 0.15);
  color: #fca5a5;
}

.sidebar-user-menu .dropdown-divider {
  border-color: rgba(255, 255, 255, 0.08);
}

.sidebar-user-menu .dropdown-header {
  color: rgba(148, 163, 184, 0.7);
}

/* Small utility dropdown (column toggle etc.) */
.admin-column-toggle-menu.dropdown-menu {
  padding: 8px;
}

.admin-column-toggle-menu .form-check {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.admin-column-toggle-menu .form-check:hover {
  background: var(--surface-muted);
}

.admin-floating-modal .card-header .badge.text-bg-light {
  color: #1f2937 !important;
}

.hero-card--compact,
.surface-card,
.preview-pane {
  border-radius: 24px;
}

.hero-card--compact {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(237, 242, 247, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.08);
}

.hero-card__eyebrow,
.surface-card__eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #64748b;
}

.hero-card__title,
.surface-card__title,
.preview-pane__title {
  margin: 0;
  color: #0f172a;
}

.hero-card__copy,
.surface-card__copy,
.template-card__meta,
.template-card__foot,
.template-card p {
  color: #475569;
}

.hero-card__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 12px;
  min-width: 260px;
}

.hero-stat {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.hero-stat__label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
}

.portal-grid {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 24px;
}

.form-span-2 {
  grid-column: span 2;
}

.filter-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.font-mono {
  font-family: var(--font-mono);
}

.surface-card {
  position: relative;
  padding: 24px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.06);
}

.surface-card--accent {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
}

.surface-card__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.template-list {
  display: grid;
  gap: 12px;
}

.template-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(248, 250, 252, 0.8);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.template-card:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.32);
  box-shadow: 0 12px 24px rgba(59, 130, 246, 0.08);
}

.template-card--selected {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.12);
}

.template-card__head,
.template-card__foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.template-card__meta,
.template-card__foot {
  font-size: 13px;
}

.template-card__link,
.source-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.surface-card--editor {
  min-width: 0;
}

.template-help {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(241, 245, 249, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.template-help strong {
  width: 100%;
  color: #0f172a;
}

.template-help code {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: #1e293b;
}

.template-editor-textarea {
  min-height: 560px;
}

.preview-pane {
  padding: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(248, 250, 252, 0.84);
}

.html-report-frame {
  width: 100%;
  min-height: 760px;
  border: 0;
  border-radius: 18px;
  background: #ffffff;
}

.empty-state {
  padding: 40px 20px;
  border: 1px dashed rgba(148, 163, 184, 0.4);
  border-radius: 20px;
  text-align: center;
  color: #64748b;
  background: rgba(255, 255, 255, 0.8);
}

@media (max-width: 1100px) {
  .portal-grid {
    grid-template-columns: 1fr;
  }

  .hero-card--compact {
    flex-direction: column;
  }

  .hero-card__stats {
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .surface-card,
  .hero-card--compact {
    padding: 18px;
  }

  .surface-card__header {
    flex-direction: column;
  }

  .hero-card__stats {
    grid-template-columns: 1fr;
  }

  .form-span-2 {
    grid-column: auto;
  }

  .html-report-frame {
    min-height: 640px;
  }
}
