:root {
  --bg: #0f172a;
  --bg-2: #111827;
  --card: #1e293b;
  --card-soft: #263449;
  --text: #f8fafc;
  --text-2: #cbd5e1;
  --muted: #64748b;
  --primary: #3b82f6;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --border: rgba(203, 213, 225, 0.1);
  --shadow: 0 24px 70px rgba(2, 6, 23, 0.34);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(59, 130, 246, 0.2), transparent 28rem),
    radial-gradient(circle at 100% 18%, rgba(34, 197, 94, 0.12), transparent 24rem),
    var(--bg);
  color: var(--text);
  font-family: "Cairo", "IBM Plex Sans Arabic", "Inter", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 18px;
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  min-height: 56px;
  padding: 0 1.15rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button:hover {
  box-shadow: 0 16px 28px rgba(59, 130, 246, 0.28);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.52);
  color: var(--text);
  min-height: 56px;
  outline: none;
  padding: 0 1rem;
}

input::placeholder {
  color: #64748b;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-family: "Inter", "Cairo", sans-serif;
  font-size: clamp(1.8rem, 8vw, 2.6rem);
  line-height: 1.1;
  margin-bottom: 0;
}

h2 {
  font-size: 1.05rem;
  margin-bottom: 0.2rem;
}

p,
small,
span {
  color: var(--text-2);
}

.splash-screen,
.onboarding {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: var(--bg);
  text-align: center;
}

.splash-screen {
  animation: fadeIn 0.6s ease both;
}

.splash-screen h1,
.splash-screen p {
  margin: 0.35rem 0 0;
}

.logo-orb {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  margin-inline: auto;
  border-radius: 36px;
  background: linear-gradient(135deg, var(--primary), #2563eb 52%, var(--success));
  box-shadow: 0 24px 60px rgba(59, 130, 246, 0.32);
  color: #ffffff;
  font-size: 3rem;
  font-weight: 900;
  animation: scaleIn 0.7s ease both;
}

.logo-orb.small {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  font-size: 2rem;
}

.logo-orb.mini {
  width: 60px;
  height: 60px;
  border-radius: 22px;
  font-size: 1.75rem;
  margin: 0;
}

.onboarding-card {
  width: min(440px, calc(100% - 2rem));
  border: 1px solid var(--border);
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.94), rgba(17, 24, 39, 0.96));
  box-shadow: var(--shadow);
  padding: 1.35rem;
}

.onboarding-slide {
  min-height: 185px;
  padding: 1.25rem 0;
  animation: slideUp 0.35s ease both;
}

.onboarding-slide h2 {
  color: var(--text);
  font-size: 1.8rem;
  margin-bottom: 0.8rem;
}

.slide-dots {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.slide-dots button {
  min-height: 0;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--muted);
  padding: 0;
}

.slide-dots button.active {
  width: 28px;
  background: var(--primary);
}

.onboarding-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.hub-shell {
  display: grid;
  gap: 1rem;
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 1rem;
  animation: fadeIn 0.3s ease both;
}

.hub-header,
.hub-hero,
.service-card {
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(30, 41, 59, 0.66);
  padding: 1.25rem;
}

.hub-header p,
.hub-header span {
  color: var(--muted);
}

.hub-header h1 {
  margin: 0.25rem 0 0.45rem;
}

.hub-hero {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.18), transparent 15rem),
    linear-gradient(135deg, #1d4ed8, #0f766e);
  padding: 1.4rem;
}

.hub-hero::after {
  content: "";
  position: absolute;
  inset-inline-end: -88px;
  bottom: -110px;
  width: 280px;
  height: 280px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.hub-hero strong {
  display: block;
  max-width: 620px;
  color: #ffffff;
  font-size: clamp(2rem, 8vw, 4.3rem);
  line-height: 1.12;
  margin: 0.5rem 0 1rem;
}

.hub-hero p,
.hub-hero span {
  max-width: 560px;
  color: rgba(255, 255, 255, 0.78);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.service-card {
  display: grid;
  align-content: start;
  gap: 0.55rem;
  min-height: 240px;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.94), rgba(17, 24, 39, 0.94));
  color: inherit;
  padding: 20px;
  text-align: start;
}

button.service-card {
  min-height: 240px;
}

.service-card:hover {
  box-shadow: 0 24px 70px rgba(59, 130, 246, 0.18);
}

.service-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 20px;
  background: rgba(59, 130, 246, 0.14);
  font-size: 1.55rem;
}

.service-card small {
  color: var(--primary);
  font-weight: 900;
}

.service-card strong {
  color: var(--text);
  font-size: 1.25rem;
}

.service-card p {
  color: var(--text-2);
  line-height: 1.8;
}

.service-card em {
  align-self: end;
  justify-self: start;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.14);
  color: var(--success);
  font-style: normal;
  font-weight: 900;
  padding: 0.45rem 0.85rem;
}

.disabled-service {
  opacity: 0.62;
}

.disabled-service em {
  background: rgba(100, 116, 139, 0.18);
  color: var(--muted);
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 1rem 1rem 6.7rem;
}

.screen {
  display: none;
  animation: fadeIn 0.25s ease both;
}

.screen.active {
  display: grid;
  gap: 1rem;
}

.app-bar,
.page-header,
.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.page-header {
  display: block;
  padding: 0.35rem 0.25rem;
}

.page-header.center {
  text-align: center;
}

.page-header p,
.section-heading p {
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.section-heading {
  margin-bottom: 1rem;
}

.section-heading.row {
  align-items: center;
}

.user-chip,
.profile-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.profile-entry {
  min-height: auto;
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
  color: inherit;
  padding: 0.35rem 0.55rem;
  text-align: start;
}

.profile-entry:hover {
  border-color: var(--border);
  background: rgba(59, 130, 246, 0.1);
  box-shadow: none;
}

.profile-entry em,
.profile-edit-link {
  color: var(--primary);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
}

.user-chip img,
.profile-card img {
  width: 52px;
  height: 52px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  object-fit: cover;
}

.user-chip strong,
.profile-card strong {
  display: block;
  color: var(--text);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 52px;
  min-height: 52px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: none;
}

.app-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.app-actions .ghost-button {
  min-height: 52px;
}

.balance-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  border-radius: 28px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.22), transparent 13rem),
    linear-gradient(135deg, #2563eb, #1d4ed8 58%, #0f766e);
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: 1.35rem;
  position: relative;
}

.balance-card::after {
  content: "";
  position: absolute;
  inset-inline-end: -70px;
  bottom: -90px;
  width: 230px;
  height: 230px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.balance-card strong {
  display: block;
  color: #ffffff;
  font-family: "Inter", "Cairo", sans-serif;
  font-size: clamp(2.2rem, 9vw, 4rem);
  margin: 0.4rem 0;
}

.balance-card p,
.balance-card span {
  color: rgba(255, 255, 255, 0.78);
}

.spend-ring {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  align-content: center;
  width: 96px;
  height: 96px;
  border: 10px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ffffff;
  border-radius: 999px;
}

.spend-ring span {
  color: #ffffff;
  font-family: "Inter", "Cairo", sans-serif;
  font-weight: 900;
}

.spend-ring small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.7rem;
}

.balance-meta {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  position: relative;
  z-index: 1;
}

.balance-meta article {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.18);
  padding: 0.9rem;
}

.balance-meta article strong {
  font-size: 1.1rem;
  margin: 0.15rem 0 0;
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
}

.quick-stats article,
.card,
.amount-panel,
.budget-progress-card,
.profile-card,
.profile-editor,
.settings-list {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.94), rgba(17, 24, 39, 0.94));
  box-shadow: var(--shadow);
  padding: 20px;
}

.quick-stats article {
  min-height: 132px;
}

.quick-stats p {
  color: var(--text-2);
  margin: 0.7rem 0 0.25rem;
}

.quick-stats strong,
.goal-card strong,
.budget-progress-card strong,
.top-category strong {
  display: block;
  color: var(--text);
  font-family: "Inter", "Cairo", sans-serif;
  font-size: 1.15rem;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  color: #ffffff;
  font-weight: 900;
}

.primary,
.stat-icon.primary {
  background: rgba(59, 130, 246, 0.16);
  color: var(--primary);
}

.success,
.stat-icon.success {
  background: rgba(34, 197, 94, 0.16);
  color: var(--success);
}

.danger,
.stat-icon.danger {
  background: rgba(239, 68, 68, 0.16);
  color: var(--danger);
}

.warning,
.stat-icon.warning {
  background: rgba(245, 158, 11, 0.16);
  color: var(--warning);
}

.bar-chart,
.compare-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 0.55rem;
  min-height: 180px;
}

.bar-item {
  display: grid;
  align-content: end;
  gap: 0.45rem;
  height: 180px;
  text-align: center;
}

.bar-fill,
.income-fill,
.expense-fill {
  min-height: 8px;
  border-radius: 999px 999px 8px 8px;
}

.bar-fill {
  background: linear-gradient(180deg, var(--primary), #1d4ed8);
}

.income-fill {
  background: var(--success);
}

.expense-fill {
  background: var(--danger);
}

.bar-item span {
  color: var(--muted);
  font-size: 0.76rem;
}

.transaction-list,
.legend-list,
.top-categories {
  display: grid;
  gap: 0.8rem;
}

.transaction-item,
.legend-item,
.top-category {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 0.85rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.38);
  padding: 0.85rem;
}

.transaction-icon,
.legend-dot {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: rgba(59, 130, 246, 0.14);
  font-size: 1.35rem;
}

.transaction-item strong,
.legend-item strong {
  display: block;
  color: var(--text);
}

.transaction-item small,
.legend-item small {
  color: var(--muted);
}

.transaction-amount {
  color: var(--danger);
  font-family: "Inter", "Cairo", sans-serif;
  font-weight: 900;
}

.transaction-amount.income {
  color: var(--success);
}

.ghost-button {
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.32);
  color: var(--text-2);
  box-shadow: none;
}

.ghost-button:hover {
  background: rgba(59, 130, 246, 0.14);
  box-shadow: none;
}

.empty-state {
  color: var(--muted);
  margin: 0;
  padding: 0.7rem 0 0;
  text-align: center;
}

.type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  border-radius: 22px;
  background: rgba(15, 23, 42, 0.38);
  padding: 0.45rem;
  margin-bottom: 1.25rem;
}

.type-toggle button {
  background: transparent;
  box-shadow: none;
  color: var(--text-2);
}

.type-toggle button.active {
  background: var(--primary);
  color: #ffffff;
}

.transaction-form,
.budget-form {
  display: grid;
  gap: 0.9rem;
}

.transaction-form label {
  color: var(--text-2);
  font-weight: 800;
}

.amount-input {
  height: 96px;
  text-align: center;
  font-family: "Inter", "Cairo", sans-serif;
  font-size: 3rem;
  font-weight: 900;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
}

.category-button {
  display: grid;
  place-items: center;
  gap: 0.35rem;
  min-height: 92px;
  background: rgba(15, 23, 42, 0.45);
  box-shadow: none;
  color: var(--text-2);
}

.category-button span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 16px;
  background: rgba(59, 130, 246, 0.12);
  font-size: 1.25rem;
}

.category-button.active {
  outline: 2px solid var(--primary);
  background: rgba(59, 130, 246, 0.16);
  color: var(--text);
}

.save-button,
.primary-button {
  background: linear-gradient(135deg, var(--primary), #2563eb);
}

.pie-section {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 1rem;
  align-items: center;
}

.pie-chart {
  width: 180px;
  height: 180px;
  border-radius: 999px;
  background: conic-gradient(var(--primary) 0 25%, var(--success) 25% 50%, var(--danger) 50% 75%, var(--warning) 75% 100%);
  position: relative;
}

.pie-chart::after {
  content: "";
  position: absolute;
  inset: 38px;
  border-radius: inherit;
  background: var(--card);
}

.legend-item {
  grid-template-columns: 18px 1fr auto;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
}

.goal-card {
  display: grid;
  gap: 0.8rem;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.25);
}

.progress.large {
  height: 14px;
  margin-top: 1rem;
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--success));
}

.budget-form {
  grid-template-columns: 1fr 1fr auto;
}

.budget-progress-card strong {
  font-size: 2rem;
}

.profile-card {
  align-items: center;
}

.profile-editor {
  display: grid;
  gap: 0.75rem;
}

.profile-editor label {
  color: var(--text-2);
  font-weight: 800;
}

.profile-editor input[type="file"] {
  min-height: auto;
  padding: 0.9rem 1rem;
}

.profile-card img {
  width: 72px;
  height: 72px;
  border-radius: 24px;
}

.settings-list {
  display: grid;
  gap: 0.75rem;
}

.settings-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.36);
  box-shadow: none;
  color: var(--text);
}

.settings-list span {
  color: var(--muted);
}

.danger-action {
  color: #ffffff !important;
  background: var(--danger) !important;
}

.bottom-nav {
  position: fixed;
  right: 0.85rem;
  bottom: 0.85rem;
  left: 0.85rem;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: rgba(17, 24, 39, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 0.45rem;
}

.bottom-nav button {
  display: grid;
  place-items: center;
  gap: 0.12rem;
  min-height: 58px;
  border-radius: 22px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 1.15rem;
  padding: 0;
}

.bottom-nav button span {
  color: inherit;
  font-size: 0.72rem;
}

.bottom-nav button.active {
  background: rgba(59, 130, 246, 0.16);
  color: var(--text);
}

.bottom-nav .add-tab {
  background: var(--primary);
  color: #ffffff;
  transform: translateY(-14px);
  box-shadow: 0 18px 34px rgba(59, 130, 246, 0.34);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (min-width: 900px) {
  .app-shell {
    padding-bottom: 7rem;
  }

  .screen.active {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-bar,
  .page-header,
  .balance-card,
  .quick-stats,
  .add-screen .amount-panel {
    grid-column: 1 / -1;
  }

  .add-screen.active {
    grid-template-columns: minmax(0, 680px);
    justify-content: center;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding-inline: 0.85rem;
  }

  .hub-shell {
    padding: 0.85rem;
  }

  .hub-header {
    align-items: start;
  }

  .services-grid {
    grid-template-columns: 1fr;
  }

  .service-card,
  button.service-card {
    min-height: 210px;
  }

  .balance-card {
    grid-template-columns: 1fr;
  }

  .spend-ring {
    width: 88px;
    height: 88px;
  }

  .balance-meta,
  .quick-stats,
  .budget-form,
  .pie-section {
    grid-template-columns: 1fr;
  }

  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .transaction-item,
  .top-category {
    grid-template-columns: 44px 1fr;
  }

  .transaction-amount {
    grid-column: 2;
  }

  .bottom-nav {
    right: 0.5rem;
    left: 0.5rem;
    bottom: 0.5rem;
  }
}

/* Catalyst-inspired budget dashboard */
@media (min-width: 980px) {
  body {
    background:
      linear-gradient(90deg, rgba(15, 23, 42, 0.84), rgba(15, 23, 42, 0.2)),
      radial-gradient(circle at 78% 28%, rgba(59, 130, 246, 0.14), transparent 24rem),
      #030712;
  }

  .app-shell {
    display: grid;
    grid-template-columns: 224px minmax(0, 1fr);
    gap: 0;
    width: min(1440px, calc(100% - 1rem));
    min-height: calc(100vh - 1rem);
    margin: 0.5rem auto;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 24px;
    background: #0b1220;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
    padding: 0;
  }

  .service-sidebar {
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    gap: 1.4rem;
    min-height: calc(100vh - 1rem);
    border-inline-start: 1px solid rgba(148, 163, 184, 0.12);
    background: #050a14;
    padding: 1.25rem;
  }

  .sidebar-brand,
  .sidebar-footer,
  .side-nav button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }

  .brand-dot {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.16);
    color: var(--primary);
    font-weight: 900;
  }

  .sidebar-brand strong,
  .sidebar-footer strong {
    color: var(--text);
  }

  .side-nav {
    display: grid;
    gap: 0.35rem;
  }

  .side-nav button {
    justify-content: flex-start;
    min-height: 38px;
    border-radius: 12px;
    background: transparent;
    box-shadow: none;
    color: var(--text-2);
    font-size: 0.92rem;
    padding: 0 0.65rem;
  }

  .side-nav button span {
    color: inherit;
  }

  .side-nav button.active,
  .side-nav button:hover {
    background: rgba(59, 130, 246, 0.12);
    color: #ffffff;
    transform: none;
  }

  .sidebar-events {
    align-self: start;
    display: grid;
    gap: 0.65rem;
    margin-top: 1.4rem;
  }

  .sidebar-events span {
    color: var(--muted);
    font-size: 0.8rem;
  }

  .sidebar-events p {
    color: var(--text-2);
    font-size: 0.88rem;
    font-weight: 700;
    margin: 0;
  }

  .sidebar-footer {
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    padding-top: 1rem;
  }

  .sidebar-footer img {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    object-fit: cover;
  }

  .sidebar-footer span {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
  }

  .screen.active {
    grid-column: 2;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-content: start;
    gap: 1.25rem;
    min-height: calc(100vh - 1rem);
    background: #101827;
    padding: 2rem;
  }

  .app-bar,
  .page-header {
    grid-column: 1 / -1;
    border: 0;
    padding: 0;
  }

  .user-chip img {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  .user-chip span,
  .page-header p {
    color: var(--text-2);
    font-size: 0.92rem;
  }

  .user-chip strong,
  .page-header h1 {
    color: var(--text);
    font-size: 1.15rem;
  }

  .profile-entry em {
    display: block;
    margin-top: 0.2rem;
  }

  .app-actions .icon-button {
    width: 42px;
    min-height: 42px;
    border-radius: 12px;
    background: #111827;
  }

  .app-actions .ghost-button {
    min-height: 42px;
    border-radius: 12px;
  }

  .balance-card {
    grid-column: 1 / -1;
    grid-template-columns: 1.4fr 120px 1.4fr;
    min-height: 160px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 18px;
    background: #111827;
    box-shadow: none;
    padding: 1.3rem 1.5rem;
  }

  .balance-card::after {
    display: none;
  }

  .balance-card strong {
    color: var(--text);
    font-size: clamp(2rem, 5vw, 3rem);
  }

  .balance-card p,
  .balance-card span {
    color: var(--muted);
  }

  .spend-ring {
    width: 94px;
    height: 94px;
    border-color: rgba(59, 130, 246, 0.14);
    border-top-color: var(--primary);
  }

  .spend-ring span {
    color: var(--text);
  }

  .spend-ring small {
    color: var(--muted);
  }

  .balance-meta {
    grid-column: auto;
    grid-template-columns: 1fr 1fr;
    align-self: center;
  }

  .balance-meta article {
    border-color: rgba(148, 163, 184, 0.12);
    background: rgba(15, 23, 42, 0.36);
  }

  .quick-stats {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    gap: 0;
    padding: 1rem 0;
  }

  .quick-stats article {
    min-height: 106px;
    border: 0;
    border-inline-end: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 0.4rem 1.1rem;
  }

  .quick-stats article:last-child {
    border-inline-end: 0;
  }

  .quick-stats .stat-icon {
    display: none;
  }

  .quick-stats p {
    color: var(--text-2);
    font-size: 0.78rem;
    margin: 0 0 1rem;
  }

  .quick-stats strong {
    font-size: 1.45rem;
  }

  .card,
  .amount-panel,
  .budget-progress-card,
  .profile-card,
    .profile-editor,
  .settings-list {
    border-color: rgba(148, 163, 184, 0.12);
    border-radius: 18px;
    background: #111827;
    box-shadow: none;
  }

  #homeScreen .card:first-of-type {
    grid-column: span 2;
  }

  #homeScreen .card:last-of-type {
    grid-column: span 2;
  }

  .section-heading {
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    margin-bottom: 1rem;
    padding-bottom: 0.9rem;
  }

  .section-heading h2 {
    color: var(--text-2);
    font-size: 0.9rem;
  }

  .section-heading p {
    color: var(--muted);
    font-size: 0.78rem;
  }

  .transaction-list {
    gap: 0;
  }

  .transaction-item {
    grid-template-columns: 46px 1fr auto;
    border: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 0;
    background: transparent;
    padding: 0.88rem 0;
  }

  .transaction-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgba(148, 163, 184, 0.08);
    font-size: 1rem;
  }

  .bottom-nav {
    display: none !important;
  }
}

@media (max-width: 979px) {
  .service-sidebar {
    display: none;
  }

  .app-shell {
    width: min(430px, 100%);
    min-height: 100vh;
    background: rgba(16, 24, 39, 0.72);
  }

  .screen.active {
    gap: 0.9rem;
  }

  .app-bar,
  .page-header {
    position: sticky;
    top: 0;
    z-index: 5;
    align-items: center;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(18px);
    margin: -1rem -1rem 0;
    padding: 1rem;
  }

  .balance-card,
  .quick-stats article,
  .card,
  .amount-panel,
  .budget-progress-card,
  .profile-card,
  .profile-editor,
  .settings-list {
    border-color: rgba(148, 163, 184, 0.12);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
  }

  .quick-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .bar-chart,
  .compare-chart {
    min-height: 150px;
  }

  .bar-item {
    height: 150px;
  }
}

/* Platform prototype additions */
body[data-theme="light"] {
  --bg: #f8fafc;
  --bg-2: #eef2f7;
  --card: #ffffff;
  --card-soft: #e2e8f0;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --border: rgba(15, 23, 42, 0.1);
  background: #f8fafc;
}

body[data-theme="amoled"] {
  --bg: #000000;
  --bg-2: #030303;
  --card: #080808;
  --card-soft: #111111;
  --border: rgba(255, 255, 255, 0.09);
  background: #000000;
}

body[data-theme="blue"] {
  --bg: #07142f;
  --bg-2: #0c1f45;
  --card: #102a5c;
  --card-soft: #15366f;
  --primary: #60a5fa;
}

.landing-shell,
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 1rem;
  width: min(1120px, 100%);
}

.landing-copy,
.landing-preview,
.auth-card,
.launcher-panel,
.platform-card,
.notification-center,
.command-box {
  border: 1px solid var(--border);
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(17, 24, 39, 0.94));
  box-shadow: var(--shadow);
}

.landing-copy {
  padding: clamp(1.25rem, 4vw, 3rem);
}

.landing-copy h1 {
  font-size: clamp(2.6rem, 8vw, 5.5rem);
  letter-spacing: -0.04em;
  margin: 0.8rem 0 1rem;
}

.landing-copy p {
  max-width: 620px;
  line-height: 1.9;
}

.platform-badge {
  display: inline-flex;
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--primary);
  font-weight: 900;
  padding: 0.45rem 0.8rem;
}

.landing-actions,
.hub-actions,
.hub-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hub-user,
.user-chip,
.sidebar-footer {
  cursor: pointer;
}

.landing-preview {
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 1.25rem;
}

.preview-window {
  width: min(420px, 100%);
  border: 1px solid var(--border);
  border-radius: 28px;
  background: rgba(15, 23, 42, 0.66);
  padding: 1rem;
  transform: rotate(-2deg);
}

.preview-top {
  height: 150px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--primary), #0f766e);
  margin-bottom: 0.9rem;
}

.preview-grid,
.widgets-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}

.preview-grid span {
  height: 86px;
  border-radius: 20px;
  background: rgba(148, 163, 184, 0.12);
}

.auth-card {
  width: min(460px, 100%);
  padding: 1.25rem;
}

.auth-back {
  min-height: 42px;
  margin-bottom: 1rem;
}

.auth-heading {
  text-align: center;
  margin: 1rem 0;
}

.auth-form {
  display: grid;
  gap: 0.8rem;
}

.provider-button {
  width: 100%;
  margin-top: 0.8rem;
  background: rgba(15, 23, 42, 0.48);
  box-shadow: none;
}

.auth-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 1rem 0 0;
}

.auth-switch button {
  min-height: 0;
  background: transparent;
  color: var(--primary);
  padding: 0;
}

.hub-user img {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  object-fit: cover;
}

.hub-user strong,
.hub-user span {
  display: block;
}

.hub-user i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--success);
}

.launcher-panel {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
}

.launcher-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
}

.launcher-categories {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
}

.launcher-categories button,
.theme-picker button {
  min-height: 42px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.34);
  box-shadow: none;
  color: var(--text-2);
}

.launcher-categories button.active,
.theme-picker button.active {
  background: rgba(59, 130, 246, 0.18);
  color: var(--text);
}

.service-card {
  position: relative;
}

.favorite-toggle {
  position: absolute;
  top: 1rem;
  inset-inline-end: 1rem;
  min-height: 38px;
  width: 38px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.42);
  box-shadow: none;
  padding: 0;
}

.launch-service {
  justify-self: start;
  min-height: 44px;
}

.platform-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.platform-card {
  padding: 1rem;
}

.mini-list,
.activity-feed,
.notification-list,
.command-results {
  display: grid;
  gap: 0.65rem;
}

.mini-list button,
.activity-feed article,
.notification-item,
.command-results button,
.widgets-grid div {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.34);
  color: var(--text);
  box-shadow: none;
  min-height: 52px;
  padding: 0.75rem;
  text-align: start;
}

.widgets-grid strong {
  display: block;
  color: var(--text);
}

.activity-feed article {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem;
}

.notification-center {
  position: fixed;
  top: 1rem;
  inset-inline-end: 1rem;
  z-index: 40;
  width: min(390px, calc(100% - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: 1rem;
}

.notification-item {
  border-inline-start: 4px solid var(--primary);
}

.notification-item.success {
  border-inline-start-color: var(--success);
}

.notification-item.security,
.notification-item.danger {
  border-inline-start-color: var(--danger);
}

.command-menu {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: start center;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(16px);
  padding: 8vh 1rem 1rem;
}

.command-box {
  width: min(720px, 100%);
  padding: 1rem;
}

.command-results {
  margin-top: 0.8rem;
}

.command-results button {
  display: grid;
  grid-template-columns: 1fr auto;
}

.toast-stack {
  position: fixed;
  z-index: 60;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  gap: 0.65rem;
  width: min(360px, calc(100% - 2rem));
}

.toast {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.94);
  box-shadow: var(--shadow);
  padding: 0.9rem;
  animation: slideUp 0.24s ease both;
}

.toast strong,
.toast span {
  display: block;
}

.theme-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
}

#profileBio {
  color: var(--muted);
  margin: 0.35rem 0 0;
}

.profile-edit-link {
  display: inline-block;
  margin-top: 0.45rem;
  text-decoration: none;
}

@media (max-width: 900px) {
  .landing-hero,
  .platform-grid {
    grid-template-columns: 1fr;
  }

  .hub-header,
  .hub-actions {
    align-items: start;
    flex-direction: column;
  }

  .launcher-search {
    grid-template-columns: 1fr;
  }
}

/* Final layout fixes */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

input[type="number"] {
  appearance: textfield;
}

.bucket-form {
  display: grid;
  grid-template-columns: 1fr 150px auto;
  gap: 0.7rem;
}

.bucket-summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.34);
  margin: 0.8rem 0;
  padding: 0.85rem;
}

.bucket-summary strong {
  color: var(--text);
}

.bucket-list {
  display: grid;
  gap: 0.75rem;
}

.transaction-buckets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}

.bucket-choice {
  display: grid;
  align-content: center;
  gap: 0.25rem;
  min-height: 70px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.34);
  box-shadow: none;
  color: var(--text-2);
  padding: 0.65rem;
}

.bucket-choice strong,
.bucket-choice span {
  color: inherit;
}

.bucket-choice.active {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.16);
  color: var(--text);
  outline: 1px solid rgba(59, 130, 246, 0.55);
}

.bucket-item {
  display: grid;
  grid-template-columns: 1fr minmax(120px, 0.7fr) auto;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.28);
  padding: 0.8rem;
}

.bucket-item strong,
.bucket-item span {
  display: block;
}

.bucket-item strong {
  color: var(--text);
}

.bucket-item button {
  min-height: 40px;
}

@media (min-width: 980px) {
  #addScreen.screen.active {
    grid-template-columns: minmax(0, 740px);
    justify-content: center;
    align-content: start;
    padding-top: 1.5rem;
  }

  #addScreen .page-header,
  #addScreen .amount-panel {
    grid-column: 1;
  }

  #addScreen .page-header {
    text-align: center;
  }

  #addScreen .amount-panel {
    padding: 1.1rem;
  }

  #addScreen .type-toggle {
    margin-bottom: 0.8rem;
  }

  #addScreen .type-toggle button {
    min-height: 46px;
  }

  #addScreen .transaction-form {
    gap: 0.65rem;
  }

  #addScreen .amount-input {
    height: 72px;
    min-height: 72px;
    font-size: 2.25rem;
  }

  #addScreen .category-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.55rem;
  }

  #addScreen .transaction-buckets {
    grid-template-columns: repeat(3, 1fr);
  }

  #addScreen .category-button {
    min-height: 72px;
    border-radius: 16px;
    font-size: 0.9rem;
  }

  #addScreen .category-button span {
    width: 30px;
    height: 30px;
    border-radius: 12px;
    font-size: 1rem;
  }

  #addScreen input:not(.amount-input) {
    min-height: 46px;
  }

  #addScreen .save-button {
    min-height: 50px;
  }

  #budgetScreen.screen.active {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 1rem;
  }

  #budgetScreen .page-header {
    grid-column: 1 / -1;
  }

  #budgetScreen .card,
  #budgetScreen .budget-progress-card {
    min-height: 260px;
  }

  #budgetScreen .money-buckets-card {
    grid-column: span 2;
  }

  #accountScreen.screen.active {
    grid-template-columns: minmax(280px, 360px) minmax(360px, 520px);
    justify-content: center;
    align-items: start;
  }

  #accountScreen .page-header {
    grid-column: 1 / -1;
  }

  #accountScreen .profile-card,
  #accountScreen .profile-editor,
  #accountScreen .settings-list {
    min-height: auto;
  }

  #accountScreen .profile-card,
  #accountScreen .profile-editor {
    grid-column: 1;
  }

  #accountScreen .settings-list {
    grid-column: 2;
    grid-row: 2 / span 2;
  }

  #accountScreen .settings-list button {
    min-height: 48px;
    font-size: 0.95rem;
  }

  #statsScreen.screen.active {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }

  #statsScreen .page-header {
    grid-column: 1 / -1;
  }

  #statsScreen .pie-section {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  #statsScreen .pie-chart {
    width: 150px;
    height: 150px;
  }

  #statsScreen .pie-chart::after {
    inset: 32px;
  }

  #statsScreen .bar-chart,
  #statsScreen .compare-chart {
    min-height: 150px;
  }

  #statsScreen .bar-item {
    height: 150px;
  }
}

@media (max-width: 700px) {
  .bucket-form,
  .bucket-item,
  .transaction-buckets {
    grid-template-columns: 1fr;
  }
}

/* Seen Jeem MVP game */
.game-shell {
  display: grid;
  gap: 0.5rem;
  width: min(1080px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0.55rem;
  animation: fadeIn 0.25s ease both;
}

.game-header,
.teams-panel,
.category-selection,
.question-board,
.question-dialog {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.94), rgba(17, 24, 39, 0.96));
  box-shadow: 0 16px 45px rgba(2, 6, 23, 0.26);
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.55rem 0.7rem;
}

.game-header.playing {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  padding-block: 0.2rem;
}

.game-header.playing .game-title-block {
  display: none;
}

.game-header.playing .game-header-actions {
  margin-inline-start: auto;
}

.game-header h1 {
  font-size: clamp(1.25rem, 4vw, 2rem);
  margin: 0.25rem 0 0.35rem;
}

.game-header p,
.game-header span {
  color: var(--muted);
}

.game-header-actions,
.question-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.game-header-actions .ghost-button {
  min-height: 42px;
  border-radius: 13px;
}

.teams-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  padding: 0.5rem;
}

.game-header.playing + .teams-panel {
  justify-self: end;
  width: min(430px, 100%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-radius: 16px;
  padding: 0.35rem;
}

.category-selection {
  display: grid;
  gap: 0.5rem;
  padding: 0.55rem;
}

.selection-columns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.selection-columns article {
  display: grid;
  gap: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.34);
  padding: 0.5rem;
}

.selection-columns strong {
  color: var(--text);
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-height: 28px;
}

.selected-tag,
.empty-selection {
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.14);
  color: var(--text-2);
  font-size: 0.74rem;
  font-weight: 800;
  padding: 0.25rem 0.45rem;
}

.empty-selection {
  background: rgba(100, 116, 139, 0.12);
  color: var(--muted);
}

.category-pool {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.35rem;
}

.category-pick {
  display: grid;
  justify-items: start;
  gap: 0.25rem;
  min-height: 76px;
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 13px;
  background: rgba(15, 23, 42, 0.36);
  box-shadow: none;
  color: var(--text);
  padding: 0.5rem;
  text-align: start;
}

.category-pick span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.15);
  font-size: 0.9rem;
}

.category-pick strong {
  color: var(--text);
  font-size: 0.74rem;
}

.category-pick small {
  color: var(--muted);
}

.category-pick.selected {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.12);
}

.team-card {
  display: grid;
  gap: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(15, 23, 42, 0.35);
  padding: 0.45rem 0.55rem;
}

.team-card.active {
  border-color: rgba(59, 130, 246, 0.8);
  background: rgba(59, 130, 246, 0.14);
}

.team-card span {
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 900;
}

.team-card input {
  min-height: 34px;
  border-radius: 10px;
  font-weight: 900;
  font-size: 0.85rem;
}

.team-card strong,
.score-input {
  color: var(--text);
  font-size: clamp(1.15rem, 4vw, 1.8rem);
  line-height: 1;
}

.score-input {
  min-height: 0 !important;
  border: 0;
  background: transparent;
  padding: 0;
  font-weight: 900;
  text-align: start;
}

.question-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  padding: 0.5rem;
}

.game-category {
  display: grid;
  gap: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(15, 23, 42, 0.32);
  padding: 0.5rem;
}

.game-category header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.game-category header span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.14);
  font-size: 0.85rem;
}

.game-category header strong {
  color: var(--text);
  font-size: 0.82rem;
}

.game-question-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.28rem;
}

.game-question-tile {
  display: grid;
  place-items: center;
  gap: 0.15rem;
  min-height: 44px;
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.12);
  box-shadow: none;
  color: var(--text);
}

.game-question-tile span {
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 900;
}

.game-question-tile small {
  color: var(--muted);
}

.game-question-tile:disabled {
  border-color: rgba(100, 116, 139, 0.16);
  background: rgba(100, 116, 139, 0.12);
  opacity: 0.45;
  transform: none;
}

.question-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 10%, rgba(59, 130, 246, 0.2), transparent 24rem),
    radial-gradient(circle at 90% 80%, rgba(34, 197, 94, 0.14), transparent 20rem),
    #020617;
  padding: clamp(0.8rem, 2vw, 2rem);
}

.question-dialog {
  display: grid;
  align-content: space-between;
  gap: clamp(1rem, 3vw, 2rem);
  width: min(1100px, 100%);
  min-height: min(760px, calc(100vh - 2rem));
  border-radius: 34px;
  padding: clamp(1.2rem, 4vw, 3rem);
  text-align: center;
}

.question-dialog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  text-align: start;
}

.question-dialog-top span,
.question-dialog-top strong {
  display: block;
}

.question-dialog-top strong,
.question-dialog h2 {
  color: var(--text);
}

.question-dialog h2 {
  max-width: 920px;
  color: #ffffff;
  font-size: clamp(1.75rem, 6vw, 3.7rem);
  line-height: 1.35;
  margin: 0 auto;
}

.timer-pill {
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.16);
  color: #fecaca;
  font-weight: 900;
  padding: 0.8rem 1.2rem;
}

.timer-pill span {
  color: #ffffff;
}

.answer-box {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(15, 23, 42, 0.45);
  justify-self: end;
  align-self: end;
  width: min(420px, 100%);
  margin: 0;
  padding: 0.85rem 1rem;
  text-align: end;
}

.answer-box summary {
  list-style-position: inside;
  color: var(--primary);
  cursor: pointer;
  font-weight: 900;
}

.answer-box summary::before {
  content: "▾ ";
}

.answer-box p {
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0.8rem 0 0;
}

.question-actions {
  justify-content: center;
}

.correct-action {
  background: var(--success);
}

.wrong-action {
  background: var(--danger);
}

@media (max-width: 820px) {
  .game-header,
  .teams-panel {
    grid-template-columns: 1fr;
  }

  .game-header {
    display: grid;
  }

  .question-board {
    grid-template-columns: 1fr;
  }

  .selection-columns,
  .category-pool {
    grid-template-columns: 1fr;
  }

  .question-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* Compact polish for add and analytics screens */
.card,
.amount-panel,
.budget-progress-card {
  overflow: hidden;
}

@media (min-width: 980px) {
  #addScreen.screen.active {
    grid-template-columns: minmax(0, 560px);
    padding-top: 1rem;
  }

  #addScreen .page-header {
    margin-bottom: -0.3rem;
  }

  #addScreen .page-header h1 {
    font-size: 1.15rem;
  }

  #addScreen .page-header p {
    font-size: 0.78rem;
  }

  #addScreen .amount-panel {
    border-radius: 20px;
    padding: 0.9rem;
  }

  #addScreen .type-toggle {
    gap: 0.45rem;
    border-radius: 16px;
    margin-bottom: 0.55rem;
    padding: 0.3rem;
  }

  #addScreen .type-toggle button {
    min-height: 38px;
    border-radius: 13px;
    font-size: 0.88rem;
  }

  #addScreen .transaction-form {
    gap: 0.45rem;
  }

  #addScreen .transaction-form label {
    font-size: 0.82rem;
  }

  #addScreen .amount-input {
    height: 52px;
    min-height: 52px;
    border-radius: 14px;
    font-size: 1.8rem;
  }

  #addScreen .category-grid,
  #addScreen .transaction-buckets {
    gap: 0.45rem;
  }

  #addScreen .category-button {
    min-height: 54px;
    border-radius: 14px;
    font-size: 0.78rem;
    gap: 0.15rem;
  }

  #addScreen .category-button span {
    width: 24px;
    height: 24px;
    border-radius: 10px;
    font-size: 0.85rem;
  }

  #addScreen .bucket-choice {
    min-height: 54px;
    border-radius: 14px;
    font-size: 0.78rem;
    padding: 0.45rem;
  }

  #addScreen .bucket-choice span {
    font-size: 0.72rem;
  }

  #addScreen input:not(.amount-input) {
    min-height: 42px;
    border-radius: 14px;
    font-size: 0.85rem;
  }

  #addScreen .save-button {
    min-height: 44px;
    border-radius: 14px;
    font-size: 0.9rem;
    margin-top: 0.25rem;
  }

  #statsScreen.screen.active {
    gap: 0.85rem;
  }

  #statsScreen .card {
    min-height: 250px;
    padding: 1rem;
  }

  #statsScreen .section-heading {
    margin-bottom: 0.75rem;
    padding-bottom: 0.65rem;
  }

  #statsScreen .compare-chart {
    min-height: 132px;
    align-items: end;
  }

  #statsScreen .compare-chart .bar-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 116px auto;
    gap: 0.22rem;
    height: 140px;
    align-items: end;
  }

  #statsScreen .compare-chart .income-fill,
  #statsScreen .compare-chart .expense-fill {
    align-self: end;
    width: 100%;
    max-height: 112px;
  }

  #statsScreen .compare-chart .bar-item span {
    grid-column: 1 / -1;
  }

  #statsScreen .pie-chart {
    width: 128px;
    height: 128px;
  }

  #statsScreen .pie-chart::after {
    inset: 28px;
  }

  #statsScreen .legend-list {
    gap: 0.55rem;
    width: 100%;
  }

  #statsScreen .legend-item {
    min-height: 52px;
    padding: 0.6rem;
    font-size: 0.82rem;
  }

  #statsScreen .goal-card strong {
    font-size: 1.15rem;
  }
}
