/* Notebook — dunkles, ruhiges Lese-Theme. Mobil zuerst, ab 800px feste Sidebar. */
:root {
  --bg: #0f1623;
  --bg-2: #111827;
  --panel: #161f30;
  --panel-2: #1c2840;
  --border: #243049;
  --text: #e8edf6;
  --muted: #93a1b8;
  --accent: #2cabe2;
  --accent-2: #009fe3;
  --danger: #ef4444;
  --radius: 12px;
  --topbar-h: 52px;
  --sidebar-w: 312px;
}

* { box-sizing: border-box; }
/* hidden-Attribut muss Author-CSS (z. B. .empty{display:flex}) schlagen */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

/* ---------- Login-Gate ---------- */
body:not(.authed) .app { display: none !important; }
body.authed #authGate { display: none; }
#authGate {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 24px; text-align: center;
  background: radial-gradient(120% 80% at 50% 0%, #16233a 0%, var(--bg) 60%);
}
#authGate .ag-logo { font-size: 44px; }
#authGate h1 { font-size: 26px; font-weight: 700; margin: 4px 0 0; letter-spacing: .2px; }
#authGate .ag-sub { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
#authGate .ag-hint { color: var(--danger); font-size: 12px; min-height: 16px; }

/* ---------- App-Layout ---------- */
.app { min-height: 100%; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 8px;
  padding: 0 8px; padding-top: env(safe-area-inset-top);
  background: var(--bg-2); border-bottom: 1px solid var(--border);
}
.topbar-title { font-weight: 700; flex: 1; text-align: center; }

.icon-btn {
  appearance: none; border: 1px solid transparent; background: transparent;
  color: var(--text); font-size: 20px; line-height: 1;
  width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--panel-2); }
.icon-btn:active { transform: scale(.94); }

.shell { display: block; }

/* ---------- Sidebar / Navigation ---------- */
.sidebar {
  position: fixed; z-index: 40; top: 0; left: 0; bottom: 0;
  width: min(86vw, var(--sidebar-w));
  background: var(--bg-2); border-right: 1px solid var(--border);
  transform: translateX(-104%); transition: transform .22s ease;
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top);
}
body.nav-open .sidebar { transform: translateX(0); }
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 10px; border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 16px; }
.nav { flex: 1; overflow-y: auto; padding: 8px 8px 16px; }
.sidebar-foot { padding: 10px 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }

.nav-group-title {
  color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; padding: 14px 10px 6px;
}
.nav-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: 1px solid transparent; color: var(--text);
  border-radius: 10px; padding: 9px 10px; margin: 2px 0;
}
.nav-item:hover { background: var(--panel); }
.nav-item.active { background: var(--panel-2); border-color: var(--border); }
.nav-item .ni-title { font-size: 14px; font-weight: 600; display: block; }
.nav-item .ni-date { font-size: 11px; color: var(--muted); margin-top: 2px; }
.nav-empty { color: var(--muted); font-size: 13px; padding: 18px 12px; }

.scrim {
  position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.5);
  opacity: 0; visibility: hidden; transition: opacity .2s ease;
}
body.nav-open .scrim { opacity: 1; visibility: visible; }

/* ---------- Content ---------- */
.content { padding: 18px clamp(16px, 5vw, 40px) 64px; max-width: 820px; margin: 0 auto; }
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; color: var(--muted); min-height: 50vh; text-align: center;
}
.empty-icon { font-size: 40px; opacity: .7; }

.report-head { padding: 8px 0 18px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.report-cat {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; color: var(--accent);
  background: rgba(44,171,226,.12); border: 1px solid rgba(44,171,226,.25);
  padding: 3px 9px; border-radius: 999px; margin-bottom: 10px;
}
.report-title { font-size: clamp(22px, 4vw, 30px); line-height: 1.2; margin: 0; }
.report-date { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* ---------- Markdown ---------- */
.markdown { font-size: 16px; word-wrap: break-word; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { line-height: 1.25; margin: 1.6em 0 .5em; font-weight: 700; }
.markdown h1 { font-size: 1.6em; }
.markdown h2 { font-size: 1.35em; border-bottom: 1px solid var(--border); padding-bottom: .25em; }
.markdown h3 { font-size: 1.15em; }
.markdown h4 { font-size: 1em; color: var(--muted); }
.markdown p { margin: .7em 0; }
.markdown a { color: var(--accent); text-decoration: none; }
.markdown a:hover { text-decoration: underline; }
.markdown ul, .markdown ol { margin: .6em 0; padding-left: 1.4em; }
.markdown li { margin: .25em 0; }
.markdown blockquote {
  margin: 1em 0; padding: .4em 1em; color: var(--muted);
  border-left: 3px solid var(--accent); background: var(--panel);
  border-radius: 0 8px 8px 0;
}
.markdown code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em;
  background: var(--panel-2); padding: .12em .4em; border-radius: 6px;
}
.markdown pre {
  background: #0b1220; border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; overflow-x: auto; margin: 1em 0;
}
.markdown pre code { background: transparent; padding: 0; font-size: .85em; }
.markdown hr { border: none; border-top: 1px solid var(--border); margin: 1.6em 0; }
.markdown table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: .92em; display: block; overflow-x: auto; }
.markdown th, .markdown td { border: 1px solid var(--border); padding: 7px 11px; text-align: left; }
.markdown th { background: var(--panel-2); }
.markdown img { max-width: 100%; border-radius: 8px; }
.markdown strong { font-weight: 700; }

/* ---------- Desktop: feste Sidebar ---------- */
@media (min-width: 800px) {
  .topbar { display: none; }
  .sidebar { transform: none; }
  .scrim { display: none; }
  .content { margin-left: var(--sidebar-w); }
  .content { padding-top: 32px; }
}
