/* CANCOM Medienraum Baufortschritt – Farben nach Simple Signage DESIGN.md */
:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-2: #eeeeee;
  --line: #d9dee3;
  --text: #212121;
  --muted: #6b7280;
  --header: #2b2f36;
  --accent: #da002d;
  --accent-hover: #b00024;
  --green: #22c55e;
  --green-2: #16a34a;
  --yellow: #f5b70a;
  --red: #ef4444;
  --shadow: 0 8px 24px rgba(0,0,0,.08);
  --radius: 16px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1216;
  --panel: #15181d;
  --panel-2: #1a1e24;
  --line: #2b3440;
  --text: #e5e7eb;
  --muted: #9aa4b2;
  --header: #0f1720;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
  -webkit-font-smoothing: antialiased; font-size: 15px; line-height: 1.45;
}
a { color: inherit; }
.wrap { max-width: 1440px; margin: 0 auto; padding: 24px 16px 48px; }
@media (min-width: 900px) { .wrap { padding: 32px 32px 64px; } }
.wrap.narrow { max-width: 760px; }

/* Header */
header.top { background: var(--header); color: #fff; border-bottom: 4px solid var(--accent); }
header.top .inner {
  max-width: 1440px; margin: 0 auto; padding: 14px 16px;
  display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between;
}
@media (min-width: 900px) { header.top .inner { padding: 16px 32px; } }
.brand { display: flex; align-items: center; gap: 16px; text-decoration: none; color: #fff; }
.logo { height: 24px; width: auto; display: block; }
.brand .divider { width: 1px; align-self: stretch; background: rgba(255,255,255,.25); }
.brand .app-name { font-weight: 600; font-size: 15px; color: #d7dce3; }
nav.main { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
nav.main a, nav.main button, header.top .ghost {
  color: #d7dce3; text-decoration: none; font-size: 14px; padding: 7px 12px; border-radius: 8px;
  background: transparent; border: 1px solid transparent; cursor: pointer; font: inherit;
}
nav.main a:hover, nav.main button:hover { background: rgba(255,255,255,.08); color: #fff; }
nav.main a.active { background: rgba(255,255,255,.12); color: #fff; }
nav.main .user { color: #9aa4b2; font-size: 13px; padding: 0 6px; }
nav.main form { display: inline; margin: 0; }

/* Allgemein */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.page-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn {
  font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); padding: 8px 14px; font-size: 14px; font-weight: 500;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px; line-height: 1.2;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.section-title { margin: 0; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; border: 1px solid; }
.flash.ok { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.4); }
.flash.error { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.4); }
.empty { color: var(--muted); text-align: center; padding: 48px 16px; }

/* Ampel & Status */
.ampel { display: flex; flex-direction: column; gap: 5px; padding: 6px; border-radius: 12px; background: #0a0d12; border: 1px solid #222a36; flex: none; }
.ampel span { width: 14px; height: 14px; border-radius: 50%; background: #1f2633; }
.ampel .on.r { background: var(--red); box-shadow: 0 0 12px var(--red); }
.ampel .on.y { background: var(--yellow); box-shadow: 0 0 12px var(--yellow); }
.ampel .on.g { background: var(--green); box-shadow: 0 0 12px var(--green); }
.ampel.big span { width: 22px; height: 22px; }
.ampel.big { gap: 7px; padding: 9px; border-radius: 16px; }
.status-pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.status-pill.g { background: rgba(34,197,94,.14); color: var(--green-2); }
.status-pill.y { background: rgba(245,183,10,.16); color: #b7860a; }
.status-pill.r { background: rgba(239,68,68,.14); color: var(--red); }
:root[data-theme="dark"] .status-pill.g { color: var(--green); }
:root[data-theme="dark"] .status-pill.y { color: var(--yellow); }

/* Fortschrittsbalken */
.bar { position: relative; height: 12px; background: var(--panel-2); border-radius: 999px; }
.bar .fill {
  height: 100%; border-radius: 999px; width: 0;
  background: linear-gradient(90deg, var(--green-2), var(--green));
  box-shadow: 0 0 14px rgba(34,197,94,.3);
  transition: width 1.1s cubic-bezier(.2,.8,.2,1);
}
.bar .target { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); opacity: .55; border-radius: 2px; }
.bar-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.progress-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; color: var(--muted); }
.progress-row strong { font-size: 26px; color: var(--text); font-weight: 800; font-variant-numeric: tabular-nums; }

/* Hero / KPIs */
.hero { display: grid; gap: 20px; grid-template-columns: 1fr; margin-bottom: 28px; }
@media (min-width: 1000px) { .hero { grid-template-columns: 360px 1fr; } }
.overall { padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.gauge { position: relative; width: 210px; height: 210px; }
.gauge svg { transform: rotate(-90deg); display: block; }
.gauge .arc { transition: stroke-dashoffset 1.4s cubic-bezier(.2,.8,.2,1); }
.gauge .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.gauge .val strong { font-size: 50px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.gauge .val span { display: block; color: var(--muted); font-size: 13px; margin-top: 6px; }
.overall .sub { color: var(--muted); font-size: 13px; text-align: center; }
.overall .sub b { color: var(--text); }
.hero-right { display: flex; flex-direction: column; gap: 16px; }
.kpis { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.kpi { padding: 18px 20px; position: relative; overflow: hidden; }
.kpi .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi .num { font-size: 40px; font-weight: 800; margin-top: 6px; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi .hint { color: var(--muted); font-size: 12px; margin-top: 8px; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--muted); }
.kpi.g::before { background: var(--green); } .kpi.g .num { color: var(--green-2); }
.kpi.y::before { background: var(--yellow); } .kpi.y .num { color: #d39a06; }
.kpi.r::before { background: var(--red); } .kpi.r .num { color: var(--red); }
:root[data-theme="dark"] .kpi.g .num { color: var(--green); }
:root[data-theme="dark"] .kpi.y .num { color: var(--yellow); }
.distribution { padding: 20px; flex: 1; }
.stack { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--panel-2); margin-top: 14px; }
.stack div { height: 100%; }
.legend { display: flex; gap: 8px 18px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.legend i.tick { width: 3px; background: var(--text); opacity: .55; }
.info-line { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 16px; font-size: 13px; color: var(--muted); }
.info-line b { color: var(--text); font-weight: 600; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters button { font: inherit; font-size: 13px; cursor: pointer; padding: 7px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.filters button .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.filters button.active { background: var(--text); border-color: var(--text); color: var(--bg); }
input.search { width: 280px; }
@media (max-width: 600px) { input.search { width: 100%; min-width: 0; } }

/* Raumkarten */
.grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 1150px) { .grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.card-link { text-decoration: none; color: inherit; display: block; }
.room { padding: 20px; display: flex; flex-direction: column; gap: 16px; height: 100%; transition: transform .15s ease, border-color .15s ease; }
.card-link:hover .room, .card-link:focus-visible .room { transform: translateY(-2px); border-color: var(--muted); }
.room-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.room h3 { margin: 0; font-size: 17px; font-weight: 700; }
.room .loc { color: var(--muted); font-size: 13px; margin-top: 3px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.facts div { font-size: 12px; color: var(--muted); }
.facts b { display: block; color: var(--text); font-size: 14px; margin-top: 3px; font-weight: 600; }
.phase { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.phase b { color: var(--text); font-weight: 600; }
.note { font-size: 13px; color: var(--muted); background: var(--panel-2); padding: 10px 12px; border-radius: 10px; border-left: 3px solid var(--line); white-space: pre-line; }
.st-r .note { border-left-color: var(--red); }
.st-y .note { border-left-color: var(--yellow); }

/* Projektliste */
.project-card { padding: 22px; display: flex; flex-direction: column; gap: 16px; height: 100%; transition: transform .15s ease, border-color .15s ease; }
.card-link:hover .project-card { transform: translateY(-2px); border-color: var(--muted); }
.project-card h3 { margin: 0; font-size: 18px; }
.mini-counts { display: flex; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.mini-counts span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.mini-counts .g::before { background: var(--green); }
.mini-counts .y::before { background: var(--yellow); }
.mini-counts .r::before { background: var(--red); }

/* Raumdetail */
.detail { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .detail { grid-template-columns: 1.4fr 1fr; } }
.box { padding: 22px; }
.box + .box { margin-top: 20px; }
.box h2 { margin: 0 0 16px; font-size: 17px; }
.status-hero { display: flex; gap: 20px; align-items: center; }
.status-hero .grow { flex: 1; min-width: 0; }
.facts.four { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 600px) { .facts.four { grid-template-columns: repeat(4, 1fr); } }

.gallery { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.gallery figure { margin: 0; position: relative; }
.gallery button.thumb { padding: 0; border: 0; background: var(--panel-2); border-radius: 10px; overflow: hidden; cursor: zoom-in; display: block; width: 100%; aspect-ratio: 4/3; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.gallery button.thumb:hover img { transform: scale(1.04); }
.gallery figcaption { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.3; }
.gallery form { position: absolute; top: 6px; right: 6px; margin: 0; }
.gallery form button { background: rgba(0,0,0,.6); color: #fff; border: 0; border-radius: 8px; width: 28px; height: 28px; cursor: pointer; font-size: 15px; }

.upload { display: grid; gap: 10px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--panel); border: 2px solid var(--muted); }
.timeline .meta { font-size: 12px; color: var(--muted); }
.timeline .what { font-weight: 600; font-size: 14px; margin-top: 2px; }
.timeline .chg { font-size: 13px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.timeline .chg b { color: var(--text); font-weight: 500; }
.timeline .chg s { opacity: .7; }

/* Lightbox */
dialog.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 94vh; }
dialog.lightbox::backdrop { background: rgba(0,0,0,.88); }
dialog.lightbox img { max-width: 96vw; max-height: 86vh; display: block; border-radius: 8px; margin: 0 auto; }
dialog.lightbox .cap { color: #e5e7eb; text-align: center; font-size: 14px; margin-top: 10px; }
dialog.lightbox .close { position: fixed; top: 14px; right: 18px; background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 50%; width: 40px; height: 40px; font-size: 20px; cursor: pointer; }
dialog.lightbox .nav { position: fixed; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 50%; width: 44px; height: 44px; font-size: 22px; cursor: pointer; }
dialog.lightbox .prev { left: 14px; } dialog.lightbox .next { right: 14px; }

/* Formulare */
form.stack-form { display: grid; gap: 16px; }
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
input, select, textarea {
  font: inherit; font-size: 15px; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(218,0,45,.35); outline-offset: 1px; border-color: var(--accent); }
input[type=range] { padding: 0; border: 0; accent-color: var(--green); background: transparent; }
input[type=file] { padding: 8px; }
.row2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .row2 { grid-template-columns: 1fr 1fr; } }
.form-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-top: 6px; }
.range-out { font-weight: 800; color: var(--text); font-size: 18px; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td form { margin: 0; display: inline-flex; gap: 6px; }
td input { padding: 6px 10px; font-size: 14px; }
.badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); }
.badge.admin { background: rgba(218,0,45,.12); color: var(--accent); }
.badge.pm { background: rgba(59,130,246,.14); color: #3b82f6; }

/* Login */
.login-wrap { min-height: calc(100vh - 80px); display: grid; place-items: center; padding: 24px 16px; }
.login { width: min(420px, 100%); padding: 32px; }
.login h1 { margin: 0 0 6px; font-size: 22px; }
.login p { margin: 0 0 22px; color: var(--muted); font-size: 14px; }

footer.foot { max-width: 1440px; margin: 0 auto; padding: 0 16px 32px; color: var(--muted); font-size: 12px; }
@media (min-width: 900px) { footer.foot { padding: 0 32px 32px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Smartphone: kompakte Kopfleiste */
@media (max-width: 640px) {
  .brand .app-name, .brand .divider, nav.main .user { display: none; }
  header.top .inner { padding: 12px 16px; }
  nav.main { gap: 2px; }
  nav.main a, nav.main button { padding: 6px 8px; font-size: 13px; }
  .page-head h1 { font-size: 22px; }
  .gauge { transform: scale(.9); }
}
