:root {
  color-scheme: light;
  --bg: #eef3f8;
  --bg-2: #dce8f4;
  --card: rgba(255, 255, 255, 0.88);
  --card-border: rgba(18, 35, 58, 0.12);
  --text: #142033;
  --muted: #5a6a7f;
  --accent: #0f766e;
  --accent-2: #155e75;
  --good: #12805c;
  --warn: #b45309;
  --bad: #b91c1c;
  --shadow: 0 20px 45px rgba(16, 24, 40, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Trebuchet MS", "Lucida Grande", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(21, 94, 117, 0.22), transparent 35%),
    radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.18), transparent 28%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}

.shell {
  width: min(1400px, calc(100% - 24px));
  margin: 0 auto;
  padding: 12px;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.sidebar, .panel { padding: 20px; }

.sidebar {
  position: sticky;
  top: 12px;
  align-self: start;
  height: fit-content;
}

.sidebar-head, .panel-head, .row, .expense-grid, .hero, .hero-actions { display: flex; gap: 10px; }
.sidebar-head, .panel-head, .hero { justify-content: space-between; align-items: center; }
.hero {
  padding: 24px;
  margin-bottom: 18px;
}

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

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 1.7rem; }
h2 { margin-bottom: 6px; font-size: clamp(1.8rem, 3vw, 2.6rem); }
h3 { margin-bottom: 0; font-size: 1.1rem; }

.lead { margin-bottom: 0; color: var(--muted); max-width: 60ch; }

input, select, button {
  font: inherit;
}

input, select {
  width: 100%;
  border: 1px solid rgba(20, 32, 51, 0.15);
  border-radius: 14px;
  padding: 0.82rem 0.95rem;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
}

button {
  border: 0;
  border-radius: 14px;
  padding: 0.82rem 1rem;
  background: #d7e2ec;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}
button:hover { transform: translateY(-1px); }
button.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: white; }
button.danger { background: rgba(185, 28, 28, 0.1); color: var(--bad); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.row { margin: 14px 0; }

.trip-list, .chips, .expenses, .balances, .settlements {
  display: grid;
  gap: 10px;
}

.trip-item {
  text-align: left;
  width: 100%;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(20, 32, 51, 0.12);
}

.trip-item.active {
  background: rgba(15, 118, 110, 0.12);
  border-color: rgba(15, 118, 110, 0.3);
}

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-2);
  border: 1px solid rgba(15, 118, 110, 0.18);
  font-size: 0.92rem;
}

.chip button {
  margin-left: 8px;
  padding: 0;
  background: transparent;
  color: inherit;
  font-weight: 900;
}

.expense-item {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(20, 32, 51, 0.1);
}

.expense-grid { align-items: center; }
.expense-label { flex: 1.3; }
.expense-amount { flex: 0.8; }
.expense-payer { flex: 1; }
.remove-expense { flex: 0 0 auto; }

.split-box { margin-top: 12px; }
.split-box p { margin-bottom: 10px; color: var(--muted); }
.participants { display: flex; flex-wrap: wrap; gap: 10px; }
.participants label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(20, 32, 51, 0.1);
  cursor: pointer;
}

.summary, .balance-item, .settlement-item {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(20, 32, 51, 0.1);
}
.summary { margin-bottom: 14px; }
.muted { color: var(--muted); }
.balance-item strong { display: inline-block; min-width: 120px; }
.positive { color: var(--good); font-weight: 700; }
.negative { color: var(--bad); font-weight: 700; }
.neutral { color: var(--warn); font-weight: 700; }

@media (max-width: 1050px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}

@media (max-width: 720px) {
  .shell { width: min(100% - 14px, 1400px); padding: 7px; }
  .sidebar, .panel, .hero { padding: 16px; }
  .expense-grid, .row, .hero, .sidebar-head { flex-direction: column; align-items: stretch; }
  .hero-actions { justify-content: stretch; }
  .hero-actions button { width: 100%; }
}
