.app-shell {
  color-scheme: light;
}

.app-main {
  width: 100%;
  flex: 1 0 auto;
}

.app-shell--authenticated .app-main {
  background:
    radial-gradient(circle at top left, rgba(20, 184, 166, 0.08), transparent 28%),
    linear-gradient(180deg, var(--workspace-bg-start) 0%, var(--workspace-bg-end) 100%);
}

.theme-shell {
  width: min(100%, var(--shell-max-width));
  margin: 0 auto;
  padding-inline: var(--shell-inline-padding);
}

.theme-shell--reading {
  width: min(100%, 1100px);
}

.theme-stack {
  display: grid;
  gap: var(--shell-gap);
  min-width: 0;
}

.theme-card-grid,
.theme-card-grid--compact,
.theme-card-grid--metrics {
  display: grid;
  gap: 1rem;
}

.theme-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

.theme-card-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.theme-card-grid--metrics {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

.theme-panel {
  display: grid;
  gap: 1rem;
  min-width: 0;
  padding: clamp(1rem, 2vw, 1.5rem);
  border-radius: var(--panel-radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, var(--surface-muted) 100%);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-sm);
}

.theme-panel--soft {
  background: rgba(255, 255, 255, 0.84);
  box-shadow: none;
}

.theme-panel--contrast {
  background:
    radial-gradient(circle at top right, rgba(45, 212, 191, 0.18), transparent 34%),
    linear-gradient(180deg, #113532 0%, #0f2f2c 100%);
  border-color: rgba(167, 243, 208, 0.12);
  box-shadow: 0 20px 42px rgba(17, 53, 50, 0.18);
  color: #effcf8;
}

.theme-panel--contrast .theme-page-subtitle,
.theme-panel--contrast .theme-section-header p,
.theme-panel--contrast .theme-note {
  color: rgba(232, 251, 246, 0.78);
}

.theme-kicker {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.theme-page-title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
  color: var(--text);
  text-wrap: balance;
}

.theme-page-subtitle {
  max-width: 60ch;
  color: var(--muted);
  line-height: 1.7;
}

.theme-section-header {
  display: grid;
  gap: 0.45rem;
}

.theme-section-header__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
  flex-wrap: wrap;
}

.theme-section-header__row > * {
  min-width: 0;
}

.theme-section-header p {
  max-width: 60ch;
  color: var(--muted);
  line-height: 1.6;
}

.theme-tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  width: fit-content;
  max-width: 100%;
  padding: 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 118, 110, 0.12);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.theme-tab-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  transition:
    background var(--transition),
    color var(--transition),
    box-shadow var(--transition);
}

.theme-tab-link:hover {
  color: var(--accent-dim);
  background: rgba(15, 118, 110, 0.08);
}

.theme-tab-link.active,
.theme-tab-link[aria-current="page"] {
  background: linear-gradient(180deg, rgba(226, 244, 239, 0.96) 0%, rgba(240, 253, 250, 0.98) 100%);
  color: var(--accent-dark);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.14);
}

.theme-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.theme-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.45rem 0.72rem;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.08);
  border: 1px solid rgba(15, 118, 110, 0.14);
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 700;
}

.theme-note {
  padding: 1rem 1.1rem;
  border-radius: 18px;
  border: 1px solid rgba(15, 118, 110, 0.14);
  background: linear-gradient(180deg, rgba(236, 253, 245, 0.86), rgba(255, 255, 255, 1));
  color: var(--muted);
  line-height: 1.65;
}

.theme-empty-state {
  display: grid;
  justify-items: center;
  gap: 0.85rem;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
  border: 1px dashed rgba(15, 118, 110, 0.2);
  border-radius: var(--panel-radius);
  background:
    radial-gradient(circle at top center, rgba(45, 212, 191, 0.1), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 250, 248, 0.98));
}

.theme-empty-state h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.theme-empty-state p {
  max-width: 42rem;
  line-height: 1.7;
}

.theme-empty-state svg {
  opacity: 0.38;
}

.theme-empty-state--compact {
  padding: 2rem;
}

@media (max-width: 900px) {
  .theme-section-header__row {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .theme-tab-nav {
    width: 100%;
    border-radius: 20px;
  }

  .theme-tab-link {
    width: 100%;
  }

  .theme-empty-state {
    padding: 2.5rem 1.25rem;
  }
}
