:root {
  --bg: #f2ede2;
  --bg-strong: #efe5d1;
  --surface: rgba(255, 250, 241, 0.82);
  --surface-strong: #fffaf1;
  --line: rgba(64, 39, 19, 0.12);
  --text: #22160c;
  --muted: #6b584a;
  --accent: #c9652c;
  --accent-strong: #9f4314;
  --green: #25664b;
  --red: #8d3326;
  --shadow: 0 24px 60px rgba(71, 44, 16, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Source Sans 3", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(201, 101, 44, 0.2), transparent 30%),
    radial-gradient(circle at bottom right, rgba(37, 102, 75, 0.16), transparent 35%),
    linear-gradient(135deg, #f7f0e3 0%, #ece4d8 40%, #efe8db 100%);
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 24px;
  align-items: end;
  margin-bottom: 28px;
}

.hero__copy,
.hero__badge-panel,
.panel {
  backdrop-filter: blur(16px);
}

.hero__copy {
  background: linear-gradient(135deg, rgba(255, 250, 241, 0.9), rgba(247, 237, 222, 0.82));
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 32px;
}

.eyebrow,
.panel__kicker,
.hero__badge-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.74rem;
  color: var(--muted);
}

.hero h1,
.panel h2,
.section-heading h3 {
  font-family: "Space Grotesk", sans-serif;
  margin: 0;
}

.hero h1 {
  font-size: clamp(2.4rem, 4vw, 4.4rem);
  line-height: 0.96;
  max-width: 11ch;
}

.hero__text {
  margin: 18px 0 0;
  max-width: 56ch;
  font-size: 1.08rem;
  color: var(--muted);
}

.hero__badge-panel {
  display: grid;
  gap: 16px;
}

.hero__badge {
  background: rgba(34, 22, 12, 0.9);
  color: #fff7ec;
  border-radius: var(--radius-lg);
  padding: 22px;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.hero__badge strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.4rem;
}

.app-grid {
  display: grid;
  gap: 24px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 24px;
}

.panel__header--row,
.group-strip,
.section-heading,
.inline-form {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.tabs {
  display: inline-flex;
  padding: 6px;
  background: rgba(34, 22, 12, 0.06);
  border-radius: 999px;
  margin-bottom: 20px;
}

.tabs__button,
.button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, color 140ms ease;
}

.tabs__button {
  background: transparent;
  color: var(--muted);
  padding: 10px 16px;
}

.tabs__button.is-active {
  background: #24160d;
  color: #fff9ef;
}

.stack {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.participant-box legend {
  font-weight: 600;
}

.field input,
.field select,
.inline-form input {
  width: 100%;
  border: 1px solid rgba(64, 39, 19, 0.14);
  background: rgba(255, 252, 247, 0.92);
  color: var(--text);
  border-radius: 14px;
  padding: 13px 14px;
}

.field--compact select {
  min-width: 220px;
}

.button {
  padding: 12px 18px;
  font-weight: 700;
}

.button:hover,
.tabs__button:hover {
  transform: translateY(-1px);
}

.button--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff8ef;
}

.button--accent {
  background: linear-gradient(135deg, #1f6046, #3d8d6d);
  color: #f4fff9;
}

.button--ghost {
  background: rgba(34, 22, 12, 0.08);
  color: var(--text);
}

.status-message {
  min-height: 1.5em;
  margin: 14px 0 0;
  color: var(--muted);
}

.group-strip {
  margin: 22px 0 28px;
  flex-wrap: wrap;
}

.summary-grid,
.equivalent-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric-card,
.equivalent-card,
.history-item {
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.metric-card {
  padding: 18px;
}

.metric-card__label {
  display: block;
  color: var(--muted);
  margin-bottom: 12px;
}

.metric-card strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
}

.dashboard-section {
  margin-top: 28px;
}

.table-shell {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(64, 39, 19, 0.08);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.dashboard-section--split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 20px;
}

.expense-panel {
  border-radius: var(--radius-lg);
  background: rgba(255, 250, 241, 0.72);
  border: 1px solid var(--line);
  padding: 18px;
}

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

.participant-box,
.custom-share-box {
  border: 1px solid rgba(64, 39, 19, 0.12);
  border-radius: var(--radius-md);
  padding: 14px;
  background: rgba(255, 252, 247, 0.78);
}

.participant-list,
.custom-share-list,
.history-list {
  display: grid;
  gap: 12px;
}

.participant-row,
.custom-share-row,
.history-item__top,
.history-item__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.participant-row {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(34, 22, 12, 0.04);
}

.participant-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.custom-share-row input {
  max-width: 140px;
}

.equivalent-card,
.history-item {
  padding: 16px;
}

.equivalent-card__label,
.history-item__meta,
.history-item__participants {
  color: var(--muted);
}

.equivalent-card strong,
.history-item__amount {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
}

.history-item__participants {
  margin: 8px 0 0;
}

.history-item__actions {
  margin-top: 12px;
}

.history-item__actions button {
  background: rgba(141, 51, 38, 0.12);
  color: var(--red);
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}

.amount-positive {
  color: var(--green);
}

.amount-negative {
  color: var(--red);
}

.empty-state {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(64, 39, 19, 0.18);
  border-radius: var(--radius-md);
}

@media (max-width: 980px) {
  .hero,
  .dashboard-section--split,
  .summary-grid,
  .equivalent-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    max-width: none;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 20px;
  }

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

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .panel__header--row,
  .section-heading,
  .group-strip,
  .inline-form,
  .history-item__top,
  .history-item__meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .field--compact select,
  .inline-form,
  .inline-form input,
  .inline-form button {
    width: 100%;
  }
}
