:root {
  color-scheme: dark;
  --bg: #0f172a;
  --bg-deep: #020617;
  --panel: #111c33;
  --panel-2: #0f172a;
  --line: #1e293b;
  --line-strong: #243047;
  --text: #ffffff;
  --muted: #94a3b8;
  --soft: #cbd5e1;
  --accent: #38bdf8;
  --accent-dark: #0f5f78;
  --good: #22c55e;
  --bad: #fca5a5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(980px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 16px 116px;
  position: relative;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(14px);
}

.app-header h1,
.app-header p,
.card h2,
.bill-card h3,
.list-item h3,
.savings-card h3,
.muted,
.section-label {
  margin: 0;
}

.app-header h1 {
  font-size: 28px;
  font-weight: 900;
}

.app-header p,
.muted,
.empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.status-pill {
  flex: 0 0 auto;
  max-width: 150px;
  border: 1px solid #1e3a5f;
  border-radius: 999px;
  background: #10243f;
  color: #dbeafe;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.content {
  display: grid;
  gap: 14px;
}

.notice {
  grid-column: 1 / -1;
  border: 1px solid rgba(56, 189, 248, 0.38);
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.14);
  color: #dbeafe;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 900;
}

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

.card h2 {
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 900;
}

.section-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.big-money {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: clamp(32px, 9vw, 46px);
  font-weight: 900;
  line-height: 1;
}

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

.mini-stat,
.list-item,
.bill-card,
.savings-card,
.scan-box,
.input-group input {
  background: var(--panel-2);
}

.mini-stat {
  border-radius: 8px;
  padding: 14px;
}

.mini-stat span,
.input-group span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mini-stat strong {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  font-weight: 900;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.flex-one {
  flex: 1 1 auto;
  min-width: 0;
}

.progress-block {
  margin-bottom: 16px;
}

.progress-block:last-child {
  margin-bottom: 0;
}

.progress-block strong,
.progress-block span {
  font-size: 14px;
}

.progress-block span {
  color: var(--soft);
  font-weight: 800;
}

.progress-track {
  height: 12px;
  margin: 8px 0 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-2);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.list-item,
.bill-card,
.savings-card {
  border-radius: 8px;
  margin-bottom: 10px;
  padding: 14px;
}

.list-item,
.bill-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bill-card h3,
.list-item h3,
.savings-card h3 {
  overflow-wrap: anywhere;
  font-size: 15px;
  font-weight: 900;
}

.amount,
.expense-text,
.positive-text {
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 900;
}

.expense-text {
  color: var(--bad);
}

.positive-text {
  color: #86efac;
}

.thumb {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--line);
  object-fit: cover;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.input-group {
  display: grid;
  gap: 6px;
}

.input-group input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  padding: 12px 14px;
}

.input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}

.primary-button,
.secondary-button,
.small-button,
.text-button,
.clear-button,
.segment-row button,
.tabs button {
  border: 0;
  font-weight: 900;
}

.primary-button {
  width: 100%;
  min-height: 48px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  padding: 12px 14px;
}

.danger-button {
  background: #ef4444;
  color: #ffffff;
}

.text-button {
  background: transparent;
  color: var(--accent);
  padding: 8px;
}

.text-button.danger {
  color: var(--bad);
}

.action-column {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.secondary-button,
.small-button {
  display: inline-grid;
  min-height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  padding: 10px 14px;
}

.secondary-button {
  flex: 1 1 0;
  background: #1e293b;
}

.small-button {
  background: var(--accent);
}

.small-button.dark {
  background: #334155;
}

.small-button.paid {
  background: var(--good);
}

.clear-button {
  width: 100%;
  margin-top: 6px;
  background: transparent;
  color: var(--muted);
  padding: 14px;
}

.segment-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  margin: 16px 0 14px;
  border-radius: 8px;
  background: var(--panel-2);
  padding: 5px;
}

.segment-row button {
  min-height: 40px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.segment-row button.active {
  background: var(--accent);
  color: var(--bg);
}

.scan-box {
  display: grid;
  height: min(60vw, 270px);
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.scan-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-placeholder {
  display: grid;
  justify-items: center;
  gap: 10px;
  color: var(--soft);
}

.scan-placeholder span {
  display: grid;
  width: 74px;
  height: 74px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.tabs {
  position: fixed;
  left: max(12px, calc((100vw - 980px) / 2 + 12px));
  right: max(12px, calc((100vw - 980px) / 2 + 12px));
  bottom: 18px;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-deep);
  padding: 8px;
}

.tabs button {
  min-width: 0;
  min-height: 42px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.tabs button.active {
  background: var(--accent);
  color: var(--bg);
}

@media (min-width: 760px) {
  .app-shell {
    padding-inline: 24px;
  }

  .content {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .card {
    min-width: 0;
  }
}

@media (max-width: 520px) {
  .app-header {
    align-items: flex-start;
  }

  .button-row,
  .row-between {
    align-items: stretch;
  }

  .button-row {
    flex-direction: column;
  }

  .row-between {
    flex-direction: column;
  }

  .row-between > * {
    width: 100%;
  }

  .tabs {
    border-radius: 8px;
  }

  .tabs button {
    font-size: 11px;
    padding-inline: 2px;
  }
}
