:root {
  --bg: #0a0a0a;
  --bg-card: #141414;
  --bg-elevated: #1c1c1c;
  --text: #f5f5f5;
  --muted: #9ca3af;
  --border: #2a2a2a;
  --accent: #ffffff;
  --accent-fg: #0a0a0a;
  --brand: #d83b01;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --radius: 12px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100dvh;
  padding-bottom: calc(72px + var(--safe-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(10, 10, 10, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.brand {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.agent-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #64748b;
}

.dot.on {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px;
}

.view-title {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 650;
}

.view-sub {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-brand {
  background: var(--brand);
  color: #fff;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--muted);
}

input,
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.field {
  margin-bottom: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  transform: translateX(-50%);
  max-width: min(92vw, 420px);
  padding: 10px 14px;
  border-radius: 10px;
  background: #1f2937;
  border: 1px solid var(--border);
  font-size: 0.88rem;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.toast.show {
  opacity: 1;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(10, 10, 10, 0.96);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}

.nav-btn {
  appearance: none;
  background: none;
  border: none;
  color: var(--muted);
  padding: 10px 4px 12px;
  font-size: 11px;
  cursor: pointer;
}

.nav-btn.active {
  color: var(--text);
}

.nav-btn span {
  display: block;
  font-size: 18px;
  margin-bottom: 2px;
}

.agent-grid {
  display: grid;
  gap: 12px;
}

.agent-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--bg-elevated);
}

.agent-card.locked {
  opacity: 0.55;
}

.agent-card h4 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #262626;
  color: var(--muted);
  margin-bottom: 8px;
}

.platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px;
}

.platforms span {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.steps {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.steps li {
  margin-bottom: 8px;
}

.runs li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  list-style: none;
}

.runs {
  margin: 0;
  padding: 0;
}

.status-ok {
  color: var(--ok);
}

.status-err {
  color: var(--err);
}

.install-banner {
  border-left: 3px solid var(--brand);
}

#installIosHint {
  font-size: 0.85rem;
  color: var(--muted);
}

@media (min-width: 768px) {
  .bottom-nav {
    max-width: 720px;
    margin: 0 auto;
    border-radius: 16px 16px 0 0;
    left: 50%;
    transform: translateX(-50%);
  }
}
