*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg-page: #F7F7F8;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F0F0F2;
  --bg-overlay: #E8E8EC;
  --border-default: #E2E2E6;
  --border-strong: #C8C8CE;
  --text-primary: #111114;
  --text-secondary: #6B6B78;
  --text-tertiary: #9999A8;
  --accent: #18181B;
  --accent-fg: #FFFFFF;
  --color-success: #16A34A;
  --color-warning: #CA8A04;
  --color-danger: #DC2626;
  --color-info: #2563EB;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --fw-body: 400;
  --fw-heading: 600;
  --fw-label: 500;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  background: var(--bg-page);
  font-family: var(--font-sans);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: var(--fw-body);
}

/* ── Sidebar ── */
.sidebar {
  width: 220px;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  padding: var(--space-4) 0;
}

.sidebar-logo {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--border-default);
  margin-bottom: 8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
}

.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: background 100ms, color 100ms;
}

.sidebar-nav .nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.sidebar-nav .nav-item.active {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-left-color: var(--text-primary);
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--border-default);
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 12px 4px;
}

.nav-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: background 100ms, color 100ms;
}

.nav-group-toggle:hover,
.nav-group-toggle:not(.collapsed) {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.nav-chevron {
  font-size: 10px;
  transition: transform 200ms;
  flex-shrink: 0;
}

.nav-group-toggle:not(.collapsed) .nav-chevron {
  transform: rotate(90deg);
}

.nav-sub-item {
  padding-left: 34px !important;
}

.sidebar-user .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

/* ── Main content ── */
.main-content {
  margin-left: 220px;
  padding: 32px 40px;
  min-height: 100vh;
}

.content-body {
  max-width: 1100px;
  margin: 0 auto;
}

/* ── Page header ── */
.page-header {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-default);
}

.page-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin: 0;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 3px 0 0;
}

/* ── Buttons ── */
.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 120ms;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--accent);
  color: var(--accent-fg);
  opacity: 0.82;
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  transition: background 100ms;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-outline:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-ghost-danger {
  background: transparent;
  color: var(--color-danger);
  border: 1px solid transparent;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: background 100ms, border-color 100ms;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-ghost-danger:hover {
  background: #FEF2F2;
  border-color: #FECACA;
  color: var(--color-danger);
}

/* ── Dashboard hero ── */
.dashboard-hero {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.dashboard-kicker {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.dashboard-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  max-width: 480px;
}

.dashboard-copy {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 480px;
}

.dashboard-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.dashboard-actions a {
  text-decoration: none;
}

/* ── Stat cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.stat-value {
  font-size: 28px;
  line-height: 1;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  text-align: right;
  min-width: 56px;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 15px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-copy {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.55;
  margin-top: 2px;
}

.stat-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 100ms;
}

.stat-link:hover { color: var(--text-primary); }

.quick-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-page);
}

.quick-link:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.dashboard-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.dashboard-panel-wide {
  grid-column: 1 / -1;
}

.dashboard-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.dashboard-panel-kicker {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.dashboard-panel-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.compact-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.compact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--border-default);
}

.compact-item:first-child {
  border-top: none;
  padding-top: 0;
}

.compact-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.compact-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.setup-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.setup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  font-size: 13px;
}

.setup-row span {
  color: var(--text-secondary);
}

.setup-row strong {
  color: var(--text-primary);
  font-weight: 600;
}

.dashboard-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Tables ── */
.data-table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-default);
}

.table-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-input {
  padding: 7px 12px;
  font-size: 13px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  color: var(--text-primary);
  width: 200px;
  transition: border-color 120ms, box-shadow 120ms;
}

.search-input:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  padding: 10px 20px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}

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

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bg-subtle); }

.table-footer {
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-default);
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

.badge-success { background: #F0FDF4; color: #15803D; }
.badge-warning { background: #FEFCE8; color: #A16207; }
.badge-danger  { background: #FEF2F2; color: #B91C1C; }
.badge-info    { background: #EFF6FF; color: #1D4ED8; }
.badge-default { background: var(--bg-overlay); color: var(--text-secondary); }

/* ── Avatar ── */
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ── Forms ── */
.form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-control {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--text-primary);
  transition: border-color 120ms, box-shadow 120ms;
}

.form-control:hover { border-color: var(--border-strong); }

.form-control:focus {
  outline: none;
  border-color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

.form-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-primary);
}

.form-group { margin-bottom: var(--space-3); }

/* ── Cards ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-default);
  padding: 16px 20px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.card-body { padding: 20px; }

/* ── Tom Select ── */
.ts-control {
  font-size: 13px !important;
  min-height: 38px !important;
  border-radius: var(--radius-sm) !important;
  border-color: var(--border-default) !important;
  padding: 5px 10px !important;
}

.ts-control .item {
  background: var(--bg-subtle) !important;
  border-radius: 6px !important;
  padding: 3px 8px !important;
  font-size: 12px !important;
  color: var(--text-primary) !important;
}

.ts-dropdown {
  font-size: 13px !important;
  border-radius: var(--radius-md) !important;
  border-color: var(--border-default) !important;
}

.ts-dropdown .active {
  background: var(--bg-subtle) !important;
  color: var(--text-primary) !important;
}

/* ── Industry checkbox grid ── */
.industry-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.industry-list .form-check {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-page);
  border: 1px solid transparent;
}

.industry-list .form-check:hover {
  background: var(--bg-surface);
  border-color: var(--border-default);
}

/* ── Auth layout ── */
.auth-split {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 460px;
}

.auth-left {
  background: #0d0d10;
  padding: 64px 56px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-left-inner {
  max-width: 420px;
}

.auth-logo-mark {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: rgba(255,255,255,0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 24px;
  letter-spacing: -0.02em;
}

.auth-wordmark {
  font-size: 22px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}

.auth-tagline {
  font-size: 14px;
  color: rgba(255,255,255,0.55);
  line-height: 1.65;
  margin: 0 0 36px;
  max-width: 340px;
}

.auth-feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-feature-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.58);
}

.auth-feature-list li .fas {
  color: rgba(255,255,255,0.28);
  font-size: 12px;
  flex-shrink: 0;
}

.auth-right {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: var(--bg-page);
  padding: clamp(32px, 8vh, 80px) 32px;
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 380px;
}

.auth-card-header {
  margin-bottom: 24px;
}

.auth-card-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.015em;
  margin: 0 0 6px;
}

.auth-card-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.auth-error-banner {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  color: #B91C1C;
  margin-bottom: 16px;
}

.auth-error-banner:empty {
  display: none;
}

.auth-field-error {
  display: block;
  font-size: 12px;
  color: var(--color-danger);
  margin-top: 5px;
}

.auth-form .form-control {
  display: block;
  width: 100%;
}

.auth-pw-wrap {
  position: relative;
}

.auth-pw-wrap .form-control {
  padding-right: 40px;
}

.auth-pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: color 100ms;
}

.auth-pw-toggle:hover {
  color: var(--text-secondary);
}

.auth-submit-btn {
  display: block;
  width: 100%;
  padding: 10px;
  font-size: 14px;
  margin-top: 8px;
}
/* Give main content breathing room so content doesn't hide behind footer */
.main-content {
    padding-bottom: 56px;
}

@media (max-width: 900px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-left { padding: 32px 28px; justify-content: flex-start; }
  .auth-feature-list { display: none; }
  .auth-tagline { margin-bottom: 0; }
  .auth-right { padding: 32px 28px; }
  .auth-card { max-width: 100%; }
}

@media (max-width: 480px) {
  .auth-left { padding: 24px 20px; }
  .auth-wordmark { font-size: 18px; }
  .auth-right { padding: 24px 20px; }
  .auth-card { padding: 24px 20px; }
}

/* ── Filter button & panel ── */
.btn-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 100ms, border-color 100ms, color 100ms;
  white-space: nowrap;
}

.btn-filter:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-filter.has-filters {
  border-color: var(--text-primary);
  color: var(--text-primary);
  background: var(--bg-subtle);
}

.filter-active-badge {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.filter-panel {
  border: 1px solid var(--border-default) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 8px 28px rgba(0,0,0,0.10) !important;
  padding: 0 !important;
  min-width: 250px !important;
}

.filter-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-default);
}

.filter-panel-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.filter-clear-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: var(--text-tertiary);
  cursor: pointer;
  font-weight: 500;
  transition: color 100ms;
}

.filter-clear-btn:hover { color: var(--color-danger); }

.filter-group {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-default);
}

.filter-group:last-child { border-bottom: none; }

.filter-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 7px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.filter-search-input {
  width: 100%;
  padding: 5px 9px;
  font-size: 12px;
  font-family: inherit;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-canvas);
  color: var(--text-primary);
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}
.filter-search-input:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.05);
}
.filter-search-input::placeholder { color: var(--text-tertiary); }

.filter-chip {
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-page);
  border: 1px solid var(--border-default);
  border-radius: 999px;
  cursor: pointer;
  transition: all 100ms;
  white-space: nowrap;
  text-decoration: none;
}

.filter-chip:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.filter-chip.active {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

/* ── Sort button & panel ── */
.btn-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 100ms, border-color 100ms, color 100ms;
  white-space: nowrap;
}

.btn-sort:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-sort.has-filters {
  border-color: var(--text-primary);
  color: var(--text-primary);
  background: var(--bg-subtle);
}

.sort-panel {
  border: 1px solid var(--border-default) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 8px 28px rgba(0,0,0,0.10) !important;
  padding: 5px !important;
  min-width: 190px !important;
}

.sort-panel-head {
  padding: 5px 8px 5px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.sort-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 80ms, color 80ms;
  text-align: left;
}

.sort-option:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.sort-option.active {
  color: var(--text-primary);
  background: var(--bg-subtle);
}

.sort-check {
  font-size: 10px;
  width: 14px;
  flex-shrink: 0;
  visibility: hidden;
}

.sort-option.active .sort-check { visibility: visible; }

/* ── Pagination buttons ── */
.page-btn {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-right: 4px;
  transition: background 100ms, color 100ms;
}

.page-btn:hover:not(:disabled) {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.page-btn:disabled { opacity: 0.4; cursor: default; }

.page-btn.active {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

/* ── Lookup overview grid ── */
.lookup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.lookup-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  transition: border-color 120ms, box-shadow 120ms;
}

.lookup-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.lookup-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 16px;
  flex-shrink: 0;
}

.lookup-card-body {
  flex: 1;
  min-width: 0;
}

.lookup-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.lookup-card-desc {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.5;
}

.lookup-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.lookup-card-count {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  min-width: 28px;
  text-align: right;
}

.lookup-card-arrow {
  color: var(--text-tertiary);
  font-size: 11px;
}

/* ── Lookup list pages ── */
.lookup-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.lookup-breadcrumb {
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 13px;
  transition: color 100ms;
}

.lookup-breadcrumb:hover {
  color: var(--text-secondary);
}

.lookup-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bg-overlay);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: 8px;
  vertical-align: middle;
}

/* ── Dashboard v2 ── */
.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.dash-kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  text-decoration: none;
  display: block;
  transition: border-color 120ms, box-shadow 120ms;
}

.dash-kpi-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.dash-kpi-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dash-kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 15px;
}

.dash-kpi-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1;
}

.dash-kpi-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.dash-kpi-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.dash-kpi-sub-pill {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
}

.dash-kpi-sub-pill.success { background: #F0FDF4; color: #15803D; }
.dash-kpi-sub-pill.danger  { background: #FEF2F2; color: #B91C1C; }
.dash-kpi-sub-pill.default { background: var(--bg-overlay); color: var(--text-secondary); }

.dash-quick-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.dash-recent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.dash-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.dash-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dash-panel-kicker {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}

.dash-panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.dash-panel-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 100ms;
}

.dash-panel-link:hover { color: var(--text-primary); }

.dash-activity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.dash-activity-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border-default);
  text-decoration: none;
  transition: background 80ms;
  margin: 0 -4px;
  padding-left: 4px;
  padding-right: 4px;
  border-radius: 6px;
}

.dash-activity-row:first-child { border-top: none; padding-top: 0; }

.dash-activity-row:hover { background: var(--bg-subtle); }

.dash-activity-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.dash-activity-body { flex: 1; min-width: 0; }

.dash-activity-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-activity-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-activity-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.dash-activity-time {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.dash-empty {
  font-size: 13px;
  color: var(--text-tertiary);
  padding: 20px 0;
  text-align: center;
}

.dash-empty a { color: var(--color-info); text-decoration: none; }

/* ── Utilities ── */
.mono { font-family: var(--font-mono); font-size: 12px; }
.text-secondary { color: var(--text-secondary) !important; }
.text-tertiary  { color: var(--text-tertiary) !important; }
.font-medium    { font-weight: 500; }

.app-footer {
    position: fixed;
    bottom: 0;
    left: 220px;
    right: 0;
    height: 40px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    padding: 0 40px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    z-index: 10;
}

/* ── Form page layout ── */
.form-page {
    max-width: 860px;
}

.form-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.form-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    margin-bottom: 16px;
}

.form-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 4px;
}

/* ── Section labels inside forms ── */
.form-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-default);
}

/* ── Input + inline action button ── */
.input-with-action {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-with-action .form-select {
    flex: 1;
    min-width: 0;
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

/* ── Disqualified toggle card ── */
.form-check-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-page);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    margin-top: 4px;
}

.form-toggle {
    width: 40px;
    height: 22px;
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 999px;
    appearance: none;
    -webkit-appearance: none;
    background: var(--border-strong);
    position: relative;
    transition: background 150ms;
    border: none;
    outline: none;
}

.form-toggle::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: transform 150ms;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.form-toggle:checked {
    background: var(--color-success);
}

.form-toggle:checked::after {
    transform: translateX(18px);
}
/* ── Row action buttons ── */
.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.btn-row-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid var(--border-default);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    text-decoration: none;
    transition: background 100ms, color 100ms, border-color 100ms;
}

.btn-row-icon:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-row-icon.btn-row-danger:hover {
    background: #FEF2F2;
    color: var(--color-danger);
    border-color: #FECACA;
}

/* ── Table group header row (e.g. grouping table rows by category) ── */
.table-group-row td {
  padding: 8px 20px !important;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-default) !important;
}

.table-group-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.table-group-range {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-left: 8px;
}

.table-group-add {
  float: right;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 100ms;
}

.table-group-add:hover {
  color: var(--text-primary);
}

/* ── Stock level bar (remaining vs. total) ── */
.stock-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stock-bar-track {
  flex: 1;
  min-width: 56px;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-overlay);
  overflow: hidden;
}

.stock-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.stock-bar-fill.stock-bar-success { background: var(--color-success); }
.stock-bar-fill.stock-bar-warning { background: var(--color-warning); }
.stock-bar-fill.stock-bar-danger  { background: var(--color-danger); }

.stock-bar-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.stock-bar-unlimited {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ── Promotion admin (winners / prize stock) — responsive, scoped to these pages only ── */
.promo-filter-row {
  padding: 14px 20px 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.promo-inline-form {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .promo-page .table-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .promo-page .table-actions {
    flex-wrap: wrap;
  }

  .promo-page .table-actions .search-input {
    flex: 1;
    min-width: 0;
    width: auto;
  }

  .promo-page .row-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .promo-page .table-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .promo-page .table-actions .search-input,
  .promo-page .table-actions .btn-outline {
    width: 100%;
  }
}

/* ── Detail page ── */
.detail-page {
    max-width: 860px;
    margin: 0 auto;
}

.detail-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.detail-card-header {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 14px 20px;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border-default);
}

.detail-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 0;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-default);
    border-right: 1px solid var(--border-default);
}

.detail-row:nth-child(even) {
    border-right: none;
}

.detail-row:nth-last-child(-n+2) {
    border-bottom: none;
}

.detail-form {
    padding: 16px 20px;
}

.detail-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}