:root {
  --bg: #0b0d10;
  --surface: #14171c;
  --surface-2: #1b1f26;
  --border: #262b33;
  --text: #f2f3f5;
  --muted: #98a1ac;
  --accent: #ff5a36;
  --accent-press: #e2462a;
  --blue: #4b8dff;
  --ok: #34c77b;
  --warn: #ffb020;
  --danger: #ff4d4f;
  --radius: 16px;
  --tabbar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 17px; line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Anmeldung ---------- */
.auth {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: center;
  padding: calc(32px + var(--safe-top)) 28px calc(32px + var(--safe-bottom));
  max-width: 440px; margin: 0 auto; gap: 28px;
}
.auth-logo { width: 96px; height: 96px; border-radius: 24px; box-shadow: 0 12px 40px rgba(255, 90, 54, .3); }
.auth h1 { font-size: 34px; letter-spacing: -.02em; margin: 0; }
.auth p { color: var(--muted); margin: 6px 0 0; }
.auth .stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Bausteine ---------- */
.btn {
  appearance: none; border: 0; border-radius: 14px; min-height: 52px; padding: 0 20px;
  font-weight: 600; font-size: 17px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { background: var(--accent-press); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid #3a2224; }
.btn svg { width: 22px; height: 22px; }

.field {
  width: 100%; min-height: 52px; padding: 0 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); outline: none;
}
.field:focus { border-color: var(--accent); }
.label { font-size: 14px; color: var(--muted); margin-bottom: 6px; display: block; }

.msg { padding: 12px 14px; border-radius: 12px; font-size: 15px; }
.msg-error { background: #2a1416; color: #ffb3b4; border: 1px solid #45201f; }
.msg-info { background: #13213a; color: #b9d2ff; border: 1px solid #1f3560; }
.msg-ok { background: #102a1d; color: #a5ecc4; border: 1px solid #1b4630; }

/* ---------- App-Rahmen ---------- */
.shell { min-height: 100vh; }
.view {
  padding: calc(12px + var(--safe-top)) 20px calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
  max-width: 760px; margin: 0 auto;
}
.view-title { font-size: 34px; font-weight: 700; letter-spacing: -.02em; margin: 8px 0 18px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(14, 16, 20, .86); backdrop-filter: saturate(160%) blur(20px); -webkit-backdrop-filter: saturate(160%) blur(20px);
  border-top: 1px solid var(--border);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500;
}
.tab svg { width: 26px; height: 26px; }
.tab.active { color: var(--accent); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px;
}
.card h2 { font-size: 17px; margin: 0 0 6px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }

.placeholder { text-align: center; padding: 48px 20px; color: var(--muted); }
.placeholder svg { width: 56px; height: 56px; color: var(--border); margin-bottom: 12px; }
.placeholder h2 { color: var(--text); font-size: 20px; margin: 0 0 6px; }

.search-box { position: relative; margin-bottom: 18px; }
.search-box svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); }
.search-box .field { padding-left: 44px; }

.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.list-head { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 4px 8px; }
.row {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left;
}
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .sub { color: var(--muted); font-size: 14px; }
.row .value { color: var(--muted); }
button.row { cursor: pointer; }
button.row:active { background: var(--surface-2); }

.badge { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge-accent { background: rgba(255, 90, 54, .15); color: var(--accent); border-color: rgba(255, 90, 54, .3); }

.copy-box { display: flex; gap: 8px; margin-top: 12px; }
.copy-box input { flex: 1; font-size: 14px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  background: var(--surface-2); border: 1px solid var(--border); padding: 12px 18px; border-radius: 99px;
  font-size: 15px; z-index: 20; box-shadow: 0 8px 30px rgba(0,0,0,.4);
  animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

.offline-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30; text-align: center;
  padding: calc(4px + var(--safe-top)) 8px 4px; font-size: 13px; background: #3a2a0a; color: #ffd38a;
}

@media (min-width: 700px) {
  .view { padding-left: 32px; padding-right: 32px; }
}
