/* app.css — gemeinsame Bausteine von Anmeldung, Übersicht und Administration.
   Raster 4 px, Schriftgrößen 12/13/14/16/20, Gewichte 400/500/600,
   eine Kurve für alle Übergänge. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

body {
  margin: 0; padding: 32px 24px 64px;
  font: 400 14px/20px var(--font);
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 880px; margin: 0 auto; }
a { color: inherit; }
code, .mono { font-family: var(--mono); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

svg.lucide { width: 16px; height: 16px; stroke-width: 1.5; flex: none; }

/* ---------- Kopfzeile ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; min-height: 40px; margin-bottom: 32px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { width: 28px; height: 28px; display: block; }
.brand-name { font-size: 16px; font-weight: 600; line-height: 20px; }
.brand-meta { font: 400 12px/16px var(--mono); color: var(--muted); }
.head-nav { display: flex; align-items: center; gap: 8px; }
.head-user { color: var(--text-2); font-size: 13px; padding: 0 4px; display: inline-flex; align-items: center; gap: 8px; }
.head-nav form { display: inline-flex; margin: 0; }

.page-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-title h1 { font-size: 20px; line-height: 28px; font-weight: 600; margin: 0; }
.page-title p { margin: 0; color: var(--text-2); font-size: 13px; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent;
  font: 500 14px/20px var(--font); white-space: nowrap; text-decoration: none; cursor: pointer;
  background: var(--accent); color: var(--on-accent);
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .12s var(--ease);
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(.98); }
.btn:focus-visible, .icon-btn:focus-visible, .tab-btn:focus-visible, .seg button:focus-visible, .chip:focus-visible, summary:focus-visible {
  outline: 2px solid var(--ring); outline-offset: 2px;
}
.btn.sec { background: var(--card); color: var(--text); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.btn.sec:hover { background: var(--raised); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--raised); color: var(--text); }
.btn.danger { background: transparent; color: var(--bad); }
.btn.danger:hover { background: var(--bad-tint); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.lg { height: 44px; padding: 0 20px; }
.btn.block { width: 100%; }
.btn.copied, .btn.copied:hover { color: var(--good); border-color: var(--good-line); background: var(--good-tint); }
.icon-btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--text-2); cursor: pointer;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--raised); color: var(--text); }

/* ---------- Flächen ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.card-head h2 { font-size: 16px; line-height: 24px; font-weight: 600; margin: 0; }
.card-head p { font-size: 13px; color: var(--text-2); margin: 4px 0 0; max-width: 60ch; }
.card-foot { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 20px; }
.section-label { font-size: 13px; font-weight: 500; color: var(--text-2); margin: 0 0 8px; }
.empty { color: var(--muted); font-size: 13px; margin: 0; padding: 8px 0; }

/* Status: Punkt + Text statt farbiger Pill */
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.status.on::before { background: var(--good); }
.status.warn::before { background: var(--warn); }
.status.bad::before { background: var(--bad); }

/* Hinweise */
.msg { display: flex; align-items: flex-start; gap: 8px; padding: 12px 16px; border-radius: 10px; font-size: 13px; margin-bottom: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.msg svg { margin-top: 2px; }
.msg.ok { border-color: var(--good-line); background: var(--good-tint); }
.msg.ok svg { color: var(--good); }
.msg.err { border-color: var(--bad-line); background: var(--bad-tint); }
.msg.err svg { color: var(--bad); }
.msg.warn { border-color: var(--warn-line); background: var(--warn-tint); }
.msg.warn svg { color: var(--warn); }
.msg.info svg { color: var(--text-2); }
.stack-gap { margin-bottom: 20px; }

/* ---------- Formulare ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-col-full { grid-column: 1 / -1; }
.field label, .field .label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 8px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 8px; }
.input, .field input[type="text"], .field input[type="password"], .field input[type="email"], .field input[type="url"],
.field input[type="number"], .field input[type="time"], .field input[type="search"], .field select {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--text);
  font: 400 14px/20px var(--font); outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input:focus, .field input:focus, .field select:focus { border-color: var(--accent-ink); box-shadow: 0 0 0 3px var(--ring); }
.input::placeholder, .field input::placeholder { color: var(--muted); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { flex: 1; min-width: 200px; }

.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.field label.check { display: flex; margin: 0; font-size: 14px; font-weight: 400; color: var(--text); }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent-ink); cursor: pointer; }

/* Schalter: Checkbox mit eigener Form */
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 36px; height: 20px; border-radius: 10px; margin: 0;
  background: var(--line-strong); position: relative; cursor: pointer; transition: background-color .15s var(--ease); }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .18s var(--ease); }
.switch:checked { background: var(--accent-ink); }
.switch:checked::after { transform: translateX(16px); }
.switch:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch-row:first-of-type { border-top: 1px solid var(--line); }
.switch-row .t { font-size: 14px; font-weight: 500; }
.switch-row .d { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.switch-row + .form-grid, .switch-rows + .form-grid { margin-top: 20px; }

/* Kleine Auswahltasten (Zyklus-Vorgaben) */
.keys { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.key { appearance: none; height: 24px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--raised);
  color: var(--text-2); font: 400 12px/16px var(--mono); cursor: pointer; transition: color .15s var(--ease), border-color .15s var(--ease); }
.key:hover { color: var(--text); border-color: var(--text-2); }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; margin: 0 -8px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
td.mono { font-family: var(--mono); font-size: 13px; word-break: break-all; }
td.t { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-2); }
td.right, th.right { text-align: right; }
td.meta { color: var(--text-2); }

/* Ziffern farbig, damit 0/O und 1/l unterscheidbar sind */
.pw-d { color: var(--digit); }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.modal-overlay.hidden { display: none; }
.modal-content { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px; width: 100%; max-width: 520px;
  box-shadow: var(--shadow-float); max-height: 92vh; overflow-y: auto; animation: rise .24s var(--ease); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-head h2 { font-size: 18px; line-height: 24px; font-weight: 600; margin: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 600px) {
  body { padding: 20px 16px 48px; }
  .card { padding: 20px 16px; border-radius: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .head-user { display: none; }
  .page-head { margin-bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
