:root {
  color-scheme: light;
  --ink: #202521;
  --muted: #707873;
  --line: #d8dcd8;
  --line-strong: #b8c0ba;
  --paper: #ffffff;
  --canvas: #f3f4f1;
  --sage: #435c4c;
  --sage-dark: #304739;
  --sage-pale: #e9eee9;
  --coral: #bc614a;
  --coral-pale: #f4e9e5;
  --yellow: #d6b64c;
  --radius: 6px;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
[hidden] { display: none !important; }

.topbar { height: 68px; padding: 0 38px; display: flex; align-items: center; gap: 54px; background: var(--paper); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; font-size: 11px; font-weight: 700; letter-spacing: 0; white-space: nowrap; }
.brand-mark { width: 31px; height: 31px; display: grid; place-items: center; background: var(--sage); color: white; font-size: 10px; letter-spacing: 0; border-radius: 3px; }
.translation { font-weight: 700; }
.translation-line { display: block; margin-top: 2px; }
.top-nav { display: flex; align-self: stretch; gap: 26px; }
.nav-link { position: relative; display: inline-flex; align-items: center; text-decoration: none; color: var(--muted); font-size: 13px; }
.nav-link.is-active { color: var(--ink); font-weight: 650; }
.nav-link.is-active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--coral); content: ""; }
.topbar-note { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.status-dot { width: 7px; height: 7px; background: #5d9369; border-radius: 50%; }

.customer-layout { display: grid; grid-template-columns: minmax(0, 1fr) 312px; gap: 30px; max-width: 1440px; margin: 0 auto; padding: 34px 38px 54px; }
.catalog-section, .cart-section, .admin-layout { min-width: 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.eyebrow { margin: 0 0 8px; color: var(--muted); font-size: 10px; line-height: 1.2; font-weight: 700; letter-spacing: 0; }
h1, h2, p { margin-top: 0; }
.section-heading h1 { margin: 0; font-size: 23px; line-height: 1.2; font-weight: 650; }
.search-box { width: min(300px, 48%); height: 40px; display: flex; align-items: center; gap: 10px; padding: 0 10px 0 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.search-box input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.search-box input::placeholder, .search-box textarea::placeholder { color: #8a918c; }
.catalog-heading { align-items: flex-start; justify-content: flex-start; }
.catalog-search-group { width: min(420px, 100%); }
.catalog-heading .search-box { width: 100%; min-height: 68px; height: auto; align-items: flex-start; padding: 10px 12px; }
.catalog-heading .search-icon { margin-top: 4px; }
.catalog-heading textarea { min-width: 0; width: 100%; min-height: 44px; max-height: 160px; padding: 0; resize: vertical; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; line-height: 1.45; }
.catalog-heading textarea:focus-visible { outline: 0; }
.catalog-heading .search-box:focus-within { border-color: var(--line-strong); }
.catalog-search-hint { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.search-icon { width: 14px; height: 14px; position: relative; flex: 0 0 auto; border: 1.5px solid #737a75; border-radius: 50%; }
.search-icon::after { position: absolute; right: -5px; bottom: -3px; width: 6px; height: 1.5px; background: #737a75; transform: rotate(45deg); content: ""; }
.catalog-meta { display: flex; justify-content: space-between; margin: 28px 0 12px; padding-bottom: 9px; border-bottom: 1px solid var(--line-strong); color: var(--muted); font-size: 11px; }
.catalog-meta span:last-child { color: var(--ink); font-weight: 650; }
.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.product-card { min-width: 0; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.product-image { height: 184px; display: grid; place-items: center; padding: 13px; background: #f9faf8; border-bottom: 1px solid #edf0ec; }
.product-image img { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.product-card-footer { min-height: 68px; padding: 8px 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; gap: 6px; }
.sku-label { color: var(--ink); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.product-card-footer > .sku-label { grid-column: 1 / -1; }
.product-pack-size { color: var(--muted); font-size: 10px; line-height: 1.2; white-space: normal; }
.product-card-footer > .button { grid-column: 2; grid-row: 2; }
.button { min-height: 36px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: var(--radius); cursor: pointer; font-size: 12px; font-weight: 650; transition: background-color 130ms ease, border-color 130ms ease, color 130ms ease; }
.button-primary { color: white; background: var(--sage); }
.button-primary:hover:not(:disabled) { background: var(--sage-dark); }
.button-primary:disabled { background: #aeb6b0; cursor: not-allowed; }
.button-secondary { color: var(--ink); background: var(--paper); border-color: var(--line-strong); }
.button-secondary:hover { background: #eef1ed; }
.button-danger { color: #8b382d; background: #fff; border-color: #d8aaa3; }
.button-danger:hover:not(:disabled) { background: #fff1ef; }
.button-danger:disabled { color: #9b7974; cursor: wait; }
.button-small { min-height: 30px; padding: 0 9px; font-size: 11px; }
.empty-state { padding: 28px 0; color: var(--muted); font-size: 13px; }

.cart-section { position: sticky; top: 18px; align-self: start; margin-top: 1px; padding: 20px; background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--sage); border-radius: var(--radius); }
.cart-heading { display: flex; align-items: start; justify-content: space-between; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.cart-heading h2 { margin: 0; font-size: 18px; line-height: 1.2; font-weight: 650; }
.count-badge { min-width: 24px; height: 24px; display: grid; place-items: center; padding: 0 6px; background: var(--sage-pale); color: var(--sage-dark); border-radius: 50%; font-size: 11px; font-weight: 700; }
.cart-items { display: grid; gap: 0; max-height: min(52vh, 480px); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) 76px 24px; align-items: center; gap: 8px; padding: 14px 0; border-bottom: 1px solid #e8ebe8; }
.cart-line-name { display: grid; gap: 4px; min-width: 0; }
.cart-line-name strong { font-size: 12px; }
.cart-line-name span { color: var(--muted); font-size: 10px; }
.cart-quantity { display: grid; gap: 3px; color: var(--muted); font-size: 10px; }
.number-input { width: 100%; min-width: 0; height: 32px; padding: 0 5px; border: 1px solid var(--line); border-radius: 4px; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; }
.remove-button { width: 24px; height: 28px; padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; }
.remove-button:hover { color: var(--coral); }
.cart-empty { padding: 21px 0; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.cart-summary { display: grid; gap: 8px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.cart-summary div { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.cart-summary strong { color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.checkout-form { display: grid; gap: 8px; padding-top: 16px; }
.checkout-form label { font-size: 12px; font-weight: 650; }
.checkout-form label span { color: var(--coral); }
.checkout-form input { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 4px; font-size: 13px; }
.checkout-button { width: 100%; min-height: 40px; margin-top: 4px; }
.form-message { margin: 2px 0 0; color: var(--coral); font-size: 11px; line-height: 1.5; white-space: pre-line; }
.success-dialog { width: min(380px, calc(100vw - 32px)); padding: 30px; border: 1px solid var(--line); border-radius: 8px; text-align: center; box-shadow: 0 24px 70px #2222; }
.success-dialog::backdrop { background: #17201966; }
.success-mark { width: 38px; height: 38px; display: grid; place-items: center; margin: 0 auto 16px; background: var(--sage-pale); color: var(--sage); border-radius: 50%; font-size: 20px; }
.success-dialog h2 { margin: 0 0 12px; font-size: 20px; }
.success-dialog p:not(.eyebrow) { margin-bottom: 22px; color: var(--muted); font-size: 12px; }
.success-dialog .order-followup-warning { margin: -8px 0 16px; color: #b74437; line-height: 1.5; }
.success-dialog strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.success-dialog .button { min-width: 120px; }

.admin-layout { max-width: 1360px; margin: 0 auto; padding: 34px 38px 56px; }
.admin-heading { align-items: center; }
.admin-heading h1 { font-size: 23px; }
.backoffice-tabs { display: flex; gap: 22px; margin-top: 22px; border-bottom: 1px solid var(--line-strong); }
.backoffice-tab { min-height: 43px; padding: 0 2px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; }
.backoffice-tab.is-selected { border-bottom-color: var(--coral); color: var(--ink); font-weight: 650; }
.product-admin-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-top: 24px; }
.product-admin-heading h2, .product-list-heading h2 { margin: 0; font-size: 16px; font-weight: 650; }
.product-admin-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.product-form { display: grid; grid-template-columns: minmax(120px, 0.75fr) minmax(220px, 1.5fr) minmax(140px, 0.8fr) auto; align-items: end; gap: 14px; margin: 18px 0 8px; padding: 17px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.product-form label { min-width: 0; display: grid; gap: 7px; font-size: 12px; font-weight: 650; }
.product-form input { min-width: 0; width: 100%; height: 38px; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--paper); font-size: 12px; }
.product-form input[type="file"] { padding: 5px; }
.product-form .button { min-height: 38px; white-space: nowrap; }
.upload-hint { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.admin-message.is-success { background: var(--sage-pale); color: var(--sage-dark); }
.product-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 30px 0 12px; }
.product-list-heading h2 { display: flex; align-items: center; gap: 9px; }
.product-list-heading h2 span { color: var(--muted); font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums; }
.product-list-controls { display: flex; align-items: center; justify-content: end; gap: 14px; }
.product-search { width: min(280px, 45%); }
.product-list-wrap { max-height: min(56vh, 640px); overflow: auto; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); background: var(--paper); }
.product-list-table { width: 100%; min-width: 680px; border-collapse: collapse; }
.product-list-table th { position: sticky; top: 0; z-index: 1; padding: 9px 14px; background: #f6f7f5; color: var(--muted); font-size: 10px; font-weight: 600; text-align: left; }
.product-list-table td { padding: 7px 14px; border-top: 1px solid #edf0ed; font-size: 12px; }
.product-list-table td:last-child { color: var(--muted); }
.product-thumbnail { display: block; width: 40px; height: 40px; object-fit: contain; }
.product-pack-form { display: flex; align-items: center; gap: 6px; }
.product-pack-input { width: 82px; flex: 0 0 82px; text-align: left; padding: 0 8px; }
.product-pack-unit { color: var(--muted); font-size: 10px; white-space: nowrap; }
.product-pack-save { min-height: 30px; color: var(--sage-dark); }
.product-status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.product-status::before { width: 7px; height: 7px; border-radius: 50%; background: var(--coral); content: ""; }
.product-status.is-active::before { background: #5d9369; }
.product-action { min-height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); color: var(--coral); cursor: pointer; font-size: 11px; }
.product-action[data-next-active="true"] { color: var(--sage-dark); }
.product-action:disabled { opacity: 0.55; cursor: wait; }
.admin-toolbar { min-height: 68px; margin-top: 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); }
.segmented { display: inline-flex; align-items: center; gap: 4px; }
.segment { min-height: 34px; padding: 0 11px; display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.segment span { min-width: 17px; color: inherit; font-size: 10px; font-variant-numeric: tabular-nums; }
.segment.is-selected { background: var(--sage-pale); color: var(--sage-dark); font-weight: 650; }
.admin-search { width: min(310px, 42%); }
.orders-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 13px; padding-top: 16px; }
.order-card { min-width: 0; padding: 16px 18px; background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--yellow); border-radius: var(--radius); }
.order-card[data-status="processed"] { border-left-color: #78917d; }
.order-card-header { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.order-ident { display: grid; gap: 7px; }
.order-ident-main { display: flex; align-items: baseline; gap: 11px; flex-wrap: wrap; }
.order-ident-main h2 { margin: 0; font-size: 15px; font-weight: 650; }
.order-id { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.order-created { color: var(--muted); font-size: 11px; }
.order-actions { display: flex; align-items: center; gap: 8px; }
.order-meta-form { display: grid; grid-template-columns: minmax(130px, 0.85fr) minmax(160px, 1fr) minmax(180px, 1.35fr) auto; align-items: end; gap: 10px; margin-top: 15px; padding: 12px 0; border-top: 1px solid #edf0ed; border-bottom: 1px solid #edf0ed; }
.order-meta-form label { min-width: 0; display: grid; gap: 5px; color: var(--muted); font-size: 10px; }
.order-meta-form input { width: 100%; min-width: 0; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: var(--paper); font-size: 11px; }
.order-meta-form .button { min-height: 32px; }
.status-select { min-height: 34px; padding: 0 26px 0 9px; border: 1px solid var(--line); border-radius: 4px; background: white; color: var(--ink); font-size: 11px; }
.order-table-wrap { min-width: 0; max-width: 100%; overflow-x: auto; margin-top: 14px; }
.order-table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.order-table th { padding: 8px 10px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; font-weight: 600; text-align: left; }
.order-table th:not(:first-child), .order-table td:not(:first-child) { text-align: right; }
.order-table th:last-child { padding-right: 66px; }
.order-table td { padding: 9px 10px; border-bottom: 1px solid #edf0ed; font-size: 12px; font-variant-numeric: tabular-nums; }
.order-table tbody tr:last-child td { border-bottom: 0; }
.price-cell { width: 122px; height: 31px; text-align: right; }
.money-pending { color: var(--muted); }
.order-table .money-pending { display: flex; align-items: center; justify-content: flex-end; gap: 32px; }
.line-delete-button { width: 24px; height: 24px; flex: 0 0 24px; padding: 0; border: 0; background: transparent; color: var(--coral); cursor: pointer; font-size: 17px; line-height: 1; }
.line-delete-button:hover:not(:disabled) { color: #913d30; background: var(--coral-pale); border-radius: 50%; }
.line-delete-button:disabled { color: var(--muted); cursor: wait; }
.order-no-items { color: var(--muted); text-align: center !important; }
.order-total { padding: 10px 10px 0; display: flex; justify-content: end; gap: 22px; color: var(--muted); font-size: 11px; }
.order-total strong { color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.orders-empty { padding: 88px 20px; text-align: center; }
.empty-rule { width: 36px; height: 3px; display: block; margin: 0 auto 16px; background: var(--coral); }
.orders-empty h2 { margin: 0 0 8px; font-size: 16px; font-weight: 650; }
.orders-empty p { margin: 0; color: var(--muted); font-size: 12px; }
.admin-message { margin-top: 14px; padding: 10px 12px; background: var(--coral-pale); color: #7d382c; border-radius: 4px; font-size: 12px; }
.admin-message.is-success { background: var(--sage-pale); color: var(--sage-dark); }
.export-confirm-dialog { position: fixed; inset: 0; width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 24px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px #17201930; }
.export-confirm-dialog::backdrop { background: #17201966; }
.export-confirm-dialog h2 { margin: 0 0 12px; font-size: 18px; }
.export-confirm-message { margin: 0 0 12px; color: var(--ink); font-size: 13px; line-height: 1.5; }
.export-confirm-order { margin: 0 0 16px; color: var(--muted); font-size: 12px; }
.export-confirm-order strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.export-confirm-label { margin: 0 0 7px; color: var(--muted); font-size: 11px; font-weight: 650; }
.export-confirm-skus { max-height: min(190px, 30vh); display: flex; flex-wrap: wrap; gap: 6px; overflow-y: auto; padding: 10px; border: 1px solid var(--line); border-radius: 4px; background: #f8f9f7; }
.export-confirm-sku { padding: 4px 6px; background: white; border: 1px solid var(--line); border-radius: 3px; color: var(--ink); font-size: 11px; font-variant-numeric: tabular-nums; }
.export-confirm-empty { color: var(--muted); font-size: 11px; }
.export-confirm-sku-tools { min-height: 30px; display: flex; align-items: center; gap: 9px; margin-top: 8px; }
.export-confirm-sku-tools span { color: var(--sage-dark); font-size: 11px; }
.export-confirm-sku-tools button:disabled { opacity: 0.5; cursor: not-allowed; }
.export-confirm-inventory-tip { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.export-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 980px) {
  .customer-layout { grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; padding-right: 24px; padding-left: 24px; }
  .product-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .cart-section { padding: 16px; }
  .admin-layout { padding-right: 24px; padding-left: 24px; }
}

@media (max-width: 680px) {
  .topbar { height: 60px; padding: 0 16px; gap: 18px; }
  .brand { gap: 7px; font-size: 9px; letter-spacing: 0; }
  .brand-mark { width: 28px; height: 28px; }
  .top-nav { gap: 14px; }
  .nav-link { font-size: 11px; }
  .topbar-note { display: none; }
  .customer-layout { display: flex; flex-direction: column; gap: 18px; padding: 24px 16px 94px; }
  .section-heading { align-items: center; }
  .section-heading h1 { font-size: 20px; }
  .eyebrow { font-size: 9px; }
  .search-box { width: min(56%, 230px); height: 38px; gap: 8px; padding-right: 8px; padding-left: 10px; }
  .product-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .product-card { display: grid; grid-template-columns: 96px minmax(0, 1fr); }
  .product-image { height: 112px; padding: 7px; border-right: 1px solid #edf0ec; border-bottom: 0; }
  .product-card-footer { min-height: 112px; align-content: center; padding: 10px; gap: 5px; }
  .product-card-footer > .button { min-height: 42px; flex-direction: column; gap: 1px; padding-top: 4px; padding-bottom: 4px; line-height: 1.1; }
  .product-card-footer > .button .translation-separator { display: none; }
  .sku-label { font-size: 12px; }
  .button-small { min-height: 29px; padding: 0 8px; font-size: 10px; }
  .catalog-meta { margin-top: 21px; }
  .cart-section { position: static; padding: 16px; }
  .admin-layout { padding: 24px 16px 40px; }
  .admin-heading { align-items: center; }
  .admin-heading h1 { font-size: 20px; }
  .backoffice-tabs { gap: 20px; margin-top: 17px; }
  .backoffice-tab { min-height: 40px; font-size: 12px; }
  .product-form { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 14px; padding: 14px 0; }
  .product-form .button { width: 100%; }
  .product-list-heading { align-items: stretch; flex-direction: column; gap: 12px; margin-top: 24px; }
  .product-list-controls { align-items: stretch; flex-direction: column; gap: 10px; }
  .product-search { width: 100%; }
  .product-list-table th, .product-list-table td { padding-right: 10px; padding-left: 10px; }
  .admin-toolbar { align-items: stretch; flex-direction: column-reverse; gap: 12px; padding: 12px 0; }
  .admin-search { width: 100%; }
  .segmented { justify-content: space-between; }
  .segment { padding: 0 8px; }
  .order-card { padding: 13px 11px; }
  .order-card-header { align-items: start; flex-direction: column; gap: 11px; }
  .order-actions { width: 100%; justify-content: space-between; }
  .order-meta-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 9px; }
  .order-meta-form label:nth-child(3) { grid-column: 1 / -1; }
  .order-meta-form .button { grid-column: 1 / -1; width: 100%; }
  .order-table { min-width: 530px; }
  .order-total { padding-right: 4px; }
}

@media (max-width: 380px) {
  .topbar { gap: 12px; }
  .brand > span:last-child { display: none; }
  .brand-admin > span:last-child { display: inline; }
  .brand-catalog > span:last-child { display: inline; }
  .top-nav { gap: 15px; }
  .section-heading { align-items: start; }
  .search-box { width: 55%; }
  .cart-line { grid-template-columns: minmax(0, 1fr) 70px 22px; gap: 6px; }
}
