/* Buch-Notizen -- gleiche Design-Tokens/Fonts wie der Hub (christianhennings-com) */
:root {
  --paper: #ffffff;
  --ink: #121316;
  --muted: #6b6f76;
  --line: #e3e4e7;
  --card: #f6f7f8;
  --accent: #2a4cff;
  --accent-ink: #ffffff;
  --accent-soft: #e8ecff;
  --danger: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0a0b0d;
    --ink: #edeef0;
    --muted: #90949c;
    --line: #26282d;
    --card: #17181b;
    --accent: #6b87ff;
    --accent-ink: #0a0b0d;
    --accent-soft: #1b2140;
    --danger: #ff7a6e;
  }
}
:root[data-theme="dark"] {
  --paper: #0a0b0d;
  --ink: #edeef0;
  --muted: #90949c;
  --line: #26282d;
  --card: #17181b;
  --accent: #6b87ff;
  --accent-ink: #0a0b0d;
  --accent-soft: #1b2140;
  --danger: #ff7a6e;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Archivo", "Segoe UI", system-ui, sans-serif;
  line-height: 1.55;
}
h1, h2, h3, .display {
  font-family: "Archivo", system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0 0 12px;
}
.mono {
  font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
}
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ============================= Header / Tabs ============================= */
.app-header {
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--paper); z-index: 10;
}
.header-inner {
  max-width: 1080px; margin: 0 auto; padding: 16px 20px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink);
}
.brand-icon { width: 28px; height: 28px; flex: none; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.who { color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 12.5px; }

.tabs {
  max-width: 1080px; margin: 0 auto; padding: 0 20px;
  display: flex; gap: 4px; overflow-x: auto;
}
.tab {
  font-family: "IBM Plex Mono", monospace; font-size: 12.5px; font-weight: 500;
  letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted);
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 12px 6px 10px; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }

.app-main { max-width: 1080px; margin: 0 auto; padding: 28px 20px 80px; }
.view { display: none; }
.view.is-active { display: block; }

.view-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.view-head h1 { font-size: 22px; margin-bottom: 4px; }
.view-sub { color: var(--muted); font-size: 14px; margin: 0; max-width: 60ch; }

/* ============================= Buttons ============================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 11px 20px; border-radius: 3px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  background: var(--card); color: var(--ink);
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: var(--accent-soft); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-small { padding: 7px 12px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.linklike {
  background: none; border: none; padding: 0; color: var(--muted);
  font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.linklike:hover { color: var(--ink); }

/* ============================= Regal ============================= */
.shelf-columns {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
@media (max-width: 800px) { .shelf-columns { grid-template-columns: 1fr; } }
.shelf-column-head {
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 12px;
}
.shelf-column-title {
  font-family: "IBM Plex Mono", monospace; font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.shelf-column-count {
  font-family: "IBM Plex Mono", monospace; font-size: 11.5px; color: var(--muted);
}
.book-grid { display: flex; flex-direction: column; gap: 10px; }
.book-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 4px;
  padding: 14px 16px; cursor: pointer; text-align: left; width: 100%;
  font-family: inherit; color: var(--ink);
  display: flex; flex-direction: column; gap: 6px;
}
.book-card:hover { border-color: var(--accent); }
.book-card .book-title { font-weight: 600; font-size: 15px; }
.book-card .book-author { color: var(--muted); font-size: 13px; }
.book-card .book-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.badge {
  display: inline-block; font-family: "IBM Plex Mono", monospace;
  font-size: 10px; font-weight: 500; letter-spacing: 0.04em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 2px;
  background: var(--accent-soft); color: var(--accent); width: fit-content;
}
.badge.type-quote { background: var(--accent-soft); color: var(--accent); }
.badge.type-idea { background: #26331e; color: #a8d977; }
.badge.type-summary { background: #1e2733; color: #7db3e8; }
.badge.type-action { background: #332615; color: #e0a95c; }
@media (prefers-color-scheme: light) {
  .badge.type-idea { background: #eaf3df; color: #5c8a2b; }
  .badge.type-summary { background: #e4eef8; color: #2f6ea8; }
  .badge.type-action { background: #f6ead9; color: #a06a1f; }
}
:root[data-theme="light"] .badge.type-idea { background: #eaf3df; color: #5c8a2b; }
:root[data-theme="light"] .badge.type-summary { background: #e4eef8; color: #2f6ea8; }
:root[data-theme="light"] .badge.type-action { background: #f6ead9; color: #a06a1f; }
:root[data-theme="dark"] .badge.type-idea { background: #26331e; color: #a8d977; }
:root[data-theme="dark"] .badge.type-summary { background: #1e2733; color: #7db3e8; }
:root[data-theme="dark"] .badge.type-action { background: #332615; color: #e0a95c; }

.stars { font-size: 13px; letter-spacing: 1px; color: var(--accent); }
.stars.empty { color: var(--line); }
.star-input { display: flex; gap: 4px; }
.star-input button {
  background: none; border: none; cursor: pointer; font-size: 20px;
  line-height: 1; padding: 2px; color: var(--line);
}
.star-input button.is-filled { color: var(--accent); }

.empty-state {
  border: 1px dashed var(--line); border-radius: 4px; padding: 24px;
  color: var(--muted); font-size: 13.5px; text-align: center;
}

/* ============================= Forms ============================= */
.field { text-align: left; margin: 0 0 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 3px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font-size: 14.5px; font-family: inherit;
}
.field textarea { resize: vertical; min-height: 70px; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 560px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.form-error { color: var(--danger); font-size: 13px; margin: 0 0 10px; }

/* ============================= Notizen ============================= */
.note-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.note-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px;
}
.note-item-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.note-item-ref { font-family: "IBM Plex Mono", monospace; font-size: 11.5px; color: var(--muted); }
.note-item-content { font-size: 14.5px; white-space: pre-wrap; }
.note-item-content.is-quote { font-style: italic; }
.note-item-actions { display: flex; gap: 8px; }

/* ============================= Sections ============================= */
.section { margin-bottom: 30px; }
.section-heading {
  font-family: "IBM Plex Mono", monospace; font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  margin: 0 0 14px; border-bottom: 1px solid var(--line); padding-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}

.summary-readout dt {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted); margin-bottom: 4px;
}
.summary-readout dd { margin: 0 0 16px; font-size: 14.5px; }
.summary-readout ul { margin: 4px 0 0; padding-left: 20px; }

.ki-box {
  border: 1px dashed var(--line); border-radius: 4px; padding: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.ki-box-text { font-size: 13.5px; color: var(--muted); max-width: 46ch; }
.ki-box-text strong { color: var(--ink); }

.status-msg { font-size: 13.5px; margin-top: 10px; min-height: 18px; }
.status-msg.ok { color: var(--accent); }
.status-msg.err { color: var(--danger); }

/* ============================= Uebersicht / Index ============================= */
.index-search { margin-bottom: 20px; max-width: 420px; }
.insight-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.insight-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px;
}
.insight-item .insight-text { font-size: 14.5px; margin-bottom: 6px; }
.insight-item .insight-source {
  font-family: "IBM Plex Mono", monospace; font-size: 11.5px; color: var(--muted);
}
.insight-item .insight-source a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.insight-item .insight-source a:hover { color: var(--accent); }

/* ============================= Modal (Buch-Detail) ============================= */
dialog.modal {
  border: 1px solid var(--line); border-radius: 6px; padding: 0;
  background: var(--paper); color: var(--ink);
  width: min(680px, 92vw); max-height: 88vh;
}
dialog.modal::backdrop { background: rgba(10, 11, 13, 0.55); }
.modal-card { display: flex; flex-direction: column; max-height: 88vh; }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 20px 22px 14px; border-bottom: 1px solid var(--line); flex: none;
}
.modal-head h2 { font-size: 18px; margin: 0; }
.modal-close {
  background: none; border: none; font-size: 22px; line-height: 1; cursor: pointer;
  color: var(--muted); padding: 2px 6px;
}
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px; border-top: 1px solid var(--line); flex: none;
}
.modal-tabs { display: flex; gap: 2px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.modal-tab {
  font-family: "IBM Plex Mono", monospace; font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted);
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 8px 4px 8px; margin-right: 16px; cursor: pointer;
}
.modal-tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.modal-pane { display: none; }
.modal-pane.is-active { display: block; }

@media (max-width: 560px) {
  .header-inner { flex-wrap: wrap; }
}
