:root {
    --ink: #161616;
    --muted: #6f7177;
    --line: #dde1e5;
    --paper: #ffffff;
    --bg: #f5f6f7;
    --brand: #f05a24;
    --brand-dark: #202326;
    --ok: #18865a;
    --danger: #c43f36;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
}
a { color: inherit; text-decoration: none; }
input, select, textarea, button {
    font: inherit;
}
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 248px;
    background: #fff;
    color: var(--ink);
    border-right: 1px solid var(--line);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}
.brand img {
    width: 180px;
    max-width: 100%;
    display: block;
}
nav {
    display: grid;
    gap: 8px;
}
nav a, .session a {
    border-radius: 8px;
    padding: 11px 12px;
    color: #434b53;
}
nav a:hover, .session a:hover {
    background: #f0f3f5;
}
.session {
    margin-top: auto;
    border-top: 1px solid var(--line);
    padding-top: 16px;
    display: grid;
    gap: 6px;
}
.session span { color: #6f7177; font-size: 13px; }
.content {
    margin-left: 248px;
    padding: 28px;
}
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.panel, .card, .table-wrap {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 16px 40px rgba(30, 22, 16, .06);
}
.panel {
    padding: 24px;
}
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}
h1, h2, h3 { margin: 0; line-height: 1.1; }
h1 { font-size: 30px; }
h2 { font-size: 21px; }
.muted { color: var(--muted); }
.grid {
    display: grid;
    gap: 16px;
}
.stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.card {
    padding: 18px;
}
.card strong {
    display: block;
    font-size: 26px;
    margin-top: 8px;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
label {
    display: grid;
    gap: 7px;
    color: #34302d;
    font-weight: 700;
    font-size: 13px;
}
input, select, textarea {
    width: 100%;
    border: 1px solid #d6d0c8;
    border-radius: 8px;
    padding: 11px 12px;
    background: #fff;
    color: var(--ink);
}
textarea { min-height: 84px; resize: vertical; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.btn {
    border: 0;
    border-radius: 8px;
    padding: 11px 15px;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg, .view-switch svg { width: 18px; height: 18px; flex-shrink: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #257d9c; outline-offset: 3px; }
.btn.secondary {
    background: #24201d;
}
.btn.ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
}
.btn.danger {
    background: var(--danger);
}
.table-wrap {
    overflow: auto;
}
table {
    border-collapse: collapse;
    width: 100%;
    min-width: 760px;
}
th, td {
    border-bottom: 1px solid var(--line);
    padding: 12px;
    text-align: left;
    vertical-align: top;
}
th {
    background: #f0f3f5;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0;
    color: #5a554f;
}
.flash {
    margin-bottom: 16px;
    border-radius: 8px;
    padding: 12px 14px;
    background: #e9f7ef;
    color: #106342;
    border: 1px solid #b9e5ce;
}
.flash.error {
    background: #fff0ef;
    color: #9f2e28;
    border-color: #f3c2bd;
}
.pos-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
}
.cart-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 72px 92px 40px;
    gap: 10px;
    align-items: end;
    margin-bottom: 10px;
}
.cart-row:has(.cart-photo[hidden]) { grid-template-columns: minmax(0, 1fr) 72px 92px 40px; }
.cart-photo { width: 48px; height: 48px; object-fit: contain; border-radius: 4px; }
.cart-row label { min-width: 0; }
.cart-row select { text-overflow: ellipsis; }
.icon-button { width: 40px; height: 42px; padding: 8px; }
.pos-workspace { min-width: 0; }
.pos-summary { position: sticky; top: 20px; padding: 0 0 0 20px; border-left: 1px solid var(--line); max-height: calc(100vh - 40px); overflow: auto; min-width: 0; }
.product-editor { padding: 20px 0; border-block: 1px solid var(--line); }
.catalog-section { margin-top: 24px; }
.catalog-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 20px 0 14px; flex-wrap: wrap; }
.view-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; padding: 3px; background: #fff; }
.view-switch button { border: 0; border-radius: 4px; background: transparent; color: #555f68; display: inline-flex; gap: 6px; align-items: center; padding: 8px 12px; cursor: pointer; font-size: 13px; }
.view-switch button[aria-pressed="true"] { background: #202326; color: white; }
.catalog-filters { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.search-field { position: relative; flex: 1 1 220px; }
.search-field svg { position: absolute; left: 12px; top: 12px; width: 18px; height: 18px; color: var(--muted); }
.search-field input { padding-left: 38px; }
.catalog-count { color: #64717a; font-size: 12px; }
.catalog-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
.finish-card { min-width: 0; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; padding: 20px 0; border-block: 1px solid var(--line); }
.finish-photo { display: block; position: relative; width: 100%; aspect-ratio: 1; background: #edf0f2; padding: 0; border: 0; border-radius: 4px; overflow: hidden; cursor: zoom-in; }
.finish-photo img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.finish-photo > svg { position: absolute; width: 28px; height: 28px; right: 8px; bottom: 8px; padding: 5px; color: #fff; background: #202326; border-radius: 4px; }
.finish-body { padding: 4px 0; display: flex; flex-direction: column; gap: 16px; }
.finish-body h3 { font-size: 23px; line-height: 1.3; overflow-wrap: anywhere; }
.variant-selectors { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.variant-selectors label { font-size: 12px; min-width: 0; }
.variant-selectors select { padding: 12px; font-size: 15px; min-height: 46px; }
.product-sku { font-size: 12px; color: #58616a; overflow-wrap: anywhere; }
.finish-meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 24px; }
.finish-price { font-size: 24px; }
.stock-label { font-size: 11px; color: #14674f; }
.stock-label.stock-low { color: #b23a30; }
.table-photo { display: block; width: 56px; height: 56px; object-fit: contain; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.photo-dialog { width: min(650px, calc(100% - 24px)); max-height: 90vh; overflow: auto; padding: 24px; border: 1px solid var(--line); border-radius: 8px; }
.photo-dialog::backdrop { background: rgba(15,20,24,.7); }
.photo-dialog > .icon-button { float: right; }
.photo-dialog h2 { padding-right: 48px; margin-bottom: 18px; line-height: 1.4; }
.full-photo { display: block; width: 100%; height: auto; max-height: 60vh; object-fit: contain; }
.photo-alternatives { display: flex; gap: 8px; }
.photo-alternative { width: 60px; height: 60px; padding: 2px; border: 1px solid var(--line); background: white; cursor: pointer; }
.photo-alternative img { width: 100%; height: 100%; object-fit: contain; }
.standalone-catalog .finish-meta { display: none; }
.catalog-brand { padding: 16px max(20px, calc((100% - 1040px) / 2)); background: #fff; color: #55636c; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; }
.catalog-brand img { width: 190px; max-width: 50%; }
.catalog-brand > a { display: block; width: 190px; max-width: 50%; }
.catalog-brand > a img { display: block; width: 100%; max-width: 100%; }
.login-back { display: block; margin-top: 18px; color: #53616a; text-align: center; font-size: 14px; }
.staff-access { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.staff-access svg { width: 15px; height: 15px; }
.catalog-footnote { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.catalog-brand span { font-size: 12px; }
.catalog-document { max-width: 1080px; margin: auto; padding: 28px 20px; }
.catalog-footnote { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 18px; font-size: 13px; color: var(--muted); }
.list-search { display: block; margin-bottom: 16px; }
.sidebar nav a, .sidebar nav button { display: flex; align-items: center; gap: 12px; min-height: 46px; }
.sidebar nav svg { width: 19px; height: 19px; flex-shrink: 0; }
.sidebar nav a[aria-current="page"] { background: #fff1e9; color: #bf420f; font-weight: 700; }
.sidebar nav button { background: transparent; border: 0; border-radius: 6px; padding: 11px 12px; color: #434b53; font: inherit; text-align: left; cursor: pointer; }
.mobile-header, .menu-toggle, .menu-close, .mobile-sale-bar { display: none; }
.menu-toggle, .menu-close { border: 1px solid var(--line); background: #fff; color: #26323a; border-radius: 6px; cursor: pointer; align-items: center; justify-content: center; flex-shrink: 0; }
.menu-toggle svg, .menu-close svg { width: 22px; height: 22px; }
.menu-scrim { position: fixed; inset: 0; z-index: 60; border: 0; background: rgba(13,24,30,.45); cursor: pointer; }
.menu-open { overflow: hidden; }
.standalone-menu { transform: translateX(-100%); z-index: 70; transition: transform .2s ease; width: 280px; }
.standalone-menu.is-open { transform: translateX(0); }
.standalone-menu .menu-close, .standalone-catalog .menu-toggle { display: inline-flex; }
.standalone-menu .menu-close { align-self: flex-end; }
.catalog-brand > span { margin-left: auto; }
.catalog-categories { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.category-tab { display: inline-flex; gap: 8px; align-items: center; padding: 12px 16px; min-height: 46px; background: #fff; color: #53616a; border: 1px solid var(--line); border-radius: 6px; font-weight: 700; font-size: 14px; cursor: pointer; }
.category-tab svg { width: 18px; height: 18px; }
.category-tab[aria-pressed="true"] { color: #fff; background: #263b43; border-color: #263b43; }
.catalog-filters > label:not(.search-field) { display: none; }
.catalog-type-holder { display: none; }
.model-navigation { display: flex; align-items: end; gap: 12px; margin-bottom: 18px; }
.model-navigation > label { flex: 1; min-width: 0; }
.model-navigation select { min-height: 46px; font-size: 16px; }
.model-arrows { display: flex; gap: 6px; }
.model-arrows .icon-button { width: 46px; height: 46px; }
.sale-details { border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.sale-details summary { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; min-height: 44px; list-style: none; }
.sale-details summary::-webkit-details-marker { display: none; }
.sale-details summary svg { width: 20px; height: 20px; }
.sale-details summary svg:last-child { margin-left: auto; }
.sale-details[open] summary { margin-bottom: 14px; }
.summary-heading { margin-top: 24px; font-size: 18px; }
.pos-summary .catalog-heading { margin-top: 0; }
.pos-summary .cart-row, .pos-summary .cart-row:has(.cart-photo[hidden]) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pos-summary .cart-row > label:first-of-type { grid-column: 1 / -1; }
.pos-summary .cart-photo { display: none; }
.pos-summary #addRow { width: 100%; background: transparent; border: 1px solid var(--line); color: #434b53; }
#sale-summary { scroll-margin-top: 86px; }
@media (min-width: 981px) and (max-width: 1220px) {
    .pos-layout { grid-template-columns: minmax(0, 1fr) 280px; }
    .content { padding: 22px; margin-left: 220px; }
    .sidebar { width: 220px; }
    .cart-row, .cart-row:has(.cart-photo[hidden]) { grid-template-columns: minmax(0, 1fr) 65px 85px 40px; }
    .cart-photo { display: none; }
}
.totals {
    display: grid;
    gap: 9px;
    margin-top: 18px;
}
.totals div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}
.totals .grand {
    font-size: 24px;
    font-weight: 900;
    border-top: 1px solid var(--line);
    padding-top: 12px;
}
.login-card {
    width: min(420px, 100%);
}
.login-card img {
    max-width: 240px;
    display: block;
    margin: 0 auto 24px;
}
@media (max-width: 980px) {
    .sidebar {
        position: fixed;
        width: min(300px, calc(100% - 48px));
        padding: 18px 22px;
        gap: 24px;
        z-index: 70;
        transform: translateX(-100%);
        transition: transform .2s ease;
        overflow-y: auto;
    }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar .brand img { width: 185px; }
    .sidebar nav { display: grid; gap: 6px; }
    .sidebar .session { display: grid; }
    .mobile-header { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 14px; padding: 10px 16px; height: 68px; background: #fff; border-bottom: 1px solid var(--line); }
    .mobile-header img { display: block; width: 130px; }
    .mobile-header-label { margin-left: auto; font-size: 11px; color: #64717a; }
    .menu-toggle, .menu-close { display: inline-flex; width: 44px; height: 44px; }
    .menu-close { align-self: flex-end; }
    .content {
        margin-left: 0;
    }
    .stats, .form-grid, .pos-layout {
        grid-template-columns: 1fr;
    }
    .span-2, .span-3 { grid-column: auto; }
    .pos-summary { position: static; max-height: none; overflow: visible; padding: 20px 0; border-left: 0; border-top: 1px solid var(--line); }
    body:has(.mobile-sale-bar) { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
    .mobile-sale-bar { position: fixed; bottom: 0; inset-inline: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: #fff; }
    .mobile-sale-bar > div { display: grid; gap: 4px; }
    .mobile-sale-bar span { font-size: 12px; color: #64717a; }
    .mobile-sale-bar strong { font-size: 21px; }
    .catalog-brand { position: sticky; top: 0; z-index: 50; padding: 12px 16px; }
    .catalog-brand img { width: 135px; }
    .catalog-brand > a { width: 135px; }
    .catalog-brand span { font-size: 10px; }
}
@media (max-width: 600px) {
    .content { padding: 16px; }
    h1 { font-size: 25px; }
    .finish-card { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px 0; }
    .finish-photo { aspect-ratio: 1.65; }
    .finish-body { padding: 0; gap: 14px; }
    .finish-body h3 { font-size: 21px; }
    .variant-selectors { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 10px; }
    .finish-price { font-size: 24px; }
    .finish-body .btn { min-height: 48px; font-size: 15px; }
    input, select, textarea { font-size: 16px; }
    .variant-selectors select { font-size: 16px; padding: 10px 6px; }
    .cart-row, .cart-row:has(.cart-photo[hidden]) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
    .cart-photo { display: none; }
    .cart-row > label:first-of-type { grid-column: 1 / -1; }
    .topbar { flex-wrap: wrap; }
    .catalog-filters { gap: 8px; }
    .catalog-count { flex-basis: auto; }
    .catalog-document { padding: 20px 16px; }
    .catalog-categories { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
    .category-tab { justify-content: center; padding: 11px 6px; gap: 5px; font-size: 12px; }
    .category-tab svg { width: 16px; height: 16px; }
    .topbar { margin-bottom: 14px; }
    .topbar p { margin: 6px 0 0; }
    .sale-details { padding-bottom: 8px; }
    .catalog-section { margin-top: 12px; }
    .catalog-heading { margin-top: 14px; }
}
@media (max-width: 360px) { .variant-selectors { grid-template-columns: minmax(0, 1fr); } .mobile-header-label { display: none; } .catalog-brand span { font-size: 9px; } }
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
.public-catalog .catalog-brand { gap: 14px; }
.order-open { position: relative; min-height: 44px; }
.order-badge { display: inline-grid; place-items: center; min-width: 23px; height: 23px; padding: 0 5px; background: #263b43; color: #fff; border-radius: 4px; font-size: 12px; }
.public-cart-bar { display: none; }
.order-opened { overflow: hidden; }
.order-dialog { position: fixed; inset: 0; margin: 0 0 0 auto; width: min(490px, 100%); max-width: 100%; height: 100vh; height: 100dvh; max-height: none; padding: 0; border: 0; border-left: 1px solid var(--line); background: #fff; color: var(--ink); }
.order-dialog[open] { display: flex; flex-direction: column; }
.order-dialog::backdrop { background: rgba(13,24,30,.5); }
.order-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(22px + env(safe-area-inset-top)) 22px 18px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.order-dialog-header h2 { font-size: 24px; }
.order-dialog-header p { margin: 6px 0 0; font-size: 13px; }
.order-dialog-body { padding: 0 22px 22px; overflow-y: auto; flex: 1; min-height: 0; overscroll-behavior: contain; }
.order-dialog-footer { padding: 16px 22px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; display: grid; gap: 10px; flex-shrink: 0; }
.order-dialog-footer .btn { min-height: 48px; font-size: 14px; }
.order-dialog-footer #sendOrder { background: #16865e; }
.btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.order-item { display: grid; grid-template-columns: 62px minmax(0,1fr) 40px; gap: 12px; border-bottom: 1px solid var(--line); padding: 20px 0; }
.order-item-photo { width: 62px; height: 62px; border-radius: 4px; object-fit: contain; background: #f0f3f5; }
.order-item-details { min-width: 0; }
.order-item-details h3 { font-size: 16px; line-height: 1.35; overflow-wrap: anywhere; }
.order-item-details p { margin: 5px 0; font-size: 12px; line-height: 1.5; }
.order-item-details code { font-size: 11px; overflow-wrap: anywhere; }
.order-quantity { grid-column: 2 / -1; display: flex; gap: 6px; align-items: center; }
.order-quantity input { width: 72px; text-align: center; padding: 10px 6px; min-height: 44px; }
.order-quantity .icon-button { width: 44px; height: 44px; }
.order-contact { display: grid; gap: 16px; margin-top: 24px; }
.order-contact h3 { font-size: 17px; }
.order-contact p { font-size: 13px; margin: 0; }
.order-empty { display: grid; justify-items: center; gap: 20px; text-align: center; padding: 70px 0; }
.order-empty > svg { width: 46px; height: 46px; color: #7f969f; }
.order-empty h3 { font-size: 19px; }
.order-notice { position: fixed; bottom: 28px; right: 24px; z-index: 55; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 6px; background: #263b43; color: #fff; font-size: 13px; box-shadow: 0 3px 12px rgba(0,0,0,.12); }
@media (max-width: 980px) {
    .public-catalog { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
    .public-catalog .catalog-brand > span { display: none; }
    .public-catalog .catalog-brand > .order-open { margin-left: auto; padding: 8px; gap: 6px; }
    .order-open-label { display: none; }
    .public-cart-bar { display: flex; position: fixed; bottom: 0; inset-inline: 0; z-index: 40; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); }
    .public-cart-bar > div { display: grid; gap: 4px; }
    .public-cart-bar > div > span { font-size: 12px; color: #64717a; }
    .public-cart-bar > div > strong { font-size: 17px; }
    .public-cart-bar .btn { min-height: 46px; font-size: 13px; }
    .order-notice { bottom: calc(94px + env(safe-area-inset-bottom)); right: 16px; }
}
@media (max-width: 600px) {
    .order-dialog { width: 100%; border-left: 0; }
    .order-dialog-body { padding-inline: 16px; }
    .order-dialog-header, .order-dialog-footer { padding-inline: 16px; }
    .order-item { grid-template-columns: 52px minmax(0,1fr) 40px; gap: 10px; }
    .order-item-photo { width: 52px; height: 52px; }
}
