:root {
  --bg: #070b16;
  --bg2: #0f172a;
  --panel: rgba(15, 23, 42, 0.92);
  --panel2: rgba(30, 41, 59, 0.95);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --soft: #94a3b8;
  --line: rgba(148, 163, 184, 0.22);
  --blue: #2563eb;
  --blue2: #60a5fa;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #facc15;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
  --radius: 24px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.34), transparent 28rem),
    radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.16), transparent 26rem),
    linear-gradient(180deg, #020617, #0f172a 55%, #020617);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

a {
  color: #bfdbfe;
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.button,
.nav-link,
.install-btn {
  min-height: 44px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 0.85rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  min-width: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1.55rem;
  font-weight: 950;
  background: linear-gradient(135deg, #2563eb, #22c55e);
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.35);
}

.brand-title {
  font-weight: 950;
  letter-spacing: -0.04em;
  font-size: 1.08rem;
  line-height: 1;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.2rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.nav-link,
.install-btn,
.button,
button {
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.82);
  color: var(--text);
  padding: 0.68rem 0.95rem;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.nav-link:hover,
.install-btn:hover,
.button:hover,
button:hover {
  background: rgba(37, 99, 235, 0.28);
  border-color: rgba(96, 165, 250, 0.45);
  transform: translateY(-1px);
}

.primary,
.primary-nav {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-color: rgba(147, 197, 253, 0.42);
  color: white;
}

.danger-nav {
  color: #fecaca;
}

.mobile-bottom-nav {
  display: none;
}

.shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

.user-pill {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.7);
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 1.25rem;
  padding: clamp(1.15rem, 3vw, 2.2rem);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 8px);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.25), rgba(15, 23, 42, 0.9)),
    rgba(15, 23, 42, 0.86);
  box-shadow: var(--shadow);
  margin-bottom: 1.15rem;
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  right: -4rem;
  bottom: -4rem;
  width: 13rem;
  height: 13rem;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.13);
  pointer-events: none;
}

.eyebrow {
  color: var(--blue2);
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  margin: 0 0 0.55rem;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.1rem);
  letter-spacing: -0.07em;
  line-height: 0.96;
}

h2 {
  margin: 0 0 0.75rem;
  letter-spacing: -0.035em;
  font-size: clamp(1.25rem, 3vw, 1.65rem);
}

h3 {
  margin: -0.25rem 0 0.9rem;
  color: var(--muted);
  font-weight: 750;
  font-size: 1rem;
}

p {
  line-height: 1.55;
}

.lead {
  color: var(--muted);
  max-width: 68ch;
  font-size: 1.05rem;
  margin-bottom: 0;
}

.hero-actions,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  position: relative;
  z-index: 1;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(30, 41, 59, 0.75), rgba(15, 23, 42, 0.95)),
    var(--panel);
  box-shadow: 0 16px 55px rgba(0, 0, 0, 0.24);
  padding: 1.25rem;
}

.narrow {
  max-width: 640px;
  margin: 0 auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}

.grid > .card {
  grid-column: span 6;
}

.child-card,
.app-card {
  position: relative;
  overflow: hidden;
}

.child-card::before,
.app-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, #2563eb, #22c55e);
}

.big-count {
  font-size: 3rem;
  margin: 0.5rem 0;
  font-weight: 950;
  letter-spacing: -0.06em;
}

.status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-weight: 900;
  color: #dbeafe;
  border: 1px solid rgba(96, 165, 250, 0.35);
  background: rgba(37, 99, 235, 0.18);
  margin-bottom: 0.7rem;
  font-size: 0.83rem;
}

.status.good {
  color: #dcfce7;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.18);
}

.status.bad {
  color: #fee2e2;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.18);
}

.progress-wrap {
  height: 18px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #22c55e);
  border-radius: 999px;
  box-shadow: 0 0 25px rgba(34, 197, 94, 0.25);
}

form {
  display: grid;
  gap: 0.8rem;
}

label {
  font-weight: 850;
  color: #e2e8f0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(2, 6, 23, 0.64);
  color: var(--text);
  padding: 0.95rem 1rem;
  font-size: 16px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(96, 165, 250, 0.75);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

textarea {
  resize: vertical;
}

.small {
  padding: 0.45rem 0.7rem;
  border-radius: 12px;
  font-size: 0.85rem;
  min-height: 36px;
}

.alert {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  margin-top: 1rem;
}

.alert.warn {
  background: rgba(250, 204, 21, 0.13);
  border-color: rgba(250, 204, 21, 0.35);
}

.alert.bad {
  background: rgba(239, 68, 68, 0.13);
  border-color: rgba(239, 68, 68, 0.35);
}

.hint {
  color: var(--muted);
  font-size: 0.95rem;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  background: rgba(2, 6, 23, 0.25);
}

th,
td {
  padding: 0.85rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #dbeafe;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tr:last-child td {
  border-bottom: 0;
}

.footer {
  color: var(--soft);
  text-align: center;
  padding: 2rem 1rem;
}

/* Better phone experience */
@media (max-width: 820px) {
  body {
    padding-bottom: calc(82px + var(--safe-bottom));
  }

  .desktop-nav {
    display: none;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(0.65rem + var(--safe-bottom));
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.35rem;
    padding: 0.45rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 24px;
    background: rgba(2, 6, 23, 0.88);
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(18px);
  }

  .mobile-bottom-nav .nav-link,
  .mobile-bottom-nav .install-btn {
    min-width: 0;
    min-height: 52px;
    padding: 0.45rem 0.25rem;
    border-radius: 18px;
    font-size: 0.72rem;
    display: grid;
    place-items: center;
    text-align: center;
    line-height: 1.05;
    white-space: normal;
  }

  .mobile-bottom-nav .danger-nav {
    color: #fecaca;
  }

  .mobile-bottom-nav .install-btn[hidden] {
    display: none;
  }

  .mobile-bottom-nav .install-btn:not([hidden]) {
    display: grid;
  }

  .topbar {
    padding: 0.75rem 1rem;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    font-size: 1.35rem;
  }

  .brand-title {
    font-size: 1rem;
  }

  .brand-subtitle {
    font-size: 0.74rem;
  }

  .shell {
    width: min(100% - 1rem, 1180px);
    padding-top: 0.75rem;
  }

  .user-pill {
    width: 100%;
    justify-content: center;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
  }

  .hero {
    flex-direction: column;
    padding: 1.15rem;
    border-radius: 24px;
    margin-bottom: 0.9rem;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .hero-actions .button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  h1 {
    font-size: clamp(2rem, 12vw, 3.15rem);
    line-height: 0.94;
  }

  .lead {
    font-size: 0.98rem;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .grid > .card {
    grid-column: auto;
  }

  .card {
    padding: 1rem;
    border-radius: 22px;
  }

  .big-count {
    font-size: 2.55rem;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .actions .button,
  .actions button {
    text-align: center;
    width: 100%;
  }

  form {
    gap: 0.85rem;
  }

  input,
  select,
  textarea {
    border-radius: 15px;
    padding: 0.95rem;
  }

  form .primary,
  form button {
    width: 100%;
    min-height: 52px;
    font-size: 1rem;
  }

  .progress-wrap {
    height: 16px;
    margin-bottom: 0.9rem;
  }

  .table-wrap {
    border: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 680px;
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
  }

  th,
  td {
    padding: 0.75rem;
  }

  .footer {
    display: none;
  }
}

/* Tiny phones */
@media (max-width: 420px) {
  .mobile-bottom-nav {
    left: 0.45rem;
    right: 0.45rem;
    border-radius: 22px;
  }

  .mobile-bottom-nav .nav-link,
  .mobile-bottom-nav .install-btn {
    font-size: 0.68rem;
    min-height: 50px;
  }

  .shell {
    width: min(100% - 0.7rem, 1180px);
  }

  .hero {
    padding: 1rem;
  }

  .card {
    padding: 0.95rem;
  }

  .brand-subtitle {
    display: none;
  }
}