:root {
  --bg: #f4f8fb;
  --surface: #ffffff;
  --surface-2: #f7fbfd;
  --ink: #1f2933;
  --muted: #667085;
  --line: #dbe4ee;
  --accent: #0f766e;
  --accent-2: #2563eb;
  --gold: #c28a20;
  --good: #16803c;
  --warn: #b7791f;
  --bad: #b42318;
  --soft-good: #dff4e7;
  --soft-warn: #fff0c2;
  --soft-bad: #ffe4df;
  --shadow: 0 14px 34px rgba(31, 41, 51, 0.08);
}

body.v2-mode {
  min-width: 0;
  overflow-x: hidden;
  background: #f6f7f3;
  color: #15171a;
}

body.v2-mode .app-shell {
  display: none;
}

body.v2-mode .pwa-status {
  display: none;
}

.v2-app {
  min-height: 100vh;
  overflow-x: hidden;
  padding: 24px 24px calc(104px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at top left, rgba(17, 131, 124, 0.12), transparent 34%),
    linear-gradient(180deg, #fbfaf6 0%, #f2f3ee 100%);
}

.v2-header {
  width: min(1180px, 100%);
  min-width: 0;
  margin: 0 auto 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.v2-kicker,
.v2-card-label,
.v2-stat span,
.v2-list-item span,
.v2-account-card span,
.v2-empty span,
.v2-field span,
.v2-mini-field span,
.v2-legal p {
  color: #737b86;
}

.v2-kicker {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
}

.v2-header h1 {
  font-size: 34px;
  line-height: 1.15;
}

.v2-header p {
  margin-top: 8px;
  color: #626b78;
}

.v2-header-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.v2-month {
  display: grid;
  gap: 5px;
  color: #667085;
  font-size: 12px;
}

.v2-month input,
.v2-field input,
.v2-field select,
.v2-mini-field input {
  border: 1px solid #dde3ea;
  border-radius: 8px;
  background: #ffffff;
  color: #1d2939;
}

.v2-month input {
  width: 164px;
  height: 42px;
  padding: 0 12px;
}

.v2-main {
  width: min(1180px, 100%);
  min-width: 0;
  margin: 0 auto;
}

.v2-page {
  display: none;
  animation: v2Fade 0.18s ease;
}

.v2-page.active {
  display: grid;
  opacity: 1;
  gap: 16px;
  animation: none;
}

@keyframes v2Fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.v2-hero-card,
.v2-progress-card,
.v2-panel,
.v2-stat,
.v2-account-card,
.v2-list-item {
  min-width: 0;
  border: 1px solid rgba(27, 35, 43, 0.08);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(22, 27, 29, 0.08);
}

.v2-hero-card {
  min-height: 210px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 28px;
  color: #f9fafb;
  background: linear-gradient(135deg, #0b1216 0%, #0f4f49 100%);
}

.v2-hero-card strong {
  display: block;
  margin-top: 10px;
  font-size: 44px;
  letter-spacing: 0;
}

.v2-hero-card small,
.v2-progress-ring span {
  color: rgba(255, 255, 255, 0.74);
}

.v2-progress-ring {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  border: 10px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.1);
}

.v2-progress-ring strong {
  margin: 0;
  font-size: 24px;
}

.v2-progress-ring span {
  font-size: 12px;
}

.v2-progress-card,
.v2-panel {
  padding: 20px;
}

.v2-row,
.v2-panel-head,
.v2-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.v2-row strong,
.v2-panel h2,
.v2-section-title h2 {
  color: #111827;
  font-size: 20px;
}

.v2-row span,
.v2-panel-head p,
.v2-section-title p {
  color: #6b7280;
  font-size: 13px;
}

.v2-progress-track {
  height: 12px;
  margin: 16px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e8e3d6;
}

.v2-progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #deb956);
}

.v2-stage-grid,
.v2-stat-grid,
.v2-action-list,
.v2-form-grid {
  display: grid;
  gap: 12px;
}

.v2-stage-grid {
  grid-template-columns: repeat(4, 1fr);
}

.v2-stage {
  padding: 12px;
  border-radius: 8px;
  background: #f2f4f1;
}

.v2-stage strong,
.v2-stage span {
  display: block;
}

.v2-stage span {
  margin-top: 4px;
  color: #667085;
  font-size: 12px;
}

.v2-stage.done {
  background: #e1f3ea;
}

.v2-stage.current {
  color: #0f3f3b;
  background: #d9eee9;
}

.v2-stat-grid {
  grid-template-columns: repeat(4, 1fr);
}

.v2-stat-grid.compact {
  grid-template-columns: repeat(4, 1fr);
}

.v2-stat {
  min-height: 118px;
  padding: 18px;
}

.v2-stat strong {
  display: block;
  margin-top: 12px;
  color: #111827;
  font-size: 28px;
  letter-spacing: 0;
}

.v2-stat small {
  display: block;
  margin-top: 6px;
  color: #667085;
}

.v2-section-title {
  min-height: 76px;
  padding: 8px 0 2px;
}

.v2-pill-button,
.v2-link-button,
.v2-settings-list button,
.v2-card-actions button,
.v2-sheet-head button {
  min-height: 42px;
  border: 1px solid #d9e1e8;
  border-radius: 8px;
  padding: 0 16px;
  color: #15322f;
  background: #ffffff;
  cursor: pointer;
}

.v2-pill-button {
  border-color: transparent;
  color: #ffffff;
  background: #0f766e;
}

.v2-pill-button.dark {
  background: #111827;
}

.v2-link-button {
  color: #0f766e;
  border-color: #bfded8;
  background: #f6fffc;
}

.v2-action-card {
  display: grid;
  gap: 6px;
  width: 100%;
  min-height: 92px;
  border: 1px solid #dde7eb;
  border-radius: 8px;
  padding: 14px;
  text-align: left;
  background: #ffffff;
  cursor: pointer;
}

.v2-action-card span {
  width: fit-content;
  border-radius: 999px;
  padding: 3px 9px;
  color: #0f766e;
  background: #e1f3ea;
  font-size: 12px;
  font-weight: 700;
}

.v2-action-card small {
  color: #667085;
}

.v2-start-grid,
.v2-account-guide {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.v2-start-card,
.v2-account-guide-card {
  width: 100%;
  min-width: 0;
  border: 1px solid #dde7eb;
  border-radius: 8px;
  padding: 14px;
  text-align: left;
  background: #ffffff;
  cursor: pointer;
}

.v2-start-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.v2-start-card > span {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #0f3f3b;
  background: #d9eee9;
  font-weight: 900;
}

.v2-start-card strong,
.v2-account-guide-card strong {
  display: block;
  color: #111827;
}

.v2-start-card small,
.v2-account-guide-card span {
  display: block;
  margin-top: 5px;
  color: #667085;
  line-height: 1.55;
}

.v2-start-card b {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 10px;
  color: #0f3f3b;
  background: #e6f2ef;
  font-size: 12px;
}

.v2-start-card.good,
.v2-account-guide-card.daily,
.v2-account-guide-card.saving {
  border-color: #bfe8d0;
  background: #f3fbf7;
}

.v2-start-card.warn,
.v2-account-guide-card.investment {
  border-color: #f5d08a;
  background: #fff9ec;
}

.v2-start-card.stable,
.v2-account-guide-card.debt {
  border-color: #c8d9ef;
  background: #f5f8fd;
}

.v2-account-guide {
  grid-template-columns: repeat(4, 1fr);
}

.v2-insight-grid,
.v2-budget-grid,
.v2-product-map {
  display: grid;
  gap: 12px;
}

.v2-insight-grid {
  grid-template-columns: repeat(3, 1fr);
}

.v2-insight-card,
.v2-budget-summary,
.v2-product-card,
.v2-invest-note {
  min-width: 0;
  border: 1px solid #dde7eb;
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.v2-insight-card {
  display: grid;
  gap: 7px;
}

.v2-insight-card span,
.v2-budget-summary span {
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.v2-insight-card strong,
.v2-budget-summary strong {
  color: #111827;
  font-size: 24px;
}

.v2-insight-card b {
  color: #111827;
}

.v2-insight-card small,
.v2-budget-summary small,
.v2-product-card span,
.v2-invest-note span {
  color: #667085;
}

.v2-insight-card.good,
.v2-budget-summary.good,
.v2-product-card.good,
.v2-invest-note.good {
  border-color: #bfe8d0;
  background: #f0fbf5;
}

.v2-insight-card.stable,
.v2-product-card.stable {
  border-color: #c8d9ef;
  background: #f3f7fd;
}

.v2-insight-card.warn,
.v2-budget-summary.warn,
.v2-product-card.warn,
.v2-invest-note.warn {
  border-color: #f5d08a;
  background: #fff8e8;
}

.v2-insight-card.bad,
.v2-budget-summary.bad {
  border-color: #f4b4a8;
  background: #fff1ee;
}

.v2-natural-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: stretch;
}

.v2-natural-box textarea {
  min-height: 88px;
  resize: vertical;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  padding: 12px;
  color: #1d2939;
  background: #ffffff;
  font: inherit;
}

.v2-budget-grid {
  grid-template-columns: minmax(220px, 0.45fr) minmax(0, 1fr);
  align-items: stretch;
}

.v2-budget-rows {
  display: grid;
  gap: 10px;
}

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

.v2-budget-row div,
.v2-product-card,
.v2-invest-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.v2-product-card div {
  display: grid;
  gap: 4px;
}

.v2-product-card b {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 10px;
  color: #0f3f3b;
  background: #e6f2ef;
  font-size: 12px;
}

.v2-budget-row span {
  color: #667085;
}

.v2-budget-row i {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f6;
}

.v2-budget-row b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #0f766e;
}

.v2-budget-row.near b {
  background: #d99a20;
}

.v2-budget-row.over b {
  background: #b42318;
}

#v2InvestmentPanel {
  display: grid;
  gap: 12px;
}

.v2-bar-list,
.v2-list,
.v2-account-list,
.v2-settings-list {
  display: grid;
  gap: 10px;
}

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

.v2-bar-row div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.v2-bar-row span {
  color: #667085;
}

.v2-bar-row i {
  height: 8px;
  border-radius: 999px;
  background: #edf1f3;
  overflow: hidden;
}

.v2-bar-row b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #0f766e;
}

.v2-list-item,
.v2-account-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  box-shadow: none;
}

.v2-list-icon,
.v2-account-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #0f3f3b;
  background: #e6f2ef;
  font-weight: 800;
}

.v2-list-icon.out,
.v2-account-card.debt .v2-account-icon {
  color: #7a2f1a;
  background: #ffe7dc;
}

.v2-list-item strong,
.v2-list-item span,
.v2-account-card strong,
.v2-account-card span {
  display: block;
}

.v2-list-item b,
.v2-account-card b {
  font-size: 18px;
}

.v2-list-item b.out {
  color: #b42318;
}

.v2-list-item b.in {
  color: #087443;
}

.v2-card-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.v2-card-actions button {
  min-height: 34px;
  padding: 0 12px;
  color: #475467;
}

.v2-empty {
  min-height: 140px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed #d9e1e8;
  border-radius: 8px;
  background: #ffffff;
  text-align: center;
}

.v2-form-grid {
  grid-template-columns: repeat(2, 1fr);
}

.v2-field,
.v2-mini-field {
  display: grid;
  gap: 6px;
}

.v2-field input,
.v2-field select,
.v2-mini-field input {
  height: 44px;
  padding: 0 12px;
}

.v2-settings-list button {
  width: 100%;
  text-align: left;
  background: #ffffff;
}

.v2-legal a {
  display: inline-block;
  margin-top: 10px;
  color: #0f766e;
  text-decoration: none;
}

.v2-tabbar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 40;
  width: min(620px, calc(100vw - 28px));
  min-height: 70px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  transform: translateX(-50%);
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 18px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(12px);
}

@media (min-width: 900px) {
  .v2-app {
    padding-bottom: calc(132px + env(safe-area-inset-bottom));
  }

  .v2-tabbar {
    width: min(520px, calc(100vw - 28px));
    min-height: 60px;
    border-radius: 16px;
  }

  .v2-fab {
    width: 56px;
    height: 56px;
    bottom: calc(92px + env(safe-area-inset-bottom));
    font-size: 32px;
  }
}

.v2-tabbar button {
  border: 0;
  border-radius: 12px;
  color: #717680;
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}

.v2-tabbar button.active {
  color: #ffffff;
  background: #111827;
}

.v2-fab {
  position: fixed;
  right: max(26px, calc((100vw - 1180px) / 2 + 24px));
  bottom: calc(102px + env(safe-area-inset-bottom));
  z-index: 41;
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: #111827;
  font-size: 36px;
  line-height: 1;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.25);
  cursor: pointer;
}

.v2-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 14, 18, 0.46);
}

.v2-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 51;
  width: min(720px, 100vw);
  max-height: min(92vh, 860px);
  overflow-y: auto;
  transform: translateX(-50%);
  border-radius: 24px 24px 0 0;
  padding: 10px 22px calc(22px + env(safe-area-inset-bottom));
  background: #ffffff;
  box-shadow: 0 -20px 50px rgba(15, 23, 42, 0.25);
}

.v2-sheet-handle {
  width: 46px;
  height: 5px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: #d7dde4;
}

.v2-sheet-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.v2-sheet-head button:first-child {
  justify-self: start;
}

.v2-sheet-head button:last-child {
  justify-self: end;
}

.v2-segment {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 18px;
  padding: 4px;
  border-radius: 12px;
  background: #eff2f5;
}

.v2-segment button,
.v2-category-grid button,
.v2-chip-row button,
.v2-keypad button,
.v2-account-type-grid button {
  border: 0;
  cursor: pointer;
}

.v2-segment button {
  min-height: 42px;
  border-radius: 10px;
  color: #667085;
  background: transparent;
}

.v2-segment button.active {
  color: #111827;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.v2-category-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.v2-category-grid button {
  min-height: 82px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border-radius: 14px;
  color: #667085;
  background: #f3f6f8;
}

.v2-category-grid button i {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #4b5563;
  background: #e7edf2;
  font-style: normal;
  font-weight: 800;
}

.v2-category-grid button.active i {
  color: #ffffff;
  background: #b98b42;
}

.v2-chip-row {
  display: flex;
  gap: 8px;
  margin: 16px 0;
  overflow-x: auto;
}

.v2-chip-row button {
  flex: 0 0 auto;
  min-height: 38px;
  border-radius: 999px;
  padding: 0 14px;
  color: #4b5563;
  background: #f0f3f6;
}

.v2-chip-row button.active {
  color: #ffffff;
  background: #0f766e;
}

.v2-filter-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.v2-filter-row input {
  min-height: 44px;
  border: 1px solid #dde3ea;
  border-radius: 12px;
  padding: 0 14px;
  font: inherit;
  color: #1d2939;
  background: #ffffff;
}

.v2-filter-row div,
.v2-inline-actions,
.v2-template-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.v2-filter-row button,
.v2-template-strip button {
  border: 1px solid #dde3ea;
  border-radius: 999px;
  background: #ffffff;
  color: #667085;
  padding: 9px 13px;
  font-weight: 700;
}

.v2-filter-row button.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.v2-template-strip {
  margin: 4px 0 14px;
}

.v2-template-strip span {
  color: #667085;
  font-size: 13px;
  font-weight: 800;
}

.v2-entry-box {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(0, 1fr);
  gap: 12px;
  margin: 14px 0;
  padding: 16px;
  border-radius: 16px;
  background: #f6f8fa;
}

.v2-entry-box > strong {
  align-self: center;
  color: #e5484d;
  font-size: 38px;
}

.v2-entry-box > div {
  display: grid;
  gap: 10px;
}

.v2-keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.v2-keypad button {
  min-height: 58px;
  border-radius: 12px;
  color: #475467;
  background: #f2f5f8;
  font-size: 22px;
  font-weight: 700;
}

.v2-keypad .save {
  color: #ffffff;
  background: #0f766e;
}

.v2-account-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.v2-account-type-grid button {
  min-height: 120px;
  display: grid;
  gap: 8px;
  align-content: center;
  border: 1px solid #d8dee6;
  border-radius: 12px;
  padding: 16px;
  text-align: left;
  background: #ffffff;
}

.v2-account-type-grid button.active {
  border-color: #0f766e;
  background: #effaf7;
}

.v2-account-type-grid i {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: #111827;
  font-style: normal;
}

.v2-account-type-grid span {
  color: #667085;
}

.v2-sheet:not(.is-debt) .debt-only {
  display: none;
}

@media (max-width: 760px) {
  .v2-app {
    padding: 18px 14px calc(94px + env(safe-area-inset-bottom));
  }

  .v2-header,
  .v2-main {
    width: min(100%, 362px);
    margin-left: 0;
    margin-right: 0;
  }

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

  .v2-header h1 {
    font-size: 27px;
  }

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

  .v2-header-actions > .v2-pill-button {
    display: none;
  }

  .v2-month {
    flex: 1;
  }

  .v2-month input {
    width: 100%;
  }

  .v2-hero-card {
    min-height: 188px;
    display: block;
    padding: 22px;
  }

  .v2-hero-card strong {
    font-size: 34px;
  }

  .v2-progress-ring {
    display: none;
  }

  .v2-stat-grid,
  .v2-stat-grid.compact,
  .v2-form-grid,
  .v2-insight-grid,
  .v2-budget-grid,
  .v2-start-grid,
  .v2-account-guide {
    grid-template-columns: repeat(2, 1fr);
  }

  .v2-natural-box {
    grid-template-columns: 1fr;
  }

  .v2-stage-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .v2-stat {
    min-height: 104px;
    padding: 14px;
  }

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

  .v2-filter-row {
    grid-template-columns: 1fr;
  }

  .v2-filter-row div {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .v2-filter-row button,
  .v2-template-strip button {
    flex: 0 0 auto;
  }

  .v2-section-title,
  .v2-panel-head,
  .v2-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .v2-list-item,
  .v2-account-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .v2-product-card,
  .v2-invest-note,
  .v2-start-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .v2-list-item b,
  .v2-account-card b {
    grid-column: 2;
    justify-self: start;
  }

  .v2-start-card {
    grid-template-columns: 1fr;
  }

  .v2-start-card b {
    justify-self: start;
  }

  .v2-fab {
    left: min(300px, calc(100vw - 82px));
    right: auto;
    bottom: calc(94px + env(safe-area-inset-bottom));
  }

  .v2-tabbar {
    bottom: 10px;
    width: calc(100vw - 20px);
    min-height: 68px;
    border-radius: 16px;
  }

  .v2-sheet {
    border-radius: 22px 22px 0 0;
    padding-inline: 14px;
  }

  .v2-segment {
    grid-template-columns: repeat(3, 1fr);
  }

  .v2-category-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
  }

  .v2-category-grid button {
    min-height: 74px;
    font-size: 12px;
  }

  .v2-category-grid button i {
    width: 38px;
    height: 38px;
  }

  .v2-entry-box {
    grid-template-columns: 1fr;
  }

  .v2-account-type-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .v2-stat-grid,
  .v2-stat-grid.compact,
  .v2-insight-grid,
  .v2-budget-grid,
  .v2-start-grid,
  .v2-account-guide {
    grid-template-columns: 1fr;
  }

  .v2-stage-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .v2-category-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 1120px;
  background: var(--bg);
  color: var(--ink);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Segoe UI",
    Arial,
    sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  display: grid;
  grid-template-columns: 270px minmax(868px, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #172026;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e8b44b;
  color: #1f2933;
  font-size: 22px;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand span {
  margin-top: 3px;
  color: #cbd5e1;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav::-webkit-scrollbar {
  display: none;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  text-align: left;
  color: #dbe6ea;
  background: transparent;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: #edf6f4;
  color: #0f3f3b;
}

.sidebar-status {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-status span,
.sidebar-status strong {
  display: block;
}

.sidebar-status span {
  color: #cbd5e1;
  font-size: 12px;
}

.sidebar-status strong {
  margin-top: 5px;
  font-size: 13px;
}

.workspace {
  padding: 26px;
  overflow: hidden;
}

.module-guide {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid #cfe1ec;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #eef8fb 100%);
  box-shadow: 0 12px 28px rgba(15, 45, 65, 0.07);
}

.module-guide strong,
.module-guide span {
  display: block;
}

.module-guide strong {
  font-size: 18px;
}

.module-guide span,
.module-guide li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.module-guide span {
  margin-top: 5px;
}

.module-guide ul {
  margin: 0;
  padding-left: 18px;
}

.topbar {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.25;
}

h2 {
  font-size: 16px;
  line-height: 1.35;
}

.topbar p,
.panel-head span,
.metric small,
.progress-head span,
.field span {
  color: var(--muted);
}

.topbar p {
  margin-top: 6px;
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
}

.field.compact {
  width: 154px;
}

.field span {
  font-size: 12px;
}

input,
select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #ffffff;
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 2px solid rgba(15, 118, 110, 0.2);
  border-color: var(--accent);
}

.button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

.button:hover {
  border-color: #aeb8c6;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.button:disabled {
  cursor: default;
  opacity: 0.62;
}

.button.install {
  border-color: #e8b44b;
  background: #fff6dc;
  color: #5f4711;
}

.button.danger {
  border-color: #f4b3aa;
  color: var(--bad);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid,
.dashboard-grid,
.two-column,
.plan-grid,
.settings-grid,
.bucket-grid {
  display: grid;
  gap: 16px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.metric,
.panel,
.progress-panel {
  background: var(--surface);
  border: 1px solid rgba(130, 154, 174, 0.28);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  min-height: 122px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  margin-top: 12px;
  font-size: 25px;
  line-height: 1.15;
}

.today-panel {
  padding: 16px;
}

.today-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 12px;
}

.today-card {
  min-height: 164px;
  padding: 14px;
  display: grid;
  align-content: space-between;
  gap: 10px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #ffffff;
}

.today-card span,
.today-card strong,
.today-card small {
  display: block;
}

.today-card span {
  color: var(--muted);
  font-size: 12px;
}

.today-card strong {
  font-size: 20px;
  line-height: 1.2;
}

.today-card small {
  min-height: 42px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.today-card.good {
  border-color: #b7e4c7;
  background: #f0fdf4;
}

.today-card.warn {
  border-color: #f5d48a;
  background: #fffaf0;
}

.today-card.bad {
  border-color: #f4b3aa;
  background: #fff7f5;
}

.onboarding-progress {
  height: 9px;
  margin: 0 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.onboarding-progress i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--gold));
}

.onboarding-grid,
.quick-template-grid,
.account-grid,
.review-loop-grid {
  display: grid;
  gap: 12px;
}

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

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

.account-grid,
.review-loop-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.onboarding-step,
.stage-action-card,
.quick-template-card,
.account-card,
.review-card {
  padding: 13px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #ffffff;
}

.quick-template-card {
  display: grid;
  gap: 4px;
  text-align: left;
  cursor: pointer;
}

.quick-template-card:hover {
  border-color: var(--accent);
  box-shadow: 0 10px 22px rgba(17, 24, 39, 0.08);
}

.quick-template-card span,
.quick-template-card strong,
.quick-template-card small {
  display: block;
}

.quick-template-card span,
.quick-template-card small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.onboarding-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.onboarding-step > strong {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #edf6f4;
  color: var(--accent);
}

.onboarding-step b,
.onboarding-step span,
.account-card span,
.account-card strong,
.account-card b,
.account-card small,
.review-card span,
.review-card strong,
.review-card small {
  display: block;
}

.onboarding-step span,
.account-card span,
.account-card small,
.review-card span,
.review-card small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.account-card b {
  margin: 8px 0 6px;
  font-size: 22px;
}

.account-card.neutral,
.review-card.neutral {
  border-color: #e3e8ef;
  background: #ffffff;
}

.onboarding-step.good,
.account-card.good,
.review-card.good {
  border-color: #b7e4c7;
  background: #f0fdf4;
}

.onboarding-step.warn,
.account-card.warn,
.review-card.warn {
  border-color: #f5d48a;
  background: #fffaf0;
}

.onboarding-step.bad,
.account-card.bad,
.review-card.bad {
  border-color: #f4b3aa;
  background: #fff7f5;
}

.progress-panel {
  padding: 18px;
  margin-bottom: 16px;
}

.progress-head,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.progress-head strong {
  font-size: 24px;
}

.progress-track {
  height: 14px;
  margin-top: 16px;
  border-radius: 999px;
  background: #e7e2d6;
  overflow: hidden;
}

.progress-track div {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0f766e, #e8b44b);
  transition: width 180ms ease;
}

.milestone-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.milestone {
  min-height: 92px;
  padding: 12px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #ffffff;
}

.milestone.current {
  border-color: var(--accent);
  background: #edf6f4;
}

.milestone.reached {
  border-color: #b7e4c7;
  background: #f0fdf4;
}

.milestone span,
.milestone strong,
.milestone small {
  display: block;
}

.milestone span,
.milestone small {
  color: var(--muted);
  font-size: 12px;
}

.milestone strong {
  margin: 8px 0 5px;
  font-size: 18px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  margin-bottom: 16px;
}

.panel {
  padding: 16px;
  margin-bottom: 16px;
}

.panel.wide {
  min-width: 0;
}

.panel-head {
  margin-bottom: 14px;
}

.panel-head span {
  font-size: 13px;
}

canvas {
  display: block;
  width: 100%;
  height: 320px;
  background: #ffffff;
  border: 1px solid #dfe8f1;
  border-radius: 8px;
}

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

.plan-grid,
.settings-grid {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid #e1e8f0;
  border-radius: 8px;
  background: #ffffff;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

th,
td {
  min-height: 38px;
  border-bottom: 1px solid #e6ebf2;
  padding: 7px 8px;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eaf5f7;
  color: #143f48;
  font-weight: 700;
}

td.number,
th.number {
  text-align: right;
}

td.actions {
  width: 64px;
  text-align: center;
}

td input,
td select {
  height: 34px;
  border-radius: 6px;
}

.row-delete {
  width: 30px;
  height: 30px;
  border: 1px solid #f4b3aa;
  border-radius: 6px;
  background: #fff7f5;
  color: var(--bad);
  cursor: pointer;
}

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

.insight-list,
.rule-list {
  display: grid;
  gap: 10px;
}

.insight,
.rule {
  padding: 12px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #ffffff;
}

.insight strong,
.rule strong {
  display: block;
  margin-bottom: 4px;
}

.insight span,
.rule span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.stage-roadmap,
.stage-command-grid,
.stage-week-grid,
.leverage-grid {
  display: grid;
  gap: 12px;
}

.stage-roadmap {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stage-command-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 12px;
}

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

.stage-card,
.stage-command-card,
.stage-action-card,
.strategy-item,
.lever-card {
  padding: 14px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #ffffff;
}

.stage-command-card span,
.stage-command-card strong,
.stage-command-card small,
.stage-action-card strong,
.stage-action-card span {
  display: block;
}

.stage-command-card span {
  color: var(--muted);
  font-size: 12px;
}

.stage-command-card strong {
  margin: 8px 0 6px;
  font-size: 22px;
}

.stage-command-card small,
.stage-action-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.stage-action-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.stage-action-card strong {
  margin-bottom: 5px;
}

.stage-command-card.good,
.stage-action-card.good {
  border-color: #b7e4c7;
  background: #f0fdf4;
}

.stage-command-card.warn,
.stage-action-card.warn {
  border-color: #f5d48a;
  background: #fffaf0;
}

.stage-command-card.bad,
.stage-action-card.bad {
  border-color: #f4b3aa;
  background: #fff7f5;
}

.stage-card.current {
  border-color: var(--accent);
  background: #edf6f4;
}

.stage-card.reached {
  border-color: #b7e4c7;
  background: #f0fdf4;
}

.stage-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stage-card-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stage-progress {
  height: 8px;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.stage-progress i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
}

.stage-card dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.stage-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.stage-card dt,
.stage-card dd {
  margin: 0;
  font-size: 13px;
}

.stage-card dt,
.stage-card p,
.strategy-item span,
.strategy-item small,
.lever-card span,
.lever-card small {
  color: var(--muted);
}

.stage-card p {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.45;
}

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

.strategy-item strong,
.lever-card strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 22px;
}

.strategy-item small,
.lever-card small {
  display: block;
  line-height: 1.45;
}

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

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

.allocation-lane,
.allocation-checklist {
  display: grid;
  gap: 12px;
}

.allocation-lane {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
}

.allocation-node,
.allocation-check {
  padding: 13px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #ffffff;
}

.allocation-node span,
.allocation-node strong,
.allocation-node small {
  display: block;
}

.allocation-node span {
  color: var(--muted);
  font-size: 12px;
}

.allocation-node strong {
  margin: 8px 0 6px;
  font-size: 20px;
}

.allocation-node small,
.allocation-check span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.allocation-node.good {
  border-color: #b7e4c7;
  background: #f0fdf4;
}

.allocation-node.warn {
  border-color: #f5d48a;
  background: #fffaf0;
}

.allocation-node.bad {
  border-color: #f4b3aa;
  background: #fff7f5;
}

.allocation-check {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.allocation-check strong {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #edf6f4;
  color: var(--accent);
  font-size: 13px;
}

.bucket {
  min-height: 136px;
  padding: 14px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #ffffff;
}

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

.bucket-head span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.bucket b,
.bucket small {
  display: block;
}

.bucket b {
  margin-top: 9px;
  font-size: 23px;
  font-weight: 800;
}

.bucket-track {
  height: 9px;
  margin: 12px 0 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.bucket-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.bucket small {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.45;
}

.bucket.good {
  border-color: #b7e4c7;
}

.bucket.good .bucket-track i {
  background: var(--good);
}

.bucket.warn {
  border-color: #f5d48a;
}

.bucket.warn .bucket-track i {
  background: var(--warn);
}

.bucket.bad {
  border-color: #f4b3aa;
}

.bucket.bad .bucket-track i {
  background: var(--bad);
}

.bucket.grow .bucket-track i {
  background: var(--gold);
}

.bucket.neutral .bucket-track i {
  background: #8b95a7;
}

.quick-entry-grid {
  display: grid;
  grid-template-columns: 150px 150px 170px 160px minmax(220px, 1fr) 110px;
  gap: 12px;
  align-items: end;
}

.wide-field {
  min-width: 0;
}

.quick-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip-button {
  min-height: 34px;
  border: 1px solid #d8dde7;
  border-radius: 999px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
}

.chip-button:hover,
.chip-button.active {
  border-color: var(--accent);
  background: #edf6f4;
  color: #0f3f3b;
}

.quick-actions {
  margin-top: 12px;
}

.ledger-summary-grid,
.balance-summary-grid,
.recurring-summary-grid,
.debt-pressure-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.ledger-summary {
  min-height: 86px;
  padding: 13px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #ffffff;
}

.ledger-summary span,
.ledger-summary strong {
  display: block;
}

.ledger-summary span {
  color: var(--muted);
  font-size: 12px;
}

.ledger-summary strong {
  margin-top: 10px;
  font-size: 22px;
}

.assistant-panel {
  background: #fbfdff;
}

.assistant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -2px 0 14px;
}

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

.assistant-card {
  min-height: 112px;
  padding: 13px;
  border: 1px solid #dde8f0;
  border-radius: 8px;
  background: #ffffff;
}

.assistant-card span,
.assistant-card strong,
.assistant-card small {
  display: block;
}

.assistant-card span,
.assistant-card small {
  color: var(--muted);
}

.assistant-card span {
  font-size: 12px;
}

.assistant-card strong {
  margin: 8px 0 6px;
  font-size: 22px;
}

.assistant-card small {
  font-size: 13px;
  line-height: 1.45;
}

.assistant-card.good {
  border-color: #b7e4c7;
  background: #f0fdf4;
}

.assistant-card.warn {
  border-color: #f5d48a;
  background: #fffaf0;
}

.assistant-card.bad {
  border-color: #f4b3aa;
  background: #fff7f5;
}

.asset-mix-list,
.balance-risk-list {
  display: grid;
  gap: 12px;
}

.asset-mix-row,
.debt-pressure-card {
  padding: 13px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #ffffff;
}

.asset-mix-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.asset-mix-head span,
.asset-mix-row small,
.debt-pressure-card span,
.debt-pressure-card small {
  color: var(--muted);
  font-size: 13px;
}

.asset-mix-head strong,
.debt-pressure-card strong {
  font-size: 20px;
}

.asset-mix-row small,
.debt-pressure-card small {
  display: block;
  line-height: 1.45;
}

.asset-mix-bar {
  height: 10px;
  margin: 12px 0 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.asset-mix-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.asset-mix-row.cash .asset-mix-bar i {
  background: #2d7ff9;
}

.asset-mix-row.safe .asset-mix-bar i {
  background: var(--good);
}

.asset-mix-row.invest .asset-mix-bar i {
  background: var(--gold);
}

.asset-mix-row.other .asset-mix-bar i {
  background: #8b95a7;
}

.debt-pressure-card strong {
  display: block;
  margin: 8px 0 6px;
}

.debt-pressure-card.good {
  border-color: #b7e4c7;
  background: #f0fdf4;
}

.debt-pressure-card.warn {
  border-color: #f5d48a;
  background: #fffaf0;
}

.debt-pressure-card.bad {
  border-color: #f4b3aa;
  background: #fff7f5;
}

.budget-track {
  height: 10px;
  margin: 14px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.budget-track i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 180ms ease;
}

.category-breakdown {
  display: grid;
  gap: 9px;
}

.category-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 96px 150px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.category-row span {
  color: var(--muted);
}

.category-row strong {
  text-align: right;
}

.category-row small {
  color: var(--muted);
  text-align: right;
}

.category-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.category-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent-2);
}

.category-row.near .category-bar i {
  background: var(--warn);
}

.category-row.over .category-bar i {
  background: var(--bad);
}

.empty-state,
.empty-table {
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

.action-list,
.warning-list,
.report-grid,
.diagnosis-list,
.health-snapshot-grid,
.repair-grid,
.health-action-plan,
.coach-command-grid,
.coach-question-list,
.coach-workflow,
.prompt-grid,
.health-grid,
.coach-grid,
.health-layout {
  display: grid;
  gap: 12px;
}

.action-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #ffffff;
}

.action-item strong {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #edf6f4;
  color: var(--accent);
  font-size: 13px;
}

.action-item span,
.health-action-item span,
.diagnosis-item,
.prompt-card textarea {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.action-item span b,
.action-item span small {
  display: block;
}

.action-item span b {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
}

.action-item span small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.action-item.good {
  border-color: #b7e4c7;
  background: #f0fdf4;
}

.action-item.warn {
  border-color: #f5d48a;
  background: #fffaf0;
}

.action-item.bad {
  border-color: #f4b3aa;
  background: #fff7f5;
}

.warning-item {
  padding: 13px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #ffffff;
}

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

.warning-item span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.warning-item.bad {
  border-color: #f4b3aa;
  background: #fff7f5;
}

.warning-item.warn {
  border-color: #f5d48a;
  background: #fffaf0;
}

.warning-item.good {
  border-color: #b7e4c7;
  background: #f0fdf4;
}

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

.report-card {
  padding: 14px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #ffffff;
}

.report-card strong {
  display: block;
  margin-bottom: 10px;
}

.report-card ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.recurring-task-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.recurring-task {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 82px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #ffffff;
}

.recurring-task.done {
  background: #f8fafc;
}

.recurring-task.late,
.recurring-task.today {
  border-color: #f4b3aa;
  background: #fff7f5;
}

.recurring-task.near {
  border-color: #f5d48a;
  background: #fffaf0;
}

.recurring-task strong,
.recurring-task span {
  display: block;
}

.recurring-task div > span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.health-layout,
.coach-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.coach-command-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.coach-command-card,
.coach-question,
.coach-workflow-step {
  padding: 13px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #ffffff;
}

.coach-command-card span,
.coach-command-card strong,
.coach-command-card small,
.coach-question strong,
.coach-question span {
  display: block;
}

.coach-command-card span {
  color: var(--muted);
  font-size: 12px;
}

.coach-command-card strong {
  margin: 8px 0 6px;
  font-size: 21px;
}

.coach-command-card small,
.coach-question span,
.coach-workflow-step small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.coach-command-card.good {
  border-color: #b7e4c7;
  background: #f0fdf4;
}

.coach-command-card.stable {
  border-color: #cfe3ff;
  background: #f5f9ff;
}

.coach-command-card.warn {
  border-color: #f5d48a;
  background: #fffaf0;
}

.coach-command-card.bad {
  border-color: #f4b3aa;
  background: #fff7f5;
}

.coach-question strong {
  margin-bottom: 6px;
}

.coach-workflow-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.coach-workflow-step > strong {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #edf6f4;
  color: var(--accent);
  font-size: 13px;
}

.coach-workflow-step span {
  display: block;
  margin-bottom: 4px;
  font-weight: 800;
}

.score-panel {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.score-panel p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.score-ring {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  border: 10px solid #dff4e7;
  background: #ffffff;
}

.score-ring.good {
  border-color: #b7e4c7;
}

.score-ring.stable {
  border-color: #dff4e7;
}

.score-ring.warn {
  border-color: #f5d48a;
}

.score-ring.bad {
  border-color: #f4b3aa;
}

.score-ring strong {
  font-size: 34px;
  line-height: 1;
}

.score-ring span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

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

.health-snapshot-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.repair-grid,
.health-action-plan {
  grid-template-columns: 1fr;
}

.health-card,
.health-snapshot-card,
.repair-card,
.health-action-item,
.diagnosis-item,
.prompt-card {
  padding: 13px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #ffffff;
}

.health-snapshot-card span,
.health-snapshot-card strong,
.health-snapshot-card small,
.repair-card span,
.repair-card strong,
.repair-card small {
  display: block;
}

.health-snapshot-card span,
.repair-card span {
  color: var(--muted);
  font-size: 12px;
}

.health-snapshot-card strong,
.repair-card strong {
  margin: 8px 0 6px;
  font-size: 22px;
}

.health-snapshot-card small,
.repair-card small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.health-action-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.health-action-item strong {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #edf6f4;
  color: var(--accent);
  font-size: 13px;
}

.health-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.health-card-head span {
  font-weight: 800;
  color: var(--accent);
}

.health-card.good,
.health-snapshot-card.good,
.repair-card.good {
  border-color: #b7e4c7;
  background: #f0fdf4;
}

.health-card.stable {
  border-color: #cfe3ff;
  background: #f5f9ff;
}

.health-card.warn,
.health-snapshot-card.warn,
.repair-card.warn {
  border-color: #f5d48a;
  background: #fffaf0;
}

.health-card.bad,
.health-snapshot-card.bad,
.repair-card.bad {
  border-color: #f4b3aa;
  background: #fff7f5;
}

.health-bar {
  height: 8px;
  margin: 10px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.health-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.health-card.good .health-bar i {
  background: var(--good);
}

.health-card.stable .health-bar i {
  background: var(--accent);
}

.health-card.warn .health-bar i {
  background: var(--warn);
}

.health-card.bad .health-bar i {
  background: var(--bad);
}

.health-card small {
  color: var(--muted);
  line-height: 1.45;
}

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

.prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.prompt-head strong {
  min-width: 0;
}

.prompt-head .button {
  min-height: 32px;
  padding: 0 10px;
}

.prompt-card textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
  font-family: inherit;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.tag.good {
  background: var(--soft-good);
  color: var(--good);
}

.tag.warn {
  background: var(--soft-warn);
  color: var(--warn);
}

.tag.bad {
  background: var(--soft-bad);
  color: var(--bad);
}

.tag.neutral {
  background: #eef2f7;
  color: var(--muted);
}

.settings-grid .panel.wide {
  grid-column: 1 / -1;
}

.settings-safety-grid,
.settings-check-list {
  display: grid;
  gap: 12px;
}

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

.compliance-card {
  padding: 13px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #ffffff;
}

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

.compliance-card strong {
  margin-bottom: 7px;
}

.compliance-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.settings-safety-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.settings-card,
.settings-check {
  padding: 13px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #ffffff;
}

.settings-card span,
.settings-card strong,
.settings-card small,
.settings-check strong,
.settings-check span {
  display: block;
}

.settings-card span {
  color: var(--muted);
  font-size: 12px;
}

.settings-card strong {
  margin: 8px 0 6px;
  font-size: 21px;
}

.settings-card small,
.settings-check span,
.settings-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.settings-check {
  display: grid;
  gap: 5px;
}

.settings-card.good,
.settings-check.good {
  border-color: #b7e4c7;
  background: #f0fdf4;
}

.settings-card.warn,
.settings-check.warn {
  border-color: #f5d48a;
  background: #fffaf0;
}

.settings-card.bad,
.settings-check.bad {
  border-color: #f4b3aa;
  background: #fff7f5;
}

.settings-note {
  margin: 12px 0 0;
}

.site-footer {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #dde4ef;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.site-footer-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.site-footer strong,
.site-footer span,
.site-footer a {
  display: block;
}

.site-footer strong {
  color: var(--ink);
  font-size: 15px;
}

.site-footer-links {
  min-width: 360px;
  text-align: right;
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.site-footer p {
  margin-top: 10px;
}

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

.cloud-box {
  display: grid;
  gap: 12px;
}

.sync-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #ffffff;
}

.sync-summary span {
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  min-height: 42px;
  padding: 11px 14px;
  border-radius: 8px;
  background: #202a2c;
  color: #ffffff;
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.pwa-status {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 20;
  min-height: 34px;
  padding: 8px 11px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--muted);
  box-shadow: var(--shadow);
  font-size: 12px;
}

.pwa-status[data-mode="ok"] {
  background: var(--soft-good);
  color: var(--good);
}

.pwa-status[data-mode="warn"] {
  background: var(--soft-warn);
  color: var(--warn);
}

@media (max-width: 760px) {
  body {
    min-width: 0;
    padding-bottom: calc(74px + env(safe-area-inset-bottom));
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 30;
    height: auto;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(32, 42, 44, 0.98);
  }

  .brand {
    display: none;
  }

  .nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(72px, 1fr);
    overflow-x: auto;
    gap: 4px;
  }

  .nav-item {
    min-height: 50px;
    border-radius: 8px;
    padding: 0 4px;
    text-align: center;
    font-size: 12px;
  }

  .sidebar-status {
    display: none;
  }

  .workspace {
    padding: calc(14px + env(safe-area-inset-top)) 12px 14px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    margin: -14px -12px 14px;
    padding: calc(14px + env(safe-area-inset-top)) 12px 12px;
    background: rgba(244, 248, 251, 0.96);
    backdrop-filter: blur(12px);
  }

  .topbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 23px;
  }

  .field.compact {
    width: 100%;
  }

  .metric-grid,
  .module-guide,
  .assistant-grid,
  .today-grid,
  .dashboard-grid,
  .two-column,
  .plan-grid,
  .settings-grid,
  .bucket-grid,
  .stage-roadmap,
  .stage-command-grid,
  .stage-week-grid,
  .leverage-grid,
  .allocation-summary-grid,
  .allocation-lane,
  .health-snapshot-grid,
  .coach-command-grid,
  .settings-safety-grid,
  .compliance-grid,
  .onboarding-grid,
  .quick-template-grid,
  .account-grid,
  .review-loop-grid,
  .form-grid,
  .milestone-grid,
  .quick-entry-grid,
  .ledger-summary-grid,
  .balance-summary-grid,
  .recurring-summary-grid,
  .debt-pressure-grid,
  .health-layout,
  .coach-grid,
  .health-grid,
  .report-grid,
  .prompt-grid {
    grid-template-columns: 1fr;
  }

  .module-guide {
    align-items: stretch;
    padding: 13px;
  }

  .module-guide .button {
    width: 100%;
  }

  .quick-chip-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .assistant-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .quick-chip-row::-webkit-scrollbar,
  .assistant-actions::-webkit-scrollbar {
    display: none;
  }

  .chip-button {
    flex: 0 0 auto;
  }

  .category-row {
    grid-template-columns: 1fr;
    row-gap: 6px;
  }

  .onboarding-step {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .onboarding-step .button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .stage-action-card {
    grid-template-columns: 1fr;
  }

  .stage-action-card .button {
    width: 100%;
  }

  .category-row strong {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
    text-align: left;
  }

  .category-bar {
    grid-column: 1 / -1;
  }

  .category-row small {
    grid-column: 1 / -1;
    text-align: left;
  }

  .stage-card {
    min-width: 0;
  }

  .stage-card-head,
  .stage-card dl div {
    align-items: flex-start;
  }

  .stage-card-head {
    flex-direction: column;
  }

  .stage-card dl div {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .stage-card dd {
    min-width: 0;
    text-align: left;
    overflow-wrap: anywhere;
  }

  .recurring-task {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .recurring-task .button {
    width: 100%;
  }

  canvas {
    height: 260px;
  }

  .metric {
    min-height: 104px;
    padding: 14px;
  }

  .metric strong {
    font-size: 22px;
  }

  .panel,
  .progress-panel {
    padding: 13px;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .site-footer {
    margin-bottom: calc(76px + env(safe-area-inset-bottom));
    padding: 14px;
  }

  .site-footer-main {
    display: grid;
    gap: 12px;
  }

  .site-footer-links {
    min-width: 0;
    text-align: left;
  }

  .score-panel {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .score-ring {
    margin: 0 auto;
  }

  .score-panel h2 {
    text-align: center;
  }

  .score-panel > div:last-child {
    min-width: 0;
    max-width: 100%;
  }

  .score-panel p {
    display: none;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  table {
    table-layout: auto;
  }

  tr {
    margin-bottom: 12px;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
  }

  td {
    min-height: 46px;
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #edf1f5;
    padding: 7px 0;
  }

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

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
  }

  td.number {
    text-align: left;
  }

  td.actions {
    width: auto;
    text-align: left;
  }

  td input,
  td select,
  input,
  select,
  .button {
    min-height: 44px;
  }

  .row-delete {
    width: 100%;
    height: 38px;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: calc(86px + env(safe-area-inset-bottom));
    max-width: none;
  }

  .pwa-status {
    display: none;
  }
}
