/* immobot – one small stylesheet on top of Pico 2 (loaded after it in base.html).
   Sections: tokens · base · header/nav · building blocks (card, flash, badge, chip, buttons) ·
   listings · listing detail · gallery/lightbox · settings · credentials · status · login. Mobile first. */

/* ---------- tokens (light / dark, same selectors as Pico so ours win) ---------- */
:root {
  --pico-font-size: 100%;
  --pico-border-radius: .5rem;
  --pico-form-element-spacing-vertical: .6rem;
  --pico-form-element-spacing-horizontal: .8rem;
  --radius: .85rem;
  --radius-sm: .55rem;
  --gap: 1rem;
}
@media (min-width: 1024px) { :root { --pico-font-size: 103%; } }

:root:not([data-theme=dark]) {
  --pico-background-color: #f4f5f7;
  --pico-color: #2b3038;
  --pico-muted-color: #5f6875;
  --pico-muted-border-color: #e3e6eb;
  --pico-h1-color: #191d23;
  --pico-h2-color: #222831;
  --pico-h3-color: #2b3038;
  --pico-primary: #0b6b63;
  --pico-primary-background: #0f766e;
  --pico-primary-underline: rgba(15, 118, 110, .45);
  --pico-primary-hover: #0a534d;
  --pico-primary-hover-background: #0c625b;
  --pico-primary-focus: rgba(15, 118, 110, .3);
  --pico-primary-inverse: #fff;
  --pico-secondary: #535d6c;
  --pico-secondary-background: #535d6c;
  --pico-secondary-hover-background: #434b57;
  --pico-card-background-color: #fff;
  --pico-card-border-color: #e3e6eb;
  --pico-card-sectioning-background-color: #fafbfc;
  --pico-card-box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .04);
  --pico-form-element-background-color: #fff;
  --pico-form-element-border-color: #d3d8e0;
  --pico-code-background-color: #eef0f3;
  --pico-code-color: #3a4250;
  --pico-mark-background-color: #fdecc8;
  --pico-switch-checked-background-color: #0f766e;
  --text: #2b3038;
  --surface-2: #f1f3f6;
  --accent: #0f766e;
  --accent-soft: #e1f2ef;
  --accent-strong: #0a534d;
  --ok: #157347;       --ok-soft: #e3f5ea;   --ok-line: #b9e3c9;
  --warn: #8a5300;     --warn-soft: #fff4dc; --warn-line: #f3d79a;
  --err: #b42318;      --err-soft: #fdecea;  --err-line: #f5c2bc;
  --info: #1f5fbf;     --info-soft: #e6effc; --info-line: #c3d6f5;
  --neutral: #4f5866;  --neutral-soft: #eceef2;
  --shadow-lift: 0 4px 14px rgba(16, 24, 40, .08);
  --overlay: rgba(10, 12, 16, .94);
}
@media only screen and (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --pico-background-color: #0e1116;
    --pico-color: #d0d5dc;
    --pico-muted-color: #8f99a6;
    --pico-muted-border-color: #242b35;
    --pico-h1-color: #f2f4f7;
    --pico-h2-color: #e6e9ee;
    --pico-h3-color: #d7dbe1;
    --pico-primary: #4fd1bf;
    --pico-primary-background: #0f766e;
    --pico-primary-underline: rgba(79, 209, 191, .45);
    --pico-primary-hover: #8be6d9;
    --pico-primary-hover-background: #11877e;
    --pico-primary-focus: rgba(79, 209, 191, .35);
    --pico-primary-inverse: #fff;
    --pico-secondary: #a3acb9;
    --pico-secondary-background: #3a4350;
    --pico-secondary-hover-background: #465060;
    --pico-card-background-color: #161a21;
    --pico-card-border-color: #242b35;
    --pico-card-sectioning-background-color: #1a1f27;
    --pico-card-box-shadow: none;
    --pico-form-element-background-color: #11151b;
    --pico-form-element-border-color: #2e3642;
    --pico-form-element-active-background-color: #11151b;
    --pico-code-background-color: #1f252e;
    --pico-code-color: #c6ccd5;
    --pico-mark-background-color: #5a4310;
    --pico-mark-color: #fff;
    --pico-switch-checked-background-color: #0f766e;
    --text: #d0d5dc;
    --surface-2: #1d232c;
    --accent: #4fd1bf;
    --accent-soft: rgba(79, 209, 191, .13);
    --accent-strong: #8be6d9;
    --ok: #6fd69b;       --ok-soft: rgba(52, 199, 112, .13);  --ok-line: rgba(52, 199, 112, .32);
    --warn: #f5c55b;     --warn-soft: rgba(245, 180, 40, .12); --warn-line: rgba(245, 180, 40, .32);
    --err: #ff9a8f;      --err-soft: rgba(240, 82, 66, .14);   --err-line: rgba(240, 82, 66, .36);
    --info: #8db8ff;     --info-soft: rgba(80, 140, 255, .14); --info-line: rgba(80, 140, 255, .34);
    --neutral: #b2bac6;  --neutral-soft: rgba(150, 162, 180, .14);
    --shadow-lift: 0 4px 18px rgba(0, 0, 0, .35);
    --overlay: rgba(0, 0, 0, .94);
  }
}

/* ---------- base ---------- */
body { min-height: 100vh; }
h1 { --pico-font-size: 1.55rem; --pico-line-height: 1.2; margin-bottom: .35rem; }
h2 { --pico-font-size: 1.2rem; --pico-line-height: 1.3; margin: 0 0 .6rem; }
h3 { --pico-font-size: 1.02rem; margin: 0 0 .5rem; }
@media (min-width: 768px) { h1 { --pico-font-size: 1.85rem; } h2 { --pico-font-size: 1.3rem; } }
:where(a) { text-underline-offset: .18em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code { padding: .1rem .35rem; border-radius: .3rem; font-size: .86em; overflow-wrap: anywhere; }
small, .small { font-size: .84rem; }
.muted { color: var(--pico-muted-color); }
[hidden] { display: none !important; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.success { color: var(--ok); }
.error { color: var(--err); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.icon { width: 1.05em; height: 1.05em; flex: none; vertical-align: -.15em; }
main.container { padding-top: 1.25rem; padding-bottom: 4rem; }
@media (min-width: 1024px) { .container { max-width: 1080px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
html { scroll-behavior: smooth; scroll-padding-top: 1rem; }

/* ---------- header & navigation ---------- */
.site-header {
  background: var(--pico-card-background-color);
  border-bottom: 1px solid var(--pico-muted-border-color);
}
.site-header .bar {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "brand out" "tabs tabs";
  align-items: center; gap: .35rem .75rem; padding-top: .6rem; padding-bottom: .5rem;
}
.brand {
  grid-area: brand; display: inline-flex; align-items: center; gap: .45rem;
  font-weight: 700; font-size: 1.08rem; letter-spacing: -.01em; color: var(--pico-h1-color); text-decoration: none;
}
.brand:hover { color: var(--pico-h1-color); }
.brand .logo {
  display: inline-grid; place-items: center; width: 1.85rem; height: 1.85rem; border-radius: .55rem;
  background: var(--pico-primary-background); color: #fff;
}
.brand .logo svg { width: 1.1rem; height: 1.1rem; }
.logout { grid-area: out; margin: 0; }
.logout button {
  margin: 0; padding: .35rem .7rem; font-size: .85rem; border-radius: 999px;
  background: transparent; color: var(--pico-muted-color); border: 1px solid var(--pico-muted-border-color);
}
.logout button:hover { color: var(--text); border-color: var(--pico-form-element-border-color); background: var(--surface-2); }
.tabs {
  grid-area: tabs; display: flex; gap: .2rem; margin: 0 -.25rem; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: 1 1 auto; text-align: center; white-space: nowrap; text-decoration: none;
  padding: .42rem .6rem; border-radius: 999px; font-size: .9rem; font-weight: 500; color: var(--pico-muted-color);
}
.tabs a:hover { color: var(--text); background: var(--surface-2); }
.tabs a[aria-current="page"] { color: var(--accent-strong); background: var(--accent-soft); font-weight: 600; }
@media (min-width: 768px) {
  .site-header .bar { grid-template-columns: auto 1fr auto; grid-template-areas: "brand tabs out"; padding-top: .7rem; padding-bottom: .7rem; }
  .tabs { justify-content: center; margin: 0; }
  .tabs a { flex: 0 0 auto; padding: .42rem .85rem; }
}

/* ---------- page heading ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: .2rem 0 0; color: var(--pico-muted-color); }
.backlink { margin: 0 0 .75rem; font-size: .9rem; }
.backlink a { text-decoration: none; color: var(--pico-muted-color); }
.backlink a:hover { color: var(--pico-primary); }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin: 1.75rem 0 .75rem; }
.section-head h2 { margin: 0; }
.section-head form { margin: 0; }
.count { display: inline-block; min-width: 1.5em; padding: 0 .45em; border-radius: 999px; background: var(--surface-2); color: var(--pico-muted-color); font-size: .8em; font-weight: 600; text-align: center; vertical-align: .12em; }

/* ---------- cards ---------- */
article {
  --pico-block-spacing-vertical: 1rem;
  --pico-block-spacing-horizontal: 1rem;
  border: 1px solid var(--pico-card-border-color); border-radius: var(--radius); margin-bottom: 1rem;
}
@media (min-width: 768px) { article { --pico-block-spacing-vertical: 1.25rem; --pico-block-spacing-horizontal: 1.35rem; } }
article > header, article > footer { border-color: var(--pico-card-border-color); }
article > :last-child { margin-bottom: 0; }
.card-title { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin-bottom: .35rem; }
.card-title h2, .card-title h3 { margin: 0; }
.help { color: var(--pico-muted-color); font-size: .88rem; margin: -.15rem 0 .85rem; }
.help:last-child { margin-bottom: 0; }

/* ---------- flash messages & callouts ---------- */
.flash, .callout {
  display: flex; gap: .6rem; align-items: flex-start; padding: .7rem .9rem; margin: 0 0 1rem;
  border-radius: var(--radius-sm); border: 1px solid var(--neutral-soft); background: var(--neutral-soft); color: var(--text);
  font-size: .95rem; overflow-wrap: anywhere;
}
.flash::before { flex: none; font-weight: 700; line-height: inherit; }
.flash.ok { background: var(--ok-soft); border-color: var(--ok-line); }
.flash.ok::before { content: "✓"; color: var(--ok); }
.flash.err { background: var(--err-soft); border-color: var(--err-line); }
.flash.err::before { content: "!"; display: inline-grid; place-items: center; width: 1.25rem; height: 1.25rem; margin-top: .1rem; border-radius: 50%; background: var(--err); color: var(--pico-card-background-color); font-size: .8rem; }
.flash.warn { background: var(--warn-soft); border-color: var(--warn-line); }
.flash.warn::before { content: "⚠"; color: var(--warn); }
.flash.bare::before { content: none; }
.flash.bare.ok { color: var(--ok); font-weight: 600; }
.flash.bare.err { color: var(--err); font-weight: 600; }
.callout.warn { background: var(--warn-soft); border-color: var(--warn-line); }
.callout.info { background: var(--info-soft); border-color: var(--info-line); }
.callout > :last-child, .flash > :last-child { margin-bottom: 0; }
.callout p { margin: 0 0 .4rem; }
/* Claude's notes with simple Markdown (filter "md", textfmt.py): the hint callouts and the reasons of proposals */
.md { min-width: 0; overflow-wrap: anywhere; }
.md > p, .md > ul, .md > ol { margin: 0; }
.md > * + p, .md > * + ul, .md > * + ol { margin-top: .4em; }
.md > .md-label + p { display: inline; }  /* "Hinweis: …" on one line; a list starts below the label */
.md > .md-label + ul, .md > .md-label + ol { margin-top: .2em; }
.md ul, .md ol { padding-left: 1.2em; }
.md li { margin: .15em 0 0; }
.md li::marker { color: var(--pico-muted-color); }

/* ---------- badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem; padding: .12rem .55rem; border-radius: 999px;
  font-size: .76rem; font-weight: 600; line-height: 1.45; white-space: nowrap;
  background: var(--neutral-soft); color: var(--neutral);
}
.badge.dot::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.badge.ok, .st-sent { background: var(--ok-soft); color: var(--ok); }
.badge.warn, .st-drafted { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.info, .st-new { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent-strong); }
.st-dismissed { background: var(--neutral-soft); color: var(--neutral); }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; padding: 0; list-style: none; }
p.chips { margin-bottom: 1.5rem; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem; padding: .14rem .55rem; border-radius: 999px;
  font-size: .78rem; line-height: 1.5; color: var(--pico-muted-color); background: var(--surface-2); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- buttons & forms ---------- */
button, [role=button], [type=submit] { font-weight: 600; }
.btn-sm, .actions .btn-sm { padding: .38rem .75rem; font-size: .88rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .25rem; }
.actions > *, .actions form, .actions button, .actions [role=button] { margin: 0; }
.actions form { display: contents; }
.section-head button, .savebar button, .command button { width: auto; }
/* Pico makes submit buttons full width: good on phones, too wide on larger screens. */
@media (min-width: 576px) { button[type=submit] { width: auto; } }
[aria-busy=true] { pointer-events: none; }
:is(button, [role=button])[aria-busy=true] { opacity: .85; }
.copy-btn { min-width: 7.6rem; }
.copy-btn.copied { --pico-color: var(--ok); --pico-border-color: var(--ok); color: var(--ok); border-color: var(--ok); }
button.linkish {
  flex: none; text-align: left;
  display: inline; width: auto; margin: 0; padding: 0; border: 0; background: none; font: inherit; font-size: .84rem; font-weight: 500;
  color: var(--pico-muted-color); text-decoration: underline; text-underline-offset: .18em; cursor: pointer;
}
button.linkish:hover, button.linkish:focus { background: none; color: var(--pico-primary); box-shadow: none; }
label { font-size: .95rem; }
label > small, .field-hint { display: block; color: var(--pico-muted-color); font-size: .83rem; font-weight: 400; margin-top: .1rem; }
input:not([type=checkbox], [type=radio]), select, textarea { margin-bottom: .9rem; }
textarea { line-height: 1.55; font-size: .95rem; resize: vertical; }
fieldset { margin-bottom: .75rem; }
input.masked { -webkit-text-security: disc; }
small.error { display: block; margin: -.6rem 0 .8rem; color: var(--err); }
details { margin-bottom: .75rem; }
details > summary { font-weight: 500; display: flex; align-items: center; gap: .4rem; }
details > summary::after { flex: none; float: none !important; margin-left: auto !important; }  /* chevron stays on the right, even when the text wraps */
details.disclosure { border: 1px solid var(--pico-card-border-color); border-radius: var(--radius-sm); background: var(--pico-card-background-color); padding: 0; }
details.disclosure > summary { padding: .65rem .9rem; font-size: .92rem; }
details.disclosure[open] > summary { border-bottom: 1px solid var(--pico-card-border-color); margin-bottom: 0; }
details.disclosure > .disclosure-body { padding: .85rem .9rem .9rem; }
details.disclosure > .disclosure-body > :last-child { margin-bottom: 0; }
details.howto { margin: .5rem 0 0; }
details.howto > summary { font-size: .88rem; color: var(--pico-primary); }
details.howto ol { margin: .5rem 0 .25rem; padding-left: 1.25rem; font-size: .9rem; }
details.howto li { margin-bottom: .3rem; }
details.howto p { font-size: .88rem; margin: .4rem 0 0; color: var(--pico-muted-color); }

/* ---------- listings overview ---------- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin: 0 0 1rem; }
@media (min-width: 768px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; } }
.stat {
  padding: .7rem .9rem; border-radius: var(--radius); background: var(--pico-card-background-color);
  border: 1px solid var(--pico-card-border-color); box-shadow: var(--pico-card-box-shadow); min-width: 0;
}
.stat .label { display: block; font-size: .76rem; color: var(--pico-muted-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .value { display: block; font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; color: var(--pico-h1-color); font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat .sub { display: block; font-size: .74rem; color: var(--pico-muted-color); }

.filters {
  justify-content: flex-start;
  display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--pico-spacing) * -1) 1rem;
  padding: .1rem var(--pico-spacing) .25rem;
}
.filters::-webkit-scrollbar { display: none; }
.filters a {
  display: inline-flex; align-items: center; gap: .4rem; flex: none; padding: .36rem .8rem; border-radius: 999px;
  border: 1px solid var(--pico-card-border-color); background: var(--pico-card-background-color);
  color: var(--text); font-size: .88rem; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.filters a:hover { border-color: var(--pico-form-element-border-color); }
.filters a .n { color: var(--pico-muted-color); font-variant-numeric: tabular-nums; font-size: .82rem; }
.filters a .dot { width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.filters a .dot.st-new { color: var(--info); } .filters a .dot.st-drafted { color: var(--warn); }
.filters a .dot.st-sent { color: var(--ok); } .filters a .dot.st-dismissed { color: var(--neutral); }
.filters a[aria-current="page"] { background: var(--pico-primary-background); border-color: var(--pico-primary-background); color: #fff; }
.filters a[aria-current="page"] .n { color: rgba(255, 255, 255, .8); }
.filters a[aria-current="page"] .dot { color: #fff; background: #fff; }
@media (min-width: 768px) { .filters { flex-wrap: wrap; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; } }

.listing-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.listing-list > li { list-style: none; margin: 0; }
.listing-card {
  --pico-color: var(--text);
  display: grid; grid-template-columns: 6.25rem minmax(0, 1fr); gap: .8rem; align-items: start;
  padding: .65rem; border-radius: var(--radius); border: 1px solid var(--pico-card-border-color);
  background: var(--pico-card-background-color); box-shadow: var(--pico-card-box-shadow);
  color: var(--text); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.listing-card:hover { border-color: var(--pico-form-element-border-color); box-shadow: var(--shadow-lift); color: var(--text); }
.listing-card:hover .lc-title { color: var(--pico-primary); }
.listing-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.listing-card.is-dismissed { opacity: .62; }
.listing-card.is-dismissed:hover { opacity: 1; }
.lc-body { min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.lc-top { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .5rem; white-space: nowrap; font-size: .78rem; color: var(--pico-muted-color); }
.lc-title {
  font-weight: 650; font-size: .98rem; line-height: 1.3; color: var(--pico-h2-color);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lc-addr { font-size: .84rem; color: var(--pico-muted-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-facts { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .7rem; font-size: .86rem; }
.lc-facts .price { font-weight: 700; color: var(--pico-h1-color); }
.lc-facts .portal { color: var(--pico-muted-color); }
.lc-meta { font-size: .78rem; color: var(--pico-muted-color); }
@media (min-width: 768px) {
  .listing-card { grid-template-columns: 10rem minmax(0, 1fr); gap: 1.1rem; padding: .75rem; }
  .lc-title { font-size: 1.06rem; }
}

/* thumbnails: fixed 4:3 box, placeholder underneath, image on top (removed by app.js when it fails) */
.thumb {
  position: relative; display: block; aspect-ratio: 4 / 3; width: 100%; overflow: hidden; border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.thumb .thumb-ph {
  position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: .2rem;
  color: var(--pico-muted-color); font-size: .68rem; font-weight: 600; letter-spacing: .02em; text-align: center; padding: .25rem;
}
.thumb .thumb-ph svg { width: 1.6rem; height: 1.6rem; opacity: .6; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb img.is-broken { display: none; }

/* ---------- empty states ---------- */
.empty {
  text-align: center; padding: 2rem 1.25rem; border: 1px dashed var(--pico-form-element-border-color);
  border-radius: var(--radius); color: var(--pico-muted-color); background: var(--pico-card-background-color);
}
.empty svg { width: 2.25rem; height: 2.25rem; opacity: .5; margin-bottom: .35rem; }
.empty strong { display: block; color: var(--text); font-size: 1.02rem; margin-bottom: .2rem; }
.empty p { margin: 0 auto; max-width: 30rem; font-size: .92rem; }

/* ---------- listing detail ---------- */
.listing-head { padding: 0; overflow: hidden; }
.listing-head .lh-grid { display: grid; }
.hero { display: block; position: relative; aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lh-body { padding: 1rem; }
.lh-top { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin-bottom: .45rem; font-size: .82rem; color: var(--pico-muted-color); }
.listing-head h1 { --pico-font-size: 1.35rem; margin: 0 0 .3rem; overflow-wrap: anywhere; }
.lh-addr { display: flex; gap: .35rem; align-items: flex-start; margin: 0 0 .85rem; color: var(--pico-muted-color); font-size: .93rem; }
.lh-addr .icon { margin-top: .2rem; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin: 0 0 1rem; }
.facts > div { padding: .5rem .7rem; border-radius: var(--radius-sm); background: var(--surface-2); min-width: 0; }
.facts dt { font-size: .74rem; color: var(--pico-muted-color); font-weight: 500; margin: 0; }
.facts dd { margin: 0; font-weight: 650; color: var(--pico-h1-color); overflow-wrap: anywhere; }
.lh-actions { display: grid; grid-template-columns: 1fr; gap: .5rem; }
.lh-actions [role=button] { margin: 0; text-align: center; }
.status-switch { margin: 1rem 0 0; padding-top: .9rem; border-top: 1px solid var(--pico-card-border-color); }
.status-switch .label { display: block; font-size: .82rem; color: var(--pico-muted-color); margin-bottom: .4rem; }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
.seg button {
  margin: 0; padding: .45rem .5rem; font-size: .88rem; font-weight: 600; border-radius: var(--radius-sm);
  background: transparent; color: var(--text); border: 1px solid var(--pico-form-element-border-color);
}
.seg button:hover { background: var(--surface-2); color: var(--text); }
.seg button[aria-pressed="true"] { border-color: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.seg button[aria-pressed="true"].st-new { background: var(--info-soft); color: var(--info); }
.seg button[aria-pressed="true"].st-drafted { background: var(--warn-soft); color: var(--warn); }
.seg button[aria-pressed="true"].st-sent { background: var(--ok-soft); color: var(--ok); }
.seg button[aria-pressed="true"].st-dismissed { background: var(--neutral-soft); color: var(--neutral); }
@media (min-width: 576px) {
  .lh-actions { grid-template-columns: repeat(auto-fit, minmax(10rem, max-content)); }
  .seg { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .listing-head .lh-grid.has-image { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
  .lh-grid.has-image .hero { aspect-ratio: auto; min-height: 100%; }
  .lh-grid.has-image .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lh-body { padding: 1.35rem 1.5rem; }
  .listing-head h1 { --pico-font-size: 1.6rem; }
}
.description { font-size: .95rem; line-height: 1.6; }

/* exposé details (ImmoScout24): key facts, label/value lists, text sections */
.details { display: grid; gap: 0 1.75rem; }
.details > .facts { margin-bottom: 1.25rem; }
.facts > div.wide { grid-column: span 2; }
.details-section { margin-bottom: 1.15rem; min-width: 0; }
.details-section:last-child { margin-bottom: 0; }
.details-section h3 { margin: 0 0 .4rem; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--pico-muted-color); }
.details-section .description { margin: 0; }
details.details-section { margin-bottom: .75rem; align-self: start; }
details.details-section > summary { font-weight: 600; }
details.details-section + .details-section:not(details) { margin-top: 1.4rem; }
.kvlist.disclosure-body { padding-top: .3rem; padding-bottom: .45rem; }
.kvlist { margin: 0; font-size: .9rem; }
.kvlist > div { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .32rem 0; border-bottom: 1px solid var(--pico-muted-border-color); }
.kvlist > div:last-child { border-bottom: 0; }
.kvlist dt { margin: 0; color: var(--pico-muted-color); font-weight: 400; }
.kvlist dd { margin: 0; flex-shrink: 0; max-width: 55%; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
@media (min-width: 900px) {
  .kvlist { columns: 2; column-gap: 2rem; }  /* open lists: two columns of label/value rows */
  .kvlist > div { break-inside: avoid; }
}

/* drafts */
.draft-card > header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding-top: .7rem; padding-bottom: .7rem; }
.draft-card > header .when { font-size: .82rem; color: var(--pico-muted-color); }
.draft-card > header > div { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; }
.draft-card .copy-btn { margin: 0 0 0 auto; padding: .38rem .8rem; font-size: .88rem; }
.draft-card .instruction { font-size: .9rem; margin: 0 0 .75rem; }
.draft-card .callout { font-size: .9rem; }
pre.draft {
  margin: 0 0 .85rem; padding: .9rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text);
  font-family: var(--pico-font-family-sans-serif); font-size: .95rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
}
.draft-card > footer { padding-top: .6rem; padding-bottom: .6rem; }
.draft-new { box-shadow: 0 0 0 2px var(--accent-soft), var(--pico-card-box-shadow); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
:target.draft-card { animation: flash-target 1.6s ease-out 1; }
@keyframes flash-target { from { box-shadow: 0 0 0 4px var(--accent); } to { box-shadow: 0 0 0 2px transparent; } }

/* ---------- text diff (textdiff.word_diff + macros.text_diff): profile history, rewrite proposals, editor ---------- */
.diff { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.diff ins, .diff del { border-radius: .2rem; padding: 0 .08em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.diff ins { background: var(--ok-soft); color: var(--ok); text-decoration: none; box-shadow: inset 0 -1px 0 var(--ok-line); }
.diff del { background: var(--err-soft); color: var(--err); text-decoration: line-through; text-decoration-thickness: 1px; }
/* Screen readers don't announce <ins>/<del>: say it, without showing it. */
.diff ins::before, .diff ins::after, .diff del::before, .diff del::after {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(100%); white-space: nowrap;
}
.diff ins::before { content: " [eingefügt: "; }
.diff del::before { content: " [gelöscht: "; }
.diff ins::after, .diff del::after { content: "] "; }

/* ---------- gallery (photo grid with captions; markup comes from the gallery feature) ----------
   <div class="gallery">
     <a class="gallery-item" href="FULL_URL" data-lightbox data-caption="Wohnzimmer">
       <img src="THUMB_URL" alt="Wohnzimmer" loading="lazy" decoding="async"><span class="gallery-caption">Wohnzimmer</span>
     </a> …
   </div>
   app.js opens [data-lightbox] links in an overlay (prev/next within the same .gallery); without JS the link just opens. */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin: 0 0 1rem; }
@media (min-width: 576px) { .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .65rem; } }
.gallery-item {
  position: relative; display: block; margin: 0; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius-sm);
  background: var(--surface-2); color: #fff; text-decoration: none; cursor: zoom-in;
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.gallery-item:hover img { transform: scale(1.03); }
.gallery-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gallery-caption, .gallery-item figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 1.2rem .55rem .4rem; font-size: .76rem; line-height: 1.3;
  color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .68)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gallery-item.is-first { grid-column: span 2; grid-row: span 2; }
.lightbox {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--overlay); color: #fff; display: none;
}
.lightbox[open] { display: grid; grid-template-rows: 1fr auto; }
.lightbox::backdrop { background: transparent; }
.lightbox[open] { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.lightbox figure { margin: 0; display: grid; place-items: center; min-height: 0; padding: 3.25rem .5rem .5rem; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 8rem); max-height: calc(100dvh - 8rem); object-fit: contain; border-radius: .35rem; }
.lightbox .lb-caption { text-align: center; padding: .5rem 1rem 1.25rem; font-size: .9rem; color: rgba(255, 255, 255, .9); }
.lightbox button {
  position: absolute; margin: 0; padding: 0; width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: 1.4rem; line-height: 1; display: grid; place-items: center;
}
.lightbox button:hover { background: rgba(255, 255, 255, .26); }
.lightbox .lb-close { top: .6rem; right: .6rem; }
.lightbox .lb-prev { left: .5rem; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: .5rem; top: 50%; transform: translateY(-50%); }
.lightbox .lb-count { position: absolute; top: 1.3rem; left: 1rem; font-size: .85rem; color: rgba(255, 255, 255, .8); }

/* ---------- settings ---------- */
/* Tabs (Profil · Verhalten · Zugänge) as a segmented control; a red dot = something required is missing. */
.subnav {
  display: flex; gap: .1rem; padding: .2rem; margin: 0 0 1.25rem; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--pico-muted-border-color); overflow-x: auto; scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: .25rem; white-space: nowrap;
  text-decoration: none; padding: .42rem .35rem; border-radius: 999px; font-size: .8rem; font-weight: 500; color: var(--pico-muted-color);
}
.subnav a:hover { color: var(--text); }
.subnav a[aria-current="page"] { background: var(--pico-card-background-color); color: var(--accent-strong); font-weight: 600; box-shadow: var(--pico-card-box-shadow); }
.alert-dot { flex: none; width: .45rem; height: .45rem; border-radius: 50%; background: var(--err); }
@media (max-width: 349px) { .subnav a { font-size: .72rem; padding: .4rem .25rem; } }
@media (min-width: 400px) { .subnav a { font-size: .86rem; padding: .42rem .6rem; gap: .35rem; } }
@media (min-width: 768px) { .subnav { display: inline-flex; gap: .2rem; padding: .25rem; } .subnav a { flex: 0 0 auto; padding: .42rem 1rem; font-size: .9rem; } }
/* "Pflicht" / "optional" next to a credential's name. */
.need {
  display: inline-block; font-size: .68rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; line-height: 1.5;
  padding: 0 .45rem; border-radius: 999px; color: var(--pico-muted-color); border: 1px solid var(--pico-muted-border-color);
}
.need.optional { border-style: dashed; }
.cred-title { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem .55rem; }
.lead-note { font-size: .88rem; color: var(--pico-muted-color); margin: 0 0 .5rem; }
details.notes-box { margin: 1.5rem 0 0; }
details.notes-box .notes { margin: 0; font-size: .9rem; }
.setting-card h2 { display: flex; align-items: center; gap: .5rem; }
.setting-card h2 label { font-size: inherit; font-weight: inherit; margin: 0; cursor: pointer; }
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: .25rem 1rem; }
.field-head > :first-child { min-width: 0; }
.field-head h2 { margin-bottom: .2rem; }
/* Settings → KI-Anbieter: one panel per provider. With JS (html.js) only the chosen one shows; without JS all do. */
.provider-panel { border: 1px solid var(--pico-card-border-color); border-radius: var(--radius-sm); padding: .9rem .9rem .4rem; margin: 0 0 1rem; }
.provider-panel h3 small { font-weight: 400; }
/* Phones: no box in the box, so the model list (name · price) isn't cut off at 320 px. */
@media (max-width: 479px) {
  .provider-panel { border-width: 1px 0 0; border-radius: 0; padding: .9rem 0 .2rem; }
  .provider-panel select { font-size: .92rem; padding-left: .65rem; }
}
.js .provider-panel:not(.is-active) { display: none; }
.key-status { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin: 0 0 .75rem; font-size: .92rem; }
.form-grid { display: grid; gap: 0 1rem; }
@media (min-width: 768px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.check { display: flex; align-items: flex-start; gap: .6rem; margin-bottom: .9rem; }
.check input { margin-top: .2rem; flex: none; }
.check span small { display: block; color: var(--pico-muted-color); }
.savebar {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  margin: 1rem calc(var(--pico-spacing) * -1) 0; padding: .7rem var(--pico-spacing) calc(.7rem + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--pico-background-color) 88%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-top: 1px solid var(--pico-muted-border-color);
}
.savebar button { margin: 0; min-width: 9rem; }
.savebar button { white-space: nowrap; }
@media (max-width: 419px) { .savebar.button-first small { display: none; } .savebar.button-first button { flex: 1; } }
.savebar small { color: var(--pico-muted-color); }
@media (min-width: 768px) { .savebar { margin-left: 0; margin-right: 0; border: 1px solid var(--pico-muted-border-color); border-radius: var(--radius); bottom: .75rem; } }
.js .nojs-only { display: none !important; }  /* fallback buttons for what app.js does by itself */
#anbieter > .actions { margin: .5rem 0 .75rem; }
.empty-line { color: var(--pico-muted-color); font-size: .92rem; margin: 0 0 1rem; }

/* Profil → "Aus Rückmeldungen verbessern": a card when there is enough to act on, else one muted line */
.rewrite-card.is-active { border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: 0 0 0 2px var(--accent-soft), var(--pico-card-box-shadow); }
.rewrite-card > p { margin-bottom: .6rem; }
.rewrite-card form.actions { margin: .25rem 0 .6rem; }
.rewrite-busy { font-weight: 600; }
.rewrite-busy [aria-busy=true]::before { margin-right: .5rem; }
.rewrite-line { margin: -.25rem 0 1rem; color: var(--pico-muted-color); }
.rewrite-line form { display: inline; margin: 0 0 0 .25rem; }
.rewrite-line button.linkish { color: var(--pico-primary); font-weight: 600; }
/* "System-Prompt – Grundanweisung …": the name stays on one line, the note wraps beside it. */
.setting-card details > summary > strong { flex: none; }
.setting-card details > summary > small { min-width: 0; }
.flash .flash-dismiss { margin: 0 0 0 auto; flex: none; }
/* Stand-alone text buttons ("Rückgängig", "Wieder als Beispiel nutzen"): a taller tap area on phones. */
.flash .linkish, .rule-foot .linkish { padding: .3rem 0; }

/* Profil → Verlauf (profile versions) */
.version-list { list-style: none; margin: .75rem 0 0; padding: 0; }
.version-list > li {
  list-style: none; margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .75rem;
  padding: .55rem 0; border-top: 1px solid var(--pico-muted-border-color); font-size: .9rem;
}
.version-list .v-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .5rem; min-width: 0; }
.version-list .v-when { color: var(--pico-muted-color); font-size: .84rem; font-variant-numeric: tabular-nums; }
.version-list .v-current { color: var(--accent-strong); font-size: .8rem; font-weight: 600; }
.version-list .v-note { flex-basis: 100%; color: var(--pico-muted-color); font-size: .84rem; overflow-wrap: anywhere; }
.version-list .v-actions { display: inline-flex; align-items: baseline; gap: .9rem; margin-left: auto; font-size: .84rem; }
.version-list .v-actions form { margin: 0; }
.version-field.is-same { padding-top: .7rem; padding-bottom: .7rem; }
.version-field.is-same .card-title { margin: 0; }
.version-field.is-same h3 { color: var(--pico-muted-color); }

/* Profil → a rewrite proposal: one card per edit, its diff in the context of the field */
.edit-card .edit-head { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; margin-bottom: .6rem; }
.edit-card .edit-head .check { margin: 0; }
.edit-card.is-fact { border-color: var(--warn-line); }
.edit-card.is-off .edit-diff { opacity: .7; }
.edit-diff {
  margin: 0 0 .65rem; padding: .7rem .85rem; border-radius: var(--radius-sm); background: var(--surface-2);
  font-size: .93rem; max-height: 22rem; overflow-y: auto;
}
.edit-note { font-size: .88rem; margin: 0 0 .5rem; }
.edit-note.fact-note { color: var(--warn); }
.edit-reason { margin: 0 0 .4rem; font-size: .93rem; }
.evidence { list-style: none; margin: 0 0 .5rem; padding: 0; font-size: .84rem; color: var(--pico-muted-color); }
.evidence > li { list-style: none; position: relative; margin: .15rem 0; padding-left: 1.1rem; overflow-wrap: anywhere; }
.evidence > li::before { content: "↳"; position: absolute; left: 0; }
.stale-actions { margin-bottom: 1.25rem; }
.reject-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; margin: 1.25rem 0 0; }
.reject-row button { width: auto; margin: 0; }

/* Verhalten → Lernen: learned rules and examples */
.learn-links { margin: 0; font-size: .88rem; }
.rule-group { margin: .9rem 0 1rem; }
.rule-group h3 { display: flex; align-items: center; gap: .4rem; margin-bottom: .2rem; }
.rule-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; }
.rule-list-title { margin: 1rem 0 .4rem; }
.rule-list > li {
  list-style: none; margin: 0; min-width: 0; padding: .7rem .85rem; border-radius: var(--radius-sm);
  border: 1px solid var(--pico-card-border-color); background: var(--pico-card-background-color);
}
.rule-list.compact > li { padding: .5rem .75rem; }
.rule-list form { margin: 0; }
.rule-list button { width: auto; margin: 0; }  /* small inline buttons, also on phones */
.rule-list textarea { margin-bottom: .5rem; font-size: .93rem; }
.rule.is-proposed { border-color: var(--warn-line); background: var(--warn-soft); }
.rule.is-off .rule-text { color: var(--pico-muted-color); }
.rule-kind { margin: 0 0 .35rem; font-size: .82rem; font-weight: 600; color: var(--pico-muted-color); }
.rule-kind .old { font-weight: 400; text-decoration: line-through; }
.rule-text { margin: 0 0 .3rem; font-size: .95rem; overflow-wrap: anywhere; }
.rule-reason { margin: 0 0 .35rem; font-size: .85rem; color: var(--pico-muted-color); }
.rule-meta { margin: 0 0 .35rem; font-size: .82rem; color: var(--pico-muted-color); overflow-wrap: anywhere; }
.rule-list.compact .rule-meta { margin: 0; }
.rule-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem 1rem; }
.rule-foot .rule-meta { margin: 0; }
.rule-toggle { display: inline-flex; align-items: center; gap: .6rem; }
.rule-toggle label { display: inline-flex; align-items: center; gap: .1rem; margin: 0; font-size: .86rem; white-space: nowrap; }
.rule-edit { margin: .4rem 0 0; }
.rule-edit > summary { font-size: .84rem; color: var(--pico-primary); }
.rule-edit[open] > summary { margin-bottom: .5rem; }
.rule-edit pre.draft { font-size: .9rem; margin-bottom: .5rem; }
.rule.example form { margin-top: .5rem; }

/* ---------- credentials ---------- */
.cred-list { display: grid; gap: .75rem; margin-bottom: 1.5rem; }
.cred-list > article { margin: 0; }
.cred > header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .35rem .75rem; padding-top: .8rem; padding-bottom: .8rem; }
.cred > header strong { font-size: 1rem; }
.cred .cred-state { font-size: .88rem; margin: 0 0 .5rem; }
.cred .cred-state code { font-size: .84em; }
.cred p { font-size: .9rem; margin-bottom: .5rem; }
.cred details.disclosure { margin: .75rem 0 0; }
.cred form { margin: 0; }
.step-up { font-size: .84rem; color: var(--pico-muted-color); margin: -.35rem 0 .75rem; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: .25rem 0 .75rem; }
.steps > li { counter-increment: step; position: relative; padding-left: 2.2rem; margin-bottom: .75rem; list-style: none; font-size: .95rem; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: -.05rem; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  display: grid; place-items: center; font-size: .82rem; font-weight: 700; background: var(--pico-primary-background); color: #fff;
}
.command { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .35rem; }
.command code { font-size: .92rem; padding: .45rem .7rem; }
.command button { margin: 0; }
#new-token-value { font-family: var(--pico-font-family-monospace); font-size: .9rem; word-break: break-all; background: var(--pico-card-background-color); border: 1px solid var(--warn-line); }
.highlight-card { border-color: var(--warn-line); background: var(--warn-soft); }
.highlight-card.accent { border-color: var(--accent); background: var(--accent-soft); }
.highlight-card > header { background: transparent; }
.highlight-card .actions { margin-bottom: .85rem; }
.notes { font-size: .9rem; padding-left: 1.1rem; margin: 0; }
.notes li { margin-bottom: .45rem; }

/* audit log */
.log { list-style: none; margin: 0; padding: 0; border: 1px solid var(--pico-card-border-color); border-radius: var(--radius); background: var(--pico-card-background-color); overflow: hidden; }
.log > li { list-style: none; margin: 0; padding: .6rem .9rem; border-top: 1px solid var(--pico-card-border-color); font-size: .88rem; }
.log > li:first-child { border-top: 0; }
.log .log-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .5rem; }
.log .log-main strong { font-weight: 600; }
.log .log-sub { display: flex; flex-wrap: wrap; gap: .1rem .75rem; color: var(--pico-muted-color); font-size: .8rem; }
.log .log-detail { color: var(--pico-muted-color); font-size: .8rem; overflow-wrap: anywhere; }

/* ---------- status ---------- */
.health { display: grid; gap: .65rem; margin-bottom: 1.5rem; }
@media (min-width: 768px) { .health { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.health-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .75rem; align-items: start; padding: .85rem 1rem;
  border-radius: var(--radius); border: 1px solid var(--pico-card-border-color); background: var(--pico-card-background-color);
  box-shadow: var(--pico-card-box-shadow);
}
.health-item .hi-icon {
  width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 1rem;
  background: var(--neutral-soft); color: var(--neutral);
}
.health-item.ok .hi-icon { background: var(--ok-soft); color: var(--ok); }
.health-item.warn .hi-icon { background: var(--warn-soft); color: var(--warn); }
.health-item.err .hi-icon { background: var(--err-soft); color: var(--err); }
.health-item h3 { margin: 0 0 .1rem; font-size: .8rem; font-weight: 600; color: var(--pico-muted-color); text-transform: uppercase; letter-spacing: .04em; }
.health-item p { margin: 0; font-size: .93rem; overflow-wrap: anywhere; }
.health-item p + p { margin-top: .2rem; font-size: .84rem; color: var(--pico-muted-color); }
.kv { list-style: none; margin: 0 0 1.5rem; padding: 0; border: 1px solid var(--pico-card-border-color); border-radius: var(--radius); background: var(--pico-card-background-color); overflow: hidden; }
.kv > li { list-style: none; margin: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem 1rem; padding: .6rem .9rem; border-top: 1px solid var(--pico-card-border-color); font-size: .9rem; }
.kv > li:first-child { border-top: 0; }
.kv .k { font-weight: 600; }
.kv > li { flex-direction: column; }
.kv .v { color: var(--pico-muted-color); overflow-wrap: anywhere; min-width: 0; }
@media (min-width: 576px) { .kv > li { flex-direction: row; } .kv .v { text-align: right; } }
.kv .v .error, .kv .v .success { font-weight: 600; }

/* Cost bar (cost_bar.html): this month by source against the budget. The legend carries the information; the
   segments are separated by a 2px gap, the profile rewrite is hatched (amber like the rule proposals). */
.cost-card { margin-bottom: 1.5rem; }
.costbar { margin: 0 0 1rem; }
.cost-card .costbar { margin: 0; }
.costbar-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .1rem 1rem; margin: 0 0 .45rem; font-size: .9rem; }
.costbar-month { color: var(--pico-muted-color); }
.costbar-total { font-variant-numeric: tabular-nums; }
.costbar-total strong { font-size: 1.1rem; color: var(--pico-h1-color); }
.costbar-meter { position: relative; }
.costbar-meter.is-slim { margin: .3rem 0 .2rem; }
.costbar-track {
  display: flex; height: .7rem; border-radius: 999px; overflow: hidden;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--pico-muted-border-color);
}
.is-slim .costbar-track { height: .3rem; }
.costbar-seg { flex: none; min-width: 3px; height: 100%; }
.costbar-seg + .costbar-seg { border-left: 2px solid var(--pico-card-background-color); }
.seg-drafts { background: var(--accent); }
.seg-editor { background: var(--info); }
.seg-rules { background: var(--warn); }
.seg-rewrite { background: repeating-linear-gradient(135deg, var(--warn) 0 2px, transparent 2px 4px); }
.seg-test { background: var(--neutral); }
.seg-other { background: var(--pico-muted-color); }
/* where the budget ended (over budget only): a red mark sticking out of the bar */
.costbar-limit { position: absolute; top: -.25rem; bottom: -.25rem; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--err); box-shadow: 0 0 0 1.5px var(--pico-card-background-color); }
.is-slim .costbar-limit { top: -.15rem; bottom: -.15rem; width: 2px; margin-left: -1px; }
.costbar.is-over .costbar-total strong, .stat-cost.is-over .value, .stat-cost.is-over .sub { color: var(--err); }
.costbar.is-over .costbar-track, .stat-cost.is-over .costbar-track { box-shadow: inset 0 0 0 1px var(--err-line); }
.costbar-alert { margin: .5rem 0 0; font-size: .88rem; font-weight: 600; color: var(--err); }
.costbar-legend { list-style: none; margin: .7rem 0 .5rem; padding: 0; display: grid; gap: .1rem 1.5rem; font-size: .88rem; }
@media (min-width: 768px) { .costbar-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.costbar-legend > li {
  list-style: none; margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .55rem; align-items: baseline;
  padding: .2rem 0; border-bottom: 1px solid var(--pico-muted-border-color);
}
.costbar-swatch { width: .75rem; height: .75rem; border-radius: .2rem; align-self: center; box-shadow: inset 0 0 0 1px var(--pico-muted-border-color); }
.costbar-label small { color: var(--pico-muted-color); font-size: .78rem; }
.costbar-amount { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--pico-h2-color); white-space: nowrap; }
.costbar .help { margin: 0; font-size: .82rem; }
.foot { margin-top: 2rem; font-size: .8rem; color: var(--pico-muted-color); text-align: center; }

/* ---------- login ---------- */
.login-wrap { min-height: calc(100vh - 6rem); display: grid; place-items: center; }
.login { width: 100%; max-width: 23rem; padding: 1.5rem; }
.login .brand { margin-bottom: 1.25rem; font-size: 1.3rem; }
.login .brand .logo { width: 2.3rem; height: 2.3rem; border-radius: .7rem; }
.login h1 { --pico-font-size: 1.25rem; margin-bottom: .25rem; }
.login p { color: var(--pico-muted-color); font-size: .92rem; }
.login button { width: 100%; margin-bottom: 0; }
.setting-card input[type=number] { max-width: 14rem; }

/* --- Editor --- */
/* Draft editor (editor.html, editor_message.html): mobile first, one column; from 1024 px the text on the left and
   critique / rules on the right. The bar with Kopieren · Fertig sticks to the bottom of the screen (the text saves
   itself; without JS "Zwischenspeichern" next to the heading does). */
.ed-brand-note { grid-area: out; font-size: .85rem; font-weight: 500; color: var(--pico-muted-color); }
.ed-head { margin: 0 0 1rem; }
.ed-top { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; margin-bottom: .4rem; }
.ed-head h1 { --pico-font-size: 1.3rem; margin: 0 0 .2rem; overflow-wrap: anywhere; }
@media (min-width: 768px) { .ed-head h1 { --pico-font-size: 1.55rem; } }
.ed-facts { margin: 0 0 .7rem; color: var(--pico-muted-color); font-size: .92rem; overflow-wrap: anywhere; }
.ed-links { display: flex; flex-wrap: wrap; gap: .5rem; }
.ed-links [role=button] { margin: 0; padding: .4rem .8rem; font-size: .88rem; }
.ed-grid { display: grid; gap: 0 1.25rem; }
.ed-main, .ed-side { min-width: 0; }
@media (min-width: 1024px) {
  .ed-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
  .ed-side { position: sticky; top: 1rem; }
}
.ed-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; margin-bottom: .7rem; }
.ed-card-head h2 { margin: 0 auto 0 0; }
.ed-card-head h2 label { font-size: inherit; font-weight: inherit; margin: 0; }
.ed-card-head .when { font-size: .8rem; color: var(--pico-muted-color); }
.ed-save { font-size: .78rem; font-weight: 500; color: var(--pico-muted-color); }
.ed-save[data-state=saved] { color: var(--ok); }
.ed-save[data-state=error] { color: var(--err); font-weight: 600; }
.ed-card-head .ed-save-reload, .ed-card-head .ed-save-nojs { font-size: .8rem; padding: .3rem 0; }
.ed-card h2 { margin-bottom: .6rem; }
.ed-card h2 label { font-size: inherit; font-weight: inherit; margin: 0; }
.ed-card .callout { font-size: .9rem; margin-bottom: .75rem; }
#ed-text { min-height: 15rem; margin-bottom: 0; font-size: 1rem; line-height: 1.6; }
.js #ed-text { overflow-y: hidden; resize: none; }
.ed-card > .ed-bar {
  position: sticky; bottom: 0; z-index: 4; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem;
  margin: .75rem calc(var(--pico-block-spacing-horizontal) * -1) calc(var(--pico-block-spacing-vertical) * -1);
  padding: .6rem var(--pico-block-spacing-horizontal) calc(.6rem + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--pico-card-background-color) 90%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-top: 1px solid var(--pico-card-border-color); border-radius: 0 0 var(--radius) var(--radius);
}
.ed-bar button { width: 100%; margin: 0; padding: .55rem .35rem; font-size: .92rem; white-space: nowrap; }
.ed-bar-note { grid-column: 1 / -1; margin: 0; font-size: .76rem; line-height: 1.35; color: var(--pico-muted-color); text-align: center; }
.ed-bar button.copied { color: var(--ok); border-color: var(--ok); }
@media (max-width: 359px) { .ed-bar button { padding: .55rem .2rem; font-size: .85rem; } }
.ed-diff { margin: 0 0 1rem; }
.ed-diff > summary .badge { font-weight: 600; }
.ed-diff .diff { font-size: .93rem; }
.ed-nodiff { margin: 0; font-size: .9rem; }
.ed-card #ed-critique { margin-bottom: .5rem; }
.ed-card .ed-revise { width: 100%; margin: 0; }
.ed button[type=button] { font-weight: 600; }  /* Pico's [type=button] rule would make "Kopieren" thinner */
.ed-card > .ed-history-title:first-child { margin-top: 0; }
.ed-history-title { margin: 1.1rem 0 .35rem; font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--pico-muted-color); }
.ed-history { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.ed-history li {
  list-style: none; margin: 0; padding: .35rem 0; display: grid; grid-template-columns: 1.5rem minmax(0, 1fr) auto;
  gap: .5rem; align-items: baseline; border-top: 1px solid var(--pico-muted-border-color);
}
.ed-history .n {
  display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%;
  background: var(--surface-2); color: var(--pico-muted-color); font-size: .72rem; font-weight: 700;
}
.ed-history li:last-child .n { background: var(--accent-soft); color: var(--accent-strong); }
.ed-history .t { overflow-wrap: anywhere; }
.ed-history .when { font-size: .74rem; color: var(--pico-muted-color); white-space: nowrap; }
.ed-history .is-note .n { background: var(--warn-soft); color: var(--warn); }
.ed-intro { margin: -.3rem 0 .75rem; }
.ed-ask { margin: .6rem 0 0; }
.ed-ask button { width: auto; margin: 0; }
.ed-done { border-color: var(--ok-line); }
.ed-done pre.draft { margin-bottom: .9rem; }
.ed-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.ed-actions > *, .ed-actions form, .ed-actions button { margin: 0; }
.ed-actions form { display: contents; }
.ed-done .ed-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr)); align-items: stretch; }
.ed-done .ed-actions button, .ed-done .ed-actions [role=button] { width: 100%; text-align: center; }
.ed-done .ed-actions .copy-btn { min-width: 0; }
.ed-sent { justify-content: center; padding: .55rem .8rem; font-size: .88rem; }
.ed-rules h2 { margin-bottom: .75rem; }
.ed-wait {
  display: flex; align-items: center; gap: .6rem; margin: 0 0 .5rem; padding: .75rem .9rem; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 600;
}
.ed-rule { margin: 0; padding: .85rem 0; border-top: 1px solid var(--pico-muted-border-color); }
.ed-rule:last-of-type { padding-bottom: 0; }
.ed-rule-kind { margin: 0 0 .45rem; }
.ed-rule-old { margin: 0 0 .45rem; font-size: .86rem; overflow-wrap: anywhere; }
.ed-rule-text { margin: 0 0 .45rem; overflow-wrap: anywhere; }
.ed-rule textarea { margin-bottom: .4rem; font-size: .93rem; }
.js .ed-rule textarea { overflow-y: hidden; }
.ed-reason { margin: 0 0 .6rem; font-size: .8rem; color: var(--pico-muted-color); }
.ed-rule .ed-actions button { flex: 1 1 8rem; }
.ed-norules { margin: 0; font-size: .9rem; overflow-wrap: anywhere; }
/* "Regel selbst eintragen" (editor) / "Regel hinzufügen" (Verhalten → Lernen), rule_macros.html */
details.rule-add { margin: .85rem 0 0; }
details.rule-add > summary { font-size: .9rem; color: var(--pico-primary); }
details.rule-add[open] > summary { margin-bottom: .5rem; }
details.rule-add.is-prominent { padding: .7rem .85rem; border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); border-radius: var(--radius-sm); background: var(--accent-soft); }
details.rule-add.is-prominent > summary { font-weight: 600; color: var(--accent-strong); }
details.rule-add label { font-size: .88rem; margin-bottom: .25rem; }
details.rule-add textarea { margin-bottom: .4rem; font-size: .93rem; }
.js .ed details.rule-add textarea { overflow-y: hidden; }  /* autosized by editor.js */
.rule-howto { margin: 0 0 .6rem; font-size: .82rem; }
details.rule-add button { width: auto; margin: 0; }
.ed-decided { list-style: none; margin: .85rem 0 0; padding: .75rem 0 0; border-top: 1px solid var(--pico-muted-border-color); font-size: .88rem; }
.ed-decided li { list-style: none; margin: 0 0 .35rem; overflow-wrap: anywhere; }
.ed-newer { align-items: center; }
.ed-newer form { margin: .5rem 0 0; }
.ed-newer button { width: auto; margin: 0; }
.ed-empty form { margin: 1rem 0 0; }
.ed-empty button { width: auto; margin: 0; }
.ed-lost { margin: 0 0 1rem; }
.ed-lost pre.draft { margin-bottom: .6rem; }
.ed-message { max-width: 34rem; margin: 1.5rem auto 0; }
.ed-message h1 { --pico-font-size: 1.3rem; }
.ed-message p { color: var(--pico-muted-color); }
.ed-message [role=button] { margin: 0; }
/* The editor's final version on the listing page. */
.draft-final { border-color: var(--ok-line); }
.draft-card > footer a { font-size: .88rem; }
/* Editor: quick buttons next to the critique field ("Kürzer", "Förmlicher", "Ganz neu schreiben"). */
.ed-quick { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin: .8rem 0 0; }
.ed-quick-label { flex: 1 0 100%; font-size: .8rem; color: var(--pico-muted-color); }
.ed-quick button { flex: 1 1 auto; width: auto; margin: 0; padding: .45rem .7rem; font-size: .88rem; white-space: nowrap; }
