/* =============================================================
   Schichtly Cockpit — Design (an Schichtlys shared.css angelehnt)
   ============================================================= */
:root {
  --lime: #C8F135;
  --lime-dark: #9FC200;
  --ink: #0E0E0E;
  --ink-soft: #202020;
  --ink-muted: #6C6C6C;
  --white: #FFFFFF;
  --surface: #F5F5F0;
  --surface-strong: #ECECE4;
  --surface-card: #FFFEFB;
  --purple: #6C3FF5;
  --purple-light: #EDE8FF;
  --coral: #FF5C3A;
  --teal: #00C2A8;
  --slate: #64748B;
  --danger: #EF4444;
  --success: #10B981;
  --warning: #F59E0B;
  --border: rgba(14, 14, 14, 0.10);
  --shadow-soft: 0 18px 50px rgba(14, 14, 14, 0.08);
  --shadow-card: 0 20px 50px rgba(14, 14, 14, 0.12);
  --shadow-shell: 0 28px 90px rgba(14, 14, 14, 0.18);
  --radius: 18px;
  --radius-lg: 28px;
  --radius-pill: 999px;
}

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

body {
  font-family: 'Epilogue', 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(108, 63, 245, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(200, 241, 53, 0.18), transparent 24%),
    var(--surface);
  color: var(--ink);
  min-height: 100vh;
}

h1, h2, h3 { font-family: 'Syne', sans-serif; letter-spacing: -0.03em; line-height: 1.05; }
button, input, select, textarea { font: inherit; }
a { text-decoration: none; color: inherit; }

/* ── Login ─────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 38px 34px;
  border: 1px solid var(--border);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
}
.brand .dot {
  width: 34px; height: 34px; border-radius: 12px;
  background: var(--lime); display: grid; place-items: center;
  color: var(--ink); font-size: 1.1rem;
}
.login-card h1 { font-size: 1.6rem; margin: 22px 0 6px; }
.login-card p.sub { color: var(--ink-muted); margin-bottom: 22px; }

/* ── Formular ──────────────────────────────────────────────── */
.form-label { display: block; font-weight: 600; font-size: 0.85rem; margin: 14px 0 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  outline: none;
  transition: box-shadow .15s, border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(108, 63, 245, 0.10);
}

/* ── Buttons ───────────────────────────────────────────────── */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--radius-pill); border: 1px solid transparent;
  font-weight: 700; cursor: pointer; transition: transform .12s, box-shadow .12s, background .12s;
}
.button:active { transform: translateY(1px); }
.button-primary { background: var(--lime); color: var(--ink); }
.button-primary:hover { background: var(--lime-dark); }
.button-secondary { background: var(--white); color: var(--ink); border-color: var(--border); }
.button-ghost { background: transparent; color: var(--ink); border-color: var(--border); }
.button-block { width: 100%; }

/* ── App-Shell ─────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--ink);
  color: var(--white);
  padding: 24px 18px;
  display: flex; flex-direction: column; gap: 8px;
}
.sidebar .brand { color: var(--white); margin-bottom: 18px; padding: 0 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius);
  color: rgba(255,255,255,0.78); font-weight: 600; font-size: 0.95rem;
  cursor: pointer; transition: background .12s, color .12s;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: var(--white); }
.nav-item.active { background: var(--lime); color: var(--ink); }
.nav-item .ico { font-size: 1.1rem; width: 22px; text-align: center; }
.sidebar .spacer { flex: 1; }
.sidebar .user-box { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,0.12); }
.sidebar .user-box .email { font-size: 0.85rem; color: rgba(255,255,255,0.85); }
.sidebar .user-box .role { font-size: 0.72rem; color: var(--lime); text-transform: uppercase; letter-spacing: .08em; }

.main { padding: 32px 38px 60px; max-width: 1280px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 26px; }
.page-head h1 { font-size: 2rem; }
.page-head .muted { color: var(--ink-muted); }

/* ── Karten / KPI ──────────────────────────────────────────── */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 22px 24px;
}
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 26px; }
.kpi { position: relative; overflow: hidden; }
.kpi::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--accent, var(--lime));
}
.kpi .label { color: var(--ink-muted); font-size: 0.85rem; font-weight: 600; }
.kpi .value { font-family: 'Syne', sans-serif; font-size: 2.4rem; margin-top: 6px; }
.kpi.green { --accent: var(--success); }
.kpi.purple { --accent: var(--purple); }
.kpi.coral { --accent: var(--coral); }
.kpi.teal { --accent: var(--teal); }

.badge { display: inline-flex; padding: 4px 12px; border-radius: var(--radius-pill); font-size: 0.78rem; font-weight: 700; }
.badge-info { background: var(--purple-light); color: var(--purple); }

.error-msg { color: var(--danger); font-size: 0.9rem; margin-top: 12px; min-height: 1.2em; }
.placeholder { color: var(--ink-muted); padding: 40px; text-align: center; }

/* ── Tabellen ───────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted); padding: 10px 12px; border-bottom: 1px solid var(--border); }
td { padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-strong); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge-ok { background: rgba(16,185,129,.12); color: var(--success); }
.badge-warn { background: rgba(245,158,11,.14); color: #B45309; }
.badge-alert { background: rgba(239,68,68,.12); color: var(--danger); }
.badge-neutral { background: var(--surface-strong); color: var(--ink-muted); }

/* ── Toolbar / Filter ───────────────────────────────────────── */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }

/* ── Felder ─────────────────────────────────────────────────── */
.field { margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(14,14,14,.5); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 24px; z-index: 50;
}
.modal-box { background: var(--surface-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-shell); width: 100%; max-width: 560px; max-height: 90vh; display: flex; flex-direction: column; }
.modal-box.wide { max-width: 860px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 1.25rem; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: var(--ink-muted); }
.modal-body { padding: 22px 24px; overflow: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); }

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 120%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: var(--radius-pill);
  box-shadow: var(--shadow-card); transition: transform .25s; z-index: 60; border-left: 4px solid var(--lime);
}
.toast.show { transform: translate(-50%, 0); }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warn { border-left-color: var(--warning); }

/* ── Modul-Picker / Listen ──────────────────────────────────── */
.module-row { display: grid; grid-template-columns: 28px 1fr 130px; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.module-row .price { width: 120px; }
.item-table input { padding: 8px 10px; }
.section-title { font-family: 'Syne', sans-serif; font-size: 1.05rem; margin: 22px 0 10px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 0.9rem; }
.kv .k { color: var(--ink-muted); }
.right { text-align: right; }
.mt { margin-top: 18px; }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.button-sm { padding: 7px 13px; font-size: 0.85rem; }
.link { color: var(--purple); cursor: pointer; font-weight: 600; }

/* ── Developer-Umgebung ─────────────────────────────────────── */
.dev-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.dev-layout { display: grid; grid-template-columns: 260px 1fr; gap: 14px; align-items: start; }
.dev-tree { background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; max-height: 70vh; overflow: auto; font-size: 0.88rem; }
.tree-item { padding: 3px 6px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.tree-item:hover { background: var(--surface-strong); }
.tree-item.active { background: var(--lime); color: var(--ink); }
.tree-children { margin-left: 12px; border-left: 1px dashed var(--border); padding-left: 4px; }
.dev-main { min-width: 0; }
.editor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.editor-head .file-path { font-family: ui-monospace, monospace; font-size: 0.85rem; color: var(--ink-muted); flex: 1; }
.code-area { width: 100%; min-height: 320px; max-height: 60vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-card); }
.code-area pre { margin: 0; padding: 14px; font-size: 0.82rem; }
.code-area textarea { width: 100%; min-height: 320px; border: 0; padding: 14px; font-family: ui-monospace, monospace; font-size: 0.82rem; resize: vertical; outline: none; background: var(--surface-card); }
.dev-tabs { display: flex; gap: 6px; margin: 14px 0 8px; flex-wrap: wrap; }
.dev-tab { padding: 7px 14px; border-radius: var(--radius-pill); border: 1px solid var(--border); cursor: pointer; font-size: 0.85rem; font-weight: 600; background: var(--white); }
.dev-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.dev-panel { background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; min-height: 120px; }
.diff-line { font-family: ui-monospace, monospace; font-size: 0.8rem; white-space: pre-wrap; padding: 0 6px; }
.diff-add { background: rgba(16,185,129,.12); }
.diff-del { background: rgba(239,68,68,.12); }
.diff-meta { color: var(--ink-muted); }
.preview-frame { width: 100%; height: 60vh; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }

/* ── Claude-Code-Chat ───────────────────────────────────────── */
.chat-log { max-height: 46vh; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px; }
.chat-msg { display: flex; }
.chat-user { justify-content: flex-end; }
.chat-assistant { justify-content: flex-start; }
.chat-tool { justify-content: center; }
.chat-bubble { max-width: 78%; padding: 10px 14px; border-radius: 16px; font-size: 0.9rem; white-space: pre-wrap; word-break: break-word; line-height: 1.4; }
.chat-user .chat-bubble { background: var(--lime); color: var(--ink); border-bottom-right-radius: 4px; }
.chat-assistant .chat-bubble { background: var(--surface-strong); color: var(--ink); border-bottom-left-radius: 4px; }
.chat-bubble.streaming::after { content: '▋'; animation: blink 1s steps(2) infinite; margin-left: 2px; }
@keyframes blink { 0%,50% { opacity: 1; } 50.01%,100% { opacity: 0; } }
.chat-tool-block { background: var(--ink); color: #d6f36b; font-family: ui-monospace, monospace; font-size: 0.76rem; padding: 6px 12px; border-radius: 10px; max-width: 90%; }
.chat-compose { display: flex; gap: 8px; margin-top: 10px; align-items: flex-end; }
.chat-input { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); resize: vertical; font: inherit; outline: none; }
.chat-input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(108,63,245,0.10); }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; }
  .sidebar .spacer { display: none; }
  .main { padding: 24px 18px 48px; }
  .grid-2, .grid-3, .detail-grid { grid-template-columns: 1fr; }
  .dev-layout { grid-template-columns: 1fr; }
}

/* ── Postfach / Mail-Client ─────────────────────────────────────────────── */
.mail-list { display: flex; flex-direction: column; }
.mail-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px; border-bottom: 1px solid var(--border);
  cursor: pointer; border-radius: 10px;
}
.mail-row:hover { background: var(--surface-strong); }
.mail-row.unread .mail-from,
.mail-row.unread .mail-subject { font-weight: 700; }
.mail-dot { color: var(--purple); width: 12px; font-size: .7rem; }
.mail-meta { flex: 1; min-width: 0; }
.mail-from { font-size: .9rem; color: var(--ink); display: flex; align-items: center; gap: 4px; }
.mail-subject { font-size: .85rem; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-date { font-size: .78rem; white-space: nowrap; }
.mail-head { margin-bottom: 10px; }
.mail-head-subject { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.mail-attachments { margin: 8px 0; padding: 8px; background: var(--surface-strong); border-radius: 10px; font-size: .85rem; }
.mail-body-frame { width: 100%; min-height: 360px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.mail-body-text { white-space: pre-wrap; word-wrap: break-word; font-family: inherit; font-size: .9rem; line-height: 1.5; background: var(--surface); padding: 12px; border-radius: 10px; max-height: 460px; overflow: auto; }
