/* Dashboard layout follows the supplied reference; figures use saved app data. */
body[data-page="dashboard"] {
  --text: #f4f7fe;
  --muted: #b6cae9;
  font-family: "Segoe UI", Arial, sans-serif;
  background: radial-gradient(ellipse at 60% 18%, rgba(25, 57, 78, .14), transparent 65%), #081722;
  color: var(--text);
}

body[data-page="dashboard"] .app-shell.has-top-navigation > .main {
  padding: 22px clamp(20px, 3.3vw, 50px) 16px;
}

.reference-dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 10px;
}

.reference-dashboard-header h1 {
  margin: 0;
  font-size: 42px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.035em;
}

.reference-dashboard-header p {
  margin: 2px 0 0;
  color: #b4caee;
  font-size: 20px;
  line-height: 1.2;
}

.reference-month-nav {
  display: grid;
  grid-template-columns: 40px 131px 40px;
  flex: 0 0 auto;
  margin-top: 7px;
  overflow: hidden;
  border: 1px solid #234052;
  border-radius: 8px;
  background: rgba(15, 32, 45, .55);
}

.reference-month-nav button,
.reference-month-nav .select {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #f4f7fe;
  box-shadow: none;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

.reference-month-nav .select {
  appearance: none;
  border-right: 1px solid #203b4e;
  border-left: 1px solid #203b4e;
  text-align: center;
  text-align-last: center;
}

.reference-month-nav button:hover {
  background: rgba(73, 168, 221, .12);
}

.reference-month-nav svg,
.reference-view-link svg,
.reference-empty svg,
.reference-dashboard-footer svg {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reference-month-nav svg {
  width: 16px;
  height: 16px;
}

.reference-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 12px;
}

.reference-metric,
.reference-panel {
  min-width: 0;
  border: 1px solid #213e51;
  border-radius: 9px;
  background: linear-gradient(110deg, rgba(14, 33, 47, .94), rgba(13, 29, 41, .9));
}

.reference-metric {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  height: 114px;
  padding: 14px 28px;
}

.reference-metric h2 {
  margin: 0;
  color: #bdd1f0;
  font-size: 18px;
  font-weight: 500;
  line-height: 22px;
}

.reference-metric strong {
  display: block;
  font-size: clamp(26px, 2.35vw, 36px);
  font-weight: 650;
  line-height: 44px;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.reference-metric p {
  margin: 0;
  color: #b6cae9;
  font-size: 16px;
  line-height: 20px;
}

.reference-positive {
  color: #51edaf;
}

.reference-negative {
  color: #ff917e;
}

.reference-metric-icon {
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  margin-top: 4px;
  border-radius: 50%;
}

.reference-metric-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reference-metric-icon.income {
  background: rgba(0, 181, 208, .17);
  color: #00daef;
}

.reference-metric-icon.spent {
  background: rgba(78, 152, 239, .18);
  color: #62c1ff;
}

.reference-metric-icon.remaining {
  background: rgba(0, 213, 154, .17);
  color: #12e7ad;
}

.reference-attention {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 22px;
  min-height: 125px;
  margin-bottom: 16px;
  padding: 16px 28px 20px;
  border: 1px solid #e9b600;
  border-radius: 10px;
  background: linear-gradient(105deg, rgba(91, 63, 4, .36), rgba(68, 46, 6, .44));
}

.reference-attention-icon {
  padding-top: 4px;
  color: #ffd04d;
}

.reference-attention-icon svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reference-attention h2 {
  margin: 0 0 9px;
  color: #ffcf42;
  font-size: 20px;
  font-weight: 650;
  line-height: 26px;
}

.reference-attention-items {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr);
  gap: 64px;
}

.reference-attention-items > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.reference-attention-items > div:first-child {
  padding-right: 42px;
  border-right: 1px solid rgba(225, 219, 195, .23);
}

.reference-attention h3 {
  margin: 0 0 2px;
  color: #faf9f5;
  font-size: 18px;
  font-weight: 600;
  line-height: 23px;
}

.reference-attention p {
  margin: 0;
  color: #b7cbe7;
  font-size: 16px;
  line-height: 22px;
}

.reference-attention a {
  flex: 0 0 auto;
  padding: 9px 20px;
  border: 1px solid #e9b600;
  border-radius: 7px;
  background: rgba(28, 24, 10, .4);
  color: #ffda51;
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
}

.reference-attention a:hover {
  background: rgba(233, 182, 0, .13);
}

.reference-attention.is-clear {
  border-color: #2a9e78;
  background: rgba(23, 79, 63, .24);
}

.reference-attention.is-clear h2,
.reference-attention.is-clear .reference-attention-icon {
  color: #51edaf;
}

.reference-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.39fr) minmax(0, 1fr);
  grid-template-areas: "spending recent" "cash snapshot";
  grid-template-rows: 300px 222px;
  gap: 16px;
}

.reference-spending { grid-area: spending; }
.reference-recent { grid-area: recent; }
.reference-cash { grid-area: cash; }
.reference-snapshot { grid-area: snapshot; }

.reference-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 50px;
  padding: 14px 22px 10px;
}

.reference-panel-head h2 {
  margin: 0;
  color: #f4f7fe;
  font-size: 20px;
  font-weight: 600;
  line-height: 26px;
  letter-spacing: -.025em;
}

.reference-period {
  width: 124px;
  max-width: 130px;
  min-height: 32px;
  padding: 5px 12px;
  border: 1px solid #2c4c64;
  border-radius: 6px;
  background: #102436;
  color: #f4f7fe;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.reference-spending-list {
  display: grid;
  gap: 17px;
  padding: 8px 22px 22px;
}

.reference-spending-row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) minmax(77px, max-content) 57px;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 20px;
  font-size: 14px;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
}

.reference-category {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: #f1f5fe;
  white-space: nowrap;
}

.reference-category i {
  display: block;
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: linear-gradient(145deg, color-mix(in srgb, var(--category-color), white 15%), var(--category-color));
}

.reference-category > span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.reference-bar-track {
  height: 18px;
  overflow: hidden;
  border-radius: 7px;
  background: #192f40;
}

.reference-bar-track > span {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--category-color), white 12%), var(--category-color));
}

.reference-spending-amount,
.reference-share {
  text-align: right;
}

.reference-spending-amount { font-size: 16px; }

.reference-share {
  color: #b9cdeb;
}

.reference-view-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  color: #22c9ff;
  font-size: 14px;
  font-weight: 400;
  white-space: nowrap;
}

.reference-view-link:hover {
  color: #8de4ff;
}

.reference-table-wrap {
  padding: 0 22px 4px;
  overflow-x: auto;
}

.reference-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 22px;
  font-variant-numeric: tabular-nums;
}

.reference-table th,
.reference-table td {
  padding: 9px 0;
  overflow: hidden;
  border-bottom: 1px solid #203b4d;
  color: inherit;
  font-weight: 400;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-table th {
  color: #b6cae9;
  line-height: 20px;
}

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

.reference-table td.reference-positive {
  color: #51edaf;
}

.reference-table td.reference-negative {
  color: #ff917e;
}

.reference-recent th:nth-child(1) { width: 16%; }
.reference-recent th:nth-child(2) { width: 37%; }
.reference-recent th:nth-child(3) { width: 25%; }
.reference-recent th:nth-child(4) { width: 22%; }
.reference-recent td:nth-child(2) { padding-right: 12px; }
.reference-recent th:last-child,
.reference-recent td:last-child { text-align: right; }
.reference-recent .reference-category { gap: 10px; }
.reference-recent .reference-category i { flex-basis: 14px; width: 14px; height: 14px; }
.reference-snapshot th:first-child { width: 31%; }
.reference-snapshot th:not(:first-child),
.reference-snapshot td:not(:first-child) { text-align: right; }

.reference-cash .reference-panel-head {
  min-height: 44px;
  padding-bottom: 2px;
}

.reference-chart-legend {
  display: inline-flex;
  align-items: center;
  gap: 26px;
  color: #bed0ed;
  font-size: 13px;
}

.reference-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.reference-chart-legend i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.reference-chart-legend .income { background: #35e9a6; }
.reference-chart-legend .spent { background: #469fff; }

.reference-cash-chart {
  display: block;
  width: calc(100% - 44px);
  height: 170px;
  margin: 0 22px;
  overflow: visible;
  font-family: "Segoe UI", Arial, sans-serif;
}

.reference-chart-grid {
  stroke: #304657;
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.reference-chart-baseline {
  fill: none;
  stroke: #496072;
  stroke-width: 1;
}

.reference-chart-axis { fill: #a3badb; font-size: 13px; }
.reference-chart-month { fill: #b6cae9; font-size: 14px; }
.reference-chart-value { fill: #f4f7fe; font-size: 14px; }

.reference-empty {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 12px;
  min-height: 130px;
  padding: 22px;
  color: #b6cae9;
}

.reference-empty a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #22c9ff;
}

.reference-spending-list .reference-empty {
  padding: 0;
}

.reference-dashboard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  color: #a5bee0;
  font-size: 14px;
  line-height: 20px;
}

.reference-dashboard-footer > span > i {
  margin: 0 6px;
  font-style: normal;
}

.reference-demo-label { color: #e6bf64; }

.reference-footer-help {
  display: flex;
  align-items: center;
  gap: 14px;
}

.reference-footer-help > a {
  color: #b6cae9;
}

.reference-explanation {
  position: relative;
}

.reference-explanation summary {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #a9d5ff;
  list-style: none;
  cursor: pointer;
}

.reference-explanation summary::-webkit-details-marker { display: none; }

.reference-explanation > div {
  position: absolute;
  right: 0;
  bottom: 32px;
  z-index: 41;
  width: min(420px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid #35556b;
  border-radius: 9px;
  background: #102434;
  color: #c7d8ef;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
  font-size: 14px;
  line-height: 1.6;
}

.reference-explanation > div > strong { color: #f4f7fe; font-size: 18px; }
.reference-explanation p { margin: 10px 0; }
.reference-explanation a { display: inline-flex; align-items: center; gap: 8px; color: #22c9ff; }

body[data-page="dashboard"] :focus-visible {
  outline: 2px solid #20c8e5;
  outline-offset: 3px;
}

.learn-grid { margin-top: 18px; }
.learn-grid h2 { font-size: 20px; }
.learn-grid p { color: var(--muted); line-height: 1.6; }

@media (max-width: 1260px) {
  .reference-attention-items { gap: 22px; }
  .reference-attention-items > div { gap: 12px; }
  .reference-attention-items > div:first-child { padding-right: 22px; }
  .reference-attention a { padding: 9px 12px; }
  .reference-attention h3 { font-size: 16px; }
  .reference-attention p { font-size: 14px; }
  .reference-spending-amount { font-size: 13px; }
  .reference-spending-row { grid-template-columns: 116px minmax(0, 1fr) 92px 35px; gap: 8px; font-size: 13px; }
  .reference-panel-head h2 { font-size: 18px; }
  .reference-table { font-size: 12px; }
  .reference-table .reference-category { gap: 6px; }
}

@media (max-width: 980px) {
  .reference-dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "spending" "recent" "cash" "snapshot";
    grid-template-rows: auto;
    grid-auto-rows: auto;
  }
  .reference-spending { min-height: 280px; }
  .reference-recent { min-height: 290px; }
  .reference-cash, .reference-snapshot { min-height: 222px; }
  .reference-attention-items { grid-template-columns: 1fr; gap: 14px; }
  .reference-attention-items > div:first-child { padding: 0 0 14px; border-right: 0; border-bottom: 1px solid rgba(225, 219, 195, .23); }
  .reference-metric { padding: 16px; }
  .reference-metric-icon { flex-basis: 38px; width: 38px; height: 38px; }
  .reference-metric p { font-size: 13px; }
  .reference-table { font-size: 14px; }
  .reference-spending-row { grid-template-columns: 128px minmax(0, 1fr) 108px 44px; gap: 12px; font-size: 14px; }
  .reference-dashboard-footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 650px) {
  body[data-page="dashboard"] .app-shell.has-top-navigation > .main { padding: 20px 16px; }
  .reference-dashboard-header { flex-direction: column; gap: 12px; margin-bottom: 16px; }
  .reference-dashboard-header h1 { font-size: 34px; }
  .reference-dashboard-header p { font-size: 16px; }
  .reference-month-nav { margin-top: 0; }
  .reference-metrics { grid-template-columns: 1fr; gap: 10px; }
  .reference-metric { height: 103px; padding: 14px 20px; }
  .reference-metric strong { font-size: 30px; line-height: 38px; }
  .reference-metric-icon { flex-basis: 44px; width: 44px; height: 44px; }
  .reference-attention { grid-template-columns: 24px minmax(0, 1fr); gap: 12px; padding: 16px; }
  .reference-attention-icon svg { width: 24px; height: 24px; }
  .reference-attention h2 { font-size: 18px; }
  .reference-attention-items > div { align-items: flex-start; flex-direction: column; gap: 10px; }
  .reference-attention a { font-size: 13px; }
  .reference-panel-head { padding: 14px 16px 10px; gap: 8px; }
  .reference-panel-head h2 { font-size: 17px; }
  .reference-period { max-width: 110px; font-size: 12px; padding: 4px 8px; }
  .reference-spending-list { gap: 15px; padding: 8px 16px 22px; }
  .reference-spending-amount { font-size: 12px; }
  .reference-spending-row { grid-template-columns: 96px minmax(0, 1fr) 78px 28px; gap: 6px; font-size: 12px; }
  .reference-category { gap: 7px; }
  .reference-category i { flex-basis: 11px; width: 11px; height: 11px; }
  .reference-bar-track { height: 14px; }
  .reference-table-wrap { padding: 0 16px 8px; }
  .reference-table { min-width: 460px; font-size: 13px; }
  .reference-view-link { gap: 5px; font-size: 12px; }
  .reference-view-link svg { width: 16px; }
  .reference-chart-legend { gap: 10px; font-size: 11px; }
  .reference-chart-legend span { gap: 5px; }
  .reference-chart-legend i { width: 9px; height: 9px; }
  .reference-cash-chart { width: calc(100% - 16px); margin: 0 8px; }
  .reference-dashboard-footer { font-size: 12px; }
  .reference-explanation > div { left: -45px; right: auto; }
}

@media (prefers-reduced-motion: reduce) {
  body[data-page="dashboard"] .main.page-transition { animation: none; }
}
