/* Farbwelt aus dem Solar-Oberberg-Logo:
   Dunkelblau #2469af · Himmelblau #189eda · Hellblau #a5d7f3
   Sonnengelb #ffd317 · Hellgrau #f3f3f4 */
:root {
    --blue: #2469af;
    --blue-dark: #1d5590;
    --sky: #189eda;
    --sky-light: #eaf4fb;
    --sun: #ffd317;
    --ink: #22303c;
    --muted: #6b7681;
    --bg: #f3f3f4;
    --line: #e2e6ea;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 15px; color: var(--ink); background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 1rem 0; color: var(--ink); }
h2 { font-size: 1.05rem; margin: 1.2rem 0 0.5rem; color: var(--blue); }

.topbar { background: #fff; border-bottom: 3px solid var(--sun); box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.topbar-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 1.5rem; padding: 0.55rem 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; }
.brand img { height: 52px; display: block; }
.topbar nav { display: flex; gap: 0.4rem; flex: 1; }
.topbar nav a { color: var(--ink); padding: 0.35rem 0.7rem; border-radius: 7px; font-weight: 500; }
.topbar nav a.active, .topbar nav a:hover { color: var(--blue); background: var(--sky-light); text-decoration: none; }
.user-box { display: flex; align-items: center; gap: 0.8rem; color: var(--muted); }

.container { max-width: 1200px; margin: 0 auto; padding: 0.5rem 1rem 3rem; }
/* Volle Breite nur für mehrspaltige Seiten – einspaltige bleiben lesbar schmal (Marco 07.07.) */
.container.wide { max-width: none; padding-left: 1.5rem; padding-right: 1.5rem; }
.container.wide .board { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.container.wide .two-col { max-width: 1760px; }
.flash { background: var(--sky-light); border: 1px solid var(--sky); color: var(--blue); padding: 0.6rem 1rem; border-radius: 8px; margin: 0.8rem 0; }
.muted { color: var(--muted); }
.error { color: #b3261e; font-size: 0.85rem; margin: 0.2rem 0; }

.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; align-items: start; }
.board-col { background: #e8ecf0; border-radius: 10px; padding: 0.7rem; }
.board-col h2 { margin: 0.2rem 0 0.7rem; font-size: 0.9rem; }
.count { background: var(--sun); color: var(--ink); border-radius: 10px; padding: 0 0.5rem; font-size: 0.75rem; font-weight: 700; }
.card { display: block; background: #fff; border-radius: 8px; padding: 0.6rem 0.7rem; margin-bottom: 0.5rem; box-shadow: 0 1px 2px rgba(0,0,0,0.08); border-left: 3px solid var(--sky); }
.card:hover { text-decoration: none; box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.card strong { display: block; color: var(--ink); }
.card .muted { display: block; font-size: 0.85rem; }
.card-meta { display: block; font-size: 0.8rem; color: var(--muted); margin-top: 0.3rem; }
.empty { text-align: center; }

.panel { background: #fff; border-radius: 10px; padding: 1rem 1.2rem; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.panel.narrow { max-width: 540px; }
.two-col { display: grid; grid-template-columns: 1fr 1.2fr; gap: 1rem; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

label { display: block; margin: 0.8rem 0 0.25rem; font-weight: 600; font-size: 0.88rem; }
input, select, textarea { width: 100%; padding: 0.5rem 0.6rem; border: 1px solid #c5ced6; border-radius: 7px; font: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid #2469af33; border-color: var(--blue); }

.btn { display: inline-block; margin-top: 1rem; background: var(--blue); color: #fff; border: 0; border-radius: 7px; padding: 0.55rem 1.2rem; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--blue-dark); }
.btn.small { margin: 0; padding: 0.25rem 0.7rem; font-size: 0.82rem; }
.linklike { background: none; border: 0; color: var(--blue); cursor: pointer; font: inherit; padding: 0; text-decoration: none; }
.linklike:hover { text-decoration: underline; }

.badge { display: inline-block; background: var(--sky-light); color: var(--blue); border-radius: 6px; padding: 0.15rem 0.6rem; font-size: 0.75rem; vertical-align: middle; }

.task-table { width: 100%; border-collapse: collapse; }
.task-table td { padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.task-due { white-space: nowrap; font-weight: 600; width: 5.5rem; }
/* Aktionen dürfen in schmalen Spalten umbrechen – aber nie mitten in einem Knopf */
.task-action { text-align: right; }
.task-action .inline, .task-action .wait-details, .task-action .btn.small, .task-action .waiting, .task-action .muted { display: inline-block; white-space: nowrap; vertical-align: middle; }
.task-action .inline + .wait-details, .task-action .wait-details + .inline, .task-action .inline + .inline { margin-left: 0.5rem; }
.task-action .wait-details[open] { display: block; }
tr.overdue .task-due, tr.overdue td:nth-child(2) { color: #b3261e; }
tr.overdue .task-due::after { content: " ⚠"; }
tr.done { opacity: 0.55; }
tr.done td:nth-child(2) { text-decoration: line-through; }

.compare td { white-space: nowrap; padding-right: 1rem; }
.compare td:first-child { width: 9rem; }

.filter { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filter a { background: #e8ecf0; border-radius: 20px; padding: 0.3rem 0.9rem; font-size: 0.85rem; color: var(--ink); }
.filter a.active { background: var(--blue); color: #fff; }

.stale-group { margin-top: 0.5rem; }
.stale-group summary { cursor: pointer; color: var(--muted); font-size: 0.82rem; padding: 0.3rem 0; }
.stale-group summary:hover { color: var(--blue); }
.stale-group .card { opacity: 0.75; }

.baustelle { border-left: 4px solid var(--sky); }
.baustelle.heute { border-left-color: var(--sun); }
.site-notes { background: #fff8e1; border: 1px solid var(--sun); border-radius: 8px; padding: 0.5rem 0.8rem; }
.settings-table input[type=text] { min-width: 16rem; }

.login-card { max-width: 380px; margin: 8vh auto; background: #fff; border-radius: 12px; padding: 1.5rem 2rem 2rem; box-shadow: 0 4px 16px rgba(0,0,0,0.1); border-top: 4px solid var(--sun); }
.login-logo { display: block; max-width: 240px; margin: 0.5rem auto 1rem; }

/* Cockpit & Ampel */
/* Jedes Panel eine Spalte, so viele nebeneinander wie Platz ist (wie das Projekte-Board) */
.cockpit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 1rem; align-items: start; }
@media (max-width: 860px) { .cockpit-grid { grid-template-columns: 1fr; } }
.panel.spaced { margin-top: 1rem; }
.group-label { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 1rem 0 0.2rem; }
.group-label.rot-text { color: #b3261e; }
.small { font-size: 0.85rem; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 0.45rem; vertical-align: baseline; }
.dot.rot { background: #d3382c; }
.dot.gelb { background: var(--sun); border: 1px solid #d9b000; }
.dot.gruen { background: #3a9e57; }

.upcoming-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.upcoming-row:last-child { border-bottom: 0; }
.upcoming-name { flex: 1; line-height: 1.25; }
.progress-text { white-space: nowrap; font-size: 0.85rem; }

.radar { border-left: 4px solid var(--sun); }

.inline { display: inline; }
.checkline { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }
.checkline input[type=checkbox], .checkline input[type=hidden] { width: auto; }
.waiting { color: var(--muted); font-size: 0.82rem; font-style: italic; }
.wait-details { display: inline-block; margin-left: 0.4rem; }
.wait-details summary { cursor: pointer; list-style: none; color: var(--blue); font-size: 0.9em; }
.wait-details summary:hover { text-decoration: underline; }
/* Safari zeigt sonst zusätzlich sein eigenes Aufklapp-Dreieck */
.wait-details summary::-webkit-details-marker { display: none; }
.wait-details form { display: flex; gap: 0.3rem; margin-top: 0.3rem; }
.wait-details select { width: auto; padding: 0.25rem 0.4rem; font-size: 0.82rem; }

/* Kunden-Datenraum (öffentliche Seite, Magic-Link) */
.portal-container { max-width: 860px; }
.portal-claim { margin-left: auto; font-size: 0.9rem; }
.portal-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; padding: 0; margin: 0.5rem 0 1rem; }
.portal-steps li { display: flex; align-items: center; gap: 0.45rem; color: var(--muted); font-size: 0.9rem; }
.portal-steps .step-dot { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: #e8ecf0; font-size: 0.78rem; font-weight: 700; }
.portal-steps li.done { color: var(--ink); }
.portal-steps li.done .step-dot { background: #d9efe0; color: #2c7a48; }
.portal-steps li.current { color: var(--blue); font-weight: 700; }
.portal-steps li.current .step-dot { background: var(--sun); color: var(--ink); }
.photo-slot { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; justify-content: space-between; border: 1px dashed #c5ced6; border-radius: 8px; padding: 0.7rem 0.9rem; margin-top: 0.6rem; }
.photo-slot.has-photo { border-style: solid; border-color: #9fd3b4; background: #f4fbf6; }
.slot-info { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; min-width: 220px; }
.slot-form { display: flex; gap: 0.5rem; align-items: center; }
.slot-form input[type=file] { width: auto; max-width: 220px; padding: 0.3rem; font-size: 0.82rem; }
.field-hint { margin: 0.15rem 0 0; }
.portal-footer { max-width: 860px; margin: 2rem auto 3rem; padding: 1rem; text-align: center; color: var(--muted); font-size: 0.85rem; display: flex; flex-direction: column; gap: 0.3rem; }
.portal-link-box { display: flex; gap: 0.5rem; align-items: center; margin: 0.4rem 0; }
.portal-link-box input { font-size: 0.8rem; color: var(--muted); }
.testbetrieb-warnung { background: #fff3f2; border: 1px solid #e5b5b1; color: #b3261e; border-radius: 8px; padding: 0.5rem 0.8rem; font-size: 0.85rem; margin: 0.5rem 0; }

/* Abnahmeprotokoll (mobil-tauglich) */
.abnahme-form { max-width: 860px; }
.check-row { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; align-items: center; padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.check-label { flex: 1 1 260px; }
.check-states { display: flex; gap: 0.3rem; }
.check-state { display: inline-flex; align-items: center; margin: 0; padding: 0.3rem 0.7rem; border: 1px solid #c5ced6; border-radius: 18px; font-size: 0.82rem; font-weight: 500; cursor: pointer; user-select: none; }
.check-state input { display: none; }
.check-state.active.state-ja { background: #d9efe0; border-color: #3a9e57; color: #2c7a48; }
.check-state.active.state-offen { background: #fdecea; border-color: #d3382c; color: #b3261e; }
.check-state.active.state-nr { background: #e8ecf0; border-color: #8a949e; color: #4b555f; }
.check-note { flex: 1 1 180px; max-width: 320px; padding: 0.3rem 0.5rem; font-size: 0.82rem; }
.serial-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.4rem; align-items: center; }
.serial-row select { width: auto; min-width: 12rem; }
.serial-row input[type=text] { flex: 1; min-width: 180px; }
.serial-foto { display: flex; gap: 0.5rem; align-items: center; }
.serial-foto input[type=file] { width: auto; max-width: 230px; padding: 0.3rem; font-size: 0.8rem; }
.foto-vorhanden { white-space: nowrap; font-size: 0.85rem; }
.proposal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0.5rem 1.5rem; align-items: start; }
.zuordnen-box { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.3rem; }
.material-status { display: flex; flex-direction: column; gap: 0.3rem; align-items: flex-end; }

/* Datenraum: erledigte Abschnitte klappen zu einer Statuszeile zusammen */
.portal-abschnitt summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.portal-abschnitt summary::-webkit-details-marker { display: none; }
.portal-abschnitt summary::after { content: "▸ aufklappen"; margin-left: auto; color: var(--muted); font-size: 0.8rem; }
.portal-abschnitt[open] summary::after { content: "▾ zuklappen"; }
.abschnitt-titel { font-size: 1.05rem; font-weight: 700; color: var(--blue); }

/* Zahlung im Datenraum */
.zahlung-block { display: flex; gap: 1.2rem; align-items: flex-start; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem 1rem; margin-top: 0.6rem; }
.zahlung-block .qr-code svg { display: block; border: 1px solid var(--line); border-radius: 8px; }
.zahlung-daten { flex: 1; min-width: 240px; }

/* Tickets */
.ticket-msg { border-left: 3px solid var(--sky); background: var(--bg); border-radius: 0 8px 8px 0; padding: 0.5rem 0.8rem; margin-bottom: 0.6rem; }
.ticket-msg.kunde { border-left-color: var(--sun); background: #fffbe8; }

/* Controlling */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.kpi { display: flex; flex-direction: column; gap: 0.2rem; }
.kpi-wert { font-size: 1.7rem; font-weight: 700; color: var(--blue); }
.balken-chart { display: flex; align-items: flex-end; gap: 0.5rem; padding-top: 1.2rem; }
.balken-spalte { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.2rem; }
.balken { width: 100%; max-width: 46px; background: var(--sky); border-radius: 4px 4px 0 0; }
.balken-wert { font-size: 0.7rem; color: var(--muted); }
.balken-label { font-size: 0.75rem; color: var(--muted); }
.quote-balken { height: 10px; background: #e8ecf0; border-radius: 5px; overflow: hidden; }
.quote-balken div { height: 100%; background: #3a9e57; border-radius: 5px; }
.live-search { margin: 0.3rem 0 0.8rem; }
.live-search input { max-width: 360px; padding: 0.45rem 0.8rem; border-radius: 20px; }
/* Lager-Tabellen brauchen mehr Platz je Spalte als das Cockpit */
.lager-grid { grid-template-columns: repeat(auto-fit, minmax(560px, 1fr)); }
@media (max-width: 640px) { .lager-grid { grid-template-columns: 1fr; } }
.vollmacht-tabelle { width: 100%; border-collapse: collapse; margin: 0.4rem 0 0.8rem; }
.vollmacht-tabelle td { border: 1px solid #c5ced6; padding: 0.3rem 0.6rem; }
.vollmacht-tabelle td:first-child { width: 11rem; color: var(--muted); }
#sig-pad { width: 100%; max-width: 600px; height: 180px; border: 1px dashed #c5ced6; border-radius: 8px; background: #fff; touch-action: none; display: block; margin-top: 0.4rem; }
.abnahme-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.abnahme-actions .btn { margin: 0; }
.btn.btn-warn { background: #b3720f; }
.btn.btn-go { background: #2c7a48; }
