:root {
  --bg: #0f1419;
  --surface: #1a222d;
  --border: #2a3544;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #5eb88a;
  --accent-dim: #3d8a63;
  --danger: #e07a7a;
  --radius: 10px;
  --font: "DM Sans", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.45;
  color: var(--text);
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, #1f3d2e 0%, transparent 55%),
    var(--bg);
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.header {
  margin-bottom: 1.75rem;
}

.header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 52ch;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
}

.card-title {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.card-head .card-title {
  margin-bottom: 0;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 560px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.label {
  font-size: 0.9rem;
  font-weight: 500;
}

.hint {
  font-size: 0.78rem;
  color: var(--muted);
}

input[type="number"],
input[type="text"] {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  width: 100%;
  max-width: 100%;
}

input:focus {
  outline: 2px solid var(--accent-dim);
  outline-offset: 1px;
}

input::placeholder {
  color: #5c6b7d;
}

.btn {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
}

.btn-secondary {
  background: var(--bg);
  color: var(--accent);
  border-color: var(--accent-dim);
}

.btn-secondary:hover {
  background: #243028;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--muted);
}

.btn-icon {
  padding: 0.35rem 0.55rem;
  font-size: 1.1rem;
  line-height: 1;
  background: transparent;
  color: var(--muted);
  border: none;
}

.btn-icon:hover {
  color: var(--danger);
}

.table-hint {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  margin: 0 -0.35rem;
  padding: 0 0.35rem;
}

.households-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.households-table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.4rem 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
}

.households-table td {
  padding: 0.5rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

.households-table tbody tr:last-child td {
  border-bottom: none;
}

.households-table input.name-input {
  min-width: 140px;
}

.households-table input.nights-input {
  width: 5rem;
}

.col-share,
.col-amount {
  text-align: right;
  white-space: nowrap;
}

.col-actions {
  width: 2.5rem;
  text-align: center;
}

.share-cell,
.amount-cell {
  font-variant-numeric: tabular-nums;
}

.amount-cell {
  font-weight: 600;
  color: var(--accent);
}

.summary-card {
  border-color: var(--accent-dim);
}

.summary {
  font-size: 0.95rem;
}

.summary p {
  margin: 0 0 0.65rem;
}

.summary p:last-child {
  margin-bottom: 0;
}

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

.summary .total-line {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-weight: 600;
}

.footer {
  margin-top: 1.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
