:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #272426;
  background: #f6f5f4;
  font-synthesis: none;
  --ink: #272426;
  --muted: #706b6c;
  --line: #e8e3e1;
  --surface: #fff;
  --red: #b82920;
  --red-dark: #951d17;
  --red-light: #fff0ed;
  --shadow: 0 12px 32px rgba(39, 28, 27, .045), 0 1px 2px rgba(39, 28, 27, .04);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
a { color: var(--red-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(184, 41, 32, .3); outline-offset: 2px; }
header {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 12px max(28px, calc((100vw - 1440px) / 2));
  background: #fff;
  border-bottom: 1px solid #e5dfdd;
  box-shadow: 0 2px 14px rgba(35, 26, 25, .035);
}
.brand { display: flex; align-items: center; gap: 12px; flex: none; min-width: 0; color: var(--ink); font-weight: 750; }
.brand:hover { text-decoration: none; }
.brand span { display: block; font-size: 14px; line-height: 1.2; white-space: nowrap; }
.brand small { display: block; margin-top: 4px; color: #777173; font-size: 10px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; }
nav { display: flex; align-items: center; gap: 3px; min-width: 0; flex: 1; }
nav a { display: inline-flex; align-items: center; min-height: 42px; padding: 0 12px; border-radius: 8px; color: #615b5d; font-size: 13px; font-weight: 650; white-space: nowrap; transition: background .16s, color .16s; }
nav a:hover { background: #f6f3f2; color: var(--ink); text-decoration: none; }
nav a.active { background: var(--red-light); color: var(--red-dark); }
.account { display: flex; align-items: center; gap: 11px; color: #615b5d; font-size: 13px; white-space: nowrap; }
.account form { margin: 0; }
.account button, .text-button { border: 0; background: none; color: var(--red-dark); font-size: 13px; font-weight: 700; padding: 6px 0; }
.account button:hover, .text-button:hover { text-decoration: underline; }
main { max-width: 1440px; margin: 0 auto; padding: 34px 28px 72px; }
.page-head, .section-head, .actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head { margin-bottom: 25px; }
.page-head h1 { margin: 0; font-size: clamp(28px, 2.4vw, 36px); line-height: 1.12; letter-spacing: -.045em; font-weight: 760; }
.today { color: #898182; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.muted, .hint { color: var(--muted); line-height: 1.55; }
.hint { font-size: 13px; }
.actions { justify-content: flex-start; margin: 0 0 22px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 10px 16px; border: 1px solid #ded6d3; border-radius: 9px; background: #fff; color: #403638; font-size: 13px; font-weight: 700; line-height: 1.25; box-shadow: 0 1px 2px rgba(35, 26, 25, .035); transition: background .16s, border-color .16s, box-shadow .16s, transform .16s; }
.button:hover { background: #faf6f5; border-color: #cfc1bd; text-decoration: none; box-shadow: 0 4px 12px rgba(35, 26, 25, .07); transform: translateY(-1px); }
.button.primary { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 3px 9px rgba(184, 41, 32, .14); }
.button.primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.button.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.button.danger { color: #a2241c; border-color: #e4b7b1; background: #fff8f6; }
.button.danger:hover { background: #ffebe7; }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 15px; margin: 0 0 24px; }
.cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card, .panel, .form-shell { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.card { position: relative; overflow: hidden; min-height: 128px; padding: 21px 20px 18px; }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: #d5cfcd; }
.card:nth-child(2)::before, .card:nth-child(4)::before { background: var(--red); }
.card span { display: block; color: #736b6d; font-size: 12px; font-weight: 700; }
.card strong { display: block; margin: 14px 0 6px; color: #2d292a; font-size: clamp(21px, 2vw, 29px); font-weight: 760; letter-spacing: -.045em; line-height: 1.12; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.card small { color: #898184; font-size: 11px; line-height: 1.4; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.vendor-layout { grid-template-columns: 330px minmax(0, 1fr); }
.panel { padding: 23px; margin-bottom: 20px; }
.panel h2 { margin: 0 0 17px; font-size: 17px; font-weight: 750; letter-spacing: -.02em; }
.panel > .muted, .panel > .hint { margin-top: -4px; }
.section-head { margin-bottom: 15px; }
.section-head h2 { margin: 0; }
.section-head a { font-size: 12px; font-weight: 750; }
.table-wrap { overflow-x: auto; border: 1px solid #efebea; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
th { background: #faf8f7; color: #7d7476; font-size: 10px; font-weight: 750; letter-spacing: .075em; text-transform: uppercase; white-space: nowrap; }
th, td { padding: 13px 12px; border-bottom: 1px solid #f0eceb; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fdfbfa; }
td { color: #423b3d; font-variant-numeric: tabular-nums; }
td:last-child { max-width: 230px; }
.empty { padding: 29px; text-align: center; color: #8d8486; }
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: 10px; font-weight: 750; white-space: nowrap; }
.pill.inventory { background: #edf4ef; color: #397153; }
.pill.partial { background: #fff2df; color: #916326; }
.pill.sold { background: #f0eded; color: #766f70; }
.filter { margin-bottom: 14px; }
.filter input { max-width: 350px; }
.form-shell { max-width: 790px; padding: 28px; }
.form-shell.wide { max-width: 1100px; }
.form-shell > p:first-child { margin: 0 0 22px; }
.entry-form { display: grid; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.entry-form label, .report-filter label { display: grid; gap: 7px; color: #50484a; font-size: 12px; font-weight: 700; }
.entry-form label small { color: #898183; font-size: 11px; font-weight: 450; }
input, textarea, select { width: 100%; min-height: 41px; padding: 10px 12px; outline: none; border: 1px solid #dcd5d3; border-radius: 8px; background: #fff; color: var(--ink); font-size: 13px; transition: border-color .16s, box-shadow .16s; }
input:hover, textarea:hover, select:hover { border-color: #c6bcb9; }
input:focus, textarea:focus, select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(184, 41, 32, .12); }
input[readonly] { background: #f7f5f4; color: #776e70; }
textarea { resize: vertical; }
.form-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 4px; }
.alert { margin: 0 0 20px; padding: 12px 15px; border: 1px solid; border-radius: 9px; font-size: 13px; font-weight: 600; }
.alert.ok { background: #f0f7f1; border-color: #d4ead8; color: #326c42; }
.alert.bad { background: #fff1ed; border-color: #f0d1c9; color: #9d3324; }
.lot-table input[type=checkbox] { width: 17px; height: 17px; min-height: auto; accent-color: var(--red); }
.lot-table input[type=number] { width: 86px; padding: 7px 8px; }
.lot-table tr.selected { background: #fff4f1; }
.report-filter { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.report-filter label { min-width: 175px; }
.details { display: flex; gap: 36px; flex-wrap: wrap; margin: 0 0 28px; }
.details dt { color: #8a8183; font-size: 10px; font-weight: 750; letter-spacing: .075em; text-transform: uppercase; }
.details dd { margin: 5px 0; color: #393334; font-size: 15px; font-weight: 700; }
.text-link { color: var(--red-dark); font-weight: 700; }
.inline-form { display: flex; align-items: center; gap: 6px; }
.inline-form input { min-width: 130px; width: 140px; padding: 7px 9px; }
.price-reduction-form input { min-width: 68px; width: 75px; }
.price-reduction-form span { color: var(--muted); font-size: 13px; }
.delete-form { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
summary { cursor: pointer; color: var(--red-dark); font-size: 14px; font-weight: 700; }
details.panel[open] summary { margin-bottom: 18px; }
.reports-dropdown { position: relative; flex: none; }
.reports-dropdown summary { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px; border-radius: 8px; color: #615b5d; font-size: 13px; font-weight: 650; white-space: nowrap; list-style: none; }
.reports-dropdown summary::-webkit-details-marker { display: none; }
.reports-dropdown summary::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.reports-dropdown[open] summary::after { transform: translateY(2px) rotate(225deg); }
.reports-dropdown summary:hover, .reports-dropdown[open] summary { background: #f6f3f2; color: var(--ink); }
.reports-dropdown summary.active { background: var(--red-light); color: var(--red-dark); }
.reports-menu { position: absolute; z-index: 30; top: calc(100% + 7px); left: 0; min-width: 220px; padding: 7px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 16px 36px rgba(39,28,27,.14); }
.reports-menu a { display: flex; min-height: 37px; padding: 8px 10px; border-radius: 6px; }
.search-placeholder { max-width: 650px; }
.search-lookup { max-width: 760px; }
.search-form { display: grid; gap: 16px; }
.search-query-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; }
.search-price-list { max-width: 430px; }
.search-list-caption { margin: 0 0 14px; }
.search-form input { min-height: 46px; font-size: 16px; }
.search-form button { min-height: 46px; }
.search-live-status { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.search-live-status:empty { display: none; }
.search-results { max-width: 760px; }
.receipt-add-form { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.receipt-add-form select { width: auto; min-width: 85px; min-height: 32px; padding: 5px 25px 5px 8px; font-size: 12px; }
.receipt-add-button { min-height: 32px; padding: 6px 11px; }
.receipt-add-toast { position: fixed; z-index: 60; left: 50%; top: 105px; transform: translateX(-50%); min-width: 110px; max-width: min(90vw,430px); padding: 12px 22px; border: 1px solid #b8d9bf; border-radius: 12px; background: #f2fbf4; box-shadow: 0 14px 36px rgba(21,37,23,.18); color: #22603c; font-size: 16px; font-weight: 800; text-align: center; }
.receipt-add-toast[hidden] { display: none; }
.receipt-add-toast.is-error { border-color: #e4b8ae; background: #fff5f1; color: #9d3324; font-size: 13px; }
@media (max-width: 540px) { .search-query-row { grid-template-columns: 1fr; } }
.receipt-builder { margin-bottom: 28px; }
.receipt-builder > .panel { max-width: 780px; }
.receipt-vendor-select { max-width: 780px; margin: 0 auto 18px; }
.receipt-vendor-select h2 { margin-bottom: 6px; }
.receipt-vendor-select p { margin: 0 0 16px; }
.receipt-vendor-form { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.receipt-vendor-form label { width: 100%; color: #50484a; font-size: 12px; font-weight: 700; }
.receipt-vendor-form select { flex: 1 1 230px; max-width: 430px; }
.receipt-draft-actions { max-width: 780px; margin: 0 auto 14px; }
.receipt-draft-actions form { margin: 0 0 0 auto; }
.receipt-average-toggle { display: inline-flex; align-items: center; gap: 9px; min-height: 40px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.receipt-average-toggle:hover { border-color: var(--red); }
.receipt-average-toggle:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.receipt-average-switch { position: relative; display: inline-block; width: 30px; height: 18px; border-radius: 20px; background: #a9a2a2; transition: background .15s; }
.receipt-average-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: transform .15s; }
.receipt-average-toggle[aria-pressed="true"] .receipt-average-switch { background: var(--red); }
.receipt-average-toggle[aria-pressed="true"] .receipt-average-switch::after { transform: translateX(12px); }
.receipt-average-value[hidden] { display: none; }
.receipt-share-status { color: #397153; font-size: 12px; font-weight: 700; }
.receipt-save-dialog { width: min(430px,calc(100% - 32px)); padding: 26px; border: 1px solid var(--line); border-radius: 16px; background: #fff; color: var(--ink); box-shadow: 0 24px 75px rgba(23,19,20,.24); }
.receipt-save-dialog::backdrop { background: rgba(20,17,18,.55); }
.receipt-save-dialog h2 { margin: 0 0 10px; font-size: 22px; }
.receipt-save-dialog p { margin: 0 0 23px; color: var(--muted); line-height: 1.5; }
.receipt-save-dialog .actions { justify-content: flex-end; margin: 0; gap: 8px; }
.receipt-custom-dialog .entry-form { margin-top: 20px; }
.receipt-custom-dialog { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; }
.receipt-custom-dialog input { font-size: 16px; }
.receipt-custom-dialog .actions { margin-top: 5px; }
.receipt-draft-actions button[disabled] { opacity: .6; cursor: wait; }
.receipt-draft-table { margin-top: 30px; }
.receipt-draft-table th:nth-child(2), .receipt-draft-table th:nth-child(3), .receipt-draft-table th:nth-child(4), .receipt-draft-table td:nth-child(2), .receipt-draft-table td:nth-child(3), .receipt-draft-table td:nth-child(4) { text-align: right; white-space: nowrap; }
.receipt-quantity { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; font-variant-numeric: tabular-nums; }
.receipt-quantity form { margin: 0; }
.receipt-quantity-add { width: 34px; height: 34px; padding: 0; border: 1px solid #e5b6b4; border-radius: 8px; background: #fff7f6; color: var(--red-dark); font: inherit; font-size: 22px; font-weight: 700; line-height: 1; cursor: pointer; }
.receipt-quantity-add:hover { border-color: var(--red); background: #ffeae8; }
.receipt-quantity-add:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.receipt-quantity-add:disabled { opacity: .5; cursor: wait; }
.receipt-price-form { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.receipt-price-form > span { color: var(--muted); font-weight: 700; }
.receipt-price-form input[type="number"] { width: 78px; min-height: 32px; padding: 5px 6px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.receipt-price-form button { min-height: 32px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--red-dark); font-size: 11px; font-weight: 800; cursor: pointer; }
.receipt-price-form button:hover { border-color: var(--red); background: #fff7f5; }
.receipt-price-print { display: none; }
.receipt-draft-total { display: flex; align-items: baseline; justify-content: flex-end; gap: 24px; margin-top: 24px; padding-top: 18px; border-top: 2px solid var(--red); }
.receipt-draft-total span { color: var(--muted); font-size: 13px; font-weight: 750; }
.receipt-draft-total strong { font-size: 29px; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.receipt-sheet { max-width: 780px; margin: 0 auto; padding: 42px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.receipt-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 24px; border-bottom: 3px solid var(--red); }
.receipt-heading img { width: min(45%,250px); height: auto; background: #d2cccb; border-radius: 4px; }
.receipt-heading div { text-align: right; }
.receipt-heading strong, .receipt-heading span { display: block; }
.receipt-heading strong { font-size: 18px; }
.receipt-heading span { margin-top: 5px; color: var(--muted); }
.receipt-heading .receipt-vendor { max-width: 50%; overflow-wrap: anywhere; }
.receipt-heading .receipt-vendor-label { color: var(--red-dark); font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.receipt-heading .receipt-vendor strong { margin-top: 7px; }
.receipt-meta, .receipt-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 22px; margin-top: 30px; }
.receipt-meta.has-average { grid-template-columns: repeat(3,minmax(0,1fr)); }
.receipt-meta span, .receipt-fields span, .receipt-notes span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.receipt-meta strong, .receipt-fields strong { font-size: 17px; }
.receipt-fields div:last-child strong { color: var(--red-dark); font-size: 27px; }
.receipt-notes { min-height: 95px; margin-top: 34px; }
.receipt-notes p { margin: 0; white-space: pre-wrap; }
.receipt-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 66px; }
.receipt-signatures div { padding-top: 9px; border-top: 1px solid #726c6d; color: var(--muted); font-size: 11px; }
.receipt-footnote { margin: 38px 0 0; color: var(--muted); font-size: 10px; }
@media (max-width: 1200px) {
  header { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand account" "nav nav"; gap: 9px 16px; }
  .brand { grid-area: brand; }
  nav { grid-area: nav; overflow: visible; }
  .account { grid-area: account; justify-self: end; }
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  main { padding: 24px 16px 54px; }
  header { padding: 12px 16px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .cards.three, .two-col, .vendor-layout { grid-template-columns: 1fr; }
  .card { min-height: 116px; padding: 18px 16px; }
  .card strong { font-size: 24px; }
  .form-grid { grid-template-columns: 1fr; }
  .panel, .form-shell { padding: 18px; }
  .page-head { align-items: start; }
  .page-head h1 { font-size: 29px; }
  .receipt-sheet { padding: 24px; }
}
@media (max-width: 520px) {
  .brand span { display: none; }
  .account { font-size: 11px; gap: 7px; }
  nav { margin: 0 -16px; padding: 0 16px 2px; }
  nav a { min-height: 38px; padding: 0 10px; font-size: 12px; }
  .reports-dropdown summary { min-height: 38px; padding: 0 10px; font-size: 12px; }
  .reports-menu a { min-height: 37px; padding: 8px 10px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .card { min-height: 104px; padding: 15px 13px; }
  .card strong { margin-top: 11px; font-size: 21px; }
  .card small { font-size: 10px; }
  .page-head { gap: 6px; }
  .today { width: 100%; }
  .report-filter label { width: 100%; }
  .form-actions .button { flex: 1; }
  .receipt-meta, .receipt-fields { grid-template-columns: 1fr; gap: 18px; }
  .receipt-meta.has-average { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .receipt-meta.has-average > :first-child { grid-column: 1 / -1; }
}
@media print {
  @page { margin: .55in; }
  body { background: #fff; }
  header, .page-head, .receipt-actions, .receipt-draft-actions, .receipt-vendor-select, .alert { display: none !important; }
  main { max-width: none; padding: 0; }
  .receipt-sheet { max-width: none; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
  .receipt-draft-sheet .receipt-draft-table th:last-child, .receipt-draft-sheet .receipt-draft-table td:last-child { display: none; }
  .receipt-quantity form { display: none; }
  .receipt-price-form { display: none; }
  .receipt-price-print { display: inline; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
