/* Bauzeitplan – große Schrift, hoher Kontrast, große Knöpfe mit Text */

@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-display: swap; src: url("../fonts/atkinson-400.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-display: swap; src: url("../fonts/atkinson-700.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600; font-display: swap; src: url("../fonts/barlow-sc-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 700; font-display: swap; src: url("../fonts/barlow-sc-700.woff2") format("woff2"); }

:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --fg: #16202e;
  --muted: #4a5668;
  --line: #c9d1dc;
  --accent: #1d4f91;
  --accent-fg: #ffffff;
  --accent-soft: #dfe8f5;
  --signal: #f2b705;
  --weekend: #e7ebf1;
  --holiday: #fbecc4;
  --danger: #b3261e;
  --ok: #2e7d32;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", Verdana, sans-serif;
  --font-head: "Barlow Semi Condensed", "Arial Narrow", "Segoe UI", sans-serif;
  --fs: 19px;
  color-scheme: light;
}
/* Dunkel: wie das Gerät (außer "Hell" gewählt) oder ausdrücklich "Dunkel" gewählt */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11161e; --surface: #1a212c; --fg: #eef2f7; --muted: #b3bdcb; --line: #354052;
    --accent: #7fb0f0; --accent-fg: #0d1520; --accent-soft: #23334a; --signal: #f2c230;
    --weekend: #202836; --holiday: #3a3220; --danger: #ff8a80; --ok: #81c784;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11161e; --surface: #1a212c; --fg: #eef2f7; --muted: #b3bdcb; --line: #354052;
  --accent: #7fb0f0; --accent-fg: #0d1520; --accent-soft: #23334a; --signal: #f2c230;
  --weekend: #202836; --holiday: #3a3220; --danger: #ff8a80; --ok: #81c784;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: var(--fs); line-height: 1.5; padding-inline: 16px; padding-block: 0 48px; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: 2rem; } h2 { font-size: 1.6rem; } h3 { font-size: 1.25rem; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
.wrap { max-width: 1200px; margin: 0 auto; display: grid; gap: 20px; }
.hint { color: var(--muted); font-size: 0.95rem; }
.num { font-variant-numeric: tabular-nums; }
.phone { user-select: all; font-variant-numeric: tabular-nums; white-space: nowrap; }
.loading { padding: 40px 0; color: var(--muted); }

/* Kopf */
.apphead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-block: 8px; border-bottom: 3px solid var(--accent); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--fg); }
.brand .logo { width: 44px; height: 44px; border-radius: 8px; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; }
.brand .logo svg { width: 28px; height: 28px; }
.brand span { font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; }
.who { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; color: var(--muted); }

/* Knöpfe */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 10px 22px; border-radius: 10px; border: 2px solid var(--accent); background: var(--accent); color: var(--accent-fg); font-weight: 700; cursor: pointer; text-decoration: none; text-align: center; }
.btn.secondary { background: var(--surface); color: var(--accent); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: var(--surface); }
.btn.big { min-height: 64px; font-size: 1.15rem; padding-inline: 28px; }
.btn.small { min-height: 46px; padding: 6px 16px; }
.btn:hover { filter: brightness(1.08); }
.btn[disabled] { opacity: .6; cursor: default; }

.crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.projtitle { display: grid; gap: 2px; min-width: 0; flex: 1 1 300px; }
.projtitle p { color: var(--muted); }

/* Reiter */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab { flex: 1 1 180px; min-height: 60px; border: 2px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 12px; font-weight: 700; font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; }
.tab[aria-current="page"] { border-color: var(--accent); background: var(--accent); color: var(--accent-fg); }
.tab svg { width: 24px; height: 24px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.toolbar .group { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.empty { background: var(--surface); border: 2px dashed var(--line); border-radius: 12px; padding: 32px 20px; display: grid; gap: 16px; justify-items: start; }

/* Formulare */
.login { max-width: 460px; margin: 40px auto 0; display: grid; gap: 20px; }
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-weight: 700; }
.field input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), .field select, .field textarea { min-height: 52px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); width: 100%; }
.field textarea { min-height: 90px; resize: vertical; }
.field small { color: var(--muted); font-size: 0.9rem; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.error { color: var(--danger); font-weight: 700; }
.calc { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; }

/* Projektkarten */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 20px; display: grid; gap: 12px; cursor: pointer; text-align: left; color: var(--fg); text-decoration: none; align-content: start; }
.card:hover { border-color: var(--accent); }
.card .meta { color: var(--muted); }
.status { justify-self: start; padding: 2px 12px; border-radius: 999px; font-size: 0.9rem; font-weight: 700; background: var(--accent-soft); color: var(--fg); }
.progress { height: 12px; background: var(--weekend); border-radius: 6px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ok); }
.card.new { border-style: dashed; place-items: center; align-content: center; text-align: center; min-height: 200px; color: var(--accent); font-family: var(--font-head); font-size: 1.5rem; font-weight: 700; background: var(--surface); }
.card.new .plus { font-size: 3rem; line-height: 1; }

/* Zeitplan (Gantt) */
.ganttframe { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.gantt { position: relative; width: calc(var(--label) + var(--width)); }
.gantt .grow { display: flex; }
.gantt .lbl { position: sticky; left: 0; z-index: 2; flex: none; width: var(--label); background: var(--surface); border-right: 2px solid var(--line); padding: 8px 12px; display: grid; align-content: center; min-height: 72px; border-bottom: 1px solid var(--line); cursor: pointer; text-align: left; border-top: 0; border-left: 0; color: var(--fg); }
.gantt .lbl:hover b { text-decoration: underline; }
.gantt .lbl b { font-size: 1.05rem; }
.gantt .lbl small { color: var(--muted); font-size: 0.88rem; line-height: 1.35; }
.gantt .lbl .dates { color: var(--fg); font-variant-numeric: tabular-nums; }
.gantt .lbl.headcell { min-height: 0; font-weight: 700; color: var(--muted); cursor: default; }
.gantt .row { position: relative; border-bottom: 1px solid var(--line); min-height: 72px; width: var(--width); flex: none; }
.gantt .scale { position: relative; height: 58px; border-bottom: 2px solid var(--line); width: var(--width); flex: none; }
.scale .m { position: absolute; top: 4px; font-weight: 700; font-size: 0.95rem; padding-left: 6px; border-left: 2px solid var(--line); height: 26px; white-space: nowrap; }
.scale .w { position: absolute; bottom: 4px; font-size: 0.78rem; color: var(--muted); padding-left: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gantt .shade { position: absolute; top: 58px; bottom: 0; pointer-events: none; }
.gantt .shade i { position: absolute; top: 0; bottom: 0; background: var(--weekend); opacity: .7; }
.gantt .shade i.h { background: var(--holiday); opacity: 1; }
.gridline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); opacity: 0.6; }
.bar { position: absolute; top: 16px; height: 40px; border-radius: 8px; cursor: grab; border: 0; padding: 0; box-shadow: inset 0 -4px 0 rgba(0,0,0,.18); touch-action: none; overflow: hidden; }
.bar .done { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255,255,255,.3); pointer-events: none; }
.bar:hover, .bar:focus-visible { outline: 3px solid var(--signal); outline-offset: 1px; }
.bar.dragging { cursor: grabbing; opacity: .85; outline: 3px dashed var(--signal); z-index: 3; }
.outside { position: absolute; top: 26px; font-size: 0.85rem; color: var(--muted); white-space: nowrap; pointer-events: none; }
.today { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--signal); z-index: 1; pointer-events: none; }
.today b { position: absolute; bottom: 6px; left: 6px; background: var(--signal); color: #16202e; font-size: 0.8rem; padding: 0 6px; border-radius: 4px; white-space: nowrap; }
.dragtip { position: fixed; z-index: 70; background: var(--fg); color: var(--bg); padding: 8px 14px; border-radius: 10px; font-weight: 700; pointer-events: none; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; color: var(--muted); font-size: 0.95rem; }
.legend i { display: inline-block; width: 18px; height: 18px; border-radius: 4px; vertical-align: -3px; margin-right: 6px; border: 1px solid var(--line); }

/* Kalender */
.calhead { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.calhead h2 { min-width: 9ch; text-align: center; }
.calframe { overflow-x: auto; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); min-width: 840px; background: var(--surface); }
.cal .dow { padding: 8px; font-weight: 700; text-align: center; border-right: 1px solid var(--line); border-bottom: 2px solid var(--line); }
.cal .day { min-height: 128px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal .day.we { background: var(--weekend); }
.cal .day.hol { background: var(--holiday); }
.cal .day.other { opacity: 0.45; }
.cal .dnum { font-weight: 700; font-variant-numeric: tabular-nums; display: flex; justify-content: space-between; gap: 6px; }
.cal .dnum em { font-style: normal; font-weight: 400; font-size: 0.78rem; color: var(--muted); text-align: right; }
.cal .dnum .todaynum { background: var(--signal); color: #16202e; border-radius: 6px; padding: 0 6px; }
.chip { border-radius: 6px; color: #fff; font-size: 0.85rem; font-weight: 700; padding: 3px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border: 0; text-align: left; text-shadow: 0 1px 1px rgba(0,0,0,.35); }

/* Liste */
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; min-width: 820px; }
th, td { text-align: left; padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.95rem; color: var(--muted); }
td.num { white-space: nowrap; }
.swatch { display: inline-block; width: 22px; height: 22px; border-radius: 5px; vertical-align: -5px; margin-right: 10px; }

/* Dialoge */
.backdrop { position: fixed; inset: 0; background: rgba(10,15,25,.55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.dialog { background: var(--surface); color: var(--fg); border-radius: 16px; width: min(640px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 24px; display: grid; gap: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.dialog .actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }
.dialog .actions .right { display: flex; flex-wrap: wrap; gap: 12px; margin-left: auto; }
.dialog ul { margin: 0; padding-left: 1.2em; }
.colors { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.colors button { width: 52px; height: 52px; border-radius: 10px; border: 3px solid transparent; cursor: pointer; }
.colors button[aria-pressed="true"], .colors label.custom.on { border-color: var(--fg); box-shadow: inset 0 0 0 3px var(--surface); }
.colors label.custom { display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px 0 6px; border: 3px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 700; }
.colors input[type="color"] { width: 40px; height: 40px; border: 0; padding: 0; background: none; cursor: pointer; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.checks label { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 12px; border: 2px solid var(--line); border-radius: 10px; cursor: pointer; }
.checks input, .hollist input, .checkline input { width: 24px; height: 24px; accent-color: var(--accent); flex: none; }
.checkline { display: flex; align-items: center; gap: 12px; cursor: pointer; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(40px + env(safe-area-inset-bottom, 0px)); background: var(--fg); color: var(--bg); padding: 12px 12px 12px 20px; border-radius: 12px; display: flex; gap: 16px; align-items: center; z-index: 60; max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.toast button { min-height: 48px; padding: 0 18px; border-radius: 8px; border: 2px solid var(--signal); background: transparent; color: var(--bg); font-weight: 700; cursor: pointer; }
.toast.err { background: var(--danger); color: #fff; }

/* Einstellungen */
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; align-items: start; }
.settings .panel { display: grid; gap: 16px; min-width: 0; }
.hollist { display: grid; }
.hollist label { display: grid; grid-template-columns: 28px 7.5em 1fr; align-items: center; gap: 10px; min-height: 46px; padding: 4px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.hollist label.off span { color: var(--muted); text-decoration: line-through; }
.rows { display: grid; gap: 8px; }
.rows > div { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border: 2px solid var(--line); border-radius: 10px; }
.themes { display: grid; gap: 12px; }
.themes .checkline { min-height: 48px; padding: 4px 12px; border: 2px solid var(--line); border-radius: 10px; }
.logobox { display: flex; align-items: center; min-height: 60px; }
.logoprev { max-height: 80px; max-width: 100%; object-fit: contain; background: #fff; padding: 6px; border: 1px solid var(--line); border-radius: 8px; }
.themebtn svg { width: 22px; height: 22px; }
.badge { font-size: 0.8rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); margin-left: 6px; }

/* Druckvorschau */
.sheetwrap { overflow-x: auto; padding: 8px 0; }
.sheet { margin: 0 auto; background: #fff; color: #111; padding: 28px 32px; box-shadow: 0 4px 24px rgba(0,0,0,.2); display: grid; gap: 14px; align-content: start; font-size: 12px; line-height: 1.35; }
.sheet.a3 { font-size: 14px; }
.sheet h2 { font-size: 22px; color: #111; }
.sheet .shead { display: flex; justify-content: space-between; border-bottom: 2px solid #111; padding-bottom: 8px; gap: 16px; }
.sheet .pg { display: grid; border: 1px solid #999; position: relative; }
.sheet .pg > div { border-bottom: 1px solid #ddd; min-height: 24px; position: relative; }
.sheet .pg .pl { padding: 3px 8px; border-right: 1px solid #999; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sheet .pbar { position: absolute; top: 5px; height: 14px; border-radius: 3px; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.sheet .pm { position: absolute; top: 3px; font-weight: 700; font-size: 11px; padding-left: 4px; border-left: 1px solid #999; height: calc(100% - 3px); white-space: nowrap; }
.sheet .ptoday { position: absolute; top: 0; bottom: 0; width: 2px; background: #e0a800; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.sheet table { min-width: 0; font-size: inherit; }
.sheet th, .sheet td { padding: 3px 6px; border-bottom: 1px solid #ccc; color: #111; }
.sheet .firmhead { align-items: flex-end; }
.sheet .firm { display: flex; gap: 14px; align-items: flex-start; min-width: 0; }
.sheet .plogo { max-height: 64px; max-width: 220px; object-fit: contain; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.sheet.a3 .plogo { max-height: 80px; max-width: 280px; }
.sheet .firmname { font-size: 1.15em; }
.sheet .foot { display: flex; justify-content: space-between; color: #555; border-top: 1px solid #999; padding-top: 6px; }

/* Fußzeile mit Programmversion */
.appfoot { position: fixed; inset-inline: 0; bottom: 0; z-index: 40; padding: 4px 16px calc(4px + env(safe-area-inset-bottom, 0px)); text-align: center; font-size: 0.8rem; color: var(--muted); background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); pointer-events: none; font-variant-numeric: tabular-nums; }

@media (max-width: 600px) {
  :root { --fs: 18px; }
  h1 { font-size: 1.6rem; }
  .brand span { font-size: 1.3rem; }
  .who .name { display: none; }
  .themebtn span { display: none; }
  .gantt .lbl { padding: 6px 8px; }
  .gantt .lbl b { font-size: 0.95rem; }
  .gantt .lbl small { font-size: 0.8rem; }
}
@media (prefers-reduced-motion: no-preference) { .btn, .tab, .card { transition: border-color .15s, background-color .15s, filter .15s; } }

@media print {
  :root { background: #fff; color-scheme: light !important; }
  body { background: #fff; padding: 0; }
  body > *:not(#app), #app > *:not(.print-area), .print-area > *:not(.sheetwrap) { display: none !important; }
  .wrap { max-width: none; display: block; }
  .sheetwrap { overflow: visible; padding: 0; }
  .sheet { box-shadow: none; margin: 0; padding: 0; width: 100% !important; }
}
