:root {
  --bg: #efece6;
  --sidebar: #f7f5f1;
  --topbar: #f4f1ec;
  --ink: #2f2d2a;
  --line: #d8d3c8;
  --dash: #e3dfd6;
  --muted: #8a857c;
  --faint: #a39d92;
  --card: #fff;
  --cream: #fbf6ec;
  --accent: #4f46e5;
  --accent-tint: #eceafd;
  --green: #0e7c5a;
  --green-tint: #e6efe6;
  --amber: #b4801f;
  --amber-deep: #a3852f;
  --amber-tint: #fbf0d8;
  --red: #b4451f;
  --red-tint: #fde7e0;
  --shadow: 3px 3px 0 rgba(47, 45, 42, .1);
  --shadow-bold: 3px 3px 0 rgba(47, 45, 42, .15);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Public Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfc9bd; border-radius: 6px; }
a { color: inherit; }

.serif { font-family: 'Newsreader', Georgia, serif; }
.hand { font-family: 'Kalam', cursive; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

/* ---------- layout ---------- */
.app { display: flex; height: 100vh; width: 100%; overflow: hidden; }

.sidebar {
  width: 258px; flex: none; background: var(--sidebar);
  border-right: 2px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 16px; cursor: pointer; }
.brand .logo {
  width: 36px; height: 36px; flex: none; border: 2px solid var(--ink); border-radius: 9px;
  background: #fff; display: flex; align-items: center; justify-content: center;
  font-family: 'Newsreader', Georgia, serif; font-size: 18px; box-shadow: 2px 2px 0 rgba(47, 45, 42, .15);
}
.brand .name { font-family: 'Newsreader', Georgia, serif; font-size: 19px; line-height: 1; }
.brand .tag { font-size: 11px; color: var(--muted); letter-spacing: .04em; }

.station-badge { border: 2px solid var(--line); border-radius: 10px; background: #fff; padding: 11px 12px; margin-bottom: 16px; }
.station-badge .row { display: flex; justify-content: space-between; align-items: baseline; }
.station-badge .label { font-weight: 700; font-size: 14px; }
.station-badge .week { font-size: 11px; color: var(--muted); }
.station-badge .track { height: 7px; border-radius: 4px; background: #e7e3da; margin-top: 8px; overflow: hidden; }
.station-badge .fill { height: 100%; background: var(--accent); border-radius: 4px; }

.nav { flex: 1; overflow: auto; }
.nav-label { font-size: 10.5px; letter-spacing: .12em; color: var(--faint); font-weight: 700; margin: 14px 8px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 8px; cursor: pointer;
  font-size: 14px; margin-bottom: 2px; border: 2px solid transparent; color: #4a463f; font-weight: 500;
  transition: background .12s;
}
.nav-item:hover { background: #fff; }
.nav-item .dot { width: 14px; height: 14px; border: 2px solid #9a948a; border-radius: 4px; flex: none; }
.nav-item.active {
  border-color: var(--accent); background: #fff; color: var(--accent); font-weight: 700;
  box-shadow: 2px 2px 0 color-mix(in srgb, var(--accent) 18%, transparent);
}
.nav-item.active .dot { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); }

.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 12px 6px 2px; border-top: 2px dashed var(--line); margin-top: 8px; }
.sidebar-user .name { font-size: 13px; font-weight: 600; }
.sidebar-user .sub { font-size: 11px; color: var(--muted); }
.sidebar-user .gear { font-size: 18px; color: var(--faint); cursor: pointer; margin-left: auto; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%; border: 2px solid #b8b4ab; flex: none;
  background: repeating-linear-gradient(45deg, #f1eee8, #f1eee8 5px, #e7e3da 5px, #e7e3da 10px);
}
.avatar.sm { width: 32px; height: 32px; }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar {
  flex: none; display: flex; align-items: center; gap: 18px; padding: 18px 32px;
  border-bottom: 2px solid var(--line); background: var(--topbar);
}
.topbar .titles { flex: 1; min-width: 0; }
.topbar h1 { font-family: 'Newsreader', Georgia, serif; font-size: 27px; margin: 0; line-height: 1.05; }
.topbar .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.search {
  display: flex; align-items: center; gap: 9px; border: 2px solid var(--line); border-radius: 9px;
  background: #fff; padding: 8px 12px; width: 240px; color: var(--faint); font-size: 13px;
}
.content { flex: 1; overflow: auto; padding: 26px 32px; }

/* ---------- cards & components ---------- */
.card { background: var(--card); border: 2px solid var(--ink); border-radius: 12px; padding: 18px; box-shadow: var(--shadow); }
.card.cream { background: var(--cream); }
.card.indigo { background: var(--accent-tint); }
.card.green { background: var(--green-tint); }
.card-title { font-family: 'Newsreader', Georgia, serif; font-size: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-head .meta { font-size: 12px; color: var(--muted); }

.grid { display: grid; gap: 18px; }

.badge { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 4px 7px; white-space: nowrap; }
.badge.hoch { background: var(--red-tint); color: var(--red); }
.badge.mittel { background: var(--amber-tint); color: #9a6b12; }
.badge.niedrig { background: var(--green-tint); color: #3a6b3a; }

.pill { font-size: 13px; border: 1.5px solid var(--line); border-radius: 999px; padding: 7px 15px; color: #6a655c; cursor: pointer; user-select: none; }
.pill.active { font-weight: 700; border: 2px solid var(--accent); color: var(--accent); background: var(--accent-tint); }

.chip { font-size: 12px; border: 1.5px solid var(--line); border-radius: 6px; padding: 4px 9px; display: inline-block; }
.chip.accent { border-color: var(--accent); color: var(--accent); font-weight: 600; cursor: pointer; }
.chip.dashed { border-style: dashed; cursor: pointer; }

.progress { height: 9px; background: #e7e3da; border-radius: 5px; overflow: hidden; }
.progress .bar { height: 100%; background: var(--accent); }
.progress .bar.green { background: var(--green); }
.progress .bar.amber { background: var(--amber); }
.progress .bar.red { background: var(--red); }

.check { width: 17px; height: 17px; flex: none; border: 2px solid #b8b4ab; border-radius: 5px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 11px; }
.check.done { border-color: var(--accent); background: var(--accent); color: #fff; }
.todo-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.todo-row .label.done { color: var(--muted); text-decoration: line-through; }

.dashed { border: 1.5px dashed var(--line); border-radius: 8px; }
.divider-dashed { border-bottom: 1.5px dashed var(--dash); }

.btn { border: 2px solid var(--ink); border-radius: 8px; padding: 9px 16px; font-size: 14px; font-weight: 600; background: #fff; cursor: pointer; font-family: inherit; }
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn-primary:disabled { opacity: .55; cursor: default; }
.btn-block { width: 100%; }

.note { font-family: 'Kalam', cursive; color: var(--accent); font-size: 14px; transform: rotate(-1deg); }

.skel { height: 9px; background: #e2ded5; border-radius: 5px; margin: 7px 0; }

.doc-thumb { width: 30px; height: 38px; flex: none; border: 2px solid #b8b4ab; border-radius: 4px;
  background: repeating-linear-gradient(45deg, #f1eee8, #f1eee8 4px, #e7e3da 4px, #e7e3da 8px); }

/* ---------- chat ---------- */
.chat-wrap { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; height: 100%; }
.bubble { max-width: 80%; border-radius: 14px; padding: 13px 16px; font-size: 14px; line-height: 1.5; }
.bubble.user { align-self: flex-end; background: var(--accent-tint); border: 2px solid var(--accent); border-radius: 14px 14px 4px 14px; }
.bubble.bot { align-self: flex-start; background: #fff; border: 2px solid var(--ink); border-radius: 14px 14px 14px 4px; box-shadow: var(--shadow); }
.bubble .role { font-family: 'Newsreader', Georgia, serif; font-size: 15px; margin-bottom: 8px; color: var(--accent); }
.bubble p { margin: 0 0 9px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 6px 0 9px; padding-left: 22px; }
.bubble li { margin: 3px 0; }
.bubble h3, .bubble h4, .bubble h5, .bubble h6 { font-family: 'Newsreader', Georgia, serif; margin: 12px 0 6px; line-height: 1.2; }
.bubble h3 { font-size: 18px; } .bubble h4 { font-size: 16px; } .bubble h5, .bubble h6 { font-size: 14px; }
.bubble code { background: #f1eee8; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-size: 12.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.bubble pre { background: #f4f1ea; border: 1.5px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 9px 0; }
.bubble pre code { background: none; border: none; padding: 0; }
.bubble blockquote { border-left: 3px solid var(--accent); margin: 9px 0; padding: 2px 0 2px 12px; color: #5a564e; }
.bubble a { color: var(--accent); text-decoration: underline; }
.bubble hr { border: none; border-top: 1.5px dashed var(--line); margin: 12px 0; }
.bubble strong { font-weight: 700; }
.bubble > :first-child { margin-top: 0; }
.chat-stream { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 16px; padding-right: 4px; }
.composer { display: flex; gap: 10px; align-items: flex-end; border: 2px solid var(--ink); border-radius: 12px; background: #fff; padding: 10px 12px; }
.composer textarea { flex: 1; border: none; outline: none; resize: none; font-family: inherit; font-size: 14px; background: transparent; max-height: 160px; }

/* ---------- generic helpers ---------- */
.row { display: flex; }
.between { display: flex; justify-content: space-between; align-items: center; }
.kv { display: flex; gap: 9px; padding: 4px 0; }
.kv .k { font-size: 12px; font-weight: 700; width: 120px; flex: none; }
.kv .v { font-size: 13px; color: #6a655c; }
.stack { display: flex; flex-direction: column; }
.wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.banner-quote {
  display: flex; gap: 16px; align-items: center; border: 2px solid var(--ink); border-radius: 12px;
  background: var(--cream); padding: 16px 20px; box-shadow: var(--shadow-bold); margin-bottom: 22px;
}
.banner-quote .mark {
  width: 44px; height: 44px; flex: none; border: 2px solid var(--ink); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-family: 'Newsreader', serif; font-size: 22px; background: #fff;
}
.eyebrow { font-size: 11px; letter-spacing: .1em; font-weight: 700; color: var(--amber-deep); }

.toast { position: fixed; bottom: 22px; right: 22px; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow-bold); z-index: 50; max-width: 360px; }
.toast.err { background: var(--red); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }
.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }

.modal-back { position: fixed; inset: 0; background: rgba(47,45,42,.4); display: flex; align-items: center; justify-content: center; z-index: 40; }
.modal { background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 24px; width: 420px; max-width: 92vw; box-shadow: var(--shadow-bold); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.field input, .field select { width: 100%; border: 2px solid var(--line); border-radius: 8px; padding: 9px 11px; font-family: inherit; font-size: 14px; }

@media (max-width: 920px) {
  .sidebar { width: 64px; padding: 14px 8px; }
  .brand .name, .brand .tag, .station-badge, .nav-label, .nav-item span:not(.dot), .sidebar-user .name, .sidebar-user .sub { display: none; }
  .content { padding: 18px; }
}
