/* ─── Farepoint Design System & Theme CSS ─────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Typography */
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', var(--font-body);

  /* Light Theme (Mono-Theme Default) */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-sidebar-header: #ffffff;
  --bg-sidebar-active: #2563eb;
  --bg-sidebar-hover: #f1f5f9;
  --border-sidebar: #e2e8f0;
  
  --text-sidebar: #475569;
  --text-sidebar-heading: #94a3b8;
  --text-sidebar-hover: #0f172a;
  --text-sidebar-active: #ffffff;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --border-subtle: #f1f5f9;
  --border-default: #e2e8f0;
  --border-strong: #cbd5e1;

  --brand-primary: #2563eb;
  --brand-primary-hover: #1d4ed8;
  --brand-primary-subtle: #eff6ff;
  --brand-primary-border: #bfdbfe;

  --status-success: #059669;
  --status-success-bg: #ecfdf5;
  --status-success-border: #a7f3d0;

  --status-warning: #d97706;
  --status-warning-bg: #fffbeb;
  --status-warning-border: #fde68a;

  --status-danger: #dc2626;
  --status-danger-bg: #fef2f2;
  --status-danger-border: #fecaca;

  --status-neutral: #64748b;
  --status-neutral-bg: #f8fafc;
  --status-neutral-border: #e2e8f0;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --shadow-card: 0 1px 3px 0 rgb(15 23 42 / 0.06), 0 1px 2px -1px rgb(15 23 42 / 0.04);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
}

/* ── Dark Theme Tokens ───────────────────────────────────────────────── */
[data-theme="dark"], html.dark {
  --bg-app: #090d16;
  --bg-surface: #0f172a;
  --bg-surface-subtle: #1e293b;
  --bg-sidebar: #0f172a;
  --bg-sidebar-header: #0f172a;
  --bg-sidebar-active: #2563eb;
  --bg-sidebar-hover: #1e293b;
  --border-sidebar: #1e293b;

  --text-sidebar: #94a3b8;
  --text-sidebar-heading: #64748b;
  --text-sidebar-hover: #f8fafc;
  --text-sidebar-active: #ffffff;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  --border-subtle: #141f33;
  --border-default: #1e293b;
  --border-strong: #334155;

  --brand-primary: #3b82f6;
  --brand-primary-hover: #2563eb;
  --brand-primary-subtle: #1e293b;
  --brand-primary-border: #1d4ed8;

  --status-success: #10b981;
  --status-success-bg: rgba(16, 185, 129, 0.12);
  --status-success-border: rgba(16, 185, 129, 0.25);

  --status-warning: #f59e0b;
  --status-warning-bg: rgba(245, 158, 11, 0.12);
  --status-warning-border: rgba(245, 158, 11, 0.25);

  --status-danger: #ef4444;
  --status-danger-bg: rgba(239, 68, 68, 0.12);
  --status-danger-border: rgba(239, 68, 68, 0.25);

  --status-neutral: #94a3b8;
  --status-neutral-bg: #1e293b;
  --status-neutral-border: #334155;

  --shadow-card: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.2);
}

/* ── Base Reset & Typography ─────────────────────────────────────────── */
body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* ── Global Dark Theme High-Contrast Utility Remappings ──────────────── */
[data-theme="dark"] .text-slate-900,
html.dark .text-slate-900,
[data-theme="dark"] .text-slate-800,
html.dark .text-slate-800,
[data-theme="dark"] .text-slate-700,
html.dark .text-slate-700 {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .text-slate-600,
html.dark .text-slate-600 {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .text-slate-500,
html.dark .text-slate-500,
[data-theme="dark"] .text-slate-400,
html.dark .text-slate-400 {
  color: var(--text-muted) !important;
}

[data-theme="dark"] .bg-white,
html.dark .bg-white {
  background-color: var(--bg-surface) !important;
}

[data-theme="dark"] .bg-slate-50,
html.dark .bg-slate-50,
[data-theme="dark"] .bg-slate-100,
html.dark .bg-slate-100 {
  background-color: var(--bg-surface-subtle) !important;
}

[data-theme="dark"] .border-slate-100,
html.dark .border-slate-100,
[data-theme="dark"] .border-slate-200,
html.dark .border-slate-200,
[data-theme="dark"] .border-slate-300,
html.dark .border-slate-300 {
  border-color: var(--border-default) !important;
}

/* Informational Callouts in Dark Theme */
[data-theme="dark"] .bg-blue-50,
html.dark .bg-blue-50,
[data-theme="dark"] .bg-blue-50\/80,
html.dark .bg-blue-50\/80 {
  background-color: rgba(37, 99, 235, 0.12) !important;
  border-color: rgba(37, 99, 235, 0.25) !important;
}
[data-theme="dark"] .text-blue-950,
html.dark .text-blue-950,
[data-theme="dark"] .text-blue-900,
html.dark .text-blue-900,
[data-theme="dark"] .text-blue-800,
html.dark .text-blue-800 {
  color: #93c5fd !important;
}
[data-theme="dark"] .text-blue-700,
html.dark .text-blue-700 {
  color: #bfdbfe !important;
}

[data-theme="dark"] .bg-emerald-50,
html.dark .bg-emerald-50,
[data-theme="dark"] .bg-emerald-50\/70,
html.dark .bg-emerald-50\/70 {
  background-color: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.25) !important;
}
[data-theme="dark"] .text-emerald-950,
html.dark .text-emerald-950,
[data-theme="dark"] .text-emerald-900,
html.dark .text-emerald-900,
[data-theme="dark"] .text-emerald-800,
html.dark .text-emerald-800 {
  color: #6ee7b7 !important;
}
[data-theme="dark"] .text-emerald-700,
html.dark .text-emerald-700 {
  color: #a7f3d0 !important;
}

[data-theme="dark"] .bg-amber-50,
html.dark .bg-amber-50,
[data-theme="dark"] .bg-amber-50\/70,
html.dark .bg-amber-50\/70 {
  background-color: rgba(245, 158, 11, 0.12) !important;
  border-color: rgba(245, 158, 11, 0.25) !important;
}
[data-theme="dark"] .text-amber-950,
html.dark .text-amber-950,
[data-theme="dark"] .text-amber-900,
html.dark .text-amber-900,
[data-theme="dark"] .text-amber-800,
html.dark .text-amber-800 {
  color: #fcd34d !important;
}
[data-theme="dark"] .text-amber-700,
html.dark .text-amber-700 {
  color: #fde68a !important;
}

[data-theme="dark"] .bg-red-50,
html.dark .bg-red-50,
[data-theme="dark"] .bg-red-50\/70,
html.dark .bg-red-50\/70 {
  background-color: rgba(239, 68, 68, 0.12) !important;
  border-color: rgba(239, 68, 68, 0.25) !important;
}
[data-theme="dark"] .text-red-950,
html.dark .text-red-950,
[data-theme="dark"] .text-red-900,
html.dark .text-red-900,
[data-theme="dark"] .text-red-800,
html.dark .text-red-800 {
  color: #fca5a5 !important;
}
[data-theme="dark"] .text-red-700,
html.dark .text-red-700 {
  color: #fecaca !important;
}

/* ── Layout & Surfaces ───────────────────────────────────────────────── */
.fp-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.fp-card-hover:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.fp-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fp-card-body {
  padding: 1.5rem;
}

/* ── KPI Stat Widgets ────────────────────────────────────────────────── */
.fp-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.fp-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background-color: var(--brand-primary);
  border-top-left-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-lg);
}

.fp-stat-card.stat-success::before {
  background-color: var(--status-success);
}
.fp-stat-card.stat-warning::before {
  background-color: var(--status-warning);
}
.fp-stat-card.stat-danger::before {
  background-color: var(--status-danger);
}

.fp-stat-label {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.fp-stat-value {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-top: 0.35rem;
  line-height: 1.2;
}

.fp-stat-subtext {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.fp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  transition: all 0.15s ease-in-out;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1.25rem;
}

.fp-btn-primary {
  background-color: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}

.fp-btn-primary:hover {
  background-color: var(--brand-primary-hover);
  border-color: var(--brand-primary-hover);
  box-shadow: 0 2px 4px 0 rgb(37 99 235 / 0.25);
}

.fp-btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.fp-btn-secondary:hover {
  background-color: var(--bg-surface-subtle);
  border-color: var(--border-strong);
}

.fp-btn-success {
  background-color: var(--status-success);
  color: #ffffff;
  border-color: var(--status-success);
}

.fp-btn-success:hover {
  background-color: #047857;
}

.fp-btn-danger {
  background-color: var(--status-danger);
  color: #ffffff;
  border-color: var(--status-danger);
}

.fp-btn-danger:hover {
  background-color: #b91c1c;
}

.fp-btn-sm {
  font-size: 0.8125rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
}

.fp-btn-lg {
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
}

/* ── Badges ──────────────────────────────────────────────────────────── */
.fp-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  line-height: 1.1;
  border: 1px solid transparent;
}

.fp-badge-success {
  background-color: var(--status-success-bg);
  color: var(--status-success);
  border-color: var(--status-success-border);
}

.fp-badge-warning {
  background-color: var(--status-warning-bg);
  color: var(--status-warning);
  border-color: var(--status-warning-border);
}

.fp-badge-danger {
  background-color: var(--status-danger-bg);
  color: var(--status-danger);
  border-color: var(--status-danger-border);
}

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

.fp-badge-neutral {
  background-color: var(--status-neutral-bg);
  color: var(--status-neutral);
  border-color: var(--status-neutral-border);
}

/* ── Tables ──────────────────────────────────────────────────────────── */
.fp-table-container {
  overflow-x: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background-color: var(--bg-surface);
}

.fp-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
  text-align: left;
}

.fp-table th {
  background-color: var(--bg-surface-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border-default);
}

.fp-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.fp-table tbody tr:hover {
  background-color: var(--bg-surface-subtle);
}

/* ── Form Inputs & Controls ──────────────────────────────────────────── */
.fp-input, .fp-select, .fp-textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.875rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input[type="checkbox"],
input[type="radio"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--brand-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.fp-input:focus, .fp-select:focus, .fp-textarea:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.15);
}

.fp-input::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

.fp-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.fp-help-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.fp-error-text {
  font-size: 0.75rem;
  color: var(--status-danger);
  margin-top: 0.3rem;
}

/* ── Unified Mono-Theme Sidebar Navigation ───────────────────────────── */
.fp-sidebar {
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-sidebar);
  color: var(--text-sidebar);
}

.fp-sidebar-header {
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border-sidebar);
  background-color: var(--bg-sidebar-header);
}

.fp-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-decoration: none;
}

.fp-sidebar-badge {
  padding: 0.75rem 1rem;
  background-color: var(--bg-surface-subtle);
  border-bottom: 1px solid var(--border-sidebar);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.fp-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-sidebar);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all 0.15s ease-in-out;
}

.fp-nav-link:hover {
  background-color: var(--bg-sidebar-hover);
  color: var(--text-sidebar-hover);
}

.fp-nav-link.active {
  background-color: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
  font-weight: 600;
  box-shadow: 0 2px 6px 0 rgb(37 99 235 / 0.25);
}

.fp-nav-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-sidebar-heading);
  padding: 1.25rem 0.875rem 0.375rem 0.875rem;
}

.fp-sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border-sidebar);
  background-color: var(--bg-sidebar-header);
}

/* ── Floating Notification Toasts ───────────────────────────────────── */
.fp-toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 26rem;
  width: calc(100% - 2.5rem);
  pointer-events: none;
}

.fp-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-default);
  backdrop-filter: blur(12px);
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.fp-toast.hide {
  opacity: 0;
  transform: translateX(100%);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(2rem) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.fp-toast-success {
  background-color: var(--status-success-bg);
  border-color: var(--status-success-border);
  color: var(--text-primary);
}
.fp-toast-success .fp-toast-icon {
  color: var(--status-success);
}

.fp-toast-error, .fp-toast-danger {
  background-color: var(--status-danger-bg);
  border-color: var(--status-danger-border);
  color: var(--text-primary);
}
.fp-toast-error .fp-toast-icon, .fp-toast-danger .fp-toast-icon {
  color: var(--status-danger);
}

.fp-toast-warning {
  background-color: var(--status-warning-bg);
  border-color: var(--status-warning-border);
  color: var(--text-primary);
}
.fp-toast-warning .fp-toast-icon {
  color: var(--status-warning);
}

.fp-toast-info {
  background-color: var(--brand-primary-subtle);
  border-color: var(--brand-primary-border);
  color: var(--text-primary);
}
.fp-toast-info .fp-toast-icon {
  color: var(--brand-primary);
}

