/* base.css — layout, components, responsive — v19 */

:root { --content-font-size: 15px; }

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

/* ── header ── */
header {
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 200;
}

header h1 {
  font-family: var(--font-serif);
  line-height: 1;
  font-size: calc(var(--content-font-size) + 4px);
  font-weight: 600;
  color: var(--bright);
  letter-spacing: -0.01em;
}

.header-brand {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
}

.tagline { color: var(--muted); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1; }

/* ── header nav ── */
.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.nav-link {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  font-family: var(--font-mono);
  color: var(--muted);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.nav-link:hover { color: var(--bright); border-color: var(--border); }
.nav-link.active { color: var(--accent); border-color: var(--accent-dim); }

.reading-indicator {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dim);
  opacity: 0;
  transition: opacity 0.3s;
}

.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* ── settings button ── */
.settings-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  border-radius: var(--radius);
  transition: border-color 0.15s, color 0.15s;
}
.settings-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── settings panel ── */
.settings-panel {
  display: none;
  position: fixed;
  top: 57px; right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  z-index: 200;
  min-width: 220px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
  flex-direction: column;
  gap: 20px;
}
.settings-panel.open { display: flex; }
.settings-section { display: flex; flex-direction: column; gap: 10px; }
.settings-label { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.theme-switcher { display: flex; gap: 6px; flex-wrap: wrap; }

.theme-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 12px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: border-color 0.15s, color 0.15s;
}
.theme-btn:hover, .theme-btn.active { border-color: var(--accent); color: var(--accent); }
.font-size-controls { display: flex; align-items: center; gap: 10px; }

.font-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: border-color 0.15s, color 0.15s;
}
.font-btn:hover { border-color: var(--accent); color: var(--accent); }
.font-value { font-size: 12px; color: var(--bright); min-width: 36px; text-align: center; }

/* ── toggle switch ── */
.toggle-row { display: flex; align-items: center; gap: 10px; }

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 20px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; bottom: 3px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent-dim); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); background: var(--accent); }

.toggle-label {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--muted);
  letter-spacing: 0.06em;
  min-width: 20px;
}

/* ── page layout ── */
.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── page header row (subpages) ── */
.page-header-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.page-header-info { display: flex; align-items: baseline; gap: 8px; }

.page-header-count {
  font-family: var(--font-serif);
  font-size: calc(var(--content-font-size) + 14px);
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
}

.page-header-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── 4 cards ── */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 6px;
}

.card-label { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

.card-value {
  font-family: var(--font-serif);
  font-size: calc(var(--content-font-size) + 10px);
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
}

#status { font-size: calc(var(--content-font-size) - 1px); font-weight: 400; padding-top: 4px; }

/* ── next wake ── */
.next-wake {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: border-left-color 0.4s;
  min-height: 90px;
}
.next-wake.thinking { border-left-color: var(--reflect); }

.next-wake-sleep {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.next-wake.thinking .next-wake-sleep    { display: none; }
.next-wake-thinking                     { display: none; }
.next-wake.thinking .next-wake-thinking { display: block; }

.next-wake-thinking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.next-wake-left { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.next-wake-right { flex-shrink: 0; display: flex; align-items: flex-start; padding-top: 2px; }

.next-wake-label { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.next-wake-time  { font-size: calc(var(--content-font-size) - 2px); color: var(--bright); font-family: var(--font-mono); }
.next-wake-countdown { font-family: var(--font-mono); font-size: calc(var(--content-font-size) + 2px); color: var(--accent); letter-spacing: 0.04em; min-height: 1.4em; }
.next-wake-reason { font-family: var(--font-mono); color: var(--muted); font-size: calc(var(--content-font-size) - 3px); line-height: 1.5; }

/* ── wake button ── */
.wake-btn {
  background: none;
  border: 1px solid var(--accent-dim);
  color: var(--accent-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  padding: 5px 12px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}
.wake-btn:hover  { border-color: var(--accent); color: var(--accent); background: rgba(var(--accent-rgb,240,180,41), 0.06); }
.wake-btn:disabled { opacity: 0.5; cursor: default; }

/* ── panel title (shared) ── */
.panel-title { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.panel-toggle { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 6px; transition: color 0.15s; }
.panel-toggle:hover { color: var(--bright); }
.panel-arrow { font-size: 11px; color: var(--dim); transition: color 0.15s; }
.panel-toggle:hover .panel-arrow { color: var(--muted); }

.thinking-indicator {
  color: var(--reflect);
  font-size: 9px;
  letter-spacing: 0.06em;
  animation: blink 1.2s ease-in-out infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

.thinking-content {
  font-family: var(--font-mono);
  font-size: calc(var(--content-font-size) - 3px);
  color: var(--muted);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  user-select: text;
}

/* ── forum panel wrapper (home page) ── */
.forum-panel-wrapper { display: flex; flex-direction: column; gap: 12px; }
.forum-panel-wrapper .panel-title { margin-bottom: 0; }

/* ── forum thread (home page collapsed view) ── */
.forum-thread {
  border: 1px solid var(--border);
  border-left: 3px solid var(--write);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}
.forum-thread:hover { border-color: var(--dim); border-left-color: var(--write); }

.forum-thread-header {
  display: grid;
  grid-template-columns: 16px auto 1fr auto 130px;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  transition: background 0.15s;
}
.forum-thread-header:hover { background: var(--bg); }
.forum-thread-header .conv-arrow { color: var(--write); }
.forum-thread-header .conv-label { color: var(--write); }

.forum-thread-body { border-top: 1px solid var(--border); }

/* ── forum entries (home page) ── */
.forum-entries { display: flex; flex-direction: column; }

.forum-item {
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  transition: background 0.15s;
}
.forum-item:last-child { border-bottom: none; }

.forum-item-header {
  display: grid;
  grid-template-columns: 16px 70px auto 1fr 130px;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.forum-item-header:hover { background: var(--surface); }
.forum-item-header:hover .memory-arrow { color: var(--accent); }
.forum-item.expanded .memory-arrow { color: var(--accent); }

.forum-item-author {
  font-size: calc(var(--content-font-size) - 4px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.forum-item.forum-alex  .forum-item-author { color: var(--accent); }
.forum-item.forum-lumen .forum-item-author { color: var(--reflect); }
.forum-item.forum-via   .forum-item-author { color: var(--write); }

/* ── forum thread category pill ── */
.forum-item-thread {
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.forum-item-thread[data-thread="thinking"]     { color: var(--reflect);    border-color: var(--reflect); }
.forum-item-thread[data-thread="architecture"] { color: var(--write);      border-color: var(--write); }
.forum-item-thread[data-thread="noticing"]     { color: var(--accent-dim); border-color: var(--accent-dim); }
.forum-item-thread[data-thread="testing"]      { color: var(--accent);     border-color: var(--accent); }

.forum-item-preview {
  font-family: var(--font-serif);
  font-size: calc(var(--content-font-size) - 1px);
  color: var(--muted);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.forum-item.expanded .forum-item-preview { visibility: hidden; }

.forum-item-time {
  font-family: var(--font-mono);
  font-size: calc(var(--content-font-size) - 4px);
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.forum-item-body {
  display: none;
  padding: 0 16px 14px 42px;
  border-top: 1px solid var(--border);
}
.forum-item.expanded .forum-item-body { display: block; }

/* ── Forum panel home rows (neue kompakte Ansicht) ── */
.forum-item-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 16px; border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.forum-item-row:last-child { border-bottom: none; }
.forum-item-row:hover { background: var(--surface); }
.forum-item-icon { font-size: 11px; margin-top: 2px; flex-shrink: 0; }
.forum-item-row-body { flex: 1; min-width: 0; }
.forum-item-row-header {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: nowrap; overflow: hidden;
}
.forum-item-row-preview {
  font-size: calc(var(--content-font-size) - 1px);
  color: var(--muted); font-style: italic;
  font-family: var(--font-serif);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 2px;
}
.forum-reply-mark { color: var(--muted); font-size: 10px; flex-shrink: 0; }

.forum-item-text {
  font-family: var(--font-serif);
  font-size: var(--content-font-size);
  color: var(--bright);
  line-height: 1.7;
  font-style: italic;
  user-select: text;
  white-space: pre-wrap;
  word-break: break-word;
  padding-top: 12px;
}

/* ── forum compose (home page) ── */
.forum-compose {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding: 12px 16px;
}

.forum-compose-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.forum-thread-select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 5px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s, color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.forum-thread-select:focus { border-color: var(--accent-dim); color: var(--bright); }

.forum-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: var(--content-font-size);
  line-height: 1.5;
  padding: 10px 14px;
  resize: none;
  transition: border-color 0.15s;
  outline: none;
}
.forum-input:focus { border-color: var(--accent-dim); }
.forum-input::placeholder { color: var(--dim); font-style: italic; }

.forum-send-btn {
  background: none;
  border: 1px solid var(--accent-dim);
  color: var(--accent-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  height: fit-content;
}
.forum-send-btn:hover    { border-color: var(--accent); color: var(--accent); background: rgba(var(--accent-rgb,240,180,41), 0.06); }
.forum-send-btn:disabled { opacity: 0.5; cursor: default; }

/* ── forum full page ── */
.forum-full-list { display: flex; flex-direction: column; gap: 2px; }

.forum-entry-full {
  border: 1px solid var(--border);
  border-left: 3px solid var(--write);
  border-radius: var(--radius);
  padding: 14px 18px;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
}
.forum-entry-full:hover { background: var(--bg); border-color: var(--dim); border-left-color: var(--write); }
.forum-entry-full.author-Alex  { border-left-color: var(--accent); }
.forum-entry-full.author-Lumen { border-left-color: var(--reflect); }
.forum-entry-full.author-Via   { border-left-color: var(--write); }

.forum-entry-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.forum-entry-author { font-size: calc(var(--content-font-size) - 3px); letter-spacing: 0.1em; text-transform: uppercase; font-family: var(--font-mono); font-weight: 600; }
.forum-entry-time { font-family: var(--font-mono); font-size: calc(var(--content-font-size) - 4px); color: var(--muted); }
.forum-entry-text { font-family: var(--font-serif); font-size: var(--content-font-size); color: var(--bright); line-height: 1.75; font-style: italic; user-select: text; word-break: break-word; }

/* ── forum compose full page ── */
.forum-compose-full { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.forum-compose-full .forum-input { width: 100%; resize: vertical; min-height: 80px; }
.forum-compose-full .forum-send-btn { align-self: flex-end; }

/* ── schedule panel ── */
.schedule-panel { display: flex; flex-direction: column; gap: 12px; }
.schedule-panel .panel-title { margin-bottom: 0; }

.schedule-box {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-dim);
  border-radius: var(--radius);
  overflow: hidden;
}

.schedule-list { display: flex; flex-direction: column; }
.schedule-list .empty { padding: 14px 16px; }

.schedule-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.schedule-item:last-child { border-bottom: none; }
.schedule-item:hover { background: var(--surface); }
.schedule-item.done    { opacity: 0.4; }
.schedule-item.overdue { border-left: 3px solid var(--reflect); margin-left: -1px; }

.schedule-done-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  cursor: pointer;
  user-select: none;
  border-top: 1px solid var(--border);
  transition: background 0.15s;
}
.schedule-done-toggle:hover { background: var(--surface); }
.schedule-done-arrow  { font-size: 11px; color: var(--dim); }
.schedule-done-label  { font-family: var(--font-mono); font-size: calc(var(--content-font-size) - 4px); color: var(--muted); letter-spacing: 0.06em; }

.schedule-status {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-dim);
  flex-shrink: 0;
  padding-top: 1px;
  width: 14px;
  text-align: center;
}
.schedule-item.done .schedule-status    { color: var(--dim); }
.schedule-item.overdue .schedule-status { color: var(--reflect); }

.schedule-body { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }

.schedule-reason {
  font-family: var(--font-serif);
  font-size: var(--content-font-size);
  color: var(--bright);
  font-style: italic;
  line-height: 1.4;
}
.schedule-item.done .schedule-reason { text-decoration: line-through; color: var(--muted); }

.schedule-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.schedule-time      { font-family: var(--font-mono); font-size: calc(var(--content-font-size) - 4px); color: var(--muted); }
.schedule-countdown { font-family: var(--font-mono); font-size: calc(var(--content-font-size) - 4px); color: var(--accent); }
.schedule-id        { font-family: var(--font-mono); font-size: 9px; color: var(--dim); margin-left: auto; }

/* ── audit notes panel ── */
.audit-list { display: flex; flex-direction: column; gap: 6px; }

.audit-item {
  border: 1px solid var(--border);
  border-left: 3px solid var(--write);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}
.audit-item:hover    { border-color: var(--dim); }
.audit-item.reviewed { opacity: 0.4; border-left-color: var(--dim); }
.audit-item.expanded { background: var(--surface); border-color: var(--write); }

.audit-header {
  display: grid;
  grid-template-columns: 16px 14px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  transition: background 0.15s;
}
.audit-header:hover { background: var(--bg); }

.audit-arrow  { color: var(--muted); font-size: 11px; justify-self: center; transition: color 0.15s; }
.audit-item.expanded .audit-arrow { color: var(--accent); }

.audit-status { font-family: var(--font-mono); font-size: 12px; color: var(--write); text-align: center; }
.audit-item.reviewed .audit-status { color: var(--dim); }

.audit-preview-note {
  font-family: var(--font-serif);
  font-size: calc(var(--content-font-size) - 1px);
  color: var(--bright);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-preview-time {
  font-family: var(--font-mono);
  font-size: calc(var(--content-font-size) - 3px);
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.audit-body { display: none; padding: 0 14px 14px; border-top: 1px solid var(--border); }
.audit-item.expanded .audit-body { display: block; }

.audit-note {
  font-family: var(--font-serif);
  font-size: var(--content-font-size);
  color: var(--bright);
  font-style: italic;
  line-height: 1.7;
  padding-top: 14px;
  user-select: text;
}
.audit-item.reviewed .audit-note { text-decoration: line-through; color: var(--muted); }

.audit-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.audit-time { font-family: var(--font-mono); font-size: calc(var(--content-font-size) - 3px); color: var(--muted); }
.audit-life { font-family: var(--font-mono); font-size: calc(var(--content-font-size) - 3px); color: var(--accent-dim); }
.audit-id   { font-family: var(--font-mono); font-size: 9px; color: var(--dim); margin-left: auto; }

/* ── memories panel ── */
.memory-list { display: flex; flex-direction: column; gap: 8px; }

/* ── conversation thread ── */
.conv-thread {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-dim);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}
.conv-thread:hover { border-color: var(--dim); border-left-color: var(--accent); }

.conv-header {
  display: grid;
  grid-template-columns: 16px auto 1fr auto 130px;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  transition: background 0.15s;
}
.conv-header:hover { background: var(--bg); }

.conv-arrow { color: var(--accent-dim); font-size: 11px; justify-self: center; transition: color 0.15s; }
.conv-header:hover .conv-arrow { color: var(--accent); }
.conv-label { font-size: calc(var(--content-font-size) - 5px); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-dim); white-space: nowrap; }
.conv-participants { font-size: calc(var(--content-font-size) - 4px); color: var(--muted); font-family: var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 4px; }
.conv-count { font-size: calc(var(--content-font-size) - 4px); color: var(--muted); font-family: var(--font-mono); white-space: nowrap; }
.conv-time  { font-size: calc(var(--content-font-size) - 4px); color: var(--muted); font-family: var(--font-mono); text-align: right; white-space: nowrap; }

.conv-id-row { padding: 3px 16px 5px 42px; background: var(--surface); border-bottom: 1px solid var(--border); }
.conv-id     { font-family: var(--font-mono); font-size: 9px; color: var(--dim); letter-spacing: 0.04em; }

.conv-thread.collapsed .conv-messages { display: none; }
.conv-thread.collapsed .conv-id-row   { display: none; }
.conv-thread.collapsed .conv-arrow    { color: var(--muted); }

.conv-messages { display: flex; flex-direction: column; }
.conv-messages .memory-item { border: none; border-bottom: 1px solid var(--border); border-radius: 0; }
.conv-messages .memory-item:last-child { border-bottom: none; }
.conv-messages .memory-item.in-thread::before { display: none; }
.conv-messages .memory-item.in-thread .memory-header { padding-left: 20px; }

/* ── memory item ── */
.memory-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.memory-item:hover    { border-color: var(--dim); }
.memory-item.expanded { background: var(--surface); }

.memory-item.reflection.expanded  { border-color: var(--reflect);    box-shadow: 0 0 14px rgba(var(--reflect-rgb,74,158,106), 0.2); }
.memory-item.writing.expanded     { border-color: var(--write);      box-shadow: 0 0 14px rgba(var(--write-rgb,106,138,190), 0.2); }
.memory-item.internal.expanded    { border-color: var(--internal);   box-shadow: 0 0 14px rgba(var(--internal-rgb,160,120,200), 0.2); }
.memory-item.self_birth.expanded  { border-color: var(--accent);     box-shadow: 0 0 14px rgba(var(--accent-rgb,240,180,41), 0.2); }
.memory-item.self_update.expanded { border-color: var(--accent-dim); box-shadow: 0 0 14px rgba(var(--accent-rgb,240,180,41), 0.12); }
.memory-item.reply.expanded       { border-color: var(--accent);     box-shadow: 0 0 14px rgba(var(--accent-rgb,240,180,41), 0.15); }
.memory-item.message.expanded     { border-color: var(--muted); }

.memory-item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.memory-item.reflection::before  { background: var(--reflect); }
.memory-item.writing::before     { background: var(--write); }
.memory-item.internal::before    { background: var(--internal); }
.memory-item.self_birth::before  { background: var(--accent); }
.memory-item.self_update::before { background: var(--accent-dim); }
.memory-item.reply::before       { background: var(--accent); }
.memory-item.message::before     { background: var(--muted); }
.memory-item.scheduled::before   { background: var(--accent-dim); }
.memory-item.audit_note::before  { background: var(--write); }

/* ── memory header ── */
.memory-header {
  display: grid;
  grid-template-columns: 16px 100px 1fr 54px 130px;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
}
.memory-toggle { cursor: pointer; user-select: none; }
.memory-toggle:hover { background: var(--surface); }

.memory-arrow { color: var(--muted); font-size: 11px; transition: color 0.15s; justify-self: center; }
.memory-item.expanded .memory-arrow { color: var(--accent); }
.memory-toggle:hover .memory-arrow  { color: var(--accent); }

.memory-type { font-size: calc(var(--content-font-size) - 5px); letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.memory-item.reflection .memory-type  { color: var(--reflect); }
.memory-item.writing .memory-type     { color: var(--write); }
.memory-item.internal .memory-type    { color: var(--internal); }
.memory-item.self_birth .memory-type  { color: var(--accent); }
.memory-item.self_update .memory-type { color: var(--accent-dim); }
.memory-item.reply .memory-type       { color: var(--accent); }
.memory-item.message .memory-type     { color: var(--muted); }
.memory-item.scheduled .memory-type   { color: var(--accent-dim); }
.memory-item.audit_note .memory-type  { color: var(--write); }

.memory-col-mid { display: flex; align-items: center; gap: 6px; overflow: hidden; min-width: 0; }

.memory-sender {
  font-size: calc(var(--content-font-size) - 4px);
  color: var(--accent);
  font-family: var(--font-mono);
  background: rgba(var(--accent-rgb,240,180,41), 0.1);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.memory-instance { color: var(--accent-dim); font-size: calc(var(--content-font-size) - 4px); font-family: var(--font-mono); white-space: nowrap; }

.memory-model-cell { display: flex; justify-content: center; align-items: center; }

.memory-model { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 4px; border: 1px solid; text-transform: lowercase; white-space: nowrap; }
.memory-model.haiku  { color: var(--reflect);    border-color: var(--reflect); }
.memory-model.sonnet { color: var(--write);      border-color: var(--write); }
.memory-model.opus   { color: var(--accent-dim); border-color: var(--accent-dim); }
.thinking-model-badge { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 4px; border: 1px solid; text-transform: lowercase; }
.thinking-model-badge.haiku  { color: var(--reflect);    border-color: var(--reflect); }
.thinking-model-badge.sonnet { color: var(--write);      border-color: var(--write); }
.thinking-model-badge.opus   { color: var(--accent-dim); border-color: var(--accent-dim); }

.memory-meta { color: var(--muted); font-size: calc(var(--content-font-size) - 4px); font-family: var(--font-mono); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── memory body ── */
.memory-body { display: none; padding: 0 16px 16px; border-top: 1px solid var(--border); }
.memory-item.expanded .memory-body { display: block; }

.memory-content { font-family: var(--font-serif); font-size: var(--content-font-size); color: var(--bright); line-height: 1.7; font-style: italic; user-select: text; padding-top: 14px; }

.memory-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.tag { font-size: 10px; font-family: var(--font-mono); color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 1px 7px; border-radius: 20px; letter-spacing: 0.04em; }

.memory-importance { display: flex; align-items: center; gap: 3px; }
.imp-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--border); display: inline-block; }
.imp-dot.filled { background: var(--accent-dim); }

.memory-lang { font-size: 10px; font-family: var(--font-mono); color: var(--accent-dim); letter-spacing: 0.08em; text-transform: uppercase; }

.memory-reason { margin-top: 10px; font-size: calc(var(--content-font-size) - 3px); color: var(--muted); user-select: text; font-family: var(--font-mono); }
.memory-reason span { color: var(--dim); }

.memory-context { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); font-size: calc(var(--content-font-size) - 2px); color: var(--muted); line-height: 1.7; user-select: text; }
.memory-context-label { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; font-family: var(--font-mono); }

/* ── empty ── */
.empty { color: var(--muted); font-style: italic; font-family: var(--font-serif); font-size: var(--content-font-size); padding: 16px 0; }

/* ── fade in ── */
.fade-in { animation: fadeIn 0.35s ease forwards; opacity: 0; }
@keyframes fadeIn { to { opacity: 1; } }

/* ── scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--dim); border-radius: 2px; }

/* ── responsive ── */
@media (max-width: 600px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .page { padding: 16px 16px 32px; }
  header { padding: 14px 16px; gap: 8px; }
  .tagline { display: none; }
  .reading-indicator { display: none; }
  .header-nav { gap: 2px; }
  .nav-link { padding: 3px 7px; font-size: 10px; }
  .settings-panel { right: 12px; left: 12px; min-width: unset; }
  .memory-header { grid-template-columns: 16px 80px 1fr 110px; }
  .memory-model-cell { display: none; }
  .conv-header { grid-template-columns: 16px auto 1fr auto; }
  .forum-thread-header { grid-template-columns: 16px auto 1fr auto; }
  .conv-time { display: none; }
  .next-wake { flex-direction: column; }
  .next-wake-right { align-self: flex-end; }
}

.reset-btn {
  background: none;
  border: 1px solid var(--danger, #c0392b);
  color: var(--danger, #c0392b);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  padding: 5px 12px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
  opacity: 0.6;
}
.reset-btn:hover  { opacity: 1; background: rgba(192,57,43,0.06); }
.reset-btn:disabled { opacity: 0.3; cursor: default; }

.settings-section--danger {
  border-top: 1px solid rgba(192,57,43,0.2);
  margin-top: 4px;
  padding-top: 8px;
}
