:root {
  --ink: #17283d;
  --muted: #586a7f;
  --brand: #b62937;
  --brand-hover: #94202c;
  --line: #dce3ec;
  --canvas: #f3f6fa;
  --surface: #fff;
  --success: #1b664f;
  --warning: #854b14;
  --shadow: 0 3px 10px #1a345309;
  color: var(--ink);
  background: var(--canvas);
  font: 15px/1.45 'Instrument Sans', 'Inter', 'Segoe UI', sans-serif;
  font-synthesis: none;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled { cursor: default; opacity: .59; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid #3b69a8; outline-offset: 3px; }
h1, h2, p, fieldset { margin: 0; }
h1, h2 { letter-spacing: -.035em; line-height: 1.14; }
h1 { font-size: clamp(1.85rem, 3.8vw, 2.35rem); }
h2 { font-size: 1.27rem; }
.muted { color: var(--muted); }
.sr-only { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }

.topbar { position: sticky; z-index: 3; top: 0; min-height: 70px; display: flex; align-items: center; gap: clamp(14px, 3vw, 40px); padding: 10px clamp(16px, 3vw, 42px); color: #fff; background: #152438; }
.brand { display: flex; flex: 0 0 auto; align-items: center; gap: 11px; font-size: 1.17rem; font-weight: 780; line-height: 1.08; }
.brand small { display: block; margin-top: 4px; color: #b6c5d5; font-size: .72rem; font-weight: 500; }
.brand img { border-radius: 9px; }
.main-nav { display: flex; align-items: center; gap: 6px; }
.nav-button { display: flex; align-items: center; gap: 7px; min-height: 40px; padding: 7px 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #d0dbe8; font-weight: 600; }
.nav-button:hover, .nav-button[aria-current='page'] { background: #263b53; color: #fff; }
.nav-button[aria-current='page'] { border-color: #3a516c; }
.nav-icon { position: relative; width: 14px; height: 12px; border: 1px solid currentColor; border-radius: 2px; }
.nav-icon::after { content: ''; position: absolute; }
.ico-register::after { inset: 3px 2px auto; border-top: 1px solid; }
.ico-stock { transform: rotate(45deg); border-radius: 1px; width: 10px; height: 10px; margin: 0 2px; }
.ico-ticket { width: 11px; height: 14px; }
.ico-ticket::after { inset: 4px 2px auto; border-top: 1px solid; box-shadow: 0 2px; }
.ico-activity { border: 0; width: 14px; height: 13px; border-left: 1px solid; border-bottom: 1px solid; }
.ico-activity::after { inset: 1px 2px 2px; background: linear-gradient(to top,#afc1d4 45%,transparent 45%) left / 2px 100% no-repeat,linear-gradient(to top,#afc1d4 70%,transparent 70%) center / 2px 100% no-repeat,linear-gradient(to top,#afc1d4 100%,transparent 100%) right / 2px 100% no-repeat; }
.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: 13px; }
.store-control select { max-width: 210px; padding: 6px 23px 6px 10px; border: 1px solid #465870; border-radius: 8px; color: #f2f6fb; background: #20324a; font-size: .85rem; }
.store-control select:disabled { appearance: none; opacity: 1; padding-right: 10px; }
.connection { display: inline-flex; align-items: center; gap: 7px; font-size: .84rem; font-weight: 700; white-space: nowrap; color: #dce7f1; }
.connection::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #abb5c0; }
.connection[data-status='online']::before { background: #69d9a2; }
.connection[data-status='offline']::before { background: #ffc075; }
.profile { position: relative; }
.profile summary { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid #54708e; border-radius: 50%; color: #e4f0ff; background: #2b4564; list-style: none; cursor: pointer; font-weight: 750; }
.profile summary::-webkit-details-marker { display: none; }
.profile-menu { position: absolute; top: 48px; right: 0; min-width: 176px; display: grid; gap: 6px; padding: 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); box-shadow: 0 10px 26px #17283d25; }
.profile-menu small { margin-bottom: 6px; color: var(--muted); }

.login-screen { min-height: 100dvh; display: grid; align-items: center; justify-items: center; padding: 18px; background: radial-gradient(ellipse at top, #e1ebf6, var(--canvas) 60%); }
.login-card { display: grid; gap: 13px; width: min(100%, 440px); padding: clamp(26px, 5vw, 42px); border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 20px 55px #17325115; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 1.18rem; }
.login-brand img { border-radius: 10px; }
.login-card h1 { font-size: clamp(1.75rem, 5vw, 2.05rem); }
.login-form { display: grid; gap: 7px; margin-top: 11px; }
.login-form label { font-weight: 700; }
.login-form input { width: 100%; min-height: 45px; margin-bottom: 6px; padding: 7px 10px; border: 1px solid #bdc9d7; border-radius: 8px; color: var(--ink); background: #fff; }
.login-form .primary { margin-top: 8px; }

.workspace { max-width: 1710px; display: grid; grid-template-columns: minmax(0, 1fr) clamp(350px, 32vw, 455px); gap: clamp(18px, 2.3vw, 32px); align-items: start; margin: 0 auto; padding: clamp(18px, 2.6vw, 38px); }
.workspace.stock-view { grid-template-columns: minmax(0, 1fr); }
.catalog-panel { min-width: 0; }
.catalog-heading, .ticket-header, .catalog-footer, .dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.catalog-heading p, .ticket-header p, .dialog-head p { margin-top: 5px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 14px; border-radius: 8px; font-weight: 740; white-space: nowrap; }
.outline { border: 1px solid #d0dae6; background: var(--surface); color: var(--ink); }
.outline:hover:enabled { border-color: #889bb4; background: #f7faff; }
.primary { border: 1px solid transparent; background: var(--brand); color: white; }
.primary:hover:enabled { background: var(--brand-hover); }
.link-button { width: fit-content; align-self: center; padding: 4px 0; border: 0; background: transparent; color: var(--brand-hover); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.count { min-width: 20px; padding: 1px 5px; border-radius: 7px; background: #f9dfe3; color: var(--brand-hover); font-size: .75rem; text-align: center; }

#search-form { position: relative; display: flex; align-items: center; margin: 20px 0 13px; }
#search { width: 100%; min-height: 54px; padding: 8px 48px 8px 43px; color: var(--ink); border: 1px solid #b8c7d9; border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
#search::placeholder { color: var(--muted); }
#search::-webkit-search-cancel-button { margin-right: 7px; }
.search-icon { position: absolute; left: 16px; width: 16px; height: 12px; color: #49637f; pointer-events: none; background: repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 3px, currentColor 3px 5px, transparent 5px 7px); }
.search-icon::after { position: absolute; content: ''; inset: -3px; border: 1px solid currentColor; border-radius: 3px; }
kbd { position: absolute; right: 12px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; background: #f0f4f9; color: var(--muted); pointer-events: none; }
.catalog-controls { display: grid; gap: 10px; margin-bottom: 17px; }
.category-line { display: flex; flex-wrap: wrap; gap: 6px; }
.category-chip { min-height: 35px; padding: 6px 10px; border: 1px solid #d7e0ea; border-radius: 7px; background: #fff; color: #334962; font-size: .82rem; font-weight: 650; }
.category-chip:hover { border-color: #8ea2bb; }
.category-chip[aria-pressed='true'] { color: #8f2331; border-color: #e4b3ba; background: #fdf1f2; }
.catalog-filters { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.catalog-filters label { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); font-size: .83rem; }
.catalog-filters select { min-width: 130px; max-width: min(250px, 58vw); padding: 5px 7px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.results-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.results-head .muted { font-size: .84rem; text-align: right; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 152px), 1fr)); gap: 12px; }
.product { display: flex; position: relative; min-width: 0; flex-direction: column; padding: 0; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: var(--surface); color: var(--ink); text-align: left; box-shadow: var(--shadow); }
.product:hover, .product:focus-visible { border-color: #d18a93; box-shadow: 0 2px 9px #17233719; }
.product-visual { width: 100%; height: 115px; display: grid; place-items: center; overflow: hidden; background: #f7f9fc; border-bottom: 1px solid #edf0f5; color: #71849a; }
.product-visual img { width: 100%; height: 115px; padding: 9px; object-fit: contain; mix-blend-mode: multiply; }
.no-photo-symbol { display: block; width: 33px; height: 28px; border: 1px solid #9cafc3; border-radius: 4px; background: linear-gradient(150deg, transparent 50%, #dfe7f0 50%) center/100% 100%; }
.product-info { padding: 10px 10px 11px; display: grid; flex: 1; grid-template-rows: auto 1fr auto auto; gap: 4px; width: 100%; }
.product-code { color: var(--muted); font-size: .73rem; }
.product-name { display: -webkit-box; font-weight: 720; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .89rem; line-height: 1.33; }
.product-price { align-self: end; color: var(--ink); font-weight: 790; }
.product-old-price { margin-left: .34rem; color: var(--muted); font-size: .74rem; font-weight: 400; }
.product-bottom { display: flex; align-items: center; justify-content: space-between; gap: 3px; }
.product-add { display: grid; place-items: center; flex: 0 0 auto; width: 27px; height: 27px; border-radius: 6px; color: var(--brand-hover); background: #fbeef0; font-size: 1.18rem; }
.product:hover .product-add { background: var(--brand); color: white; }
.stock-label { color: var(--muted); font-size: .72rem; font-weight: 630; }
.stock-label[data-level='available'] { color: var(--success); }
.stock-label[data-level='low'] { color: #875500; }
.stock-label[data-level='empty'] { color: #923344; }
.no-results { grid-column: 1/-1; padding: 22px; border: 1px dashed #c4d0df; border-radius: 8px; background: var(--surface); color: var(--muted); }
.catalog-footer { align-items: center; margin-top: 15px; color: var(--muted); font-size: .85rem; }
.stock-list { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.stock-table, .manager-table { width: 100%; border-collapse: collapse; text-align: left; }
.stock-table th, .stock-table td, .manager-table th, .manager-table td { padding: 8px 13px; border-bottom: 1px solid var(--line); }
.stock-table th, .manager-table th { background: #edf2f8; color: #3d536e; font-size: .81rem; white-space: nowrap; }
.stock-table tr:last-child td, .manager-table tr:last-child td { border: 0; }
.stock-table .stock-label { font-size: .89rem; white-space: nowrap; }
.stock-item { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.stock-item img { flex: none; width: 44px; height: 44px; padding: 3px; object-fit: contain; border-radius: 7px; background: #f3f6fa; }
.stock-item small { display: block; color: var(--muted); }

.ticket-panel { position: sticky; top: 90px; border: 1px solid #d5dfeb; border-radius: 13px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.ticket-header, .ticket-footer { padding: 17px 18px; }
.ticket-header { border-bottom: 1px solid var(--line); }
.customer-section { display: flex; align-items: center; gap: 8px; padding: 10px 18px; border-bottom: 1px solid var(--line); font-size: .85rem; }
.customer-section label { flex: none; font-weight: 700; }
.customer-section select { min-width: 0; width: 100%; padding: 7px 8px; color: var(--ink); background: #f6f8fb; border: 1px solid var(--line); border-radius: 7px; }
.cart { min-height: 178px; max-height: clamp(178px, calc(100dvh - 435px), 590px); overflow: auto; }
.empty-cart { min-height: 178px; display: grid; align-content: center; justify-items: center; gap: 4px; padding: 16px 22px; color: var(--muted); text-align: center; }
.empty-cart strong { color: var(--ink); }
.empty-cart-symbol { display: grid; place-items: center; width: 40px; height: 39px; margin-bottom: 4px; border-radius: 8px; color: #42627f; background: #eaf0f8; }
.empty-cart-symbol::after { content: ''; display: block; width: 14px; height: 17px; border: 1.5px solid; border-radius: 2px; background: repeating-linear-gradient(to bottom, transparent 0 3px, #42627f 3px 4px, transparent 4px 7px) center/8px 11px no-repeat; }
.cart-line { padding: 10px 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; align-items: start; border-bottom: 1px solid #e9edf2; }
.cart-name { overflow-wrap: anywhere; font-size: .89rem; font-weight: 700; }
.cart-code { display: block; color: var(--muted); font-size: .75rem; margin-top: 1px; }
.cart-line-price { font-weight: 740; white-space: nowrap; }
.quantity { display: flex; align-items: center; gap: 6px; }
.quantity button { display: grid; place-items: center; width: 31px; height: 31px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--canvas); color: var(--ink); font-size: 1.02rem; }
.quantity output { min-width: 22px; text-align: center; }
.remove-line { justify-self: end; align-self: center; font-size: .76rem; }
.ticket-footer { display: grid; gap: 9px; border-top: 1px solid var(--line); background: #f9fbfe; }
.total-row, .subtotal-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.total-row { font-size: .97rem; font-weight: 740; }
.total-row strong { font-size: 1.78rem; letter-spacing: -.045em; white-space: nowrap; }
.checkout { width: 100%; justify-content: space-between; min-height: 44px; }
.payment-shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.payment-shortcuts .button { padding-inline: 6px; min-height: 36px; font-size: .85rem; }
.ticket-help { font-size: .78rem; }

dialog { width: min(490px, calc(100vw - 24px)); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 22px; background: var(--surface); box-shadow: 0 20px 52px #15213228; }
dialog::backdrop { background: #15243894; }
.dialog-head { margin-bottom: 17px; }
.icon-button { display: grid; flex: 0 0 auto; place-items: center; width: 34px; height: 34px; border-radius: 7px; padding: 0; border: 1px solid var(--line); background: var(--canvas); color: var(--ink); font-size: 1.3rem; }
.payment-methods { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; border: 0; margin-bottom: 15px; }
.payment-methods legend { font-weight: 740; margin-bottom: 6px; padding: 0; }
.payment-methods label { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
.payment-methods label:has(input:checked) { background: #fcf0f2; border-color: #e7b8be; }
.payment-methods input { accent-color: var(--brand); }
.cash-fields, .delivery-note-fields { display: grid; gap: 5px; margin-bottom: 14px; }
.cash-fields label, .delivery-note-fields label { font-weight: 710; }
.cash-fields input { max-width: 170px; border: 1px solid #bbc9da; border-radius: 7px; min-height: 40px; padding: 5px 8px; }
.delivery-note-fields select { min-height: 40px; width: 100%; padding: 5px 8px; color: var(--ink); background: var(--surface); border: 1px solid #bbc9da; border-radius: 7px; }
.delivery-note-fields p { margin-bottom: 5px; font-size: .87rem; }
.delivery-note-fields input { width: 100%; }
.message { padding: 9px 12px; border-radius: 7px; margin: 0 0 12px; }
.warning { color: var(--warning); background: #fff3e3; }
.sales-list { display: grid; padding: 0; list-style: none; max-height: 45vh; overflow: auto; margin: 0 0 17px; }
.sales-list li { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sales-list li span { display: block; font-size: .85rem; }
.sales-status[data-status='synced'] { color: var(--success); }
.sales-status[data-status='pending'] { color: var(--warning); }
.sales-status[data-status='error'] { color: var(--brand-hover); }
.receipt { background: #f5f8fc; border: 1px dashed #a1b0c3; border-radius: 8px; padding: 13px; margin-bottom: 15px; }
.receipt dl { margin: 8px 0 0; }
.receipt dl div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 4px 0; }
.receipt dd { margin: 0; white-space: nowrap; }
.manager-dialog { width: min(740px, calc(100vw - 24px)); }
.manager-results { overflow-x: auto; margin-bottom: 12px; }
.manager-summary { margin: 0 0 12px; padding: 9px 12px; border-radius: 8px; background: #eef4fa; font-weight: 700; }
.manager-table { margin-bottom: 4px; font-size: .88rem; }
.toast { position: fixed; z-index: 4; bottom: 15px; left: 50%; width: max-content; max-width: calc(100% - 28px); transform: translateX(-50%); border-radius: 8px; background: var(--ink); color: white; padding: 10px 14px; box-shadow: 0 3px 12px #17233337; }
.mobile-ticket { display: none; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(305px, 38%); }
  .topbar { gap: 16px; }
  .topbar-tools { gap: 8px; }
  .nav-icon { display: none; }
  .nav-button { padding-inline: 9px; }
  .store-control select { max-width: 135px; }
}
@media (max-width: 750px) {
  .topbar { position: static; flex-wrap: wrap; gap: 7px 12px; }
  .brand img { width: 32px; height: 32px; }
  .brand small { display: none; }
  .main-nav { order: 3; flex: 1 0 100%; }
  .nav-button { min-height: 35px; }
  .workspace { display: flex; flex-direction: column; gap: 17px; padding-bottom: 71px; }
  .catalog-panel, .ticket-panel { width: 100%; }
  .ticket-panel { position: static; }
  .cart { max-height: none; }
  .mobile-ticket { position: fixed; z-index: 2; right: 12px; left: 12px; bottom: 9px; display: flex; justify-content: space-between; gap: 12px; border-radius: 8px; padding: 11px 14px; background: var(--ink); color: #fff; font-weight: 740; text-decoration: none; }
  .toast { bottom: 62px; }
}
@media (max-width: 415px) {
  .store-control select { max-width: 105px; }
  .connection { font-size: .72rem; }
  .profile summary { width: 33px; height: 33px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .category-chip { padding-inline: 7px; }
  .catalog-heading { align-items: flex-start; }
  #install-button { font-size: .73rem; }
  .stock-table th, .stock-table td { padding-inline: 8px; }
}
