:root {
  color-scheme: light;
  --ink: #101820;
  --muted: #667085;
  --line: #d9dee7;
  --paper: #f7f9fb;
  --surface: #ffffff;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --warn: #b42318;
  --blue: #255f85;
  --shadow: 0 18px 48px rgba(16, 24, 32, 0.16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(92px + env(safe-area-inset-bottom));
}

.screen {
  max-width: 520px;
  min-height: calc(100vh - 124px);
  margin: 0 auto;
}

.hidden {
  display: none !important;
}

.brand-panel {
  min-height: calc(100vh - 160px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: 2.65rem;
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.45rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.status-line,
.state-detail,
.result-message {
  color: var(--muted);
  line-height: 1.45;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 10px;
}

.topbar h1 {
  margin-bottom: 0;
  font-size: 2.1rem;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.25rem;
}

.session-state {
  margin-top: 28px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.state-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.state-value {
  margin-bottom: 6px;
  font-size: 1.5rem;
  font-weight: 800;
}

.action-grid {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.primary-action {
  min-height: 86px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-size: 1.22rem;
  font-weight: 850;
  box-shadow: var(--shadow);
}

.primary-action.start {
  background: var(--accent);
}

.primary-action.end {
  background: var(--blue);
}

.primary-action:disabled {
  background: #98a2b3;
  box-shadow: none;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.nav-item {
  min-height: 58px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.78rem;
  font-weight: 750;
}

.nav-item.active {
  background: #e7f4f2;
  color: var(--accent-strong);
}

.nav-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.placeholder {
  min-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.modal {
  width: min(92vw, 430px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(16, 24, 32, 0.5);
}

.modal-card {
  padding: 22px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-copy {
  margin-bottom: 20px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 800;
}

.field select {
  background: var(--surface);
  font-size: 1rem;
  font-weight: 750;
}

.field textarea {
  min-height: 104px;
  padding: 12px 14px;
  resize: vertical;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.35;
}

.form-error {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--warn);
  font-weight: 750;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.secondary-button,
.confirm-button {
  min-height: 50px;
  border-radius: 8px;
  font-weight: 850;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.confirm-button {
  border: 0;
  background: var(--accent);
  color: #fff;
}

.confirm-button.full {
  width: 100%;
}

.goal-summary {
  margin-top: 22px;
}

.goal-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.form-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.form-panel .field + .field {
  margin-top: 16px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.small-muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.day-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.day-input {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.day-input span {
  font-weight: 850;
}

.day-input small {
  color: var(--muted);
  font-weight: 700;
}

.day-input input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 800;
}

.goal-save {
  min-height: 54px;
}

.daily-targets {
  margin-top: 16px;
}

.expense-form {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.expense-summary {
  margin-top: 22px;
  padding: 18px;
}

.expense-form .form-panel {
  padding: 16px;
}

.expense-form .field {
  gap: 6px;
}

.expense-form .field input,
.expense-form .field select {
  min-height: 48px;
}

.expense-form .field textarea {
  min-height: 72px;
}

.compact-field {
  margin-top: 12px;
}

.expense-save {
  min-height: 54px;
}

.expense-list-panel {
  margin-top: 16px;
}

.expense-list {
  display: grid;
  gap: 0;
}

.expense-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.expense-row:first-child {
  border-top: 0;
}

.expense-row-main,
.expense-row-meta {
  display: grid;
  gap: 4px;
}

.expense-row-main {
  min-width: 0;
}

.expense-row-main strong {
  font-size: 1.1rem;
}

.expense-row-main span {
  overflow-wrap: anywhere;
  line-height: 1.32;
}

.expense-row-main small,
.expense-row-meta small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.expense-row-meta {
  justify-items: end;
  text-align: right;
}

.category-pill {
  max-width: 150px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #e7f4f2;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 850;
  line-height: 1.1;
}

.target-list {
  display: grid;
  gap: 9px;
}

.target-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.target-row:first-child {
  border-top: 0;
}

.target-row strong,
.target-row span {
  display: block;
}

.target-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.target-money {
  text-align: right;
}

@media (min-width: 680px) {
  .app-shell {
    padding-top: 34px;
  }

  .bottom-nav {
    left: 50%;
    width: min(520px, calc(100% - 28px));
    transform: translateX(-50%);
    bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
  }
}
