:root {
  --bg: #f0f6f8;
  --panel: #ffffff;
  --ink: #071116;
  --muted: #65737d;
  --line: #d8e6eb;
  --brand: #008a9a;
  --brand-dark: #0d4d59;
  --good: #11875d;
  --bad: #c43d32;
  --shadow: 0 18px 46px rgba(7, 17, 22, 0.09);
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

.shell {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto;
  padding: 34px 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.4rem, 7vw, 5.3rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.12rem;
}

.hero p {
  max-width: 700px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-price,
.panel,
.summary-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-price {
  display: grid;
  gap: 2px;
  min-width: 170px;
  padding: 18px;
}

.hero-price span,
.panel-title span,
.summary-card span {
  color: var(--muted);
}

.hero-price strong {
  color: var(--brand-dark);
  font-size: 2rem;
  line-height: 1;
}

.top-grid {
  display: grid;
  grid-template-columns: 0.75fr 1.3fr 1fr;
  gap: 16px;
  align-items: start;
}

.panel {
  padding: 20px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.compact-form {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-items: end;
}

#addExpenseForm {
  grid-template-columns: 1fr 1fr auto;
}

label {
  display: grid;
  gap: 7px;
  color: var(--brand-dark);
  font-size: 0.9rem;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #f9fcfd;
}

.prefix,
.suffix {
  display: grid;
  align-items: center;
  min-height: 44px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fcfd;
}

.prefix {
  grid-template-columns: 34px 1fr;
}

.suffix {
  grid-template-columns: 1fr 42px;
}

.prefix input,
.suffix input {
  min-height: 42px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.prefix span,
.suffix span {
  color: var(--muted);
  text-align: center;
  font-weight: 850;
}

.primary-button,
.delete-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 850;
}

.primary-button {
  padding: 0 16px;
  color: #ffffff;
  background: var(--brand);
}

.delete-button {
  min-width: 38px;
  color: var(--bad);
  background: #fdebea;
}

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

.summary-card {
  display: grid;
  gap: 6px;
  min-height: 112px;
  padding: 18px;
}

.summary-card strong {
  align-self: end;
  font-size: clamp(1.45rem, 3vw, 2.25rem);
  line-height: 1;
}

.summary-card.highlight {
  border-color: rgba(0, 138, 154, 0.45);
}

.sheet-panel {
  margin-top: 16px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: #f7fbfc;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td {
  background: #ffffff;
  font-weight: 720;
}

tfoot th {
  color: var(--ink);
  background: #eaf6f7;
}

.positive {
  color: var(--good);
}

.negative {
  color: var(--bad);
}

.empty-row td {
  color: var(--muted);
  font-weight: 600;
  text-align: center;
}

@media (max-width: 1100px) {
  .top-grid,
  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .compact-form,
  #addExpenseForm {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1280px);
    padding: 20px 0;
  }

  .hero,
  .top-grid,
  .summary-grid,
  .compact-form,
  #addExpenseForm {
    grid-template-columns: 1fr;
  }

  .hero-price {
    width: 100%;
  }

  .panel {
    padding: 16px;
  }

  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }
}
