/* Rendered inside a HubSpot iframe. HubSpot's chrome is light, so light is the
   default, but the sheet honours a dark viewer too. */
:root {
  --bg: #ffffff;
  --surface: #f8fafc;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #16222f;
  --text-dim: #5a6b7d;
  --accent: #0b6ab8;
  --accent-soft: #e8f2fb;
  --ok: #1c7a4a;
  --warn-bg: #fff8e6;
  --warn-line: #e8cf94;
  --radius: 8px;
  --tap: 38px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10161d;
    --surface: #161f28;
    --line: #26333f;
    --line-strong: #354655;
    --text: #e7edf3;
    --text-dim: #93a4b5;
    --accent: #4da3e8;
    --accent-soft: #16293a;
    --ok: #4cc38a;
    --warn-bg: #2b2413;
    --warn-line: #5c4d24;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#root { padding: 16px 18px 24px; max-width: 1100px; }

.state {
  padding: 28px 4px;
  color: var(--text-dim);
}
.state.error { color: #b4232a; }

/* ── header ───────────────────────────────────────────────────────────── */
.head {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.head-main { min-width: 240px; flex: 1 1 320px; }

.event-name {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--text-dim);
  font-size: 12.5px;
}
.meta b { color: var(--text); font-weight: 600; }

.head-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.progress { min-width: 170px; text-align: right; }
.progress-bar {
  height: 6px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}
.progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ok);
  border-radius: 99px;
  transition: width 160ms ease;
}
.progress-label {
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.actions { display: flex; gap: 8px; }

.btn {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); color: #fff; }
.btn-ghost { background: transparent; }

/* ── add bar ──────────────────────────────────────────────────────────── */
.addbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 14px 0 0;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.in {
  min-height: var(--tap);
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.in:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
.in-name { flex: 1 1 220px; }
.in-qty { width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
.in-cat { flex: 0 0 150px; }

/* ── banner ───────────────────────────────────────────────────────────── */
.banner {
  margin: 14px 0 0;
  padding: 10px 12px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: var(--radius);
  font-size: 13px;
}

/* ── table ────────────────────────────────────────────────────────────── */
.table-wrap {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  max-height: 68vh;
}

.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.tbl th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  border-bottom: 1px solid var(--line-strong);
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  white-space: nowrap;
}

.tbl td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: none; }

/* Column sizing is explicit so the numeric columns stay wide enough for the
   inputs — the native HubSpot card failed precisely here. */
.c-supply { width: auto; min-width: 200px; }
.c-num    { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.c-packed { width: 78px;  text-align: center; }
.c-act    { width: 78px;  text-align: right; }

/* section header row */
.row-cat td {
  background: var(--accent-soft);
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 33px;
  z-index: 1;
}

.supply-name { font-weight: 500; }
tr.is-packed .supply-name {
  text-decoration: line-through;
  color: var(--text-dim);
}

.calc { color: var(--text-dim); }

.qty {
  width: 82px;
  min-height: var(--tap);
  padding: 0 8px;
  text-align: right;
  font: inherit;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}
.qty:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
.qty.is-override {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

/* Big hit area — this gets used on a tablet in a kitchen. */
.chk {
  width: 21px;
  height: 21px;
  accent-color: var(--ok);
  cursor: pointer;
}

.link-del {
  border: none;
  background: none;
  padding: 6px;
  font: inherit;
  font-size: 12.5px;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 4px;
}
.link-del:hover { color: #b4232a; }

.tbl tfoot td {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--line-strong);
  border-bottom: none;
  padding: 10px 12px;
  font-weight: 650;
}
.tbl tfoot .total { font-size: 15px; }

.row-empty td {
  padding: 26px 12px;
  text-align: center;
  color: var(--text-dim);
}

/* ── footer ───────────────────────────────────────────────────────────── */
.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-dim);
}

body.busy { cursor: progress; }
