@import "tokens.css";

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font: var(--t-body);
  background: var(--bg-base);
  color: var(--text-primary);
}
h1, h2, h3, b { font-family: var(--font-display); }

.hidden { display: none !important; }
.muted { color: var(--text-secondary); font-size: .9rem; }
.row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.inline-warn { color: var(--danger); font-size: .85rem; margin: 6px 2px 0; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ---- App-Shell ---- */
.app-root { min-height: 100vh; display: flex; flex-direction: column; }
.scroll { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: var(--space-5) var(--space-5) var(--space-9); }

/* ---- App-Bar ---- */
.appbar { background: var(--surface); position: sticky; top: 0; z-index: 10; }
.appbar-row { display: flex; align-items: center; gap: 10px; padding: 10px var(--space-5); max-width: 760px; margin: 0 auto; }
.appbar-mark { width: 36px; height: 36px; flex: none; }
.appbar-title { flex: 1; font-family: var(--font-display); font-weight: 600; font-size: 1.7rem; line-height: 1; }
.appbar-sub { display: block; font-family: var(--font-body); font-weight: 400; font-size: .8rem; color: var(--text-secondary); margin-top: 3px; }
.appbar-accent { height: 3px; background: var(--brand); }

/* ---- Buttons ---- */
.btn-primary { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; background: var(--brand); color: var(--brand-ink); padding: 11px 18px; border-radius: var(--radius-m); transition: filter .15s; }
.btn-primary:hover { filter: brightness(.96); }
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-primary.ok { background: var(--g-600); color: #fff; }
.btn-ghost { font-family: var(--font-display); font-weight: 600; font-size: 1rem; color: var(--accent-text); border: 1px solid var(--border-strong); padding: 10px 16px; border-radius: var(--radius-m); background: var(--bg-base); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ghost.sm { padding: 7px 12px; font-size: .92rem; }
.block { width: 100%; display: flex; align-items: center; justify-content: center; }

/* ---- Felder ---- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: var(--space-4); }
.field label { font-family: var(--font-display); font-weight: 600; font-size: .92rem; }
input, select {
  font-family: var(--font-body); font-size: 1rem; padding: 11px 14px;
  border-radius: var(--radius-m); border: 1px solid var(--border-strong);
  background: var(--bg-base); color: var(--text-primary);
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.field input { width: 100%; }

/* ---- Karten / Sektionen ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-m); padding: var(--space-5); box-shadow: var(--shadow-1); margin-bottom: var(--space-4); }
.list-card { padding: 4px 0; }
.sec-title { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; margin: 0 4px 10px; }

/* ---- Esel-Liste ---- */
.donkey-row { width: 100%; display: flex; align-items: center; gap: 13px; padding: 12px 16px; text-align: left; cursor: pointer; border: none; background: none; }
.donkey-row:hover { background: var(--surface-2); }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; flex: none; }
.donkey-meta { flex: 1; min-width: 0; }
.donkey-meta b { font-family: var(--font-display); font-weight: 600; font-size: 1.22rem; display: block; line-height: 1.15; }
.donkey-meta span { font-size: .88rem; color: var(--text-secondary); }
.chev { color: var(--text-secondary); flex: none; font-size: 1.3rem; }

/* ---- Badges ---- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-body); font-weight: 600; font-size: .78rem; padding: 3px 11px; border-radius: var(--radius-pill); white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--g-700); }
.b-warn { background: var(--warn-bg); color: #8a5a08; }
.b-danger { background: var(--danger-bg); color: var(--danger); }

/* ---- Detail: Stat-Karte ---- */
.capture-head { display: flex; align-items: center; gap: 12px; margin-bottom: var(--space-4); }
.capture-head b { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; display: block; }
.stat-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.stat-label { font-family: var(--font-mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-secondary); }
.stat-value { font-family: var(--font-display); font-weight: 600; font-size: 3rem; line-height: 1; margin-top: 4px; white-space: nowrap; }
.stat-value small { font-size: 1.2rem; color: var(--text-secondary); }
.stat-delta { font-family: var(--font-mono); font-size: .82rem; text-align: right; white-space: nowrap; flex: none; min-width: 100px; }
.stat-delta.up { color: var(--g-700); }
.stat-delta.down { color: var(--danger); }
.stat-delta small { display: block; color: var(--text-secondary); font-size: .68rem; margin-top: 2px; }
.stat-base { font-family: var(--font-mono); font-size: .74rem; color: var(--text-secondary); margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }

/* ---- Chart ---- */
.chart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.chart-head b { font-size: 1.1rem; }
.chart-box { height: 200px; position: relative; }
.chart-legend { display: flex; gap: 16px; margin-top: 12px; font-family: var(--font-mono); font-size: .68rem; color: var(--text-secondary); }
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.lg-line { width: 16px; height: 3px; border-radius: 2px; background: var(--series); }
.lg-band { width: 14px; height: 10px; border-radius: 3px; background: var(--baseline-band); }
.lg-base { width: 16px; height: 0; border-top: 2px dashed var(--baseline-line); }

/* ---- Messwert-Liste ---- */
.obs-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 2px; border-bottom: 1px solid var(--border); }
.obs-row:last-child { border-bottom: none; }
.obs-row b { font-family: var(--font-display); font-weight: 600; }
.obs-row span { font-family: var(--font-mono); font-size: .78rem; color: var(--text-secondary); }

/* ---- Nicht zugeordnet ---- */
.unassigned-top { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.unassigned-kg { font-family: var(--font-display); font-weight: 600; font-size: 1.8rem; color: var(--accent-text); }
.assign-list { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- Login ---- */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: stretch; padding: 0 28px; max-width: 380px; margin: 0 auto; background: radial-gradient(120% 70% at 50% 0%, var(--o-50), var(--bg-base) 60%); }
.login-top { text-align: center; margin-bottom: 32px; }
.login-disc { width: 96px; height: 96px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; margin: 0 auto 18px; box-shadow: var(--shadow-3); }
.login-disc img { width: 58%; filter: brightness(0) invert(1); }
.login-top h1 { font-size: 3rem; line-height: 1; margin: 0; }
.login-top p { color: var(--text-secondary); margin: 6px 0 0; font-size: .95rem; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-foot { text-align: center; color: var(--text-secondary); font-family: var(--font-mono); font-size: .72rem; margin-top: 26px; }

/* ---- Vitalwerte ---- */
.vital-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.vital-card { padding: 13px 12px; border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--bg-base); text-align: center; }
.vital-card.flag { border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: var(--danger-bg); }
.vital-card > .vt { font-family: var(--font-body); font-weight: 600; font-size: .72rem; color: var(--text-secondary); }
.vital-num { font-family: var(--font-display); font-weight: 600; font-size: 1.7rem; margin: 6px 0 8px; line-height: 1; }
.vital-num small { font-size: .72rem; color: var(--text-secondary); margin-left: 2px; }
.sparkbar { position: relative; height: 6px; background: var(--surface-2); border-radius: 3px; margin: 0 2px; }
.sparkbar-band { position: absolute; top: 0; bottom: 0; background: var(--baseline-band); border-radius: 3px; }
.sparkbar-marker { position: absolute; top: -2px; width: 4px; height: 10px; border-radius: 2px; transform: translateX(-50%); }
.vital-norm { font-family: var(--font-mono); font-size: .6rem; color: var(--text-secondary); margin-top: 7px; }

/* ---- Pflege ---- */
.care-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 4px; text-align: left; border: none; background: none; border-bottom: 1px solid var(--border); }
.care-row:last-child { border-bottom: none; }
.care-row.clickable { cursor: pointer; }
.care-row.clickable:hover { background: var(--surface-2); }
.care-ico { width: 38px; height: 38px; border-radius: var(--radius-s); background: var(--o-50); display: grid; place-items: center; flex: none; font-family: var(--font-display); font-weight: 700; color: var(--accent-text); }
.care-meta { flex: 1; min-width: 0; }
.care-meta b { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; display: block; }
.care-meta span { font-size: .82rem; color: var(--text-secondary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.due-group-title { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-secondary); margin: 16px 4px 8px; }

/* ---- Verwaltung ---- */
.tenant-row { display: flex; align-items: center; gap: 12px; }
.tenant-row b { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; }
.brand-swatch { width: 30px; height: 30px; border-radius: 8px; border: 1px solid rgba(0,0,0,.12); flex: none; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.user-row:last-child { border-bottom: none; }
.user-row b { font-family: var(--font-display); font-weight: 600; }

canvas { max-width: 100%; }
