/* Belegbox. Ruhig, papierhaft, zwei Personen, ein Haushalt. */
:root {
  --papier: #f6f7f4;
  --flaeche: #ffffff;
  --tinte: #1d2a2e;
  --tinte-2: #52646a;
  --linie: #dfe4e0;
  --gruen: #2f6f5e;
  --gruen-dunkel: #245647;
  --gruen-hell: #dcebe4;
  --bernstein: #c98a1f;
  --bernstein-hell: #fbefd6;
  --rot: #b3261e;
  --rot-hell: #f8e1df;
  --blau-hell: #e3ecf3;
  --radius: 10px;
  --radius-gross: 16px;
  --schatten: 0 1px 2px rgba(29,42,46,.06), 0 6px 20px -12px rgba(29,42,46,.18);
  --font: "Avenir Next", "Helvetica Neue", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tab-h: 62px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.45; color: var(--tinte); background: var(--papier); }
a { color: var(--gruen); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.75rem; font-weight: 600; letter-spacing: -.01em; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; font-weight: 600; margin: 0 0 .6rem; }
h3 { font-size: 1rem; font-weight: 600; margin: 0 0 .4rem; }
p { margin: 0 0 .8rem; }
.muted { color: var(--tinte-2); }
.small { font-size: .875rem; }
.mt { margin-top: 1rem; }
.mb { margin-bottom: 1rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: #fff; padding: .5rem; z-index: 99; }
hr { border: 0; border-top: 1px solid var(--linie); margin: 1rem 0; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9em; background: var(--papier); padding: .1em .35em; border-radius: 4px; }

/* Kopfzeile */
.topbar { display: flex; align-items: center; gap: 1.25rem; padding: 0 1.25rem; height: 56px; background: var(--flaeche); border-bottom: 1px solid var(--linie); position: sticky; top: 0; z-index: 20; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.05rem; color: var(--tinte); letter-spacing: -.01em; }
.brand.big { font-size: 1.4rem; margin-bottom: 1.25rem; }
.mainnav { display: flex; gap: .15rem; flex: 1; }
.mainnav a { padding: .45rem .7rem; border-radius: 8px; color: var(--tinte-2); font-weight: 500; font-size: .95rem; }
.mainnav a:hover { background: var(--papier); text-decoration: none; color: var(--tinte); }
.mainnav a.aktiv { background: var(--gruen-hell); color: var(--gruen-dunkel); }
.search input { width: 240px; }
.user { display: flex; align-items: center; gap: .6rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--u, var(--gruen)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; text-transform: uppercase; }
.avatar:hover { text-decoration: none; }

.content { max-width: 1240px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.messages { margin-bottom: 1rem; }
.alert { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: .6rem; border: 1px solid transparent; }
.alert-success { background: var(--gruen-hell); border-color: #bcd9cb; color: var(--gruen-dunkel); }
.alert-error, .alert-danger { background: var(--rot-hell); border-color: #ecc4c0; color: var(--rot); }
.alert-warning { background: var(--bernstein-hell); border-color: #ead6a6; color: #7a5210; }
.alert-info { background: var(--blau-hell); border-color: #c7d8e6; color: #2b4a63; }

/* Kacheln der Startseite */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.tile { display: flex; flex-direction: column; gap: .6rem; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius-gross); padding: 1.1rem 1.2rem; min-height: 170px; color: var(--tinte); box-shadow: var(--schatten); transition: border-color .15s; }
.tile:hover { text-decoration: none; border-color: var(--gruen); }
.tile-head h2 { margin: 0; font-size: 1.1rem; }
.tile-head .muted { font-size: .85rem; }
.tile-big { font-size: 2.2rem; font-weight: 600; letter-spacing: -.02em; line-height: 1; margin-top: auto; }
.tile-big small { display: block; font-size: .8rem; font-weight: 500; color: var(--tinte-2); margin-top: .35rem; letter-spacing: 0; }
.tile-lines { list-style: none; margin: 0; padding: 0; font-size: .875rem; color: var(--tinte-2); }
.tile-lines li { padding: .15rem 0; border-top: 1px dashed var(--linie); }
.tile-alert { border-left: 4px solid var(--bernstein); }
.tile-alert .tile-big { color: var(--bernstein); }
.tile-shield { background: linear-gradient(180deg, #fff, var(--gruen-hell)); }

/* Karten, Raster */
.card { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius-gross); padding: 1.1rem 1.2rem; box-shadow: var(--schatten); color: var(--tinte); }
a.card:hover { text-decoration: none; border-color: var(--gruen); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-2 > *, .grid-3 > *, .tiles > * { min-width: 0; }
code, pre, .secret { overflow-wrap: anywhere; }
pre { white-space: pre-wrap; }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }

/* Formulare */
label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; font-weight: 500; color: var(--tinte-2); }
label.check { flex-direction: row; align-items: center; gap: .5rem; }
input, select, textarea { font: inherit; color: var(--tinte); background: #fff; border: 1px solid #c9d1cc; border-radius: 8px; padding: .55rem .7rem; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #a9d3c3; outline-offset: 1px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--gruen); }
textarea { min-height: 90px; }
.err { color: var(--rot); font-size: .85rem; }
.help { font-size: .82rem; color: var(--tinte-2); font-weight: 400; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; font-size: .95rem; padding: .55rem 1rem; border-radius: 8px; border: 1px solid #c9d1cc; background: #fff; color: var(--tinte); cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--papier); text-decoration: none; }
.btn-primary { background: var(--gruen); border-color: var(--gruen); color: #fff; }
.btn-primary:hover { background: var(--gruen-dunkel); }
.btn-danger { color: var(--rot); border-color: #ecc4c0; }
.btn-danger:hover { background: var(--rot-hell); }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; }
.btn-link { background: none; border: 0; color: var(--tinte-2); font-weight: 500; padding: .3rem .4rem; }
.btn-link:hover { color: var(--tinte); background: none; text-decoration: underline; }
.btn-block { width: 100%; }

/* Tabellen */
table { width: 100%; border-collapse: collapse; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--linie); vertical-align: top; }
th { font-size: .8rem; font-weight: 600; color: var(--tinte-2); background: #fafbfa; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.faellig td { background: var(--bernstein-hell); }
tr.ueberfaellig td { background: var(--rot-hell); }
.table-wrap { overflow-x: auto; }

/* Statusmarken */
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .15rem .5rem; border-radius: 999px; background: var(--papier); color: var(--tinte-2); border: 1px solid var(--linie); white-space: nowrap; }
.badge-gruen { background: var(--gruen-hell); color: var(--gruen-dunkel); border-color: transparent; }
.badge-gelb { background: var(--bernstein-hell); color: #7a5210; border-color: transparent; }
.badge-rot { background: var(--rot-hell); color: var(--rot); border-color: transparent; }
.badge-blau { background: var(--blau-hell); color: #2b4a63; border-color: transparent; }

/* Fälligkeitsleiste */
.timeline { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .4rem; }
.timeline .tl { min-width: 150px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: .6rem .75rem; }
.timeline .tl strong { display: block; font-size: 1.1rem; }

/* Leerzustand */
.empty { text-align: center; padding: 3rem 1rem; color: var(--tinte-2); background: var(--flaeche); border: 1px dashed var(--linie); border-radius: var(--radius-gross); }
.empty p { margin-bottom: 1rem; }

/* Anmeldung */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.auth-card { width: min(420px, 100%); background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius-gross); padding: 2rem; box-shadow: var(--schatten); }
.qr-box { display: flex; justify-content: center; padding: .5rem; background: #fff; border: 1px solid var(--linie); border-radius: var(--radius); }
.secret { display: block; word-break: break-all; padding: .5rem; margin-top: .4rem; }
.codes { columns: 2; list-style: none; padding: 0; margin: 1rem 0; }
.codes li { padding: .25rem 0; }
.codes code { font-size: 1.05rem; }

/* Mobil */
.tabbar { display: none; }
.m-hero { margin-bottom: 1rem; }
.m-capture { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; height: 150px; border-radius: var(--radius-gross); background: var(--gruen); color: #fff; font-size: 1.3rem; font-weight: 600; box-shadow: var(--schatten); }
.m-capture small { font-weight: 400; opacity: .85; font-size: .9rem; }
.m-capture:hover { text-decoration: none; background: var(--gruen-dunkel); }
.m-cards { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.m-cards .card p { font-size: 1.4rem; font-weight: 600; margin: 0; }
.m-cards .card small { display: block; color: var(--tinte-2); }

@media (max-width: 980px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .mainnav { display: none; }
  .search input { width: 160px; }
}
@media (max-width: 640px) {
  body { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }
  .topbar { gap: .6rem; padding: 0 .8rem; }
  .search { display: none; }
  .user .btn-link, .user .btn-primary { display: none; }
  .content { padding: 1rem .8rem 2rem; }
  .tiles, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .tile { min-height: 0; }
  h1 { font-size: 1.4rem; }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--flaeche); border-top: 1px solid var(--linie); z-index: 30; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; font-size: .7rem; font-weight: 500; color: var(--tinte-2); }
  .tabbar a .ic { font-size: 1.3rem; line-height: 1; }
  .tabbar a.aktiv { color: var(--gruen); }
  .tabbar a.capture .ic { background: var(--gruen); color: #fff; border-radius: 50%; width: 40px; height: 40px; display: grid; place-items: center; font-size: 1.1rem; margin-top: -14px; box-shadow: var(--schatten); }
  th, td { padding: .5rem .5rem; font-size: .9rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .topbar, .tabbar, .toolbar, .btn { display: none !important; } body { background: #fff; } }
