/* ==========================================================================
   PORTFOLIO CORE DESIGN SYSTEM & MULTI-THEME SPECIFICATION
   Engineered & Rigorous · Quiet Technical Sophistication
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700;800&family=Fauna+One&display=swap');

/* --- SINGLE DESIGN SYSTEM PALETTE --- */
:root {
  /* Canvas & Surface Colors */
  --bg-canvas: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f5f2ea;
  --bg-subtle: #faf9f6;
  --bg-inset: #f5f2ea;

  /* Borders */
  --border-subtle: #e5e0d6;
  --border-strong: #cec6b8;
  --border-focus: #c59a3d;

  /* Typography Colors */
  --text-primary: #161513;
  --text-secondary: #5f5b54;
  --text-muted: #918b80;

  /* Primary Brand & Accent Colors */
  --accent-primary: #c59a3d;
  --accent-primary-dark: #987225;
  --accent-primary-light: #e7d4a5;
  --accent-ink: #ffffff;
  --accent-subtle: rgba(197, 154, 61, 0.08);
  --accent-border: rgba(197, 154, 61, 0.25);
  --accent-signal: #287a58;

  --gold: #c59a3d;
  --warning: #b7791f;
  --danger: #b83a3a;
  --link: #a77c2e;

  /* Gold aliases — shared Tabulator theme compatibility (checkbox fallback chain) */
  --gold-primary: #b99b5f;
  --gold-light: #cbb183;
  --border-gold: #b99b5f;

  /* Button Specific Tokens */
  --btn-bg: #181715;
  --btn-text: #ffffff;
  --btn-hover: #302d27;

  /* Fonts & Radii */
  --font-sans: 'Fauna One', sans-serif;
  --font-serif: 'Cinzel', serif;
  --font-mono: 'Fauna One', monospace;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -2px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 16px 32px rgba(28, 25, 20, 0.12);

  /* Backward compatibility variables */
  --bg: var(--bg-canvas);
  --bg-soft: var(--bg-subtle);
  --card: var(--bg-surface);
  --border: var(--border-subtle);
  --text: var(--text-primary);
  --muted: var(--text-muted);
  --accent: var(--accent-primary);
  --radius: var(--radius-md);
}

/* ==========================================================================
   BASE & RESET
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 1rem;
  transition: background-color 150ms ease, color 150ms ease;
}

.container {
  width: 90%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-fluid {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0 28px;
  box-sizing: border-box;
}

.admin-header .container-fluid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.admin-main {
  padding: 24px 0 48px;
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */
h1, h2, h3, h4 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
  word-break: break-word;
}

h1 { font-size: clamp(1.85rem, 3.5vw, 2.5rem); }
h2 { font-size: 1.5rem; letter-spacing: -0.015em; }
h3 { font-size: 1.15rem; font-weight: 600; }
h4 { font-size: 0.95rem; font-weight: 600; }

p {
  margin: 0 0 16px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.65;
  text-align: justify;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 120ms ease;
}

a:hover {
  color: var(--accent-primary-dark);
  text-decoration: underline;
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

.mono {
  font-family: var(--font-mono);
}

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

/* ==========================================================================
   HEADER & STICKY NAVIGATION
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-canvas);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-logo {
  height: 52px;
  width: auto;
  display: block;
  transition: transform 180ms ease;
}

.brand:hover .brand-logo {
  transform: scale(1.03);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-nav a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
}

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

/* Logout is a POST form (CSRF) rather than a plain GET link, so style the
   submit button to match the surrounding nav links. */
.site-nav .nav-link-btn {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 4px 6px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

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

.nav-cv-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.nav-cv-btn:hover {
  border-color: var(--border-strong);
  text-decoration: none;
}

/* ==========================================================================
   BUTTONS & BADGES
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  text-decoration: none;
  transition: all 120ms ease;
}

.btn:hover {
  border-color: var(--text-primary);
  text-decoration: none;
}

.btn-primary {
  background: var(--btn-bg);
  border-color: var(--btn-bg);
  color: var(--btn-text);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--btn-hover);
  border-color: var(--btn-hover);
  color: var(--btn-text);
  text-decoration: none;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8125rem;
}

.btn-mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

/* Server-side list pagination (leads, qr scans) */
.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 20px 0 8px;
  padding: 10px 0;
}

.admin-pagination .btn-mono[disabled],
.admin-pagination .btn-mono[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.admin-pagination-status {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
}

.badge-accent {
  color: var(--accent-primary);
  background: var(--accent-subtle);
  border-color: var(--accent-border);
}

.badge-signal {
  color: var(--accent-signal);
  background: rgba(5, 150, 105, 0.08);
  border-color: rgba(5, 150, 105, 0.25);
}

/* ==========================================================================
   SECTIONS & PANELS
   ========================================================================== */
.section {
  padding: 64px 0;
  border-bottom: 1px solid var(--border-subtle);
}
section:nth-of-type(even) {
  background-color: var(--bg-surface-elevated);
}

.section-head {
  margin-bottom: 32px;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.section-title {
  font-size: clamp(1.4rem, 2.5vw, 1.85rem);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.section-intro {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 760px;
  margin-bottom: 0;
}

/* Card Primitive */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

/* Admin Metric Stat Cards */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.admin-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: all 120ms ease;
  position: relative;
  overflow: hidden;
}

.admin-stat-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}

.admin-stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.admin-stat-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.admin-stat-icon {
  font-size: 1rem;
  opacity: 0.7;
}

.admin-stat-value {
  font-family: var(--font-mono);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--accent-primary);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 4px 0 2px;
}

.admin-stat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px dashed var(--border-subtle);
}

.admin-stat-scope {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.admin-stat-arrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-primary);
}

/* ==========================================================================
   FORMS
   ========================================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group label {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-control {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  width: 100%;
  transition: border-color 120ms ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
}

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

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.alert-success {
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  color: var(--accent-primary);
}

/* ==========================================================================
   TABLES & ADMIN VIEWS
   ========================================================================== */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: var(--bg-surface);
}

.table th, .table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.table th {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-subtle);
}

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

.cell-actions {
  display: flex;
  gap: 6px;
}

/* Admin container */
.admin-header {
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
}
.admin-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  padding-bottom: 12px;
}
.admin-main {
  padding: 32px 0;
}

/* Footer */
.site-footer {
  padding: 32px 0;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-links a {
  color: var(--text-muted);
}
.footer-links a:hover {
  color: var(--text-primary);
}

/* Flash messages (e.g. campaign restore warnings) */
.flash-message {
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  border: 1px solid transparent;
}
.flash-warning {
  background: rgba(183, 121, 31, 0.12);
  border-color: var(--warning);
  color: var(--warning);
}
.flash-error {
  background: rgba(184, 58, 58, 0.1);
  border-color: var(--danger);
  color: var(--danger);
}

/* Mobile Navigation Drawer & Responsive Adjustments */
.mobile-nav-toggle {
  display: none;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 1.2rem;
  color: var(--text-primary);
  cursor: pointer;
  line-height: 1;
  transition: all 150ms ease;
  min-height: 44px;
  min-width: 44px;
}

.mobile-nav-toggle:hover,
.mobile-nav-toggle:focus-visible {
  background: var(--bg-subtle);
  border-color: var(--gold-light);
  outline: none;
}

@media (max-width: 900px) {
  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .site-header .container,
  .admin-header .container-fluid {
    position: relative;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .site-nav {
    display: none;
  }

  .site-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-gold);
    padding: 20px 24px;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .site-nav a {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.98rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .site-nav a::after {
    display: none;
  }

  .site-nav a:hover,
  .site-nav a.is-active {
    border-color: var(--border-gold);
    color: var(--gold-light);
    background: var(--bg-surface-elevated);
  }
}

@media (max-width: 576px) {
  .container {
    padding: 0 16px;
  }

  .container-fluid {
    padding: 0 16px;
  }

  .brand-sub {
    display: none;
  }

  .admin-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .admin-stat-card {
    padding: 14px;
  }

  .admin-stat-value {
    font-size: 1.65rem;
  }
}

@media (max-width: 400px) {
  .admin-stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Table Responsive Scroll Wrapper */
.table-responsive-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

@media (max-width: 900px) {
  .table-responsive-wrapper .tabulator {
    min-width: 820px;
  }
  /* Summary tables inside split cards stay at natural width. */
  .table-responsive-wrapper .tabulator.summary-table {
    min-width: 0;
  }
  .hide-on-desktop {
    display: inline-block !important;
  }
}

@media (min-width: 901px) {
  .hide-on-desktop {
    display: none !important;
  }
}

/* ==========================================================================
   ADMIN MOBILE REFINEMENTS
   Keeps toolbars, action bars, footers and detail layouts usable on phones.
   ========================================================================== */

/* Sticky admin header so navigation is reachable while scrolling (matches
   the public .site-header behaviour). */
.admin-header {
  position: sticky;
  top: 0;
  z-index: 500;
}

/* Bulk-action forms hold several buttons — wrap instead of overflowing. */
#bulk-toolbar form {
  flex-wrap: wrap;
}

/* Two-column form/detail grid that stacks on phones. */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.form-grid-2 > * {
  min-width: 0;
}

/* Chart/breakdown row — children (cards) must be allowed to shrink. */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.chart-grid > * {
  min-width: 0;
}

/* Compact 2-column summary grids (date/count, label/count) live inside
   split cards — never force the wide-table 820px scroll width on them.
   TableKit applies tableClass:"summary-table" to the Tabulator root itself,
   so match the compound class rather than a descendant. */
.table-responsive-wrapper .tabulator.summary-table {
  min-width: 0;
}

@media (max-width: 900px) {
  .brand-logo {
    height: 44px;
  }

  /* Pagination footer: let controls wrap and grow tap targets. */
  .tabulator .tabulator-footer {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .tabulator .tabulator-footer .tabulator-paginator {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 4px;
  }

  .tabulator .tabulator-footer .tabulator-page {
    padding: 6px 12px;
  }
}

@media (max-width: 576px) {
  .brand-logo {
    height: 36px;
  }

  .admin-header .container-fluid {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .admin-main {
    padding: 20px 0 40px;
  }

  .card {
    padding: 16px;
  }

  /* 1rem avoids iOS auto-zoom when focusing inputs. */
  .form-control {
    font-size: 1rem;
  }

  .btn-sm {
    padding: 5px 10px;
  }

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

/* ==========================================================================
   SHARED TABULATOR THEME (UNIFIED)
   ========================================================================== */
.tabulator {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-sans) !important;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.tabulator .tabulator-header {
  background-color: var(--bg-surface-elevated) !important;
  border-bottom: 1px solid var(--border-gold) !important;
  color: var(--text-secondary) !important;
  font-family: var(--font-mono) !important;
  font-size: 0.75rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
}

.tabulator .tabulator-header .tabulator-col {
  background-color: transparent !important;
  border-right: 1px solid var(--border-subtle) !important;
  padding: 10px 12px !important;
  vertical-align: top !important;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-content {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title {
  font-weight: 700 !important;
  color: var(--text-secondary) !important;
}

.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover {
  background-color: var(--bg-inset) !important;
}

.tabulator .tabulator-header .tabulator-col input,
.tabulator .tabulator-header .tabulator-col select {
  width: 100% !important;
  box-sizing: border-box !important;
  background-color: var(--bg-canvas) !important;
  border: 1px solid var(--border-subtle) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-xs) !important;
  padding: 3px 6px !important;
  font-family: var(--font-mono) !important;
  font-size: 0.75rem !important;
}

/* Two-line vertical filter layout - works across all Tabulator tables */
.tabulator .tabulator-header .tabulator-col {
  height: auto !important;
}
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter {
  height: auto !important;
  overflow: visible !important;
}
.custom-header-filter-container {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  align-items: stretch !important;
}
.custom-header-filter-container select,
.custom-header-filter-container input {
  display: block !important;
  width: 100% !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}

/* Tabulator List Editor Popup styling */
.tabulator-edit-list {
  background-color: var(--bg-canvas) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-xs) !important;
  font-family: var(--font-mono) !important;
  font-size: 0.75rem !important;
  box-shadow: var(--shadow-md) !important;
  color: var(--text-primary) !important;
  max-height: 250px !important;
  overflow-y: auto !important;
}

.tabulator-edit-list .tabulator-edit-list-item {
  padding: 4px 8px !important;
  color: var(--text-secondary) !important;
  transition: background-color 100ms ease, color 100ms ease !important;
}

.tabulator-edit-list .tabulator-edit-list-item:hover {
  background-color: var(--bg-surface-elevated) !important;
  color: var(--text-primary) !important;
}

.tabulator-edit-list .tabulator-edit-list-item.tabulator-edit-list-item-selected {
  background-color: var(--accent-primary) !important;
  color: var(--accent-ink) !important;
  font-weight: 700 !important;
}

.tabulator .tabulator-header .tabulator-col input:focus,
.tabulator .tabulator-header .tabulator-col select:focus {
  border-color: var(--accent-primary) !important;
  outline: none !important;
}

.tabulator .tabulator-tableholder .tabulator-table .tabulator-row {
  background-color: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  cursor: pointer !important;
  transition: background-color 100ms ease !important;
}

.tabulator .tabulator-tableholder .tabulator-table .tabulator-row:hover {
  background-color: var(--accent-subtle) !important;
}

.tabulator .tabulator-tableholder .tabulator-table .tabulator-row.tabulator-selected {
  background-color: var(--accent-subtle) !important;
}

.tabulator .tabulator-cell {
  padding: 10px 10px !important;
  border-right: 1px solid transparent !important;
  vertical-align: middle !important;
  display: inline-flex !important;
  align-items: center !important;
}

.tabulator .tabulator-footer {
  background-color: var(--bg-surface-elevated) !important;
  border-top: 1px solid var(--border-subtle) !important;
  color: var(--text-secondary) !important;
  font-family: var(--font-mono) !important;
  font-size: 0.8rem !important;
  padding: 8px 12px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

.tabulator .tabulator-footer .tabulator-paginator label {
  color: var(--text-muted) !important;
  font-family: var(--font-mono) !important;
  font-size: 0.75rem !important;
}

.tabulator .tabulator-footer .tabulator-page {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border-subtle) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-xs) !important;
  padding: 4px 10px !important;
  font-family: var(--font-mono) !important;
  font-size: 0.78rem !important;
  margin: 0 2px !important;
}

.tabulator .tabulator-footer .tabulator-page.active {
  background-color: var(--accent-primary) !important;
  color: var(--accent-ink) !important;
  border-color: var(--accent-primary) !important;
  font-weight: 700 !important;
}

.tabulator .tabulator-footer .tabulator-page:hover:not(.disabled) {
  background-color: var(--bg-inset) !important;
}

/* Custom Tabulator Checkbox Styling */
.tabulator input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-strong) !important;
  border-radius: var(--radius-sm) !important;
  background: var(--bg-surface) !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.15s ease;
  vertical-align: middle;
}

.tabulator input[type="checkbox"]:hover {
  border-color: var(--gold-primary, var(--accent-primary)) !important;
  box-shadow: 0 0 0 3px var(--gold-glow, var(--accent-subtle)) !important;
}

.tabulator input[type="checkbox"]:checked {
  background: var(--gold-primary, var(--accent-primary)) !important;
  border-color: var(--gold-primary, var(--accent-primary)) !important;
}

.tabulator input[type="checkbox"]:checked::after {
  content: "";
  display: block;
  width: 5px;
  height: 9px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

/* ==========================================================================
   SCROLL-TO-TOP FAB (JUMP TO TOP)
   ========================================================================== */
#to-top-btn {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 52px;
  height: 52px;
  border: none;
  background: var(--bg-surface);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 220ms ease, transform 220ms ease, visibility 220ms ease, box-shadow 200ms ease;
  z-index: 999;
}

#to-top-btn.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#to-top-btn:hover {
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-gold), 0 0 22px rgba(185, 155, 95, 0.35);
}

#to-top-btn:active {
  transform: scale(0.95);
}

.to-top-ring {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.to-top-track {
  fill: none;
  stroke: var(--border-subtle);
  stroke-width: 3;
}

.to-top-progress {
  fill: none;
  stroke: var(--gold-primary);
  stroke-width: 3;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 60ms linear;
}

.to-top-arrow {
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
}

@media (max-width: 480px) {
  #to-top-btn {
    right: 14px;
    bottom: 14px;
    width: 44px;
    height: 44px;
  }

  #to-top-btn .to-top-ring {
    width: 44px;
    height: 44px;
  }
}
