/*
 * Design-Tokens von sachdoc. Einzige Quelle für Farben, Schrift, Maße, Schatten und Bewegung.
 * Werte am 02.12.2026 aus Langdock gemessen (app.langdock.com), Primärfarbe Indigo statt Langdock-Blau.
 * Light zuerst: :root ist hell, .dark auf <html> schaltet dunkel.
 * data-size="large" auf <html> vergrößert Schrift und Bedienelemente für Nutzer, die das brauchen.
 */

:root {
  /* Warme Grauskala, Stufen wie bei Langdock */
  --gray-20: #fbfaf9;
  --gray-50: #f5f4f2;
  --gray-60: #f1f0ee;
  --gray-75: #edecea;
  --gray-100: #e8e7e4;
  --gray-150: #dddcda;
  --gray-200: #d2d1ce;
  --gray-300: #bab9b7;
  --gray-400: #a1a1a3;
  --gray-500: #898a8c;
  --gray-600: #727376;
  --gray-700: #5a5b5f;
  --gray-800: #3e3f43;
  --gray-850: #313236;
  --gray-900: #26272b;
  --gray-925: #1d1e22;
  --gray-950: #16171b;
  --ink: #0f1014;

  /* Indigo, Tailwind-Skala */
  --indigo-50: #eef2ff;
  --indigo-100: #e0e7ff;
  --indigo-200: #c7d2fe;
  --indigo-300: #a5b4fc;
  --indigo-400: #818cf8;
  --indigo-500: #6366f1;
  --indigo-600: #4f46e5;
  --indigo-700: #4338ca;
  --indigo-800: #3730a3;
  --indigo-900: #312e81;

  /* Flächen */
  --app: var(--gray-75); /* hinter allem, Farbe der Sidebar */
  --background: var(--gray-20); /* Hauptfläche */
  --card: #ffffff;
  --popover: #ffffff;
  --overlay: rgb(15 16 20 / 0.15);
  --tooltip: var(--gray-900);
  --composer: rgb(255 255 255 / 0.85);
  --input: #ffffff;

  /* Text */
  --foreground: var(--ink); /* Überschriften, Werte */
  --foreground-soft: var(--gray-900); /* Fließtext, Buttons */
  --nav-foreground: var(--gray-800);
  --muted-foreground: var(--gray-600); /* Beschreibungen */
  --subtle-foreground: var(--gray-500); /* Icons, Nebeninfos */
  --placeholder: var(--gray-400);
  --nav-icon: var(--gray-700);

  /* Linien */
  --border: var(--gray-100);
  --border-soft: var(--gray-75);
  --border-strong: var(--gray-200);

  /* Bedienflächen: Sekundärbutton, Auswahl, aktives Segment */
  --control: #ffffff;
  --control-hover: var(--gray-50);

  /* Zustände in Listen und Navigation. Durchscheinend, damit sie auf Sidebar, Hauptfläche und Karte gleich stark
     wirken. Ausgewählt ist doppelt so kräftig wie Hover, sonst sieht man nicht, wo man ist. */
  --hover: rgb(15 16 20 / 0.045);
  --selected: rgb(15 16 20 / 0.095);
  --pressed: rgb(15 16 20 / 0.095);
  --tab-selected: var(--gray-75);
  --segment-track: var(--gray-50);

  /* Primärfarbe */
  --primary: var(--indigo-600);
  --primary-hover: var(--indigo-700);
  --primary-foreground: #ffffff;
  --primary-text: var(--indigo-600); /* Links, Akzenttext */
  --primary-soft: var(--indigo-50);
  --ring: var(--indigo-600); /* Rand eines Felds im Fokus, Fokusrahmen */
  --ring-halo: rgb(79 70 229 / 0.2); /* weicher Ring direkt am Feld */

  /* Signalfarben (sachdoc-Ergänzung, bei Langdock nicht gemessen) */
  --danger: #dc2626;
  --danger-solid: #dc2626; /* Fläche des Löschen-Buttons, in beiden Themen gleich */
  --danger-soft: #fef2f2;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --success: #15803d;
  --success-soft: #f0fdf4;

  /* Schrift */
  --font-sans: "Inter Variable", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --text-2xs: 10px;
  --text-2xs--line-height: 16px;
  --text-xs: 12px;
  --text-xs--line-height: 16px;
  --text-s: 13px;
  --text-s--line-height: 18px;
  --text-nav: 13.5px;
  --text-nav--line-height: 20px;
  --text-sm: 14px;
  --text-sm--line-height: 20px;
  --text-base: 16px;
  --text-base--line-height: 24px;
  --text-lg: 18px;
  --text-lg--line-height: 28px;
  --text-xl: 20px;
  --text-xl--line-height: 28px;
  --text-2xl: 24px;
  --text-2xl--line-height: 32px;
  --text-3xl: 30px;
  --text-3xl--line-height: 36px;
  --weight-regular: 400;
  --weight-nav: 450;
  --weight-medium: 500;
  --weight-semibold: 600;

  /* Maße */
  --sidebar-width: 240px;
  --content-max: 1344px;
  --nav-item-h: 28px;
  --control-h: 32px;
  --control-h-sm: 28px;
  --tab-h: 34px;
  --icon: 17px;
  --icon-stroke: 1.5;

  /* Radien */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Schatten */
  --shadow-xs: 0 1px 2px rgb(0 0 0 / 0.05);
  --shadow-ring-xs: 0 1px 2px #0f172a0a, 0 0 0 1px #0f172a0f;
  --shadow-ring-sm: 0 1px 2px #0f172a0a, 0 2px 6px #0f172a0d, 0 0 0 1px #0f172a0f;
  --shadow-ring-md: 0 2px 4px #0f172a0a, 0 4px 14px #0f172a12, 0 0 0 1px #0f172a12;
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-button:
    inset 0 0 0 1px var(--border), inset 0 1px 0 rgb(255 255 255 / 0.95), inset 0 -1.5px 1.5px rgb(0 0 0 / 0.07);
  --shadow-button-primary: inset 0 0 0 1px rgb(15 16 20 / 0.1), inset 0 1px 0.5px rgb(255 255 255 / 0.22);

  /* Bewegung, gemessen bei Langdock. Jede Kurve hat eine Aufgabe. */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1); /* Farben bei Hover und Fokus */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1); /* Erscheinen: schnell da, weich zur Ruhe */
  --ease-in: cubic-bezier(0.4, 0, 1, 1); /* Verschwinden */
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1); /* Bewegen: Schalter, Segment, Tab-Markierung, Aufklappen */
  --ease-sidebar: cubic-bezier(0.67, 0.005, 0.29, 1); /* Sidebar ein- und ausklappen */
  --duration-hover: 100ms;
  --duration-control: 150ms;
  --duration-move: 200ms;
  --duration-sidebar: 350ms;
}

.dark {
  color-scheme: dark;

  --app: var(--gray-925);
  --background: var(--gray-950);
  --card: var(--gray-900);
  --popover: var(--gray-900);
  --overlay: rgb(0 0 0 / 0.5);
  --tooltip: var(--gray-800);
  --composer: rgb(38 39 43 / 0.85);
  --input: rgb(255 255 255 / 0.03);

  --foreground: var(--gray-50);
  --foreground-soft: var(--gray-100);
  --nav-foreground: var(--gray-200);
  --muted-foreground: rgb(245 244 242 / 0.6);
  --subtle-foreground: var(--gray-400);
  --placeholder: var(--gray-500);
  --nav-icon: var(--gray-400);

  --border: rgb(255 255 255 / 0.1);
  --border-soft: rgb(255 255 255 / 0.1);
  --border-strong: var(--gray-800);

  --control: var(--gray-850);
  --control-hover: var(--gray-800);

  --hover: rgb(255 255 255 / 0.05);
  --selected: rgb(255 255 255 / 0.11);
  --pressed: rgb(255 255 255 / 0.11);
  --tab-selected: var(--gray-850);
  --segment-track: var(--gray-900);

  --primary: var(--indigo-600);
  --primary-hover: var(--indigo-500);
  --primary-text: var(--indigo-300);
  --primary-soft: rgb(99 102 241 / 0.15);
  --ring: var(--indigo-400);
  --ring-halo: rgb(129 140 248 / 0.25);

  --danger: #f87171;
  --danger-soft: rgb(248 113 113 / 0.12);
  --warning: #fbbf24;
  --warning-soft: rgb(251 191 36 / 0.12);
  --success: #4ade80;
  --success-soft: rgb(74 222 128 / 0.12);

  --shadow-ring-xs: 0 0 0 1px #ffffff17;
  --shadow-ring-sm: 0 0 0 1px #ffffff1c;
  --shadow-ring-md: 0 0 0 1px #ffffff24;
  --shadow-lg: 0 12px 32px -4px rgb(0 0 0 / 0.55);
  --shadow-button:
    inset 0 0 0 1px rgb(255 255 255 / 0.1), inset 0 1px 0 rgb(255 255 255 / 0.03), inset 0 -1px 1px rgb(0 0 0 / 0.1);
}

/* Größere Darstellung: gleiche Proportionen, rund 15 % größer */
[data-size="large"] {
  --text-xs: 13.5px;
  --text-xs--line-height: 18px;
  --text-s: 15px;
  --text-s--line-height: 22px;
  --text-nav: 15.5px;
  --text-nav--line-height: 22px;
  --text-sm: 16px;
  --text-sm--line-height: 24px;
  --text-base: 18px;
  --text-base--line-height: 28px;
  --text-xl: 23px;
  --text-xl--line-height: 30px;
  --text-3xl: 34px;
  --text-3xl--line-height: 40px;
  --sidebar-width: 272px;
  --nav-item-h: 36px;
  --control-h: 40px;
  --control-h-sm: 34px;
  --tab-h: 40px;
  --icon: 20px;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-hover: 0ms;
    --duration-control: 0ms;
    --duration-move: 0ms;
    --duration-sidebar: 0ms;
  }
}
