/* Global design tokens */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-2: #3b82f6;
  --success: #059669;
  --radius: 18px;
  --radius-lg: 24px;
  --shadow: 0 10px 35px -15px rgba(2, 6, 23, 0.25);
}

.dark {
  --bg: #020617;
  --surface: #0f172a;
  --surface-2: #111827;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --line: #1e293b;
  --shadow: 0 12px 36px -15px rgba(0, 0, 0, 0.7);
}

/* Shared page shell to avoid repeated backdrop markup */
.app-shell {
  position: relative;
  min-height: 100vh;
}

.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  transition: background 0.3s ease;
  background: radial-gradient(ellipse at top, #e0e7ff 0%, #f8fafc 45%, #ffffff 100%);
}

.dark .app-shell::before {
  background: radial-gradient(ellipse at top, #312e81 0%, #020617 55%, #000000 100%);
}

.app-shell::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: radial-gradient(currentColor 1px, transparent 1px);
  background-size: 40px 40px;
}

.dark .app-shell::after {
  opacity: 0.2;
}

.app-shell > * {
  position: relative;
  z-index: 1;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--bg);
  color: var(--text);
  transition: background-color 0.3s, color 0.3s;
}

/* Scrollbar (Ref_design) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.dark ::-webkit-scrollbar-thumb {
  background: #334155;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
.dark ::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

::selection {
  background-color: #06b6d4;
  color: white;
}

/* Backward-compatible aliases across admin/legal pages */
.bg-card { background-color: var(--surface); }
.border-border { border-color: var(--line); }
.text-navy { color: var(--text); }
.text-dark-green { color: var(--muted); }
.text-muted-foreground { color: var(--muted); }

/* Optional reusable shells */
.surface-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.surface-card-lg {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* Primary button: Ref_design cyan–blue gradient */
.btn-gradient,
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: 1rem; /* rounded-2xl */
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.625rem 1.5rem;
  transition: all 0.2s;
  background: linear-gradient(to right, #0891b2, #2563eb); /* cyan-600 to blue-600 */
  color: #ffffff;
  border: none;
  cursor: pointer;
  outline: none;
  position: relative;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
}

.btn-gradient:hover,
.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 24px rgba(6, 182, 212, 0.4);
}

.btn-primary:focus-visible,
.btn-gradient:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.35);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  border-radius: 1rem;
}

/* Dark mode primary */
.dark .btn-primary,
.dark .btn-gradient {
  background: linear-gradient(to right, #22d3ee, #3b82f6);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.2);
}

/* Danger button */
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1.5rem;
  transition: all 0.2s;
  background: linear-gradient(to right, #dc2626, #b91c1c);
  color: #ffffff;
  border: none;
  cursor: pointer;
  outline: none;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.btn-danger:hover {
  background: linear-gradient(to right, #b91c1c, #991b1b);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.btn-danger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.3);
}

/* Outline button – Ref_design slate/cyan */
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1.5rem;
  transition: all 0.2s;
  border: 2px solid #e2e8f0;
  background-color: transparent;
  color: #0f172a;
  cursor: pointer;
  outline: none;
}

.dark .btn-outline {
  border-color: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.btn-outline:hover {
  border-color: #0891b2;
  color: #0891b2;
  background-color: rgba(8, 145, 178, 0.05);
}

.dark .btn-outline:hover {
  border-color: #22d3ee;
  color: #22d3ee;
  background-color: rgba(34, 211, 238, 0.1);
}

.btn-outline:focus-visible {
  outline: 2px solid #0891b2;
  outline-offset: 2px;
}

.dark .btn-outline:focus-visible {
  outline-color: #22d3ee;
}

.btn-outline:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-outline.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* Ghost button */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  border: none;
  background-color: transparent;
  color: #475569;
  cursor: pointer;
  outline: none;
}

.dark .btn-ghost {
  color: #94a3b8;
}

.btn-ghost:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.dark .btn-ghost:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
}

.btn-ghost:focus-visible {
  outline: 2px solid #0891b2;
  outline-offset: 2px;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Ref_design font-display utility */
.font-display {
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
}
