:root {
  --bg: #0e1116;
  --card: #171b23;
  --text: #e8ecf3;
  --muted: #8b93a3;
  --accent: #4f8cff;
  --ok: #34c273;
  --warn: #e2b93b;
  --bad: #e25c5c;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font:
    16px/1.45 -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 30rem;
  margin: 0 auto;
  padding: 1rem;
  padding-bottom: 2rem;
}
.screen:not(.hidden) {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.hidden {
  display: none !important;
}

.card {
  background: var(--card);
  border-radius: 1rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.center {
  align-items: center;
  text-align: center;
  padding: 2rem 1.25rem;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.8rem;
}
h1 {
  font-size: 1.35rem;
}
h2 {
  font-size: 1.05rem;
}
.muted {
  color: var(--muted);
  font-size: 0.9rem;
}
.error {
  color: var(--bad);
  font-size: 0.9rem;
}

.stats {
  display: flex;
  gap: 1rem;
  margin: 0.5rem 0;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
}
.stat-label {
  color: var(--muted);
  font-size: 0.8rem;
}

button {
  border: 0;
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
.primary {
  background: var(--accent);
  color: #fff;
}
.secondary {
  background: #232a36;
  color: var(--text);
  font-weight: 500;
}
.row {
  display: flex;
  gap: 0.6rem;
}

.status-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.pill {
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(79, 140, 255, 0.15);
  color: var(--accent);
}
.pill.ok {
  background: rgba(52, 194, 115, 0.15);
  color: var(--ok);
}
.pill.bad {
  background: rgba(226, 92, 92, 0.15);
  color: var(--bad);
}
.pill.subtle {
  background: rgba(139, 147, 163, 0.15);
  color: var(--muted);
}

.meter {
  background: #232a36;
  border-radius: 999px;
  height: 0.55rem;
  overflow: hidden;
}
.meter-fill {
  background: var(--accent);
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s;
}

.tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--card);
  border-radius: 0.75rem;
  padding: 0.3rem;
}
.tab {
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.5rem 0.3rem;
  border-radius: 0.5rem;
}
.tab.active {
  background: #232a36;
  color: var(--text);
}

.plan {
  border-top: 1px solid #232a36;
  padding-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.plan p {
  color: var(--muted);
  font-size: 0.85rem;
}
.plan.current p {
  color: var(--text);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.modal-card {
  background: var(--card);
  border-radius: 1rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  max-width: 90vw;
}
.modal-card canvas,
.modal-card img,
.modal-card table {
  border-radius: 0.5rem;
  background: #fff;
  padding: 0.5rem;
}

a {
  color: var(--accent);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--muted);
  border-radius: 0.75rem;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  max-width: 90vw;
  text-align: center;
  z-index: 20;
}
.toast.hidden {
  display: none;
}
