/* ===========================
   NOGHOST DESIGN SYSTEM
   globals.css — CSS custom properties + base design tokens
   =========================== */

/* ---------- Font Import ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ---------- Design Tokens ---------- */
:root {
  /* Background layers */
  --background:       #f8fafc;
  --foreground:        #0f172a;

  /* Primary (navy/slate) */
  --primary:          #0f172a;
  --primary-foreground: #ffffff;

  /* Accent (cyan/electric blue) */
  --accent:           #0ea5e9;
  --accent-foreground: #ffffff;
  --accent-muted:     rgba(14, 165, 233, 0.12);
  --accent-border:    rgba(14, 165, 233, 0.25);
  --accent-glow:      rgba(14, 165, 233, 0.15);

  /* Muted / secondary */
  --muted:            #f1f5f9;
  --muted-foreground: #64748b;

  /* Surfaces */
  --card:             #ffffff;
  --card-foreground:  #0f172a;
  --popover:          #ffffff;
  --popover-foreground: #0f172a;

  /* Borders */
  --border:           #e2e8f0;
  --border-strong:    #cbd5e1;
  --input:            #e2e8f0;
  --input-focus:      #0ea5e9;
  --ring:             rgba(14, 165, 233, 0.35);

  /* Semantic */
  --destructive:      #ef4444;
  --destructive-foreground: #ffffff;
  --success:          #22c55e;
  --success-foreground: #ffffff;
  --warning:          #f59e0b;
  --warning-foreground: #0f172a;
  --info:             #3b82f6;

  /* Text hierarchy */
  --text-primary:     #0f172a;
  --text-secondary:   #475569;
  --text-muted:       #94a3b8;
  --text-placeholder: #cbd5e1;

  /* Radius */
  --radius-sm:        6px;
  --radius:           8px;
  --radius-lg:        12px;
  --radius-xl:        16px;
  --radius-full:      9999px;

  /* Shadows */
  --shadow-xs:        0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:        0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:        0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
  --shadow-lg:        0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.05);
  --shadow-xl:        0 20px 25px rgba(0,0,0,0.1), 0 8px 10px rgba(0,0,0,0.06);

  /* Focus ring */
  --focus-ring:       0 0 0 3px rgba(14, 165, 233, 0.30);

  /* Transitions */
  --transition-fast:  0.15s ease;
  --transition:       0.2s ease;
  --transition-slow: 0.3s ease;

  /* Typography */
  --font-sans:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Font sizes */
  --text-xs:          0.75rem;    /* 12px */
  --text-sm:          0.875rem;   /* 14px */
  --text-base:        1rem;       /* 16px */
  --text-lg:          1.125rem;   /* 18px */
  --text-xl:          1.25rem;    /* 20px */
  --text-2xl:         1.5rem;     /* 24px */
  --text-3xl:         1.875rem;   /* 30px */
  --text-4xl:         2.25rem;    /* 36px */
  --text-5xl:         3rem;       /* 48px */
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ---------- Base Body ---------- */
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  background-color: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p { line-height: 1.7; color: var(--text-secondary); }

a { color: var(--accent); text-decoration: none; }
a:hover { color: #0284c7; }

small, .text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-muted { color: var(--text-muted); }

/* ---------- Layout Containers ---------- */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-sm {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

.section { padding: 80px 0; }
.section-sm { padding: 48px 0; }
.section-lg { padding: 120px 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header { padding: 20px 24px; border-bottom: 1px solid var(--border); }
.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background var(--transition-fast),
              transform var(--transition-fast),
              box-shadow var(--transition-fast),
              border-color var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; opacity: 0.9; }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}
.btn-primary:hover { background: #1e293b; box-shadow: var(--shadow-md); }

.btn-accent {
  background: var(--accent);
  color: var(--accent-foreground);
}
.btn-accent:hover { background: #0284c7; box-shadow: var(--shadow-md); }

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--muted); border-color: var(--text-muted); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--muted); color: var(--text-primary); }

.btn-destructive {
  background: var(--destructive);
  color: var(--destructive-foreground);
}
.btn-destructive:hover { background: #dc2626; }

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent-border);
}
.btn-outline:hover { background: var(--accent-muted); }

.btn-link { background: none; border: none; color: var(--accent); padding: 0; }
.btn-link:hover { text-decoration: underline; }

.btn-sm { padding: 6px 12px; font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 28px; font-size: var(--text-lg); border-radius: var(--radius-lg); }
.btn-icon { padding: 8px; }

/* ---------- Form Inputs ---------- */
.input, select, textarea {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--input);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  padding: 9px 12px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input::placeholder { color: var(--text-placeholder); }

.input:focus, select:focus, textarea:focus {
  border-color: var(--input-focus);
  box-shadow: var(--focus-ring);
}

.input:disabled, select:disabled, textarea:disabled {
  background: var(--muted);
  color: var(--text-muted);
  cursor: not-allowed;
}

textarea { resize: vertical; min-height: 80px; }

.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-hint { font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: var(--text-xs); color: var(--destructive); margin-top: 4px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
}

.badge-primary { background: var(--accent-muted); color: var(--accent); border-color: var(--accent-border); }
.badge-success { background: #dcfce7; color: #16a34a; border-color: #bbf7d0; }
.badge-warning { background: #fef9c3; color: #a16207; border-color: #fde047; }
.badge-danger  { background: #fee2e2; color: #dc2626; border-color: #fecaca; }
.badge-neutral { background: var(--muted); color: var(--text-muted); border-color: var(--border); }
.badge-info     { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

thead { background: var(--muted); }

th {
  text-align: left;
  padding: 10px 14px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-secondary);
}

tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--muted); cursor: pointer; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--text-primary);
  text-decoration: none;
}

.nav-logo svg { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: color var(--transition-fast);
}

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

/* ---------- Alerts / Toasts ---------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: var(--text-sm);
}

.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.alert-warning  { background: #fefce8; border-color: #fde047; color: #a16207; }
.alert-danger   { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.alert-info     { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  font-size: var(--text-sm);
  z-index: 9999;
  box-shadow: var(--shadow-xl);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--transition), transform var(--transition);
  max-width: 340px;
}

.toast.show { opacity: 1; transform: none; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--destructive); }
.toast.info    { border-left: 3px solid var(--info); }

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 520px;
  max-width: 100%;
  padding: 28px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

.modal-header { margin-bottom: 20px; }
.modal-title { font-size: var(--text-xl); font-weight: 700; }
.modal-footer {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

/* ---------- Dividers ---------- */
.divider { height: 1px; background: var(--border); margin: 24px 0; }

/* ---------- Utility classes ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-center { text-align: center; }
.text-right  { text-align: right; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold   { font-weight: 700; }

/* Flex helpers */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

/* Margin helpers */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }

/* ---------- App Shell ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--background);
}

/* ── Sidebar ── */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--primary);
  border-right: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 14px;
  font-weight: 700;
  font-size: var(--text-lg);
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid #1e293b;
}

.sidebar-logo svg { color: var(--accent); flex-shrink: 0; }

.sidebar-section {
  padding: 12px 12px 8px;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
  padding: 0 8px;
  margin-bottom: 4px;
}

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

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: #94a3b8;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  border-left: 2px solid transparent;
  text-decoration: none;
}

.sidebar-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-item:hover {
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
}

.sidebar-item.active {
  background: rgba(14,165,233,0.12);
  color: #0ea5e9;
  border-left-color: #0ea5e9;
}

.sidebar-item.active svg { color: #0ea5e9; }

.sidebar-spacer { flex: 1; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #1e293b;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1e3a5f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #e2e8f0; }
.sidebar-user-role { font-size: 11px; color: #475569; }

/* ── Main Area ── */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Top bar ── */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-workspace {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-right: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-workspace-badge {
  font-size: 10px;
  background: var(--muted);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 500;
  border: 1px solid var(--border);
}

.topbar-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: var(--font-sans);
  transition: background var(--transition-fast), color var(--transition-fast);
  border: 1px solid transparent;
}

.tab-btn svg { width: 15px; height: 15px; }

.tab-btn:hover { background: var(--muted); color: var(--text-primary); }
.tab-btn.active {
  background: var(--accent-muted);
  color: var(--accent);
  border-color: var(--accent-border);
}

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* ── Content area ── */
.content { padding: 28px 32px; flex: 1; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-header-left {}
.page-title { font-size: var(--text-2xl); font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.page-subtitle { font-size: var(--text-sm); color: var(--text-muted); margin-top: 4px; }

/* ── Stat Cards ── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
}
.stat-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.stat-icon { width: 32px; height: 32px; border-radius: var(--radius); background: var(--accent-muted); display: flex; align-items: center; justify-content: center; }
.stat-icon svg { width: 16px; height: 16px; stroke: var(--accent); }
.stat-value { font-size: 30px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Data card (table container) ── */
.data-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.data-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.data-card-title { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); }

/* ── Table refinements ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }

thead { background: var(--muted); }

th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-secondary);
  background: var(--card);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }

/* ── Campaign Status Badges ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}

.status-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.status-badge.status-draft { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }
.status-badge.status-pending_review { background: #fef9c3; color: #b45309; border-color: #fde68a; }
.status-badge.status-active { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.status-badge.status-paused { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.status-badge.status-completed { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }

/* Record status badges */
.badge-active  { background: #dcfce7; color: #15803d; }
.badge-draft    { background: var(--muted); color: var(--text-muted); border: 1px solid var(--border); }
.badge-archived { background: #fef2f2; color: #b91c1c; }

/* Action badges */
.badge-create { background: #dbeafe; color: #1d4ed8; }
.badge-update { background: #dcfce7; color: #15803d; }
.badge-delete { background: #fee2e2; color: #dc2626; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 56px 32px;
  color: var(--text-muted);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.empty-state-icon svg { width: 22px; height: 22px; stroke: var(--text-muted); }

.empty-state-title { font-size: var(--text-base); font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.empty-state-desc { font-size: var(--text-sm); color: var(--text-muted); margin-bottom: 20px; }

/* ── Modals ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 520px;
  max-width: 100%;
  padding: 28px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: var(--text-xl); font-weight: 700; }
.modal-close {
  width: 28px; height: 28px;
  border-radius: var(--radius);
  background: var(--muted);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition-fast);
}
.modal-close:hover { background: var(--border); color: var(--text-primary); }

.modal-body { margin-bottom: 0; }
.modal-footer {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

/* ── Filter bar ── */
.filter-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-group { display: flex; align-items: center; gap: 6px; }
.filter-label { font-size: var(--text-sm); color: var(--text-muted); font-weight: 500; }

select, input[type="date"], input[type="text"] {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  outline: none;
}

select:focus, input:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--muted);
}

.pagination-info { font-size: var(--text-sm); color: var(--text-muted); }
.pagination-controls { display: flex; gap: 6px; }

/* ── Audit detail ── */
.audit-detail {
  padding: 16px;
  background: var(--muted);
  border-radius: var(--radius);
  margin-top: 10px;
  border: 1px solid var(--border);
}

.audit-detail pre {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  font-size: var(--text-sm);
  z-index: 9999;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--transition), transform var(--transition);
  max-width: 340px;
  box-shadow: var(--shadow-xl);
}

.toast.show { opacity: 1; transform: none; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--destructive); }

/* ── Action buttons ── */
.action-group { display: flex; align-items: center; gap: 6px; }

.btn-danger {
  background: var(--destructive);
  color: var(--destructive-foreground);
  border: none;
}
.btn-danger:hover { background: #dc2626; }

/* ── Inline actions ── */
.row-actions { display: flex; align-items: center; gap: 6px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { padding: 20px 16px; }
  .page-header { flex-direction: column; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}