/* Grundgestaltung – nutzt die Variablen aus theme.css */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.5 var(--font-body); min-height: 100vh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom, 0); }
a { color: var(--brand); }
@media (prefers-color-scheme: dark) { a { color: #8fb6e6; } }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 18px; }
main.wrap { flex: 1; padding-top: 24px; padding-bottom: 120px; }

/* Kopf */
.site-header { position: sticky; top: 0; z-index: 30; background: var(--header-bg); box-shadow: 0 2px 10px rgba(0,0,0,.06); padding-top: env(safe-area-inset-top, 0); }
.topbar { background: var(--topbar-bg); color: var(--topbar-text); font-size: .8rem; }
.topbar .wrap { display: flex; justify-content: space-between; align-items: center; min-height: 30px; gap: 10px; }
.mainbar { display: flex; align-items: center; gap: 18px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--header-text); }
.brand .logo { height: 30px; width: auto; display: block; }
@media (prefers-color-scheme: dark) { .brand .logo { filter: brightness(0) invert(1); } }
.brand .app-name { font-family: var(--font-head); font-size: .8rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); border-left: 2px solid var(--accent); padding-left: 12px; }
#nav { display: flex; gap: 2px; flex-wrap: wrap; margin-left: auto; align-items: center; }
#nav a, #nav button { font: 600 .82rem var(--font-head); text-transform: uppercase; letter-spacing: .06em; color: var(--header-text); text-decoration: none;
  padding: 10px 12px; border: 0; background: none; cursor: pointer; border-bottom: 3px solid transparent; min-height: auto; border-radius: 0; }
#nav a:hover { color: var(--accent); }
#nav a.active { border-bottom-color: var(--accent); }
#nav .nav-logout { color: var(--muted); }
.menu-toggle { display: none; margin-left: auto; font-size: 1.4rem; background: none; border: 0; color: var(--header-text); }
@media (max-width: 860px) {
  .menu-toggle { display: block; }
  #nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--header-bg); flex-direction: column; align-items: stretch; padding: 8px 18px 14px; box-shadow: 0 8px 16px rgba(0,0,0,.1); }
  body.menu-open #nav { display: flex; }
  #nav a, #nav button { text-align: left; border-bottom: 1px solid var(--line); }
  .brand .app-name { display: none; }
}
.net { padding: 2px 10px; border-radius: 99px; background: rgba(255,255,255,.15); white-space: nowrap; }
.net.off { background: var(--star); color: #1d2125; }
.net.pending { font-weight: 600; }

/* Fuß */
.site-footer { background: var(--footer-bg); color: var(--footer-text); font-size: .8rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 16px; padding-bottom: 16px; }
.site-footer .muted { color: inherit; opacity: .7; }

/* Typografie */
h1, h2, h3 { font-family: var(--font-head); color: var(--brand); letter-spacing: var(--head-spacing); line-height: 1.2; }
@media (prefers-color-scheme: dark) { h1, h2, h3 { color: var(--text); } }
h1 { font-size: 1.6rem; margin: .1em 0 .6em; text-transform: var(--head-transform); font-weight: 700; }
h2 { font-size: 1.1rem; margin: 0 0 .7em; text-transform: var(--head-transform); }
h3 { font-size: 1rem; margin: 1.1em 0 .4em; }
h1::after { content: ""; display: block; width: 48px; height: 3px; background: var(--accent); margin-top: 10px; }
.eyebrow { font: 600 .74rem var(--font-head); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.back { display: inline-block; font-size: .85rem; margin-bottom: 8px; text-decoration: none; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.label { display: block; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.error-text { color: var(--bad); font-size: .9rem; min-height: 1em; }

/* Bausteine */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 0 0 14px; box-shadow: var(--shadow); }
.card.click { cursor: pointer; border-left: 4px solid transparent; transition: border-color .15s; }
.card.click:hover { border-left-color: var(--accent); }
.card-title { font-size: 1.05rem; color: var(--brand); }
@media (prefers-color-scheme: dark) { .card-title { color: var(--text); } }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; } .row.end { justify-content: flex-end; }
.row.chips { gap: 6px; margin-top: 8px; }
.grid { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin-bottom: 12px; }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.facts > div { min-width: 0; overflow-wrap: anywhere; }
label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 10px; }
label > input, label > select, label > textarea { margin-top: 4px; }
label.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: .95rem; }
label.check input { width: auto; min-height: auto; margin: 0; }
input, select, textarea, button { font: inherit; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); min-height: 44px; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
input:disabled, select:disabled, textarea:disabled { background: var(--bg); color: var(--muted); }
.search { margin-bottom: 14px; }
.w-sm { min-width: 74px; } .w-md { min-width: 130px; } .w-lg { max-width: 280px; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; font-weight: 600; font-size: .9rem; }
button:hover, .btn:hover { border-color: var(--brand); }
button.primary, .btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); text-transform: uppercase; letter-spacing: .05em; font-size: .82rem; }
button.primary:hover, .btn.primary:hover { background: var(--brand-dark); }
button.block { width: 100%; margin-top: 6px; }
button.danger { color: var(--bad); border-color: var(--bad); }
button.ghost { border-color: transparent; background: transparent; }
button.xs { min-height: auto; padding: 0 4px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--brand-light); font-size: .75rem; white-space: nowrap; }
.chip.lg { font-size: .9rem; }
.chip.entwurf { background: #e3ecf7; color: #0d2c54; }
.chip.unterschrieben { background: #fff1dc; color: #8a4b00; }
.chip.abgeschlossen { background: #dff3e5; color: #1a6b31; }
.chip.warn { background: var(--star); color: #1d2125; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .74rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
tr.inactive td { opacity: .55; }
.scroll { overflow-x: auto; }
.tbl-input td input, .tbl-input td select { min-height: 40px; padding: 6px 8px; }
.right { text-align: right; } .nowrap { white-space: nowrap; }
.tabs { display: flex; gap: 0; flex-wrap: wrap; margin: 6px 0 16px; border-bottom: 2px solid var(--line); }
.tabs button { border: 0; border-radius: 0; background: none; border-bottom: 3px solid transparent; margin-bottom: -2px; font: 600 .8rem var(--font-head); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tabs button.active { color: var(--brand); border-bottom-color: var(--accent); }
@media (prefers-color-scheme: dark) { .tabs button.active { color: var(--text); } }
.banner { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 14px; border: 1px solid var(--line); background: var(--surface); }
.banner.info { border-left: 4px solid var(--brand); } .banner.warn { border-left: 4px solid var(--mark-line); background: var(--mark); }
.checkbox-list { max-height: 160px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; }
.checkbox-list label { margin: 4px 0; }
dialog { border: 0; border-radius: 6px; padding: 0; max-width: min(780px, 96vw); width: 100%; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(8,29,56,.55); }
dialog .dlg { padding: 22px; max-height: 88vh; overflow: auto; }
#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
#toast div { background: var(--brand-dark); color: #fff; padding: 10px 18px; border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 90vw; }
#toast div.err { background: var(--bad); }
.login-wrap { min-height: 60vh; display: grid; place-items: center; }
.login { width: 100%; max-width: 420px; border-top: 4px solid var(--accent); }
.qr { background: #fff; padding: 8px; display: inline-block; border-radius: var(--radius); }
.qr svg { display: block; width: 220px; height: 220px; }
.hide { display: none !important; }
input.invalid { border-color: var(--bad); background: #fdecec; }
@media (prefers-color-scheme: dark) { input.invalid { background: #3a1c1c; } }
button.sm { min-height: 36px; padding: 4px 10px; font-size: .75rem; }
input.unknown { color: var(--muted); background: var(--bg); }
