:root {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color-scheme: light;
  --surface-gradient: radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.4), transparent 28%),
    radial-gradient(circle at 90% 10%, rgba(34, 197, 94, 0.18), transparent 26%),
    radial-gradient(circle at 50% 80%, rgba(79, 70, 229, 0.08), transparent 30%);
  --brand-green: #1c9f5b;
  --brand-yellow: #f4c542;
  --brand-dark: #0f172a;
  --brand-light: #f8fafc;
  --surface-base: #f1f5f9;
  --surface-elevated: #ffffff;
  --surface-card: rgba(255, 255, 255, 0.94);
  --surface-glass: rgba(255, 255, 255, 0.8);
  --border-soft: rgba(148, 163, 184, 0.35);
  --border-strong: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --table-header-bg: #f9fafb;
  --table-row-bg: #ffffff;
  --table-row-alt-bg: #f5f5f5;
  --table-border-color: #e5e7eb;
  --table-stripe: rgba(15, 23, 42, 0.03);
  --pill-muted: rgba(148, 163, 184, 0.2);
  --header-glass: rgba(255, 255, 255, 0.82);
  --toggle-bg: linear-gradient(135deg, #f8f9ff, #eef1ff);
  --toggle-border: #cdd6ff;
  --toggle-thumb: #ffffff;
  --toggle-shadow: 0 8px 24px rgba(136, 150, 255, 0.2);
  --input-bg: #ffffff;
  --sidebar-accent: rgba(28, 159, 91, 0.08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-gradient: radial-gradient(circle at 14% 18%, rgba(52, 211, 153, 0.14), transparent 28%),
    radial-gradient(circle at 84% 12%, rgba(94, 234, 212, 0.12), transparent 25%),
    radial-gradient(circle at 50% 84%, rgba(59, 130, 246, 0.16), transparent 30%);
  --surface-base: #070d1a;
  --surface-elevated: #0c1426;
  --surface-card: rgba(16, 24, 40, 0.92);
  --surface-glass: rgba(12, 20, 38, 0.82);
  --border-soft: rgba(148, 163, 184, 0.35);
  --border-strong: #1f2937;
  --text-primary: #f5f7ff;
  --text-secondary: #d8e1ef;
  --text-muted: #b6c4d8;
  --table-header-bg: #0b1220;
  --table-row-bg: #020617;
  --table-row-alt-bg: #030a1a;
  --table-border-color: #1e293b;
  --table-stripe: rgba(148, 163, 184, 0.08);
  --pill-muted: rgba(148, 163, 184, 0.16);
  --header-glass: rgba(12, 20, 38, 0.82);
  --toggle-bg: linear-gradient(135deg, #0e162b, #111827);
  --toggle-border: rgba(165, 180, 255, 0.5);
  --toggle-thumb: #e2e8f0;
  --toggle-shadow: 0 18px 42px rgba(0, 0, 0, 0.55);
  --input-bg: #0f172a;
  --sidebar-accent: rgba(52, 211, 153, 0.1);
}

.theme-toggle {
  position: relative;
  display: inline-flex;
}

.theme-toggle__button {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-items: center;
  width: 112px;
  height: 48px;
  padding: 6px;
  border-radius: 999px;
  border: 1.5px solid var(--toggle-border);
  background: var(--toggle-bg);
  box-shadow: var(--toggle-shadow);
  cursor: pointer;
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.theme-toggle__button:hover {
  box-shadow: 0 10px 28px rgba(136, 150, 255, 0.28);
  border-color: #a5b4ff;
}

.theme-toggle__thumb {
  position: absolute;
  top: 6px;
  left: 6px;
  width: calc(50% - 8px);
  height: calc(100% - 12px);
  border-radius: 999px;
  background: var(--toggle-thumb);
  box-shadow: 0 12px 26px rgba(87, 105, 255, 0.28);
  transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.theme-toggle.is-dark .theme-toggle__thumb {
  transform: translateX(calc(100% + 8px));
  box-shadow: var(--toggle-shadow);
}

.theme-toggle__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #c6c1ff;
  opacity: 0.9;
  transition: opacity 150ms ease, color 150ms ease;
}

.theme-toggle__icon svg {
  width: 20px;
  height: 20px;
}

.theme-toggle__icon--sun {
  color: #fbbf24;
}

.theme-toggle__icon--moon {
  color: #a78bfa;
}

.theme-toggle.is-dark .theme-toggle__icon--sun,
.theme-toggle:not(.is-dark) .theme-toggle__icon--moon {
  opacity: 0.55;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--surface-base);
  background-image: var(--surface-gradient);
  color: var(--text-primary);
  transition: background-color 250ms ease, color 250ms ease, background-image 250ms ease;
}

a,
a:visited {
  color: var(--text-primary);
  transition: color 160ms ease;
}

a:hover {
  color: #22c55e;
}

.app-shell {
  background-color: transparent;
  color: var(--text-primary);
}

.app-main {
  background-color: var(--surface-base);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0));
  color: var(--text-primary);
}

[data-theme="dark"] .app-main,
.dark .app-main {
  background-color: var(--surface-base);
  background-image: linear-gradient(180deg, rgba(15, 23, 42, 0.35), rgba(7, 13, 26, 0.8)), var(--surface-gradient);
}

.app-header,
.app-sidebar {
  background: var(--surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-soft) !important;
  box-shadow: 0 18px 38px -18px rgba(15, 23, 42, 0.6);
}

.top-header {
  height: 72px;
  min-height: 72px;
  max-height: 72px;
  flex: 0 0 72px;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(auto, 1fr) max-content minmax(auto, 1fr);
  align-items: center;
  column-gap: 16px;
  padding: 0 24px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

.top-header-left,
.top-header-center,
.top-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.top-header-left {
  justify-content: flex-start;
}

.top-header-center {
  justify-content: center;
}

.top-header-right {
  justify-content: flex-end;
}

.app-sidebar__title {
  color: var(--text-primary);
}

.app-sidebar__nav a {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.app-sidebar__nav a:hover {
  background: var(--sidebar-accent);
  color: var(--text-primary);
  transform: translateX(2px);
}

.app-sidebar__nav a.is-active {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(94, 234, 212, 0.12));
  color: var(--text-primary);
  border-color: rgba(34, 197, 94, 0.35);
  box-shadow: 0 10px 26px -12px rgba(34, 197, 94, 0.5);
}

.app-sidebar__icon {
  background: rgba(148, 163, 184, 0.14);
  color: var(--text-primary);
  border: 1px solid var(--border-soft);
}

.app-sidebar__nav a.is-active .app-sidebar__icon {
  background: #22c55e;
  color: #0f172a;
  border-color: transparent;
}

.app-sidebar__footer button {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-primary);
  border: 1px solid var(--border-soft);
}

.app-sidebar__footer button:hover {
  background: rgba(34, 197, 94, 0.12);
  color: var(--text-primary);
  border-color: rgba(34, 197, 94, 0.35);
}

input:not([type='checkbox']):not([type='radio']),
textarea,
select {
  padding: 0.6rem 0.9rem;
  border-radius: 0.85rem;
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  color: var(--text-primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease, color 160ms ease;
}

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

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #1c9f5b;
  box-shadow: 0 0 0 3px rgba(28, 159, 91, 0.2);
}

/* Base button styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}

.btn-md {
  padding: 8px 18px;
  font-size: 0.95rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

/* Primary action button */
.btn-primary {
  background-color: #22c55e !important;
  color: #ffffff !important;
  border: 1px solid #16a34a !important;
  padding: 8px 18px;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.25);
}

.btn-primary:hover {
  background-color: #16a34a !important;
}

/* Secondary button (outlined) */
.btn-secondary {
  background-color: transparent !important;
  color: #19934e !important;
  border: 2px solid #22c55e !important;
  padding: 7px 18px;
}

.btn-secondary:hover {
  background-color: rgba(34, 197, 94, 0.16) !important;
}

/* Muted buttons (disabled) */
.btn-disabled,
button:disabled {
  background-color: #e1e4e8 !important;
  color: #999 !important;
  border: none !important;
  cursor: not-allowed;
}

[data-theme="dark"] .btn-disabled,
[data-theme="dark"] button:disabled,
.dark .btn-disabled,
.dark button:disabled {
  background-color: #1f2937 !important;
  color: #94a3b8 !important;
  border: 1px solid #334155 !important;
}

/* Small utility button (top-right actions) */
.btn-light {
  background: var(--surface-glass) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: 8px;
  padding: 6px 14px;
}

.btn-light:hover {
  background: rgba(148, 163, 184, 0.16) !important;
}

.dark .btn-secondary {
  color: #34d399 !important;
  border-color: #34d399 !important;
}

.dark .btn-primary {
  box-shadow: 0 2px 10px rgba(52, 211, 153, 0.35);
}

.btn-danger {
  background-color: #e74c3c !important;
  color: #ffffff !important;
  border: 1px solid #c0392b !important;
  padding: 8px 18px;
  box-shadow: 0 2px 6px rgba(231, 76, 60, 0.25);
}

.btn-danger:hover {
  background-color: #c0392b !important;
}

.btn-warning {
  background-color: #fbbf24 !important;
  color: #1f2937 !important;
  border: 1px solid #f59e0b !important;
  padding: 8px 18px;
  box-shadow: 0 2px 6px rgba(251, 191, 36, 0.25);
}

.btn-warning:hover {
  background-color: #f59e0b !important;
}

.card {
  background-color: var(--surface-card);
  border-radius: 1.5rem;
  border: 1px solid var(--border-soft);
  padding: 1.5rem;
  box-shadow: 0 25px 60px -25px rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  color: var(--text-primary);
}

[data-theme="dark"] .card,
.dark .card {
  box-shadow: 0 30px 70px -35px rgba(0, 0, 0, 0.6);
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background-color: var(--table-row-bg);
  border: 1px solid var(--table-border-color);
  border-radius: 1.25rem;
  overflow: hidden;
}

.table th,
.table td {
  border-bottom: 1px solid var(--table-border-color);
  color: var(--text-primary);
}

.table thead th {
  background-color: var(--table-header-bg);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.table tbody tr {
  background-color: var(--table-row-bg);
}

.table tbody tr:nth-child(even) {
  background-color: var(--table-row-alt-bg);
}

input,
textarea,
select {
  font-family: inherit;
}

.glass-panel {
  border-radius: 1.5rem;
  border: 1px solid var(--border-soft);
  background-color: var(--surface-glass);
  padding: 1.5rem;
  box-shadow: 0 25px 50px -18px rgba(15, 23, 42, 0.35);
  transition: transform 200ms ease, box-shadow 200ms ease;
  color: var(--text-primary);
}

.glass-panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 35px 70px -32px rgba(15, 23, 42, 0.45);
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background-color: rgba(34, 197, 94, 0.12);
  color: #065f46;
  font-weight: 600;
  font-size: 0.75rem;
}

[data-theme="dark"] .stat-pill,
.dark .stat-pill {
  background-color: rgba(34, 197, 94, 0.18);
  color: #d1fae5;
}

.stat-pill--muted {
  background-color: var(--pill-muted);
  color: var(--text-secondary);
}

[data-theme="dark"] .stat-pill--muted,
.dark .stat-pill--muted {
  color: var(--text-primary);
}

.alert {
  border-radius: 0.9rem;
  padding: 0.9rem 1rem;
  font-weight: 600;
  border: 1px solid transparent;
  margin-bottom: 0.75rem;
}

.alert-success {
  background: #ecfdf3;
  color: #166534;
  border-color: #bbf7d0;
}

.alert-danger {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecdd3;
}

.dark .alert-success {
  background: rgba(34, 197, 94, 0.12);
  color: #bbf7d0;
  border-color: rgba(52, 211, 153, 0.4);
}

.dark .alert-danger {
  background: rgba(248, 113, 113, 0.12);
  color: #fecdd3;
  border-color: rgba(248, 113, 113, 0.35);
}

.text-success {
  color: #15803d;
}

.text-warning {
  color: #b45309;
}

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

[data-theme="dark"] .text-success,
.dark .text-success {
  color: #bbf7d0;
}

[data-theme="dark"] .text-warning,
.dark .text-warning {
  color: #fbbf24;
}

[data-theme="dark"] .text-muted,
.dark .text-muted {
  color: #cbd5e1;
}

.metric-card {
  color: var(--text-primary);
}

.metric-card__label {
  color: var(--text-secondary);
}

.metric-card__value {
  color: var(--text-primary);
}

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

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

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

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