.hero-row {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, .95fr);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 18px;
  padding: 26px;
  background: #ffffff;
  background-color: #ffffff;
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.hero-left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 170px;
}

.hero-label {
  font-size: .72rem;
  font-weight: 800;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .16em;
  margin-bottom: 10px;
}

.hero-value {
  font-size: clamp(2.5rem, 4vw, 3.6rem);
  line-height: .95;
  letter-spacing: -.05em;
  color: var(--text-1);
  font-weight: 800;
}

.hero-growth {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--green-dim);
  color: var(--green);
  font-size: .82rem;
  font-weight: 800;
}

.hero-cta-btn {
  align-self: flex-start;
  margin-top: 12px;
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-sm);
}

.hero-cta-btn:hover {
  background: var(--accent-h);
}

.hero-yomu-btn {
  display: none;
  align-self: flex-start;
  margin-top: 10px;
  background: #ffffff;
  color: var(--blue);
  border: 1px solid var(--blue-bdr);
  box-shadow: var(--shadow-sm);
}

.hero-yomu-btn:hover {
  background: var(--blue-dim);
}

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

.hero-chip {
  min-height: 82px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg-hover);
  border: 1px solid var(--border);
}

.hc-label {
  font-size: .67rem;
  font-weight: 800;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .11em;
  margin-bottom: 8px;
}

.hc-value {
  font-size: 1.18rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-1);
}

.hc-pl {
  font-size: .73rem;
  font-weight: 800;
  color: var(--text-3);
}

.ledger-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.ledger-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.ledger-sec-header,
.ledger-sec-footer {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ledger-sec-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-thead);
}

.ledger-sec-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-thead);
  font-size: .74rem;
  color: var(--text-3);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.ledger-sec-footer strong {
  color: var(--text-1);
  font-size: .92rem;
  letter-spacing: 0;
  text-transform: none;
}

.lsh-left { display: flex; align-items: center; gap: 10px; }
.lsh-icon { font-size: 1.05rem; }
.lsh-left h3,
.lsh-total {
  font-weight: 800;
  font-size: .9rem;
}

.ledger-table,
.master-table,
.tx-table,
.nw-table {
  width: 100%;
  border-collapse: collapse;
}

.ledger-table th,
.master-table th,
.tx-table th,
.nw-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: .67rem;
  font-weight: 800;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .12em;
  background: var(--bg-thead);
  white-space: nowrap;
}

.ledger-table td,
.master-table td,
.tx-table td,
.nw-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.ledger-table tbody tr:last-child td,
.master-table tbody tr:last-child td,
.tx-table tbody tr:last-child td,
.nw-table tbody tr:last-child td {
  border-bottom: none;
}

.ledger-table tbody tr:hover td,
.master-table tbody tr:hover td,
.tx-table tbody tr:hover td,
.nw-table tbody tr:hover td {
  background: var(--bg-hover);
}

.asset-name { font-weight: 800; font-size: .88rem; }
.asset-sub { font-size: .76rem; color: var(--text-3); margin-top: 2px; }
.asset-val { font-weight: 800; white-space: nowrap; }

.btn-tbl-edit,
.btn-tbl-upd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: .16s ease;
}

.btn-tbl-edit {
  padding: 6px 8px;
  color: var(--text-3);
  font-size: .9rem;
}

.btn-tbl-edit:hover {
  color: var(--primary);
  background: var(--bg-hover);
}

.btn-tbl-upd {
  padding: 7px 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--primary);
  font-size: .67rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.btn-tbl-upd:hover {
  color: #f8fbff;
  background: var(--primary);
}

.dash-bottom {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.perf-card .perf-stats { display: flex; gap: 20px; }
.perf-stat-label {
  font-size: .67rem;
  font-weight: 800;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .11em;
  margin-bottom: 5px;
}

.perf-stat-val { font-size: 1rem; font-weight: 800; }

.chart-wrap { position: relative; }
.chart-bar { height: 220px; }
.chart-donut { height: 220px; display: flex; align-items: center; justify-content: center; }

.alloc-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  color: var(--text-2);
  font-size: .76rem;
  font-weight: 700;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.page-header-assets {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.page-header-assets h1 {
  font-size: 1.48rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.assets-quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.add-form-card,
.update-prices-panel {
  margin-bottom: 14px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.add-form-card {
  border: 1px solid var(--border);
}

.update-prices-panel {
  border: 1px solid var(--gold-bdr);
  background: #ffffff;
}

.add-form-title,
.update-prices-panel .panel-title {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 14px;
}

.update-prices-panel .panel-title { color: var(--gold-mid); }

.form-row-wide {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.price-update-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--bg-hover);
  border: 1px solid var(--border);
}

.price-update-row label {
  font-size: .83rem;
  color: var(--text-2);
  font-weight: 800;
}

.price-update-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.price-update-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.price-field-label {
  font-size: .68rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 800;
}

.cost-display {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 1.24rem;
  font-weight: 700;
  color: var(--text-3);
}

.cost-display.has-value { color: var(--red); }

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

.summary-chip {
  padding: 14px 12px;
  text-align: left;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.summary-chip::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--blue);
}

.summary-chip-label {
  font-size: .66rem;
  font-weight: 800;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .11em;
  margin-bottom: 7px;
}

.summary-chip-value {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.1;
}

.assets-grid-tiles {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 16px;
}

.asset-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .69rem;
  font-weight: 800;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .15em;
}

.asset-section-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(100, 131, 169, 0.16), transparent);
}

.asset-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.asset-tile {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 190px;
  padding: 18px 18px 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s ease, border-color .18s ease;
}

.asset-tile:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-md);
}

.asset-tile::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
}

.asset-tile.type-cash::before { background: linear-gradient(90deg, #2b8a78, #57c2ad); }
.asset-tile.type-gold::before { background: linear-gradient(90deg, #4f85d8, #82b4f1); }
.asset-tile.type-checking::before { background: linear-gradient(90deg, #356ea8, #74b5e2); }
.asset-tile.type-savings::before { background: linear-gradient(90deg, #6877c3, #9fb2ea); }

.tile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.tile-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .92rem;
}

.type-cash .tile-icon { background: var(--green-dim); }
.type-gold .tile-icon { background: var(--gold-dim); }
.type-checking .tile-icon { background: var(--blue-dim); }
.type-savings .tile-icon { background: var(--purple-dim); }

.tile-type {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: .64rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .09em;
}

.type-cash .tile-type { background: var(--green-dim); color: var(--green); }
.type-gold .tile-type { background: var(--gold-dim); color: var(--gold-mid); }
.type-checking .tile-type { background: var(--blue-dim); color: var(--blue); }
.type-savings .tile-type { background: var(--purple-dim); color: var(--purple); }

.tile-title {
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 4px;
}

.tile-sub,
.tile-extra {
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-sub {
  font-size: .79rem;
  line-height: 1.45;
}

.tile-extra {
  font-size: .73rem;
  margin-top: 6px;
  white-space: nowrap;
}

.tile-amount-section {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.tile-amount {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1;
}

.tile-amount.green { color: var(--green); }

.tile-pl {
  font-size: .73rem;
  font-weight: 800;
  white-space: nowrap;
}

.tile-pl.up { color: var(--green); }
.tile-pl.down { color: var(--red); }

.tile-footer {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(100, 131, 169, 0.10);
}

.tile-footer .btn-inline:not(.btn-inline-del) { flex: 1; }

.btn-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: .73rem;
  font-weight: 800;
  transition: .16s ease;
  white-space: nowrap;
}

.btn-inline-edit { background: var(--bg-hover); border: 1px solid var(--border); color: var(--primary); }
.btn-inline-sell { background: var(--red-dim); border: 1px solid var(--red-bdr); color: var(--red); }
.btn-inline-info { background: var(--bg-hover); border: 1px solid var(--border); color: var(--text-2); }
.btn-inline-mature { background: var(--gold-dim); border: 1px solid var(--gold-bdr); color: var(--gold-mid); }
.btn-inline-del {
  margin-left: auto;
  flex: 0 !important;
  color: var(--text-3);
  padding: 7px 9px;
}

.btn-inline:hover { box-shadow: var(--shadow-sm); }
.btn-inline-edit:hover { background: var(--primary); color: #f8fbff; }
.btn-inline-sell:hover { background: rgba(192, 70, 59, 0.16); }
.btn-inline-info:hover { color: var(--text-1); }
.btn-inline-mature:hover { background: var(--gold-dim); }
.btn-inline-del:hover { color: var(--red); background: var(--red-dim); }

.modal-sell-info,
.modal-deposit-info {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-sell-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: .88rem;
}

.modal-sell-label {
  color: var(--text-3);
  font-weight: 700;
}

.modal-sell-val {
  font-weight: 800;
  text-align: right;
}

.modal-sell-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 13px 15px;
  border-radius: var(--radius);
  background: var(--green-dim);
  border: 1px solid var(--green-bdr);
}

.modal-sell-total.hidden { display: none; }

.transfer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.transfer-bar-label {
  font-size: .83rem;
  font-weight: 800;
  color: var(--text-2);
  white-space: nowrap;
}

.transfer-bar-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(160px, 1fr) minmax(150px, .8fr) auto;
  gap: 10px;
  align-items: center;
  flex: 1;
}

.transfer-arrow {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
}

#page-assets {
  flex-direction: column;
  max-height: calc(100vh - var(--topbar-h) - 56px);
  overflow: hidden;
}

#page-assets.active { display: flex; }
#page-assets .page-header-assets,
#page-assets .assets-summary-bar,
#page-assets .transfer-bar,
#page-assets .update-prices-panel,
#page-assets .add-form-card { flex-shrink: 0; }
#page-assets .assets-grid-tiles { flex: 1; min-height: 0; overflow: auto; padding-right: 2px; }

.tx-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.summary-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
}

.summary-label {
  color: var(--text-3);
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .11em;
  font-weight: 800;
}

.summary-val {
  display: block;
  margin-top: 6px;
  font-size: .98rem;
  font-weight: 800;
}

.table-wrap {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  box-shadow: var(--shadow-sm);
}

.tx-table { font-size: .86rem; min-width: 760px; }
.tx-table tbody tr:hover .btn-del { opacity: 1; }

.tx-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tx-row {
  display: grid;
  grid-template-columns: 88px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border-radius: var(--radius);
  background: var(--bg-hover);
  transition: .14s ease;
}

.tx-row:hover { background: #eef4fa; }
.tx-date { color: var(--text-3); font-size: .75rem; font-weight: 700; }
.tx-desc { color: var(--text-1); line-height: 1.35; min-width: 0; }
.tx-cat { font-size: .69rem; padding: 4px 9px; border-radius: 999px; font-weight: 800; }
.income-cat { background: var(--green-dim); color: var(--green); }
.expense-cat { background: var(--red-dim); color: var(--red); }
.tx-amount { font-weight: 800; white-space: nowrap; }
.tx-amount.income { color: var(--green); }
.tx-amount.expense { color: var(--red); }

.add-layout {
  display: grid;
  grid-template-columns: 1.3fr .9fr;
  gap: 16px;
}

.type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.type-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 11px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-2);
  font-size: .86rem;
  font-weight: 800;
  transition: .16s ease;
}

.type-btn.income-btn.active {
  background: var(--green-dim);
  border-color: var(--green-bdr);
  color: var(--green);
}

.type-btn.expense-btn.active {
  background: var(--red-dim);
  border-color: var(--red-bdr);
  color: var(--red);
}

.type-btn:hover:not(.active) {
  border-color: var(--border-md);
}

.dest-group { margin-top: 14px; }

.dest-group label,
.recent-added-card h3,
.nw-subtitle {
  font-size: .7rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 800;
}

.dest-select-wrap {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.dest-select-wrap select { flex: 1; }

.master-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.master-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.master-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.master-card-title h2 {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -.01em;
}

.master-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--bg-hover);
  font-size: 1rem;
}

.master-table td.master-name { font-weight: 800; }
.master-table td.master-full { color: var(--text-2); }
.master-table td.master-acts { text-align: right; white-space: nowrap; }
.master-table tr.is-editing td { background: var(--bg-hover); }
.family-event-inline-row td { vertical-align: middle; }
.family-inline-stack {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.family-inline-date {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.family-event-inline-row .master-input-sm,
.family-event-inline-row select.master-input-sm {
  min-width: 0;
}

.family-event-form {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--bg-hover);
  border: 1px solid var(--border);
}

.family-event-lunar-group {
  min-width: 220px;
}

.family-event-lunar-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.family-event-hint {
  margin-top: 8px;
  color: var(--text-3);
  font-size: 0.78rem;
  line-height: 1.45;
}

.family-events-table td {
  vertical-align: top;
}

.nw-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.nw-chart-card {
  padding: 22px 22px 12px;
  margin-bottom: 14px;
  min-height: 320px;
}

.nw-chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  color: var(--text-3);
  font-size: .9rem;
}

.nw-table { min-width: 760px; }
.nw-table .nw-month-cell { font-weight: 800; white-space: nowrap; }
.nw-table .nw-total-cell { font-family: inherit; font-weight: 800; text-align: right; white-space: nowrap; font-size: .96rem; }
.nw-table .nw-cell { color: var(--text-2); text-align: right; white-space: nowrap; font-size: .83rem; }
.nw-table .nw-empty { text-align: center; padding: 32px; color: var(--text-3); font-size: .9rem; }
.nw-pos { color: var(--green); font-weight: 800; font-size: .83rem; }
.nw-neg { color: var(--red); font-weight: 800; font-size: .83rem; }
.nw-pct { font-size: .74rem; opacity: .86; }
.nw-muted { color: var(--text-3); }
