/* Pi5 – Gestaltung. Hell und dunkel folgen automatisch der Systemeinstellung. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --text: #16181d;
  --muted: #646b78;
  --border: #dde1e7;
  --accent: #0f8f7e;
  --accent-text: #ffffff;
  --accent-soft: #d9f2ee;
  --danger: #c4383b;
  --warn: #c98a12;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.05), 0 2px 8px rgb(16 24 40 / 0.04);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1114;
    --surface: #171a1f;
    --surface-2: #20242b;
    --text: #e9ebef;
    --muted: #949bab;
    --border: #2a2f37;
    --accent: #2bb8a3;
    --accent-text: #06201c;
    --accent-soft: #123a35;
    --danger: #ef6b6e;
    --warn: #e7ae3c;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
h1, h2 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 1rem; font-weight: 600; }
small { font-size: 0.82rem; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-weight: 500; }

/* ---------- Kopfzeile ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; font-size: 1.05rem; }
.topbar nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.topbar nav a {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  color: var(--muted); font-weight: 500; white-space: nowrap;
}
.topbar nav a:hover { color: var(--text); background: var(--surface-2); }
.topbar nav a.active { color: var(--text); background: var(--surface-2); }

main { max-width: 1080px; margin: 0 auto; padding: 28px 24px 64px; display: grid; gap: 20px; }
main.narrow { max-width: 520px; padding-top: 10vh; }

.page-head { display: grid; gap: 4px; }

/* ---------- Karten ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  align-content: start;
}
.card.center { text-align: center; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.grid { display: grid; gap: 20px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

.pill {
  font-size: 0.8rem; color: var(--muted);
  background: var(--surface-2); padding: 2px 10px; border-radius: 999px;
}

.stat-card { color: inherit; transition: border-color 0.15s; }
.stat-card:hover { border-color: var(--accent); }
.stat { display: flex; align-items: baseline; gap: 8px; }
.stat strong { font-size: 2.2rem; font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- Personen ---------- */

.people-row { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.person-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: inherit; transition: border-color 0.15s, transform 0.15s; }
.person-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.person-card > span:last-child { display: grid; }
.person-head { display: flex; align-items: center; gap: 16px; }
.person-head > div { flex: 1; display: grid; gap: 2px; }

.avatar {
  flex: none; display: grid; place-items: center; border-radius: 999px;
  color: #fff; font-weight: 700; background: var(--accent);
}
.avatar.md { width: 42px; height: 42px; font-size: 1.1rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.5rem; }
.avatar.person-gerrit { background: #0f8f7e; }
.avatar.person-jette { background: #d9467a; }
.avatar.person-tilda { background: #7c5cff; }
.avatar.person-rocco { background: #e08a16; }

.narrow-block { max-width: 460px; width: 100%; margin: 6vh auto 0; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: auto; accent-color: var(--accent); }
.tool-form, .stack-form { gap: 14px; justify-items: start; }
.stack-form label { width: 100%; max-width: 420px; }

.mini-list { list-style: none; margin: 0; padding: 10px 0 0; border-top: 1px solid var(--border); display: grid; gap: 4px; font-size: 0.88rem; }
.mini-list li { display: flex; justify-content: space-between; }

/* ---------- Wetter ---------- */

.weather-now { display: flex; align-items: center; gap: 14px; }
.weather-symbol { font-size: 2.6rem; line-height: 1; }
.weather-now > div { display: grid; }
.weather-temp { font-size: 2rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.1; }
.forecast {
  list-style: none; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center;
}
.forecast li { display: grid; gap: 2px; font-size: 0.9rem; }
.forecast li span:nth-child(2) { font-size: 1.3rem; }

.rain-hint { color: var(--accent); font-weight: 600; }
.rain-text { margin: 0; font-size: 1.05rem; font-weight: 600; }
.rain-chart { width: 100%; height: auto; display: block; }
.rain-chart .grid line { stroke: var(--border); stroke-width: 1; }
.rain-chart .labels text { fill: var(--muted); font-size: 12px; }
.rain-chart rect.light { fill: #8ec5ff; }
.rain-chart rect.medium { fill: #3b8cf0; }
.rain-chart rect.heavy { fill: #1d4fb8; }
.legend { margin: 0; font-size: 0.82rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 4px 0 8px; vertical-align: -1px; }
.dot.light { background: #8ec5ff; }
.dot.medium { background: #3b8cf0; }
.dot.heavy { background: #1d4fb8; }

/* ---------- Regenradar ---------- */

.radar-frame { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.radar-frame canvas { display: block; width: 100%; height: auto; }
.radar-status { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.radar-controls { display: flex; align-items: center; gap: 14px; }
.radar-controls input[type=range] { flex: 1; padding: 0; accent-color: var(--accent); }
.radar-controls strong { min-width: 150px; text-align: right; font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.zoom-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.zoom-buttons button.active { background: var(--accent); color: var(--accent-text); border-color: transparent; }

/* ---------- Systemanzeige ---------- */

.meters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
.meter { display: grid; gap: 6px; }
.meter-head { display: flex; justify-content: space-between; font-size: 0.9rem; }
.meter-head strong { font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.6s ease; }
.meter.warn .bar span { background: var(--warn); }
.meter.hot .bar span { background: var(--danger); }

/* ---------- Links ---------- */

.links { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.link-tile { position: relative; }
.link-tile a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border: 1px solid var(--border); border-radius: 12px; color: var(--text);
}
.link-tile a:hover { border-color: var(--accent); }
.link-tile a > span:last-child { display: grid; min-width: 0; }
.link-tile small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-initial {
  flex: none; width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; font-weight: 700;
  background: var(--accent-soft); color: var(--accent);
}
.link-tile form { position: absolute; top: -8px; right: -8px; }

.edit-only { display: none !important; }
[data-editing] .edit-only { display: flex !important; }
[data-editing] .tool-form, [data-editing] .stack-form { display: grid !important; }

/* ---------- Formulare ---------- */

label { display: grid; gap: 6px; font-size: 0.9rem; font-weight: 500; }
input, select, textarea {
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; }

button, .button {
  font: inherit; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-text);
}
button:hover, .button:hover { filter: brightness(1.06); }
button:disabled { opacity: 0.6; cursor: progress; }
button.small, .button.small { padding: 5px 12px; font-size: 0.85rem; }
button.ghost { background: transparent; color: var(--text); border-color: var(--border); }
button.ghost:hover { background: var(--surface-2); }
button.danger { color: var(--danger); }
.icon-button {
  width: 26px; height: 26px; padding: 0; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 0.75rem;
}

.inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 180px; width: auto; }

.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- Upload ---------- */

.upload { display: grid; gap: 16px; }
.dropzone {
  position: relative; display: grid; justify-items: center; gap: 4px; text-align: center;
  padding: 32px 16px; border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--surface-2); cursor: pointer; font-weight: 400;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-icon { font-size: 2rem; color: var(--accent); line-height: 1; }
.file-list { list-style: none; margin: 8px 0 0; padding: 0; font-size: 0.85rem; color: var(--muted); }

.progress { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

.result { display: grid; gap: 8px; padding: 14px; border-radius: 12px; background: var(--accent-soft); }

.copy-row { display: flex; gap: 8px; }
.copy-row input { font-size: 0.85rem; background: var(--surface-2); }

/* ---------- Transferliste ---------- */

.transfers, .downloads { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.transfer {
  display: flex; gap: 16px; align-items: flex-start; justify-content: space-between;
  padding: 14px; border: 1px solid var(--border); border-radius: 12px;
}
.transfer-main { display: grid; gap: 6px; min-width: 0; flex: 1; }

.file-download {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; color: var(--text);
}
.file-download > span:first-child { display: grid; min-width: 0; }
.file-download strong { overflow-wrap: anywhere; }
.file-download:hover { border-color: var(--accent); }
.message { white-space: pre-wrap; margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }

/* ---------- Anmeldung ---------- */

.auth form { display: grid; gap: 14px; }
.auth-head { display: flex; align-items: center; gap: 12px; }
.auth p { margin: 0; }

/* ---------- Kleine Bildschirme ---------- */

@media (max-width: 760px) {
  .topbar { padding: 10px 16px; gap: 12px; }
  .topbar .brand { font-size: 0; gap: 0; }
  main { padding: 20px 16px 48px; }
  .grid, .form-grid, .meters { grid-template-columns: 1fr; }
  .people-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-2 { grid-column: auto; }
  .transfer { flex-direction: column; }
}
