/* ============================================================
   MonkeySuite – Design-System
   Gemeinsame Tokens, Reset und Basis-Komponenten für Landing,
   Dashboard und Admin.
   ============================================================ */

:root {
  /* Flächen */
  --bg:            #070b18;
  --bg-soft:       #0c1226;
  --surface:       #111a33;
  --surface-2:     #16203d;
  --surface-3:     #1c2848;
  --line:          rgba(148, 163, 184, 0.16);
  --line-strong:   rgba(148, 163, 184, 0.3);

  /* Text */
  --ink:           #eef2ff;
  --ink-soft:      #b6c2e0;
  --ink-muted:     #8494b8;
  --ink-faint:     #64749a;

  /* Akzente */
  --brand:         #6d5efc;
  --brand-2:       #22d3ee;
  --brand-3:       #f472b6;
  --brand-soft:    rgba(109, 94, 252, 0.16);
  --brand-line:    rgba(109, 94, 252, 0.45);

  --ok:            #34d399;
  --ok-soft:       rgba(52, 211, 153, 0.14);
  --warn:          #fbbf24;
  --warn-soft:     rgba(251, 191, 36, 0.14);
  --err:           #fb7185;
  --err-soft:      rgba(251, 113, 133, 0.14);
  --info:          #60a5fa;
  --info-soft:     rgba(96, 165, 250, 0.14);

  /* Formen */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-pill: 999px;

  --shadow-sm: 0 2px 8px rgba(2, 6, 23, 0.4);
  --shadow-md: 0 12px 32px rgba(2, 6, 23, 0.45);
  --shadow-lg: 0 30px 70px rgba(2, 6, 23, 0.6);
  --glow: 0 10px 40px rgba(109, 94, 252, 0.35);

  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Consolas, monospace;

  --header-h: 66px;
  --sidebar-w: 252px;
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 { margin: 0; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }

::selection { background: var(--brand-soft); color: #fff; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(148,163,184,.3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(148,163,184,.22); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,.4); background-clip: content-box; }

/* ============================ Hintergrund-Deko ============================ */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.aurora span {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  animation: float 22s ease-in-out infinite;
}
.aurora span:nth-child(1) { width: 620px; height: 620px; top: -220px; left: -120px; background: #6d5efc; }
.aurora span:nth-child(2) { width: 520px; height: 520px; top: 10%;   right: -180px; background: #22d3ee; animation-delay: -7s; }
.aurora span:nth-child(3) { width: 480px; height: 480px; bottom: -200px; left: 35%; background: #f472b6; opacity: .3; animation-delay: -14s; }
@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33%      { transform: translate3d(40px, -30px, 0) scale(1.08); }
  66%      { transform: translate3d(-30px, 25px, 0) scale(0.95); }
}
@media (prefers-reduced-motion: reduce) {
  .aurora span { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* ================================ Layout ================================= */
.wrap { width: min(1200px, calc(100% - 40px)); margin: 0 auto; }
.wrap-narrow { width: min(880px, calc(100% - 40px)); margin: 0 auto; }
.stack { display: grid; gap: 16px; }
.row-flex { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }
.hidden { display: none !important; }
.text-muted { color: var(--ink-muted); }
.text-faint { color: var(--ink-faint); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ================================= Glas ================================== */
.glass {
  background: linear-gradient(160deg, rgba(255,255,255,0.07), rgba(255,255,255,0.025));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.card {
  background: linear-gradient(160deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-tight { padding: 14px 16px; }

/* =============================== Buttons ================================= */
.btn {
  --btn-bg: rgba(255,255,255,0.06);
  --btn-fg: var(--ink);
  --btn-line: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--btn-line);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease, opacity .16s;
}
.btn:hover { background: rgba(255,255,255,0.11); border-color: var(--brand-line); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }

.btn-primary {
  --btn-bg: linear-gradient(135deg, #6d5efc, #8b5cf6 55%, #22d3ee);
  --btn-line: transparent;
  color: #fff;
  box-shadow: var(--glow);
}
.btn-primary:hover { filter: brightness(1.08); border-color: transparent; }

.btn-ghost { --btn-bg: transparent; --btn-line: transparent; color: var(--ink-soft); }
.btn-ghost:hover { --btn-bg: rgba(255,255,255,0.07); color: var(--ink); }

.btn-outline { --btn-bg: transparent; }

.btn-danger { --btn-bg: var(--err-soft); --btn-line: rgba(251,113,133,.4); color: #fecdd3; }
.btn-danger:hover { --btn-bg: rgba(251,113,133,.25); }

.btn-ok { --btn-bg: var(--ok-soft); --btn-line: rgba(52,211,153,.4); color: #bbf7d0; }
.btn-ok:hover { --btn-bg: rgba(52,211,153,.25); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: var(--r-sm); gap: 6px; }
.btn-lg { padding: 14px 26px; font-size: 16px; border-radius: var(--r-md); }
.btn-block { width: 100%; }

.btn-icon {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: rgba(255,255,255,0.05);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 14px;
  transition: all .15s;
}
.btn-icon:hover { background: rgba(255,255,255,0.12); color: var(--ink); border-color: var(--line-strong); }
.btn-icon.danger:hover { background: var(--err-soft); color: #fecdd3; border-color: rgba(251,113,133,.4); }

/* ============================== Formulare ================================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field > label, label.lbl {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}
.field small, .hint { font-size: 11.5px; color: var(--ink-faint); font-weight: 400; }

input[type="text"], input[type="password"], input[type="number"], input[type="url"],
input[type="email"], input[type="search"], input[type="date"], input[type="tel"],
select, textarea {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: rgba(8, 13, 28, 0.7);
  color: var(--ink);
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  background: rgba(8, 13, 28, 0.9);
}
textarea { resize: vertical; min-height: 76px; line-height: 1.55; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238494b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
select option { background: #111a33; color: var(--ink); }
input[type="color"] {
  width: 100%; height: 38px; padding: 3px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: rgba(8,13,28,.7); cursor: pointer;
}
input[type="range"] { accent-color: var(--brand); width: 100%; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); width: 16px; height: 16px; cursor: pointer; }

.check {
  display: inline-flex; align-items: flex-start; gap: 9px;
  font-size: 13px; color: var(--ink-soft); cursor: pointer; user-select: none;
}
.check input { margin-top: 2px; flex: none; }

.form-grid { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 640px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } }

fieldset.group {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  margin: 0;
  background: rgba(255,255,255,0.02);
}
fieldset.group > legend {
  font-size: 11.5px; font-weight: 800; letter-spacing: .09em;
  text-transform: uppercase; color: var(--brand-2); padding: 0 8px;
}

/* ================================ Badges ================================= */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-ok    { background: var(--ok-soft);   color: #6ee7b7; border-color: rgba(52,211,153,.3); }
.badge-warn  { background: var(--warn-soft); color: #fcd34d; border-color: rgba(251,191,36,.3); }
.badge-err   { background: var(--err-soft);  color: #fda4af; border-color: rgba(251,113,133,.3); }
.badge-info  { background: var(--info-soft); color: #93c5fd; border-color: rgba(96,165,250,.3); }
.badge-brand { background: var(--brand-soft); color: #c4b5fd; border-color: var(--brand-line); }
.badge-mute  { background: rgba(148,163,184,.12); color: var(--ink-muted); border-color: var(--line); }

/* ================================ Tabelle ================================ */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--line); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
table.data th {
  text-align: left; padding: 12px 14px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-muted);
  background: rgba(255,255,255,0.035);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1;
}
table.data td { padding: 12px 14px; border-bottom: 1px solid rgba(148,163,184,.08); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: rgba(255,255,255,0.03); }

/* ================================= Modal ================================= */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(3, 7, 18, 0.72);
  backdrop-filter: blur(8px);
  display: grid; place-items: center;
  padding: 20px;
  animation: fade .16s ease;
}
.overlay[hidden] { display: none; }
.modal {
  width: min(620px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  background: linear-gradient(165deg, #16203d, #0e1730);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  animation: rise .2s cubic-bezier(.2,.9,.3,1);
}
.modal-wide { width: min(920px, 100%); }
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
  background: linear-gradient(180deg, #16203d, rgba(22,32,61,.94));
  backdrop-filter: blur(8px);
  z-index: 2;
}
.modal-head h2, .modal-head h3 { font-size: 17px; margin: 0; }
.modal-body { padding: 20px 24px; display: grid; gap: 16px; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px 22px;
  flex-wrap: wrap;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

/* ================================ Drawer ================================= */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(3,7,18,.6); backdrop-filter: blur(4px); z-index: 90; display: none; }
.drawer-backdrop.open { display: block; animation: fade .16s ease; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%;
  width: min(430px, 94vw);
  background: linear-gradient(165deg, #141d38, #0a1226);
  border-left: 1px solid var(--line-strong);
  box-shadow: -20px 0 60px rgba(0,0,0,.5);
  z-index: 91;
  transform: translateX(100%);
  transition: transform .26s cubic-bezier(.3,.9,.3,1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer > header { padding: 20px 22px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.drawer > .body { padding: 20px 22px; overflow: auto; display: grid; gap: 16px; align-content: start; }

/* ================================= Toast ================================= */
#toasts {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  border-radius: var(--r-md);
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-md);
  font-size: 13.5px; font-weight: 500;
  max-width: min(520px, 92vw);
  animation: toastIn .22s cubic-bezier(.2,.9,.3,1);
  backdrop-filter: blur(12px);
}
.toast.ok   { border-color: rgba(52,211,153,.45);  background: rgba(6, 46, 34, .96); }
.toast.err  { border-color: rgba(251,113,133,.45); background: rgba(63, 12, 24, .96); }
.toast.warn { border-color: rgba(251,191,36,.45);  background: rgba(60, 39, 5, .96); }
.toast.out { opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }

/* =============================== Notizen ================================= */
.note {
  font-size: 13px; line-height: 1.6;
  color: var(--ink-soft);
  background: rgba(109, 94, 252, 0.08);
  border: 1px solid var(--brand-line);
  border-left-width: 3px;
  border-radius: var(--r-md);
  padding: 12px 15px;
}
.note.warn { background: var(--warn-soft); border-color: rgba(251,191,36,.4); }
.note.err  { background: var(--err-soft);  border-color: rgba(251,113,133,.4); }
.note.ok   { background: var(--ok-soft);   border-color: rgba(52,211,153,.4); }

/* ============================== Leerzustand ============================== */
.empty {
  display: grid; place-items: center; gap: 10px;
  padding: 56px 24px; text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  color: var(--ink-muted);
}
.empty .icon { font-size: 42px; opacity: .75; }
.empty h3 { font-size: 16px; color: var(--ink-soft); }

/* ================================ Spinner ================================ */
.spin {
  display: inline-block; width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: rot .7s linear infinite;
  flex: none;
}
@keyframes rot { to { transform: rotate(360deg); } }

.loading-block { display: grid; place-items: center; padding: 60px; color: var(--ink-muted); gap: 12px; }

/* ============================== Skeletons ================================ */
.skel {
  background: linear-gradient(90deg, rgba(255,255,255,.05), rgba(255,255,255,.11), rgba(255,255,255,.05));
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ================================ Marke ================================== */
.brand-mark {
  display: inline-flex; align-items: center; gap: 11px;
  font-weight: 800; font-size: 17px; letter-spacing: -0.02em;
}
.brand-logo {
  width: 38px; height: 38px; flex: none;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 20px;
  background: linear-gradient(135deg, #6d5efc, #8b5cf6 50%, #22d3ee);
  box-shadow: 0 8px 22px rgba(109,94,252,.45);
}
.brand-mark small {
  display: block; font-size: 10.5px; font-weight: 600;
  color: var(--ink-faint); letter-spacing: .12em; text-transform: uppercase;
}
