@font-face { font-family: 'Fira Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/RU400.woff2) format('woff2'); unicode-range: U+0400-04FF, U+0500-052F, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Fira Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/EN400.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Fira Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/RU700.woff2) format('woff2'); unicode-range: U+0400-04FF, U+0500-052F, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Fira Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/EN700.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* reset & base */
body { font-family: 'Fira Sans', Arial, sans-serif; margin: 0; padding: 0; font-size: 1.2rem; -webkit-user-select: none; user-select: none; }
input, select, textarea, button { font: inherit; padding: 4px 6px; box-sizing: border-box; vertical-align: middle; outline: none; }
textarea { height: auto; }
.popup input, .popup select, .popup textarea, .order-sidebar input, .order-sidebar textarea { width: 100%; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #aaa; padding: 3px 6px; text-align: left; }
th { background: #f5f5f5; }
tr:nth-child(even) { background: #fff; }
tr:nth-child(odd) { background: #f5f5f5; }
button { cursor: pointer; }
a { text-decoration: none; color: #1e4ea3; outline: none; overflow-wrap: anywhere; word-break: break-word; }
a:hover, a.cur { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }
a.cur:hover { text-decoration: none; }
h1, h2, h3 { font-size: 1.2rem; }
hr { margin-top: 20px; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #f5f5f5; }
::-webkit-scrollbar-thumb { background: #aaa; }

/* layout */
.wrapper { max-width: 1000px; margin: 0 auto; padding: 20px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.page-head h2 { margin: 0; }
nav { margin-bottom: 20px; }
nav a { margin-right: 20px; }

/* utilities */
.ok { color: green; }
.err { color: red; }
.q { color: #888; }
.act, .nowrap { white-space: nowrap; }
.msg-ok { color: green; margin-top: 10px; }
.msg-err { color: red; margin-top: 10px; }
.w-auto { width: auto; }
.w-full { width: 100%; }
.w-300 { width: 300px; }
.w-60 { width: 60px; }
.d-inline { display: inline; }
.text-center { text-align: center; padding: 30px 0; }
.text-right { text-align: right; }

/* modal */
.overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 100; }
.overlay.active { display: flex; justify-content: center; align-items: center; }
.popup { background: #fff; padding: 20px; max-width: 460px; width: 95%; max-height: 90vh; overflow-y: auto; }
.popup h3 { margin-top: 0; margin-bottom: 10px; }
.popup-actions { margin-top: 15px; text-align: right; }

/* login */
.login-page { display: flex; justify-content: center; align-items: center; height: 100dvh; overflow: hidden; }
.login-box { padding: 20px; width: 100%; max-width: 320px; text-align: center; }
.login-box h2 { font-size: 1.4rem; margin-bottom: 10px; }
.pin-display { display: flex; justify-content: center; gap: 10px; margin: 14px 0; }
.pin-dot { width: 16px; height: 16px; border: 2px solid #999; }
.pin-dot.filled { background: #333; border-color: #333; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 260px; margin: 0 auto; }
.pin-btn { height: auto; padding: 14px; font-size: 1.3rem; font-weight: 700; border: 1px solid #aaa; background: #fff; }
.pin-btn:active { background: #eee; }
.pin-enter { background: #333; color: #fff; border-color: #333; }
.pin-enter:active { background: #000; border-color: #000; }

/* topbar */
.topbar { background: #333; color: #fff; padding: 10px; display: flex; justify-content: space-between; align-items: center; font-size: 1.3rem; }
.topbar a { color: #fff; margin-left: 10px; }

/* waiter */
.waiter-page { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
/* waiter mobile cart (hidden on desktop) */
.w-cart-bar { position: fixed; bottom: 0; left: 0; right: 0; background: #333; color: #fff; padding: 12px 16px; justify-content: center; align-items: center; cursor: pointer; z-index: 20; display: none; }
.w-cart-bar.has-items { justify-content: space-between; }
.w-cart-count { background: #fff; color: #333; font-weight: 700; padding: 2px 10px; margin-right: 10px; }
.w-cart-total { font-weight: 700; }
.w-cart-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 30; display: none; }
.w-cart-overlay.active { display: block; }
.w-cart-panel { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; z-index: 31; max-height: 90vh; display: flex; flex-direction: column; transform: translateY(100%); transition: transform 0.25s ease; }
.w-cart-panel.active { transform: translateY(0); }
.w-cart-header { padding: 12px 16px; font-weight: 700; border-bottom: 1px solid #aaa; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.w-cart-close { cursor: pointer; font-size: 1.4rem; padding: 0 4px; }
.w-cart-fields { padding: 8px 16px; flex-shrink: 0; }
.w-cart-fields input { width: 100%; }
.w-cart-items { overflow-y: auto; max-height: 30vh; }
.w-cart-item { display: flex; align-items: center; padding: 8px 16px; border-bottom: 1px solid #eee; }
.w-cart-item-info { flex: 1; }
.w-cart-item-qty { display: flex; align-items: center; gap: 8px; margin-left: 12px; }
.w-cart-item-qty button { width: 32px; height: 32px; font-size: 1.2rem; border: 1px solid #aaa; background: #fff; padding: 0; }
.w-cart-item-qty span { min-width: 24px; text-align: center; font-weight: 700; }
.w-cart-footer { padding: 10px 16px; border-top: 1px solid #aaa; flex-shrink: 0; }
.w-cart-footer-total { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 8px; }
.w-cart-myorders { overflow-y: auto; max-height: 25vh; }
.w-cart-myorders .mo-row { padding: 7px 16px; }

.order-layout { display: flex; flex: 1; overflow: hidden; }
.order-menu { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.order-sidebar { width: 400px; border-left: 1px solid #aaa; display: flex; flex-direction: column; background: #fff; min-height: 0; overflow: hidden; }
.order-new, .order-myorders { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.order-new { flex: 2; border-bottom: 1px solid #aaa; }
.order-myorders { flex: 1; }
.order-myorders-list { flex: 1; overflow-y: auto; }
.order-sidebar-header { padding: 8px 10px; border-bottom: 1px solid #aaa; font-weight: 700; display: flex; justify-content: space-between; }
.order-sidebar-fields { padding: 8px 10px; }
.order-sidebar-fields input { margin-bottom: 6px; }
.order-items { flex: 1; overflow-y: auto; padding: 8px 10px; }
.order-items .text-center, .order-myorders-list .text-center { height: 100%; display: flex; align-items: center; justify-content: center; padding: 0; margin: 0; }
.order-item { padding: 6px 0; border-bottom: 1px solid #aaa; }
.order-item-name { margin-bottom: 4px; }
.order-item-row { display: flex; align-items: center; }
.order-item-qty { display: flex; align-items: center; gap: 4px; }
.order-item-qty button { width: 26px; height: 26px; padding: 0; }
.order-item-qty span { min-width: 20px; text-align: center; }
.order-item-price { margin-left: auto; min-width: 90px; text-align: right; }
.order-item-remove { cursor: pointer; margin-left: 8px; color: red; width: 20px; text-align: right; margin-bottom: 3px; flex-shrink: 0; }
.order-sidebar-footer { padding: 10px; border-top: 1px solid #aaa; background: #f5f5f5; }
.order-total { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 8px; }

/* category tabs */
.cat-tabs { display: flex; flex-wrap: wrap; padding: 10px 10px 0; flex-shrink: 0; border-bottom: 1px solid #aaa; }
.cat-tab { padding: 2px 8px; border: 1px solid #aaa; background: #f5f5f5; cursor: pointer; margin: 0 10px 10px 0; }
.cat-tab.active { background: #333; color: #fff; border-color: #333; }

/* product grid */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; flex: 1; overflow-y: auto; padding: 10px; align-content: start; }
.product-card { min-height: 120px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px; text-align: center; color: #fff; }
.product-card:active { opacity: 0.8; }
.product-card b { word-break: break-word; margin-bottom: 5px; }

/* my orders list */
.mo-row { display: flex; padding: 7px 12px; border-bottom: 1px solid #aaa; cursor: pointer; }
.mo-row:active { background: #f5f5f5; }
.mo-row > span:first-child { min-width: 50px; }
.mo-status { flex: 1; margin: 0 12px; }
.mo-price { text-align: right; white-space: nowrap; }
.centered { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0; }

/* pagination */
.pager { margin-top: 10px; }
.pager a, .pager span { padding: 3px 8px; border: 1px solid #aaa; margin-right: -1px; text-decoration: none; color: #aaa; }
.pager span { background: #333; color: #fff; border-color: #333; }

/* admin filters */
.filter-form { margin-bottom: 10px; }
.filter-form select, .filter-form input[type="date"] { width: auto; }

/* kitchen */
.kitchen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(480px, 1fr)); gap: 10px; padding: 10px; }
.k-card { color: #fff; font-size: 1.2rem; display: flex; flex-direction: column; }
.k-head { padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.2); }
.k-head b { font-size: 1.4rem; }
.k-body { padding: 14px 18px; }
.k-item { padding: 4px 0; }
.k-comment { padding: 0 0 4px 24px; opacity: 0.8; }
.k-order-comment { padding: 10px 18px; background: rgba(0,0,0,0.15); }
.k-footer, .k-footer-text { padding: 12px 18px; background: rgba(0,0,0,0.1); margin-top: auto; }
.k-footer { display: flex; justify-content: space-between; align-items: center; }
.k-footer-text { opacity: 0.8; }
.k-btn { background: #fff; font-weight: 700; border: none; padding: 6px 20px; cursor: pointer; font-size: 1.2rem; }
.k-tabs { display: flex; gap: 6px; }
.k-tab { background: transparent; color: #fff; border: 1px solid #fff; padding: 4px 12px; font-size: 1.1rem; cursor: pointer; }
.k-tab.active { background: #fff; color: #333; }

/* receipt */
.receipt { max-width: 48mm; margin: 0 auto; font-size: 0.75rem; }
.receipt-title { text-align: center; font-weight: 700; font-size: 0.9rem; margin-bottom: 4px; }
.receipt p, .receipt-line, .receipt-table td, .receipt-footer { font-size: 0.7rem; }
.receipt p { margin: 4px 0; }
.receipt hr { border: none; border-top: 1px dashed #333; margin: 4px 0; }
.receipt-table { width: 100%; }
.receipt-table td { border: none; padding: 1px 0; vertical-align: top; }
.receipt-table tr:nth-child(odd), .receipt-table tr:nth-child(even) { background: none; }
.receipt-line { display: flex; justify-content: space-between; padding: 2px 0; }
.receipt-total { font-weight: 700; font-size: 0.85rem; }
.receipt-footer { text-align: center; color: #888; margin-top: 4px; }

/* public menu */
.menu-page { background: #f8f8f8; padding-bottom: 60px; color: #222; }
.m-topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 10; }
.m-header { background: #1a1a1a; color: #fff; padding: 12px 16px; text-align: center; font-weight: 700; font-size: 1.2rem; letter-spacing: 0.5px; }
.m-cats { display: flex; overflow-x: auto; padding: 4px 0; background: #fff; border-bottom: 1px solid #e0e0e0; scrollbar-width: none; -ms-overflow-style: none; }
.m-cats::-webkit-scrollbar { display: none; }
.m-cat { padding: 8px 14px; margin: 4px 4px 4px 0; white-space: nowrap; cursor: pointer; border: none; border-radius: 20px; color: #666; background: transparent; flex-shrink: 0; font-size: 0.95rem; transition: all 0.2s; }
.m-cat:first-child { margin-left: 8px; }
.m-cat.active { color: #fff; background: #1a1a1a; font-weight: 700; }
.m-section { padding: 16px; max-width: 700px; margin: 0 auto; margin-top: 90px; }
.m-section-title { font-weight: 700; font-size: 1.1rem; padding: 12px 0 8px; color: #333; border-bottom: 2px solid #e0e0e0; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
.m-product { display: flex; justify-content: space-between; align-items: center; background: #fff; padding: 14px 16px; margin-bottom: 8px; border: none; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); transition: box-shadow 0.2s; }
.m-product:active { box-shadow: 0 1px 8px rgba(0,0,0,0.12); }
.m-product-info { flex: 1; margin-right: 12px; }
.m-product-name { font-weight: 700; margin-bottom: 4px; font-size: 1.05rem; }
.m-product-price { color: #666; font-size: 0.95rem; }
.m-product-btn { background: #1a1a1a; color: #fff; border: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 1.4rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.2s; }
.m-product-btn:active, .m-product-btn.added { background: green; }
.m-cart-bar { position: fixed; bottom: 0; left: 0; right: 0; background: #1a1a1a; color: #fff; padding: 20px 20px 60px 20px; justify-content: space-between; align-items: center; cursor: pointer; z-index: 20; display: none; }
.m-cart-bar.visible { display: flex; }
.m-cart-count { background: #fff; color: #1a1a1a; font-weight: 700; padding: 2px 10px; margin-right: 10px; border-radius: 12px; font-size: 0.9rem; }
.m-cart-total { font-weight: 700; font-size: 1.1rem; }
.m-cart-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 30; display: none; }
.m-cart-overlay.active { display: block; }
.m-cart-panel { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; z-index: 31; max-height: 85vh; display: flex; flex-direction: column; transform: translateY(100%); transition: transform 0.3s ease; border-radius: 16px 16px 0 0; }
.m-cart-panel.active { transform: translateY(0); }
.m-cart-header { padding: 16px 20px; font-weight: 700; font-size: 1.1rem; border-bottom: 1px solid #e0e0e0; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.m-cart-close { cursor: pointer; font-size: 1.4rem; padding: 0 4px; color: #888; }
.m-cart-list { flex: 1; overflow-y: auto; }
.m-cart-item { display: flex; align-items: center; padding: 12px 20px; border-bottom: 1px solid #f0f0f0; }
.m-cart-item-info { flex: 1; }
.m-cart-item-name { margin-bottom: 2px; font-weight: 600; }
.m-cart-item-price { color: #666; font-size: 0.9rem; }
.m-cart-item-qty { display: flex; align-items: center; gap: 10px; margin-left: 12px; }
.m-cart-item-qty button { width: 34px; height: 34px; font-size: 1.2rem; border: 1px solid #ddd; background: #fff; cursor: pointer; padding: 0; border-radius: 8px; }
.m-cart-item-qty button:active { background: #f0f0f0; }
.m-cart-item-qty span { min-width: 24px; text-align: center; font-weight: 700; }
.m-cart-footer { padding: 16px 20px 80px 20px; flex-shrink: 0; }
.m-cart-footer-line { display: flex; justify-content: space-between; color: #666; font-size: 0.95rem; margin-bottom: 8px; }
.m-cart-footer-total { display: flex; justify-content: space-between; font-weight: 700; font-size: 1.2rem; }

/* responsive */
@media (max-width: 768px) {
    body, input, select, textarea, button, th, td { font-size: 1rem; }
    .wrapper { padding: 10px; }
    nav { display: flex; overflow-x: auto; white-space: nowrap; margin-bottom: 10px; scrollbar-width: none; -ms-overflow-style: none; }
    nav::-webkit-scrollbar { display: none; }
    nav a { margin-right: 14px; flex-shrink: 0; }
    .table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table-wrap table { min-width: 100%; white-space: nowrap; }
    .w-300 { width: 100%; }
    .filter-form { display: flex; flex-wrap: wrap; gap: 6px; }
    .page-head { flex-wrap: wrap; gap: 8px; }
    /* waiter mobile */
    .waiter-page { height: 100vh; overflow: hidden; padding-bottom: 52px; }
    .order-layout { flex-direction: column; }
    .order-menu { flex: 1; min-height: 0; }
    .order-sidebar { display: none; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .product-card { min-height: auto; }
    .w-cart-bar { display: none; }
    .w-cart-bar.visible { display: flex !important; }
    /* kitchen mobile */
    .topbar { flex-wrap: wrap; gap: 6px; font-size: 1rem; padding: 8px 10px; }
    .k-tabs { order: 3; width: 100%; }
    .k-tab { flex: 1; font-size: 1rem; padding: 6px 8px; }
    .kitchen-grid { grid-template-columns: 1fr; gap: 8px; padding: 8px; }
    .k-head { padding: 10px 12px; }
    .k-head b { font-size: 1.2rem; }
    .k-body { padding: 10px 12px; }
    .k-order-comment { padding: 8px 12px; }
    .k-footer, .k-footer-text { padding: 10px 12px; }
    .k-btn { padding: 10px 24px; font-size: 1.1rem; }
}
@media print {
    @page { size: 58mm auto; margin: 0; }
    html, body { width: 58mm; height: auto; margin: 0 !important; padding: 0 !important; overflow: visible !important; }
    body > *:not(#receiptModal) { display: none !important; }
    #receiptModal { display: block !important; position: static !important; background: none !important; width: 48mm; height: auto !important; inset: auto !important; }
    #receiptModal > .popup { display: block !important; position: static !important; background: none !important; padding: 0 !important; margin: 0 !important; max-width: none !important; width: 48mm !important; max-height: none !important; overflow: visible !important; }
    .receipt { width: 48mm; max-width: 48mm; font-size: 10px; margin: 0; padding: 0; }
    .receipt-title { font-size: 12px; }
    .receipt p, .receipt-table td, .receipt-line, .receipt-footer { font-size: 10px; }
    .receipt-total { font-size: 11px; }
    .receipt table { page-break-inside: avoid; }
}
