/* Design tokens, reset and base element styles. Loaded in numeric order; later files may override earlier ones. */

/* Every color lives in a token below; dark mode only redefines the tokens, so components never restate colors. */
:root {
  color-scheme: light dark;

  /* Surfaces */
  --color-bg: #f5f6f8;
  --color-surface: #ffffff;
  --color-surface-muted: #f8fafc;
  --color-surface-hover: #f1f5f9;
  --color-control: #ffffff;
  --color-neutral: #e2e8f0;
  --color-neutral-hover: #cbd5e1;

  /* Text */
  --color-text: #1f2933;
  --color-text-strong: #111827;
  --color-text-secondary: #4b5563;
  --color-text-muted: #6b7280;
  --color-text-subtle: #9ca3af;

  /* Lines */
  --color-border: #d1d5db;
  --color-border-subtle: #e5e7eb;

  /* Brand and focus */
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-on-primary: #ffffff;
  --color-info-bg: #eff6ff;
  --color-info-bg-strong: #dbeafe;
  --color-info-border: #93c5fd;
  --focus-ring: #1d4ed8;

  /* States */
  --color-success-bg: #dcfce7;
  --color-success-bg-soft: #f0fdf4;
  --color-success-text: #166534;
  --color-success-border: #86efac;
  --color-warning-bg: #fff7ed;
  --color-warning-text: #9a3412;
  --color-warning-strong: #c2410c;
  --color-warning-border: #fdba74;
  --color-pending-bg: #fef9c3;
  --color-pending-text: #a16207;
  --color-danger-bg: #fee2e2;
  --color-danger-bg-soft: #fef2f2;
  --color-danger-bg-hover: #fecaca;
  --color-danger-text: #b91c1c;
  --color-danger-border: #fca5a5;
  --color-accent-bg: #ede9fe;
  --color-accent-text: #6d28d9;
  --color-outbound: #10b981;
  --color-internal: #f59e0b;

  /* Charts */
  --chart-track: #eef0f3;
  --chart-axis: #9ca3af;
  --chart-neutral: #64748b;
  --chart-negative: #d03b3b;

  /* Sidebar (dark in both themes) */
  --sidebar-bg: #111827;
  --sidebar-text: #f9fafb;
  --sidebar-link: #cbd5f5;
  --sidebar-accent: #93c5fd;

  /* Elevation */
  --shadow-card: 0 8px 20px rgba(15, 23, 42, 0.06);
  --shadow-tile: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-popover: 0 8px 20px rgba(15, 23, 42, 0.18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0f1115;
    --color-surface: #181b21;
    --color-surface-muted: #1d2128;
    --color-surface-hover: #252a33;
    --color-control: #12151a;
    --color-neutral: #2a2f38;
    --color-neutral-hover: #363c47;

    --color-text: #e5e7eb;
    --color-text-strong: #f3f4f6;
    --color-text-secondary: #c4cad4;
    --color-text-muted: #9aa3af;
    --color-text-subtle: #6b7380;

    --color-border: #3a404b;
    --color-border-subtle: #2a2f38;

    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-on-primary: #ffffff;
    --color-info-bg: rgba(59, 130, 246, 0.14);
    --color-info-bg-strong: rgba(59, 130, 246, 0.28);
    --color-info-border: #3b82f6;
    --focus-ring: #60a5fa;

    --color-success-bg: rgba(34, 197, 94, 0.15);
    --color-success-bg-soft: rgba(34, 197, 94, 0.1);
    --color-success-text: #86efac;
    --color-success-border: rgba(134, 239, 172, 0.4);
    --color-warning-bg: rgba(249, 115, 22, 0.12);
    --color-warning-text: #fdba74;
    --color-warning-strong: #fb923c;
    --color-warning-border: rgba(253, 186, 116, 0.4);
    --color-pending-bg: rgba(234, 179, 8, 0.15);
    --color-pending-text: #fde047;
    --color-danger-bg: rgba(239, 68, 68, 0.15);
    --color-danger-bg-soft: rgba(239, 68, 68, 0.1);
    --color-danger-bg-hover: rgba(239, 68, 68, 0.25);
    --color-danger-text: #fca5a5;
    --color-danger-border: rgba(252, 165, 165, 0.4);
    --color-accent-bg: rgba(139, 92, 246, 0.18);
    --color-accent-text: #c4b5fd;

    --chart-track: #2a2f38;
    --chart-axis: #6b7380;
    --chart-neutral: #8391a5;
    --chart-negative: #e5534b;

    --sidebar-bg: #0a0c10;

    /* Shadows vanish on dark backgrounds, so cards get a hairline edge instead. */
    --shadow-card: 0 0 0 1px var(--color-border-subtle);
    --shadow-tile: 0 0 0 1px var(--color-border-subtle);
    --shadow-popover: 0 8px 20px rgba(0, 0, 0, 0.5);
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

:where(a, button, input, select, textarea):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus-ring) 45%, transparent);
  outline-offset: 2px;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

.guest-body {
  background: var(--color-bg);
}

.guest-language {
  position: fixed;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  box-shadow: var(--shadow-card);
  z-index: 30;
}

.guest-language__label {
  color: var(--color-text-secondary);
  font-size: 13px;
  margin: 0;
}

.guest-language__select {
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-control);
  min-height: 36px;
  padding: 0 12px;
  color: var(--color-text-strong);
}

/* Visually hidden text that screen readers still announce. */
.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;
}
