:root {
    color-scheme: light;
    --ink: #202923;
    --muted: #727b75;
    --line: #e0e6e1;
    --paper: #f4f6f2;
    --surface: #ffffff;
    --forest: #185b43;
    --forest-dark: #103d2e;
    --lime: #d4ed9b;
    --orange: #ec7349;
    --red: #b63d32;
    --shadow: 0 18px 48px rgba(30, 52, 40, .09);
    font-family: 'Aptos', 'Trebuchet MS', 'Segoe UI', sans-serif;
    color: var(--ink);
    background: var(--paper);
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { min-width: 320px; margin: 0; background: var(--paper); }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: 'Trebuchet MS', 'Segoe UI', sans-serif; }
h1 { font-size: 34px; line-height: 1.15; margin-bottom: 10px; }
h2 { font-size: 19px; line-height: 1.3; margin-bottom: 8px; }
.topbar { height: 70px; padding: 0 max(28px, calc((100% - 1280px) / 2)); display: flex; align-items: center; gap: 40px; background: var(--forest-dark); color: #fff; }
.brand { display: inline-flex; align-items: center; gap: 11px; min-width: 190px; font: 800 18px 'Trebuchet MS', sans-serif; }
.brand-mark { display: grid; width: 34px; aspect-ratio: 1; place-items: center; border-radius: 9px; background: var(--lime); color: var(--forest-dark); }
.topnav { display: flex; align-items: center; gap: 25px; flex: 1; height: 100%; }
.topnav a { height: 100%; display: inline-flex; align-items: center; color: #d2dfd7; font-size: 14px; border-bottom: 2px solid transparent; }
.topnav a:hover { color: #fff; border-color: var(--lime); }
.topbar-user { display: flex; align-items: center; gap: 14px; font-size: 13px; color: #d2dfd7; }
.topbar-user form { margin: 0; }
.page-shell { max-width: 1280px; padding: 38px 28px 110px; margin: 0 auto; min-height: calc(100vh - 70px); }
.button { min-height: 42px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 5px; font-weight: 700; font-size: 14px; transition: background .16s ease, transform .16s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--forest); }
.button-primary:hover { background: var(--forest-dark); }
.button-secondary { color: var(--forest-dark); background: #fff; border-color: var(--line); }
.button-quiet { color: #eff7f1; background: transparent; padding: 0 6px; min-height: 34px; }
.button-wide { width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.5; }
.eyebrow { color: var(--forest); font-size: 11px; font-weight: 800; letter-spacing: 1px; margin-bottom: 9px; }
.notice { padding: 13px 16px; margin-bottom: 23px; border-left: 3px solid var(--forest); background: #e8f1eb; font-size: 14px; }
.notice-error { color: #7e211b; border-color: var(--red); background: #fbedeb; }
.notice-success { color: #174e39; border-color: var(--forest); background: #e7f2e7; }
.page-heading, .catalog-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 27px; }
.catalog-heading > div:first-child p:last-child { margin-bottom: 0; }
.catalog-controls { display: flex; gap: 10px; align-items: center; }
.select-wrap { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
select, input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #d7ded8; border-radius: 4px; background: #fff; color: var(--ink); outline: none; }
select:focus, input:focus, textarea:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(24, 91, 67, .11); }
.product-list { border-top: 1px solid var(--line); }
.product-row { display: grid; grid-template-columns: 74px minmax(200px, 1fr) 100px 130px 112px 80px; align-items: center; gap: 18px; padding: 16px 5px; border-bottom: 1px solid var(--line); min-height: 115px; animation: arrive .35s ease both; }
.product-row:nth-child(2) { animation-delay: .04s; }
.product-row:nth-child(3) { animation-delay: .08s; }
.product-image { width: 74px; height: 78px; display: grid; place-items: center; overflow: hidden; background: #e7ece6; color: var(--forest); font: 700 26px 'Trebuchet MS', sans-serif; }
.product-image img { width: 100%; height: 100%; object-fit: cover; }
.product-image img[role="button"] { cursor: zoom-in; }
.product-image img[role="button"]:focus-visible { outline: 3px solid var(--forest); outline-offset: 2px; }
.image-lightbox { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; padding: 5vh 5vw; background: rgba(10, 18, 13, .88); cursor: zoom-out; animation: arrive .16s ease both; }
.image-lightbox > img { display: block; max-width: 90vw; max-height: 90vh; width: auto; height: auto; object-fit: contain; box-shadow: 0 20px 70px rgba(0, 0, 0, .4); }
.image-lightbox-close { position: absolute; top: 18px; right: 22px; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.45); border-radius: 50%; background: rgba(0,0,0,.25); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; }
.image-lightbox-close:hover { background: rgba(255,255,255,.16); }
body.lightbox-open { overflow: hidden; }
.product-main h2 { margin: 0 0 5px; font-size: 16px; }
.product-main p { margin: 7px 0 0; max-width: 640px; color: var(--muted); font-size: 13px; line-height: 1.45; white-space: pre-line; }
.product-sku, .product-stock span { color: var(--muted); font-size: 11px; }
.product-stock { display: grid; gap: 4px; }
.product-stock strong { font: 700 16px 'Trebuchet MS', sans-serif; }
.product-price { font-weight: 700; font-size: 14px; white-space: nowrap; }
.quantity-control { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.quantity-control input { text-align: center; min-width: 0; }
.save-state { min-width: 62px; color: var(--forest); font-size: 11px; }
.cart-dock { position: fixed; z-index: 5; right: max(28px, calc((100% - 1224px) / 2)); bottom: 22px; display: flex; align-items: center; gap: 18px; padding: 14px 18px; border-radius: 5px; color: #fff; background: var(--forest-dark); box-shadow: var(--shadow); font-size: 14px; font-weight: 700; }
.cart-dock strong { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 50%; background: var(--lime); color: var(--forest-dark); font-size: 12px; }
.empty-state { padding: 60px 24px; text-align: center; border: 1px dashed #cad4cc; background: rgba(255,255,255,.55); }
.empty-state h2 { margin-bottom: 8px; }
.empty-state p { color: var(--muted); }
.empty-state.compact { padding: 24px; }
.empty-state.compact p { margin: 0; }
.modal-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(17, 36, 26, .55); }
.dialog { width: min(100%, 470px); padding: 30px; background: #fff; box-shadow: var(--shadow); animation: arrive .2s ease both; }
.dialog p:not(.eyebrow) { color: var(--muted); line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.dialog-actions form { margin: 0; }
.checkout-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 36px; align-items: start; }
.checkout-items { border-top: 1px solid var(--line); }
.checkout-row { display: grid; grid-template-columns: minmax(150px,1fr) 110px 135px 70px 34px; gap: 14px; align-items: center; padding: 18px 0; border-bottom: 1px solid var(--line); }
.checkout-row h2 { margin-bottom: 6px; font-size: 15px; }
.checkout-row.is-short { color: var(--red); }
.stock-warning { display: block; margin-top: 5px; color: var(--red); font-size: 12px; font-weight: 700; }
.checkout-row > span, .checkout-row strong { font-size: 13px; white-space: nowrap; }
.checkout-description .muted { font-size: 11px; }
.checkout-quantity { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.checkout-quantity input { min-width: 0; text-align: center; }
.checkout-row .line-total { font-size: 13px; white-space: nowrap; }
.checkout-row .save-state { min-width: 0; }
.icon-button { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 0; border-radius: 4px; background: transparent; color: var(--red); font-size: 22px; line-height: 1; }
.icon-button:hover { background: #fbedeb; }
.settings-strip, .filter-bar { display: flex; align-items: end; flex-wrap: wrap; gap: 14px; padding: 16px; background: #fff; border: 1px solid var(--line); }
.settings-strip { justify-content: space-between; margin: 0 0 28px; }
.settings-strip .check-label { font-size: 13px; }
.filter-bar { margin-bottom: 20px; }
.filter-bar > label:not(.check-label) { display: grid; gap: 5px; min-width: min(300px, 100%); color: var(--muted); font-size: 11px; font-weight: 700; }
.filter-bar .check-label { min-height: 42px; }
.order-history-details { margin-top: 28px; }
.order-history-details > h2 { margin-bottom: 12px; }
.order-details { margin: 0 0 8px; border: 1px solid var(--line); background: #fff; }
.order-details summary { display: grid; grid-template-columns: 90px minmax(100px,1fr) 130px 150px minmax(120px,1fr) 125px; gap: 14px; align-items: center; padding: 14px 16px; color: var(--ink); cursor: pointer; list-style: none; font-size: 13px; }
.order-details summary::-webkit-details-marker { display: none; }
.order-details summary:hover { background: #f7f9f6; }
.order-details[open] summary { border-bottom: 1px solid var(--line); }
.order-number { color: var(--forest); font-weight: 700; }
.order-number small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.order-status { color: var(--muted); }
.order-expand { color: var(--forest); font-size: 12px; font-weight: 700; text-align: right; }
.order-expand:after { content: ' +'; }
.order-details[open] .order-expand:after { content: 'Свернуть −'; }
.order-details .table-wrap { border-top: 0; }
.order-detail-body { padding: 12px 16px 16px; }
.order-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 12px; color: var(--muted); font-size: 12px; }
.order-details > .table-wrap { padding: 0 10px; }
.order-details > p { padding: 14px 16px; margin: 0; }
.admin-photo-status { display: flex; align-items: center; gap: 7px; margin-top: 7px; color: var(--muted); font-size: 11px; }
.admin-photo-status img { width: 36px; height: 36px; object-fit: cover; border: 1px solid var(--line); }
.admin-photo-status img.image-unavailable { display: none; }
.error-text { color: var(--red) !important; }
.order-form { display: grid; gap: 15px; padding: 22px; background: #fff; border-top: 3px solid var(--forest); box-shadow: 0 8px 28px rgba(30,52,40,.05); }
.order-form h2 { margin-bottom: 0; }
.order-form > label:not(.choice-row) { display: grid; gap: 7px; font-size: 13px; font-weight: 600; }
.choice-row { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); cursor: pointer; }
.choice-row input { accent-color: var(--forest); margin-top: 3px; }
.choice-row span { display: grid; gap: 3px; }
.choice-row strong { font-size: 13px; }
.choice-row small { color: var(--muted); font-size: 11px; }
.order-total { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-top: 1px solid var(--line); font-size: 14px; }
.order-total strong { font: 800 20px 'Trebuchet MS', sans-serif; }
.text-link { color: var(--forest); font-size: 13px; font-weight: 700; }
.text-link:hover { text-decoration: underline; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 38px; }
.metric { min-height: 112px; display: flex; flex-direction: column; justify-content: space-between; padding: 17px; background: var(--surface); border: 1px solid var(--line); }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { font: 800 29px 'Trebuchet MS', sans-serif; color: var(--forest-dark); }
.section-block { margin-top: 32px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.section-title h2 { margin: 0; }
.status-dot { color: var(--forest); font-size: 12px; font-weight: 700; }
.section-block > p { margin-top: 10px; font-size: 13px; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; background: #fff; text-align: left; font-size: 13px; }
th { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .6px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td small { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.inline-edit { min-width: 92px; }
.inline-edit summary { color: var(--forest); cursor: pointer; font-weight: 700; }
.inline-edit form, .compact-form form { display: grid; gap: 11px; min-width: 240px; max-width: 390px; padding: 15px 0 3px; }
.inline-edit label, .compact-form label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.inline-edit input, .inline-edit textarea, .inline-edit select, .compact-form input { font-size: 12px; }
.check-label { display: flex !important; flex-direction: row; align-items: center; gap: 8px !important; color: var(--ink) !important; }
.check-label input { accent-color: var(--forest); }
.compact-form { margin-top: 26px; padding: 23px; background: #fff; border-left: 3px solid var(--orange); }
.compact-form h2 { font-size: 16px; }
.login-wrap { min-height: 68vh; display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: 9%; max-width: 930px; margin: auto; }
.login-intro { position: relative; padding: 42px 35px 42px 0; }
.login-intro:before { content: ''; position: absolute; inset: 0 auto 0 -100vw; width: calc(100vw + 60%); background: linear-gradient(115deg, #e4ede4, #f4f6f2 70%); z-index: -1; }
.login-intro h1 { max-width: 480px; font-size: 43px; }
.login-intro p:last-child { max-width: 330px; color: var(--muted); font-size: 16px; line-height: 1.6; }
.login-panel { display: grid; gap: 17px; padding: 28px; background: #fff; border-top: 3px solid var(--orange); box-shadow: var(--shadow); }
.login-panel h2 { margin: 0 0 4px; font-size: 21px; }
.login-panel label { display: grid; gap: 7px; font-size: 12px; font-weight: 700; }
.login-panel .muted { margin: 0; }
code { padding: 2px 5px; background: #e7ece6; color: var(--forest-dark); font-size: 12px; }
@keyframes arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 920px) {
    .product-row { grid-template-columns: 64px minmax(160px,1fr) 85px 105px 100px; gap: 12px; }
    .product-image { width: 64px; height: 68px; }
    .save-state { grid-column: 2 / -1; min-height: 13px; }
    .checkout-layout { grid-template-columns: 1fr 300px; gap: 22px; }
    .topbar { gap: 20px; }
    .brand { min-width: auto; }
    .topnav { gap: 15px; }
}
@media (max-width: 700px) {
    h1 { font-size: 28px; }
    .topbar { height: auto; min-height: 64px; padding: 12px 17px; flex-wrap: wrap; gap: 10px; }
    .brand { flex: 1; }
    .topnav { order: 3; width: 100%; height: 34px; overflow-x: auto; gap: 20px; }
    .topnav a { white-space: nowrap; font-size: 12px; }
    .topbar-user { font-size: 11px; }
    .page-shell { padding: 26px 16px 96px; }
    .catalog-heading, .page-heading { align-items: flex-start; flex-direction: column; gap: 14px; }
    .catalog-controls, .select-wrap { width: 100%; }
    .product-row { grid-template-columns: 58px minmax(0,1fr) auto; gap: 10px 12px; padding: 13px 0; }
    .product-image { width: 58px; height: 62px; grid-row: span 2; }
    .product-main { grid-column: 2 / 4; align-self: end; }
    .product-main h2 { font-size: 14px; }
    .product-main p { font-size: 12px; }
    .product-stock { grid-column: 2; grid-row: 2; }
    .product-price { grid-column: 3; grid-row: 2; text-align: right; }
    .quantity-control { grid-column: 2; grid-row: 3; display: flex; align-items: center; gap: 8px; }
    .quantity-control input { width: 94px !important; }
    .save-state { grid-column: 3; grid-row: 3; text-align: right; }
    .cart-dock { right: 16px; bottom: 15px; left: 16px; justify-content: space-between; }
    .checkout-layout { grid-template-columns: 1fr; }
    .checkout-row { grid-template-columns: minmax(0,1fr) auto; gap: 9px 12px; }
    .checkout-description { grid-column: 1 / -1; }
    .checkout-quantity { grid-column: 1; }
    .checkout-row .line-total { grid-column: 2; grid-row: 2; text-align: right; }
    .checkout-row .save-state { grid-column: 1; }
    .checkout-row .remove-cart-item { grid-column: 2; grid-row: 3; justify-self: end; }
    .order-form { padding: 18px; }
    .filter-bar { align-items: stretch; }
    .filter-bar .button, .filter-bar .text-link { align-self: center; }
    .settings-strip { align-items: flex-start; }
    .order-details summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 7px 12px; }
    .order-details summary > span { flex: 1 1 42%; }
    .order-details summary .order-expand { text-align: right; }
    .metric-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
    .metric { min-height: 92px; padding: 13px; }
    .metric strong { font-size: 24px; }
    .login-wrap { min-height: auto; grid-template-columns: 1fr; gap: 10px; padding: 5vh 0; }
    .login-intro { padding: 25px 0 10px; }
    .login-intro:before { width: 100vw; inset: 0 auto 0 -16px; }
    .login-intro h1 { font-size: 34px; }
    .login-panel { padding: 22px; }
    .dialog { padding: 23px; }
    .dialog-actions { flex-direction: column-reverse; }
    .dialog-actions .button { width: 100%; }
    th, td { padding: 11px 9px; }
}