:root {
  color-scheme: light;
  --bg: #f6f3ee;
  --panel: #ffffff;
  --ink: #202124;
  --muted: #62676d;
  --line: #d8d1c7;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --input: #fbfaf8;
  --shadow: 0 18px 45px rgba(33, 31, 28, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.app-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 8px;
}

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

h1,
h2 {
  margin: 0;
}

h1 {
  max-width: 760px;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 1rem;
}

.header-actions,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.export-heading {
  align-items: center;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.bill-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.bill-fields {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 2fr);
  gap: 14px;
  margin-top: 16px;
}

.bill-fields label,
.batch-entry label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.section-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.receipt-render-root {
  position: fixed;
  top: 0;
  left: -10000px;
  width: 430px;
  pointer-events: none;
}

.receipt-export-card {
  width: 400px;
  padding: 22px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.receipt-export-card h2 {
  margin-bottom: 14px;
  font-size: 1.5rem;
}

.receipt-export-card table {
  min-width: 0;
  margin-bottom: 14px;
  font-size: 0.9rem;
}

.receipt-export-card th,
.receipt-export-card td {
  padding: 7px 6px;
}

.receipt-export-card .receipt-total {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 2px solid var(--ink);
  font-size: 1.15rem;
}

.panel {
  min-width: 0;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.wide {
  grid-column: 1 / -1;
}

.button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #ffffff;
  background: var(--accent);
  cursor: pointer;
  font-weight: 700;
}

.button:hover,
.button:focus-visible {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.button.secondary {
  color: var(--accent-strong);
  background: #e7f4f1;
}

.button.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f0b8b3;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid #efd0cc;
  border-radius: 6px;
  color: var(--danger);
  background: var(--danger-soft);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.table-wrap {
  width: 100%;
  margin-top: 14px;
  overflow-x: auto;
}

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

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

tfoot th,
tfoot td {
  border-top: 2px solid var(--ink);
  font-weight: 900;
}

.action-col {
  width: 76px;
  text-align: center;
}

.action-cell {
  text-align: center;
}

input,
select,
textarea {
  width: 100%;
  min-width: 92px;
  padding: 9px 10px;
  border: 1px solid #cfc7bd;
  border-radius: 6px;
  color: var(--ink);
  background: var(--input);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.16);
}

input[type="number"] {
  text-align: right;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.batch-entry {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.batch-entry .button {
  justify-self: start;
}

.person-col {
  min-width: 150px;
  font-weight: 800;
}

.numeric {
  text-align: right;
}

.total-pill {
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--ink);
  font-weight: 800;
  white-space: nowrap;
}

.final-total {
  font-weight: 900;
}

.empty-state {
  margin-top: 14px;
  padding: 16px;
  color: var(--muted);
  background: #faf8f4;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    grid-template-columns: 1fr;
    padding-top: 18px;
  }

  .app-header {
    display: block;
  }

  .header-actions {
    justify-content: flex-start;
    margin-top: 18px;
  }

  h1 {
    font-size: 2.25rem;
  }

  .panel {
    padding: 14px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .export-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .bill-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .bill-fields {
    grid-template-columns: 1fr;
  }
}
