/* ─────────────────────────────────────────────────────────────
   income.css — tokens for 3 variants × (dark/light), plus a fully
   responsive layout driven by CONTAINER queries: the same component
   renders compact inside a 432px canvas mockup and as a full-screen
   dashboard on desktop.
   ───────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Spectral:ital,wght@0,300;0,400;0,500;0,600;1,400&family=Spline+Sans+Mono:wght@400;500;600&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; }

.income-app {
  position: relative;
  container-type: inline-size; container-name: app;
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  padding: 24px;
  overflow-y: auto; overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body-font);
  -webkit-font-smoothing: antialiased;
  transition: background .5s ease, color .5s ease;
}
.content { flex: 1 1 auto; display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }

/* ── variant + theme tokens ───────────────────────────────── */
.iv-obsidian { --body-font: 'Spectral', Georgia, serif; --num-font: 'Spline Sans Mono', monospace; --radius: 16px; }
.iv-obsidian.theme-dark {
  --bg: oklch(0.165 0.012 64); --surface: oklch(0.215 0.014 64); --surface-2: oklch(0.255 0.015 64);
  --text: oklch(0.95 0.012 82); --muted: oklch(0.70 0.02 74); --line: oklch(0.32 0.012 64);
  --accent: oklch(0.83 0.10 86); --accent-soft: oklch(0.83 0.10 86 / .16); --shadow: 0 1px 0 oklch(1 0 0 / .04) inset;
}
.iv-obsidian.theme-light {
  --bg: oklch(0.975 0.008 84); --surface: oklch(0.995 0.005 84); --surface-2: oklch(0.96 0.01 84);
  --text: oklch(0.24 0.012 64); --muted: oklch(0.50 0.02 70); --line: oklch(0.90 0.01 80);
  --accent: oklch(0.60 0.10 72); --accent-soft: oklch(0.60 0.10 72 / .14); --shadow: 0 1px 2px oklch(0 0 0 / .04);
}

.iv-aurora { --body-font: 'Space Grotesk', system-ui, sans-serif; --num-font: 'Space Grotesk', system-ui, sans-serif; --radius: 18px; }
.iv-aurora.theme-dark {
  --bg: oklch(0.175 0.022 252); --surface: oklch(0.215 0.026 252); --surface-2: oklch(0.255 0.028 252);
  --text: oklch(0.96 0.01 232); --muted: oklch(0.70 0.03 232); --line: oklch(0.31 0.022 252);
  --accent: oklch(0.80 0.14 168); --accent-2: oklch(0.78 0.12 200); --accent-soft: oklch(0.80 0.14 168 / .16); --shadow: 0 1px 0 oklch(1 0 0 / .05) inset;
}
.iv-aurora.theme-light {
  --bg: oklch(0.98 0.012 204); --surface: oklch(0.997 0.005 204); --surface-2: oklch(0.955 0.014 204);
  --text: oklch(0.21 0.022 244); --muted: oklch(0.50 0.03 232); --line: oklch(0.91 0.013 220);
  --accent: oklch(0.60 0.13 168); --accent-2: oklch(0.58 0.11 200); --accent-soft: oklch(0.60 0.13 168 / .13); --shadow: 0 1px 2px oklch(0 0 0 / .05);
}

.iv-mono { --body-font: 'JetBrains Mono', monospace; --num-font: 'JetBrains Mono', monospace; --radius: 8px; }
.iv-mono.theme-dark {
  --bg: oklch(0.155 0.003 252); --surface: oklch(0.195 0.003 252); --surface-2: oklch(0.235 0.004 252);
  --text: oklch(0.95 0 0); --muted: oklch(0.63 0.005 252); --line: oklch(0.29 0.004 252);
  --accent: oklch(0.80 0.06 232); --accent-soft: oklch(0.80 0.06 232 / .15); --shadow: none;
}
.iv-mono.theme-light {
  --bg: oklch(0.975 0.002 252); --surface: oklch(1 0 0); --surface-2: oklch(0.955 0.003 252);
  --text: oklch(0.18 0.003 252); --muted: oklch(0.50 0.004 252); --line: oklch(0.90 0.003 252);
  --accent: oklch(0.54 0.09 236); --accent-soft: oklch(0.54 0.09 236 / .12); --shadow: none;
}
.iv-aurora { --accent-2: var(--accent-2, var(--accent)); }
.income-app:not(.iv-aurora) { --accent-2: var(--accent); }

/* ── topbar ───────────────────────────────────────────────── */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); flex: 0 0 auto; }
.brand-name { font-size: clamp(13px, 1.5cqi, 16px); font-weight: 600; letter-spacing: .22em; }
.iv-obsidian .brand-name { letter-spacing: .26em; }
.mode-chip {
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--line); border-radius: 100px; padding: 3px 9px; margin-left: 4px; white-space: nowrap;
}
.top-actions { display: flex; gap: 8px; flex: 0 0 auto; position: relative; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: border-color .2s, transform .1s, background .3s;
}
.iv-mono .icon-btn { border-radius: 6px; }
.icon-btn:hover { border-color: var(--accent); }
.icon-btn:active { transform: scale(.94); }

/* language switcher */
.lang-btn { width: auto; min-width: 36px; padding: 0 10px; font-family: var(--num-font); font-size: 12px; font-weight: 600; letter-spacing: .06em; }
.lang-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px; min-width: 168px;
  box-shadow: 0 14px 40px oklch(0 0 0 / .32); display: flex; flex-direction: column; gap: 2px;
  animation: pop .18s cubic-bezier(.2,.8,.2,1);
}
.iv-mono .lang-menu { border-radius: 6px; }
.lang-menu button {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left;
  background: transparent; border: none; color: var(--text); font-family: var(--body-font); font-size: 14px;
  padding: 9px 12px; border-radius: 8px; cursor: pointer; transition: background .12s;
}
.iv-mono .lang-menu button { border-radius: 4px; }
.lang-menu button:hover { background: var(--surface-2); }
.lang-menu button.on { color: var(--accent); font-weight: 600; }
.lang-menu .lang-code { color: var(--muted); font-size: 11px; font-family: var(--num-font); }
.lang-backdrop { position: absolute; inset: 0; z-index: 19; }

/* ── hero ─────────────────────────────────────────────────── */
.hero { position: relative; }
.hero-label { font-size: clamp(13px, 1.7cqi, 19px); color: var(--muted); letter-spacing: .02em; }
.iv-mono .hero-label { text-transform: uppercase; letter-spacing: .14em; font-size: clamp(11px, 1.4cqi, 15px); }
.hero-amount {
  display: flex; align-items: baseline; gap: 8px; margin-top: 6px;
  font-family: var(--num-font); font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1;
}
.hero-amount .num { font-size: clamp(46px, 13cqi, 132px); font-weight: 600; line-height: .98; letter-spacing: -.025em; }
.iv-obsidian .hero-amount .num { font-weight: 500; }
.hero-amount .sym { font-size: clamp(24px, 6cqi, 56px); font-weight: 500; color: var(--accent); }
.hero-amount .sym-post { font-size: clamp(28px, 7cqi, 64px); }
.hero-pulse { display: flex; align-items: baseline; gap: 6px; margin-top: 12px; transition: opacity .4s; white-space: nowrap; }
.pulse-val { font-family: var(--num-font); font-variant-numeric: tabular-nums; color: var(--accent); font-size: clamp(15px, 1.8cqi, 22px); font-weight: 600; }
.pulse-unit { font-size: clamp(12px, 1.3cqi, 15px); color: var(--muted); }
.is-idle .hero-pulse { opacity: .35; }
.is-idle .hero-amount .num { opacity: .82; }

/* particles */
.fx { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.particle {
  position: absolute; bottom: 18%; border-radius: 50%; background: var(--accent);
  opacity: 0; animation-name: floatup; animation-timing-function: cubic-bezier(.25,.6,.3,1); animation-fill-mode: forwards;
  box-shadow: 0 0 8px var(--accent-soft);
}
.iv-mono .particle { border-radius: 1px; }
@keyframes floatup {
  0% { transform: translateY(8px) translateX(0) scale(.6) rotate(0); opacity: 0; }
  18% { opacity: .95; }
  100% { transform: translateY(-78px) translateX(var(--dx)) scale(1) rotate(var(--rot)); opacity: 0; }
}

/* ── status ───────────────────────────────────────────────── */
.status { display: flex; align-items: center; gap: 8px; font-size: clamp(12px, 1.4cqi, 15px); color: var(--muted); margin-top: 14px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); animation: breathe 2.4s ease-in-out infinite; flex: 0 0 auto; }
.is-idle .status-dot { background: var(--muted); box-shadow: none; animation: none; }
@keyframes breathe { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.35); opacity: .7; } }

/* ── goal bars ────────────────────────────────────────────── */
.goal { display: flex; flex-direction: column; gap: 8px; }
.goal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: clamp(12px, 1.3cqi, 15px); color: var(--muted); }
.goal-head > span:first-child { white-space: nowrap; min-width: 0; }
.goal-pct { font-family: var(--num-font); font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.bar { height: 8px; border-radius: 100px; background: var(--surface-2); overflow: hidden; }
.iv-mono .bar { border-radius: 2px; height: 6px; }
.bar-fill {
  height: 100%; width: 0%; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .35s cubic-bezier(.3,.7,.3,1);
}
.goal-month .bar { height: 6px; }

/* ── metrics grid ─────────────────────────────────────────── */
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat, .rate { padding: 14px 16px; border-radius: var(--radius); }
.stat { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.rate { border: 1px dashed var(--line); }
.stat-label, .rate-label { font-size: clamp(11px, 1.2cqi, 13px); color: var(--muted); }
.iv-mono .stat-label, .iv-mono .rate-label { text-transform: uppercase; letter-spacing: .07em; }
.stat-val { margin-top: 8px; font-family: var(--num-font); font-variant-numeric: tabular-nums; font-size: clamp(20px, 2.6cqi, 30px); font-weight: 600; letter-spacing: -.01em; }
.rate-val { margin-bottom: 4px; font-family: var(--num-font); font-variant-numeric: tabular-nums; font-size: clamp(18px, 2.2cqi, 26px); font-weight: 600; display: flex; align-items: baseline; gap: 4px; }
.rate-val i { font-style: normal; color: var(--accent); font-size: .6em; }
.rate { display: flex; flex-direction: column; justify-content: center; }

/* ── coffee ───────────────────────────────────────────────── */
.coffee { margin-top: auto; display: flex; align-items: center; gap: 10px; font-size: clamp(13px, 1.4cqi, 16px); color: var(--muted); padding-top: 6px; }
.coffee b { color: var(--text); font-family: var(--num-font); font-variant-numeric: tabular-nums; font-weight: 600; }
.equiv-line { display: inline; }
.equiv-prefix { white-space: nowrap; }
.equiv-wrap { display: inline-block; overflow: hidden; vertical-align: bottom; line-height: 1.3; }
.equiv { display: inline-block; color: var(--text); font-weight: 600; white-space: nowrap; }
.equiv.anim { animation: equivIn .5s cubic-bezier(.2,.85,.25,1); }
@keyframes equivIn { from { transform: translateY(105%); opacity: 0; } to { transform: none; opacity: 1; } }
.coffee-mark { width: 18px; height: 18px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; border: 1.5px solid var(--accent); position: relative; flex: 0 0 auto; }
.coffee-mark::after { content: ''; position: absolute; right: -5px; top: 3px; width: 6px; height: 7px; border: 1.5px solid var(--accent); border-left: none; border-radius: 0 6px 6px 0; }

/* per-hour card: full width on mobile so it doesn't sit alone */
@container app (max-width: 659px) {
  .rate-hour { grid-column: span 2; }
}

/* ════ TABLET ════════════════════════════════════════════════ */
@container app (min-width: 660px) {
  .income-app { padding: 40px; }
  .content { width: 100%; max-width: 720px; margin: 26px auto 0; gap: 22px; }
  .hero { text-align: center; margin-top: 10px; }
  .hero-amount, .hero-pulse, .status { justify-content: center; }
  .metrics { grid-template-columns: repeat(5, 1fr); }
  .goal-daily { width: 100%; max-width: 520px; margin: 0 auto; }
  .coffee { margin-top: 4px; justify-content: center; }
}

/* ════ DESKTOP ═══════════════════════════════════════════════ */
@container app (min-width: 1040px) {
  .income-app { padding: clamp(40px, 4.5cqi, 80px); }
  .content { max-width: 1080px; justify-content: center; gap: clamp(26px, 3cqi, 44px); margin-top: 0; }
  .hero { margin-top: 0; padding: 18px 0 6px; }
  .hero::after {
    content: ''; position: absolute; left: 50%; top: 46%; width: 60%; aspect-ratio: 1; transform: translate(-50%, -50%);
    background: radial-gradient(closest-side, var(--accent-soft), transparent 72%); opacity: .9; pointer-events: none; z-index: -1; filter: blur(8px);
  }
  .hero-amount { gap: 14px; }
  .goal-daily { max-width: 620px; }
  .metrics { gap: 18px; }
}

/* ── settings sheet ───────────────────────────────────────── */
.sheet-scrim { position: absolute; inset: 0; background: oklch(0 0 0 / .5); backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center; z-index: 20; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 520px; background: var(--bg); border: 1px solid var(--line); border-bottom: none;
  border-radius: 22px 22px 0 0; padding: 14px 22px 24px; display: flex; flex-direction: column; gap: 18px;
  box-shadow: 0 -20px 50px oklch(0 0 0 / .35); animation: slideup .32s cubic-bezier(.2,.8,.2,1);
}
.iv-mono .sheet { border-radius: 10px 10px 0 0; }
@keyframes slideup { from { transform: translateY(100%); } }
@container app (min-width: 660px) {
  .sheet-scrim { align-items: center; }
  .sheet { border-radius: 18px; border-bottom: 1px solid var(--line); animation: pop .3s cubic-bezier(.2,.8,.2,1); }
  @keyframes pop { from { transform: scale(.96); opacity: 0; } }
}
.sheet-grip { width: 38px; height: 4px; border-radius: 100px; background: var(--line); align-self: center; }
@container app (min-width: 660px) { .sheet-grip { display: none; } }
.sheet-title { font-size: 18px; font-weight: 600; }
.iv-obsidian .sheet-title { font-size: 21px; }
.field { display: flex; flex-direction: column; gap: 9px; }
.field-label { font-size: 12px; color: var(--muted); letter-spacing: .01em; }
.iv-mono .field-label { text-transform: uppercase; letter-spacing: .08em; }
.income-input { display: flex; gap: 8px; }
.income-input input {
  flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 13px 14px; font-family: var(--num-font); font-size: 20px; font-weight: 600; outline: none;
}
.income-input input:focus { border-color: var(--accent); }
.income-input select, .times input, .seg button, .days button, .vpick button {
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; font-family: var(--body-font); font-size: 14px; outline: none; cursor: pointer;
}
.iv-mono .income-input input, .iv-mono .income-input select, .iv-mono .times input, .iv-mono .seg button, .iv-mono .days button, .iv-mono .vpick button { border-radius: 6px; }
.income-input select { padding: 0 12px; font-weight: 600; }
.income-input select:focus, .times input:focus { border-color: var(--accent); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg button { padding: 12px 10px; transition: all .2s; }
.seg button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); font-weight: 600; }
.vpick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.vpick button { padding: 11px 8px; transition: all .2s; font-weight: 500; }
.vpick button.on { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.days button { padding: 10px 0; font-size: 12px; transition: all .15s; }
.days button.on { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
.times { display: flex; align-items: center; gap: 12px; }
.times input { padding: 11px 14px; font-family: var(--num-font); font-size: 15px; }
.times .dash { color: var(--muted); }
.sheet-actions { display: flex; gap: 10px; margin-top: 2px; }
.sheet-actions button { flex: 1; padding: 14px; border-radius: 12px; font-family: var(--body-font); font-size: 15px; font-weight: 600; cursor: pointer; border: 1px solid var(--line); transition: all .2s; }
.iv-mono .sheet-actions button { border-radius: 6px; }
.sheet-actions .ghost { background: transparent; color: var(--muted); flex: 0 0 auto; padding: 14px 18px; }
.sheet-actions .ghost:hover { color: var(--text); }
.sheet-actions .primary { background: var(--accent); border-color: var(--accent); color: oklch(0.16 0.01 60); }
.theme-light .sheet-actions .primary { color: var(--surface); }
.privacy-note { font-size: 11px; color: var(--muted); text-align: center; opacity: .8; }

.income-input input::-webkit-outer-spin-button, .income-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.income-input input[type=number] { -moz-appearance: textfield; }

@media (prefers-reduced-motion: reduce) {
  .particle, .status-dot { animation: none !important; }
}
