/* ═══════════════════════════════════════
   CLEARFLOW · DESIGN SYSTEM
═══════════════════════════════════════ */

:root {
  --ink:          #1a1a18;
  --ink-2:        #3d3d3a;
  --ink-3:        #6b6b67;
  --ink-4:        #9c9a92;
  --paper:        #f7f5f0;
  --paper-2:      #efecea;
  --paper-3:      #e5e2dc;
  --accent:       #2a5c45;
  --accent-light: #e8f2ed;
  --accent-mid:   #4a9470;
  --danger:       #c0392b;
  --danger-light: #fdf0ef;
  --blue:         #1a4a7a;
  --blue-light:   #e8f0f8;
  --warn:         #9c6a00;
  --radius:       12px;
  --radius-lg:    20px;
  --shadow:       0 1px 3px rgba(26,26,24,0.08), 0 4px 16px rgba(26,26,24,0.06);
  --shadow-sm:    0 1px 3px rgba(26,26,24,0.08);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ── */
h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(38px, 6vw, 58px);
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: -0.02em;
}
h1 em { font-style: italic; color: var(--accent); }
h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
h3.card-title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ── Nav ── */
#main-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247,245,240,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--paper-3);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 32px;
}
.logo {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.01em;
  text-decoration: none;
}
.logo-flow { color: var(--accent); }
.nav-tag {
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-4);
  letter-spacing: 0.02em;
}

/* ── Secondary nav info bar ── */
.nav-info {
  background: white;
  border-bottom: 1px solid var(--paper-3);
  position: sticky;
  top: 53px;
  z-index: 90;
}
.nav-info-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 32px;
  gap: 16px;
}
.nav-info-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nav-info-right { flex-shrink: 0; position: relative; }
.info-pill {
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-3);
  background: var(--paper-2);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--paper-3);
}

/* ── Screens ── */
.screen { display: none; }
.screen.active {
  display: block;
  animation: screenIn 0.35s ease;
}
@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════
   SCREEN 1 · WELCOME
═══════════════════════════════════════ */

.welcome-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 64px 32px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 28px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}
.eyebrow-rule {
  flex: 1;
  height: 1px;
  background: var(--paper-3);
}
.eyebrow-text {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-4);
  white-space: nowrap;
}

.welcome-sub {
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-3);
  max-width: 520px;
}

/* Privacy card */
.privacy-card {
  background: var(--paper-2);
  border: 1px solid var(--paper-3);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  text-align: left;
  width: 100%;
}
.privacy-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}
.shield-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-light);
  border: 1.5px solid var(--accent-mid);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.privacy-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 2px;
}
.privacy-subtitle {
  font-size: 13px;
  color: var(--ink-3);
}
.privacy-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.privacy-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.5;
}
.check-bullet {
  width: 20px;
  height: 20px;
  min-width: 20px;
  background: var(--accent-light);
  border: 1.5px solid var(--accent-mid);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-top: 1px;
}

/* Consent checkbox row */
.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.5;
}
.consent-row input[type="checkbox"] { display: none; }
.checkbox-custom {
  width: 18px;
  height: 18px;
  min-width: 18px;
  border: 1.5px solid var(--paper-3);
  border-radius: 5px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  margin-top: 1px;
}
.consent-row input:checked + .checkbox-custom {
  background: var(--accent);
  border-color: var(--accent);
}
.consent-row input:checked + .checkbox-custom::after {
  content: '';
  width: 10px;
  height: 10px;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 12 12' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='2 6 5 9 10 3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
}

/* ═══════════════════════════════════════
   SCREEN 2 · UPLOAD
═══════════════════════════════════════ */

.upload-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 32px 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Steps */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 8px;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.step.done  { color: var(--accent); }
.step.current { color: var(--ink); }
.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--paper-3);
  border: 2px solid var(--paper-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-4);
}
.step.done .step-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.step.current .step-dot {
  background: white;
  border-color: var(--ink);
  color: var(--ink);
  font-weight: 600;
}
.step-connector {
  flex: 1;
  height: 2px;
  background: var(--paper-3);
  margin-bottom: 20px;
}
.step-connector.active { background: var(--accent); }

.upload-sub { font-size: 15px; color: var(--ink-3); }

/* Drop zone */
.drop-zone {
  background: var(--paper-2);
  border: 2px dashed var(--paper-3);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}
.drop-zone:hover, .drop-zone.drag-over {
  background: var(--accent-light);
  border-color: var(--accent-mid);
}
.drop-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  pointer-events: none;
}
.upload-icon { color: var(--ink-4); }
.drop-zone:hover .upload-icon, .drop-zone.drag-over .upload-icon { color: var(--accent); }
.drop-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}
.drop-sub { font-size: 13px; color: var(--ink-3); }
.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* File list */
.file-list { display: flex; flex-direction: column; gap: 10px; }
.file-card {
  background: white;
  border: 1px solid var(--paper-3);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
  animation: slideIn 0.25s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.file-icon {
  width: 36px;
  height: 36px;
  background: var(--blue-light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  flex-shrink: 0;
}
.file-icon.error { background: var(--danger-light); color: var(--danger); }
.file-info { flex: 1; min-width: 0; }
.file-bank { font-size: 13px; font-weight: 500; color: var(--ink); }
.file-name { font-size: 11px; color: var(--ink-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.file-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; min-width: 100px; }
.progress-bar {
  height: 4px;
  background: var(--paper-3);
  border-radius: 2px;
  overflow: hidden;
  width: 100px;
}
.progress-fill {
  height: 100%;
  background: var(--accent-mid);
  border-radius: 2px;
  width: 0%;
  transition: width 1.5s cubic-bezier(0.4,0,0.2,1);
}
.file-status {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-4);
}
.file-status.done { color: var(--accent); }
.file-status.error { color: var(--danger); }

/* Bank guide */
.bank-guide {
  background: var(--paper-2);
  border: 1px solid var(--paper-3);
  border-radius: var(--radius);
  padding: 18px 22px;
}
.bank-guide-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 14px;
}
.bank-guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
}
.bank-guide-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bank-guide-item strong { font-size: 13px; font-weight: 500; color: var(--ink); }
.bank-guide-item span { font-size: 12px; color: var(--ink-3); }

/* Notices */
.notice-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--blue-light);
  border: 1px solid rgba(26,74,122,0.2);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--blue);
  line-height: 1.5;
}
.notice-banner svg { flex-shrink: 0; margin-top: 1px; }

/* ═══════════════════════════════════════
   SCREEN 3 · DASHBOARD
═══════════════════════════════════════ */

.dashboard-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 32px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Stat cards */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.stat-card {
  background: white;
  border: 1px solid var(--paper-3);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.stat-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 8px;
}
.stat-value {
  font-family: 'DM Sans', sans-serif;
  font-size: 28px;
  font-weight: 300;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.stat-value.positive { color: var(--accent); }
.stat-value.danger   { color: var(--danger); }
.stat-value.neutral  { color: var(--ink); }
.stat-meta { font-size: 11px; color: var(--ink-4); }

/* Dashboard rows */
.dashboard-row {
  display: grid;
  gap: 20px;
}
.dashboard-row.two-col { grid-template-columns: 1fr 1fr; }
.full-width-card { grid-column: 1 / -1; }

/* Cards */
.card {
  background: white;
  border: 1px solid var(--paper-3);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.chart-container {
  position: relative;
  width: 100%;
}

/* Chart legend (spending bar chart) */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 12px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ink-3);
}
.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Donut legend */
.donut-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 16px;
  justify-content: center;
}
.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ink-2);
}
.donut-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Category editor */
.editor-card { overflow-y: auto; max-height: 460px; }
.category-editor { display: flex; flex-direction: column; }
.editor-section-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 10px 0 6px;
  border-bottom: 1px solid var(--paper-3);
  margin-bottom: 4px;
}
.editor-section-label:not(:first-child) { margin-top: 12px; }
.editor-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--paper-2);
}
.editor-row:last-child { border-bottom: none; }
.cat-name { flex: 1; font-size: 13px; color: var(--ink-2); min-width: 80px; }
.delta-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  min-width: 64px;
  text-align: right;
  transition: all 0.2s;
}
.delta-badge.positive { background: var(--accent-light); color: var(--accent); }
.delta-badge.negative { background: var(--danger-light); color: var(--danger); }
.input-wrap {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--paper);
  border: 1px solid var(--paper-3);
  border-radius: 6px;
  padding: 4px 8px;
  transition: border-color 0.15s;
}
.input-wrap:focus-within { border-color: var(--accent-mid); }
.input-wrap.modified { border-color: var(--blue); background: var(--blue-light); }
.dollar-sign, .mo-label { font-size: 11px; color: var(--ink-4); }
.cat-input {
  width: 72px;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink);
  text-align: right;
  outline: none;
  -moz-appearance: textfield;
}
.cat-input::-webkit-outer-spin-button,
.cat-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.reset-link {
  font-size: 12px;
  color: var(--ink-4);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.reset-link:hover { color: var(--accent); }

/* Projection chart */
.projection-balance-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.balance-label { font-size: 12px; color: var(--ink-3); }
.balance-input-wrap {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--paper);
  border: 1px solid var(--paper-3);
  border-radius: 6px;
  padding: 4px 8px;
}
.balance-input-wrap:focus-within { border-color: var(--accent-mid); }
.dollar-prefix { font-size: 12px; color: var(--ink-4); }
.balance-input {
  width: 80px;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  -moz-appearance: textfield;
}
.balance-input::-webkit-outer-spin-button,
.balance-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.balance-hint { font-size: 11px; color: var(--ink-4); }

.projection-warning {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--danger-light);
  border: 1px solid rgba(192,57,43,0.2);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--danger);
  margin-bottom: 14px;
}
.projection-warning svg { flex-shrink: 0; }

/* Projection legend */
.proj-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  flex-shrink: 0;
}
.proj-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
}
.proj-legend-swatch {
  width: 24px;
  height: 2.5px;
  border-radius: 1px;
}
.proj-legend-swatch.dashed {
  background: repeating-linear-gradient(90deg, var(--ink-4) 0, var(--ink-4) 4px, transparent 4px, transparent 7px);
}
.proj-legend-swatch.solid { background: var(--blue); }

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s, opacity 0.18s;
  text-decoration: none;
}
.btn-primary:hover:not(:disabled) { background: var(--ink-2); }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; pointer-events: none; }
.btn-large { padding: 14px 28px; font-size: 15px; border-radius: 12px; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--paper-3);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-3);
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); }

/* Screenshot tooltip */
.screenshot-tip-wrap { position: relative; }
.tooltip {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--ink);
  color: white;
  font-size: 12px;
  line-height: 1.6;
  padding: 10px 14px;
  border-radius: 10px;
  white-space: nowrap;
  z-index: 200;
  box-shadow: var(--shadow);
}
.tooltip kbd {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: monospace;
  font-size: 11px;
}
.tooltip::before {
  content: '';
  position: absolute;
  top: -5px;
  right: 16px;
  width: 10px;
  height: 10px;
  background: var(--ink);
  transform: rotate(45deg);
}

/* ═══════════════════════════════════════
   UTILITIES
═══════════════════════════════════════ */
.hidden { display: none !important; }
.positive-text { color: var(--accent); }
.danger-text    { color: var(--danger); }

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */

@media (max-width: 1024px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .nav-inner { padding: 12px 20px; }
  .nav-info-inner { padding: 8px 20px; }
  .welcome-wrap { padding: 40px 20px 60px; }
  .upload-wrap { padding: 32px 20px 60px; }
  .dashboard-wrap { padding: 20px 16px 48px; gap: 16px; }
  .dashboard-row.two-col { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .bank-guide-grid { grid-template-columns: 1fr; }
  .card-header { flex-direction: column; gap: 10px; }
  .proj-legend { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .balance-hint { display: none; }
}

@media (max-width: 480px) {
  h1 { font-size: 32px; }
  .stat-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-value { font-size: 22px; }
  .privacy-card { padding: 20px; }
  .steps { transform: scale(0.9); transform-origin: left; }
}
