:root {
  --bg: #070b14;
  --card: #121a2b;
  --card2: #1a2438;
  --line: #2a3a55;
  --text: #eef3ff;
  --muted: #93a4c3;
  --blue: #3b82f6;
  --red: #ef4444;
  --green: #22c55e;
  --amber: #f59e0b;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 64px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
body {
  background:
    radial-gradient(800px 400px at 50% -10%, rgba(30,58,138,0.55), transparent 60%),
    radial-gradient(600px 300px at 100% 20%, rgba(185,28,28,0.25), transparent 50%),
    var(--bg);
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
}
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(7, 11, 20, 0.82);
  border-bottom: 1px solid var(--line);
  padding: 0.85rem 1rem 0.75rem;
}
.app-header .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
.logo-wrap { display: flex; align-items: center; gap: 0.65rem; }
.logo-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, #1d4ed8, #b91c1c);
  display: grid; place-items: center; font-weight: 900; font-size: 0.75rem;
}
.logo-wrap h1 { font-size: 1.15rem; line-height: 1.1; }
.logo-wrap small { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; }
.sync-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: rgba(34,197,94,0.15);
  color: #86efac;
  border: 1px solid rgba(34,197,94,0.35);
  white-space: nowrap;
}
.sync-pill.stale { background: rgba(245,158,11,0.15); color: #fcd34d; border-color: rgba(245,158,11,0.4); }
.sync-pill.off { background: rgba(239,68,68,0.12); color: #fca5a5; border-color: rgba(239,68,68,0.35); }

.three-c {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-top: 0.75rem;
}
.three-c span {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.4rem 0.2rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
}

main { padding: 1rem; max-width: 560px; margin: 0 auto; }
.crisis {
  background: linear-gradient(135deg, #450a0a, #7f1d1d);
  border: 1px solid #fca5a5;
  border-radius: 14px;
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  line-height: 1.45;
  margin-bottom: 1rem;
}
.crisis a { color: #fde68a; font-weight: 800; }

.card {
  background: linear-gradient(180deg, var(--card) 0%, #0e1524 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.card h2 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.muted { color: var(--muted); font-size: 0.88rem; line-height: 1.45; }

.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.status-btn {
  border: 1px solid var(--line);
  background: var(--card2);
  color: var(--text);
  border-radius: 14px;
  padding: 0.85rem 0.5rem;
  font: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
}
.status-btn .e { display: block; font-size: 1.25rem; margin-bottom: 0.2rem; }
.status-btn.selected { outline: 2px solid #fde68a; background: rgba(253,230,138,0.08); }
.status-btn.ok { border-left: 4px solid var(--green); }
.status-btn.buddy { border-left: 4px solid var(--amber); }
.status-btn.need { border-left: 4px solid #fb923c; }
.status-btn.mental { border-left: 4px solid var(--red); }

label { display: block; font-size: 0.8rem; font-weight: 700; color: var(--muted); margin: 0.45rem 0 0.25rem; }
input, textarea, select {
  width: 100%;
  background: #0a101c;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  font: inherit;
  margin-bottom: 0.35rem;
}
textarea { min-height: 88px; resize: vertical; }
.btn {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  margin-top: 0.5rem;
}
.btn-main {
  background: linear-gradient(135deg, #1d4ed8, #b91c1c);
  color: white;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}
.check {
  display: flex; gap: 0.5rem; align-items: flex-start;
  font-size: 0.88rem; color: var(--muted); margin: 0.5rem 0;
}
.check input { width: auto; margin: 0.2rem 0 0; }

.feed { display: flex; flex-direction: column; gap: 0.65rem; }
.alert {
  background: var(--card);
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 14px;
  padding: 0.9rem 1rem;
}
.alert.ok { border-left-color: var(--green); }
.alert.buddy { border-left-color: var(--amber); }
.alert.need { border-left-color: #fb923c; }
.alert.mental { border-left-color: var(--red); background: rgba(127,29,29,0.22); }
.alert .top {
  display: flex; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.25rem;
}
.alert .name { font-weight: 800; }
.alert .tag {
  font-size: 0.68rem; font-weight: 800; text-transform: uppercase;
  background: #0a101c; padding: 0.2rem 0.45rem; border-radius: 999px; color: var(--muted);
}
.alert .meta { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.35rem; }
.alert .msg { font-size: 0.95rem; white-space: pre-wrap; word-break: break-word; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(10, 14, 24, 0.94);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  z-index: 30;
  backdrop-filter: blur(12px);
}
.bottom-nav button {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.45rem;
  cursor: pointer;
}
.bottom-nav button.active { color: #93c5fd; }
.bottom-nav .ico { display: block; font-size: 1.2rem; margin-bottom: 0.1rem; }

.status-line { font-size: 0.85rem; min-height: 1.2em; margin-top: 0.4rem; color: #86efac; }
.status-line.err { color: #fca5a5; }
.empty { text-align: center; color: var(--muted); padding: 1.5rem 0.5rem; }

.install-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.75rem;
  padding: 0.65rem;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px dashed var(--line);
}
