:root {
  color-scheme: light;
  --bg: #f7f4ec;
  --panel: #ffffff;
  --ink: #1e2528;
  --muted: #637073;
  --line: #dde2dc;
  --accent: #087f8c;
  --accent-strong: #05606a;
  --sun: #f4b942;
  --danger: #b42318;
  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:
    linear-gradient(180deg, rgba(8, 127, 140, 0.12), transparent 260px),
    var(--bg);
  color: var(--ink);
}

.app-shell {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 18px 16px 32px;
}

.summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 148px;
  padding: 24px;
  border-radius: 8px;
  background: #102a2e;
  color: #fff;
  box-shadow: 0 18px 36px rgba(30, 37, 40, 0.16);
}

.eyebrow {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 10vw, 3.4rem);
  line-height: 1;
  word-break: break-word;
}

h2 {
  font-size: 1.05rem;
}

.trip-mark {
  display: grid;
  place-items: center;
  flex: 0 0 54px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--sun);
  color: #1c2629;
  font-size: 1.5rem;
  font-weight: 900;
}

.average,
.entry-form,
.recent,
.section-card,
.settings-form {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

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

.average h2 {
  font-size: clamp(1.6rem, 7vw, 2.2rem);
}

.dark {
  color: var(--muted);
}

#peopleBadge {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(8, 127, 140, 0.12);
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 900;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.tab-button {
  min-height: 44px;
  margin-top: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.entry-form,
.settings-form {
  display: grid;
  gap: 10px;
}

label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 54px;
  padding: 0 14px;
  border: 1px solid #cfd8d4;
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  font-size: 1.05rem;
}

input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(8, 127, 140, 0.18);
}

button {
  width: 100%;
  min-height: 54px;
  margin-top: 6px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  background: #94aaa9;
  cursor: wait;
}

.message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.message.error {
  color: var(--danger);
}

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

.section-header span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.expense-list {
  display: grid;
  gap: 8px;
  min-height: 48px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.full-list {
  max-height: 58vh;
  overflow-y: auto;
  padding-right: 2px;
}

.expense-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.expense-content {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.expense-date {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.expense-amount {
  white-space: nowrap;
  color: var(--accent-strong);
  font-size: 1rem;
  font-weight: 900;
}

.empty {
  margin: 12px 0;
  color: var(--muted);
  text-align: center;
}

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

  .entry-form {
    grid-template-columns: 1fr 1.4fr;
    align-items: end;
  }

  .entry-form label {
    grid-row: auto;
  }

  .entry-form input {
    grid-row: 2;
  }

  .entry-form button {
    grid-column: 1 / -1;
  }

  .message {
    grid-column: 1 / -1;
  }

  .settings-form {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .settings-form label,
  .settings-form input {
    grid-column: 1;
  }

  .settings-form button {
    grid-column: 2;
    grid-row: 2;
    width: 128px;
  }

  .settings-form .message {
    grid-column: 1 / -1;
  }
}
