/* Muffenale Test – zuerst fürs Handy, Hell/Dunkel über data-theme */
:root {
  --bg: #fbf7f2;
  --surface: #ffffff;
  --surface-2: #f4ede4;
  --text: #241d17;
  --muted: #6b5f55;
  --border: #e3d8cb;
  --primary: #b4400f;
  --primary-text: #ffffff;
  --primary-hover: #93330a;
  --accent: #2f6f4e;
  --danger: #b3261e;
  --ok-bg: #e5f3ea; --ok-fg: #1f5a3a;
  --err-bg: #fbe7e5; --err-fg: #8c1d16;
  --info-bg: #fff1dc; --info-fg: #7a4300;
  --warn-bg: #fff4cc; --warn-fg: #6b4e00;
  --focus: #1d5fd1;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 2px 8px rgba(60, 40, 20, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17130f; --surface: #221c17; --surface-2: #2c251f; --text: #f3ece4; --muted: #b9ab9d; --border: #3d342c;
    --primary: #ff9a62; --primary-text: #1b120c; --primary-hover: #ffb48a; --accent: #7dcfa2; --danger: #ff8a80;
    --ok-bg: #173526; --ok-fg: #a8e6c1; --err-bg: #3d1915; --err-fg: #ffb4ab; --info-bg: #3a2810; --info-fg: #ffd59a;
    --warn-bg: #3a3110; --warn-fg: #ffe28a; --focus: #8ab4ff; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17130f; --surface: #221c17; --surface-2: #2c251f; --text: #f3ece4; --muted: #b9ab9d; --border: #3d342c;
  --primary: #ff9a62; --primary-text: #1b120c; --primary-hover: #ffb48a; --accent: #7dcfa2; --danger: #ff8a80;
  --ok-bg: #173526; --ok-fg: #a8e6c1; --err-bg: #3d1915; --err-fg: #ffb4ab; --info-bg: #3a2810; --info-fg: #ffd59a;
  --warn-bg: #3a3110; --warn-fg: #ffe28a; --focus: #8ab4ff; --shadow: none; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column; overflow-wrap: break-word;
}
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: .4rem 0 .6rem; }
h2 { font-size: 1.2rem; margin: 0 0 .6rem; }
h3 { font-size: 1.05rem; margin: .8rem 0 .4rem; }
p { margin: 0 0 .8rem; }
code { font-size: .9em; background: var(--surface-2); padding: .1em .3em; border-radius: 4px; }
.wrap-anywhere { overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.lead { font-size: 1.05rem; color: var(--muted); }
.pre { white-space: pre-line; }
.center { text-align: center; }
.sr-only { position: absolute !important; left: 0; top: 0; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0 !important; }
.skip { position: absolute; left: -999px; top: 0; background: var(--primary); color: var(--primary-text); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: .5rem; top: .5rem; }

/* Kopf */
.top { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.top-inner { max-width: 1100px; margin: 0 auto; padding: .55rem 1rem; display: flex; align-items: center; gap: .75rem; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.brand img { border-radius: 8px; }
.area-name { margin-left: auto; font-size: .85rem; color: var(--muted); max-width: 40vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-toggle { display: none; }
.mainnav ul { list-style: none; margin: 0 auto; padding: 0 1rem .5rem; max-width: 1100px; display: flex; flex-wrap: wrap; gap: .15rem .25rem; }
.mainnav a, .mainnav .linklike { display: block; padding: .45rem .65rem; border-radius: 8px; text-decoration: none; color: var(--text); font-size: .95rem; }
.mainnav a:hover, .mainnav .linklike:hover { background: var(--surface-2); color: var(--text); }
.mainnav a[aria-current="page"] { background: var(--primary); color: var(--primary-text); }
.js .nav-toggle {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 .9rem; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); border-radius: 8px; font: inherit; cursor: pointer;
}
.js .mainnav { display: none; }
.js .mainnav.open { display: block; }
.js .mainnav.open ul { flex-direction: column; }
@media (min-width: 900px) {
  .js .nav-toggle { display: none; }
  .js .mainnav, .js .mainnav.open { display: block; }
  .js .mainnav.open ul { flex-direction: row; }
}

/* Inhalt */
main.wrap { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 1rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; box-shadow: var(--shadow); }
.narrow { max-width: 560px; margin: 1rem auto; }
.cols { display: grid; gap: 1rem; grid-template-columns: 1fr; align-items: start; }
.cols > .card { margin: 0; }
@media (min-width: 760px) { .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .cols { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.head-row h1, .head-row h2, .head-row h3 { margin: 0; }
.head-row + * { margin-top: .75rem; }
.crumbs { margin: 0 0 .25rem; font-size: .9rem; }
.crumbs a::before { content: "‹ "; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin: 0 0 1rem; }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { display: flex; flex-direction: column; gap: .2rem; padding: .9rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.tile:hover { border-color: var(--primary); color: var(--text); }
.tile .num { font-size: 1.6rem; font-weight: 700; color: var(--primary); line-height: 1.1; }

dl.facts { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: .35rem .75rem; margin: 0 0 1rem; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
.big { font-size: 1.3rem; font-weight: 700; }

/* Hinweise */
.flash { padding: .75rem 1rem; border-radius: var(--radius); margin: 0 0 1rem; border: 1px solid transparent; }
.flash-ok { background: var(--ok-bg); color: var(--ok-fg); }
.flash-error { background: var(--err-bg); color: var(--err-fg); }
.flash-info { background: var(--info-bg); color: var(--info-fg); }
.flash-warn { background: var(--warn-bg); color: var(--warn-fg); }
.flash a { color: inherit; font-weight: 600; }

/* Formulare */
.stack > * + * { margin-top: .75rem; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field label { font-weight: 600; font-size: .95rem; }
.field label.check { font-weight: 400; display: flex; gap: .55rem; align-items: center; min-height: 44px; cursor: pointer; }
.hint { color: var(--muted); font-size: .85rem; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=url], input[type=tel], input[type=number],
input[type=date], input[type=datetime-local], input[type=file], select, textarea {
  width: 100%; min-height: 44px; padding: .55rem .7rem; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
}
input[type=file] { padding: .45rem; }
input[type=checkbox], input[type=radio] { width: 1.25rem; height: 1.25rem; accent-color: var(--primary); flex: none; }
textarea { min-height: 5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem 1rem; margin: 0; min-width: 0; }
legend { font-weight: 700; padding: 0 .3rem; }
.grid2, .grid3 { display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 560px) { .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.checks-row { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
.filters { display: grid; gap: .75rem; grid-template-columns: 1fr 1fr; align-items: end; margin: 0 0 1rem; }
.filters .field:first-of-type { grid-column: 1 / -1; }
@media (min-width: 760px) { .filters { grid-template-columns: 2fr 1fr 1fr auto; } .filters .field:first-of-type { grid-column: auto; } }
.label-spacer { display: none; }

.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .5rem 1rem;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); text-align: center;
}
.btn:hover { border-color: var(--primary); color: var(--text); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-text); }
.btn-danger { color: var(--danger); border-color: currentColor; background: transparent; }
.btn-danger.armed { background: var(--danger); color: #fff; border-color: var(--danger); }
:root[data-theme="dark"] .btn-danger.armed { color: #1b120c; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; color: var(--primary); padding: 0; text-align: left; width: 100%; }
form.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0 0 .5rem; }
.actions form.inline { display: inline-flex; }

/* Tabellen: am Handy als Karten */
table.list { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin: 0 0 1rem; }
table.list th, table.list td { padding: .6rem .7rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
table.list th { background: var(--surface-2); font-size: .85rem; }
table.list .num { text-align: right; white-space: nowrap; }
tr.inactive td { opacity: .65; }
@media (max-width: 759px) {
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.list { border: 0; background: none; }
  table.list tr { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 .75rem; padding: .4rem .2rem; }
  table.list td { border: 0; padding: .25rem .7rem; display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: .5rem; }
  table.list td.num { text-align: left; white-space: normal; }
  table.list td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .85rem; }
  table.list td:not([data-label]) { display: block; }
}

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.badge-bestaetigt { background: var(--ok-bg); color: var(--ok-fg); }
.badge-angefragt { background: var(--info-bg); color: var(--info-fg); }
.badge-abgesagt { background: var(--err-bg); color: var(--err-fg); }

ul.plain, ul.cards, ol.timeline, ul.files, ul.weather, ol.log { list-style: none; margin: 0; padding: 0; }
ul.plain li, ul.weather li { padding: .3rem 0; border-bottom: 1px solid var(--border); }
ul.cards { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { ul.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
ul.cards > .card { margin: 0; }
ol.timeline > li.card { margin: 0 0 .75rem; }
ol.timeline .day h2 { margin: 1rem 0 .5rem; }
.timeline .time { color: var(--primary); font-weight: 700; margin: 0 0 .2rem; }
.timeline h3 { margin: 0 0 .3rem; }
ol.log li { padding: .25rem 0; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; border-bottom: 1px dashed var(--border); }

.qr { display: inline-block; background: #fff; padding: .5rem; border-radius: 8px; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.25rem; letter-spacing: .1em; font-weight: 700; }
ul.files { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); margin: 0 0 1rem; }
ul.files li { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; }
ul.files a { display: flex; flex-direction: column; gap: .3rem; text-decoration: none; color: var(--text); }
ul.files img { width: 100%; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); }
.file-icon { display: flex; align-items: center; justify-content: center; height: 90px; border-radius: 6px; background: var(--surface-2); font-weight: 700; color: var(--muted); border: 1px solid var(--border); }
.fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ul.files .btn { min-height: 36px; padding: .25rem .6rem; font-size: .85rem; }
.copy-row { display: flex; gap: .5rem; margin: 0 0 .75rem; }
.copy-row input { flex: 1; min-width: 0; font-size: .85rem; }

.video-box { background: #000; border-radius: var(--radius); overflow: hidden; margin: 0 0 .75rem; aspect-ratio: 4 / 3; max-width: 520px; }
.video-box video { width: 100%; height: 100%; object-fit: cover; display: block; }

ul.checks { list-style: none; padding: 0; margin: 0 0 1rem; }
ul.checks li { padding: .3rem 0 .3rem 1.8rem; position: relative; }
ul.checks li::before { position: absolute; left: 0; font-weight: 700; }
ul.checks li.ok::before { content: "✓"; color: var(--accent); }
ul.checks li.bad::before { content: "✗"; color: var(--danger); }
ul.checks li.warn::before { content: "!"; color: var(--info-fg); }
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .5rem; vertical-align: baseline; }
.dot-ok { background: var(--accent); }
.dot-warn { background: #d99a00; }
.dot-bad { background: var(--danger); }

.legal h1 { font-size: 1.5rem; }
.legal h2 { font-size: 1.15rem; margin-top: 1.2rem; }
.legal-stand { color: var(--muted); font-size: .85rem; }

/* Fuß */
.foot { border-top: 1px solid var(--border); background: var(--surface); margin-top: 1rem; }
.foot-inner { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; justify-content: space-between; padding-top: .75rem; padding-bottom: .75rem; }
.foot .wrap { max-width: 1100px; margin: 0 auto; padding-left: 1rem; padding-right: 1rem; width: 100%; }
.legal-links { display: flex; gap: 1rem; }
.legal-links a { display: inline-flex; align-items: center; min-height: 44px; }
.theme-switch { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .25rem .9rem; align-items: center; }
.theme-switch legend { float: left; font-weight: 600; font-size: .9rem; padding: 0; margin-right: .5rem; }
.theme-switch label { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; cursor: pointer; font-size: .9rem; }
.foot p { margin: 0; }

@media print {
  .top, .foot, .actions, form { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 0; box-shadow: none; }
}
