:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f2430;
  --text: #e8ecf2;
  --muted: #aab3c5;
  --primary: #4f8cff;
  --primary-2: #7ea8ff;
  --success: #2ec27e;
  --border: #2b3343;
  --danger: #ff6b6b;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

body.light {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #edf2fd;
  --text: #202736;
  --muted: #5f6b85;
  --primary: #3c74eb;
  --primary-2: #5f8ff0;
  --success: #159f63;
  --border: #d5dfef;
  --shadow: 0 10px 22px rgba(13, 31, 67, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  margin: 0 auto;
  min-height: 100dvh;
  max-width: 860px;
  display: flex;
  flex-direction: column;
}

.auth-gate {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-card {
  width: min(420px, 100%);
}

.auth-gate.is-hidden {
  display: none;
}

.app-shell.is-hidden {
  display: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 12px 16px;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--primary), var(--primary-2));
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary) 20%, transparent);
}

.brand__name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.brand__sub {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
}

.content {
  flex: 1;
  padding: 14px 14px 84px;
}

.screen {
  display: none;
  gap: 12px;
}

.screen.is-active {
  display: flex;
  flex-direction: column;
}

h1 {
  margin: 4px 2px 2px;
  font-size: 22px;
}

h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.hero-card {
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--surface) 75%, var(--primary) 25%),
    var(--surface)
  );
}

.hero-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.plan-name {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 700;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.badge--success {
  color: #c9ffe6;
  border-color: color-mix(in srgb, var(--success) 35%, transparent);
  background: color-mix(in srgb, var(--success) 28%, transparent);
}

.progress-wrap {
  margin-top: 14px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.progress-bar {
  height: 10px;
  width: 100%;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(120deg, var(--primary), var(--primary-2));
  transition: width 0.25s ease;
}

.grid-two {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat p {
  margin: 0;
}

.stat p:last-child {
  margin-top: 3px;
  font-size: 16px;
  font-weight: 700;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.btn--small {
  padding: 8px 10px;
  font-size: 13px;
}

.btn--primary {
  background: linear-gradient(120deg, var(--primary), var(--primary-2));
  border-color: color-mix(in srgb, var(--primary) 60%, transparent);
  color: #fff;
}

.btn--ghost {
  background: transparent;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row--between {
  justify-content: space-between;
}

.mono-block {
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  padding: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.list li {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 12px;
  padding: 10px;
}

details {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: var(--surface-2);
}

details + details {
  margin-top: 8px;
}

summary {
  cursor: pointer;
  font-weight: 600;
}

details p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 8px;
}

.tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 10px 4px;
  border-radius: 10px;
  font-size: 12px;
  cursor: pointer;
}

.tab.is-active {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 78px;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  transition: all 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 900px) {
  .bottom-nav {
    left: 50%;
    width: 860px;
    transform: translateX(-50%);
    border-radius: 12px 12px 0 0;
  }

  .content {
    padding: 18px 18px 92px;
  }

  .quick-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
