:root {
  --vendor-ink: #182124;
  --vendor-muted: #626664;
  --vendor-surface: #fffdf9;
  --vendor-page: #f4f1ea;
  --vendor-line: #e1dbcf;
  --vendor-gold: #dbc48f;
  --vendor-radius: 14px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--vendor-page);
  color: var(--vendor-ink);
  font: 400 14px/1.55 "Plus Jakarta Sans", system-ui, sans-serif;
}
.hidden { display: none !important; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
a { color: inherit; }
:focus-visible { outline: 2px solid #8a6226; outline-offset: 3px; }
.vendor-muted, .vendor-meta { color: var(--vendor-muted); }
.vendor-error { color: #97322a; overflow-wrap: anywhere; }
.vendor-error:empty { display: none; }
.vendor-wordmark {
  width: max-content;
  color: #fff8e7;
  text-decoration: none;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.085em;
}
.vendor-wordmark span { color: var(--vendor-gold); }

.vendor-auth-shell { min-height: 100svh; display: grid; grid-template-columns: 2fr 3fr; }
.vendor-auth-art {
  min-height: 260px;
  background: var(--vendor-ink);
  color: #fff8e7;
  padding: clamp(26px,6vw,88px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.vendor-auth-art h1 {
  max-width: 9ch;
  font-size: clamp(42px,6vw,84px);
  line-height: 1;
  font-weight: 500;
  letter-spacing: -.07em;
  margin: 0 0 22px;
}
.vendor-return { color: var(--vendor-gold); text-underline-offset: 4px; }
.vendor-auth-panel { display: grid; place-items: center; padding: 28px; }
.vendor-auth-panel form {
  width: min(100%, 430px);
  padding: clamp(22px,4vw,42px);
  border: 1px solid var(--vendor-line);
  border-radius: 18px;
  background: var(--vendor-surface);
}
.vendor-auth-panel h2 { font-size: 28px; letter-spacing: -.04em; margin: 0; font-weight: 500; }
.vendor-auth-panel p { margin: 6px 0 12px; }
.vendor-form, .vendor-form label { display: grid; gap: 10px; min-width: 0; }
.vendor-form label { gap: 5px; }
.vendor-primary { background: var(--vendor-ink); color: #fff8e7; }

.vendor-app { display: grid; grid-template-columns: 228px minmax(0,1fr); min-height: 100svh; }
.vendor-skip { position: fixed; top: 8px; left: 8px; z-index: 10; background: #fff; padding: 10px; transform: translateY(-150%); }
.vendor-skip:focus { transform: none; }
.vendor-sidebar {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  background: var(--vendor-ink);
  color: #fff8e7;
  padding: 24px 14px 14px;
}
.vendor-sidebar-top { display: flex; justify-content: space-between; align-items: center; padding-inline: 10px; }
.vendor-current-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0 18px;
  padding: 10px;
  border: 1px solid #ffffff26;
  border-radius: 9px;
  overflow-wrap: anywhere;
}
#vendorBrandLogo { flex: 0 0 36px; height: 36px; display: grid; place-items: center; border-radius: 6px; background: #f4e9cd; color: var(--vendor-ink); overflow: hidden; }
#vendorBrandLogo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.vendor-current-brand strong, .vendor-current-brand small { display: block; }
.vendor-current-brand strong { font-weight: 500; font-size: 13px; }
.vendor-current-brand small, .vendor-nav-group > span { color: #bec4bf; font-size: 11px; }
.vendor-sidebar nav { display: flex; flex: 1; flex-direction: column; gap: 16px; }
.vendor-nav-group { display: grid; gap: 3px; }
.vendor-nav-group > span { margin: 0 10px 4px; }
.vendor-sidebar nav button, .vendor-menu {
  min-height: 43px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #f3eee4;
  background: transparent;
  padding: 8px 11px;
}
.vendor-sidebar nav button:hover { background: #ffffff13; }
.vendor-sidebar nav button.selected {
  color: #f8e5ba;
  background: #ffffff16;
  box-shadow: inset 3px 0 var(--vendor-gold);
}
.vendor-sidebar-bottom { margin-top: auto; }
.vendor-sidebar-bottom button { width: 100%; border-color: #ffffff28 !important; }
.vendor-menu { display: none; }

.vendor-main { width: min(100%,1460px); min-width: 0; padding: clamp(18px,3.2vw,44px); margin-inline: auto; }
.vendor-topbar, .vendor-panel-head, .vendor-top-actions, .vendor-stock-tools, .vendor-period {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.vendor-topbar {
  justify-content: space-between;
  align-items: end;
  border-bottom: 1px solid var(--vendor-line);
  padding-bottom: 18px;
  margin-bottom: 22px;
}
.vendor-role-label { color: var(--vendor-muted); font-size: 12px; margin: 0 0 4px; }
.vendor-topbar h1 { margin: 0; font-size: clamp(30px,4vw,48px); font-weight: 500; line-height: 1.12; letter-spacing: -.055em; }
.vendor-top-actions a, .vendor-text-link, .vendor-primary,
.operations-form button, .operations-entry button, .vendor-order-amount button,
.vendor-order-amount a, .vendor-invoice-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 42px;
  padding: 7px 12px;
  border: 1px solid var(--vendor-line);
  border-radius: 8px;
  background: var(--vendor-surface);
  color: var(--vendor-ink);
  text-decoration: none;
}
.vendor-text-link { text-underline-offset: 3px; }
.vendor-auth-panel .vendor-primary, .operations-form button:is([value=submit],[data-primary]) {
  background: var(--vendor-ink);
  color: #fff8e7;
  border-color: var(--vendor-ink);
}
.vendor-auth-panel .vendor-primary { width: 100%; }
.vendor-top-actions a:hover, .vendor-text-link:hover, .operations-form button:hover, .operations-entry button:hover { border-color: #8e8170; }
input:not([type=checkbox],[type=hidden]), select, textarea {
  min-width: 0;
  max-width: 100%;
  min-height: 43px;
  padding: 8px 11px;
  border: 1px solid #cdc5b6;
  border-radius: 8px;
  background: #fff;
  color: var(--vendor-ink);
}
select { padding-inline-end: 30px; }
textarea { resize: vertical; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--vendor-ink); }

.vendor-view, .vendor-overview-grid, .vendor-stock-grid { display: grid; gap: 16px; align-items: start; }
.vendor-overview-grid:has(#vendorPayNow:not(.hidden)) { grid-template-columns: minmax(0,2fr) minmax(205px,1fr); }
.vendor-stock-grid { grid-template-columns: minmax(0,1.4fr) minmax(0,1fr); }
.vendor-panel, .vendor-metrics article {
  border: 1px solid var(--vendor-line);
  border-radius: var(--vendor-radius);
  background: var(--vendor-surface);
}
.vendor-panel { min-width: 0; padding: clamp(14px,2.4vw,24px); }
.vendor-panel-head { justify-content: space-between; margin-bottom: 14px; }
.vendor-panel h2 { margin: 0; font-size: 20px; font-weight: 500; letter-spacing: -.03em; }
.vendor-panel-head p { color: var(--vendor-muted); margin: 5px 0 0; }
.vendor-pill {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 20px;
  background: #efe9dc;
  color: #4c514a;
  font-size: 12px;
  white-space: nowrap;
}
.vendor-pill:empty { display: none; }
.vendor-metrics { display: grid; gap: 12px; grid-template-columns: repeat(4,minmax(0,1fr)); }
.vendor-metrics article { padding: clamp(12px,1.7vw,20px); }
.vendor-metrics article:first-child { background: var(--vendor-ink); color: #fff3d9; }
.vendor-metrics span, .vendor-metrics small, .vendor-meta { font-size: 12px; }
.vendor-metrics small { display: block; opacity: .82; }
.vendor-metrics strong, .vendor-stat-strip dd {
  display: block;
  font-size: clamp(21px,3.1vw,34px);
  letter-spacing: -.045em;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
#vendorPayNow img { display: block; margin-bottom: 12px; width: min(144px,100%); height: auto; }
#vendorPayee { margin: 0; }
.vendor-empty { border: 1px dashed #d8cfbd; border-radius: 10px; padding: 20px 15px; background: #f8f5ed; color: var(--vendor-muted); }
.vendor-empty strong { color: var(--vendor-ink); font-weight: 500; }
.vendor-empty p { margin: 3px 0 0; }
.vendor-stock-tools { align-items: end; margin-bottom: 12px; }
.vendor-stock-tools label:first-child { display: grid; flex: 1 1 160px; gap: 4px; }
.vendor-check { display: flex; align-items: center; gap: 5px; min-height: 43px; }
#vendorListingEditor { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--vendor-line); }
#vendorListingEditor > summary { cursor: pointer; font-weight: 500; }
.vendor-stat-strip {
  display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,130px),1fr));
  border: 1px solid var(--vendor-line); border-radius: 10px; overflow: hidden;
  background: #f7f3e8; margin: 0 0 14px;
}
.vendor-stat-strip > div { padding: 12px 15px; }
.vendor-stat-strip > div + div { box-shadow: inset 1px 0 var(--vendor-line); }
.vendor-stat-strip dt { font-size: 12px; }
.vendor-stat-strip dd { margin: 0; }

.vendor-order-row, .vendor-invoice-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 12px;
  align-items: start;
  border-top: 1px solid var(--vendor-line);
  padding: 14px 0;
  overflow-wrap: anywhere;
}
.vendor-invoice-row { grid-template-columns: minmax(0,1fr) auto auto; align-items: center; }
.vendor-order-row :is(small,strong), .vendor-invoice-row small { display: block; }
.vendor-order-row small, .vendor-invoice-row small { color: var(--vendor-muted); }
.vendor-order-amount { display: grid; gap: 5px; justify-items: end; font-variant-numeric: tabular-nums; }
.vendor-order-amount > span { color: var(--vendor-muted); font-size: 12px; }
.vendor-order-items { margin-block: 8px; background: #f6f2e8; border-radius: 8px; padding: 8px; font-size: 13px; }
.operations-entry { border-top: 1px solid var(--vendor-line); padding: 12px 2px; overflow-wrap: anywhere; }
.operations-entry summary { cursor: pointer; font-weight: 500; }
.operations-entry summary small { display: block; margin: 3px 0 0 17px; color: var(--vendor-muted); font-weight: 400; }
.operations-entry p { white-space: pre-wrap; margin: 4px 0; }
.operations-order { grid-column: 1 / -1; border: 1px solid var(--vendor-line); border-radius: 10px; padding: 10px 12px; }
.operations-order summary { cursor: pointer; }
.operations-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin: 12px 0 0; }
.operations-form label { display: grid; gap: 5px; flex: 1 1 140px; min-width: 0; }
.operations-actions { display: flex; flex-wrap: wrap; gap: 7px; width: 100%; }
.vendor-toast {
  position: fixed; z-index: 20; bottom: 16px; inset-inline-end: 16px;
  max-width: calc(100vw - 32px); padding: 10px 15px; border-radius: 9px;
  background: var(--vendor-ink); color: #fff8e7; opacity: 0; pointer-events: none;
}
.vendor-toast.show { opacity: 1; }

@media (max-width: 1080px) {
  .vendor-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 910px) {
  .vendor-stock-grid { grid-template-columns: 1fr; }
}
@media (max-width: 710px) {
  .vendor-auth-shell { grid-template-columns: 1fr; }
  .vendor-auth-art { min-height: 185px; }
  .vendor-auth-art h1 { max-width: none; margin: 14px 0 3px; }
  .vendor-app { display: block; }
  .vendor-sidebar { position: static; height: auto; padding: 12px; overflow: visible; }
  .vendor-sidebar-top { padding-inline: 2px; }
  .vendor-menu { display: inline-flex; align-items: center; border-color: #ffffff45; }
  .vendor-current-brand { margin: 10px 0 0; padding: 6px 8px; }
  .vendor-sidebar nav { display: none; }
  .vendor-sidebar nav.is-open { display: grid; grid-template-columns: 1fr 1fr; margin-top: 12px; gap: 8px; }
  .vendor-sidebar-bottom { grid-column: 1 / -1; }
  .vendor-overview-grid:has(#vendorPayNow:not(.hidden)) { grid-template-columns: 1fr; }
}
@media (max-width: 435px) {
  .vendor-main { padding-inline: 12px; }
  .vendor-metrics { gap: 8px; }
  .vendor-topbar { gap: 12px; }
  .vendor-order-row, .vendor-invoice-row { grid-template-columns: 1fr; }
  .vendor-order-amount { justify-items: start; }
}

#vendorSpecifications { flex: 1 0 100%; min-width: 0; }
#vendorSpecifications div, #editSpecifications div { display: grid; gap: 8px; }
