/* 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; }

/* ---------- 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; } }

/* ---------- 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 ---------- */
.settings-nav { justify-content: flex-start; display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--pico-spacing) * -1) 1rem; padding: 0 var(--pico-spacing) .2rem; }
.settings-nav::-webkit-scrollbar { display: none; }
.settings-nav a { flex: none; font-size: .84rem; padding: .3rem .7rem; border-radius: 999px; background: var(--surface-2); color: var(--text); text-decoration: none; white-space: nowrap; }
.settings-nav a:hover { background: var(--accent-soft); color: var(--accent-strong); }
@media (min-width: 768px) { .settings-nav { flex-wrap: wrap; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; } }
.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; }
.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 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; } }

/* ---------- 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; }
.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; }
