:root {
  color-scheme: dark;
  --bg: #0e1116;
  --panel: #171b22;
  --panel-soft: #1d222b;
  --line: #2a313d;
  --text: #f4f7fb;
  --muted: #8f99a8;
  --accent: #bbf451;
  --accent-dark: #88b92d;
  --danger: #ff726f;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 90% -5%, rgba(187, 244, 81, .12), transparent 32%),
    var(--bg);
  color: var(--text);
}

button, input { font: inherit; }

.shell {
  width: min(100%, 620px);
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 16px max(40px, env(safe-area-inset-bottom));
}

.hero, .section-heading, .days-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hero { margin: 2px 2px 22px; }
.eyebrow, .step {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: 28px; letter-spacing: -.04em; }
h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 5px rgba(143, 153, 168, .1);
}
.status-dot.saved { background: var(--accent); box-shadow: 0 0 0 5px rgba(187, 244, 81, .12); }
.status-dot.error { background: var(--danger); box-shadow: 0 0 0 5px rgba(255, 114, 111, .12); }

.daily-card {
  overflow: hidden;
  position: relative;
  padding: 24px;
  border-radius: 26px;
  background: var(--accent);
  color: #151a0d;
  box-shadow: 0 18px 60px rgba(104, 136, 39, .2);
}
.daily-card::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -72px;
  top: -86px;
  border: 34px solid rgba(255,255,255,.18);
  border-radius: 50%;
}
.daily-card p, .daily-card span { position: relative; z-index: 1; margin: 0; }
.daily-card p { font-weight: 700; font-size: 13px; opacity: .68; }
.daily-card strong {
  position: relative;
  z-index: 1;
  display: block;
  margin: 6px 0 3px;
  font-size: clamp(34px, 10vw, 52px);
  letter-spacing: -.06em;
  line-height: 1.05;
}
.daily-card span { font-size: 12px; opacity: .62; }

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0 24px;
}
.summary-grid.single-summary { grid-template-columns: 1fr; }
.summary-grid article {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(23,27,34,.8);
}
.summary-grid span, .summary-grid b { display: block; }
.summary-grid span { margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.summary-grid b { overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }

.panel {
  margin-bottom: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.panel.compact { padding: 18px 20px; }
.section-heading { margin-bottom: 18px; }
.currency {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
}
.currency.rub { background: rgba(99, 157, 255, .14); color: #83b4ff; font-size: 18px; }
.currency.uzs { background: rgba(187, 244, 81, .12); color: var(--accent); }

.field { display: block; margin-top: 12px; }
.field > span { display: block; margin: 0 0 7px 2px; color: var(--muted); font-size: 12px; }
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  background: #11151b;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: var(--accent-dark); box-shadow: 0 0 0 3px rgba(187,244,81,.08); }
input[readonly] {
  cursor: default;
  color: var(--accent);
  background: rgba(187, 244, 81, .045);
}
input[readonly]:focus { border-color: var(--line); box-shadow: none; }
.field input { height: 50px; padding: 0 15px; font-size: 17px; font-weight: 650; }

.deductions {
  margin-top: 18px;
  padding: 4px 14px;
  border-radius: 15px;
  background: var(--panel-soft);
}
.deductions > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.deductions > div:last-child { border-bottom: 0; }
.deductions span { color: var(--muted); font-size: 12px; }
.deductions b { font-size: 13px; }
.deductions-total b { color: var(--accent); }

.conversion-result {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
}
.conversion-result span { max-width: 150px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.conversion-result strong { text-align: right; font-size: 20px; letter-spacing: -.03em; }

.expense-list { display: grid; gap: 9px; }
.expense-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(110px, .9fr) 28px;
  align-items: center;
  gap: 7px;
}
.fixed-expense-row {
  min-height: 44px;
  margin-bottom: 9px;
  color: var(--muted);
}
.fixed-expense-name,
.fixed-expense-amount {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(17, 21, 27, .58);
  font-size: 13px;
}
.fixed-expense-amount {
  justify-content: flex-end;
  gap: 7px;
  color: var(--text);
  font-weight: 650;
}
.fixed-expense-amount span { color: var(--muted); font-size: 10px; }
.fixed-expense-lock {
  width: 8px;
  height: 8px;
  justify-self: center;
  border-radius: 50%;
  background: var(--accent);
  color: transparent;
  opacity: .55;
}
.expense-row input { height: 44px; padding: 0 11px; font-size: 13px; }
.amount-wrap { position: relative; }
.amount-wrap input { padding-right: 42px; text-align: right; }
.rub-expense-row .amount-wrap input { padding-right: 26px; }
.amount-wrap span {
  position: absolute;
  right: 10px;
  top: 50%;
  color: var(--muted);
  font-size: 10px;
  transform: translateY(-50%);
  pointer-events: none;
}
.remove-expense {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #687383;
  font-size: 21px;
  cursor: pointer;
}
.remove-expense:hover { background: rgba(255,114,111,.1); color: var(--danger); }

.add-button {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed #3b4656;
  border-radius: 13px;
  background: transparent;
  color: #aeb8c6;
  cursor: pointer;
}

.rub-reserve {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 15px;
  border: 1px solid rgba(187, 244, 81, .24);
  border-radius: 15px;
  background: rgba(187, 244, 81, .075);
}
.rub-reserve span,
.rub-reserve small { display: block; }
.rub-reserve span { font-size: 12px; font-weight: 700; }
.rub-reserve small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.rub-reserve output {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.03em;
}

.save-button {
  width: 100%;
  margin-top: 5px;
  padding: 16px;
  border: 0;
  border-radius: 15px;
  background: var(--accent);
  color: #151a0d;
  font-weight: 800;
  cursor: pointer;
}
.save-button:disabled { cursor: wait; opacity: .62; }
.error { min-height: 20px; margin: 10px 4px 0; color: var(--danger); font-size: 12px; text-align: center; }

@media (max-width: 380px) {
  .expense-row { grid-template-columns: minmax(0, 1fr) 116px 25px; gap: 5px; }
  .panel { padding: 17px 14px; }
  .expense-row input { padding-left: 8px; font-size: 12px; }
  .rub-reserve { align-items: flex-start; flex-direction: column; }
}
