/* Nous — Portal Styles
   Design system: NEUE direction (Swiss B/W minimalist)
*/

/* ── Reset & Base ─────────────────────────────────────────── */

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

:root {
  /* NEUE colour tokens */
  --bg:       #ffffff;
  --bg-sub:   #fafaf9;
  --ink:      #0a0a0a;
  --ink-2:    #3a3a36;
  --ink-3:    #6a6a64;
  --ink-4:    #a3a098;
  --line:     #d8d6cd;
  --line-2:   #ececea;
  --accent:   #c5311f;
  --selected: #f3f1ea;

  /* Layout */
  --sidebar-width: 256px;
  --header-height: 60px;
  --content-max-width: 820px;

  /* Fonts */
  /* Inter first — CDN font should take priority over local system fonts.
     Segoe UI as Windows fallback (thinner and cleaner than Arial). */
  --font-text: 'Inter', 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
  --font-serif: 'Source Serif 4', Georgia, serif;

  /* Legacy compat — keep these so any stray references don't break */
  --color-accent:      var(--accent);
  --color-accent-soft: var(--selected);
  --color-text:        var(--ink);
  --color-muted:       var(--ink-3);
  --color-border:      var(--line);
  --color-bg:          var(--bg);
  --color-bg-soft:     var(--bg-sub);
  --color-broken:      #b45309;
  --font-text-legacy:  var(--font-text);
}

html {
  font-family: var(--font-text);
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  letter-spacing: -0.005em;
  scroll-behavior: smooth;
}
body { min-height: 100vh; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; }

.mono { font-family: var(--font-mono); }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 4px; }

/* ── Shell Layout ─────────────────────────────────────────── */

.shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.shell-body {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr 0;
  flex: 1;
  min-height: 0;
}
.shell-body.preview-open {
  grid-template-columns: var(--sidebar-width) 1fr 50vw;
}

/* ── Topbar ───────────────────────────────────────────────── */

.topbar {
  display: grid;
  grid-template-columns: 1fr minmax(0, 480px) 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  height: var(--header-height);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar .brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.topbar .brand .wordmark {
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 18px;
}
.topbar .brand .crumb {
  color: var(--ink-3);
  font-size: 13px;
  letter-spacing: -0.005em;
}

.topbar .search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: var(--bg-sub);
  color: var(--ink-3);
  font-size: 13px;
  min-width: 0;
}
.topbar .search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--ink);
  font: inherit;
}
.topbar .search input::placeholder { color: var(--ink-3); }

.topbar .actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Topbar buttons */
.topbar .tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-2);
  font-size: 13px;
  transition: background .12s, color .12s;
}
.topbar .tb-btn:hover { color: var(--ink); background: var(--bg-sub); }
.topbar .tb-btn.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}
.topbar .tb-btn.primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.topbar .tb-btn .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 11px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
}
.topbar .tb-btn.primary .badge { background: var(--bg); color: var(--ink); }
.topbar .tb-btn.hidden { display: none; }

.topbar .icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  color: var(--ink-2);
  background: var(--bg);
}
.topbar .icon-btn:hover { color: var(--ink); }

/* Avatar / user button */
.topbar .avatar-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line);
  background: var(--bg);
  position: relative;
}
.topbar .avatar-btn .av {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.topbar .avatar-btn .av-name { font-size: 13px; color: var(--ink-2); }
.topbar .avatar-btn .chev { color: var(--ink-3); }

/* User menu popover */
.user-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 220px;
  background: var(--bg);
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px -16px rgba(0,0,0,0.25);
  z-index: 200;
}
.user-menu-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-2);
}
.user-menu-header .um-name { font-size: 13px; font-weight: 600; }
.user-menu-header .um-meta {
  font-size: 11px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}
.user-menu-items { padding: 6px 0; }
.user-menu-sep { border-top: 1px solid var(--line-2); margin: 6px 0; }
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  cursor: pointer;
}
.user-menu-item:hover { background: var(--bg-sub); color: var(--ink); }
.user-menu-item.danger { color: var(--accent); }
.user-menu-item svg { flex-shrink: 0; }

/* kbd shortcut badge */
.kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  color: var(--ink-3);
}

/* ── Sidebar ──────────────────────────────────────────────── */

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--bg);
  overflow-y: auto;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  padding: 10px 0 24px;
}

/* Top-level nav items (Briefing, Was ist neu, etc.) */
.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  color: var(--ink-2);
  font-size: 13px;
  position: relative;
  user-select: none;
  text-decoration: none;
  cursor: pointer;
}
.sb-item:hover { background: var(--bg-sub); color: var(--ink); }
.sb-item.active {
  background: var(--ink);
  color: var(--bg);
}
.sb-item .sb-icon { color: var(--ink-3); flex-shrink: 0; font-size: 14px; }
.sb-item.active .sb-icon { color: var(--bg); }
.sb-item .sb-label { flex: 1; }
.sb-item .sb-badge {
  font-family: var(--font-mono);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  border-radius: 9px;
}

/* Section headers (group labels like MARKTTHEMEN) */
.sb-section {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 0 20px 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  color: var(--ink-3);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.sb-section .chev {
  transition: transform .12s;
  font-size: 10px;
}
.sb-section.collapsed .chev { transform: rotate(-90deg); }

/* Sub-items (wiki pages within a section) */
.sb-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 20px 5px 36px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.35;
  text-decoration: none;
  cursor: pointer;
}
.sb-sub:hover { background: var(--bg-sub); color: var(--ink); }
.sb-sub.active { background: var(--selected); color: var(--ink); font-weight: 500; }
.sb-sub.unread { font-weight: 500; }

/* Unread indicators */
.unread-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: auto;
  flex-shrink: 0;
}
.sb-sub .unread-dot { margin-left: 4px; }
.sb-item .unread-dot {
  margin-left: auto;
  background: var(--accent);
}

/* Unread badge on Was ist neu */
.unread-badge {
  display: inline-block;
  margin-left: auto;
  padding: 0.05em 0.45em;
  background: var(--accent);
  color: #fff;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 500;
  font-family: var(--font-mono);
}

/* Admin section in sidebar */
.sb-admin-block {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.sb-admin-head {
  padding: 0 20px 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.sb-admin-head .lock {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink-4);
}

/* Sidebar divider */
.sb-divider {
  border-top: 1px solid var(--line);
  margin: 10px 0;
}

/* Backward compatibility — map old class names used by sidebar.js */
.sidebar-nav { /* wrapper, no special style needed */ }
.sidebar-list { list-style: none; padding: 0; margin: 0; }
.sidebar-list.nested { display: none; }
.sidebar-group.open > .sidebar-list.nested { display: block; }

.sidebar-link {
  /* styled as .sb-sub when nested, .sb-item at root */
}

.sidebar-list.root > li > .sidebar-link,
.sidebar-list.root > li > a.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  color: var(--ink-2);
  font-size: 13px;
  text-decoration: none;
  position: relative;
}
.sidebar-list.root > li > .sidebar-link:hover,
.sidebar-list.root > li > a.sidebar-link:hover {
  background: var(--bg-sub);
  color: var(--ink);
}
.sidebar-list.root > li > .sidebar-link.active,
.sidebar-list.root > li > a.sidebar-link.active {
  background: var(--ink);
  color: var(--bg);
}
.sidebar-list.root > li > .sidebar-link.active .bi,
.sidebar-list.root > li > a.sidebar-link.active .bi {
  color: var(--bg);
}
.sidebar-list.root > li > .sidebar-link .bi,
.sidebar-list.root > li > a.sidebar-link .bi {
  color: var(--ink-3);
  flex-shrink: 0;
  font-size: 14px;
}

/* Nested sidebar links (wiki articles) */
.sidebar-list.nested .sidebar-link,
.sidebar-list.nested a.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 20px 5px 36px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.35;
  text-decoration: none;
}
.sidebar-list.nested .sidebar-link:hover,
.sidebar-list.nested a.sidebar-link:hover {
  background: var(--bg-sub);
  color: var(--ink);
}
.sidebar-list.nested .sidebar-link.active,
.sidebar-list.nested a.sidebar-link.active {
  background: var(--selected);
  color: var(--ink);
  font-weight: 500;
}
.sidebar-list.nested .sidebar-link.unread,
.sidebar-list.nested a.sidebar-link.unread {
  font-weight: 500;
}

/* Group toggle (section header) */
.sidebar-group-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 20px 4px;
  margin-top: 18px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  color: var(--ink-3);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  background: none;
  border: none;
}
.sidebar-group-toggle:hover { color: var(--ink-2); }
.sidebar-group-toggle .group-name {
  flex: 1;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  font-weight: 600;
}
.sidebar-group-toggle .toggle-icon {
  font-size: 10px;
  color: var(--ink-4);
  transition: transform 0.12s;
}
.sidebar-group.open > .sidebar-group-toggle .toggle-icon {
  transform: rotate(90deg);
}

.sidebar-divider {
  border-top: 1px solid var(--line);
  margin: 10px 0;
  list-style: none;
}

/* ── Main content area ────────────────────────────────────── */

.main {
  flex: 1;
  min-width: 0;
  background: var(--bg);
}
.content {
  /* alias used in existing templates */
}

/* ── Preview pane ─────────────────────────────────────────── */

.preview-pane {
  display: none;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  min-width: 0;
  overflow: hidden;
}
.shell-body.preview-open .preview-pane { display: flex; }

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-sub);
  flex-shrink: 0;
}
.preview-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.preview-icon { color: var(--ink-3); flex-shrink: 0; }
.preview-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-actions { display: flex; gap: 4px; flex-shrink: 0; }
.preview-btn {
  background: transparent;
  border: 0;
  color: var(--ink-3);
  padding: 4px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: 14px;
}
.preview-btn:hover { color: var(--ink); }
.preview-frame { flex: 1; width: 100%; border: 0; background: var(--bg); }
.preview-link.is-active { background: var(--selected); }

/* ── Raw viewer (eml/msg) ─────────────────────────────────── */

.raw-viewer-body { margin: 0; padding: 0; font-family: var(--font-text); color: var(--ink); background: var(--bg); }
.raw-viewer-header { padding: 1rem 1.25rem 0.85rem; border-bottom: 1px solid var(--line); background: var(--bg-sub); }
.raw-viewer-subject { font-size: 1.1rem; font-weight: 600; margin: 0 0 0.5rem; line-height: 1.3; }
.raw-viewer-meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.15rem 0.75rem; margin: 0; font-size: 0.85rem; }
.raw-viewer-meta dt { color: var(--ink-3); font-weight: 400; }
.raw-viewer-meta dd { margin: 0; word-break: break-word; }
.raw-viewer-frame { width: 100%; height: calc(100vh - 180px); min-height: 400px; border: 0; display: block; }
.raw-viewer-text { padding: 1rem 1.25rem; white-space: pre-wrap; font-family: var(--font-mono); font-size: 0.85rem; margin: 0; }
.raw-viewer-error { padding: 2rem; }

/* ── Briefing page ────────────────────────────────────────── */

.briefing-wrap {
  padding: 56px 80px 120px;
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
}

.briefing-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 12px;
}
.briefing-kicker::after {
  content: '';
  width: 36px;
  height: 1px;
  background: var(--ink-3);
}

.briefing-wrap h1 {
  font-size: 56px;
  line-height: 1.04;
  letter-spacing: -0.025em;
  font-weight: 600;
  margin: 0 0 12px;
}

.briefing-accent-rule {
  width: 64px;
  height: 3px;
  background: var(--accent);
  margin: 16px 0 28px;
}

.briefing-dek {
  font-size: 19px;
  line-height: 1.45;
  color: var(--ink-2);
  max-width: 680px;
  margin-bottom: 40px;
}

/* TOC inline (numbered grid) */
.briefing-toc {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 32px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 48px;
  list-style: none;
}
.briefing-toc a {
  display: flex;
  gap: 12px;
  padding: 5px 0;
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--ink-2);
  text-decoration: none;
}
.briefing-toc a:hover { color: var(--ink); }
.briefing-toc a .n {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
  padding-top: 1px;
  min-width: 18px;
}

.briefing-section-head {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 48px 0 18px;
}
.briefing-section-head::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--ink);
}
.briefing-section-head .n {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
}

/* Body typography */
.briefing-body h2 {
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-weight: 600;
  margin: 0 0 22px;
}
.briefing-body h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 28px 0 10px;
}
.briefing-body p {
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-2);
  margin: 0 0 16px;
}
.briefing-body .inline-link {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1px;
}
.briefing-body .pull {
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 18px;
  margin: 24px 0;
}
.briefing-body .pull-text {
  font-size: 19px;
  line-height: 1.4;
  color: var(--ink);
}
.briefing-body .pull-att {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 8px;
}

/* Staleness indicators */
.brf-stale { color: var(--accent); }
.brf-fresh { color: #1e7a44; }

/* Briefing footer */
.briefing-footer {
  margin-top: 2.5em;
  padding-top: 1em;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
}
.briefing-footer a { color: var(--accent); text-decoration: none; }
.briefing-footer a:hover { text-decoration: underline; }

/* Fallback for old briefing styles (page-body in briefing) */
.briefing-page .page-body h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 36px 0 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line-2);
  letter-spacing: -0.01em;
}
.briefing-page .page-body h2:first-of-type { border-top: 0; padding-top: 0; }
.briefing-page .page-body p { font-size: 15.5px; line-height: 1.65; color: var(--ink-2); margin: 0 0 14px; }

/* ── Stream (Was ist neu) ─────────────────────────────────── */

.stream-page {
  padding: 48px 64px 96px;
  max-width: 1080px;
}

.page-head {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}
.page-head .kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.page-head h1 {
  font-size: 40px;
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.page-head .sub { font-size: 15px; color: var(--ink-2); }
.page-head .page-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 22px;
  align-items: flex-end;
}
.page-head .pf { display: flex; flex-direction: column; gap: 4px; }
.page-head .pf .pf-lbl {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.page-head .pf select,
.page-head .pf input {
  border: 1px solid var(--line);
  padding: 6px 10px;
  font-size: 13px;
  background: var(--bg);
  font-family: inherit;
  outline: none;
  min-width: 140px;
}
.page-head .pf select:focus,
.page-head .pf input:focus { border-color: var(--ink-3); }
.filter-reset {
  font-size: 13px;
  color: var(--ink-3);
  text-decoration: none;
  padding: 6px 10px;
  align-self: flex-end;
}
.filter-reset:hover { color: var(--ink); }

/* Old stream filter compatibility */
.stream-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 28px;
  padding: 12px;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  align-items: flex-end;
}
.stream-filter label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.stream-filter select {
  border: 1px solid var(--line);
  padding: 6px 10px;
  font-size: 13px;
  background: var(--bg);
  font-family: inherit;
  outline: none;
  min-width: 140px;
}

.stream-header { margin-bottom: 12px; }
.stream-header h1 {
  font-size: 40px;
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

/* Feed items */
.feed { display: flex; flex-direction: column; }
.feed-day {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 22px 0 12px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
}
.stream-day { margin-bottom: 8px; }
.stream-date {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 18px 0 10px;
  margin: 0;
  border-bottom: 1px solid var(--line-2);
}
.stream-list { list-style: none; padding: 0; margin: 0; }

.stream-item {
  display: grid;
  grid-template-columns: 80px 1fr 110px;
  gap: 14px;
  padding: 13px 0;
  border-top: 1px solid var(--line-2);
  cursor: pointer;
  align-items: start;
}
.stream-item:hover { background: var(--bg-sub); margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.stream-item.unread { background: #fffbeb; }
.stream-item.unread:hover { background: #fef3c7; }
.stream-row { display: contents; }

.stream-status {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  padding: 3px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  font-weight: 500;
  background: var(--ink);
  color: var(--bg);
  align-self: start;
  white-space: nowrap;
}
.status-neu { background: #1e7a44; color: #fff; }
.status-geaendert { background: var(--ink-3); color: #fff; }

.stream-title {
  font-size: 14.5px;
  line-height: 1.35;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
}
.stream-title:hover { color: var(--accent); }
.stream-meta { font-size: 12px; color: var(--ink-3); }
.stream-excerpt { font-size: 13px; color: var(--ink-3); line-height: 1.5; margin-top: 4px; grid-column: 2 / -1; }
.stream-when {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  text-align: right;
}
.stream-empty { padding: 3em 0; text-align: center; color: var(--ink-3); }

/* ── Watchlist ────────────────────────────────────────────── */

.watch-page { padding: 48px 64px 96px; max-width: 1080px; }
.watch-header h1 { font-size: 40px; line-height: 1.05; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 8px; }

.wl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.wl-card {
  border: 1px solid var(--line);
  padding: 18px 20px;
  background: var(--bg-sub);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}
.wl-card .wl-top { display: flex; align-items: center; gap: 8px; }
.wl-card .wl-sec {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.wl-card .wl-new {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  background: var(--accent);
  color: #fff;
}
.wl-card .wl-title {
  font-size: 15px;
  line-height: 1.3;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
}
.wl-card .wl-title:hover { color: var(--accent); }
.wl-card .wl-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  gap: 10px;
}
.wl-card .wl-star {
  position: absolute;
  top: 16px;
  right: 16px;
  color: var(--accent);
  cursor: pointer;
  background: none;
  border: none;
}

/* Legacy watch list (keep compatible) */
.watch-list { list-style: none; padding: 0; margin: 1em 0 0; }
.watch-item {
  display: grid;
  grid-template-columns: 9rem 1fr auto;
  gap: 0.8rem;
  align-items: baseline;
  padding: 0.6em 0.8em;
}
.watch-item:hover { background: var(--bg-sub); }
.watch-item.unread { background: #fffbeb; }
.watch-main { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.watch-title { font-weight: 500; color: var(--ink); text-decoration: none; }
.watch-title:hover { color: var(--accent); }
.watch-meta { font-size: 0.82rem; color: var(--ink-3); }
.watch-side { display: flex; align-items: baseline; gap: 0.8rem; white-space: nowrap; }
.watch-status { }

.status-pill {
  display: inline-block;
  padding: 0.15em 0.55em;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-unread { background: #fde68a; color: #92400e; }
.status-new { background: #dcfce7; color: #166534; }
.status-seen { background: var(--line-2); color: var(--ink-3); }

/* ── Wiki page ────────────────────────────────────────────── */

.wiki-page-wrap {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100%;
}
.wiki-toc-rail {
  padding: 48px 24px;
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
}
.wiki-toc-rail .lbl {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 14px;
}
.wiki-toc-rail ul { list-style: none; margin: 0; padding: 0; }
.wiki-toc-rail li {
  font-size: 12.5px;
  line-height: 1.4;
  padding: 6px 12px 6px 14px;
  color: var(--ink-2);
  cursor: pointer;
  border-left: 2px solid transparent;
  margin-left: -14px;
}
.wiki-toc-rail li:hover { color: var(--ink); }
.wiki-toc-rail li.is-active { color: var(--ink); font-weight: 500; border-left-color: var(--accent); }
.wiki-toc-rail li.toc-sub { padding-left: 28px; font-size: 12px; color: var(--ink-3); }
.wiki-toc-rail a { text-decoration: none; color: inherit; }

.wiki-body {
  padding: 48px 80px 120px;
  max-width: 880px;
}

/* meta-row (type badges + star) */
.wiki-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line-2);
  flex-wrap: wrap;
}
.wiki-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  color: var(--ink-2);
  background: var(--bg-sub);
  text-transform: lowercase;
}
.wiki-stamp {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-left: auto;
}
.wiki-stamp a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* Star button */
.star-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: color .12s, border-color .12s;
  flex-shrink: 0;
}
.star-btn:hover { color: var(--accent); border-color: var(--accent); }
.star-btn.watched { color: var(--accent); border-color: var(--accent); }

/* Wiki body typography */
.wiki-content h1 {
  font-size: 40px;
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
}
.wiki-content h2 {
  font-size: 24px;
  line-height: 1.2;
  font-weight: 600;
  margin: 44px 0 14px;
  letter-spacing: -0.012em;
  padding-top: 18px;
  border-top: 1px solid var(--line-2);
}
.wiki-content h2:first-of-type { border-top: 0; padding-top: 0; }
.wiki-content h3 { font-size: 16px; font-weight: 600; margin: 24px 0 10px; }
.wiki-content p { font-size: 15px; line-height: 1.65; color: var(--ink); margin: 0 0 14px; }
.wiki-content ul { margin: 0 0 18px; padding: 0; list-style: none; }
.wiki-content ul li {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 10px;
  padding-left: 22px;
  position: relative;
}
.wiki-content ul li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
}
.wiki-content a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--accent); padding-bottom: 1px; }
.wiki-content code { font-family: var(--font-mono); font-size: 0.9em; background: var(--bg-sub); padding: 0.1em 0.35em; }
.wiki-content pre { background: var(--bg-sub); padding: 0.85em 1em; overflow-x: auto; font-size: 0.88em; margin: 0 0 14px; }
.wiki-content pre code { background: transparent; padding: 0; }
.wiki-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.3em 0.9em;
  color: var(--ink-2);
  margin: 1em 0;
  background: var(--bg-sub);
}
.wiki-content table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 0.94em; }
.wiki-content th, .wiki-content td { border: 1px solid var(--line); padding: 0.45em 0.7em; text-align: left; vertical-align: top; }
.wiki-content th { background: var(--bg-sub); }
.wiki-content .broken-link { color: var(--accent); background: #fff7ed; padding: 0 0.25em; font-family: var(--font-mono); font-size: 0.9em; }

/* Sources block at bottom of wiki page */
.wiki-sources-block {
  margin-top: 56px;
  padding-top: 22px;
  border-top: 1px solid var(--ink);
}
.wiki-sources-block h3 {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 600;
  margin: 0 0 14px;
}

/* ── Old page structures (compat) ─────────────────────────── */

.wiki-page {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 1.5rem 2rem 4rem;
}
.wiki-page.quellen-page { max-width: 1300px; }

.page-with-toc.no-toc { display: block; }
.page-with-toc:not(.no-toc) {
  --toc-width: 220px;
  display: grid;
  grid-template-columns: var(--toc-width) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

/* Old TOC */
.page-toc {
  position: sticky;
  top: calc(var(--header-height) + 1rem);
  align-self: start;
  max-height: calc(100vh - var(--header-height) - 2rem);
  overflow-y: auto;
  font-size: 0.88rem;
  padding-top: 0.4rem;
}
.page-toc-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  font-weight: 600;
  margin: 0 0 0.55em 0.7em;
}
.page-toc-list { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--line); }
.page-toc-list li { margin: 0; }
.page-toc-link {
  display: block;
  padding: 0.32em 0.8em;
  color: var(--ink-3);
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: -1px;
  line-height: 1.35;
}
.page-toc-link:hover { color: var(--accent); }
.page-toc-link.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }
.page-toc-list li.page-toc-level-4 .page-toc-link { padding-left: 1.6em; font-size: 0.84rem; }

.page-body h1, .page-body h2, .page-body h3, .page-body h4 {
  margin-top: 1.8em; margin-bottom: 0.6em; line-height: 1.3; font-weight: 600;
}
.page-body h1 { font-size: 1.8rem; margin-top: 0.6em; border-bottom: 1px solid var(--line); padding-bottom: 0.3em; }
.page-body h2 { font-size: 1.35rem; }
.page-body h3 { font-size: 1.1rem; }
.page-body p { margin-bottom: 0.95em; }
.page-body ul, .page-body ol { margin-bottom: 0.95em; padding-left: 1.3em; }
.page-body li { margin-bottom: 0.25em; }
.page-body code { background: var(--bg-sub); padding: 0.1em 0.35em; font-family: var(--font-mono); font-size: 0.9em; }
.page-body pre { background: var(--bg-sub); padding: 0.85em 1em; overflow-x: auto; font-size: 0.88em; }
.page-body pre code { background: transparent; padding: 0; }
.page-body blockquote { border-left: 3px solid var(--accent); padding: 0.3em 0.9em; color: var(--ink-2); margin: 1em 0; background: var(--bg-sub); }
.page-body table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 0.94em; }
.page-body th, .page-body td { border: 1px solid var(--line); padding: 0.45em 0.7em; text-align: left; vertical-align: top; }
.page-body th { background: var(--bg-sub); }
.page-body a { color: var(--accent); text-decoration: none; }
.page-body a:hover { text-decoration: underline; }
.page-body a.external::after { content: " ↗"; font-size: 0.85em; opacity: 0.6; }
.page-body a.wikilink { border-bottom: 1px dotted var(--accent); }
.page-body .broken-link { color: var(--accent); background: #fff7ed; padding: 0 0.25em; font-family: var(--font-mono); font-size: 0.9em; }

/* Heading scroll offset */
.page-body h1[id], .page-body h2[id], .page-body h3[id], .page-body h4[id] {
  scroll-margin-top: calc(var(--header-height) + 0.6rem);
}

/* Frontmatter / meta-box */
.meta-box {
  background: var(--bg-sub);
  border: 1px solid var(--line);
  padding: 0.7em 0.95em;
  margin-bottom: 1.5em;
  font-size: 0.9rem;
}
.meta-row { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.meta-row + .meta-row { margin-top: 0.45em; }
.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.15em 0.55em;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 0.82rem;
}
.meta-quelltyp { background: var(--selected); border-color: var(--line); color: var(--ink-2); font-weight: 500; }
.text-muted { color: var(--ink-3) !important; }
.small { font-size: 0.85rem; }

/* Page toolbar (star + diff hint) */
.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
  margin-bottom: 0.8em;
  flex-wrap: wrap;
}
.diff-hint-line {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.85rem;
  color: var(--ink-3);
}
.diff-hint-swatch {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  background: #dcfce7;
  border-left: 3px solid #16a34a;
  border-radius: 0 2px 2px 0;
}

/* ── Diff highlighting ────────────────────────────────────── */

.diff-body .diff-block-new,
.diff-body .diff-block-removed {
  padding: 0.4em 0.9em;
  margin: 0.6em -0.9em;
  border-radius: 0 4px 4px 0;
}
.diff-body .diff-block-new { background: #dcfce7; border-left: 4px solid #16a34a; }
.diff-body .diff-block-removed { background: #fef2f2; border-left: 4px solid #dc2626; opacity: 0.6; }
.diff-body .diff-block-removed,
.diff-body .diff-block-removed h1,
.diff-body .diff-block-removed h2,
.diff-body .diff-block-removed h3,
.diff-body .diff-block-removed h4,
.diff-body .diff-block-removed p,
.diff-body .diff-block-removed li,
.diff-body .diff-block-removed td,
.diff-body .diff-block-removed th {
  text-decoration: line-through;
  text-decoration-color: rgba(153,27,27,0.45);
}
.diff-body > .diff-block-new:first-child,
.diff-body > .diff-block-removed:first-child { margin-top: 0; }
.diff-body .diff-block-new > :first-child,
.diff-body .diff-block-removed > :first-child { margin-top: 0; }
.diff-body .diff-block-new > :last-child,
.diff-body .diff-block-removed > :last-child { margin-bottom: 0; }
.diff-body li.diff-item-new {
  background: #dcfce7; border-left: 4px solid #16a34a;
  padding: 0.1em 0.4em; margin-left: -0.5em; border-radius: 0 4px 4px 0;
}
.diff-body li.diff-item-removed {
  background: #fef2f2; border-left: 4px solid #dc2626;
  padding: 0.1em 0.4em; margin-left: -0.5em; border-radius: 0 4px 4px 0;
  opacity: 0.6; text-decoration: line-through;
  text-decoration-color: rgba(153,27,27,0.45);
}
.diff-body tr.diff-row-new > td { background: #dcfce7; }
.diff-body tr.diff-row-new > td:first-child { border-left: 4px solid #16a34a; }
.diff-body tr.diff-row-removed > td { background: #fef2f2; opacity: 0.6; text-decoration: line-through; text-decoration-color: rgba(153,27,27,0.45); }
.diff-body tr.diff-row-removed > td:first-child { border-left: 4px solid #dc2626; }

/* ── Quellen / Sources table ──────────────────────────────── */

.quellen-page .quellen-header h1 {
  font-size: 40px;
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.quellen-filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 12px;
  padding: 12px;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  margin-bottom: 28px;
}
.quellen-filters .f { display: flex; flex-direction: column; gap: 4px; }
.quellen-filters .f .f-lbl {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.quellen-filters .f input,
.quellen-filters .f select,
.filter-bar select, .filter-bar input,
.filter-group select, .filter-group input,
.filter-group .form-select, .filter-group .form-control {
  border: 1px solid var(--line);
  padding: 6px 10px;
  background: var(--bg);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  appearance: none;
  width: 100%;
}
.filter-bar { display: flex; flex-wrap: wrap; gap: 0.85rem; margin: 1.2em 0 1em; align-items: end; }
.filter-group { display: flex; flex-direction: column; gap: 0.2rem; min-width: 160px; }
.filter-group label { font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }

.tbl, .quellen-table, table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl thead th, .quellen-table thead th, table.table thead th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--ink);
  white-space: nowrap;
}
.tbl tbody td, .quellen-table tbody td, table.table tbody td {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink);
  vertical-align: top;
}
.tbl tbody tr:hover, .quellen-table tbody tr:hover, table.table tbody tr:hover { background: var(--bg-sub); }
.tbl .num, .tbl .date, .tbl .when,
.quellen-table .datum {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}
.tbl .type-badge, .quelltyp-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  color: var(--ink-2);
  background: var(--bg);
  border-radius: 0;
}
.tbl .ttl-link, .quellen-table a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
}
.tbl .status-ok {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px;
  padding: 2px 8px; background: rgba(37,162,90,0.10); color: #1e7a44;
}
.tbl .status-fail {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px;
  padding: 2px 8px; background: rgba(197,49,31,0.10); color: var(--accent);
}
.tbl .role-admin {
  font-family: var(--font-mono); font-size: 11px;
  padding: 2px 8px; background: var(--ink); color: var(--bg);
}
.tbl .role-user {
  font-family: var(--font-mono); font-size: 11px;
  padding: 2px 8px; border: 1px solid var(--line); color: var(--ink-2);
}

.quellen-table th.sortable { cursor: pointer; user-select: none; }
.quellen-table th.sortable:hover { color: var(--ink); }
.quellen-table th .sort-indicator { opacity: 0; font-size: 0.7em; margin-left: 0.25em; }
.quellen-table th.sort-asc .sort-indicator,
.quellen-table th.sort-desc .sort-indicator { opacity: 0.6; }
.quellen-table th.sort-asc .sort-indicator { transform: rotate(180deg); display: inline-block; }
.table-responsive { overflow-x: auto; }

/* Log items */
.log-item {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line-2);
}
.log-stamp { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.log-stamp .log-date { color: var(--ink); }
.log-kind {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 6px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 10px;
}
.log-kind-lint { background: var(--accent); }
.log-kind-ingest { background: #1e7a44; }
.log-kind-briefing { background: #2c4a8a; }
.log-kind-rss-triage { background: #6a5a1e; }
.log-title { font-size: 15px; font-weight: 500; line-height: 1.35; margin-bottom: 6px; }
.log-body { font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.log-body code { font-family: var(--font-mono); font-size: 12px; background: var(--bg-sub); padding: 1px 4px; }

/* Benutzer (user management) */
.user-mgmt-head {
  display: grid;
  grid-template-columns: 220px 80px 110px 1fr auto;
  gap: 18px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ink);
  background: var(--bg-sub);
}
.user-mgmt-head span {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.user-row {
  display: grid;
  grid-template-columns: 220px 80px 110px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line-2);
}
.user-row:hover { background: var(--bg-sub); }
.user-av-wrap { display: flex; align-items: center; gap: 12px; }
.user-av {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--ink); color: var(--bg);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.user-name { font-weight: 500; font-size: 14px; }
.user-you {
  font-family: var(--font-mono); font-size: 10px;
  padding: 2px 6px; background: var(--bg-sub); border: 1px solid var(--line); color: var(--ink-3);
}
.user-kuerz { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.user-activity { font-size: 12px; color: var(--ink-3); }
.user-activity b { color: var(--ink); font-weight: 500; }
.user-actions { display: flex; gap: 8px; }
.user-actions button {
  font-size: 12px; padding: 5px 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-2);
}
.user-actions button:hover { color: var(--ink); }
.user-actions .btn-danger { color: var(--accent); }

/* ── Chat page ────────────────────────────────────────────── */

.chat-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  min-height: calc(100vh - var(--header-height));
}
.chat-main { display: flex; flex-direction: column; min-width: 0; padding: 28px 56px 0; max-width: 860px; }
.chat-head { padding-bottom: 18px; margin-bottom: 8px; border-bottom: 1px solid var(--line-2); }
.chat-head h1 { font-size: 24px; margin: 0; font-weight: 600; letter-spacing: -0.015em; }
.chat-head .sub { font-size: 13px; color: var(--ink-3); margin-top: 4px; }

.chat-history { flex: 1; overflow-y: auto; padding: 16px 0; }
.chat-thread { display: flex; flex-direction: column; gap: 24px; }
.cm { display: grid; grid-template-columns: 72px 1fr; gap: 8px; }
.cm .who {
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); padding-top: 5px;
}
.cm.user .who { color: var(--ink); font-weight: 600; }
.cm.claude .who { color: var(--accent); font-weight: 600; }
.cm .body { min-width: 0; }
.cm.user .body { font-size: 16px; line-height: 1.5; color: var(--ink); font-weight: 500; }
.cm.claude .body { font-size: 14.5px; line-height: 1.65; color: var(--ink); }
.cm.claude .body p { margin: 0 0 12px; }
.cm.claude .body strong { font-weight: 600; }
.cm.claude .body ul { margin: 6px 0 12px; padding: 0; list-style: none; }
.cm.claude .body ul li { padding-left: 18px; position: relative; margin-bottom: 6px; }
.cm.claude .body ul li::before { content: ''; position: absolute; left: 4px; top: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); }

/* Old chat styles compatibility */
.chat-container { height: calc(100vh - var(--header-height)); max-width: 860px; margin: 0 auto; padding: 1.25rem 1.5rem; display: flex; flex-direction: column; }
#chat-history { flex: 1; overflow-y: auto; margin-bottom: 12px; padding: 12px; border: 1px solid var(--line); background: var(--bg); }
#chat-input-wrap {
  display: flex; align-items: flex-end; gap: 0;
  border: 1px solid var(--ink); background: var(--bg); overflow: hidden;
}
#chat-input {
  flex: 1; border: 0; padding: 12px 14px; font: inherit; font-size: 14px; resize: none;
  background: transparent; outline: none;
}
#chat-input-wrap:focus-within { border-color: var(--ink); }
#chat-send {
  padding: 0 16px; background: var(--ink); color: var(--bg);
  border: 0; font-size: 15px; cursor: pointer; min-height: 46px;
}
#chat-send:hover { background: var(--ink-2); }
.chat-bubble { padding: 12px 16px; margin-bottom: 12px; max-width: 92%; }
.chat-bubble.user { background: var(--selected); margin-left: auto; }
.chat-bubble.assistant { background: var(--bg-sub); border: 1px solid var(--line); }
.chat-bubble .wikilink { color: var(--accent); text-decoration: underline; cursor: pointer; }

/* Chat rail */
.chat-rail { border-left: 1px solid var(--line); padding: 28px 22px; overflow-y: auto; }
.chat-rail h3 {
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 12px; font-weight: 600;
}
.chat-rail h3:not(:first-child) { margin-top: 28px; }

/* Composer */
.chat-composer { position: sticky; bottom: 0; background: var(--bg); padding: 16px 0 24px; border-top: 1px solid var(--line-2); }
.chat-composer .wrap { border: 1px solid var(--ink); background: var(--bg); display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; }
.chat-composer .ta { border: 0; outline: none; resize: none; background: transparent; font: inherit; color: var(--ink); min-height: 56px; font-size: 14.5px; line-height: 1.45; }
.scope-toggles { display: inline-flex; }
.scope-btn { padding: 4px 11px; font: inherit; font-size: 11.5px; border: 1px solid var(--line); background: var(--bg); color: var(--ink-3); cursor: pointer; white-space: nowrap; }
.scope-btn + .scope-btn { border-left: 0; }
.scope-btn.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.scope-btn:hover:not(.active) { color: var(--ink); border-color: var(--ink-3); }

/* ── Admin alerts bar ─────────────────────────────────────── */

#admin-alerts-bar:not(:empty) { border-bottom: 1px solid var(--line); }
.alert-bar-inner { font-size: 0.87rem; }
.alert-bar-item {
  display: flex; align-items: baseline; gap: 0.55rem;
  padding: 0.55rem 1.25rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  line-height: 1.4;
}
.alert-bar-item:last-of-type { border-bottom: none; }
.alert-bar-error { background: #fef2f2; color: #7f1d1d; }
.alert-bar-warning { background: #fffbeb; color: #78350f; }
.alert-bar-source { font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.alert-bar-msg { flex: 1; min-width: 0; word-break: break-word; }
.alert-bar-time { font-size: 0.8rem; opacity: 0.6; white-space: nowrap; flex-shrink: 0; }
.alert-bar-dismiss { background: transparent; border: 0; cursor: pointer; color: inherit; opacity: 0.45; padding: 0 0.2rem; flex-shrink: 0; font-size: 0.85rem; }
.alert-bar-dismiss:hover { opacity: 1; }
.alert-bar-footer { padding: 0.35rem 1.25rem; background: var(--bg-sub); border-top: 1px solid rgba(0,0,0,0.05); }
.alert-bar-dismiss-all { background: transparent; border: 0; cursor: pointer; font-size: 0.8rem; color: var(--ink-3); padding: 0; text-decoration: underline; }
.alert-bar-dismiss-all:hover { color: var(--ink); }

/* ── Inbox Drawer ─────────────────────────────────────────── */

.overlay-bg {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
}
.overlay-bg.open { display: block; }

.scrim {
  position: absolute; inset: 0;
  background: rgba(10,10,10,0.30);
  backdrop-filter: blur(2px);
}

.drawer {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 460px;
  background: var(--bg);
  border-left: 1px solid var(--line);
  z-index: 10;
  display: flex; flex-direction: column;
}

.drawer-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.drawer-head h2 { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: -0.01em; flex: 1; }
.drawer-head .drawer-count { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.drawer-head .drawer-close { color: var(--ink-3); width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; }
.drawer-head .drawer-close:hover { color: var(--ink); }

/* Jump tabs */
.drawer-jump {
  display: flex; gap: 4px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-sub);
  flex-shrink: 0;
}
.drawer-jump button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--bg); border: 1px solid var(--line);
  font-size: 12px; color: var(--ink-2); flex: 1;
}
.drawer-jump button:hover { color: var(--ink); border-color: var(--ink-3); }
.drawer-jump .jn { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--ink-4); }
.drawer-jump .jn-accent { background: var(--accent); color: #fff; padding: 1px 5px; }
.drawer-jump .jn-ok { color: #1e7a44; }

.drawer-body { flex: 1; overflow-y: auto; }
.drawer-section { padding: 18px 22px; border-bottom: 1px solid var(--line); }
.drawer-section:last-child { border-bottom: 0; }
.drawer-section h3 {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600; margin: 0 0 14px;
}
.drawer-section h3 .ds-ct { font-family: var(--font-mono); font-size: 10px; color: var(--ink-4); }
.drawer-action-row {
  display: flex; gap: 8px; margin-top: 10px;
}
.drawer-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  background: var(--ink); color: var(--bg);
  border: 1px solid var(--ink); font-size: 13px;
}
.drawer-btn:hover { background: var(--ink-2); border-color: var(--ink-2); }
.drawer-btn.secondary { background: var(--bg); color: var(--ink-2); border-color: var(--line); }
.drawer-btn.secondary:hover { color: var(--ink); }
.drawer-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Source rows (RSS / Gmail) */
.src-row {
  display: grid; grid-template-columns: 28px 1fr auto;
  gap: 12px; align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-2);
}
.src-row:last-child { border-bottom: 0; }
.src-row .sr-name { font-size: 13px; font-weight: 500; }
.src-row .sr-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }
.src-row .sr-meta.err { color: var(--accent); }
.src-row .sr-btns { display: flex; gap: 6px; }
.src-btn {
  font-size: 12px; padding: 5px 10px;
  border: 1px solid var(--line); background: var(--bg);
  display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2);
}
.src-btn:hover { color: var(--ink); }
.src-btn.warn { border-color: var(--accent); color: var(--accent); }
.src-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pending-pill {
  font-family: var(--font-mono); font-size: 11px;
  padding: 2px 7px; background: var(--accent); color: #fff;
}

/* Inbox doc items */
.inb-doc {
  display: grid; grid-template-columns: 32px 1fr auto;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-2);
}
.inb-doc:last-child { border-bottom: 0; }
.inb-doc .inb-icon {
  width: 32px; height: 38px; border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3);
}
.inb-doc .inb-name { font-size: 13px; font-weight: 500; color: var(--ink); margin-bottom: 3px; word-break: break-word; }
.inb-doc .inb-meta {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3);
  display: flex; gap: 8px; flex-wrap: wrap;
}
.inb-doc .inb-detected {
  margin-top: 6px; font-size: 11.5px; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 6px; background: var(--bg-sub); border: 1px solid var(--line);
}
.inb-doc .inb-acts { align-self: center; display: flex; gap: 6px; }
.inb-doc .inb-acts button {
  font-size: 12px; padding: 5px 9px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-2);
}
.inb-doc .inb-acts .go {
  background: var(--ink); color: var(--bg); border-color: var(--ink);
}
.inb-doc .inb-acts .go:hover { background: var(--ink-2); }

/* Bulk actions */
.drawer-bulk {
  display: flex; gap: 8px; padding-top: 10px;
  border-top: 1px solid var(--line-2); margin-top: 6px;
}

/* Lint card */
.lint-card {
  background: var(--bg-sub); border: 1px solid var(--line);
  padding: 14px;
  display: flex; align-items: center; gap: 14px;
}
.lint-ic {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #25a25a; color: #fff; font-size: 18px;
}
.lint-ic.err { background: var(--accent); }
.lint-body { flex: 1; }
.lint-body .lint-head { font-size: 13px; font-weight: 500; }
.lint-body .lint-meta { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); margin-top: 3px; }

/* Drawer status messages */
.drawer-status {
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.4;
  border: 1px solid var(--line);
  margin-top: 10px;
}
.drawer-status.info { background: var(--selected); color: var(--ink-2); }
.drawer-status.success { background: #f0fdf4; border-color: #86efac; color: #166534; }
.drawer-status.warning { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.drawer-status.danger { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }

/* ── Upload Modal ─────────────────────────────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
}
.modal-overlay.open { display: block; }

.upload-modal {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 520px;
  background: var(--bg);
  border: 1px solid var(--line);
  z-index: 10;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.30);
}
.upload-head {
  padding: 16px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.upload-head h2 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; }
.upload-head .upload-close { color: var(--ink-3); }
.upload-head .upload-close:hover { color: var(--ink); }
.upload-body { padding: 22px; }
.dropzone {
  border: 1.5px dashed var(--line);
  background: var(--bg-sub);
  padding: 36px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center; cursor: pointer;
}
.dropzone.drag-over { border-color: var(--ink); background: var(--selected); }
.dropzone .dz-icon { color: var(--ink-3); margin-bottom: 4px; font-size: 2rem; }
.dropzone .dz-head { font-size: 15px; font-weight: 500; }
.dropzone .dz-sub { font-size: 12px; color: var(--ink-3); }
.dropzone .dz-names { font-size: 13px; color: var(--ink-2); }
.upload-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex; gap: 10px; align-items: center;
  font-size: 12px; color: var(--ink-3);
}
.upload-foot button { padding: 7px 14px; border: 1px solid var(--line); font-size: 13px; background: var(--bg); color: var(--ink-2); }
.upload-foot button:hover { color: var(--ink); }
.upload-foot .upload-send { margin-left: auto; background: var(--ink); color: var(--bg); border-color: var(--ink); }
.upload-foot .upload-send:hover { background: var(--ink-2); }
.upload-foot .upload-send:disabled { opacity: 0.4; cursor: not-allowed; }
.upload-result { font-size: 13px; line-height: 1.4; }
.upload-result.ok { color: #1e7a44; }
.upload-result.err { color: var(--accent); }

/* ── Toast notifications ──────────────────────────────────── */

#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast-msg {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 16px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13.5px;
  line-height: 1.4;
  max-width: 420px;
  box-shadow: 0 8px 24px -8px rgba(0,0,0,0.35);
  animation: toast-in .18s ease;
}
.toast-msg.success { background: #1e7a44; }
.toast-msg.danger { background: var(--accent); }
.toast-msg .toast-body { flex: 1; }
.toast-msg .toast-body a { color: inherit; text-decoration: underline; }
.toast-msg .toast-close { color: rgba(255,255,255,0.6); cursor: pointer; font-size: 14px; }
.toast-msg .toast-close:hover { color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Login ────────────────────────────────────────────────── */

.login-body {
  background: var(--bg-sub);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.login-frame {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 2rem 2.2rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 4px 20px rgba(15,23,42,0.06);
}
.login-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 1.6rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}
.login-header .wordmark { font-weight: 600; font-size: 1.4rem; letter-spacing: -0.01em; }
.login-frame h1 { font-size: 1.4rem; margin: 0 0 0.4em; }
.login-hint { font-size: 0.92rem; margin-bottom: 1.2em; color: var(--ink-2); }
.login-error {
  background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
  padding: 0.5em 0.8em; font-size: 0.9rem; margin-bottom: 1em;
}
.login-form .form-group { margin-bottom: 1rem; }
.login-form label { display: block; font-size: 0.82rem; font-weight: 500; margin-bottom: 0.3rem; color: var(--ink-2); }
.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%; padding: 0.55em 0.75em;
  border: 1px solid var(--line); background: var(--bg);
  font: inherit; font-size: 1rem; outline: none;
}
.login-form input:focus { border-color: var(--ink); }
.login-form button[type="submit"] {
  width: 100%; padding: 0.65em 1em;
  background: var(--ink); color: var(--bg); border: 1px solid var(--ink);
  font-size: 1rem; cursor: pointer; font-family: inherit;
}
.login-form button[type="submit"]:hover { background: var(--ink-2); }
.login-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.login-button {
  width: 100%; display: flex; align-items: center; gap: 0.7rem;
  padding: 0.7em 1em; border: 1px solid var(--line); background: var(--bg);
  font-size: 1rem; text-align: left; cursor: pointer;
}
.login-button:hover { background: var(--bg-sub); border-color: var(--ink-3); }

/* ── Dots / status indicators ─────────────────────────────── */

.dot {
  width: 6px; height: 6px; border-radius: 50%;
  display: inline-block; background: var(--ink-3);
  flex-shrink: 0;
}
.dot.green { background: #25a25a; }
.dot.red { background: var(--accent); }
.dot.amber { background: #c98c10; }
.dot.gray { background: var(--ink-4); }

/* ── Password change ──────────────────────────────────────── */

.password-frame {
  max-width: 480px;
  margin: 4rem auto;
  padding: 0 2rem;
}

/* ── Admin users page ─────────────────────────────────────── */
.admin-page-wrap { padding: 48px 64px 96px; max-width: 1080px; }

/* ── Audits page ──────────────────────────────────────────── */
.audits-page-wrap { padding: 48px 64px 96px; max-width: 1080px; }
.audit-detail-wrap { padding: 48px 64px 96px; max-width: 980px; }

/* ── Admin table (.tbl) ──────────────────────────────────── */

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  text-align: left; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600; padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--ink); white-space: nowrap;
}
.tbl tbody td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line-2); color: var(--ink); vertical-align: top; }
.tbl tbody tr:hover { background: var(--bg-sub); }
.tbl .t-mono { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); }
.tbl .t-muted { color: var(--ink-3); font-size: 12.5px; }
.tbl .t-pub { font-weight: 500; }
.tbl .t-badge { font-family: var(--font-mono); font-size: 10px; padding: 2px 6px; border: 1px solid var(--line); color: var(--ink-2); }
.tbl .t-link { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--accent); }
.tbl .t-link:hover { color: var(--accent); }
.tbl-wrap { overflow-x: auto; }

.t-status-ok { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 11px; padding: 2px 8px; background: rgba(37,162,90,0.10); color: #1e7a44; }
.t-status-fail { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 11px; padding: 2px 8px; background: rgba(197,49,31,0.10); color: var(--accent); }
.t-status-warn { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 11px; padding: 2px 8px; background: rgba(251,191,36,0.15); color: #92400e; }
.t-status-run { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 11px; padding: 2px 8px; background: rgba(37,99,235,0.10); color: #1d4ed8; }
.t-status-revert { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 11px; padding: 2px 8px; background: rgba(120,53,15,0.10); color: #92400e; }
.t-role-admin { font-family: var(--font-mono); font-size: 11px; padding: 2px 8px; background: var(--ink); color: var(--bg); }
.t-role-user { font-family: var(--font-mono); font-size: 11px; padding: 2px 8px; border: 1px solid var(--line); color: var(--ink-2); }

.tbl-action-row { display: flex; gap: 8px; }
.admin-btn {
  font-size: 12px; padding: 5px 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font: inherit;
}
.admin-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.admin-btn.primary { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.admin-btn.primary:hover { background: var(--ink-2); }
.admin-btn.danger { border-color: var(--accent); color: var(--accent); }

.admin-flash { padding: 10px 14px; margin-bottom: 16px; font-size: 13.5px; border-left: 3px solid; }
.admin-flash.success { background: #f0fdf4; border-color: #16a34a; color: #166534; }
.admin-flash.error { background: #fef2f2; border-color: var(--accent); color: var(--accent); }

.audit-stats { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.audit-stat { font-family: var(--font-mono); font-size: 11px; padding: 3px 10px; border: 1px solid var(--line); color: var(--ink-2); background: var(--bg-sub); }
.audit-summary-pre { background: var(--bg-sub); border: 1px solid var(--line); padding: 16px; font-family: var(--font-mono); font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-x: auto; margin-bottom: 20px; }
.audit-summary-text { padding: 10px 14px; background: var(--bg-sub); border: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); margin-bottom: 20px; }
.audit-error-msg { padding: 10px 14px; background: #fef2f2; border-left: 3px solid var(--accent); font-size: 13px; color: var(--accent); margin-bottom: 20px; }

/* ── Misc ─────────────────────────────────────────────────── */

.content { /* main content area */ overflow: auto; }

/* Sidebar-group has-unread indicator */
.sidebar-group.has-unread > .sidebar-group-toggle .group-name { color: var(--ink); }

/* Responsive */
@media (max-width: 960px) {
  .shell-body,
  .shell-body.preview-open {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .wiki-page-wrap { grid-template-columns: 1fr; }
  .wiki-toc-rail { display: none; }
  .page-with-toc:not(.no-toc) { display: block; }
  .page-toc { position: static; max-height: none; margin-bottom: 1.4em; padding: 0.6em 0.8em; background: var(--bg-sub); border: 1px solid var(--line); }
  .shell-body.preview-open .preview-pane { position: fixed; inset: var(--header-height) 0 0 0; z-index: 200; border-left: 0; }
  .briefing-wrap { padding: 32px 24px 64px; }
  .stream-page, .watch-page, .admin-page-wrap, .audits-page-wrap, .audit-detail-wrap { padding: 24px; }
  .wl-grid { grid-template-columns: 1fr; }
}

/* ── Suchfeld-Dropdown ────────────────────────────────────── */

.search-dropdown {
  position: fixed;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  max-height: 440px;
  overflow-y: auto;
  z-index: 9999;
  min-width: 360px;
}
.search-result {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.search-result:last-child { border-bottom: 0; }
.search-result:hover,
.search-result.is-active { background: var(--bg-sub); }
.search-result-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-meta {
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-family: var(--font-mono);
}
.search-result-snippet {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-no-results {
  padding: 14px;
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
}

/* ── Mobile-Optimierung ─────────────────────────────────────── */

/* Hamburger-Button — auf Desktop versteckt */
.tb-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--ink-2);
  flex-shrink: 0;
}
.tb-hamburger:hover { color: var(--ink); }

/* Abbrechen-Button im Suchfeld — auf Desktop versteckt */
.search-cancel-btn {
  display: none;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--ink-2);
  padding: 0;
  white-space: nowrap;
}
.search-cancel-btn:hover { color: var(--ink); }

/* Mobiler Such-Button in der Topbar — auf Desktop versteckt */
.tb-mobile-search { display: none !important; }

/* Sidebar-Scrim (Overlay-Hintergrund beim offenen Menü) */
.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.40);
  backdrop-filter: blur(2px);
  z-index: 90;
}
.sidebar-scrim.open { display: block; }

/* ── Mobil (≤ 768px) ─────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Topbar: Grid → Flex */
  .topbar {
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 10px;
  }
  .tb-hamburger { display: inline-flex; }
  .topbar .brand { flex-shrink: 0; }

  /* Desktop-Suchfeld verstecken; mobiler Such-Button zeigen */
  .topbar .search { display: none; }
  .topbar .actions { margin-left: auto; gap: 6px; }
  .tb-mobile-search { display: inline-flex !important; }

  /* Text-Labels und Benutzername in der Topbar ausblenden */
  .topbar .tb-btn span:not(.badge) { display: none; }
  .topbar .avatar-btn .av-name { display: none; }
  .topbar .avatar-btn .chev { display: none; }
  .topbar .avatar-btn { padding: 4px; }

  /* Tastaturkürzel-Hinweis immer verstecken */
  .topbar .search .kbd { display: none; }

  /* Vollbild-Suchleiste beim Öffnen der mobilen Suche */
  body.mobile-search-open .topbar .search {
    display: flex;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    z-index: 110;
    border: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 16px;
    background: var(--bg);
    gap: 8px;
    align-items: center;
  }
  body.mobile-search-open .search-cancel-btn { display: block; }
  body.mobile-search-open .tb-mobile-search { display: none !important; }

  /* Sidebar: fixer Overlay mit Slide-in-Animation */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: min(280px, 85vw) !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 95;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    padding-top: var(--header-height);
    border-right: 1px solid var(--line);
    border-bottom: 0 !important;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.12);
  }

  /* Shell-Body: keine Sidebar-Spalte */
  .shell-body { grid-template-columns: 1fr !important; }

  /* Inbox-Drawer: volle Breite */
  .drawer { width: 100% !important; }

  /* Upload-Modal: responsive Breite */
  .upload-modal { width: calc(100vw - 24px); }

  /* Inhalts-Padding verringern */
  .briefing-wrap { padding: 20px 16px 60px; }
  .stream-page, .watch-page { padding: 16px; }
  .admin-page-wrap, .audits-page-wrap, .audit-detail-wrap { padding: 16px; }
  .wiki-body { padding: 20px 16px 60px !important; }

  /* Tabellen: horizontales Scrollen */
  .quellen-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Stream: Zeitstempel ausblenden */
  .si-when { display: none !important; }

  /* Vorschau-Bereich bei aktivierter Vorschau als Vollbild */
  .shell-body.preview-open .preview-pane {
    position: fixed;
    inset: var(--header-height) 0 0 0;
    z-index: 200;
    border-left: 0;
  }
}

/* ── Kleines Smartphone (≤ 480px) ─────────────────────────────── */
@media (max-width: 480px) {
  .topbar { padding: 0 10px; gap: 6px; }
  .topbar .brand .wordmark { font-size: 16px; }
  .briefing-wrap { padding: 16px 12px 48px; }
  .wiki-body { padding: 16px 12px 48px !important; }
  .stream-page, .watch-page { padding: 12px; }
  .admin-page-wrap, .audits-page-wrap, .audit-detail-wrap { padding: 12px; }
}
