* {
    box-sizing: border-box
}

:root {
    --ink: #17212b;
    --muted: #5f6f77;
    --line: #e8eceb;
    --surface: #ffffff;
    --surface-soft: #fff8f5;
    --canvas: #e6e6e6;
    --sidebar: #18232b;
    --sidebar-soft: #22313a;
    --primary: #ef6a56;
    --primary-dark: #d95442;
    --primary-soft: #fff1ee;
    --accent: #ef6a56;
    --accent-dark: #d95442;
    --accent-soft: #fff5df;
    --danger: #b91c1c;
    --danger-soft: rgba(185, 28, 28, .12);
    --danger-glow: rgba(185, 28, 28, .2);
    --success: #15803d;
    --button-bg: #f5f7f8;
    --button-text: #17212b;
    --button-border: #dfe6e8;
    --info: #0476bd;
    --shadow: 0 14px 40px rgba(16, 37, 46, .08);
    --shadow-soft: 0 8px 22px rgba(19, 43, 45, .06);
    --radius: 18px;
    --radius-sm: 12px;
    --radius-lg: 22px;
    --header-height: 72px;
    --mobile-footer-height: calc(68px + env(safe-area-inset-bottom, 0px));
}

body.dark {
    --ink: #edf3f4;
    --muted: #a2b7ba;
    --line: #34444b;
    --surface: #233139;
    --surface-soft: #1a2a31;
    --canvas: #121c21;
    --sidebar: #0d1519;
    --sidebar-soft: #263941;
    --primary: #ef6a56;
    --primary-dark: #d95442;
    --primary-soft: rgba(239, 106, 86, .12);
    --accent: #ef6a56;
    --accent-dark: #d95442;
    --button-bg: #30434b;
    --button-text: #f3f7f7;
    --button-border: #4a6068;
    --billiard-card: #1d2a31;
    --status-available-bg: #173b2b;
    --status-available-text: #86efac;
    --status-playing-bg: #46351a;
    --status-playing-text: #fcd34d;
    --status-reserved-bg: #2d2d56;
    --status-reserved-text: #c7d2fe;
    --shadow: 0 18px 42px rgba(0, 0, 0, .34);
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--canvas);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

html {
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

button {
    transition: all .2s ease;
}

input,
select {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--button-border);
    border-radius: 12px;
    padding: 12px 14px;
    background: var(--surface);
    color: var(--ink);
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(27, 123, 92, .10);
    background: var(--surface);
}

button:hover,
.btn:hover,
.checkout:hover {
    transform: translateY(-1px);
}

.btn,
.checkout,
.text-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 700;
    letter-spacing: .01em;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

.btn {
    background: var(--mint);
    border-color: var(--accent);
    color: var(--accent);
}

.btn.primary,
.checkout {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary);
    color: #fff;
}

.btn.primary.full,
.btn.full.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary);
    color: #fff;
}

.text-btn {
    background: transparent;
    border-color: transparent;
    color: var(--primary-dark);
}

.text-btn:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.card,
.panel,
.billiard-toolbar,
.billiard-card,
.modal-box {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

body.login-page-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at top left, rgba(239, 106, 86, .16), transparent 32%),
        radial-gradient(circle at bottom right, rgba(242, 185, 74, .12), transparent 28%),
        var(--canvas);
}

.login-shell {
    width: min(980px, calc(100% - 32px));
    min-height: 620px;
    display: grid;
    grid-template-columns: 1.06fr 1fr;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 30px 70px rgba(23, 33, 43, .12);
    backdrop-filter: blur(10px);
}

.login-panel {
    padding: 34px;
}

.login-branding {
    background: linear-gradient(135deg, #17212b 0%, #1f2d36 40%, #233b42 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.login-branding::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 10%, rgba(255, 255, 255, .12), transparent 30%);
    pointer-events: none;
}

.brand-block,
.feature-list {
    position: relative;
    z-index: 1;
}

.brand-logo {
    font-size: clamp(2rem, 2.8vw, 3rem);
    font-weight: 800;
    letter-spacing: .05em;
    margin-bottom: 10px;
}

.brand-logo span {
    color: #ffb5a3;
}

.brand-tag {
    margin: 0;
    color: rgba(255,255,255,.8);
    font-size: 1.04rem;
    max-width: 280px;
    line-height: 1.6;
}

.feature-list {
    display: grid;
    gap: 18px;
    margin-top: 40px;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 16px;
    background: rgba(255,255,255,.04);
}

.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(239, 106, 86, .18);
    color: #ffd1c7;
    font-size: 16px;
    font-weight: 700;
}

.feature-item strong {
    display: block;
    margin-bottom: 5px;
    font-size: 1rem;
}

.feature-item small {
    color: rgba(255,255,255,.72);
    display: block;
    line-height: 1.5;
}

.login-form-panel {
    background: linear-gradient(180deg, rgba(255,255,255,.82), rgba(244,246,245,.94));
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: min(100%, 420px);
    padding: 10px 4px;
}

.login-header {
    margin-bottom: 26px;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--accent-dark);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: 11px;
}

.login-header h1 {
    margin: 0;
    font-size: clamp(2rem, 3vw, 2.5rem);
    color: var(--ink);
}

.login-form {
    display: grid;
    gap: 18px;
}

.field-label {
    display: grid;
    gap: 9px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
}

.field-label span {
    color: var(--ink);
}

.field-label input {
    width: 100%;
    padding: 15px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.9);
    color: var(--ink);
    font-size: 1rem;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.field-label input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(239,106,86,.12);
}

.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 82px;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--accent-dark);
    font-weight: 700;
    cursor: pointer;
}

.login-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    color: var(--muted);
}

.remember-me {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.remember-me input {
    accent-color: var(--accent);
}

.login-meta a {
    color: var(--accent-dark);
    text-decoration: none;
    font-weight: 600;
}

.login-btn,
.secondary-btn {
    width: 100%;
    border: 0;
    border-radius: 12px;
    padding: 15px 16px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.login-btn {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: #fff;
    box-shadow: 0 14px 26px rgba(239, 106, 86, 0.28);
}

.secondary-btn {
    background: var(--button-bg);
    color: var(--button-text);
    border: 1px solid var(--button-border);
}

.login-btn:hover,
.secondary-btn:hover {
    transform: translateY(-1px);
}

.divider {
    position: relative;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.divider::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: var(--line);
}

.divider span {
    position: relative;
    display: inline-block;
    padding: 0 14px;
    background: rgba(244,246,245,.96);
}

@media (max-width: 1024px) {
    .login-shell {
        width: min(880px, calc(100% - 28px));
        min-height: 560px;
    }
}

@media (max-width: 820px) {
    .login-shell {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .login-branding {
        min-height: 100px;
        padding-bottom: 28px;
    }

    .feature-list {
        display: none;
    }
}

@media (min-width: 821px) {
    .feature-list {
        display: grid;
    }
}

@media (max-width: 560px) {
    body.login-page-body {
        padding: 18px 0;
    }

    .login-shell {
        width: min(100% - 18px, 540px);
        border-radius: 18px;
    }

    .login-panel {
        padding: 20px 18px;
    }

    .login-card {
        width: 100%;
    }

    .login-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .field-label input,
    .login-btn,
    .secondary-btn {
        padding-top: 14px;
        padding-bottom: 14px;
    }
}

@media (max-width: 420px) {
    .brand-logo {
        font-size: 2.1rem;
    }

    .brand-tag {
        font-size: .96rem;
    }

    .feature-item {
        padding: 12px 13px;
    }

    .feature-item strong {
        font-size: .94rem;
    }
}

.app {
    display: flex;
    min-height: 100vh;
}

.mobile-footer-nav {
    display: none;
}

.sidebar {
    width: 78px;
    background: linear-gradient(180deg, var(--sidebar) 0%, #101d22 100%);
    color: #fff;
    padding: 18px 12px;
    position: fixed;
    height: calc(100vh - var(--header-height));
    left: 0;
    top: var(--header-height);
    transition: width .28s ease, padding .28s ease;
    z-index: 12;
    border-right: 1px solid rgba(255, 255, 255, .06);
}

.sidebar.hidden {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    overflow: hidden;
}

.sidebar.expanded {
    width: 240px;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 14, 18, .24);
    backdrop-filter: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
    z-index: 25;
}

body.sidebar-expanded .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
}

@media (min-width: 769px) {
    .sidebar-backdrop {
        backdrop-filter: none;
        opacity: 0 !important;
        visibility: hidden !important;
    }
}

.sidebar nav {
    display: grid;
    gap: 8px;
}

.nav-btn {
    border: 0;
    background: transparent;
    color: rgba(255,255,255,.72);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .25s ease, box-shadow .25s ease, color .25s ease;
}

.nav-btn:hover,
.nav-btn.active {
    background: rgba(255,255,255,.07);
    box-shadow: inset 3px 0 var(--primary);
    color: #fff;
}

.nav-icon {
    flex: 0 0 22px;
    display: inline-flex;
    position: relative;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}

.nav-notification-dot {
    position: absolute;
    top: -2px;
    right: -4px;
    width: 10px;
    height: 10px;
    border: 2px solid var(--sidebar);
    border-radius: 50%;
    background: #dc2626;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .45);
    z-index: 1;
}

.nav-label {
    margin-left: 10px;
    white-space: nowrap;
    opacity: 1;
}

.sidebar.collapsed .nav-btn {
    justify-content: center;
    padding-left: 10px;
    padding-right: 10px;
}

.sidebar.collapsed .nav-label {
    display: none;
}

.sidebar-toggle {
    display: grid;
    place-items: center;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    box-shadow: var(--shadow-soft);
    border-radius: 10px;
    transition: transform .18s ease, background .18s ease;
}

.sidebar-toggle:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary);
    color: #fff;
    transform: scale(1.06);
}

.main {
    margin-left: 78px;
    width: calc(100% - 78px);
    height: 100vh;
    min-height: 100vh;
    padding-top: var(--header-height);
    transition: margin-left .28s ease, width .28s ease;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--line);
}

.main::-webkit-scrollbar {
    width: 8px;
}

.main::-webkit-scrollbar-track {
    background: var(--line);
    border-radius: 999px;
}

.main::-webkit-scrollbar-thumb {
    background: var(--primary);
    border: 2px solid var(--line);
    border-radius: 999px;
}

body.sidebar-hidden .main {
    margin-left: 0;
    width: 100%;
}

body.sidebar-expanded .main {
    margin-left: 240px;
    width: calc(100% - 240px);
}

.topbar {
    height: var(--header-height);
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 24px 0 18px;
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
    top: 0;
    z-index: 20;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

.topbar-title {
    margin-left: 16px;
    display: flex;
    align-items: center;
    text-align: left;
    gap: 12px;
}

.topbar-brand {
    font-size: clamp(1.6rem, 2vw, 2.4rem);
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.topbar-brand span {
    color: var(--accent-dark);
    font-weight: 600;
}

.topbar small {
    display: block;
    color: var(--muted);
    margin-top: 3px;
}

.user-menu {
    position: relative;
}

.user {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 9px 11px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
}

.user:hover,
.user[aria-expanded="true"] {
    border-color: var(--primary);
    color: var(--primary-dark);
}

.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 180px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
    z-index: 30;
    overflow: hidden;
    animation: dropdownIn .16s ease-out both;
}

.user-dropdown.show {
    margin-top: 15px;
    display: grid;
}

.user-dropdown button {
    border: 0;
    border-radius: 10px;
    padding: 10px 12px;
    background: transparent;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.user-dropdown-header {
    display: grid;
    gap: 3px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--line);
}

.user-dropdown-header small {
    color: var(--muted);
    font-size: 11px;
}

.user-dropdown-content {
    display: grid;
    gap: 2px;
    padding: 7px;
}

.user-dropdown-footer {
    padding: 7px;
    border-top: 1px solid var(--line);
}

.user-dropdown .logout-button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    color: var(--primary-dark);
}

.user-dropdown .logout-button:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.user-dropdown button:hover {
    background: rgba(27, 123, 92, .08);
    color: var(--primary-dark);
}

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: translateY(-5px) scale(.98)
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1)
    }
}

.theme-toggle {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    box-shadow: var(--shadow-soft);
    transition: transform .18s ease, background .18s ease, color .18s ease;
}

.theme-toggle:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary);
    color: #fff;
}

.page {
    display: none;
    padding: 18px 18px 20px;
}

.page.active {
    display: block;
    animation: pageSlideIn .28s ease-out both;
}

@keyframes pageSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20%)
    }

    to {
        opacity: 1;
        transform: translateX(0)
    }
}

.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.chart-panel {
    margin-bottom: 22px;
}

.chart-wrap {
    width: 100%;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(239, 106, 86, 0.03), rgba(245, 158, 11, 0.02));
    padding: 18px 14px 10px;
}

.sales-chart {
    width: 100%;
    min-height: 220px;
}

.chart-grid {
    height: 220px;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    align-items: end;
    gap: 12px;
    padding-top: 10px;
}

.chart-column {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

.chart-bar-wrap {
    width: 100%;
    min-height: 160px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    position: relative;
    border-bottom: 1px solid var(--line);
    padding: 0 8px 0;
}

.chart-bar {
    width: 100%;
    max-width: 52px;
    min-height: 12px;
    border-radius: 12px 12px 0 0;
    background: linear-gradient(180deg, #ef6a56 0%, #f59e0b 100%);
    box-shadow: 0 8px 18px rgba(239, 106, 86, 0.22);
}

.bar-value {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--ink);
    font-weight: 700;
    white-space: nowrap;
}

.chart-label {
    font-size: 11px;
    color: var(--muted);
    text-align: center;
}

.muted-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.dashboard-summary {
    display: grid;
    gap: 12px;
}

.dashboard-summary.compact {
    max-height: 340px;
    overflow-y: auto;
}

.stats-stack {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.mini-stat,
.mini-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
}

.mini-stat {
    flex-direction: column;
    align-items: flex-start;
    min-height: 76px;
}

.mini-stat span,
.mini-row span {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.mini-stat strong,
.mini-row strong {
    font-size: 1.05rem;
    color: var(--ink);
}

.mini-row.ready {
    border-color: rgba(21, 128, 61, .28);
    background: rgba(21, 128, 61, .06);
}

.mini-row.in-use {
    border-color: rgba(245, 158, 11, .38);
    background: rgba(245, 158, 11, .08);
}

.card,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-soft);
}

.card {
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
}

.card small {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 11px;
    font-weight: 700;
}

.card h2 {
    margin: 12px 0 0;
    font-size: clamp(1.6rem, 2vw, 2rem);
    color: var(--ink);
}

.panel-head,
.page-actions,
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panel-head h3 {
    margin: auto;
    margin-left: 5px;
    font-size: 1.08rem;
}

.panel-head.co {
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.page-actions {
    margin-bottom: 18px;
}

.page-actions h2 {
    margin: 0;
    font-size: clamp(1.4rem, 2vw, 1.9rem);
}

.btn:disabled,
.checkout:disabled {
    background: var(--button-bg);
    border-color: var(--button-border);
    color: var(--muted);
    opacity: .6;
    box-shadow: none;
    transform: none;
}

.toolbar {
    justify-content: flex-start;
    margin-bottom: 10px;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
    width: 100%;
    min-width: 0;
}

.toolbar input {
    max-width: 400px;
}

.toolbar select {
    max-width: 200px;
}

.pos-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 18px;
    align-items: start;
}

.product-panel {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 92px;
    align-self: start;
    height: calc(100vh - 116px);
    min-height: 560px;
    max-height: calc(100vh - 116px);
    overflow: hidden;
}

.product-grid {
    padding: 8px 10px 0;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    direction: ltr;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--line);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.product-grid>* {
    direction: ltr
}

.product-grid::-webkit-scrollbar {
    width: 8px
}

.product-grid::-webkit-scrollbar-track {
    background: var(--line);
    border-radius: 999px
}

.product-grid::-webkit-scrollbar-thumb {
    background: var(--accent);
    border: 2px solid var(--line);
    border-radius: 999px
}

.product-grid::-webkit-scrollbar-thumb:hover {
    background: var(--accent-dark)
}

.product-grid>.empty {
    grid-column: 1 / -1;
    display: grid;
    place-items: center;
    min-height: 300px;
    padding: 24px
}

.product-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: auto;
    padding-top: 20px
}

.product-pagination .btn:disabled {
    cursor: not-allowed;
    opacity: .5
}

.product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 142px;
    min-width: 150px;
    height: 142px;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.product-card.disabled {
    cursor: not-allowed;
    opacity: .52;
    filter: grayscale(.15);
    background: linear-gradient(180deg, var(--button-bg) 0%, var(--surface) 100%);
    border-color: var(--button-border);
}

.product-card.disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--button-border);
}

.product-grid.is-locked .product-card {
    pointer-events: none;
    cursor: not-allowed;
    opacity: .48;
    filter: grayscale(.35);
}

.product-card:hover {
    border-color: var(--primary);
    box-shadow: 0 12px 24px rgba(27, 123, 92, .12);
    transform: translateY(-2px);
}

.product-card strong {
    display: block;
    font-weight: 700;
    margin-bottom: 7px;
    font-size: 1rem;
}

.price {
    color: var(--primary-dark);
    font-weight: 700;
}

.price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.stock {
    color: var(--mint);
    font-size: 11px;
}

.stock.low {
    color: var(--accent-dark)
}

.stock-category {
    margin-top: auto;
    padding-top: 14px;
    color: var(--muted);
    font-size: 12px
}

.cart-panel {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 92px;
    align-self: start;
    height: calc(100vh - 116px);
    min-height: 560px;
    max-height: calc(100vh - 116px);
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
    overflow: hidden;
}

.cart-head-actions {
    display: flex;
    align-items: center;
    gap: 8px
}

.cart-view-toggle {
    display: none;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--button-border);
    border-radius: 7px;
    background: var(--button-bg);
    color: var(--button-text);
    cursor: pointer;
    font-size: 18px;
    line-height: 1
}

.cart-view-toggle:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff
}

.cart-modal-backdrop {
    display: none
}

body.cart-modal-open {
    overflow: hidden
}

.cart-modal-backdrop.show {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(18, 29, 35, .58);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 14
}

.cart-panel.is-modal {
    position: fixed;
    top: 15px;
    right: 15px;
    bottom: 15px;
    left: 15px;
    width: auto;
    height: 80vh;
    min-height: 0;
    max-height: none;
    z-index: 15;
    border-radius: 16px;
    box-shadow: 0 22px 60px rgba(10, 20, 24, .32)
}

.cart-panel.is-modal .cart-items {
    display: block;
}

.cart-items {
    padding-right: 10px;
    padding-left: 10px;
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    direction: ltr;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--line)
}

.cart-items::-webkit-scrollbar {
    width: 8px
}

.cart-items::-webkit-scrollbar-track {
    background: var(--line);
    border-radius: 999px
}

.cart-items::-webkit-scrollbar-thumb {
    background: var(--accent);
    border: 1px solid var(--line);
    border-radius: 999px
}

.cart-items::-webkit-scrollbar-thumb:hover {
    background: var(--accent-dark)
}

.cart-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 6px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.46);
    border-radius: 12px;
    margin-bottom: 8px;
    direction: ltr;
}

body.dark .cart-row {
    background: rgba(21, 31, 36, .9);
    border-color: var(--line);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.02);
}

.delete-cart-item {
    display: inline-flex;
    justify-content: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    margin-right: 2px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 0;
}

.delete-cart-item:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.confirm-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 22px
}

.confirm-actions .btn {
    min-width: 110px
}

.confirm-actions .danger {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff
}

.confirm-actions .danger:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark)
}

.cart-row strong {
    font-weight: 500;
    font-size: 15px;
}

.cart-info {
    min-width: 0
}

.cart-info strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.cart-actions {
    display: flex;
    min-width: 82px;
    align-items: flex-end;
    flex-direction: column;
    gap: 7px
}

.cart-actions>strong {
    color: var(--accent-dark);
    white-space: nowrap
}

body.dark .cart-actions>strong,
body.dark .cart-row strong,
body.dark .cart-row small,
body.dark .cart-info strong {
    color: var(--ink);
}

.cart-row small {
    display: block;
    color: var(--muted);
    padding-top: 5px;
}

.qty button {
    display: inline-flex;
    justify-content: center;
    border: 1px solid var(--button-border);
    background: var(--surface);
    color: var(--button-text);
    width: 20px;
    height: 22px;
    border-radius: 5px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.qty {
    display: flex;
    align-items: center;
    gap: 5px
}

.qty span {
    min-width: 16px;
    text-align: center;
    font-size: 13px
}

.qty .qty-value {
    min-width: 24px;
    width: auto;
    height: 22px;
    padding: 0 3px;
    border-color: transparent;
    background: transparent;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
}

.qty .qty-value:hover {
    border-color: var(--line);
    background: var(--surface);
}

.qty button:hover {
    border-color: var(--accent);
    color: var(--accent-dark)
}

.totals {
    margin-top: auto;
    border-top: 1px solid var(--line);
}

.totals>div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0;
    color: var(--muted);
}

.totals > .billed-customer-info {
    justify-content: flex-start;
    gap: 6px;
    padding-bottom: 8px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--line);
}

.billed-customer-info strong {
    color: var(--ink);
}

.grand {
    font-size: 15px;
    color: var(--primary-dark);
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid var(--line);
}

.checkout {
    width: 100%;
    margin-top: 15px;
    padding: 14px;
}

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

th,
td {
    text-align: left;
    padding: 13px;
    border-bottom: 1px solid var(--line);
}

tbody tr:hover {
    background: rgba(27, 123, 92, .04);
}

th {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.badge {
    padding: 5px 9px;
    border-radius: 20px;
    background: var(--mint-soft);
    color: #237862;
    font-size: 12px
}

.empty {
    padding: 50px;
    text-align: center;
    color: var(--muted)
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px
}

.form-grid label {
    font-size: 13px;
    font-weight: 600
}

.form-grid input {
    display: block;
    margin-top: 7px
}

.full {
    width: 100%;
    margin-top: 20px
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(14, 25, 29, .58);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    z-index: 35;
    animation: modalBackdropIn .22s ease-out both;
}

.modal.show {
    display: flex;
}

.modal-box {
    background: var(--surface);
    border-radius: 20px;
    padding: 24px;
    width: min(500px, 92%);
    position: relative;
    box-shadow: inset 3px 0 var(--primary);
    animation: modalPanelIn .28s cubic-bezier(.22, 1, .36, 1) both;
}

.table-session-modal {
    width: min(540px, calc(100% - 32px));
    max-height: min(720px, calc(100vh - 32px));
    overflow-y: auto;
}

.billiard-bill-modal {
    width: min(620px, calc(100% - 32px));
    padding: 28px;
}

.billiard-bill-icon {
    background: color-mix(in srgb, var(--mint) 18%, var(--surface));
    color: var(--mint);
}

.billiard-bill-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 22px 0 14px;
    padding: 16px 18px;
    border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--line));
    border-radius: 12px;
    background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}

.billiard-bill-heading span,
.billiard-bill-details span,
.billiard-bill-total span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.billiard-bill-heading strong {
    color: var(--accent-dark);
    font-size: 22px;
}

.billiard-bill-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--line);
}

.billiard-bill-details>div {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    background: var(--surface);
}

.billiard-bill-details strong {
    color: var(--ink);
    font-size: 13px;
}

.billiard-bill-total {
    display: grid;
    gap: 14px;
    margin-top: 18px;
    padding: 18px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--canvas) 75%, var(--surface));
}

.billiard-bill-total>div,
.billiard-bill-grand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.billiard-bill-total label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.billiard-bill-total input {
    width: 150px;
    margin: 0;
    background: var(--surface);
    color: var(--ink);
}

.billiard-bill-grand {
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.billiard-bill-grand span {
    color: var(--ink);
}

.billiard-bill-grand strong {
    color: var(--mint);
    font-size: 24px;
}

.billiard-bill-actions {
    margin-top: 20px;
}

.silent-alarm {
    border-color: var(--primary);
    color: var(--primary-dark);
    background: var(--primary-soft);
}

.silent-alarm:hover,
.silent-alarm:focus-visible {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 10px 22px rgba(239, 106, 86, 0.18);
}

.continue-playing-modal .modal-box {
    max-width: 420px;
}

.continue-playing-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

@media (max-width: 560px) {
    .billiard-bill-modal {
        padding: 20px;
    }

    .billiard-bill-details {
        grid-template-columns: 1fr;
    }

    .billiard-bill-total label {
        align-items: flex-start;
        flex-direction: column;
    }

    .billiard-bill-total input {
        width: 100%;
    }

    .table-session-modal {
        width: calc(100% - 20px);
        max-height: calc(100vh - 20px);
        padding: 18px;
    }

    .table-session-modal .table-mode-fields {
        padding: 12px;
    }
}

.table-session-modal>h2 {
    margin: 0 0 22px;
    padding-right: 28px;
    font-size: 22px;
}

.table-session-modal>label,
.table-session-modal .table-mode-fields label {
    display: grid;
    gap: 8px;
    margin-top: 14px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.table-session-modal input,
.table-session-modal select {
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--button-border);
    border-radius: 10px;
    background: var(--button-bg);
    color: var(--button-text);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.table-session-modal input[readonly] {
    background: var(--line);
    color: var(--muted);
}

.table-session-modal input:focus,
.table-session-modal select:focus {
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(239, 106, 86, .14);
    outline: none;
}

.table-session-modal .table-mode-fields {
    margin: 16px 0 2px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: color-mix(in srgb, var(--canvas) 72%, var(--surface));
}

.table-session-modal .full {
    min-height: 44px;
    margin-top: 18px;
}

.modal-note {
    margin: -8px 0 18px;
    color: var(--muted);
    line-height: 1.5;
}

.tournament-checkout-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
    padding: 15px;
    border: 1px solid var(--accent);
    border-radius: 12px;
    background: var(--surface);
    color: var(--muted);
}

.tournament-checkout-summary strong {
    color: var(--accent-dark);
    font-size: 20px;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 34px 18px 0;
    border-bottom: 1px solid var(--line)
}

.modal-header h2 {
    margin: 0;
    font-size: 20px
}

.modal-header small {
    display: block;
    margin-top: 4px;
    color: var(--muted)
}

.modal-content {
    padding: 20px 0 4px;
    color: var(--ink)
}

.modal-content p {
    line-height: 1.5;
    margin: 0 0 14px
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 18px;
    border-top: 1px solid var(--line)
}

.modal-footer .full {
    margin-top: 0
}

.modal-icon {
    display: grid;
    flex: 0 0 42px;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: #e5efff;
    color: #2563c7;
    font-size: 22px;
    font-weight: 800
}

@keyframes modalBackdropIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

@keyframes modalPanelIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.97)
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1)
    }
}

@media (prefers-reduced-motion: reduce) {

    .page,
    .modal,
    .modal-box {
        animation: none
    }
}

.message-box {
    width: min(430px, 92%)
}

.message-box .modal-header {
    padding: 0 34px 18px 0;
}

.message-box .modal-content {
    padding-top: 16px
}

.message-box .modal-content p {
    white-space: pre-line
}

.message-box.success .modal-icon {
    background: var(--mint-soft);
    color: var(--mint)
}

.message-box.danger .modal-icon,
.message-box.confirm .modal-icon {
    background: #fff0ec;
    color: var(--accent-dark)
}

.message-box.danger .modal-footer .btn.primary {
    background: var(--accent);
    border-color: var(--accent)
}

.message-box.success .modal-footer .btn.primary {

    background: var(--accent);
    border-color: var(--accent)
}


.message-footer .btn {
    flex: 1;
}
.close {
    position: absolute;
    right: 16px;
    top: 12px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-size: 28px;
    cursor: pointer
}

.payment-methods {
    display: flex;
    gap: 8px;
    margin: 18px 0
}

.payment-section {
    display: grid;
    grid-template-rows: 1fr;
    opacity: 1;
    transition: grid-template-rows .25s ease, opacity .2s ease;
}

.payment-section-inner {
    min-height: 0;
    overflow: visible;
}

.payment-section.collapsed {
    grid-template-rows: 0fr;
    opacity: 0;
}

.payment-section.collapsed .payment-section-inner {
    overflow: hidden;
}

.customer-type-toggle {
    display: flex;
    gap: 8px;
    margin: 18px 0 0
}

.customer-type {
    flex: 1;
    padding: 11px;
    border: 1px solid var(--button-border);
    background: var(--mind);
    color: var(--button-text);
    border-radius: 7px;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.customer-type.active {
    background: var(--mint);
    border-color: var(--accent);
    color: var(--accent-dark);
}

.customer-name-field {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    margin-top: 0;
    overflow: hidden;
    transition: grid-template-rows .25s ease, opacity .2s ease, margin-top .25s ease;
}

.customer-name-field>label {
    overflow: hidden;
}

.customer-name-field.show {
    grid-template-rows: 1fr;
    opacity: 1;
    margin-top: 12px;
    overflow: visible;
}

.customer-name-field.show>label {
    overflow: visible;
}

.customer-search {
    position: relative;
}

.customer-suggestions {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 180px;
    overflow-y: auto;
    background: var(--panel-bg, #fff);
    border: 1px solid var(--button-border);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .12);
    z-index: 5;
}

.customer-suggestions.show {
    display: block;
}

.customer-suggestions.show-above {
    top: auto;
    bottom: calc(100% + 4px);
}

.customer-suggestion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.customer-suggestion:hover {
    background: var(--mind);
}

.customer-suggestion-add {
    justify-content: flex-start;
    border-top: 1px solid var(--line);
    color: var(--primary-dark);
    font-weight: 700;
}

.customer-suggestion-add small {
    margin-left: auto;
    font-weight: 400;
}

.customer-suggestion small {
    color: var(--muted, #888);
    font-weight: 400;
}

.customer-suggestion-empty {
    padding: 9px 12px;
    font-size: 13px;
    color: var(--muted, #888);
}

.pay {
    flex: 1;
    padding: 11px;
    border: 1px solid var(--button-border);
    background: var(--mind);
    color: var(--button-text);
    border-radius: 7px;
    cursor: pointer
}

.pay.active {
    background: var(--mint);
    border-color: var(--accent);
    color: var(--accent-dark);
}

.ewallet-details {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin: 12px 0;
}

.ewallet-details select,
.ewallet-details input {
    width: 100%;
}

#ewalletProvider {
    display: none;
}

.modal-box label {
    font-size: 13px;
    font-weight: 600
}

.modal-box input {
    display: block;
    margin-top: 7px
}

.table-wrap {
    overflow: auto;
    border-radius: 10px
}

.table-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px
}

.table-toolbar input {
    max-width: 360px
}

.table-action {
    padding: 7px 11px;
    font-size: 12px
}

.table-action:hover {
    background: var(--accent);
    color: #fff
}

@media (min-width: 1025px) and (max-width: 1350px) {
    .product-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1025px) and (max-width: 1165px) {
    .product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}


@media (max-width: 1024px) {
    .panel.cart-panel {
        padding-bottom: 10px;
    }

    .pos-layout {
        grid-template-columns: minmax(0, 1fr) 300px;
    }

    .product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .pos-layout {
        grid-template-columns: minmax(0, 1fr) 280px;
    }

    .product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .product-card {
        min-height: 128px;
        height: 128px;
        padding: 12px;
    }
}

@media (min-width: 769px) and (max-width: 960px) {
    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Tablet and mobile layout */
@media (max-width: 768px) {
    .pos-layout {
        display: flex;
        flex-direction: column;
        gap: 8px;
        height: calc(100vh - var(--header-height) - 68px - 12px);
        min-height: 0;
        align-items: stretch;
        overflow: hidden;
        padding-bottom: 12px;
    }

    .product-panel,
    .cart-panel {
        position: static;
        min-height: 0;
        max-height: none;
        overflow: hidden;
        width: 100%;
    }

    .product-panel {
        order: 1;
        flex: 1 1 auto;
    }

    .cart-panel {
        order: 2;
        flex: 0 0 240px;
        min-height: 240px;
        max-height: 240px;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        overflow: hidden;
    }

    .cart-panel.has-billed-preview {
        flex: 0 0 260px;
        height: 260px;
        min-height: 260px;
        max-height: 260px;
        padding-bottom: 5px;
    }

    .cart-panel.is-modal.has-billed-preview {
        flex: none;
        height: calc(100% - 30px);
        min-height: 0;
        max-height: none;
    }

    .product-panel,
    .cart-panel {
        padding: 12px;
    }

    .product-panel {
        padding: 16px 12px 10px;
    }

    .cart-panel {
        padding-bottom: 10px;
    }



    .cart-view-toggle {
        display: grid;
    }

    .product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
    }

    .product-card {
        min-height: 116px;
        height: 116px;
        padding: 10px;
    }

    .cart-items {
        display: none;
    }

    .totals {
        margin-top: auto;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        padding-top: 8px;
        gap: 6px;
    }

    .totals > div {
        margin: 0;
    }

    .checkout {
        margin-top: 8px;
        display: block;
        padding: 12px;
        font-size: 0.95rem;
    }

    .main:has(#pos.page.active) {
        overflow: hidden;
    }

    #pos.page.active {
        display: block;
        height: calc(100vh - var(--header-height) - var(--mobile-footer-height));
        min-height: 0;
        overflow: hidden;
        padding-bottom: 0;
    }

    .toolbar {
        flex-wrap: wrap;
    }

    .toolbar input,
    .toolbar select,
    .toolbar .btn {
        flex: 1 1 100%;
        max-width: none;
    }

    .toolbar .btnscn {
        display: none;
    }

    .product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .product-card {
        min-height: 104px;
        height: 104px;
        min-width: 0;
        padding: 9px 9px 7px;
    }

    .product-panel {
        padding: 12px 10px 8px;
    }

    .product-card strong {
        font-size: 0.8rem;
        margin-bottom: 4px;
    }

    .price {
        font-size: 0.9rem;
    }

    .stock,
    .stock-category {
        font-size: 10px;
    }

    .cart-items {
        display: none;
    }

    .totals {
        margin-top: auto;
        gap: 4px;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 72px;
        height: 100vh;
        padding: 16px 10px 20px;
        border-right: 1px solid rgba(255,255,255,.08);
        box-shadow: 10px 0 24px rgba(10, 19, 23, .26);
        z-index: 30;
        transform: translateX(-110%);
        transition: transform .25s ease;
    }

    .sidebar.hidden,
    .sidebar.collapsed {
        transform: translateX(-110%);
    }

    .sidebar.expanded {
        transform: translateX(0);
        width: 220px;
    }

    .sidebar nav {
        display: grid;
        gap: 8px;
    }

    .sidebar .nav-btn {
        justify-content: center;
        padding: 12px 10px;
    }

    .sidebar.expanded .nav-btn {
        justify-content: flex-start;
        padding: 12px 14px;
    }

    .sidebar .nav-label {
        display: none;
    }

    .sidebar.expanded .nav-label {
        display: block;
        margin-left: 10px;
        font-size: 14px;
        line-height: 1.2;
    }

    .sidebar .nav-icon {
        width: 22px;
        height: 22px;
        flex: 0 0 22px;
    }

    .sidebar-toggle {
        display: none;
    }

    .main {
        margin-left: 0;
        width: 100%;
        height: 100vh;
        min-height: 100vh;
        padding-bottom: var(--mobile-footer-height);
    }

    body.sidebar-collapsed .main,
    body.sidebar-hidden .main,
    body.sidebar-expanded .main {
        margin-left: 0;
        width: 100%;
    }

    .mobile-footer-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 22;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: stretch;
        gap: 8px;
        height: var(--mobile-footer-height);
        padding: 8px 10px env(safe-area-inset-bottom, 0px);
        background: rgba(24, 35, 43, .96);
        border-top: 1px solid rgba(255,255,255,.08);
        backdrop-filter: blur(10px);
        box-shadow: 0 -10px 28px rgba(7, 15, 18, .2);
    }

    .mobile-nav-btn,
    .mobile-more-btn {
        position: relative;
        width: 100%;
        min-width: 0;
        border: 0;
        background: transparent;
        color: rgba(255,255,255,.72);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 8px 4px 6px;
        border-radius: 12px;
        font-size: 10px;
        font-weight: 700;
        cursor: pointer;
        transition: background .25s ease, color .25s ease;
    }

    .mobile-nav-btn.active,
    .mobile-nav-btn:hover {
        background: rgba(255,255,255,.06);
        color: #fff;
    }

    .mobile-nav-btn::after {
        content: "";
        position: absolute;
        left: 14px;
        right: 14px;
        bottom: 0;
        height: 3px;
        border-radius: 999px 999px 0 0;
        background: var(--primary);
        opacity: 0;
        transform: scaleX(.5);
        transition: opacity .25s ease, transform .25s ease;
    }

    .mobile-nav-btn.active::after,
    .mobile-nav-btn:hover::after {
        opacity: 1;
        transform: scaleX(1);
    }

    .mobile-nav-btn .nav-icon {
        display: inline-flex;
        width: 20px;
        height: 20px;
        flex: 0 0 20px;
    }

    .mobile-nav-btn .nav-label {
        display: block;
        margin-left: 0;
        font-size: 10px;
        line-height: 1.1;
        text-align: center;
    }

    .mobile-more-btn {
        width: 100%;
    }

    .sidebar-backdrop {
        display: block;
        background: rgba(8, 14, 18, .24);
        backdrop-filter: blur(4px);
    }

    .page:not(#pos) {
        padding: 12px 10px 86px;
    }

    .page:not(#pos) > .panel {
        padding: 12px;
        overflow: hidden;
    }

    .page:not(#pos) .table-wrap {
        width: 100%;
        overflow-x: auto;
    }

    .page:not(#pos) table {
        min-width: 620px;
        font-size: 12px;
    }

    .page:not(#pos) th,
    .page:not(#pos) td {
        padding: 9px 8px;
        white-space: nowrap;
    }

    .page:not(#pos) .table-toolbar {
        margin-bottom: 10px;
    }

    .page:not(#pos) .table-toolbar input {
        width: 100%;
        max-width: none;
    }
}

@supports (height: 100dvh) {
    @media (max-width: 768px) {
        .main {
            height: 100dvh;
            min-height: 100dvh;
        }

        #pos.page.active {
            height: calc(100dvh - var(--header-height) - var(--mobile-footer-height));
        }
    }
}

@media (max-width: 480px) {
    #productsTableContent table {
        min-width: 0 !important;
        width: 100%;
        table-layout: fixed;
        font-size: 11px;
    }

    #productsTableContent th,
    #productsTableContent td {
        padding: 8px 6px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #productsTableContent th:nth-child(1),
    #productsTableContent td:nth-child(1) {
        width: 28%;
    }

    #productsTableContent th:nth-child(2),
    #productsTableContent td:nth-child(2) {
        width: 20%;
    }

    #productsTableContent th:nth-child(3),
    #productsTableContent td:nth-child(3) {
        display: none;
    }

    #productsTableContent th:nth-child(4),
    #productsTableContent td:nth-child(4) {
        width: 19%;
    }

    #productsTableContent th:nth-child(5),
    #productsTableContent td:nth-child(5) {
        width: 13%;
    }

    #productsTableContent th:nth-child(6),
    #productsTableContent td:nth-child(6) {
        width: 20%;
    }

    #productsTableContent .table-action {
        padding: 6px 8px;
        font-size: 11px;
    }
}

@media (max-width: 980px) {
    .dashboard-grid {
        grid-template-columns: 1fr
    }
}

@media (max-width: 760px) {
    .stats-stack {
        grid-template-columns: 1fr
    }

    .mini-stat,
    .mini-row {
        padding: 10px 12px
    }

    .mini-stat strong,
    .mini-row strong {
        font-size: 1rem
    }
}

@media(max-width:560px) and (orientation: portrait) {
    .page {
        padding: 16px
    }

    .cards,
    .form-grid {
        grid-template-columns: 1fr
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr)
    }

    .product-card strong {
        font-size: 15px
    }

    .topbar {
        padding: 0 16px
    }

    .page-actions,
    .panel-head {
        align-items: flex-start;
        flex-wrap: wrap;

    }

    .card,
    .panel {
        padding: 10px
    }

    .table-toolbar input {
        max-width: none
    }

}

.scanner-box {
    max-width: 560px
}

.scanner-help {
    color: #64748b
}

.scanner-box video {
    width: 100%;
    height: 280px;
    object-fit: cover;
    background: #111827;
    border-radius: 10px;
    margin: 10px 0
}

#barcodeReader {
    width: 100%;
    margin: 10px 0
}

#barcodeReader video {
    width: 100% !important;
    height: 280px !important;
    object-fit: cover
}

body.dark .topbar {
    background: rgba(35, 49, 57)
}

body.dark .product-card,
body.dark .qty button,
body.dark .pay,
body.dark input,
body.dark select {
    background: #1d2a31;
    color: var(--ink)
}

body.dark .cart-panel {
    background: #202e35
}

body.dark tbody tr:hover {
    background: #2b3b42
}

body.dark .message-mark {
    background: #4b2e2b
}

body.dark .scanner-status {
    background: #1d2a31;
    color: var(--muted)
}

.scanner-status {
    padding: 10px;
    background: #f1f5f9;
    border-radius: 7px;
    margin-bottom: 12px;
    font-size: 13px
}

/* Billiard table management */
.billiard-toolbar {
    display: flex;
    gap: 16px;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 18px;
    padding: 16px;
}

.billiard-toolbar label {
    min-width: 180px;
}

.billiard-search {
    flex: 1 1 240px;
}

.billiard-toolbar input {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink);
}

.table-mode-fields {
    display: grid;
    gap: 12px;
}

.billiard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.billiard-empty {
    grid-column: 1 / -1;
    padding: 36px 20px;
    color: var(--muted);
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: 12px;
}

.billiard-card {
    position: relative;
    border-radius: 18px;
    padding: 18px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-soft);
}

.table-card-alert-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: rgba(185, 28, 28, .12);
    color: var(--danger);
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 5px 14px rgba(185, 28, 28, .2);
}

.billiard-card.available {
    border-left: 6px solid #2d9252;
}

.billiard-card.playing {
    border-left: 6px solid #f59e0b;
}

.billiard-card.alarm-reached {
    border-color: var(--danger);
    border-left-color: #dc2626;
    background: var(--surface);
    animation: billiardAlarmPulse 1.35s ease-in-out infinite;
}

.billiard-card.alarm-reached .table-timer {
    color: var(--danger);
}

.billiard-card.alarm-reached .table-status {
    background: #7f1d1d;
    color: #fecaca;
}

@keyframes billiardAlarmPulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(185, 28, 28, .08), 0 8px 22px rgba(0, 0, 0, .12);
    }

    50% {
        box-shadow: 0 0 0 7px rgba(185, 28, 28, .14), 0 12px 28px rgba(185, 28, 28, .18);
    }
}

.billiard-card.reserved {
    border-left: 6px solid #6366f1;
}

.billiard-card h3 {
    margin: 0 0 8px;
}

.table-status {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-available {
    background: var(--status-available-bg, #dcfce7);
    color: var(--status-available-text, #166534);
}

.status-playing {
    background: var(--status-playing-bg, #fef3c7);
    color: var(--status-playing-text, #92400e);
}

.status-reserved {
    background: var(--status-reserved-bg, #e0e7ff);
    color: var(--status-reserved-text, #3730a3);
}

.table-timer {
    color: var(--ink);
    font-size: 25px;
    font-weight: 800;
    margin: 12px 0;
    letter-spacing: 1px;
}

.table-mini-meta {
    display: grid;
    gap: 8px;
    margin: 12px 0;
    font-size: 13px;
    color: var(--muted);
}

.table-mini-meta div {
    display: grid;
    gap: 3px;
}

.table-mini-meta span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
}

.table-mini-meta strong {
    color: var(--ink);
    font-size: 13px;
}

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.table-actions button {
    flex: 1;
    min-width: 90px;
}

.billiard-card .btn {
    min-height: 40px;
}

.hidden {
    display: none !important;
}

.cart-info small {
    line-height: 1.4
}

@media (prefers-reduced-motion: reduce) {
    .billiard-card.alarm-reached {
        animation: none;
    }
}

.billed-orders-modal {
    width: min(860px, calc(100% - 32px));
    max-height: min(760px, calc(100vh - 32px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.quantity-modal {
    width: min(420px, calc(100% - 32px));
}

.quantity-modal .modal-content {
    padding: 16px 0 4px;
}

.quantity-modal label,
.quantity-modal input {
    display: block;
    width: 100%;
}

.quantity-stock {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
}

.quantity-error {
    margin: 8px 0 0;
    color: var(--accent-dark);
    font-size: 13px;
}

.billed-orders-header {
    flex: 0 0 auto;
}

.billed-orders-content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

#creditListTable {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.billed-order-search {
    flex: 0 0 auto;
    width: 100%;
    margin: 0 0 14px;
}

#creditListTable .billed-orders-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

#creditListTable .billed-orders-table th,
#creditListTable .billed-orders-table td {
    overflow-wrap: anywhere;
}

#creditListTable .billed-orders-table th:nth-child(1) { width: 17%; }
#creditListTable .billed-orders-table th:nth-child(2) { width: 25%; }
#creditListTable .billed-orders-table th:nth-child(3) { width: 23%; }
#creditListTable .billed-orders-table th:nth-child(4) { width: 14%; }
#creditListTable .billed-orders-table th:nth-child(5) { width: 21%; }

#creditListTable .billed-orders-table th:last-child,
#creditListTable .billed-orders-table td:last-child {
    text-align: right;
}

#creditListTable .billed-orders-table .table-action {
    margin-left: auto;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .billed-orders-modal {
        width: calc(100% - 24px);
        max-height: min(90dvh, 760px);
        padding: 20px;
    }

    #creditListTable .billed-orders-table,
    #creditListTable .billed-orders-table tbody {
        display: block;
    }

    #creditListTable .billed-orders-table thead {
        display: none;
    }

    #creditListTable .billed-orders-table tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
        padding: 10px 0;
        border-bottom: 1px solid var(--line);
    }

    #creditListTable .billed-orders-table td {
        display: grid;
        grid-template-columns: minmax(78px, 30%) minmax(0, 1fr);
        gap: 8px;
        min-width: 0;
        padding: 3px 0;
        border: 0;
        white-space: normal;
    }

    #creditListTable .billed-orders-table td[data-label="Action"] {
        display: flex;
        align-items: center;
        justify-content: space-between;
        text-align: left;
    }

    #creditListTable .billed-orders-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 11px;
        font-weight: 700;
    }
}

@media (max-width: 480px) {
    .billed-orders-modal {
        width: calc(100% - 16px);
        padding: 16px;
    }
}