:root {
  color-scheme: light;
  --page-background:
    radial-gradient(circle at top left, rgba(21, 184, 166, 0.18), transparent 34%),
    radial-gradient(circle at top right, rgba(11, 92, 171, 0.14), transparent 32%),
    linear-gradient(180deg, #f8fbff 0%, #edf4fb 100%);
  --bg: #f3f7fb;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-solid: #ffffff;
  --ink: #10233d;
  --muted: #5d6a7e;
  --primary: #0b5cab;
  --primary-dark: #083d74;
  --accent: #15b8a6;
  --line: rgba(16, 35, 61, 0.1);
  --shadow: 0 18px 50px rgba(8, 29, 56, 0.12);
  --nav-background: rgba(255, 255, 255, 0.92);
  --input-background: #ffffff;
  --ghost-background: rgba(11, 92, 171, 0.08);
  --modal-backdrop: rgba(6, 18, 35, 0.48);
  --radius: 24px;
}

html.modal-open,
body.modal-open {
  overflow: hidden !important;
  height: 100% !important;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page-background:
    radial-gradient(circle at top left, rgba(21, 184, 166, 0.12), transparent 34%),
    radial-gradient(circle at top right, rgba(11, 92, 171, 0.16), transparent 32%),
    linear-gradient(180deg, #0d1727 0%, #09111d 100%);
  --bg: #07111d;
  --panel: rgba(13, 23, 39, 0.9);
  --panel-solid: #111c2d;
  --ink: #eef4fb;
  --muted: #a4b3c7;
  --primary: #54a8ff;
  --primary-dark: #8bc4ff;
  --accent: #3fd4c3;
  --line: rgba(180, 203, 231, 0.16);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
  --nav-background: rgba(9, 17, 29, 0.92);
  --input-background: #0f1a2b;
  --ghost-background: rgba(84, 168, 255, 0.12);
  --modal-backdrop: rgba(2, 8, 16, 0.68);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  min-height: 100%;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page-background);
}

.app-shell {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE 10+ */
  overflow-y: auto;
  max-height: 100vh;
  padding: 20px 16px 96px; 
  box-sizing: border-box;
  width: 100%;
}
.app-shell::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.app-shell.no-scroll {
  overflow: hidden !important;
}

.scrollbar-mask {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 18px;
  z-index: 99999;
  pointer-events: none;
  background: var(--page-background);
  display: none !important;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 20px 18px 92px;
}

.topbar,
.section-header,
.hero,
.stats-grid,
.cards-grid,
.summary-list,
.entry-list,
.form-grid {
  width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.9rem;
  line-height: 1;
}

h2 {
  font-size: 1.5rem;
  margin-top: 4px;
}

h3 {
  font-size: 1.08rem;
}

.eyebrow,
.section-label,
.muted {
  color: var(--muted);
}

.eyebrow,
.section-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 700;
}

.main-content {
  display: grid;
  gap: 18px;
}

.view {
  display: none;
  gap: 18px;
}

.view.active {
  display: grid;
}

.card {
  background: var(--panel);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  align-items: flex-end;
}

.hero-copy {
  max-width: 70%;
}

.hero-copy p:not(.section-label) {
  margin-top: 8px;
  color: var(--muted);
}

.hero-badge {
  align-self: center;
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(21, 184, 166, 0.16);
  color: var(--primary-dark);
  font-weight: 700;
  white-space: nowrap;
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.section-header.compact {
  align-items: center;
}

.cards-grid,
.stats-grid {
  display: grid;
  gap: 12px;
}

.cards-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
}

.metric-card,
.stat-card,
.entry,
.summary-item {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.metric-card,
.stat-card {
  padding: 16px;
}

.metric-value,
.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  margin-top: 8px;
}

.metric-meta,
.stat-meta,
.entry-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.93rem;
}

.progress {
  margin-top: 12px;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(16, 35, 61, 0.08);
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--primary));
}

.stacked-card {
  padding: 18px;
}

.summary-list,
.entry-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.summary-item,
.entry {
  padding: 14px 16px;
}

.summary-row,
.entry-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.summary-label,
.entry-title {
  font-weight: 700;
}

.summary-value,
.entry-value {
  font-weight: 800;
  color: var(--primary-dark);
  white-space: nowrap;
}

.ghost-button,
.primary-button,
.nav-item {
  border: 0;
  cursor: pointer;
}

.ghost-button,
.primary-button {
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 700;
}

.ghost-button {
  background: var(--ghost-background);
  color: var(--primary-dark);
}

.primary-button {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 12px 24px rgba(11, 92, 171, 0.22);
}

.full-width {
  width: 100%;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px;
  background: var(--nav-background);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.nav-item {
  border-radius: 18px;
  padding: 14px 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.nav-item.active {
  color: var(--primary-dark);
  background: rgba(11, 92, 171, 0.12);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: hidden;
}

.modal.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--modal-backdrop);
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-sizing: border-box;
  z-index: 2;
  -webkit-overflow-scrolling: touch; 
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.form-grid label span {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-grid input,
.form-grid select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background-color: var(--input-background);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease;
}

.form-grid input:focus,
.form-grid select:focus {
  border-color: var(--primary);
}

.form-grid .primary-button {
  margin-top: 8px;
}