:root {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, system-ui, sans-serif;
  color: #111111;
  background: #ffffff;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --line: #e9e9e9;
  --muted: #5f5f5f;
  --soft: #f4f4f4;
  --red: #d92d20;
  --black: #111111;
}
* { box-sizing: border-box; }
html { background: #fff; }
body { margin: 0; min-height: 100vh; background: #fff; color: var(--black); }
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #111; outline-offset: 2px; }
.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top)) 22px calc(36px + env(safe-area-inset-bottom));
}
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
h1 { margin: 0; font-size: clamp(25px, 7vw, 34px); line-height: 1.1; font-weight: 650; letter-spacing: -0.025em; }
.reset-button { border: 0; background: transparent; color: var(--red); padding: 10px 0; font-size: 15px; font-weight: 600; cursor: pointer; }
.budget-summary { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; margin-top: 42px; }
.eyebrow { display: block; color: #5f5f5f; font-size: 11px; font-weight: 650; letter-spacing: .08em; }
.remaining-amount { display: block; margin-top: 7px; font-size: clamp(43px, 13vw, 64px); line-height: .95; font-weight: 650; letter-spacing: -0.045em; white-space: nowrap; }
.remaining-amount.negative { color: var(--red); }
.planned-block { text-align: right; padding-bottom: 5px; }
.planned-amount { display: block; margin-top: 8px; font-size: clamp(20px, 6vw, 29px); line-height: 1; font-weight: 550; letter-spacing: -0.02em; white-space: nowrap; }
.progress-section { margin-top: 30px; }
.progress-track { width: 100%; height: 12px; border-radius: 999px; background: #ededed; overflow: hidden; }
.progress-bar { width: 0%; height: 100%; border-radius: inherit; background: #111; transition: width .32s ease; }
.progress-meta { display: flex; justify-content: space-between; gap: 14px; margin-top: 9px; color: #5f5f5f; font-size: 13px; }
.add-section { margin-top: 32px; }
.add-button { width: 100%; min-height: 52px; border: 1px solid #111; border-radius: 12px; background: #111; color: #fff; font-weight: 650; font-size: 16px; cursor: pointer; }
.expense-form { margin-top: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.field { display: grid; gap: 8px; margin-bottom: 16px; }
.field label { font-size: 13px; color: #555; font-weight: 600; }
.field input { width: 100%; min-height: 48px; padding: 0 13px; border: 1px solid #d9d9d9; border-radius: 10px; color: #111; background: #fff; font-size: 16px; }
.field input::placeholder { color: #a3a3a3; }
.form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.secondary-button, .primary-button, .danger-button { min-height: 48px; border-radius: 10px; border: 1px solid #d9d9d9; cursor: pointer; font-weight: 650; }
.secondary-button { background: #fff; color: #111; }
.primary-button { background: #111; color: #fff; border-color: #111; }
.primary-button:disabled, .danger-button:disabled { opacity: .35; cursor: not-allowed; }
.danger-button { background: var(--red); color: #fff; border-color: var(--red); }
.history-section { margin-top: 44px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h2 { margin: 0; font-size: 19px; line-height: 1.2; font-weight: 650; letter-spacing: -.01em; }
.count { min-width: 27px; height: 27px; display: inline-grid; place-items: center; padding: 0 8px; border-radius: 999px; background: var(--soft); color: #555; font-size: 12px; font-weight: 650; }
.sort-row { display: flex; align-items: center; justify-content: flex-start; gap: 10px; margin: 20px 0 4px; }
.sort-row label { color: #5f5f5f; font-size: 13px; white-space: nowrap; }
.sort-control {
  position: relative;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
}
.sort-row select {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 30px;
  padding: 0;
  border: 1px solid #d9d9d9;
  border-radius: 999px;
  background: #fff;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  font-size: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.sort-row select option { color: #111; font-size: 16px; }
.sort-arrows {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  pointer-events: none;
}
.sort-arrows span {
  width: 7px;
  height: 7px;
  border-right: 2px solid #111;
  border-bottom: 2px solid #111;
}
.sort-arrows span:first-child { transform: rotate(225deg); margin-top: 4px; }
.sort-arrows span:last-child { transform: rotate(45deg); margin-bottom: 4px; }
@media (max-width: 390px) {
  .sort-row { gap: 8px; }
  .sort-control { flex-basis: 30px; width: 30px; }
}
.expense-list { margin-top: 7px; }
.expense-row { display: grid; grid-template-columns: minmax(84px, 26%) 1fr 36px; align-items: center; gap: 13px; min-height: 76px; border-bottom: 1px solid var(--line); }
.expense-amount { font-size: 17px; font-weight: 650; white-space: nowrap; }
.expense-info { min-width: 0; }
.expense-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 550; }
.expense-date { display: block; margin-top: 5px; color: #666; font-size: 12px; }
.delete-button { width: 34px; height: 34px; display: grid; place-items: center; border: 0; background: transparent; color: #777; border-radius: 8px; cursor: pointer; }
.delete-button:hover { background: #f4f4f4; color: #111; }
.delete-button svg { width: 18px; height: 18px; }
.empty-state { padding: 38px 10px 20px; text-align: center; color: #5f5f5f; }
.empty-state p { margin: 0; color: #444; font-size: 14px; font-weight: 550; }
.empty-state span { display: block; margin-top: 7px; font-size: 13px; }
.reset-dialog { width: min(92vw, 430px); padding: 0; border: 1px solid #e4e4e4; border-radius: 16px; background: #fff; color: #111; }
.reset-dialog::backdrop { background: rgba(0,0,0,.28); }
.dialog-content { padding: 23px; }
.dialog-content h2 { font-size: 21px; }
.dialog-content p { margin: 10px 0 21px; color: #666; font-size: 14px; line-height: 1.5; }
@media (max-width: 420px) {
  .app-shell { padding-left: 18px; padding-right: 18px; }
  .budget-summary { gap: 14px; }
  .remaining-amount { font-size: 45px; }
  .planned-amount { font-size: 23px; }
  .expense-row { grid-template-columns: 82px 1fr 34px; gap: 9px; }
}
@media (min-width: 761px) {
  .app-shell { padding-top: 42px; }
}


/* Voice assistant */
.add-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.add-choice-button { min-height: 52px; }
.voice-choice-button { background: #111; color: #fff; border-color: #111; }
.voice-assistant { margin-top: 16px; }
.voice-card { padding: 24px 20px; border: 1px solid #e5e5e5; border-radius: 18px; background: #fff; text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.06); }
.voice-card .eyebrow { display: block; }
.voice-indicator { width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: #f1f1f1; }
.voice-dot { width: 24px; height: 24px; border-radius: 50%; background: #111; box-shadow: 0 0 0 0 rgba(17,17,17,.25); }
.voice-card.listening .voice-dot { animation: voice-pulse 1.2s infinite; }
.voice-card h2 { margin-top: 7px; font-size: 25px; }
.voice-prompt { margin: 12px auto 0; max-width: 420px; font-size: 17px; line-height: 1.45; color: #222; }
.voice-transcript { min-height: 24px; margin: 14px auto 0; max-width: 420px; color: #666; font-size: 14px; line-height: 1.45; }
.voice-confirmation { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.voice-status { min-height: 20px; margin: 14px 0 0; color: #666; font-size: 13px; }
@keyframes voice-pulse { 0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(17,17,17,.22); } 60% { transform: scale(1.08); box-shadow: 0 0 0 14px rgba(17,17,17,0); } 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(17,17,17,0); } }
@media (max-width: 360px) { .add-choice { grid-template-columns: 1fr; } }

/* Advanced mode — premium visual layer */
.advanced-toggle-section {
  margin-top: 48px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.advanced-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  color: #111;
  font-size: 14px;
  font-weight: 600;
}
.ios-switch {
  position: relative;
  width: 51px;
  height: 31px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #d9d9de;
  cursor: pointer;
  transition: background-color .2s ease;
}
.ios-switch[aria-checked="true"] { background: #111; }
.ios-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.22);
  transition: transform .2s ease;
}
.ios-switch[aria-checked="true"] .ios-switch-knob { transform: translateX(20px); }
.advanced-panel {
  margin-top: 20px;
  padding: 0;
}
.advanced-intro {
  padding: 24px 2px 14px;
}
.advanced-intro .eyebrow {
  color: #777;
  font-size: 11px;
}
.advanced-intro h2 {
  margin-top: 7px;
  font-size: 28px;
  letter-spacing: -.035em;
}
.advanced-card {
  margin-top: 14px;
  padding: 20px;
  border: 1px solid #e8e8ec;
  border-radius: 22px;
  background: #f8f8fa;
  overflow: hidden;
}
.advanced-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.advanced-card h3 {
  margin: 0;
  font-size: 21px;
  line-height: 1.15;
  letter-spacing: -.02em;
}
.advanced-muted {
  margin: 7px 0 0;
  color: #73737a;
  font-size: 13px;
  line-height: 1.45;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-top: 18px;
}
.stat-item {
  min-height: 92px;
  padding: 13px 12px;
  border-radius: 17px;
  background: #fff;
  border: 1px solid #ececf0;
}
.stat-item span {
  display: block;
  color: #76767d;
  font-size: 11px;
  line-height: 1.25;
}
.stat-item strong {
  display: block;
  margin-top: 9px;
  font-size: 18px;
  letter-spacing: -.025em;
}
.chart-block {
  margin-top: 14px;
  padding: 16px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid #ececf0;
}
.chart-title {
  color: #303037;
  font-size: 13px;
  font-weight: 650;
}
.month-chart {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: end;
  height: 220px;
  margin-top: 18px;
  padding: 10px 12px 0;
}
.month-bar-wrap {
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto auto;
  align-items: end;
  min-width: 0;
}
.month-bar-area {
  position: relative;
  height: 100%;
  min-height: 100px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-bottom: 1px solid #e9e9ed;
  background: repeating-linear-gradient(to top, transparent 0, transparent 43px, #f0f0f3 44px);
  border-radius: 14px 14px 0 0;
}
.month-bar {
  width: min(68px, 48%);
  min-height: 5px;
  border-radius: 16px 16px 5px 5px;
  transition: height .35s ease;
}
.month-bar.current {
  background: linear-gradient(180deg, #6d5dfc 0%, #4f46e5 100%);
  box-shadow: 0 6px 18px rgba(79,70,229,.2);
}
.month-bar.previous {
  background: linear-gradient(180deg, #58b8ff 0%, #3182ce 100%);
  box-shadow: 0 6px 18px rgba(49,130,206,.16);
}
.month-bar-value {
  margin-top: 9px;
  text-align: center;
  color: #17171a;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.month-bar-label {
  margin-top: 5px;
  text-align: center;
  color: #77777e;
  font-size: 11px;
}
.category-chart {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 20px;
  align-items: center;
  margin-top: 18px;
}
.category-donut-wrap {
  display: grid;
  place-items: center;
}
.category-donut {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  position: relative;
  transform: rotate(-90deg);
}
.category-donut::after {
  content: "";
  position: absolute;
  inset: 27px;
  border-radius: 50%;
  background: #fff;
}
.category-legend { display: grid; gap: 9px; min-width: 0; }
.category-legend-row {
  display: grid;
  grid-template-columns: 9px 1fr auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.category-legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.category-legend-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #3d3d43; font-size: 12px; }
.category-legend-value { color: #17171a; font-size: 12px; font-weight: 700; white-space: nowrap; }
.category-empty {
  padding: 12px 0 2px;
  color: #77777e;
  font-size: 12px;
}
.compact-form { display: grid; grid-template-columns: 1fr auto; gap: 9px; margin-top: 16px; }
.compact-form input, .goal-fields input {
  min-width: 0;
  min-height: 45px;
  padding: 0 13px;
  border: 1px solid #e0e0e5;
  border-radius: 13px;
  background: #fff;
  color: #111;
  font-size: 15px;
}
.small-dark-button {
  min-height: 45px;
  padding: 0 17px;
  border: 0;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}
.category-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px 7px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e3e3e8;
  color: #333339;
  font-size: 12px;
}
.category-chip button {
  width: 19px; height: 19px; padding: 0; border: 0; border-radius: 50%; background: #f0f0f3; color: #555; cursor: pointer;
}
.goal-form { margin-top: 16px; }
.goal-fields { display: grid; gap: 8px; }
.goal-form .small-dark-button { margin-top: 9px; }
.goal-list { display: grid; gap: 10px; margin-top: 15px; }
.goal-item { padding: 15px; border-radius: 17px; background: #fff; border: 1px solid #ececf0; }
.goal-top, .goal-bottom { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.goal-name { font-size: 14px; font-weight: 700; }
.goal-amounts, .goal-percent { color: #6f6f76; font-size: 12px; }
.goal-progress-track { height: 9px; margin: 11px 0 8px; border-radius: 999px; background: #ededf0; overflow: hidden; }
.goal-progress { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #34c759 0%, #30b85b 100%); transition: width .3s ease; }
.goal-delete { border: 0; background: transparent; color: #8a8a90; font-size: 11px; padding: 3px 0; cursor: pointer; }
.calendar-heading { align-items: center; }
.calendar-nav { display: flex; gap: 6px; }
.calendar-nav button {
  width: 34px; height: 34px; border: 0; border-radius: 50%; background: #fff; color: #111; font-size: 23px; line-height: 1; cursor: pointer;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  margin-top: 16px;
}
.calendar-weekday { text-align: center; color: #898990; font-size: 9px; font-weight: 700; text-transform: uppercase; }
.calendar-day {
  position: relative;
  min-height: 47px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #ececf0;
  color: #2d2d32;
  font-size: 12px;
  font-weight: 650;
}
.calendar-day.empty { visibility: hidden; }
.calendar-day.today { border-color: #111; }
.calendar-day.has-expense { background: #f1efff; border-color: #d9d5ff; color: #4f46e5; }
.calendar-day-amount { position: absolute; bottom: 5px; left: 3px; right: 3px; text-align: center; color: #73737a; font-size: 8px; font-weight: 650; }
@media (max-width: 560px) {
  .advanced-card { padding: 17px; border-radius: 19px; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-item { min-height: 70px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; }
  .stat-item strong { margin-top: 0; }
  .category-chart { grid-template-columns: 112px 1fr; gap: 14px; }
  .category-donut { width: 100px; height: 100px; }
  .category-donut::after { inset: 24px; }
  .month-chart { height: 200px; gap: 12px; padding-left: 5px; padding-right: 5px; }
  .month-bar { width: 54px; }
}
