:root {
  color-scheme: light;
  --paper: #f8f4ec;
  --surface: #fffdf8;
  --white: #fff;
  --green: #17372e;
  --deep: #102d25;
  --text: #20362c;
  --muted: #546257;
  --gold: #edcf97;
  --brass: #735524;
  --line: #dfd6c6;
  --bad: #8a3027;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--text); font: 400 1rem/1.55 var(--sans); }
a { color: inherit; text-underline-offset: .18em; }
:where(button, select, input, textarea) { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: wait; }
:focus-visible { outline: 2px solid #97642f; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: var(--serif); letter-spacing: -.03em; line-height: 1.12; }
h1 { font-size: clamp(2.3rem, 5vw, 4rem); font-weight: 600; }
h2 { font-size: clamp(1.65rem, 3vw, 2.4rem); font-weight: 650; }
h3 { font-size: 1.03rem; }
.wrap { max-width: 1240px; padding-inline: clamp(17px, 5vw, 60px); margin-inline: auto; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: absolute; top: 10px; left: 12px; z-index: 1; padding: 8px 12px; background: var(--white); }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner, .brand, .topbar nav { display: flex; align-items: center; }
.topbar-inner { min-height: 70px; justify-content: space-between; gap: 12px; }
.brand { gap: 10px; text-decoration: none; }
.brand img, .gate-card img { object-fit: cover; border: 1px solid var(--line); border-radius: 4px; background: var(--white); }
.brand strong { display: block; font: 700 1.06rem/1.25 var(--serif); }
.brand small { display: block; color: var(--muted); font-size: .77rem; }
.topbar nav { gap: clamp(8px, 3vw, 24px); font-size: .87rem; font-weight: 700; }
.topbar nav a { padding: 11px 0; white-space: nowrap; text-decoration: none; }
.topbar nav a:hover { text-decoration: underline; }

.panel-hero {
  color: var(--surface);
  background: radial-gradient(ellipse at 90% 0%, #2b5143 0%, transparent 58%), var(--green);
  border-bottom: 3px solid #c2a06b;
}
.hero-inner { display: flex; justify-content: space-between; align-items: end; gap: 18px; padding-block: clamp(26px, 5vw, 54px); }
.eyebrow { color: var(--brass); font-size: .75rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.panel-hero .eyebrow { color: var(--gold); margin-bottom: 9px; }
.panel-hero .eyebrow span { margin-inline: 4px; }
.panel-hero h1 + p { color: #f2e9dc; margin-top: 10px; }

.button {
  display: inline-flex; justify-content: center; align-items: center; gap: 7px; flex: 0 0 auto;
  min-height: 44px; padding: 8px 15px; border: 1px solid transparent; border-radius: 6px;
  font-size: .9rem; font-weight: 700; line-height: 1.25; text-decoration: none;
}
.button > span { font-size: 1.12em; }
.button.primary { background: var(--green); color: var(--white); }
.button.primary:hover:not(:disabled) { background: var(--deep); }
.button.gold { background: var(--gold); color: var(--deep); }
.button.gold:hover:not(:disabled) { background: #f5dba9; }
.button.quiet { border-color: var(--line); background: var(--surface); }
.button.quiet:hover:not(:disabled) { border-color: #ae9977; background: #f4ede0; }
.button.danger { border-color: #e5b7af; color: var(--bad); background: #fff8f6; }
.button.danger:hover:not(:disabled) { background: #f9e4df; }

.workspace { padding-block: 19px 48px; min-height: 57vh; }
.view-bar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.view-tabs { display: flex; gap: 4px; padding: 4px; background: #eee7db; border: 1px solid var(--line); border-radius: 7px; }
.view-tabs button { min-height: 37px; padding: 6px 14px; border: 0; border-radius: 4px; background: transparent; font-size: .9rem; font-weight: 700; }
.view-tabs button[aria-pressed="true"] { background: var(--surface); color: var(--green); box-shadow: 0 1px 2px #271a171c; }
.section-head { display: flex; gap: 14px; align-items: end; justify-content: space-between; margin-bottom: 16px; }
.section-head h2 { margin-block: 3px 7px; }
.section-head h2 + p, .catalog-explainer, .muted { color: var(--muted); font-size: .92rem; }
.filter, .field { display: grid; gap: 4px; min-width: 0; }
.filter > span, .field > span { font-size: .84rem; font-weight: 700; }
.field small { color: var(--muted); font-weight: 500; }
:is(.filter, .field, .search-field, .order-line-form) :is(input, select, textarea) {
  width: 100%; min-width: 0; min-height: 43px; padding: 8px 10px; border: 1px solid #cfc5b4;
  border-radius: 5px; background: var(--white); color: var(--text); font-size: 1rem;
}
.filter select { min-width: 148px; }
textarea { resize: vertical; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 19px; }
.stat {
  display: grid; text-align: left; gap: 4px; padding: clamp(10px, 2.3vw, 18px);
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
}
.stat:hover, .stat[aria-pressed="true"] { border-color: #527364; background: #edf3ed; }
.stat[aria-pressed="true"] { box-shadow: inset 0 0 0 1px #527364; }
.stat > span { display: flex; align-items: center; gap: 7px; font-size: .9rem; font-weight: 700; }
.stat strong { font-family: var(--serif); font-size: clamp(1.6rem, 4vw, 2.45rem); line-height: 1.08; }
.stat small { color: var(--muted); font-size: .78rem; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.dot.received { background: #ae7632; }
.dot.confirmed { background: #47785f; }
.dot.production { background: #52799d; }
.dot.closed { background: #6c7770; }

.list-card { border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.list-tools { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 12px 15px; border-bottom: 1px solid var(--line); }
.list-label { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.list-label span, .product-row small, .order-row small { color: var(--muted); font-size: .78rem; }
.search-field { width: min(100%, 280px); }
.order-list, .catalog-list, .detail-items { list-style: none; padding: 0; margin: 0; }
.order-row, .product-row {
  display: grid; gap: 12px; align-items: center; min-width: 0;
  padding: 11px 15px; border-bottom: 1px solid var(--line);
}
.order-row:last-child, .product-row:last-child { border-bottom: 0; }
.order-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.05fr) minmax(0, .9fr) minmax(84px, .6fr) auto; }
.order-row strong, .order-row small, .product-row strong, .product-row small { display: block; overflow-wrap: anywhere; }
.order-row .button, .product-row .button { min-height: 38px; padding: 6px 10px; }
.empty { text-align: center; padding: 34px 16px; }
.empty p { color: var(--muted); margin-top: 4px; font-size: .89rem; }
.badge { display: inline-block; width: max-content; max-width: 100%; border-radius: 4px; padding: 3px 8px; font-size: .76rem; font-weight: 700; }
.badge.received { background: #f4e9d4; color: #745221; }
.badge.confirmed, .badge.available { background: #e4eee4; color: #2c583d; }
.badge.production { background: #e2edf4; color: #34566f; }
.badge.closed, .badge.paused { background: #edede7; color: #46524a; }
.badge.soldout { background: #f7e6e1; color: #813a30; }

.catalog-tools { display: grid; grid-template-columns: minmax(140px, .75fr) minmax(140px, 1fr) minmax(160px, 1fr); gap: 12px; }
.catalog-explainer { margin: 10px 0 16px; }
.catalog-head, .product-row { grid-template-columns: minmax(0, 1.7fr) minmax(0, .75fr) minmax(0, 1fr) minmax(0, .7fr) auto; }
.catalog-head { display: grid; gap: 12px; padding: 10px 15px; border-bottom: 1px solid var(--line); font-size: .83rem; font-weight: 700; color: var(--muted); }
.catalog-head span:last-child { width: 57px; }
.product-row .mobile-label { display: none; }

.feedback { padding: 10px 12px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); font-size: .9rem; }
.feedback[data-tone="error"] { color: var(--bad); border-color: #e5b7af; background: #fff6f3; }
.feedback[data-tone="success"] { color: #24543a; border-color: #b3ccb8; background: #eef6ed; }
.bottom { padding-block: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .81rem; }

dialog {
  width: min(95vw, 650px); max-height: 90dvh; margin: auto; padding: 0;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text);
  box-shadow: 0 20px 58px #101c1652;
}
dialog::backdrop { background: #10241c9e; }
.dialog-head, .dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px clamp(13px, 4vw, 22px); background: var(--surface); }
.dialog-head { border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin-top: 3px; font-size: clamp(1.5rem, 4vw, 2.06rem); }
.dialog-foot { justify-content: end; flex-wrap: wrap; border-top: 1px solid var(--line); position: sticky; bottom: 0; }
.dialog-body { padding: 15px clamp(13px, 4vw, 22px); display: grid; gap: 12px; }
.dialog-body .feedback { margin: 0; }
.icon-button {
  display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; padding: 0;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 1.35rem; line-height: 1;
}
.icon-button:hover { background: #f4ede0; }
.form-grid, .offer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; align-items: start; }
.offer { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 9px; border: 1px solid var(--line); border-radius: 6px; }
.offer legend { padding-inline: 5px; font-size: .89rem; font-weight: 700; }
.items-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 9px; margin-block: 10px 5px; }
.items-head .button { min-height: 37px; }
.order-line-form { display: grid; grid-template-columns: minmax(0, 1fr) 74px 42px; align-items: end; gap: 7px; margin-top: 7px; }
.manual-line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 70px 110px 42px; padding: 9px; border: 1px solid var(--line); border-radius: 6px; }
.order-estimate { margin-top: 9px; color: var(--muted); font-size: .89rem; }
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 14px; margin: 0 0 15px; }
.detail-meta dt { color: var(--muted); font-size: .8rem; }
.detail-meta dd { margin: 0; overflow-wrap: anywhere; }
.detail-items li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.detail-items li strong { white-space: nowrap; }
.detail-total { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; }
.detail-note { margin-top: 9px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; font-size: .89rem; }
.detail-actions .close-confirmation { flex-basis: 100%; font-size: .88rem; }

.gate-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.gate-card { width: min(100%, 490px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: clamp(22px, 6vw, 40px); }
.gate-card h1 { font-size: clamp(2rem, 6vw, 2.8rem); margin-block: 4px 8px; }
.gate-card img { margin-bottom: 14px; }
.gate-card p + p { margin-top: 10px; }
.gate-card .button { margin-top: 17px; }
.gate-back { display: block; width: fit-content; margin-top: 12px; font-size: .87rem; }

@media (max-width: 650px) {
  .hero-inner, .section-head { align-items: start; flex-direction: column; }
  .hero-inner { gap: 13px; }
  .stat { gap: 3px; }
  .stat > span { gap: 4px; font-size: .74rem; }
  .stat small { font-size: .72rem; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .list-tools { align-items: stretch; flex-direction: column; }
  .search-field { width: 100%; }
  .order-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .order-row .order-date { grid-row: 2; grid-column: 1 / span 2; }
  .order-row .order-value { grid-row: 2; grid-column: 3; text-align: right; }
  .order-row .order-open { grid-row: 1; grid-column: 3; }
  .catalog-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .catalog-tools label:last-child { grid-column: span 2; }
  .catalog-tools select { min-width: 0; }
  .catalog-head { display: none; }
  .product-row { grid-template-columns: minmax(0, 1fr) minmax(0, .8fr) auto; gap: 6px 9px; }
  .product-row .product-name { grid-column: 1 / span 2; }
  .product-row .product-action { grid-column: 3; grid-row: 1; }
  .product-row .mobile-label { display: block; }
}
@media (max-width: 450px) {
  .brand strong { font-size: .91rem; }
  .brand img { width: 43px; height: 34px; }
  .topbar nav { font-size: .75rem; }
  .form-grid { grid-template-columns: 1fr; }
  .manual-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .manual-line .icon-button { grid-column: 2; justify-self: end; }
  .offer-grid { grid-template-columns: 1fr; }
}
