/* ═══════════════════════════════════════════════════════════
   Midnight Milk Club — Design-System
   Semantische Grundlage · Karmin · Creme · Türkis
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Abenddämmerungs-Violett (Login-Hintergrund) */
  --ink:        #2E2554;
  --ink-soft:   #3A2F66;
  --ink-card:   #443878;
  --ink-line:   rgba(255, 255, 255, 0.14);
  --ink-text:   #FDFBFF;
  --ink-muted:  rgba(253, 251, 255, 0.66);

  /* Tag */
  --paper:      #FBF9FF;
  --surface:    #FFFFFF;
  --cream:      #FFF7E0;
  --line:       #EAE4F7;
  --text:       #3B3361;
  --muted:      #6E6789;

  /* Marke — Pastell-Pop (entschärft, weniger knallig) */
  --violet:       #9B82EE;
  --violet-deep:  #7E66C9;
  --violet-soft:  #F1ECFE;
  --lavender:     #D8CDFC;
  --pink:         #F3AED1;
  --pink-soft:    #FDE7F3;
  --grad:         linear-gradient(135deg, #C7B9FB, #FBD0E6);
  --grad-head:    linear-gradient(135deg, #D6CBFB 0%, #F7D4EB 70%, #FCE7C7 115%);
  /* Pastell-Gelb (Sterne, Diagramm-Akzente) */
  --gold:         #F8D98A;
  --gold-deep:    #C99A2E;
  --gold-soft:    #FEF5DC;

  /* Semantik */
  --green:      #3BA57E;
  --green-soft: #E8F7F0;
  --amber:      #C2810F;
  --amber-soft: #FCF3DE;
  --red:        #EE6A6A;
  --red-soft:   #FDEDED;
  --night:      #7B84DE;
  --night-soft: #EFF1FC;
  --day:        #ECB54E;
  --day-soft:   #FDF5E2;
  --rose:       #E58BB1;

  /* Form — runder & weicher */
  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(155, 130, 238, 0.05), 0 4px 14px rgba(155, 130, 238, 0.07);
  --shadow-md: 0 4px 10px rgba(155, 130, 238, 0.07), 0 14px 34px rgba(155, 130, 238, 0.12);
  --shadow-lg: 0 8px 20px rgba(155, 130, 238, 0.13), 0 28px 64px rgba(155, 130, 238, 0.18);

  /* Schrift — rund & kräftig */
  --serif: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --sans:  'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, 'Cascadia Mono', monospace;
}

/* ── Dunkelmodus ── */
html[data-theme="dark"] {
  --paper:      #1E1A33;
  --surface:    #2A2447;
  --cream:      #352B50;
  --line:       rgba(255, 255, 255, 0.10);
  --text:       #F4F1FC;
  --muted:      #ADA6C9;

  --violet-soft: rgba(155, 130, 238, 0.18);
  --pink-soft:   rgba(243, 174, 209, 0.16);
  --gold-soft:   rgba(248, 217, 138, 0.16);
  --green-soft:  rgba(59, 165, 126, 0.18);
  --amber-soft:  rgba(194, 129, 15, 0.18);
  --red-soft:    rgba(238, 106, 106, 0.18);
  --night-soft:  rgba(123, 132, 222, 0.18);
  --day-soft:    rgba(236, 181, 78, 0.18);

  --amber:     #E0A83D;
  --gold-deep: #F0C25C;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.20), 0 4px 14px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.22), 0 14px 34px rgba(0, 0, 0, 0.30);
  --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.28), 0 28px 64px rgba(0, 0, 0, 0.38);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: 'ss01' on;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font-family: inherit; }

::selection { background: rgba(91, 79, 232, 0.18); }

/* ── Typografie ── */
.display {
  font-family: var(--serif);
  font-weight: 480;
  letter-spacing: -0.015em;
  line-height: 1.08;
}
.display em, .h-serif em {
  font-style: italic;
  font-weight: 430;
  color: var(--violet);
}
.h-serif {
  font-family: var(--serif);
  font-weight: 520;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-deep);
}
.eyebrow::before {
  content: '';
  width: 22px; height: 1px;
  background: var(--gold);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 99px;
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease, filter 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.975); }

.btn-primary { background: var(--grad); color: #3B2A66; font-weight: 800; box-shadow: 0 8px 20px rgba(199, 185, 251, 0.45); }
.btn-primary:hover { filter: brightness(1.04); box-shadow: 0 10px 26px rgba(199, 185, 251, 0.55); transform: translateY(-1px); }

.btn-ink { background: var(--ink); color: var(--ink-text); }
.btn-ink:hover { background: var(--ink-soft); transform: translateY(-1px); }

.btn-cream { background: var(--ink-text); color: var(--ink); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); }
.btn-cream:hover { background: #fff; transform: translateY(-1px); }

.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }

.btn-outline-dark { background: transparent; color: var(--ink-text); border: 1px solid var(--ink-line); }
.btn-outline-dark:hover { border-color: var(--lavender); color: var(--lavender); }

.btn-ghost { background: transparent; color: var(--muted); border: none; }
.btn-ghost:hover { color: var(--red); }

.btn-danger-soft { background: var(--red-soft); color: var(--red); border: 1px solid rgba(214, 69, 69, 0.25); }
.btn-danger-soft:hover { background: #F9DCDA; }

.btn-sm { padding: 8px 16px; font-size: 0.82rem; }
.btn-xs { padding: 5px 11px; font-size: 0.75rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; pointer-events: none; }

/* ── Formulare ── */
label {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 6px;
}
label .opt { font-weight: 450; opacity: 0.75; }

input, select, textarea {
  width: 100%;
  padding: 12px 15px;
  background: var(--violet-soft);
  border: 1.5px solid transparent;
  border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  color-scheme: dark;
}
input::placeholder, textarea::placeholder { color: #B6A9DC; font-weight: 400; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--violet);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.14);
}
input[type="checkbox"] {
  width: 17px; height: 17px;
  accent-color: var(--violet);
  cursor: pointer;
  appearance: auto;
  -webkit-appearance: auto;
  padding: 0;
  background: none;
  border: none;
}
textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23716C87' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

/* ── Karten ── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px 24px;
  box-shadow: var(--shadow-md);
}
.card-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-primary);
  margin-bottom: 16px;
}
.card-label svg { width: 17px; height: 17px; flex-shrink: 0; color: var(--violet); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  border-radius: 99px;
  white-space: nowrap;
}
.badge-violet { background: var(--violet-soft); color: var(--color-primary); }
.badge-gold   { background: var(--gold-soft);   color: var(--gold-deep); }
.badge-green  { background: var(--green-soft);  color: var(--green); }
.badge-amber  { background: var(--amber-soft);  color: var(--amber); }
.badge-red    { background: var(--red-soft);    color: var(--red); }
.badge-night  { background: var(--night-soft);  color: var(--night); }
.badge-day    { background: var(--day-soft);    color: var(--amber); }

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: var(--ink-text);
  padding: 12px 24px;
  border-radius: 99px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
  border: 1px solid var(--ink-line);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Utility ── */
.text-center { text-align: center; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

/* ── Theme-Toggle ── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}
.theme-toggle:hover { border-color: var(--color-primary); color: var(--color-primary); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ── Scrollbar (dezent) ── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #D4CFC2; border-radius: 99px; border: 2px solid var(--paper); }
::-webkit-scrollbar-track { background: transparent; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-color: var(--paper); }

/* ── Dunkelmodus: hartkodierte Rahmenfarben ── */
html[data-theme="dark"] .alert-warn { border-color: rgba(255, 255, 255, 0.10); }
html[data-theme="dark"] .alert-info { border-color: rgba(255, 255, 255, 0.10); }

/* ── Reduzierte Bewegung ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 2px;
}

/* ── MMC Editorial · neutrale semantische Grundlage ── */
:root {
  --color-surface-canvas: var(--paper); --color-surface-panel: var(--surface); --color-surface-subtle: #FBF1E8;
  --color-text-primary: var(--text); --color-text-secondary: #6E6789; --color-text-on-primary: #FFFFFF;
  --color-border-default: var(--line); --color-border-strong: #8A819C; --color-primary: #A62D4A; --color-primary-hover: #81223A; --color-primary-soft: #F8E5EA;
  --color-status-success: #247A5B; --color-status-success-soft: #E4F4EC; --color-status-warning: #8A5A00; --color-status-warning-soft: #FAEFD4;
  --color-status-danger: #8F3027; --color-status-danger-soft: #F8E9E5; --color-status-info: #4456A6; --color-status-info-soft: #E9ECFA;
  --color-focus: #006D77; --focus-ring: 0 0 0 3px rgba(0,109,119,.28); --chart-grid:#D8D1C7; --chart-text:#554E68; --chart-series-primary:#A62D4A; --chart-series-accent:#007C83;
  --font-editorial: ui-serif, Georgia, Cambria, "Times New Roman", serif; --font-ui: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; --font-data: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --text-xs: .75rem; --text-sm: .875rem; --text-md: 1rem; --text-lg: 1.125rem; --text-xl: 1.375rem; --text-2xl: clamp(1.75rem,4vw,2.5rem);
  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem; --space-5: 1.5rem; --space-6: 2rem; --space-7: 3rem; --space-8: 4rem;
  --radius-control: .625rem; --radius-panel: 1rem; --shell-max: 80rem; --shell-gutter: clamp(.75rem,3vw,1.5rem);
  --sans: var(--font-ui); --serif: var(--font-ui); --mono: var(--font-data);
  --violet:var(--color-primary); --violet-deep:var(--color-primary-hover); --violet-soft:var(--color-primary-soft); --red:var(--color-status-danger); --red-soft:var(--color-status-danger-soft); --ink:#30262B; --ink-soft:#44353C;
}
html[data-theme="dark"] { --color-text-secondary:#C5BEDB; --color-border-strong:#77708F; --color-primary:#FF9BB4; --color-primary-hover:#FFB5C7; --color-primary-soft:rgba(255,155,180,.16); --color-text-on-primary:#211A38; --color-focus:#72D4D4; --focus-ring:0 0 0 3px rgba(114,212,212,.32); --color-status-success:#8ED8B8; --color-status-success-soft:#173D31; --color-status-warning:#F4CE78; --color-status-warning-soft:#493710; --color-status-danger:#FFB0A6; --color-status-danger-soft:#4B211E; --color-status-info:#B9C7FF; --color-status-info-soft:#252F59; --chart-grid:#514A66; --chart-text:#E4DEEF; --chart-series-primary:#FF9BB4; --chart-series-accent:#72D4D4; --violet:var(--color-primary); --violet-deep:var(--color-primary-hover); --violet-soft:var(--color-primary-soft); --red:var(--color-status-danger); --red-soft:var(--color-status-danger-soft); --ink:#191719; --ink-soft:#292329; }
html[data-theme="dark"] { --color-surface-subtle:#33282D; }
:where(button,a,input,select,textarea,[tabindex]):focus-visible { outline:3px solid var(--color-focus); outline-offset:3px; box-shadow:var(--focus-ring); }
.sr-only { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important; }
.theme-toggle[data-theme-mode="system"] { border-style:dashed; }
.btn { min-height:2.75rem; padding-inline:var(--space-3); border-radius:var(--radius-control); }
.btn-primary { background:var(--color-primary); color:var(--color-text-on-primary); box-shadow:var(--shadow-sm); }
.btn-primary:hover { background:var(--color-primary-hover); filter:none; }
.btn:disabled,.btn[aria-disabled="true"] { cursor:not-allowed; opacity:.58; }
input,select,textarea { min-height:2.75rem; background:var(--color-surface-panel); color:var(--color-text-primary); border:1px solid var(--color-border-strong); border-radius:var(--radius-control); }
input:focus,select:focus,textarea:focus { border-color:var(--color-focus); box-shadow:var(--focus-ring); }
.card,.panel { background:var(--color-surface-panel); border:1px solid var(--color-border-default); border-radius:var(--radius-panel); }
.alert { border-radius:var(--radius-control); border:1px solid var(--color-border-default); }
.alert-info { color:var(--color-status-info); background:var(--color-status-info-soft); }.alert-warn { color:var(--color-status-warning); background:var(--color-status-warning-soft); }.alert-error,.gate-error { color:var(--color-status-danger); background:var(--color-status-danger-soft); }.alert-success { color:var(--color-status-success); background:var(--color-status-success-soft); }
.loading,.empty,.error-state,.success-state { color:var(--color-text-secondary); }
.shell,.app-main,.admin-container { width:min(100%,var(--shell-max)); margin-inline:auto; padding-inline:var(--shell-gutter); }
@media (max-width:20rem) { .btn{max-width:100%;white-space:normal}.card,.panel{border-radius:var(--radius-control)}.shell,.app-main,.admin-container{padding-inline:var(--space-3)} }
@media (forced-colors:active) { :where(button,a,input,select,textarea,[tabindex]):focus-visible{outline:3px solid Highlight} }
