﻿:root {
      color-scheme: light;
      --bg: #f6f3ee;
      --panel: #ffffff;
      --ink: #202124;
      --muted: #696f75;
      --line: #ded8ce;
      --green: #147a52;
      --red: #bd3d35;
      --blue: #2366a8;
      --gold: #a66b00;
      --shadow: 0 14px 34px rgba(32, 33, 36, 0.09);
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      background: var(--bg);
      color: var(--ink);
      font-family: Arial, Helvetica, sans-serif;
      line-height: 1.45;
    }

    button,
    input,
    select,
    textarea {
      font: inherit;
    }

    .app {
      min-height: 100vh;
    }

    .topbar {
      background: #1f2933;
      color: white;
      padding: 18px 20px;
    }

    .topbar-inner {
      max-width: 1160px;
      margin: 0 auto;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
    }

    .brand h1 {
      margin: 0;
      font-size: 24px;
      letter-spacing: 0;
    }

    .brand p {
      margin: 4px 0 0;
      color: #cbd5df;
      font-size: 14px;
    }

    .timeline-filter {
      display: flex;
      align-items: center;
      gap: 10px;
      color: #dce5ec;
      flex-wrap: wrap;
    }

    .timeline-filter input,
    .timeline-filter select {
      border: 1px solid #627180;
      background: #ffffff;
      color: var(--ink);
      border-radius: 6px;
      padding: 9px 10px;
      min-width: 160px;
    }

    .range-field.hidden {
      display: none;
    }

    main {
      max-width: 1160px;
      margin: 0 auto;
      padding: 24px 20px 40px;
    }

    .app-section.hidden {
      display: none;
    }

    .toast {
      position: fixed;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%) scale(0.96);
      z-index: 100;
      width: min(360px, calc(100vw - 36px));
      padding: 18px 20px;
      border-radius: 8px;
      background: #1f2933;
      color: #ffffff;
      box-shadow: 0 20px 55px rgba(32, 33, 36, 0.32);
      opacity: 0;
      pointer-events: none;
      transition: opacity 180ms ease, transform 180ms ease;
      text-align: center;
      font-size: 16px;
      font-weight: 700;
      border: 1px solid rgba(255, 255, 255, 0.18);
    }

    .toast::before {
      content: "✓";
      display: grid;
      place-items: center;
      width: 34px;
      height: 34px;
      margin: 0 auto 10px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.18);
      color: #ffffff;
      font-size: 20px;
    }

    .toast.show {
      opacity: 1;
      transform: translate(-50%, -50%) scale(1);
    }

    .toast.error {
      background: var(--red);
    }

    .toast.error::before {
      content: "!";
    }

    .toast.success {
      background: var(--green);
    }

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

    .dashboard-intro {
      background: #ffffff;
      border: 1px solid var(--line);
      border-radius: 8px;
      box-shadow: var(--shadow);
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 18px;
      align-items: center;
      padding: 20px;
      margin-bottom: 18px;
    }

    .dashboard-intro h2 {
      margin: 4px 0 8px;
      font-size: 24px;
      letter-spacing: 0;
    }

    .dashboard-intro p {
      margin: 0;
      color: var(--muted);
      max-width: 680px;
    }

    .eyebrow {
      color: var(--blue);
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
    }

    .intro-actions {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    .money-snapshot {
      background: #1f2933;
      color: #ffffff;
      border-radius: 8px;
      box-shadow: var(--shadow);
      padding: 22px;
      margin-bottom: 18px;
    }

    .money-snapshot .eyebrow {
      color: #8fd5b4;
    }

    .money-snapshot h2 {
      margin: 6px 0 8px;
      font-size: 24px;
      letter-spacing: 0;
    }

    .money-snapshot p {
      margin: 0;
      color: #d7e0e8;
    }

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

    .snapshot-item {
      background: rgba(255, 255, 255, 0.09);
      border: 1px solid rgba(255, 255, 255, 0.14);
      border-radius: 8px;
      padding: 13px;
      min-height: 88px;
    }

    .snapshot-item span {
      color: #b9c6d2;
      display: block;
      font-size: 12px;
      margin-bottom: 6px;
    }

    .snapshot-item strong {
      display: block;
      font-size: 18px;
      overflow-wrap: anywhere;
    }

    .metric,
    .panel,
    .entry-card,
    .goal-card {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 8px;
      box-shadow: var(--shadow);
    }

    .metric {
      padding: 16px;
      min-height: 108px;
    }

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

    .metric strong {
      display: block;
      margin-top: 8px;
      font-size: 25px;
      overflow-wrap: anywhere;
    }

    .metric small {
      color: var(--muted);
      display: block;
      margin-top: 6px;
    }

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

    .red {
      color: var(--red);
    }

    .blue {
      color: var(--blue);
    }

    .gold {
      color: var(--gold);
    }

    .layout {
      display: grid;
      grid-template-columns: 380px 1fr;
      gap: 18px;
      align-items: start;
    }

    .panel {
      padding: 18px;
    }

    .panel h2 {
      margin: 0 0 14px;
      font-size: 19px;
    }

    .form-grid {
      display: grid;
      gap: 12px;
    }

    label {
      display: grid;
      gap: 6px;
      color: var(--muted);
      font-size: 13px;
    }

    input,
    select,
    textarea {
      width: 100%;
      border: 1px solid #cfc7ba;
      border-radius: 6px;
      padding: 10px 11px;
      background: white;
      color: var(--ink);
    }

    textarea {
      min-height: 78px;
      resize: vertical;
    }

    .two-col {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }

    .filter-grid {
      display: grid;
      grid-template-columns: 1.4fr repeat(3, 1fr);
      gap: 10px;
      margin-bottom: 14px;
    }

    .actions {
      display: flex;
      gap: 10px;
      margin-top: 4px;
    }

    .divider {
      border: 0;
      border-top: 1px solid var(--line);
      margin: 18px 0;
    }

    .helper {
      color: var(--muted);
      font-size: 13px;
      margin: -4px 0 12px;
    }

    .btn {
      border: 0;
      border-radius: 6px;
      padding: 11px 13px;
      cursor: pointer;
      background: #1f2933;
      color: white;
      min-height: 44px;
    }

    .btn.secondary {
      background: #e8e1d6;
      color: #28313a;
    }

    .btn.danger {
      background: #f3d7d4;
      color: #8d2f28;
    }

    .report-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 14px;
      margin-bottom: 18px;
    }

    .mini-report {
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 14px;
      background: #fbfaf8;
      min-height: 150px;
    }

    .mini-report h3 {
      margin: 0 0 12px;
      font-size: 16px;
    }

    .bar-row {
      display: grid;
      grid-template-columns: 105px 1fr 85px;
      align-items: center;
      gap: 9px;
      margin: 10px 0;
      font-size: 13px;
      color: var(--muted);
    }

    .bar {
      height: 9px;
      background: #e4ded4;
      border-radius: 999px;
      overflow: hidden;
    }

    .bar-fill {
      height: 100%;
      width: 0;
      background: var(--blue);
    }

    .goal-card {
      box-shadow: none;
      padding: 14px;
      margin-bottom: 18px;
      background: #fbfaf8;
    }

    .goal-card h3 {
      margin: 0 0 8px;
      font-size: 16px;
    }

    .insight-list {
      display: grid;
      gap: 8px;
      margin: 0;
      padding: 0;
      list-style: none;
    }

    .insight-list li {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #ffffff;
      padding: 10px 12px;
      color: var(--muted);
      font-size: 14px;
    }

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

    .progress-fill {
      background: var(--green);
      height: 100%;
      width: 0;
    }

    .progress-fill.warning {
      background: var(--gold);
    }

    .progress-fill.danger {
      background: var(--red);
    }

    .score-line {
      display: flex;
      align-items: baseline;
      gap: 10px;
      flex-wrap: wrap;
    }

    .score-line strong {
      font-size: 32px;
    }

    .entries {
      display: grid;
      gap: 10px;
    }

    .import-preview {
      display: none;
      margin-bottom: 18px;
    }

    .import-preview.active {
      display: block;
    }

    .table-wrap {
      border: 1px solid var(--line);
      border-radius: 8px;
      max-height: 240px;
      overflow: auto;
      background: #fbfaf8;
    }

    .preview-table {
      width: 100%;
      border-collapse: collapse;
      min-width: 560px;
      font-size: 13px;
    }

    .preview-table th,
    .preview-table td {
      border-bottom: 1px solid var(--line);
      padding: 9px;
      text-align: left;
      vertical-align: top;
    }

    .preview-table th {
      color: var(--muted);
      font-weight: 700;
      background: #f2eee8;
      position: sticky;
      top: 0;
    }

    .preview-table select {
      min-width: 120px;
      padding: 7px 8px;
    }

    .btn.compact {
      min-height: 34px;
      padding: 7px 10px;
    }

    .status {
      color: var(--muted);
      font-size: 13px;
      margin-top: 10px;
    }

    .privacy-list {
      display: grid;
      gap: 10px;
      margin-bottom: 12px;
    }

    .privacy-list p {
      margin: 0;
      color: var(--muted);
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fbfaf8;
      padding: 10px 12px;
      font-size: 14px;
    }

    .checklist {
      display: grid;
      gap: 10px;
    }

    .check-item {
      display: grid;
      grid-template-columns: 28px 1fr auto;
      gap: 10px;
      align-items: center;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fbfaf8;
      padding: 12px;
    }

    .check-dot {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      display: grid;
      place-items: center;
      background: #e4ded4;
      color: var(--ink);
      font-size: 13px;
      font-weight: 700;
    }

    .check-item.done .check-dot {
      background: var(--green);
      color: #ffffff;
    }

    .check-item strong {
      display: block;
      font-size: 14px;
    }

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

    .entry-card {
      padding: 13px;
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 12px;
      align-items: start;
    }

    .entry-card h3 {
      margin: 0;
      font-size: 15px;
    }

    .entry-card p {
      margin: 4px 0 0;
      color: var(--muted);
      font-size: 13px;
    }

    .amount {
      font-weight: 700;
      text-align: right;
      white-space: nowrap;
    }

    .empty {
      color: var(--muted);
      border: 1px dashed #c7bfb3;
      border-radius: 8px;
      padding: 22px;
      text-align: center;
      background: #fbfaf8;
    }

    @media (max-width: 900px) {
      .summary-grid,
      .layout,
      .report-grid,
      .filter-grid,
      .dashboard-intro {
        grid-template-columns: 1fr;
      }

      .snapshot-grid {
        grid-template-columns: 1fr;
      }

      .intro-actions {
        justify-content: flex-start;
      }

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

    @media (max-width: 520px) {
      main {
        padding: 16px 12px 30px;
      }

      .topbar {
        padding: 16px 12px;
      }

      .two-col,
      .actions {
        grid-template-columns: 1fr;
        flex-direction: column;
      }

      .bar-row {
        grid-template-columns: 85px 1fr;
      }

      .bar-row strong {
        grid-column: 2;
      }

    }
