/* The pages' styles, built on huginn.css (loaded first): its tokens give the
   colours, both themes, the fonts and the focus ring. */
:root {
  --bg: var(--hg-ground);
  --surface: var(--hg-panel);
  --text: var(--hg-text);
  --muted: var(--hg-muted);
  --border: var(--hg-line-strong);
  --accent: var(--hg-accent);
  --accent-text: var(--hg-on-accent);
  --user-bg: var(--hg-active);
  --error: var(--hg-error);
  --ok: var(--hg-ok);
  --private: var(--hg-warm);
  --private-bg: color-mix(in srgb, var(--hg-warm) 14%, var(--hg-panel));
}

html, body { height: 100%; }

body {
  display: flex;
  flex-direction: column;
  font-size: 16px;
  line-height: 1.55;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--hg-line);
  background: var(--hg-aside);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.logo { display: flex; border-radius: 5px; }
.logo img { display: block; }
.meta { color: var(--hg-faint); font-family: var(--hg-mono); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.log {
  flex: 1;
  overflow-y: auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.empty { color: var(--muted); text-align: center; margin: auto 0; }

.msg { max-width: 100%; overflow-wrap: anywhere; }
.msg p { margin: 0 0 0.6em; }
.msg p:last-child { margin-bottom: 0; }

.msg.user {
  align-self: flex-end;
  max-width: 85%;
  background: var(--user-bg);
  padding: 8px 14px;
  border-radius: var(--hg-r-lg) var(--hg-r-lg) 4px var(--hg-r-lg);
  white-space: pre-wrap;
}

.msg.bot {
  align-self: stretch;
  background: var(--surface);
  border: 1px solid var(--hg-line);
  padding: 14px 18px;
  border-radius: var(--hg-r-lg);
}

.msg.pending { color: var(--muted); }
.msg .steps { margin: 0 0 6px; padding-left: 18px; color: var(--muted); font-size: 14px; }
.msg .steps li.running::after { content: " …"; }
.msg .steps li.err { color: var(--error); }
.msg .status { color: var(--muted); font-size: 14px; }
.msg .answer:not(:empty) { color: var(--text); }
.msg.error { color: var(--error); }

details.sources { margin-top: 10px; border-top: 1px solid var(--hg-line-soft); padding-top: 8px; font-size: 14px; }
details.sources summary { cursor: pointer; color: var(--muted); }
.call { margin: 8px 0 0; }
.call-head { color: var(--hg-faint); font-family: var(--hg-mono); font-size: 12px; }
.call ul { margin: 4px 0 0; padding-left: 20px; }
.call li { margin: 2px 0; }
.call .sub { color: var(--muted); }
.call .err { color: var(--error); }
.call li.uncited { opacity: 0.5; }
.call li .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.call li.flash { animation: flash 2s ease-out; border-radius: 4px; }
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 25%, transparent); } to { background: transparent; } }
.msg a.cite { color: var(--accent); text-decoration: none; }
.msg a.cite:hover { text-decoration: underline; }
.msg .unverified { margin-top: 8px; font-size: 14px; color: var(--error); }
.call button.promote { margin-left: 8px; font-size: 12px; padding: 1px 8px; border: 1px solid var(--border); border-radius: 4px; background: none; color: var(--accent); cursor: pointer; }
.call button.promote:disabled { color: var(--muted); cursor: default; }

a { color: var(--accent); }

/* The ask bar: one field with the send button inside its border. */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 760px;
  margin: 0 auto calc(12px + env(safe-area-inset-bottom));
  padding: 6px 6px 6px 16px;
  border: 1px solid var(--hg-field);
  border-radius: 14px;
  background: var(--hg-panel);
}
.composer:focus-within { border-color: var(--accent); }

.composer textarea {
  flex: 1;
  resize: none;
  max-height: 200px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.composer textarea:focus { outline: none; }

/* No specificity, so the components' and pages' own button classes win. */
:where(button) {
  font: inherit;
  border-radius: var(--hg-r);
  padding: 8px 16px;
  cursor: pointer;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}
/* No specificity, so any styled button (.ghost, .rate, …) keeps its own. */
:where(button:hover:not(:disabled)) { background: var(--hg-text); border-color: var(--hg-text); color: var(--hg-ground); }

.actions { display: flex; gap: 8px; }

/* Phones: the title with its meta line on top, the buttons in a row of
   their own (they wrap), the briefing's date picker across the width. */
@media (max-width: 640px) {
  .bar { flex-wrap: wrap; gap: 8px; }
  .brand { flex: 1 1 100%; flex-direction: column; align-items: flex-start; gap: 0; }
  .meta { max-width: 100%; }
  .actions { flex: 1 1 100%; flex-wrap: wrap; gap: 6px; }
  #pick { flex: 1 1 100%; }
}

.msg.note {
  align-self: center;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

button.ghost { background: transparent; color: var(--text); border-color: var(--hg-btn-line); font-size: 14px; font-weight: 500; padding: 6px 12px; white-space: nowrap; }
button.ghost:hover:not(:disabled), .ghost-link:hover { background: var(--hg-raised); color: var(--hg-text-hover); }

/* No-recap mode: the toggle, a bar above the composer, and the questions
   asked in it marked, so nobody wonders later why a note is missing. */
button.ghost[aria-pressed="true"] { color: var(--private); border-color: var(--private); background: var(--private-bg); }
.private-bar { padding: 6px 16px; text-align: center; font-size: 14px; color: var(--private); background: var(--private-bg); border-top: 1px solid var(--private); }
.msg.user.private { background: var(--private-bg); outline: 1px dashed var(--private); }
.msg.user.private::before { content: "privat · "; color: var(--private); font-size: 13px; }
button:disabled { opacity: 0.5; cursor: default; }

/* Admin page (admin.html): scrolling cards instead of the chat's fixed layout. */
body.admin { display: block; height: auto; min-height: 100%; }
body.admin .bar { position: sticky; top: 0; z-index: 1; }
.ghost-link { white-space: nowrap; color: var(--text); text-decoration: none; border: 1px solid var(--hg-btn-line); border-radius: var(--hg-r); padding: 6px 12px; font-size: 14px; font-weight: 500; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; padding: 16px; max-width: 1200px; margin: 0 auto; }
.card { background: var(--surface); border: 1px solid var(--hg-line); border-radius: var(--hg-r-lg); padding: 16px 20px; min-width: 0; }
.card.wide { grid-column: 1 / -1; }
.card h2 { font-size: 17px; font-weight: 500; line-height: 1.35; margin: 0 0 10px; }
/* Subheads as eyebrows: small mono capitals. */
.card h3 { font-family: var(--hg-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; margin: 14px 0 6px; color: var(--hg-faint); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--error); }
.row { margin: 0 0 8px; }
.pill { display: inline-block; white-space: nowrap; font-family: var(--hg-mono); font-size: 11px; letter-spacing: 0.04em; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; }
.pill.ok { color: var(--ok); }
.pill.warn { color: var(--hg-warm); }
.pill.bad { color: var(--error); }
.bar-track { height: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin: 4px 0 10px; }
.bar-fill { height: 100%; background: var(--accent); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 16px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
pre.log { font: 12px/1.45 var(--hg-mono); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0; max-height: 320px; }
ul.checks { list-style: none; margin: 0; padding: 0; }
ul.checks li { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; flex-wrap: wrap; }
ul.checks .name { font-weight: 500; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--error); }
.dot.off { background: var(--border); }
.table-wrap { overflow-x: auto; margin-bottom: 8px; }
.card table { border-collapse: collapse; width: 100%; font-size: 14px; }
.card th, .card td { text-align: left; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--hg-line-soft); vertical-align: top; }
.card th { color: var(--muted); font-weight: 500; white-space: nowrap; }
.card td details summary { cursor: pointer; }
details.trace { border-top: 1px solid var(--hg-line-soft); padding: 6px 0; }
details.trace > summary { cursor: pointer; }
details.trace .answer { white-space: pre-wrap; margin: 6px 0; font-size: 14px; }
details.raw { margin-top: 6px; }
details.raw summary { cursor: pointer; }

/* Lektüre */
.add-form { display: flex; flex-direction: column; gap: 8px; }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.add-form textarea, .add-form input[type=url], .add-form input[type=text], .add-form input[type=datetime-local] {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; min-width: 0;
}
.add-form textarea { resize: vertical; min-height: 96px; }
/* Search playground (admin.js) */
#search select, #search input[type=number] {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; min-width: 0;
}
#search input[type=number] { width: 7.5em; padding: 4px 8px; margin-left: 4px; }
#search label input[type=text] { padding: 4px 8px; margin-left: 4px; width: 10em; flex: none; }
#search .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
#search tr.dim td { color: var(--muted); }
#search .up { color: var(--ok); }
#search .down { color: var(--error); }
#search td details summary { overflow-wrap: anywhere; }
.add-form input[type=url], .add-form input[type=text] { flex: 1 1 260px; }
.dropzone { flex: 1 1 260px; border: 1px dashed var(--border); border-radius: 10px; padding: 8px 10px; color: var(--muted); cursor: pointer; font-size: 14px; overflow-wrap: anywhere; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone.over, .dropzone:focus-within { border-color: var(--accent); color: var(--text); }
.dropzone.has-file { border-style: solid; color: var(--text); }
.add-form p { margin: 0; }
/* News import (news-import.js): the paste fields open when the page gives only the teaser. */
#ni-more:not([hidden]) { display: flex; flex-direction: column; gap: 8px; }
#ni-list ul.checks li { align-items: center; }
details.ni-imports { border-top: 1px solid var(--hg-line-soft); padding-top: 8px; }
details.ni-imports > summary { cursor: pointer; color: var(--muted); font-size: 14px; }
#ni-list button.ghost { margin-left: auto; font-size: 13px; padding: 2px 10px; }
tr.selected td { background: var(--bg); }
/* What Huginn wrote to be read (analyses, briefing points, match summaries) in the serif. */
.summary { margin: 4px 0 8px; font-family: var(--hg-serif); font-size: 17px; line-height: 1.6; color: var(--hg-text-read); }
ol.plain-list, ul.plain-list { margin: 0 0 4px; padding-left: 22px; font-size: 14px; }
ol.plain-list li, ul.plain-list li { margin: 3px 0; }
.detail-foot { justify-content: flex-end; margin-top: 12px; }
.detail-foot > span:first-child { margin-right: auto; }
button.ghost.danger { color: var(--error); }

/* Beobachten: the add form's radio buttons, checkboxes and threshold; one
   card per watch with its actions on the right, read matches dimmed. */
.card-list { grid-column: 1 / -1; display: grid; gap: 16px; }
.choice { white-space: nowrap; margin-right: 10px; font-size: 14px; }
.add-form input[type=number] {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px 8px; width: 6em; margin-left: 4px;
}
.add-form details summary { cursor: pointer; color: var(--muted); }
.add-form details .add-row { margin-top: 8px; }
.watch-head { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.watch-head h2 { margin: 0; }
.watch-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.card.watch p { margin: 4px 0; }
ul.matches li { margin: 6px 0 10px; }
ul.matches li.read { opacity: 0.6; }
.match-summary { margin: 3px 0 0; font-family: var(--hg-serif); font-size: 15px; line-height: 1.5; color: var(--hg-text-read); }
button.ghost.small-btn { font-size: 12px; padding: 1px 8px; }


/* Briefing */
.card.briefing h3 { margin-top: 14px; }
ul.points { margin: 4px 0 8px; padding-left: 20px; font-family: var(--hg-serif); font-size: 17px; line-height: 1.6; color: var(--hg-text-read); }
ul.points li { margin: 6px 0; }
ul.points a.cite { font-size: 12px; text-decoration: none; }
ul.points .unverified { color: var(--muted); font-size: 13px; }
ul.sources .n { color: var(--muted); font-variant-numeric: tabular-nums; }
details.off { margin-top: 10px; }
details.off summary { cursor: pointer; }
/* The overview: one tile per topic, opening its section (#t-<topic>);
   topics with nothing new as small dimmed tiles at the end. */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 16px; padding: 16px; max-width: 1200px; margin: 0 auto; }
.tile { display: flex; flex-direction: column; gap: 6px; min-width: 0; background: var(--surface); border: 1px solid var(--hg-line); border-radius: var(--hg-r-lg); padding: 16px 18px; color: var(--text); text-decoration: none; transition: border-color 0.15s, transform 0.15s; }
a.tile:hover { border-color: var(--accent); transform: translateY(-1px); }
a.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile h2 { font-size: 16px; margin: 0; line-height: 1.3; }
.tile-meta { margin: 0; font-size: 13px; color: var(--muted); }
.tile-count { font-family: var(--hg-mono); font-size: 22px; font-weight: 500; color: var(--accent); font-variant-numeric: tabular-nums; margin-right: 2px; }
.tile-teaser { margin: 0; font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.tile-more { margin: auto 0 0; font-size: 13px; color: var(--accent); }
/* The heatmap above the tiles: topics × days, one accent hue in five
   steps over the card (sequential, light to dark; in dark mode the same
   mix over the dark card); a day without the topic has no fill. */
.heat { grid-column: 1 / -1; background: var(--surface); border: 1px solid var(--hg-line); border-radius: var(--hg-r-lg); padding: 14px 18px 12px; min-width: 0; }
.heat[hidden] { display: none; }
.heat-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; margin-bottom: 10px; }
.heat-head h2 { font-size: 15px; margin: 0; }
.heat-legend { display: flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); font-family: var(--hg-mono); }
.heat-legend span:first-child { margin-right: 4px; }
.heat-legend span:last-child { margin-left: 4px; }
.heat-swatch { width: 12px; height: 12px; border-radius: 3px; }
.heat-scroll { overflow-x: auto; }
.heat-grid { display: grid; gap: 3px; min-width: max-content; }
.heat-row { display: grid; grid-template-columns: minmax(120px, 200px) repeat(var(--days), 16px); gap: 3px; align-items: center; }
.heat-topic { position: sticky; left: 0; z-index: 1; background: var(--surface); font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; align-self: stretch; display: flex; align-items: center; }
@media (max-width: 720px) {
  .heat { padding: 12px 12px 10px; }
  .heat-row { grid-template-columns: minmax(84px, 120px) repeat(var(--days), 16px); }
}
.heat-days { margin-bottom: 2px; }
.heat-day { font-size: 11px; font-family: var(--hg-mono); color: var(--muted); white-space: nowrap; overflow: visible; height: 14px; }
.heat-day.is-shown { box-shadow: inset 0 -2px 0 var(--accent); }
.heat-cell { width: 16px; height: 16px; border-radius: 4px; border: 0; padding: 0; margin: 0; display: block; }
button.heat-cell { cursor: pointer; }
button.heat-cell:hover, button.heat-cell:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.heat-cell.has-error { box-shadow: inset 0 0 0 1.5px var(--error); }
.heat-none { background: transparent; box-shadow: inset 0 0 0 1px var(--hg-line-soft); }
.heat-l0 { background: color-mix(in oklab, var(--accent) 7%, var(--surface)); box-shadow: inset 0 0 0 1px var(--hg-line); }
.heat-l1 { background: color-mix(in oklab, var(--accent) 22%, var(--surface)); }
.heat-l2 { background: color-mix(in oklab, var(--accent) 40%, var(--surface)); }
.heat-l3 { background: color-mix(in oklab, var(--accent) 58%, var(--surface)); }
.heat-l4 { background: color-mix(in oklab, var(--accent) 78%, var(--surface)); }
.heat-l5 { background: var(--accent); }
.heat-tip { position: absolute; z-index: 20; max-width: 320px; background: var(--surface); color: var(--text); border: 1px solid var(--hg-line-strong); border-radius: var(--hg-r-sm); padding: 8px 10px; font-size: 13px; line-height: 1.4; box-shadow: 0 4px 16px rgb(0 0 0 / 0.12); pointer-events: none; }
.heat-tip[hidden] { display: none; }
.heat-tip p { margin: 0; }
.heat-tip-value strong { font-family: var(--hg-mono); font-size: 15px; }
.heat-tip-topic { color: var(--muted); }
.heat-tip ul { margin: 6px 0 0; padding-left: 16px; }
.heat-tip li { margin: 2px 0; }
.overview-bar { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tile.add-tile { flex-direction: row; align-items: center; justify-content: center; gap: 8px; border-style: dashed; color: var(--accent); font-weight: 600; min-height: 72px; align-self: start; }
.add-plus { font-size: 22px; line-height: 1; }
.tile.quiet { opacity: 0.55; padding: 10px 16px; border-style: dashed; align-self: start; }
.tile.quiet h2 { font-size: 14px; font-weight: 500; }
.topic-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.topic-nav a { text-decoration: none; }
.topic-step { display: flex; gap: 16px; flex-wrap: wrap; }
.topic-nav + .card.briefing > h2 { font-size: 20px; }
@media (max-width: 640px) {
  .tiles { gap: 10px; padding: 10px; }
  .tile { padding: 12px 14px; gap: 4px; }
  .tile-teaser { -webkit-line-clamp: 3; }
}
#pick { font: inherit; font-size: 14px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 4px 6px; }

/* Thumbs up/down (rate.js) */
.rate { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.msg .rate { display: flex; margin-top: 8px; }
.rate button { font-size: 13px; line-height: 1; padding: 3px 6px; border: 1px solid transparent; border-radius: 6px; background: none; cursor: pointer; opacity: 0.45; filter: grayscale(1); }
.rate button:hover { opacity: 0.8; }
.rate button[aria-pressed="true"] { opacity: 1; filter: none; border-color: var(--border); background: var(--bg); }
.rate .rate-msg { color: var(--muted); font-size: 12px; }
.rate-note { flex: 1 1 220px; display: flex; }
.rate-note input { flex: 1; font: inherit; font-size: 14px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; }
li .rate { margin-left: 6px; vertical-align: middle; }

/* Login (login.html) and who is logged in (user.js) */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(100%, 360px); display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.login-card[hidden] { display: none; }
.login-card h1 { display: flex; align-items: center; gap: 10px; font-size: 20px; margin: 0 0 4px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.login-card input { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.login-card p { margin: 0; }
.who { align-self: center; font-size: 14px; color: var(--muted); white-space: nowrap; padding-left: 4px; }

/* The briefing topics' editor (topics.js, #themen) */
.topic-top h2 { margin: 10px 0 4px; }
.topic-top p { margin: 4px 0; }
.ok-text { color: var(--ok); }
.topic-title { background: none; border: 0; padding: 0; color: var(--text); font-weight: 600; font-size: 16px; text-align: left; cursor: pointer; }
.topic-form { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.tf { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tf-row .tf { flex: 1 1 160px; }
.tf-label { font-size: 13px; font-weight: 600; }
.tf-hint { font-size: 12px; color: var(--muted); }
.tf input, .tf textarea { font: inherit; font-size: 14px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; min-width: 0; }
.tf textarea { resize: vertical; }
.tf-row { display: flex; gap: 12px; flex-wrap: wrap; }
.topic-preview { margin-top: 10px; }
.preview-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.preview-table tr.dim td { color: var(--muted); }
.preview-table tr.dim td a { color: var(--muted); }
.preview-table tr.cut-line td { text-align: center; color: var(--accent); font-size: 12px; border-bottom: 2px solid var(--accent); }

/* "folge Thema X" in the chat (app.js offerFollow) */
.msg.follow p { margin: 0 0 8px; }
.follow-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.msg.follow p.small { margin: 8px 0 0; }
.topic-watch { margin: -4px 0 8px; }

/* Phones and touch: fields at 16px (iOS Safari zooms into anything smaller
   on focus), controls at least the tap size where a finger aims at them. */
@media (max-width: 640px) {
  input, textarea, select, #pick, .tf input, .tf textarea, .rate-note input, .login-card input { font-size: 16px; }
}
@media (pointer: coarse) {
  button.ghost, .ghost-link { min-height: 40px; display: inline-flex; align-items: center; }
  .composer button { min-height: var(--hg-tap); }
}
@media (prefers-reduced-motion: reduce) {
  .tile, a.tile:hover { transition: none; transform: none; }
  .call li.flash { animation: none; }
}

/* Lektüre: the list of items, and one item in the reader (hg-reader in
   huginn.css): text on the left, analysis beside it, sticky while the text
   scrolls; up to 940px one of the two, switched in the top bar. */
#list .list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
#list .list-head h2 { margin: 0; }
ul.reading-items { list-style: none; margin: 0; padding: 0; }
.reading-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 8px; margin: 0 -8px; border-top: 1px solid var(--hg-line-soft);
  border-radius: var(--hg-r-sm); color: var(--text); text-decoration: none;
}
ul.reading-items li:first-child .reading-item { border-top: 0; }
.reading-item:hover { background: var(--hg-raised); }
.reading-item__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.reading-item__title { font-weight: 500; overflow-wrap: anywhere; }
.reading-item .pill { flex: none; }

.hg-reader[hidden], #overview[hidden] { display: none; }
.reader-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.reader-actions .hg-btn { height: 38px; font-size: 14px; padding: 0 14px; }
.hg-btn.reader-danger { color: var(--error); }
.reader-panes { display: none; }
.reader-lead { font-family: var(--hg-serif); font-size: 20px; line-height: 1.6; color: var(--hg-text); padding-left: 16px; border-left: 2px solid var(--accent); }
.reader-text > * + * { margin-top: 1.1em; }
.reader-text h2 { font-size: 22px; font-weight: 500; line-height: 1.3; margin-top: 1.6em; }
.reader-text h3 { font-size: 18px; font-weight: 500; line-height: 1.35; margin-top: 1.4em; }
.hg-article .reader-text p.keep-lines { white-space: pre-line; }
.reader-pre { font: 13px/1.5 var(--hg-mono); color: var(--hg-text-2); background: var(--hg-raised); border-radius: var(--hg-r-sm); padding: 12px 14px; margin: 0; overflow-x: auto; white-space: pre; }
.reader-claim__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.reader-claim__more { align-self: flex-start; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-align: left; }
.reader-claim__more:hover { text-decoration: underline; }
.reader-snippet { font-size: 13px; color: var(--hg-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
a.hg-connection { color: var(--text); text-decoration: none; }
#r-entities { gap: 8px; }
.hg-companion .hg-tab { white-space: nowrap; padding: 0 8px; }
.tab-n { font-family: var(--hg-mono); font-size: 12px; color: var(--hg-faint); }
#r-error:empty { display: none; }
.reader-companion { display: flex; flex-direction: column; gap: 28px; }
@media (min-width: 941px) {
  .reader-companion { position: sticky; top: 24px; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); overflow-y: auto; }
}
@media (max-width: 940px) {
  .reader-panes { display: flex; }
  .reader-eyebrow { display: none; }
  .reader-panes .hg-tab { min-height: 36px; padding: 0 14px; }
  .hg-reader[data-pane="text"] .hg-companion,
  .hg-reader[data-pane="analysis"] .hg-article { display: none; }
  .hg-reader .hg-companion { flex-basis: 100%; border-left: 0; }
}

/* The overview (dashboard.html, "/"): the hg-app shell from huginn.css,
   a card per page with what's new there. */
.hg-brand { color: var(--text); text-decoration: none; }
.hg-brand img { display: block; border-radius: 6px; }
.hg-nav a { text-decoration: none; }
.hg-nav a svg { flex: none; }
.hg-source .hg-mono { font-size: 11px; }
.dash-user:empty { display: none; }
.dash-user { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.dash-user .who { padding: 0; font-size: 14px; color: var(--hg-text); }
.hg-main .hg-header { margin-bottom: -8px; }
.hg-ask .hg-btn { flex: none; }
.dash-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dash-briefing { display: inline-block; margin-top: 8px; }
.dash-briefing[hidden] { display: none; }
.dash-count { margin: 0; display: flex; align-items: baseline; gap: 4px; }
.dash-count__n { font-family: var(--hg-mono); font-size: 34px; font-weight: 500; line-height: 1; color: var(--accent); }
.dash-match a.hg-post__who { color: var(--text); text-decoration: none; font-size: 15px; }
.dash-match a.hg-post__who:hover { color: var(--accent); }
.dash-match { align-items: flex-start; }
.dash-match .hg-post__body { flex: 1 1 auto; min-width: 0; }
button.ghost.dash-read { flex: none; font-size: 13px; padding: 2px 10px; }
.dash-clamp { margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
ul.dash-list { list-style: none; margin: 0; padding: 0; }
.dash-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  padding: 10px 8px; margin: 0; border-top: 1px solid var(--hg-line-soft); border-radius: var(--hg-r-sm);
  color: var(--text); text-decoration: none; text-align: left;
}
ul.dash-list li:first-child .dash-row { border-top-color: transparent; }
.dash-row:hover { background: var(--hg-raised); }
button.dash-row--button { background: none; border-width: 1px 0 0; border-style: solid; border-color: var(--hg-line-soft); border-radius: var(--hg-r-sm); font-weight: 400; cursor: pointer; }
.dash-row__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash-row__title { overflow-wrap: anywhere; }
.dash-row .pill { flex: none; }
.dash-stocks .hg-ticker:first-child { border-top: 0; }
.dash-stocks .hg-ticker { position: relative; }
button.dash-ticker { flex: 1; display: flex; align-items: center; gap: 14px; min-width: 0; padding: 0; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.dash-ticker:hover .hg-ticker__sym { color: var(--accent); }
.dash-ticker .hg-ticker__id { flex: 0 1 200px; min-width: 0; }
.dash-ticker .hg-ticker__spark { flex: 1 1 48px; min-width: 40px; max-width: 320px; }
.dash-ticker .hg-ticker__val { flex: none; white-space: nowrap; }
.dash-ticker .hg-ticker__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-ticker__err { font-size: 12px; color: var(--hg-warm); }
.dash-stock-rm { flex: none; width: 28px; height: 28px; padding: 0; border: 0; background: none; color: var(--hg-faint); cursor: pointer; border-radius: var(--hg-r-sm); }
.dash-stock-rm:hover { color: var(--hg-warm); background: var(--hg-raised); }
.dash-stock-add[hidden] { display: none; }
.dash-stock-add { flex-wrap: wrap; }
.dash-stock-add .hg-input { flex: 1 1 100%; min-width: 0; }
.dash-stock-add .dash-stock-group { flex: 1 1 0; }
.dash-stock-tabs .hg-chip { min-height: 30px; padding: 0 12px; }
.dash-suggest { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 720px) {
  .hg-main .hg-display { font-size: 30px; }
  .hg-ask { padding-left: 14px; }
  .hg-ask .hg-btn { padding: 0 14px; }
}
@media (min-width: 721px) {
  .hg-app > .hg-sidebar { position: sticky; top: 0; align-self: flex-start; height: 100vh; height: 100dvh; overflow-y: auto; }
}

/* Every page in the shell (nav.js builds the sidebar): the page's own
   header bar and content in .hg-page beside it. The chat keeps its fixed
   height, its log scrolling between the bar and the ask bar. */
.hg-app > .hg-page { flex: 999 1 560px; min-width: 0; }
.hg-page .bar { background: var(--hg-ground); }
.hg-page .bar .name { font-size: 17px; font-weight: 500; }
body.chat { display: block; }
body.chat .hg-app { height: 100%; flex-wrap: nowrap; }
body.chat .hg-page { height: 100%; display: flex; flex-direction: column; }
@media (max-width: 720px) {
  body.chat .hg-app { flex-direction: column; }
  body.chat .hg-app > .hg-sidebar { flex: none; }
  body.chat .hg-page { flex: 1; height: auto; min-height: 0; }
  /* One row each: the strip with "Abmelden" at its end (the name is on
     the overview), then the page's title and actions. */
  .hg-sidebar { flex-wrap: nowrap; }
  .hg-sidebar .dash-user:not(:empty) { display: flex; flex: none; flex-basis: auto; margin: 0; padding: 0; border: 0; background: none; }
  .hg-sidebar .dash-user .who { display: none; }
  .hg-sidebar .hg-brand { font-size: 0; gap: 0; }
  .hg-sidebar .hg-nav a { padding: 0 9px; }
  .hg-sidebar .hg-nav__label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .hg-sidebar .dash-user button { padding: 6px 10px; font-size: 13px; }
  .hg-page .bar { flex-wrap: nowrap; padding: 8px 16px; }
  .hg-page .bar .brand { flex: 1 1 auto; flex-direction: row; align-items: baseline; gap: 8px; min-width: 0; }
  .hg-page .bar .actions { flex: 0 1 auto; justify-content: flex-end; }
}

/* ---------- Muninn (muninn.html): the graph with the note beside it ---------- */
.mn-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 16px; border-bottom: 1px solid var(--hg-line); }
.mn-search { flex: 1 1 200px; max-width: 320px; min-width: 0; height: 36px; padding: 0 12px; background: var(--hg-ground); border: 1px solid var(--hg-field); border-radius: var(--hg-r); color: var(--hg-text); font-size: 16px; }
.mn-search:focus { outline: none; border-color: var(--hg-accent); }
.mn-types { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; padding: 0; border: 0; }
.mn-type { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--hg-text-2); cursor: pointer; white-space: nowrap; }
.mn-swatch { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.mn-range select { height: 36px; padding: 0 8px; background: var(--hg-ground); color: var(--hg-text); border: 1px solid var(--hg-field); border-radius: var(--hg-r); }
.mn-stage { flex: 1; min-height: 0; display: flex; }
.mn-graph { position: relative; flex: 1; min-width: 0; overflow: hidden; }
.mn-graph canvas { display: block; touch-action: none; }
.mn-empty { position: absolute; inset: 40% 16px auto; text-align: center; margin: 0; }
.mn-tip[hidden] { display: none; }
.mn-tip { position: absolute; z-index: 1; max-width: 260px; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; background: var(--hg-panel); border: 1px solid var(--hg-line-strong); border-radius: var(--hg-r-sm); font-size: 14px; pointer-events: none; }
.mn-note { flex: 0 0 min(460px, 45%); min-width: 0; overflow-y: auto; border-left: 1px solid var(--hg-line); background: var(--hg-panel); padding: 16px 20px 32px; }
.mn-note[hidden] { display: none; }
.mn-note__head { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--hg-line-soft); }
.mn-note__title { margin: 0; font-size: 19px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.mn-note__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mn-note__actions [hidden] { display: none; }
.mn-note__body { font-size: 15px; line-height: 1.6; color: var(--hg-text-read); overflow-wrap: anywhere; }
.mn-note__body :where(h3, h4, h5, h6) { font-size: 16px; font-weight: 500; margin: 20px 0 6px; color: var(--hg-text); }
.mn-note__body p { margin: 0 0 10px; }
.mn-note__body ul, .mn-note__body ol { margin: 0 0 10px; padding-left: 22px; }
.mn-note__body pre { font: 13px/1.45 var(--hg-mono); background: var(--hg-raised); border-radius: var(--hg-r-sm); padding: 8px 10px; overflow-x: auto; }
.mn-note__body code { font-family: var(--hg-mono); font-size: 0.9em; }
.mn-note__body blockquote { margin: 0 0 10px; padding-left: 12px; border-left: 2px solid var(--hg-line-strong); color: var(--hg-text-2); }
.mn-note__body hr { border: 0; border-top: 1px solid var(--hg-line); margin: 16px 0; }
.mn-callout { margin: 0 0 10px; padding: 8px 12px; border: 1px solid var(--hg-line); border-radius: var(--hg-r-sm); background: var(--hg-raised); font-size: 14px; }
.mn-callout summary, .mn-callout__title { cursor: pointer; font-weight: 500; color: var(--hg-text-2); margin: 0 0 4px; }
.mn-table { overflow-x: auto; margin: 0 0 10px; }
.mn-table table { border-collapse: collapse; font-size: 14px; }
.mn-table th, .mn-table td { border: 1px solid var(--hg-line); padding: 4px 8px; text-align: left; }
.mn-fn { font-size: 13px; color: var(--hg-text-2); }
.mn-fnref { color: var(--hg-accent); font-size: 0.75em; }
a.mn-wl { color: var(--hg-accent); text-decoration: none; }
a.mn-wl:hover { text-decoration: underline; }
a.mn-wl--open { opacity: 0.75; }
.mn-wl--none { color: var(--hg-text-2); }
@media (max-width: 720px) {
  .mn-tools { padding: 8px 16px; }
  .mn-search { max-width: none; }
  .mn-stage { flex-direction: column; }
  .mn-graph { flex: 1 1 50%; min-height: 240px; }
  .mn-note { flex: 1 1 50%; border-left: 0; border-top: 1px solid var(--hg-line); padding: 12px 16px 24px; }
}

/* Muninn's knowledge graph mode ("Wissen") */
.mn-mode { display: inline-flex; gap: 4px; }
.mn-mode button[aria-pressed="true"] { background: var(--hg-raised); border-color: var(--hg-accent); color: var(--hg-text); }
.mn-find { position: relative; flex: 1 1 200px; max-width: 320px; min-width: 0; display: flex; }
.mn-find .mn-search { max-width: none; }
.mn-results { position: absolute; top: 100%; left: 0; right: 0; z-index: 3; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--hg-panel); border: 1px solid var(--hg-line-strong); border-radius: var(--hg-r-sm); max-height: 50vh; overflow-y: auto; }
.mn-results[hidden] { display: none; }
.mn-results li.muted { padding: 6px 8px; font-size: 14px; }
.mn-results button { display: block; width: 100%; text-align: left; padding: 6px 8px; background: none; border: 0; border-radius: var(--hg-r-sm); color: var(--hg-text); cursor: pointer; font-size: 14px; }
.mn-results button:hover, .mn-results button:focus-visible { background: var(--hg-raised); }
.mn-types[hidden] { display: none; }
#mn-kg-all[hidden] { display: none; }
.mn-kg-button { margin-top: 12px; }
.mn-note__body h3 { font-family: var(--hg-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--hg-faint); margin: 18px 0 6px; }
.mn-mentions, .mn-related { margin: 0 0 6px; padding-left: 0; list-style: none; font-size: 14px; }
.mn-mentions li, .mn-related li { padding: 3px 0; }
.mn-related { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.mn-relations { margin: 0 0 6px; padding-left: 0; list-style: none; font-size: 14px; }
.mn-relations li { padding: 6px 0; border-bottom: 1px solid var(--hg-line); }
.mn-relations li:last-child { border-bottom: 0; }
.mn-rel-label { color: var(--hg-muted); }
.mn-rel-sentence { display: block; margin: 2px 0; color: var(--hg-muted); font-size: 13px; overflow-wrap: anywhere; }

/* An entity's page (/begriff, begriff.js). */
.be-search input { width: min(260px, 40vw); }
@media (max-width: 640px) {
  .hg-page .bar:has(.be-search) { flex-wrap: wrap; }
  .be-search, .be-search input { width: 100%; }
}
.be-about .be-lead { font-family: var(--hg-serif); font-size: 16px; line-height: 1.55; margin: 0 0 10px; color: var(--hg-text-read); max-width: 72ch; }
.be-chart { position: relative; }
.be-chart svg { display: block; width: 100%; height: 120px; }
.be-bar { fill: var(--hg-accent); }
.be-bar.is-hot { fill: var(--hg-text); }
.be-hit { fill: transparent; cursor: default; outline: none; }
.be-base { stroke: var(--hg-line-strong); stroke-width: 1; }
.be-tip { position: absolute; top: -6px; transform: translate(-50%, -100%); background: var(--hg-panel); border: 1px solid var(--hg-line-strong); border-radius: var(--hg-r-sm); padding: 3px 8px; font-size: 12px; white-space: nowrap; pointer-events: none; color: var(--hg-text); }
.be-axis { display: flex; justify-content: space-between; margin: 4px 0 8px; }
.be-price { display: flex; align-items: baseline; gap: 12px; margin: 4px 0; }
.be-price__value { font-size: 22px; }
.be-price__change.is-up { color: var(--hg-accent); }
.be-price__change.is-down { color: var(--hg-warm); }
.be-spark { display: block; width: 100%; height: 48px; color: var(--hg-accent); margin: 6px 0 2px; }
.be-spark polyline { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.be-rel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.be-reject { flex: none; padding: 2px 8px; min-height: 0; }
a.mn-entity, a.mn-note-link { color: var(--hg-accent); text-decoration: none; }
a.mn-entity:hover, a.mn-note-link:hover { text-decoration: underline; }
.mn-connect { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.mn-connect input { flex: 1 1 160px; min-width: 0; height: 36px; padding: 0 10px; background: var(--hg-ground); border: 1px solid var(--hg-field); border-radius: var(--hg-r); color: var(--hg-text); font-size: 16px; }
.mn-connection { flex-basis: 100%; font-size: 14px; }
@media (max-width: 720px) {
  .mn-find { max-width: none; }
}

/* /admin: invite links */
.invites { margin-top: 16px; }
.invites h3 { margin: 0 0 8px; font-size: 1rem; }
.invite-link { display: flex; gap: 8px; margin: 10px 0 4px; }
.invite-link input { flex: 1; min-width: 0; font-family: var(--hg-mono); font-size: 0.85rem; }

/* /ueber: the about page, one readable column */
.about { display: grid; gap: 16px; padding: 16px; max-width: 760px; margin: 0 auto; }
.about .card h2 { margin-top: 0; }
.about p { line-height: 1.6; margin: 0 0 10px; }
.about p:last-child { margin-bottom: 0; }
.about-list { margin: 0; }
.about-list dt { font-weight: 600; margin-top: 14px; }
.about-list dt:first-child { margin-top: 0; }
.about-list dd { margin: 4px 0 0; line-height: 1.6; color: var(--hg-text-2); }
.about-notes { margin: 0; padding-left: 20px; display: grid; gap: 10px; line-height: 1.6; }
.about-costs { width: 100%; }
.about-costs td:last-child, .about-costs th:last-child { text-align: right; white-space: nowrap; }
.about-costs td .small { display: block; }
.about-costs tfoot th { border-top: 1px solid var(--hg-line, currentColor); padding-top: 8px; }
.about-coffee__btn { display: inline-block; padding: 10px 18px; border-radius: 10px; background: var(--hg-accent); color: var(--hg-on-accent); text-decoration: none; font-weight: 600; }
.about-coffee__btn:hover { filter: brightness(1.08); }
