:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #1c2333;
  --muted: #6b7280;
  --accent: #0ea5e9;
  --accent-dark: #0284c7;
  --line: #e2e8f0;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
}
* { box-sizing: border-box; }
.hidden { display: none !important; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
button.small { padding: 5px 12px; font-size: 12.5px; }
.pending-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.pp-title { font-weight: 600; font-size: 14px; }
.pp-preview { color: var(--muted); font-size: 12.5px; margin: 4px 0 8px; }
.pp-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pp-row select { flex: 1; min-width: 200px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.pp-new { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.pp-new input { flex: 1; min-width: 140px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
#manual-form label { display: block; font-size: 12.5px; color: var(--muted); margin: 8px 0 3px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 26px; }
h1 { font-size: 20px; margin: 0; }
h1 .year { color: var(--accent); }
.status { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: var(--line); color: var(--muted);
}
.pill.ok { background: #dcfce7; color: var(--ok); }
.pill.bad { background: #fee2e2; color: var(--danger); }
.pill.warn { background: #fef3c7; color: var(--warn); }
main {
  max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px;
  display: grid; gap: 16px;
}
.view-tabs {
  display: flex; gap: 8px; border-bottom: 2px solid var(--line);
  padding-bottom: 10px; flex-wrap: wrap;
}
.vt {
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  padding: 8px 18px; border-radius: 10px; cursor: pointer; font-size: 14px;
}
.vt.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.view { display: none; }
.view.active { display: grid; gap: 16px; }
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 18px;
}
h2 { font-size: 15px; margin: 0 0 12px; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab {
  border: 1px solid var(--line); background: var(--panel); padding: 6px 14px;
  border-radius: 999px; cursor: pointer; font-size: 13px; color: var(--muted);
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tabform { display: none; gap: 8px; flex-wrap: wrap; }
.tabform.active { display: flex; }
textarea, input[type="text"], input[type="url"] {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; font-family: inherit;
}
textarea { resize: vertical; }
.tabform textarea, .tabform input { flex: 1 1 100%; }
.ingest-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ingest-row input[type="file"] { flex: 1; min-width: 200px; padding: 6px; }
.websearch-details { margin-top: 14px; }
.websearch-details summary { cursor: pointer; font-size: 13px; color: var(--accent-dark); margin-bottom: 8px; }
button {
  background: var(--accent); color: #fff; border: 0; padding: 9px 18px;
  border-radius: 8px; font-size: 14px; cursor: pointer;
}
button:hover { background: var(--accent-dark); }
button.danger { background: var(--danger); }
.msg { margin-top: 10px; font-size: 13px; display: none; }
.msg.ok { display: block; color: var(--ok); }
.msg.err { display: block; color: var(--danger); }

.chat-result, .search-result { margin-top: 12px; font-size: 14px; }
.chat-answer {
  background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 10px;
  padding: 12px 14px; white-space: pre-wrap;
}
.sources { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.source-chip {
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px;
  padding: 4px 10px; font-size: 12px; cursor: pointer; color: var(--accent-dark);
}
.search-hit { border-bottom: 1px solid var(--line); padding: 8px 0; font-size: 13px; }
.search-hit b { cursor: pointer; color: var(--accent-dark); }

.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px;
  width: 2px; background: var(--line);
}
.empty { color: var(--muted); font-size: 14px; }
.month-group { margin-bottom: 18px; }
.month-label {
  font-size: 13px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; margin: 0 0 8px;
  position: relative;
}
.month-label::before {
  content: ""; position: absolute; left: -19px; top: 6px; width: 9px; height: 9px;
  background: var(--accent); border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--accent);
}
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer;
  transition: box-shadow .12s, border-color .12s;
}
.card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.08); border-color: var(--accent); }
.card .date { font-size: 12px; color: var(--accent-dark); font-weight: 600; }
.card .cpreis { font-size: 12px; font-weight: 700; color: var(--ok); margin: 2px 0; }
.card .ctitle { font-size: 14px; font-weight: 600; margin: 2px 0; }
.card .csnip { font-size: 13px; color: var(--muted); }
.card .csrc { font-size: 11px; color: var(--muted); margin-top: 4px; }

.modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex;
  align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal.hidden { display: none; }
.modal-box {
  background: #fff; border-radius: 14px; max-width: 720px; width: 100%;
  max-height: 86vh; overflow-y: auto; padding: 22px; position: relative;
}
.modal-close { position: absolute; top: 12px; right: 12px; background: var(--line);
  color: var(--ink); padding: 4px 10px; border-radius: 8px; }
.m-meta { font-size: 12px; color: var(--muted); margin: 6px 0 10px; }
.m-summary { font-size: 14px; }
.m-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.m-tags span { background: #f1f5f9; border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.m-raw {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; font-size: 12.5px; white-space: pre-wrap; max-height: 240px;
  overflow-y: auto;
}
.m-actions { margin-top: 14px; display: flex; justify-content: flex-end; }
.web-results { margin-top: 12px; }
.web-item {
  display: block; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; margin-bottom: 6px; font-size: 13px; cursor: pointer;
}
.wi-title { font-weight: 600; }
.wi-url { color: var(--accent-dark); font-size: 11px; word-break: break-all; }
.wi-c { color: var(--muted); font-size: 12px; }
.web-ingest { margin-top: 10px; }
.liste { display: flex; flex-direction: column; gap: 8px; }
.liste-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.li-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.li-time { color: var(--accent-dark); font-weight: 700; white-space: nowrap; font-size: 12px; }
.li-title { font-weight: 600; }
.li-events { color: var(--muted); font-size: 11px; margin-left: auto; white-space: nowrap; }
.li-sum { color: var(--muted); margin-top: 4px; }
.li-src { font-size: 11px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.li-src a { color: var(--accent-dark); }
.li-orig { font-size: 12px; color: var(--accent-dark); margin-top: 4px; font-weight: 600; }
.liste-item { cursor: pointer; }
.liste-item:hover { border-color: var(--accent); }
.orig-img { max-width: 100%; border-radius: 10px; margin: 10px 0; border: 1px solid var(--line); }
.orig-link { font-size: 13px; margin: 8px 0; }
.orig-link a { color: var(--accent-dark); word-break: break-all; }
.cactions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.cactions button { font-size: 11.5px; padding: 3px 8px; }
.cform { margin-top: 4px; }
.cform-inner { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); background: var(--bg); border: 1px dashed var(--line); border-radius: 8px; padding: 6px 8px; }
.cform-inner input[type=date], .cform-inner select { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px; background: var(--panel); }
.csubtree { margin-left: 16px; border-left: 2px dashed var(--line); padding-left: 10px; margin-top: 4px; }
.clink { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.ca-kids { font-weight: 600; }
.corig { font-size: 12px; color: var(--accent-dark); margin-top: 6px; font-weight: 600; cursor: pointer; }
.corig:hover { text-decoration: underline; }
.corig-btn { margin: 6px 0 4px; }
#m-orig-slot { margin-bottom: 4px; }
.m-origimg img { display: block; max-width: 240px; max-height: 160px; border-radius: 8px; border: 1px solid var(--line); margin: 6px 0; object-fit: cover; }
.m-origimg:hover img { border-color: var(--accent); }
.reset-img { display: block; max-width: 100%; border-radius: 10px; border: 1px solid var(--line); margin: 10px 0; }
#reset-captcha { width: 100%; padding: 9px 10px; font-size: 14px; border: 1px solid var(--line); border-radius: 8px; }
#reset-modal .m-actions { margin-top: 10px; }
#login-form { display: flex; gap: 8px; margin-top: 10px; }
#login-form input { flex: 1; padding: 9px 10px; font-size: 14px; border: 1px solid var(--line); border-radius: 8px; }
#login-modal .modal-box { max-width: 360px; }
.muted { color: var(--muted); font-weight: 400; font-size: 13px; }
@media (max-width: 640px) { header { flex-direction: column; gap: 8px; } }
