* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #070a12;
  --surface: rgba(17, 24, 39, 0.78);
  --surface-strong: rgba(17, 24, 39, 0.96);
  --border: rgba(255, 255, 255, 0.12);
  --text: #f8fafc;
  --muted: #a7b0c0;
  --muted-strong: #cbd5e1;
  --primary: #8b5cf6;
  --primary-strong: #7c3aed;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(139, 92, 246, 0.35), transparent 32rem),
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.18), transparent 28rem),
    linear-gradient(135deg, #070a12 0%, #111827 52%, #050816 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  padding: 28px 0 34px;
}

.topbar,
.toolbar,
.hero-content,
.panel-heading,
.stats-grid,
.form-grid,
.card-actions,
.card-meta {
  display: flex;
}

.topbar {
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 62px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.05;
}

.brand strong {
  font-size: 1.08rem;
}

.brand small {
  color: var(--muted);
}

.toolbar {
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tool-button,
.ghost-button,
.submit-button,
.icon-button {
  border: 0;
  border-radius: 999px;
  color: var(--text);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, opacity 180ms ease;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
}

.tool-button-primary,
.submit-button {
  background: linear-gradient(135deg, var(--primary), #06b6d4);
  font-weight: 800;
}

.tool-button:hover,
.ghost-button:hover,
.submit-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.hero-content {
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #c4b5fd;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(2.35rem, 6vw, 5.4rem);
  line-height: 0.94;
  letter-spacing: -0.08em;
}

.lead {
  max-width: 660px;
  margin-bottom: 0;
  color: var(--muted-strong);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.75;
}

.hero-card {
  position: relative;
  width: min(320px, 100%);
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.09);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -40px -70px auto;
  width: 160px;
  height: 160px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.34);
  filter: blur(4px);
}

.hero-card p {
  margin-bottom: 18px;
  color: var(--muted-strong);
}

.hero-card strong {
  position: relative;
  z-index: 1;
  font-size: 1.45rem;
}

.pulse {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-bottom: 22px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.14);
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: 18px;
  align-items: start;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.summary-panel,
.form-panel,
.list-panel {
  padding: 22px;
}

.list-panel {
  grid-column: 1 / -1;
}

.panel-heading {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}

.ghost-button {
  padding: 10px 14px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
}

.stats-grid {
  gap: 12px;
}

.stat-card {
  flex: 1;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.07);
}

.stat-card-save {
  background: rgba(34, 197, 94, 0.08);
}

.stat-label,
.stat-card small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.stat-card strong {
  display: block;
  margin: 10px 0 6px;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  letter-spacing: -0.06em;
}

.subscription-form {
  display: grid;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 0.7fr 0.55fr;
  gap: 14px;
}

.form-grid label:nth-child(4),
.form-grid label:nth-child(5) {
  grid-column: span 1;
}

label span {
  display: block;
  margin: 0 0 8px;
  color: var(--muted-strong);
  font-size: 0.87rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  background: rgba(3, 7, 18, 0.55);
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(139, 92, 246, 0.9);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.17);
}

.submit-button {
  min-height: 50px;
  padding: 0 18px;
}

.form-message {
  min-height: 20px;
  margin: -4px 0 0;
  color: var(--muted-strong);
  font-size: 0.9rem;
}

.filter-select {
  width: auto;
  min-width: 160px;
}

.subscription-list {
  display: grid;
  gap: 12px;
}

.subscription-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.07);
}

.subscription-card.inactive {
  opacity: 0.68;
}

.subscription-card.expired {
  border-color: rgba(245, 158, 11, 0.46);
  background: rgba(245, 158, 11, 0.08);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.card-title h3 {
  margin: 0;
  font-size: 1.1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.18);
  color: #ddd6fe;
  font-size: 0.76rem;
  font-weight: 800;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.18);
  color: #fde68a;
}

.badge-muted {
  background: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
}

.card-price {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.card-price small {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.card-meta {
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted-strong);
  font-size: 0.88rem;
}

.card-actions {
  gap: 10px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
}

.icon-button-danger {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.32);
  background: rgba(239, 68, 68, 0.1);
}

.empty-state {
  padding: 38px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--muted-strong);
}

.empty-icon {
  margin-bottom: 12px;
  font-size: 2.2rem;
}

.empty-state h3 {
  margin-bottom: 8px;
  color: var(--text);
}

.empty-state p {
  margin-bottom: 0;
}

.footer {
  padding: 26px 0 34px;
  color: var(--muted);
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .hero-content,
  .main-grid,
  .stats-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .main-grid {
    gap: 16px;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
  }

  .topbar,
  .panel-heading,
  .subscription-card {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar,
  .hero-content {
    margin-bottom: 36px;
  }

  .toolbar {
    justify-content: stretch;
  }

  .tool-button,
  .toolbar button,
  .filter-select {
    width: 100%;
    justify-content: center;
  }

  .form-grid,
  .subscription-card {
    display: grid;
    grid-template-columns: 1fr;
  }

  .card-actions {
    justify-content: stretch;
  }

  .icon-button {
    width: 100%;
  }
}
