:root {
  color-scheme: light;
  --ink: #251a16;
  --muted: #6e625b;
  --line: #e9e0d4;
  --surface: #fffefa;
  --wine: #842427;
  --wine-dark: #5b181e;
  --cream: #fbf8f1;
}
* { box-sizing: border-box }
[hidden] { display: none !important }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.5 system-ui, sans-serif;
}
.wrap { width: min(calc(100% - 48px), 1120px); margin-inline: auto }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line) }
.header-inner, .header-actions, .intro, .section-heading, .actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-inner, .intro, .section-heading { justify-content: space-between }
.header-inner { min-height: 76px }
.brand { display: flex; align-items: center; gap: 12px; color: var(--wine-dark); font-weight: 760; text-decoration: none }
.brand img { object-fit: contain }
a { color: var(--wine-dark); text-underline-offset: 3px }
main { padding-block: 36px 48px }
h1, h2, h3, p { margin: 0 }
h1, h2 { line-height: 1.15; letter-spacing: -.035em; font-family: Georgia, serif }
h1 { font-size: clamp(2rem, 5vw, 3rem) }
h2 { font-size: clamp(1.45rem, 4vw, 1.95rem) }
h3 { font-size: 1rem }
p { margin-block: 5px }
.muted { color: var(--muted) }
.panel, .product, .record, dialog {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
}
.panel, dialog { padding: clamp(15px, 3vw, 25px) }
.login { max-width: 460px; display: grid; align-items: start; gap: 18px; margin: 28px auto; }
.login a { font-size: .94rem }
label { display: grid; gap: 5px; color: var(--ink); font-size: .92rem; font-weight: 670; min-width: 0 }
small { font-weight: 470; color: var(--muted); line-height: 1.35 }
button, input, textarea, select { font: inherit; color: inherit }
button, input:not([type=checkbox]), textarea, select {
  border: 1px solid #d8cbbd;
  border-radius: 7px;
  background: #fff;
  padding: 9px 12px;
}
input:not([type=checkbox]), select, textarea { width: 100%; min-width: 0; min-height: 44px }
input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--wine) }
textarea { resize: vertical }
button { min-height: 42px; font-weight: 700; cursor: pointer; color: var(--wine-dark) }
button:not(:disabled):hover { border-color: var(--wine) }
button:disabled { opacity: .55; cursor: default }
.primary, .nav button[aria-pressed=true] { background: var(--wine); color: #fff; border-color: var(--wine) }
.primary:not(:disabled):hover { background: var(--wine-dark) }
:focus-visible { outline: 3px solid #ad701b; outline-offset: 3px }
.notice, .dialog-error { margin-block: 0 18px; padding: 10px 14px; border-radius: 8px; color: #4d442c; background: #f6ecd3 }
.notice[data-error=true], .dialog-error { color: #7d2220; background: #f7e5df }
.intro { margin-bottom: 18px }
.actions, .nav, .checks { flex-wrap: wrap }
.nav { display: flex; gap: 6px; margin-bottom: 22px; padding: 5px; background: #f0e8da; border-radius: 9px; width: fit-content; max-width: 100% }
.nav button { border-color: transparent; background: transparent }
.view, .stack { display: grid; gap: 10px }
.view { gap: 16px }
.short-field { max-width: 365px }
.catalog-tools {
  display: grid;
  grid-template-columns: minmax(230px, 365px) minmax(190px, 250px);
  gap: 12px;
}
.product-summary {
  display: inline-grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, .32fr) minmax(120px, .32fr);
  width: calc(100% - 20px);
  gap: 12px;
  vertical-align: top;
  align-items: center;
}
.product-identity, .product-metric { display: grid; gap: 3px; min-width: 0 }
.product-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px }
.product-metric { padding-inline-start: 12px; border-inline-start: 1px solid var(--line); font-variant-numeric: tabular-nums }
.product-metric small { font-size: .78rem }
.logistics-missing { color: var(--muted); font-weight: 530 }
.logistics-provisional { color: #775322; font-weight: 650 }
.product-metric .logistics-provisional { font-size: .78rem; font-weight: 530 }
.view .panel { display: grid; gap: 16px }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px }
.checks { display: flex; gap: 14px 22px }
.checks label, .check { display: flex; align-items: center; gap: 8px; min-height: 30px }
.product summary, .record summary {
  cursor: pointer;
  padding: 12px 15px;
  font-weight: 700;
}
.product summary::marker, .record summary::marker { color: var(--wine) }
.product-title { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; vertical-align: middle }
.tag {
  display: inline-block;
  border-radius: 20px;
  background: #f0e8da;
  padding: 2px 8px;
  font-size: .79rem;
  font-weight: 690;
  vertical-align: middle;
}
#mode { margin-top: 7px }
.tag.pending { background: #f6ecd3; color: #645226 }
.tag.confirmed { background: #e4efe5; color: #356042 }
.tag.rejected { background: #f7e5df; color: #7d2220 }
.product-body, .record-body { padding: 12px 15px 16px; border-top: 1px solid var(--line); display: grid; gap: 14px }
.product-body fieldset { min-width: 0; display: grid; gap: 8px; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px }
.product-body legend { padding: 0 4px; font-size: .9rem; font-weight: 690 }
.reward-row { display: grid; grid-template-columns: minmax(150px, 2fr) 1fr .75fr .75fr auto; align-items: end; gap: 10px }
.help { max-width: 670px; margin-top: 30px; padding: 12px 0; color: var(--muted) }
.help summary { cursor: pointer; font-weight: 650 }
.help pre { overflow-wrap: anywhere; white-space: pre-wrap; background: #f0e8da; padding: 10px; border-radius: 7px }
dialog { width: min(calc(100% - 32px), 490px); color: var(--ink) }
dialog::backdrop { background: #281b16a8 }
dialog form { display: grid; gap: 13px }
#customer-dialog, #business-edit-dialog, #business-decision-dialog { width: min(calc(100% - 32px), 670px) }
#company-create { display: grid; min-width: 0; gap: 10px; border: 1px solid var(--line); border-radius: 8px; margin: 0; padding: 10px 12px }
#company-create legend { padding: 0 4px; font-weight: 690 }
#pending-count { margin-inline-start: 4px }
#business-approval .check { align-items: start }
@media (max-width: 440px) { #admin-name { display: none } }
.business-pending { border-inline-start: 4px solid #be8a3c }
.record-body p { overflow-wrap: anywhere }
.record-body .actions { justify-content: flex-start }
.record-note { white-space: pre-wrap }
.customer-headline small, .business-headline small { font-size: .86rem }
.dialog-error { margin-block: 0 }
.record-body dl { display: grid; grid-template-columns: max-content minmax(0,1fr); gap: 4px 10px; margin: 0 }
.record-body dd { margin: 0; overflow-wrap: anywhere }
.record-body ul { margin-block: 0; padding-left: 24px }
.record-body button { justify-self: start }
.record-body dt { color: var(--muted) }
@media (max-width: 640px) {
  .wrap { width: calc(100% - 28px) }
  main { padding-top: 22px }
  .intro, .section-heading { align-items: flex-start; flex-direction: column }
  .reward-row { grid-template-columns: 1fr 1fr; align-items: end; padding-block: 10px; border-bottom: 1px solid var(--line) }
  .reward-row label:first-child { grid-column: 1/-1 }
  .header-actions { gap: 8px; font-size: .9rem }
  .catalog-tools, .record-body dl { grid-template-columns: 1fr }
  .product-summary { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px }
  .product-identity { grid-column: 1 / -1 }
  .record-body dd { margin-bottom: 3px }
}
