:root {
  --accent: #0f766e;
  --border: #d8ddd6;
  --ink: #141a17;
  --muted: #59645f;
  --paper: #f8f5ee;
  --rust: #7a3e2f;
  --sky: #2f5f8f;
  --surface: #fcfbf7;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input,
textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
}

button {
  padding: 0.7rem 0.9rem;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.7rem;
  background: #fff;
  color: var(--ink);
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-bottom: 1.5rem;
}

.hero {
  display: grid;
  gap: 0.8rem;
  max-width: 58rem;
  margin-bottom: 2rem;
}

.hero h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 0.9;
}

.hero p:last-child {
  max-width: 46rem;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.invoice-grid,
.operator-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 1rem;
  align-items: start;
}

.panel {
  display: grid;
  gap: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  background: var(--surface);
  box-shadow: 0 24px 80px rgb(20 25 35 / 8%);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.8rem;
}

.section-heading h2 {
  margin: 0.25rem 0 0;
  font-size: 1.35rem;
}

.section-heading > strong {
  color: var(--rust);
  font-size: 1.35rem;
  text-align: right;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}

.stats div,
.totals div {
  display: grid;
  gap: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem;
  background: #fff;
}

.stats span,
.totals span,
.quiet {
  color: var(--muted);
}

.bit-list,
.totals {
  display: grid;
  gap: 0.6rem;
}

.bit-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
  background: #fff;
}

.bit-card.selectable {
  grid-template-columns: auto minmax(0, 1fr);
  color: var(--ink);
}

.bit-card.disabled {
  background: #f4efe8;
  color: var(--muted);
}

.bit-card h3,
.bit-card p {
  margin: 0;
}

.bit-card p,
small {
  color: var(--muted);
  line-height: 1.45;
}

.bit-card input[type='checkbox'] {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.2rem;
  accent-color: var(--accent);
}

.bit-card span {
  display: grid;
  gap: 0.25rem;
}

.rate-stack {
  display: grid;
  gap: 0.25rem;
  min-width: 9rem;
  color: var(--sky);
  font-size: 0.85rem;
  font-weight: 800;
  text-align: right;
}

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

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.notice {
  border: 1px solid #b8d4c6;
  border-radius: 8px;
  padding: 0.85rem;
  background: #eef8f2;
  color: #164c37;
  font-weight: 700;
}

.notice.error {
  border-color: #dcb8a6;
  background: #fff3ee;
  color: #7a3e2f;
}

.inline-check {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  justify-content: flex-end;
  color: var(--ink);
}

.inline-check input {
  width: 1rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.invoice-list,
.policy-form {
  display: grid;
  gap: 0.6rem;
}

.invoice-list button {
  text-align: left;
}

.policy-form {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.policy-form h3 {
  margin: 0;
}

.grand {
  border-color: var(--rust) !important;
}

.grand strong {
  color: var(--rust);
  font-size: 1.2rem;
}

.about-panel {
  max-width: 72rem;
}

.intro-panel {
  max-width: 76rem;
}

.about-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.about-copy {
  display: grid;
  gap: 0.85rem;
}

.intro-copy strong {
  color: var(--ink);
}

.about-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

@media (max-width: 820px) {
  .invoice-grid,
  .operator-grid,
  .stats,
  .form-grid,
  .about-stats {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .bit-card {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .rate-stack,
  .section-heading > strong {
    text-align: left;
  }
}