:root {
  --bg: #eaf3ee;
  --bg-deep: #0b1117;
  --panel: rgba(244, 250, 246, 0.96);
  --panel-solid: #f6fbf7;
  --ink: #0b1117;
  --muted: #61736b;
  --soft: #eaf5ee;
  --line: #cadcd1;
  --surface: #111c24;
  --surface-2: #172630;
  --surface-3: #20333b;
  --green: #00c805;
  --teal: #00a7a7;
  --blue: #635bff;
  --amber: #d99b16;
  --coral: #ff6b55;
  --red: #c84a42;
  --shadow: 0 28px 80px rgba(11, 17, 23, 0.12);
  --soft-shadow: 0 14px 34px rgba(11, 17, 23, 0.08);
}

/* Keep the prioritized paycheck flow above legacy layout rules. */
.paycheck-periods {
  display: block;
}

@media (max-width: 720px) {
  .topbar {
    display: none;
  }

  .focus-card {
    flex-basis: 190px;
    min-height: 132px;
  }

  .focus-card small {
    overflow-wrap: anywhere;
  }
}

/* Paycheck-first product flow */
.overview-paycheck-panel {
  align-items: center;
  background: linear-gradient(135deg, #0b1117, #12332c);
  border: 1px solid rgba(0, 200, 5, 0.24);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
  color: #fff;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(220px, 1.1fr) minmax(360px, 1.4fr) auto;
  margin-bottom: 14px;
  padding: 20px;
}

.overview-paycheck-panel.short {
  background: linear-gradient(135deg, #181117, #3a211f);
  border-color: rgba(255, 107, 85, 0.32);
}

.overview-paycheck-panel .section-kicker {
  color: #8de7c8;
}

.overview-paycheck-panel h2 {
  color: #fff;
  font-size: 25px;
  margin: 5px 0 4px;
}

.overview-paycheck-panel p {
  color: rgba(255, 255, 255, 0.66);
  font-size: 13px;
}

.overview-paycheck-stats {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.overview-paycheck-stats div {
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  display: grid;
  gap: 5px;
  padding-left: 14px;
}

.overview-paycheck-stats span {
  color: rgba(255, 255, 255, 0.58);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.overview-paycheck-stats strong {
  color: #fff;
  font-size: 20px;
}

.overview-paycheck-panel.short .overview-paycheck-stats div:last-child strong {
  color: #ffb09f;
}

.overview-paycheck-panel > a {
  background: #e5ff58;
  border-radius: 7px;
  color: #101817;
  font-size: 13px;
  font-weight: 820;
  padding: 11px 13px;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.paycheck-page-head,
.forecast-page-head {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin: 2px 2px 14px;
  padding: 8px 2px;
}

.paycheck-page-head h2,
.forecast-page-head h2 {
  font-size: 28px;
  margin: 4px 0;
}

.paycheck-page-head p,
.forecast-page-head p {
  color: var(--muted);
  font-size: 14px;
}

.paycheck-periods {
  display: block;
  margin-bottom: 14px;
}

.paycheck-period-list,
.past-paycheck-list {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.paycheck-card.current-period {
  border-color: rgba(0, 150, 70, 0.34);
  box-shadow: 0 14px 32px rgba(0, 105, 70, 0.12);
  grid-column: 1 / -1;
}

.past-paychecks {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 12px;
}

.past-paychecks > summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 780;
  list-style: none;
  padding: 10px 2px;
}

.past-paychecks > summary::-webkit-details-marker,
.paycheck-settings-panel > summary::-webkit-details-marker {
  display: none;
}

.past-paychecks > summary span {
  background: #e1ece5;
  border-radius: 999px;
  color: var(--ink);
  margin-left: 6px;
  padding: 3px 7px;
}

.past-paycheck-list {
  margin-top: 8px;
}

.paycheck-settings-panel {
  margin-bottom: 14px;
  padding: 0;
}

.paycheck-settings-panel > summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  list-style: none;
  min-height: 70px;
  padding: 16px 18px;
}

.paycheck-settings-panel > summary span,
.paycheck-settings-panel > summary strong,
.paycheck-settings-panel > summary small {
  display: block;
}

.paycheck-settings-panel > summary small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.paycheck-settings-panel > summary b {
  color: #087d3a;
  font-size: 12px;
}

.paycheck-settings-content {
  border-top: 1px solid var(--line);
  padding: 16px 18px 18px;
}

.paycheck-settings-panel .paycheck-controls {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.settings-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

.data-completeness {
  color: #a15f00;
  display: inline-block;
  font-size: 11px;
  font-weight: 760;
  margin-top: 7px;
}

.data-completeness.complete {
  color: #087d3a;
}

.forecast-timeline {
  display: grid;
  gap: 9px;
}

.forecast-row {
  align-items: center;
  background: #f7fcf8;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 7px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(190px, 1.4fr) repeat(3, minmax(110px, 0.7fr));
  padding: 13px 14px;
}

.forecast-row.short {
  background: #fff8f5;
  border-left-color: var(--coral);
}

.forecast-row div {
  display: grid;
  gap: 3px;
}

.forecast-row span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 780;
  text-transform: uppercase;
}

.forecast-row strong {
  font-size: 13px;
}

.forecast-row.short div:last-child strong {
  color: var(--red);
}

@media (max-width: 980px) {
  .overview-paycheck-panel {
    grid-template-columns: 1fr;
  }

  .overview-paycheck-panel > a {
    justify-self: start;
  }

  .paycheck-settings-panel .paycheck-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar {
    display: none;
  }

  .overview-paycheck-panel {
    gap: 15px;
    margin-bottom: 12px;
    padding: 16px;
  }

  .overview-paycheck-panel h2 {
    font-size: 22px;
  }

  .overview-paycheck-stats {
    gap: 6px;
  }

  .overview-paycheck-stats div {
    padding-left: 9px;
  }

  .overview-paycheck-stats div:first-child {
    border-left: 0;
    padding-left: 0;
  }

  .overview-paycheck-stats strong {
    font-size: 16px;
  }

  .overview-paycheck-panel > a {
    justify-self: stretch;
  }

  .paycheck-page-head,
  .forecast-page-head {
    align-items: flex-start;
    margin: 0 2px 12px;
  }

  .paycheck-page-head h2,
  .forecast-page-head h2 {
    font-size: 23px;
  }

  .paycheck-month-badge {
    font-size: 10px;
    padding: 7px 9px;
  }

  .paycheck-period-list,
  .past-paycheck-list {
    grid-template-columns: 1fr;
  }

  .paycheck-card.current-period {
    grid-column: auto;
  }

  .paycheck-settings-panel > summary {
    min-height: 66px;
    padding: 14px;
  }

  .paycheck-settings-content {
    padding: 14px;
  }

  .paycheck-settings-panel .paycheck-controls {
    grid-template-columns: 1fr;
  }

  .settings-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .forecast-row {
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 12px;
  }

  .forecast-row > div:first-child {
    border-bottom: 1px solid var(--line);
    grid-column: 1 / -1;
    padding-bottom: 9px;
  }

  .forecast-row strong {
    font-size: 12px;
  }
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 8% 0%, rgba(99, 91, 255, 0.12), transparent 24%),
    radial-gradient(circle at 70% 0%, rgba(0, 200, 5, 0.18), transparent 24%),
    radial-gradient(circle at 100% 24%, rgba(0, 167, 167, 0.13), transparent 23%),
    linear-gradient(180deg, #f7fff8 0%, var(--bg) 46%, #dfeae4 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(11, 17, 23, 0.028) 1px, transparent 1px);
  background-size: 100% 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 72%);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: #0b1117;
  box-shadow: 0 12px 24px rgba(11, 17, 23, 0.2);
  color: #fff;
  cursor: pointer;
  font-weight: 720;
  min-height: 40px;
  padding: 0 15px;
}

button:hover {
  transform: translateY(-1px);
}

button.ghost {
  background: rgba(244, 250, 246, 0.84);
  box-shadow: none;
  color: var(--ink);
  border: 1px solid rgba(16, 24, 32, 0.12);
}

button.secondary {
  background: #e6fbe8;
  box-shadow: none;
  color: #087d1b;
}

button.icon {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  background: #eef7f1;
  box-shadow: none;
  color: var(--muted);
}

.ambient {
  border-radius: 999px;
  filter: blur(6px);
  opacity: 0.32;
  pointer-events: none;
  position: fixed;
  z-index: -1;
}

.ambient-one {
  background: #d4d1ff;
  height: 240px;
  left: -90px;
  top: 120px;
  width: 240px;
}

.ambient-two {
  background: #b1f6cf;
  bottom: 40px;
  height: 180px;
  right: -70px;
  width: 180px;
}

.shell {
  width: min(1320px, calc(100% - 34px));
  margin: 0 auto;
  padding: 26px 0 52px;
}

.app-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: 238px minmax(0, 1fr);
}

.workspace {
  min-width: 0;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.sidebar {
  background:
    radial-gradient(circle at 15% 0%, rgba(0, 200, 5, 0.2), transparent 34%),
    radial-gradient(circle at 100% 18%, rgba(99, 91, 255, 0.22), transparent 32%),
    linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
  min-height: auto;
  padding: 14px;
  position: sticky;
  top: 16px;
  backdrop-filter: blur(18px);
}

.topbar,
.brand-lockup,
.top-meta,
.section-head,
.actions {
  display: flex;
  align-items: center;
}

.topbar {
  background:
    linear-gradient(135deg, rgba(244, 250, 246, 0.92), rgba(232, 239, 255, 0.78));
  border: 1px solid rgba(16, 24, 32, 0.08);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 14px;
  z-index: 2;
  backdrop-filter: blur(18px);
}

.app-notice {
  align-items: center;
  background: #fff4dc;
  border: 1px solid rgba(217, 155, 22, 0.34);
  border-left: 4px solid var(--amber);
  border-radius: 6px;
  color: #6f4d08;
  display: flex;
  font-size: 14px;
  font-weight: 680;
  margin: -4px 0 18px;
  min-height: 44px;
  padding: 10px 14px;
}

.app-notice[hidden] {
  display: none;
}

input[aria-invalid="true"] {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(200, 74, 66, 0.12);
}

.brand-lockup {
  gap: 12px;
  min-width: 210px;
}

.brand-mark {
  border-radius: 8px;
  display: block;
  height: 42px;
  object-fit: cover;
  width: 42px;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 12px 4px 2px;
}

.legal-links a {
  color: rgba(255, 255, 255, 0.58);
  font-size: 10px;
  text-decoration: none;
}

.legal-links a:hover {
  color: #fff;
}

.delete-account-button {
  background: transparent;
  box-shadow: none;
  color: rgba(255, 255, 255, 0.58);
  font-size: 10px;
  min-height: 28px;
  padding: 2px 0;
  text-align: left;
}

.delete-account-button:hover {
  color: #fff;
  transform: none;
}

.brand-tagline {
  color: rgba(255, 255, 255, 0.58);
  font-size: 10px;
  line-height: 1.35;
  margin-top: 3px;
}

.top-meta {
  background: rgba(234, 245, 238, 0.84);
  border: 1px solid rgba(16, 24, 32, 0.08);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  gap: 0;
  overflow: hidden;
}

.nav-list {
  display: grid;
  gap: 6px;
  margin: 22px 0;
}

.nav-list a {
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 14px;
  font-weight: 730;
  padding: 11px 12px;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-icon {
  display: none;
}

.nav-list a:hover,
.nav-list a.active {
  background: rgba(0, 200, 5, 0.14);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--green);
  transform: translateX(2px);
}

.command-bar {
  align-items: center;
  background: rgba(239, 248, 242, 0.94);
  border: 1px solid rgba(16, 24, 32, 0.08);
  border-radius: 8px;
  display: flex;
  flex: 1 1 360px;
  max-width: 520px;
  min-height: 42px;
  overflow: hidden;
}

.command-bar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 0 13px;
  text-transform: uppercase;
}

.command-bar input {
  background: transparent;
  border: 0;
  color: var(--ink);
  min-width: 0;
  outline: 0;
  padding: 10px 12px 10px 0;
  width: 100%;
}

.sidebar .eyebrow {
  color: rgba(255, 255, 255, 0.56);
}

.sidebar h1 {
  color: #fff;
}

body[data-page="overview"] .topbar {
  display: none;
}

.welcome-panel {
  align-items: stretch;
  background:
    linear-gradient(120deg, rgba(11, 17, 23, 0.98), rgba(23, 48, 60, 0.94) 42%, rgba(0, 200, 5, 0.16)),
    #0b1117;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(16, 24, 32, 0.09);
  display: grid;
  gap: 18px;
  grid-template-columns: 0.9fr 1.5fr;
  margin-bottom: 14px;
  padding: 18px;
}

.welcome-copy {
  align-content: center;
  background:
    radial-gradient(circle at 10% 0%, rgba(99, 91, 255, 0.45), transparent 25%),
    radial-gradient(circle at 100% 80%, rgba(0, 200, 5, 0.32), transparent 30%),
    rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  display: grid;
  min-height: 150px;
  padding: 20px;
}

.welcome-copy h2 {
  color: #fff;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.02;
  margin: 5px 0 12px;
  max-width: 430px;
}

.welcome-copy p {
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.48;
  max-width: 500px;
}

.focus-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.focus-card {
  container-type: inline-size;
  min-width: 0;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  box-shadow: none;
  display: grid;
  min-height: 150px;
  padding: 17px;
  position: relative;
  overflow: hidden;
}

.focus-card::after {
  content: "";
  background: rgba(99, 91, 255, 0.26);
  border-radius: 50%;
  height: 70px;
  position: absolute;
  right: -26px;
  top: -26px;
  width: 70px;
}

.focus-card:nth-child(2)::after {
  background: rgba(0, 200, 5, 0.2);
}

.focus-card:nth-child(3)::after {
  background: rgba(0, 167, 167, 0.22);
}

.focus-card span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  font-weight: 820;
  text-transform: uppercase;
}

.focus-card strong {
  align-self: end;
  color: #fff;
  font-size: clamp(20px, 15cqi, 36px);
  line-height: 1;
}

.focus-card small {
  min-width: 0;
  overflow-wrap: anywhere;
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.35;
}

.top-meta span {
  border-right: 1px solid rgba(16, 24, 32, 0.08);
  padding: 9px 12px;
  white-space: nowrap;
}

.top-meta span:last-child {
  border-right: 0;
}

.actions {
  gap: 10px;
  flex-wrap: wrap;
}

.account-control {
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
  margin-top: auto;
  padding-top: 18px;
}

.account-control [hidden] {
  display: none;
}

.sign-in-button {
  background: #e5ff58;
  border-color: #cfe842;
  color: #101817;
  grid-column: 1 / -1;
  white-space: nowrap;
}

.sign-in-button:hover {
  background: #d8f54b;
}

.user-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
}

.account-copy {
  min-width: 0;
}

.account-copy small {
  color: rgba(255, 255, 255, 0.54);
  display: block;
  font-size: 11px;
  line-height: 1.4;
  margin-top: 3px;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  font-weight: 700;
}

.sync-status::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #87918f;
}

.sync-status[data-state="synced"]::before {
  background: #1eaf79;
}

.sync-status[data-state="saving"]::before {
  background: #d89c2b;
}

.sync-status[data-state="error"]::before {
  background: #e06656;
}

.eyebrow,
.section-kicker {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 3px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.panel,
.hero-panel {
  background:
    radial-gradient(circle at 100% 0%, rgba(0, 200, 5, 0.08), transparent 28%),
    linear-gradient(180deg, #f7fcf8, var(--panel-solid));
  border: 1px solid rgba(16, 24, 32, 0.08);
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(16, 24, 32, 0.09);
  margin-bottom: 18px;
  overflow: hidden;
}

.panel {
  padding: 20px;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) 2fr;
  gap: 0;
  min-height: 176px;
  margin-bottom: 14px;
}

.income-card {
  background:
    radial-gradient(circle at 15% 0%, rgba(0, 200, 5, 0.22), transparent 30%),
    linear-gradient(135deg, rgba(11, 17, 23, 0.98), rgba(22, 38, 51, 0.94)),
    #0b1117;
  color: #fff;
  padding: 24px;
}

.income-card label {
  color: rgba(255, 255, 255, 0.7);
  display: block;
  font-size: 13px;
  margin: 10px 0 9px;
}

.read-label {
  color: rgba(255, 255, 255, 0.7);
  display: block;
  font-size: 13px;
  margin: 12px 0 10px;
}

.read-money {
  color: #fff;
  display: block;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1;
  margin-bottom: 12px;
}

.income-card p,
.section-head p,
.source-list,
.activity-list {
  color: var(--muted);
  font-size: 13px;
}

.income-card p {
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.45;
}

.income-card .section-kicker {
  color: #7ce0c0;
}

.money-input {
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  display: flex;
  margin-bottom: 12px;
  max-width: 300px;
  overflow: hidden;
}

.money-input span {
  color: rgba(255, 255, 255, 0.58);
  padding: 13px 15px;
}

.money-input input {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 30px;
  font-weight: 820;
  min-width: 0;
  outline: none;
  padding: 8px 12px;
  width: 100%;
}

.income-editor-panel {
  background:
    radial-gradient(circle at 100% 0%, rgba(99, 91, 255, 0.09), transparent 30%),
    linear-gradient(135deg, rgba(246, 252, 247, 0.98), rgba(235, 247, 240, 0.94));
}

.paycheck-setup-panel {
  background:
    radial-gradient(circle at 100% 0%, rgba(99, 91, 255, 0.14), transparent 30%),
    linear-gradient(135deg, #f7fcf8, #e9f6ee);
}

.paycheck-month-badge {
  background: var(--surface);
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 9px 12px;
  white-space: nowrap;
}

.paycheck-controls {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
}

.paycheck-controls label,
.paycheck-estimate {
  background: #edf7f1;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 14px;
}

.paycheck-controls label > span,
.paycheck-estimate > span,
.paycheck-summary-card > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.paycheck-controls input {
  background: #f9fffa;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 42px;
  padding: 8px 10px;
  width: 100%;
}

.paycheck-controls label small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.paycheck-money-control {
  align-items: center;
  background: #f9fffa;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  min-height: 42px;
  overflow: hidden;
}

.paycheck-money-control > span {
  align-self: stretch;
  background: #e5f1e9;
  color: var(--muted);
  display: grid;
  padding: 0 11px;
  place-items: center;
}

.paycheck-money-control input {
  background: transparent;
  border: 0;
  min-width: 0;
}

.paycheck-estimate strong {
  font-size: 26px;
  line-height: 1;
}

.paycheck-estimate small,
.paycheck-summary-card small {
  color: var(--muted);
  font-size: 12px;
}

.paycheck-summary-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 14px;
}

.other-income-panel {
  margin-bottom: 14px;
}

.other-income-table {
  min-width: 760px;
}

.paycheck-summary-card {
  background: linear-gradient(180deg, #f7fcf8, #edf7f1);
  border: 1px solid rgba(16, 24, 32, 0.08);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 17px;
}

.paycheck-summary-card strong {
  font-size: 28px;
  line-height: 1;
}

.shortfall-assistant-panel {
  background: linear-gradient(135deg, #0b1117, #142934);
  border-color: rgba(0, 200, 5, 0.22);
  color: #fff;
  margin-bottom: 14px;
  overflow: hidden;
}

.shortfall-assistant-head,
.shortfall-list-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.shortfall-assistant-panel .section-kicker {
  color: #7ce0c0;
}

.shortfall-assistant-panel h2 {
  color: #fff;
  font-size: 24px;
  margin-top: 5px;
}

.shortfall-status {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 820;
  padding: 8px 11px;
}

.shortfall-status.warning {
  background: rgba(255, 184, 77, 0.14);
  color: #ffd18c;
}

.shortfall-status.healthy {
  background: rgba(0, 200, 5, 0.13);
  color: #9df2a0;
}

.shortfall-stat-grid {
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
  border-top: 1px solid rgba(255, 255, 255, 0.13);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 18px 0 14px;
}

.shortfall-stat-grid > div {
  display: grid;
  gap: 5px;
  padding: 15px 16px;
}

.shortfall-stat-grid > div + div {
  border-left: 1px solid rgba(255, 255, 255, 0.13);
}

.shortfall-stat-grid span,
.shortfall-stat-grid small,
.shortfall-list-head span,
.shortfall-disclaimer,
.shortfall-assistant-empty p {
  color: rgba(255, 255, 255, 0.66);
  font-size: 11px;
}

.shortfall-stat-grid strong {
  font-size: 24px;
}

.shortfall-explanation {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 18px;
}

.shortfall-recommendations {
  border-top: 1px solid rgba(255, 255, 255, 0.13);
}

.shortfall-list-head {
  padding: 14px 0 8px;
}

.shortfall-recommendation {
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.45fr);
  padding: 14px 0;
}

.shortfall-recommendation span {
  color: #7ce0c0;
  display: block;
  font-size: 10px;
  font-weight: 820;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.shortfall-recommendation strong {
  display: block;
  font-size: 16px;
  margin-bottom: 4px;
}

.shortfall-recommendation p,
.shortfall-no-change p {
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  line-height: 1.45;
}

.shortfall-recommendation b {
  color: #cfff8b;
  font-size: 13px;
  line-height: 1.4;
  text-align: right;
}

.shortfall-no-change {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 18px 0 12px;
}

.shortfall-no-change strong {
  display: block;
  margin-bottom: 5px;
}

.shortfall-disclaimer {
  line-height: 1.45;
  margin-top: 8px;
}

.shortfall-assistant-empty {
  min-height: 150px;
  place-content: center;
}

.shortfall-assistant-empty p {
  font-size: 13px;
  margin-top: 10px;
}

.paycheck-periods {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.paycheck-card {
  background:
    radial-gradient(circle at 100% 0%, rgba(0, 200, 5, 0.1), transparent 30%),
    linear-gradient(180deg, #f7fcf8, #edf7f1);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
  overflow: hidden;
  padding: 18px;
}

.paycheck-card.short {
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 107, 85, 0.14), transparent 30%),
    linear-gradient(180deg, #fff9f7, #f8eeeb);
}

.paycheck-card.next-month-preview {
  border-color: rgba(99, 91, 255, 0.34);
  box-shadow: 0 12px 28px rgba(99, 91, 255, 0.1);
}

.paycheck-card-head em {
  color: var(--blue);
  display: block;
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.paycheck-card-head,
.paycheck-card-summary,
.paycheck-item {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.paycheck-card-head span,
.paycheck-card-head strong {
  display: block;
}

.paycheck-card-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.paycheck-card-head strong {
  font-size: 26px;
}

.paycheck-card-head small {
  color: var(--muted);
  text-align: right;
}

.paycheck-progress {
  background: #dce9e1;
  border-radius: 999px;
  height: 8px;
  margin: 16px 0;
  overflow: hidden;
}

.paycheck-progress span {
  background: linear-gradient(90deg, var(--teal), var(--green));
  display: block;
  height: 100%;
}

.paycheck-card.short .paycheck-progress span {
  background: linear-gradient(90deg, var(--amber), var(--coral));
}

.paycheck-card-summary {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.paycheck-card-summary div {
  display: grid;
  flex: 1;
  gap: 4px;
}

.paycheck-card-summary div:nth-child(2) {
  text-align: center;
}

.paycheck-card-summary div:last-child {
  text-align: right;
}

.paycheck-card-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
}

.paycheck-card-summary strong {
  font-size: 17px;
}

.paycheck-card.short .paycheck-card-summary div:last-child strong {
  color: var(--red);
}

.paycheck-items {
  display: grid;
  gap: 8px;
  padding-top: 12px;
}

.paycheck-item {
  background: rgba(249, 255, 250, 0.76);
  border: 1px solid rgba(16, 24, 32, 0.07);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  padding: 10px;
}

.paycheck-item time {
  color: #0f6d4d;
  font-size: 12px;
  font-weight: 800;
}

.paycheck-item strong,
.paycheck-item span {
  display: block;
}

.paycheck-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paycheck-item span {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.paycheck-item b {
  font-size: 13px;
}

.paycheck-item-actions {
  align-items: flex-end;
  display: grid;
  gap: 5px;
  justify-items: end;
}

.paycheck-paid-control {
  align-items: center;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  font-size: 11px;
  font-weight: 760;
  gap: 6px;
}

.paycheck-paid-control input {
  accent-color: var(--green);
  height: 17px;
  margin: 0;
  width: 17px;
}

.paycheck-paid-control span {
  display: inline;
  font-size: 11px;
  margin: 0;
}

.paycheck-item.paid {
  background: #e5eee8;
  border-color: rgba(97, 115, 107, 0.18);
}

.paycheck-item.paid time,
.paycheck-item.paid strong,
.paycheck-item.paid b {
  color: var(--muted);
  text-decoration: line-through;
}

.paycheck-item.income-item {
  background: #e8f8ed;
  border-color: rgba(0, 150, 70, 0.18);
}

.paycheck-item.income-item time,
.paycheck-item.income-item b {
  color: #087d3a;
}

.paycheck-no-items,
.paycheck-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 16px;
  text-align: center;
}

.paycheck-empty {
  background: linear-gradient(135deg, #f7fcf8, #e9f6ee);
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  grid-column: 1 / -1;
  min-height: 180px;
  place-content: center;
}

.paycheck-empty strong {
  color: var(--ink);
  font-size: 18px;
}

.income-editor {
  align-items: end;
  display: grid;
  gap: 8px;
  max-width: 360px;
}

.income-editor label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.money-input.light {
  background: #f4faf6;
  border-color: var(--line);
}

.money-input.light span {
  background: #eef5f2;
  color: var(--muted);
}

.money-input.light input {
  color: var(--ink);
}

.metric-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 18px;
}

.metric {
  container-type: inline-size;
  min-width: 0;
  background:
    linear-gradient(180deg, #f7fcf8, #edf7f1);
  border: 1px solid rgba(16, 24, 32, 0.08);
  border-radius: 8px;
  min-height: 142px;
  padding: 17px;
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  border-radius: 999px;
  height: 8px;
  left: 17px;
  position: absolute;
  top: 17px;
  width: 38px;
}

.metric::after {
  content: "";
  background: rgba(16, 24, 32, 0.04);
  border-radius: 50%;
  height: 54px;
  position: absolute;
  right: -14px;
  top: -14px;
  width: 54px;
}

.metric[data-tone="teal"]::before {
  background: linear-gradient(90deg, var(--teal), var(--blue));
}

.metric[data-tone="amber"]::before {
  background: linear-gradient(90deg, var(--amber), #f7c948);
}

.metric[data-tone="coral"]::before {
  background: linear-gradient(90deg, var(--coral), #ff9b86);
}

.metric[data-tone="green"]::before {
  background: linear-gradient(90deg, var(--green), #8ef58e);
}

.metric span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin: 25px 0 10px;
}

.metric strong {
  display: block;
  font-size: clamp(18px, 18cqi, 26px);
  overflow-wrap: anywhere;
  line-height: 1;
}

.metric small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 10px;
}

.metric.highlight {
  background: linear-gradient(180deg, #e7faef, #f4fbf6);
}

.dashboard-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.35fr 1fr;
}

.ops-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 0.8fr 1.2fr;
}

.visual-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  margin-bottom: 14px;
}

.donut-panel,
.trend-panel {
  container-type: inline-size;
  min-width: 0;
  background:
    radial-gradient(circle at 0% 0%, rgba(99, 91, 255, 0.22), transparent 30%),
    radial-gradient(circle at 100% 0%, rgba(0, 200, 5, 0.14), transparent 30%),
    #0b1117;
  border-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.donut-panel .section-head p,
.trend-panel .section-head p {
  color: rgba(255, 255, 255, 0.62);
}

.donut-panel h2,
.trend-panel h2 {
  color: #fff;
}

.category-panel {
  background:
    radial-gradient(circle at 100% 0%, rgba(99, 91, 255, 0.12), transparent 28%),
    linear-gradient(180deg, #f7fbf8, #edf7f1);
}

.health-panel,
.upcoming-panel {
  min-height: 178px;
}

.health-panel {
  align-items: center;
  background:
    radial-gradient(circle at 100% 0%, rgba(0, 200, 5, 0.16), transparent 34%),
    linear-gradient(135deg, rgba(247, 252, 248, 0.98), rgba(235, 247, 240, 0.95));
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.health-panel h2 {
  font-size: 25px;
  margin: 6px 0 8px;
}

.health-panel p {
  max-width: 280px;
}

.ring {
  --score: 0;
  align-items: center;
  background:
    radial-gradient(circle at center, #f5fbf7 0 58%, transparent 59%),
    conic-gradient(var(--green) calc(var(--score) * 1%), #e4eaed 0);
  border-radius: 50%;
  display: grid;
  flex: 0 0 auto;
  height: 118px;
  justify-items: center;
  width: 118px;
}

.ring span {
  color: var(--ink);
  font-size: 26px;
  font-weight: 840;
}

.compact {
  margin-bottom: 10px;
}

.upcoming-list {
  display: grid;
  gap: 9px;
  max-height: 260px;
  overflow: auto;
  padding-right: 2px;
}

.upcoming-item {
  align-items: center;
  background: #f7fcf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 70px minmax(0, 1fr) auto;
  padding: 10px 12px;
}

.upcoming-item time {
  background: #eaf4ef;
  border-radius: 8px;
  color: #0f6d4d;
  font-size: 12px;
  font-weight: 820;
  padding: 7px 8px;
  text-align: center;
}

.upcoming-item strong,
.upcoming-item span {
  display: block;
}

.upcoming-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upcoming-item span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.upcoming-item b {
  font-size: 14px;
}

.empty-state {
  background: var(--soft);
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.donut-layout {
  align-items: center;
  display: grid;
  gap: 18px;
  grid-template-columns: 190px minmax(0, 1fr);
}

.donut-chart {
  --bills: 0deg;
  --debt: 0deg;
  align-items: center;
  background:
    radial-gradient(circle at center, #0b1117 0 55%, transparent 56%),
    conic-gradient(var(--blue) 0deg var(--bills), var(--amber) var(--bills) var(--debt), var(--green) var(--debt) 360deg);
  border-radius: 50%;
  display: grid;
  height: 190px;
  justify-items: center;
  margin: 0 auto;
  width: 190px;
}

.donut-chart div {
  text-align: center;
  width: 110px;
}

.donut-chart span {
  color: rgba(255, 255, 255, 0.62);
  display: block;
  font-size: 12px;
  font-weight: 760;
}

.donut-chart strong {
  color: #fff;
  display: block;
  font-size: 22px;
  line-height: 1;
  margin-top: 6px;
}

.legend-list {
  display: grid;
  gap: 10px;
}

.legend-row {
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  display: grid;
  gap: 9px;
  grid-template-columns: 12px 1fr auto;
  padding: 11px 12px;
}

.legend-row span {
  background: var(--dot);
  border-radius: 50%;
  height: 10px;
  width: 10px;
}

.legend-row b {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.legend-row strong {
  color: #fff;
  font-size: 13px;
}

.spark-chart {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  min-height: 215px;
  padding-top: 18px;
}

.spark-chart > .empty-state {
  grid-column: 1 / -1;
  align-self: stretch;
  display: grid;
  place-items: center;
  overflow-wrap: anywhere;
}

@container (max-width: 450px) {
  .donut-layout { grid-template-columns: minmax(0, 1fr); }
  .spark-chart:has(.spark-column) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.spark-column {
  align-items: center;
  display: grid;
  grid-template-rows: 32px 132px 22px;
  justify-items: center;
  min-width: 0;
}

.spark-value {
  color: rgba(255, 255, 255, 0.64);
  font-size: 11px;
  font-weight: 720;
  white-space: nowrap;
}

.spark-bar {
  align-self: end;
  background: linear-gradient(180deg, var(--green), #96f596);
  border-radius: 8px 8px 3px 3px;
  min-height: 8px;
  width: min(34px, 70%);
}

.spark-column.negative .spark-bar {
  background: linear-gradient(180deg, var(--coral), #f0b2a6);
}

.spark-column span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 760;
}

.category-bars {
  display: grid;
  gap: 13px;
}

.category-row {
  display: grid;
  gap: 8px;
}

.category-top {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.category-top span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
}

.category-top strong {
  color: var(--muted);
  font-size: 13px;
}

.category-track {
  background: #dfece5;
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}

.category-track div {
  background: linear-gradient(90deg, var(--blue), var(--green));
  border-radius: inherit;
  height: 100%;
}

.section-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.bars {
  display: grid;
  gap: 15px;
}

.bar-row {
  background: #f7fcf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.bar-label {
  align-items: center;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.bar-label strong {
  color: var(--ink);
}

.bar-track {
  background: #e4eaed;
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}

.bar-fill {
  border-radius: inherit;
  height: 100%;
  min-width: 2px;
  transition: width 180ms ease;
}

.source-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.source-list li {
  background: #f7fcf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 9px;
  padding: 11px 12px;
}

.source-list li:last-child {
  margin-bottom: 0;
}

.source-list strong {
  color: var(--ink);
  display: block;
  font-size: 14px;
  margin-bottom: 3px;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf7f1;
  overflow-x: auto;
}

.bill-include-control {
  align-items: center;
  display: inline-flex;
}

.bill-include-control span {
  display: none;
}

.debt-include-control,
.income-include-control {
  align-items: center;
  display: inline-flex;
}

.debt-include-control span,
.income-include-control span {
  display: none;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 900px;
  width: 100%;
}

#debts table {
  min-width: 1040px;
}

thead {
  background: #e4f0e9;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  text-align: left;
  text-transform: uppercase;
}

td,
th {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
}

tbody tr {
  background: #f7fcf8;
}

tbody tr:hover {
  background: #edf7f1;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td input,
td select {
  background: #edf7f1;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  min-height: 38px;
  padding: 7px 10px;
  width: 100%;
}

.vendor-field {
  align-items: center;
  display: flex;
  gap: 9px;
  min-width: 230px;
}

.vendor-field span {
  align-items: center;
  background: linear-gradient(135deg, rgba(99, 91, 255, 0.14), rgba(0, 200, 5, 0.16));
  border: 1px solid rgba(16, 24, 32, 0.07);
  border-radius: 8px;
  color: #174b64;
  display: grid;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 840;
  height: 34px;
  justify-items: center;
  width: 34px;
}

.vendor-field input {
  min-width: 170px;
}

.rate-field {
  align-items: center;
  background: #edf7f1;
  border-radius: 8px;
  display: flex;
  max-width: 116px;
  overflow: hidden;
}

.rate-field input {
  background: transparent;
  min-width: 0;
  width: 78px;
}

.rate-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  padding-right: 10px;
}

td input:focus,
td select:focus {
  background: #f9fffa;
  border-color: rgba(24, 123, 145, 0.45);
  outline: none;
  box-shadow: 0 0 0 3px rgba(24, 123, 145, 0.1);
}

td .check {
  accent-color: var(--green);
  height: 20px;
  width: 20px;
}


.amount {
  max-width: 132px;
}

.small {
  max-width: 112px;
}

.activity-list {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.activity {
  background: linear-gradient(180deg, #f7fcf8, #edf7f1);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 136px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.activity::before {
  content: "";
  background: linear-gradient(180deg, var(--blue), var(--green));
  border-radius: 999px;
  height: 5px;
  left: 16px;
  position: absolute;
  top: 14px;
  width: 42px;
}

.activity strong {
  color: var(--ink);
  display: block;
  font-size: 24px;
  margin-bottom: 9px;
  margin-top: 12px;
}

.activity span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  line-height: 1.35;
}

.activity span:first-of-type {
  color: var(--ink);
  font-weight: 750;
  margin-bottom: 5px;
}

.activity-empty {
  background: #edf7f1;
  border: 1px dashed rgba(16, 24, 32, 0.18);
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  gap: 6px;
  grid-column: 1 / -1;
  min-height: 132px;
  padding: 22px;
  place-content: center;
  text-align: center;
}

.activity-empty strong {
  color: var(--ink);
  font-size: 17px;
}

.activity-empty span {
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 980px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: 0;
    position: static;
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin: 16px 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .command-bar {
    flex: 0 1 auto;
    max-width: none;
    min-height: 42px;
    width: 100%;
  }

  .top-meta {
    flex-wrap: wrap;
  }

  .hero-panel,
  .welcome-panel,
  .dashboard-grid,
  .ops-grid,
  .visual-grid {
    grid-template-columns: 1fr;
  }

  .paycheck-controls,
  .paycheck-periods {
    grid-template-columns: 1fr;
  }

  .paycheck-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .donut-layout {
    grid-template-columns: 1fr 1fr;
  }

  .metric-grid,
  .focus-grid,
  .activity-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1320px);
    padding-top: 12px;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .paycheck-summary-grid {
    grid-template-columns: 1fr;
  }

  .paycheck-card-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .paycheck-card-head small {
    text-align: left;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid,
  .focus-grid,
  .activity-list {
    grid-template-columns: 1fr;
  }

  .panel,
  .income-card {
    padding: 16px;
  }

  .top-meta span {
    flex: 1 0 auto;
  }

  .command-bar {
    flex: 0 1 auto;
    max-width: none;
    min-height: 42px;
    width: 100%;
  }

  .health-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .upcoming-item {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .upcoming-item b {
    grid-column: 2;
  }

  .donut-layout {
    grid-template-columns: 1fr;
  }

  .spark-chart {
    gap: 6px;
  }

  .spark-value {
    font-size: 10px;
  }
}

@media (max-width: 720px) {
  body {
    background: #eef5f1;
    overscroll-behavior-y: none;
  }

  .ambient {
    display: none;
  }

  .shell {
    margin: 0;
    padding: 0 0 calc(86px + env(safe-area-inset-bottom));
    width: 100%;
  }

  .app-layout {
    display: block;
  }

  .page {
    scroll-margin-top: calc(72px + env(safe-area-inset-top));
  }

  .sidebar {
    align-items: center;
    background: #0b1117;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    box-shadow: 0 8px 24px rgba(11, 17, 23, 0.16);
    display: flex;
    justify-content: space-between;
    min-height: 62px;
    padding: calc(9px + env(safe-area-inset-top)) 14px 9px;
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: none;
  }

  .brand-lockup {
    gap: 9px;
    min-width: 0;
  }

  .brand-mark {
    height: 36px;
    width: 36px;
  }

  .brand-lockup .eyebrow {
    display: none;
  }

  .brand-tagline {
    display: none;
  }

  .brand-lockup h1 {
    font-size: 18px;
  }

  .account-control {
    border: 0;
    display: flex;
    gap: 8px;
    margin: 0 0 0 auto;
    min-height: 38px;
    padding: 0;
  }

  .account-copy {
    display: none;
  }

  .legal-links {
    display: none;
  }

  .delete-account-button {
    display: none;
  }

  .sign-in-button {
    font-size: 12px;
    min-height: 38px;
    padding: 8px 11px;
  }

  .nav-list {
    align-items: stretch;
    background: rgba(11, 17, 23, 0.98);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    bottom: 0;
    box-shadow: 0 -10px 28px rgba(11, 17, 23, 0.18);
    display: grid;
    gap: 0;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    left: 0;
    margin: 0;
    padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
    position: fixed;
    right: 0;
    z-index: 40;
  }

  .nav-list a {
    align-items: center;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    font-size: 10px;
    gap: 4px;
    justify-content: center;
    min-height: 52px;
    padding: 5px 2px;
  }

  .nav-list a:hover,
  .nav-list a.active {
    background: transparent;
    box-shadow: none;
    color: #e5ff58;
    transform: none;
  }

  .nav-icon {
    display: block;
    filter: invert(87%) sepia(4%) saturate(215%) hue-rotate(112deg) brightness(83%);
    height: 21px;
    opacity: 0.78;
    width: 21px;
  }

  .nav-list a.active .nav-icon {
    filter: invert(94%) sepia(83%) saturate(723%) hue-rotate(22deg) brightness(108%);
    opacity: 1;
  }

  .workspace {
    padding: 12px 12px 0;
  }

  .topbar {
    border-radius: 8px;
    gap: 10px;
    margin-bottom: 12px;
    padding: 10px;
  }

  .topbar .command-bar,
  .topbar .top-meta {
    display: none;
  }

  .topbar .actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .topbar .actions button {
    font-size: 12px;
    min-height: 42px;
    padding: 8px;
  }

  .welcome-panel,
  .hero-panel,
  .panel {
    box-shadow: 0 8px 22px rgba(16, 24, 32, 0.07);
  }

  .welcome-panel {
    padding: 16px;
  }

  .welcome-copy h2 {
    font-size: 22px;
  }

  .focus-grid {
    display: flex;
    gap: 10px;
    margin: 0 -4px;
    overflow-x: auto;
    padding: 4px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .focus-grid::-webkit-scrollbar,
  .paycheck-summary-grid::-webkit-scrollbar {
    display: none;
  }

  .focus-card {
    flex: 0 0 172px;
    min-height: 122px;
    scroll-snap-align: start;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .paycheck-setup-panel .section-head {
    gap: 12px;
  }

  .paycheck-controls {
    grid-template-columns: 1fr;
  }

  .paycheck-summary-grid {
    display: flex;
    gap: 10px;
    margin: 0 -12px 14px;
    overflow-x: auto;
    padding: 0 12px 4px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .paycheck-summary-card {
    flex: 0 0 178px;
    min-height: 108px;
    padding: 14px;
    scroll-snap-align: start;
  }

  .paycheck-summary-card strong {
    font-size: 24px;
  }

  .shortfall-assistant-panel {
    padding: 16px;
  }

  .shortfall-assistant-head {
    align-items: flex-start;
  }

  .shortfall-assistant-panel h2 {
    font-size: 21px;
  }

  .shortfall-status {
    max-width: 132px;
    text-align: center;
    white-space: normal;
  }

  .shortfall-stat-grid {
    grid-template-columns: 1fr;
  }

  .shortfall-stat-grid > div {
    padding: 11px 2px;
  }

  .shortfall-stat-grid > div + div {
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .shortfall-stat-grid strong {
    font-size: 22px;
  }

  .shortfall-list-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .shortfall-recommendation {
    gap: 8px;
    grid-template-columns: 1fr;
  }

  .shortfall-recommendation b {
    text-align: left;
  }

  .paycheck-periods {
    grid-template-columns: 1fr;
  }

  .paycheck-card {
    padding: 14px;
  }

  .paycheck-card-head {
    align-items: flex-start;
    flex-direction: row;
  }

  .paycheck-card-head small {
    max-width: 128px;
    text-align: right;
  }

  .paycheck-card-summary {
    gap: 6px;
  }

  .paycheck-card-summary span {
    font-size: 9px;
  }

  .paycheck-card-summary strong {
    font-size: 15px;
  }

  .paycheck-item {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    padding: 10px 8px;
  }

  .table-wrap {
    margin-left: -16px;
    margin-right: -16px;
    padding: 0 16px 4px;
    -webkit-overflow-scrolling: touch;
  }

  .bills-panel {
    padding: 16px;
  }

  .bills-panel .section-head {
    align-items: center;
    margin-bottom: 14px;
  }

  .bills-panel .section-head h2 {
    font-size: 22px;
  }

  .bills-panel .section-head p {
    margin-top: 4px;
  }

  .bills-panel .section-head button {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 14px;
  }

  .bills-panel .table-wrap {
    background: transparent;
    border: 0;
    margin: 0;
    overflow: visible;
    padding: 0;
  }

  .bills-table {
    display: block;
    min-width: 0;
  }

  .bills-table thead {
    display: none;
  }

  .bills-table tbody {
    display: grid;
    gap: 10px;
  }

  .bills-table tr {
    background: #f8fcf9;
    border: 1px solid rgba(16, 24, 32, 0.1);
    border-radius: 8px;
    box-shadow: 0 5px 14px rgba(16, 24, 32, 0.05);
    display: grid;
    gap: 10px 12px;
    grid-template-areas:
      "include actions"
      "name name"
      "category category"
      "due amount";
    grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
    padding: 12px;
  }

  .bills-table tr:hover {
    background: #f8fcf9;
  }

  .bills-table td {
    border: 0;
    min-width: 0;
    padding: 0;
  }

  .bills-table .bill-include {
    align-self: center;
    grid-area: include;
  }

  .bills-table .bill-include-control {
    color: var(--muted);
    font-size: 12px;
    font-weight: 760;
    gap: 8px;
    min-height: 42px;
  }

  .bills-table .bill-include-control span {
    display: inline;
  }

  .bills-table .bill-include-control .check {
    height: 24px;
    margin: 0;
    width: 24px;
  }

  .bills-table .bill-name {
    grid-area: name;
  }

  .bills-table .bill-category {
    grid-area: category;
  }

  .bills-table .bill-due {
    grid-area: due;
  }

  .bills-table .bill-amount {
    grid-area: amount;
  }

  .bills-table .bill-actions {
    align-self: center;
    grid-area: actions;
    justify-self: end;
  }

  .bills-table .bill-actions .icon {
    background: #f0f5f2;
    font-size: 22px;
    height: 42px;
    line-height: 1;
    min-height: 42px;
    width: 42px;
  }

  .bills-table .vendor-field {
    min-width: 0;
  }

  .bills-table .vendor-field span {
    height: 40px;
    width: 40px;
  }

  .bills-table .vendor-field input {
    font-size: 16px;
    font-weight: 780;
    min-width: 0;
  }

  .bills-table .bill-category::before,
  .bills-table .bill-due::before,
  .bills-table .bill-amount::before {
    color: var(--muted);
    content: attr(data-label);
    display: block;
    font-size: 10px;
    font-weight: 820;
    margin: 0 0 5px 2px;
    text-transform: uppercase;
  }

  .bills-table td input:not(.check) {
    background: #edf6f0;
    border-color: rgba(16, 24, 32, 0.06);
    min-height: 44px;
  }

  .bills-table .small,
  .bills-table .amount {
    max-width: none;
  }

  .debts-panel,
  .other-income-panel,
  .activity-panel {
    padding: 16px;
  }

  .debts-panel .section-head,
  .other-income-panel .section-head {
    align-items: start;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-bottom: 14px;
  }

  .debts-panel .section-head > div,
  .other-income-panel .section-head > div {
    min-width: 0;
  }

  .debts-panel .section-head button,
  .other-income-panel .section-head button {
    min-height: 44px;
    padding: 0 12px;
  }

  .debts-panel .table-wrap,
  .other-income-panel .table-wrap {
    background: transparent;
    border: 0;
    margin: 0;
    overflow: visible;
    padding: 0;
  }

  .debts-table,
  .other-income-table {
    display: block;
    min-width: 0;
  }

  #debts .debts-table {
    min-width: 0;
  }

  .debts-table thead,
  .other-income-table thead {
    display: none;
  }

  .debts-table tbody,
  .other-income-table tbody {
    display: grid;
    gap: 10px;
  }

  .debts-table tr,
  .other-income-table tr {
    background: #f8fcf9;
    border: 1px solid rgba(16, 24, 32, 0.1);
    border-radius: 8px;
    box-shadow: 0 5px 14px rgba(16, 24, 32, 0.05);
    display: grid;
    gap: 10px 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px;
  }

  .debts-table tr {
    grid-template-areas:
      "include actions"
      "name name"
      "type type"
      "due payment"
      "rate balance";
  }

  .other-income-table tr {
    grid-template-areas:
      "include actions"
      "name name"
      "day net"
      "gross gross";
  }

  .debts-table tr:hover,
  .other-income-table tr:hover {
    background: #f8fcf9;
  }

  .debts-table td,
  .other-income-table td {
    border: 0;
    min-width: 0;
    padding: 0;
  }

  .debt-include,
  .income-include {
    align-self: center;
    grid-area: include;
  }

  .debt-name,
  .income-name {
    grid-area: name;
  }

  .debt-type { grid-area: type; }
  .debt-due { grid-area: due; }
  .debt-payment { grid-area: payment; }
  .debt-rate { grid-area: rate; }
  .debt-balance { grid-area: balance; }
  .income-day { grid-area: day; }
  .income-net { grid-area: net; }
  .income-gross { grid-area: gross; }

  .debt-actions,
  .income-actions {
    align-self: center;
    grid-area: actions;
    justify-self: end;
  }

  .debt-include-control,
  .income-include-control {
    color: var(--muted);
    font-size: 12px;
    font-weight: 760;
    gap: 8px;
    min-height: 42px;
  }

  .debt-include-control span,
  .income-include-control span {
    display: inline;
  }

  .debt-include-control .check,
  .income-include-control .check {
    height: 24px;
    margin: 0;
    width: 24px;
  }

  .debt-actions .icon,
  .income-actions .icon {
    background: #f0f5f2;
    font-size: 22px;
    height: 42px;
    line-height: 1;
    min-height: 42px;
    width: 42px;
  }

  .debts-table .vendor-field,
  .other-income-table .vendor-field {
    min-width: 0;
  }

  .debts-table .vendor-field span,
  .other-income-table .vendor-field span {
    height: 40px;
    width: 40px;
  }

  .debts-table .vendor-field input,
  .other-income-table .vendor-field input {
    font-size: 16px;
    font-weight: 780;
    min-width: 0;
  }

  .debts-table td[data-label]::before,
  .other-income-table td[data-label]::before {
    color: var(--muted);
    content: attr(data-label);
    display: block;
    font-size: 10px;
    font-weight: 820;
    margin: 0 0 5px 2px;
    text-transform: uppercase;
  }

  .debts-table td input:not(.check),
  .other-income-table td input:not(.check) {
    background: #edf6f0;
    border-color: rgba(16, 24, 32, 0.06);
    min-height: 44px;
  }

  .debts-table .small,
  .debts-table .amount,
  .other-income-table .small,
  .other-income-table .amount,
  .debts-table .rate-field {
    max-width: none;
  }

  .debts-table .rate-field input {
    width: 100%;
  }

  .activity-list {
    grid-template-columns: 1fr;
  }

  .activity-empty {
    min-height: 180px;
    padding: 24px 18px;
  }
}

.demo-panel { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 0 0 24px; padding: 24px; border: 1px solid #385b50; border-radius: 16px; background: #122a25; color: #edf6f1; }
.demo-panel[hidden] { display: none; }
.demo-panel h2 { margin: 8px 0; font-size: 22px; }
.demo-panel p { max-width: 660px; margin: 0; line-height: 1.6; color: #b9cec5; }
.demo-actions { display: flex; flex-wrap: wrap; gap: 12px; flex-shrink: 0; }
.demo-actions a { display: inline-block; padding: 12px 16px; border-radius: 8px; font-weight: 600; text-decoration: none; }
.demo-primary { background: #b8efcc; color: #122a25; }
.demo-secondary { border: 1px solid #638677; color: #edf6f1; }
@media (max-width: 1000px) { .demo-panel { align-items: flex-start; flex-direction: column; } }

/* Final cascade guards for the paycheck-first layout. */
.paycheck-settings-panel .paycheck-controls {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
}
.paycheck-controls > label { min-width: 0; }
@media (min-width: 981px) and (max-width: 1200px) {
  .overview-paycheck-panel { grid-template-columns: minmax(0, 1fr); }
  .overview-paycheck-panel > a { justify-self: start; }
}
.paycheck-periods {
  display: block;
}

@media (max-width: 720px) {
  .topbar {
    display: none;
  }

  .focus-card {
    flex-basis: 190px;
    min-height: 132px;
  }

  .focus-card small {
    overflow-wrap: anywhere;
  }
}
