* {
    box-sizing: border-box
}

:root {
    --ink: #17212b;
    --muted: #5f6f77;
    --line: #e8eceb;
    --surface: #ffffff;
    --surface-soft: #fff8f5;
    --canvas: #e6e6e6;
    --sidebar: #18232b;
    --primary: #ef6a56;
    --primary-dark: #d95442;
    --primary-soft: #fff1ee;
    --accent: #ef6a56;
    --accent-dark: #d95442;
    --danger: #b91c1c;
    --button-bg: #f5f7f8;
    --button-text: #17212b;
    --button-border: #dfe6e8;
    --report-positive: #047857;
    --shadow: 0 14px 40px rgba(16, 37, 46, .08);
    --shadow-soft: 0 8px 22px rgba(19, 43, 45, .06);
    --radius: 18px;
    --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;
    --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;
    --report-positive: #6ee7b7;
    --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;
}

body.auth-pending .app,
body.auth-pending .mobile-footer-nav {
    visibility: hidden;
}

html {
    overflow-x: hidden;
}

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-card,
.modal-box {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

body.login-page-body {
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    display: grid;
    place-items: center;
    overflow: hidden;
    overscroll-behavior: none;
    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: min(620px, calc(100vh - 32px));
    min-height: min(620px, calc(100dvh - 32px));
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    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-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;
}

.login-error {
    margin: 0;
    color: var(--danger);
    font-size: 13px;
}

.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-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);
}

@media (max-width: 1024px) {
    .login-shell {
        width: min(880px, calc(100% - 28px));
        min-height: min(560px, calc(100dvh - 28px));
    }
}

@media (max-width: 820px) {
    body.login-page-body {
        padding: 0;
        align-items: center;
        justify-items: center;
    }

    .login-shell {
        width: min(440px, calc(100% - 24px));
        grid-template-columns: 1fr;
        min-height: 0;
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        border-radius: 22px;
    }

    .login-branding {
        display: none;
    }

    .login-form-panel {
        padding: 28px 24px;
        min-height: 0;
    }

    .login-card {
        width: 100%;
        padding: 0;
    }

    .feature-list {
        display: none;
    }
}

@media (min-width: 821px) {
    .feature-list {
        display: grid;
    }
}

@media (max-width: 560px) {
    body.login-page-body {
        padding: 0;
    }

    .login-shell {
        width: min(100% - 20px, 420px);
        border-radius: 18px;
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
    }

    .login-panel,
    .login-form-panel {
        padding: 22px 18px;
    }

    .login-header {
        margin-bottom: 20px;
    }

    .login-header h1 {
        font-size: 1.85rem;
    }

    .login-form {
        gap: 14px;
    }

    .login-card {
        width: 100%;
    }

    .field-label input,
    .login-btn {
        padding-top: 13px;
        padding-bottom: 13px;
    }
}

@media (max-width: 420px) {
    .login-shell {
        width: calc(100% - 16px);
        max-height: calc(100dvh - 12px);
    }

    .login-form-panel {
        padding: 18px 16px;
    }

    .brand-tag {
        font-size: .96rem;
    }

    .feature-item {
        padding: 12px 13px;
    }

    .feature-item strong {
        font-size: .94rem;
    }
}

/* Short mobile/tablet viewports: keep form centered, never force page scroll */
@media (max-width: 1024px) and (max-height: 760px) {
    body.login-page-body {
        overflow: hidden;
    }

    .login-shell {
        min-height: 0;
        max-height: calc(100dvh - 16px);
    }

    .login-branding {
        display: none;
    }

    .login-form-panel {
        padding: 20px 18px;
    }

    .login-header {
        margin-bottom: 16px;
    }

    .login-form {
        gap: 12px;
    }
}

.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)
    }
}

.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;
}

.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);
}

.page-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    background: var(--button-bg);
    border: 1px solid var(--button-border);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.icon-btn.enabled {
    background: var(--accent);
    border-color: var(--accent);
}

.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 {
    width: 100%;
    min-width: 0;
}

.toolbar input {
    max-width: 400px;
}

.toolbar .btnscn {
    display: none;
}

.category-filters {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    margin: 0 0 10px;
    padding: 10px 4px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.category-filter-button {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid var(--button-border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    font-weight: 700;
    white-space: nowrap;
}

.category-filter-button:hover {
    border-color: var(--primary);
    color: var(--primary-dark);
}

.category-filter-button.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.category-filter-button:focus-visible {
    outline: 3px solid rgba(239, 106, 86, .35);
    outline-offset: 2px;
}

.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;
    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
}

.settings-form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
}

.settings-help{
    grid-column:1 / -1;
    margin:-6px 0 2px;
    color:var(--muted);
    font-size:12px;
    font-weight:500;
}

.settings-logo-preview{
    grid-column:1 / -1;
    display:flex;
    align-items:center;
    padding:8px 10px;
    border:1px dashed var(--line);
    border-radius:12px;
    background:var(--surface-soft);
}

.settings-logo-preview img{
    display:block;
    height:64px;
    width:auto;
    object-fit:contain;
}

.form-grid .stock-tracking-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stock-tracking-field input {
    width: 18px;
    min-width: 18px;
    min-height: 18px;
    margin: 0;
    accent-color: var(--primary);
}

.order-discount-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.order-discount-row input {
    width: 124px;
    min-height: 36px;
    padding: 6px 10px;
    text-align: right;
}

.order-discount-total {
    display: flex;
    justify-content: space-between;
}

.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;
}

.user-account-modal {
    max-height: min(720px, calc(100dvh - 24px));
    overflow-y: auto;
    overscroll-behavior: contain;
}

.table-session-modal {
    width: min(540px, calc(100% - 32px));
    max-height: calc(100dvh - 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: 12px;
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
}

.billiard-bill-total>label {
    display: grid;
    gap: 8px;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

#billiardTournamentAmountField {
    align-items: stretch;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
}

.billiard-bill-total #billiardStandardBillFields {
    display: grid;
    gap: 12px;
}

.billiard-bill-total #billiardStandardBillFields.hidden {
    display: none;
}

.billiard-bill-total #billiardStandardBillFields>div:not(.billiard-bill-grand) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
    font-size: 14px;
}

.billiard-bill-total label {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(110px, 150px);
    align-items: center;
    gap: 12px;
}

.billiard-bill-total input {
    width: 100%;
    min-width: 0;
    margin: 0;
    background: var(--surface);
    color: var(--ink);
}

.billiard-bill-grand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--line));
    border-radius: 12px;
    background: var(--primary-soft);
}

.billiard-bill-grand span {
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.billiard-bill-grand strong {
    color: var(--primary);
    font-size: clamp(1.35rem, 4vw, 1.7rem);
    font-weight: 800;
    text-align: right;
}

.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 {
        grid-template-columns: minmax(0, 1fr);
    }

    .billiard-bill-grand {
        padding: 12px;
    }

    .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 .regular-table-fields {
    gap: 14px;
    padding: 16px;
    border-color: color-mix(in srgb, var(--primary) 24%, var(--line));
    background: color-mix(in srgb, var(--primary) 4%, var(--surface));
}

.table-session-modal .regular-table-fields .regular-rate-field {
    margin-top: 0;
}

.table-session-modal .regular-table-fields .regular-rate-field input {
    min-height: 48px;
    border-color: color-mix(in srgb, var(--primary) 24%, var(--button-border));
    background: var(--surface);
    font-size: 16px;
    font-weight: 650;
}

.table-session-modal .regular-table-fields .regular-rate-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}

.regular-duration-fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin: 0;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
}

.regular-duration-inputs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.table-session-modal .regular-duration-inputs label {
    margin: 0;
}

.table-session-modal .regular-duration-inputs input {
    min-height: 42px;
    background: var(--surface-soft);
}

.table-session-modal .full {
    min-height: 44px;
    margin-top: 18px;
}

.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;
}

.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(--button-bg);
    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(--primary);
    border-color: var(--primary);
    color: #fff;
}

.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;
}

.pay {
    flex: 1;
    padding: 11px;
    border: 1px solid var(--button-border);
    background: var(--button-bg);
    color: var(--button-text);
    border-radius: 7px;
    cursor: pointer
}

.pay.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.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
}

.sales-filter-toolbar {
    align-items: end;
    flex-wrap: wrap;
}

.sales-filter-toolbar label {
    display: grid;
    gap: 4px;
    min-width: 150px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.sales-filter-toolbar label input {
    width: 100%;
    min-height: 42px;
    margin: 0;
}

.sale-items-content {
    overflow: auto;
}

.sale-items-table {
    width: 100%;
    min-width: 520px;
}

.sale-items-summary {
    display: grid;
    gap: 8px;
    max-width: 320px;
    margin: 16px 0 0 auto;
}

.sale-items-summary>div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.sale-items-summary .grand {
    padding-top: 8px;
    border-top: 1px solid var(--line);
    color: var(--ink);
}

/* Transaction items modal: responsive polish */
#saleItemsModal .sale-items-modal {
    width: min(760px, calc(100% - 32px));
}

#saleItemsModal .sale-items-content {
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

#saleItemsModal .sale-items-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
}

#saleItemsModal .sale-items-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-soft);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
}

#saleItemsModal .sale-items-table th:not(:first-child),
#saleItemsModal .sale-items-table td:not(:first-child) {
    text-align: right;
    white-space: nowrap;
}

#saleItemsModal .sale-items-table td:last-child {
    font-weight: 700;
}

#saleItemsModal .sale-items-summary {
    max-width: none;
    margin: 14px 0 0;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
}

#saleItemsModal .sale-items-summary .grand strong {
    color: var(--primary-dark);
    font-size: 1.3rem;
}

@media (max-width: 768px) {
    #saleItemsModal .sale-items-modal {
        width: calc(100% - 20px);
        max-height: calc(100vh - 24px);
    }

    #saleItemsModal .sale-items-table,
    #saleItemsModal .sale-items-table tbody,
    #saleItemsModal .sale-items-table tr,
    #saleItemsModal .sale-items-table td {
        display: block;
        width: 100%;
    }

    #saleItemsModal .sale-items-table thead {
        display: none;
    }

    #saleItemsModal .sale-items-table tr {
        margin-bottom: 10px;
        padding: 10px 14px;
        border: 1px solid var(--line);
        border-radius: 14px;
        background: var(--surface);
    }

    #saleItemsModal .sale-items-table td,
    #saleItemsModal .sale-items-table td:not(:first-child) {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        padding: 5px 0;
        border: 0;
        text-align: right;
        white-space: normal;
    }

    #saleItemsModal .sale-items-table td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        color: var(--muted);
        font-size: 12px;
        font-weight: 600;
        text-align: left;
    }

    #saleItemsModal .sale-items-table td:first-child {
        padding-bottom: 8px;
        margin-bottom: 4px;
        border-bottom: 1px solid var(--line);
        font-weight: 700;
    }

    #saleItemsModal .sale-items-table td:first-child::before {
        display: none;
    }
}

/* Billed / credit list modal: responsive polish */
#creditListModal .billed-orders-modal {
    width: min(860px, calc(100% - 32px));
}

#creditListModal .credit-list-tabs {
    gap: 4px;
    padding: 4px;
    border: 0;
    border-radius: 14px;
    background: var(--button-bg);
}

#creditListModal .credit-list-tab {
    flex: 1 1 0;
    min-height: 44px;
    border: 0;
    border-radius: 11px;
    touch-action: manipulation;
}

#creditListModal .credit-list-tab.active {
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    color: var(--primary-dark);
}

#creditListModal .billed-order-search {
    min-height: 46px;
    border-radius: 12px;
}

#creditListModal #creditListTable {
    -webkit-overflow-scrolling: touch;
}

#creditListModal .billed-orders-table {
    border-collapse: separate;
    border-spacing: 0;
}

#creditListModal .billed-orders-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

#creditListModal .billed-orders-table td:nth-child(4) {
    font-weight: 700;
    color: var(--primary-dark);
}

#creditListModal .billed-orders-table .table-action {
    min-height: 40px;
    padding: 8px 16px;
    border-radius: 10px;
}

@media (max-width: 768px) {
    #creditListModal .billed-orders-modal {
        width: calc(100% - 20px);
        padding: 16px;
    }

    #creditListModal #creditListTable .billed-orders-table tr {
        margin-bottom: 10px;
        padding: 12px 14px;
        border: 1px solid var(--line);
        border-radius: 14px;
        background: var(--surface);
    }

    #creditListModal #creditListTable .billed-orders-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        text-align: right;
    }

    #creditListModal #creditListTable .billed-orders-table td:first-child {
        padding-bottom: 8px;
        margin-bottom: 4px;
        border-bottom: 1px solid var(--line);
        font-weight: 700;
    }

    #creditListModal #creditListTable .billed-orders-table td[data-label="Action"] {
        display: block;
        padding-top: 10px;
    }

    #creditListModal #creditListTable .billed-orders-table td[data-label="Action"]::before {
        display: none;
    }

    #creditListModal #creditListTable .billed-orders-table .table-action {
        width: 100%;
        min-height: 48px;
        margin: 0;
        font-size: 1rem;
    }
}

/* Customer profile modal: responsive polish */
#customerProfileModal .customer-profile-modal {
    width: min(820px, calc(100% - 32px));
}

#customerProfileModal .customer-profile-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

#customerProfileModal .customer-profile-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

#customerProfileModal .customer-profile-summary > div {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
}

#customerProfileModal .customer-profile-summary small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

#customerProfileModal .customer-profile-summary strong {
    font-size: 1.25rem;
}

#customerProfileModal .customer-profile-summary > div:last-child strong {
    color: var(--primary-dark);
}

#customerProfileModal .customer-profile-transactions {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

#customerProfileModal .customer-profile-table {
    width: 100%;
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
}

#customerProfileModal .customer-profile-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

#customerProfileModal .customer-profile-table th:last-child,
#customerProfileModal .customer-profile-table td:last-child {
    text-align: right;
    font-weight: 700;
}

.profile-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--button-bg);
    font-size: 12px;
    font-weight: 700;
}

.profile-status-paid { background: rgba(4, 120, 87, .12); color: var(--report-positive); }
.profile-status-billed,
.profile-status-credit { background: var(--primary-soft); color: var(--primary-dark); }

@media (max-width: 768px) {
    #customerProfileModal .customer-profile-modal {
        width: calc(100% - 20px);
        max-height: calc(100dvh - 24px);
    }

    #customerProfileModal .customer-profile-summary {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 12px;
    }

    #customerProfileModal .customer-profile-summary > div {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 10px 14px;
    }

    #customerProfileModal .customer-profile-table,
    #customerProfileModal .customer-profile-table tbody,
    #customerProfileModal .customer-profile-table tr,
    #customerProfileModal .customer-profile-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    #customerProfileModal .customer-profile-table thead {
        display: none;
    }

    #customerProfileModal .customer-profile-table tr {
        margin-bottom: 10px;
        padding: 10px 14px;
        border: 1px solid var(--line);
        border-radius: 14px;
        background: var(--surface);
    }

    #customerProfileModal .customer-profile-table td,
    #customerProfileModal .customer-profile-table td:last-child {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 5px 0;
        border: 0;
        text-align: right;
        white-space: normal;
    }

    #customerProfileModal .customer-profile-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        font-weight: 600;
        text-align: left;
    }

    #customerProfileModal .customer-profile-table td:first-child {
        margin-bottom: 4px;
        padding-bottom: 8px;
        border-bottom: 1px solid var(--line);
        font-weight: 700;
    }
}

.table-action {
    padding: 7px 11px;
    font-size: 12px
}

.table-action:hover {
    background: var(--accent);
    color: #fff
}

.product-table-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.product-table-actions .table-action {
    width: auto;
    padding: 6px 8px;
}

@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 280px;
        min-height: 280px;
        max-height: 280px;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        overflow: hidden;
    }

    .cart-panel.has-billed-preview {
        flex: 0 0 300px;
        height: 300px;
        min-height: 300px;
        max-height: 300px;
        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 .btn {
        flex: 1 1 100%;
        max-width: 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;
    }

    .customer-profile-content {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }

    .customer-profile-summary {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px;
        flex: 0 0 auto;
        margin-bottom: 16px;
    }

    .customer-profile-summary>div {
        display: grid;
        gap: 5px;
        min-width: 0;
        padding: 12px;
        border: 1px solid var(--line);
        border-radius: 8px;
    }

    .customer-profile-summary small {
        color: var(--muted);
    }

    .customer-profile-summary strong {
        overflow-wrap: anywhere;
    }

    .customer-profile-transactions {
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto;
    }

    .customer-profile-table {
        width: 100%;
        min-width: 600px;
    }

    .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) {
    .product-table-actions {
        display: grid;
        gap: 4px;
    }

    .product-table-actions .table-action {
        width: 100%;
    }
}

@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 .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 */
.table-mode-fields {
    display: grid;
    gap: 12px;
}

.billiard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
    gap: 20px;
}

.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;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, .2);
    border-radius: 18px;
    padding: 18px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, .06), transparent 42%),
        var(--surface);
    color: var(--ink);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .1);
    transition: transform .18s ease, box-shadow .18s ease;
}

.billiard-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 30px rgba(15, 23, 42, .16);
}

.billiard-card-title {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 50%;
    width: calc(100% - 34px);
    margin: 0 !important;
    color: #fff;
    overflow-wrap: anywhere;
    font-size: clamp(14px, 4vw, 19px);
    letter-spacing: .025em;
    line-height: 1.2;
    text-align: center;
    transform: translate(-50%, -50%);
}

.billiard-table-visual {
    position: relative;
    width: min(100%, 400px);
    aspect-ratio: 16 / 9;
    height: auto;
    margin: 0 0 15px;
    padding: 8px;
    border: 1px solid #80512e;
    border-radius: 12px;
    background: #a87343;
    box-shadow: 0 4px 10px rgba(34, 22, 12, .16);
}

.billiard-felt {
    position: absolute;
    inset: 8px;
    overflow: hidden;
    border: 3px solid #285c3b;
    border-radius: 6px;
    background: #17643b;
}

.billiard-pocket {
    position: absolute;
    width: 9px;
    height: 9px;
    background: #10271b;
}

.billiard-pocket-top-left {
    top: -1px;
    left: -1px;
    border-bottom-right-radius: 5px;
}

.billiard-pocket-top-middle {
    top: -1px;
    left: 50%;
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
    transform: translateX(-50%);
}

.billiard-pocket-top-right {
    top: -1px;
    right: -1px;
    border-bottom-left-radius: 5px;
}

.billiard-pocket-bottom-left {
    bottom: -1px;
    left: -1px;
    border-top-right-radius: 5px;
}

.billiard-pocket-bottom-middle {
    bottom: -1px;
    left: 50%;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    transform: translateX(-50%);
}

.billiard-pocket-bottom-right {
    right: -1px;
    bottom: -1px;
    border-top-left-radius: 5px;
}

.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-top: 3px solid #2d9252;
}

.billiard-card.playing {
    border-top: 3px 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-top: 3px solid #6366f1;
}

.billiard-card.alarm-reached {
    border-top-color: #dc2626;
}

.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;
}

@media (max-width: 560px) {
    .billiard-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .billiard-card {
        padding: 15px;
    }

    .billiard-table-visual {
        width: 100%;
    }

    .billiard-pocket {
        width: 12px;
        height: 12px;
    }

    .billiard-pocket-top-left,
    .billiard-pocket-top-right,
    .billiard-pocket-bottom-left,
    .billiard-pocket-bottom-right {
        border-radius: 0;
    }

    .billiard-pocket-top-left {
        border-bottom-right-radius: 7px;
    }

    .billiard-pocket-top-middle,
    .billiard-pocket-bottom-middle {
        border-bottom-left-radius: 7px;
        border-bottom-right-radius: 7px;
    }

    .billiard-pocket-top-right {
        border-bottom-left-radius: 7px;
    }

    .billiard-pocket-bottom-left {
        border-top-right-radius: 7px;
    }

    .billiard-pocket-bottom-middle {
        border-top-left-radius: 7px;
        border-top-right-radius: 7px;
    }

    .billiard-pocket-bottom-right {
        border-top-left-radius: 7px;
    }
}

.hidden {
    display: none !important;
}

.cart-info small {
    line-height: 1.4
}


.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-header .modal-icon.info-icon {
    background: var(--primary-soft);
    color: var(--primary);
}

.billed-orders-content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.credit-list-tabs {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.credit-list-tab {
    min-height: 40px;
    padding: 8px 14px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-weight: 700;
}

.credit-list-tab.active {
    border-bottom-color: var(--primary);
    color: var(--primary-dark);
}

#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;
}

.billed-picker-list {
    display: grid;
    gap: 8px;
    overflow-y: auto;
    max-height: 55vh;
}

.billed-picker-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 12px 14px;
    text-align: left;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
}

.billed-picker-item:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--ink);
}

.user-login-info {
    display: grid;
    gap: 4px;
    justify-items: start;
    white-space: nowrap;
}

.user-online-badge {
    padding: 2px 9px;
    border-radius: 999px;
    background: color-mix(in srgb, #16a34a 16%, var(--surface));
    color: #16a34a;
    font-size: 11px;
    font-weight: 800;
}

.billed-picker-item.selected {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: inset 3px 0 var(--primary);
}

.billed-picker-item span {
    color: var(--muted);
    font-size: 0.9em;
    font-weight: 600;
}

.transfer-table-modal {
    width: min(520px, calc(100% - 32px));
}

.transfer-table-content {
    gap: 12px;
    padding-top: 16px;
}

.transfer-from-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
}

.transfer-from-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.transfer-from-card strong {
    color: var(--ink);
    text-align: right;
    overflow-wrap: anywhere;
}

.transfer-table-content .billed-order-search {
    margin: 0;
}

.transfer-table-content .billed-picker-list {
    min-height: 88px;
    max-height: min(45vh, 360px);
    padding: 1px;
}

.transfer-table-footer {
    flex: 0 0 auto;
    justify-content: flex-end;
    padding-top: 16px;
}

.ewallet-picker-item strong {
    overflow-wrap: anywhere;
}

#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;
    }

    .customer-profile-summary {
        grid-template-columns: minmax(0, 1fr);
    }

    #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;
    }

    .transfer-table-footer .btn {
        flex: 1 1 0;
    }
}
.store-toggle{border-color:#16a34a;color:#16a34a;font-weight:700;white-space:nowrap}
.store-toggle.store-open{background:#dc2626;border-color:#dc2626;color:#fff}
.form-error{color:#dc2626;font-size:.85rem;margin:8px 0 0}
.modal-content label{display:block;margin-top:10px}
.modal-content label input{width:100%;margin-top:4px}
#salesStoreSession{min-width:180px}

.settings-tabs{display:flex;gap:6px;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;border-bottom:1px solid var(--line);margin-bottom:14px}
.settings-tab{border:0;background:transparent;color:var(--muted,inherit);padding:10px 16px;font-weight:600;cursor:pointer;white-space:nowrap;border-bottom:3px solid transparent;margin-bottom:-1px}
.settings-tab.active{color:var(--primary);border-bottom-color:var(--primary)}

.mode-buttons{display:flex;flex-wrap:wrap;gap:8px;margin:6px 0 12px}.mode-btn{flex:1 1 140px;padding:10px 12px}.mode-btn.active{background:var(--primary,#2563eb);color:#fff;border-color:transparent}

/* ===== Dashboard refresh ===== */
#dashboard .cards{grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:16px;margin-bottom:20px}
#dashboard .card{position:relative;overflow:hidden;padding:18px 20px;border-radius:16px;background:var(--surface);transition:transform .15s,box-shadow .15s}
#dashboard .card::before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;background:var(--primary)}
#dashboard .card:nth-child(2)::before{background:#3b82f6}
#dashboard .card:nth-child(3)::before{background:#10b981}
#dashboard .card:nth-child(4)::before{background:#f59e0b}
#dashboard .card:nth-child(5)::before{background:#8b5cf6}
#dashboard .card:hover{transform:translateY(-2px)}
#dashboard .card h2{font-size:clamp(1.35rem,2.2vw,1.9rem);margin-top:10px;word-break:break-word}
#dashboard .dashboard-grid,#dashboard .chart-panel,#dashboard .panel{margin-bottom:20px}
#dashboard .dashboard-grid{gap:20px}
#dashboard .dashboard-grid .panel{margin-bottom:0}
#dashboard .panel{border-radius:16px;padding:20px}
#dashboard .panel-head{margin-bottom:16px;flex-wrap:wrap}
#dashboard .panel-head h3{margin:0}
#dashboard .mini-stat,#dashboard .mini-row{border-radius:12px}
.trend-toggle{display:inline-flex;gap:4px;padding:4px;border-radius:999px;background:var(--surface-soft);border:1px solid var(--line)}
.trend-toggle button{border:0;background:transparent;color:var(--muted);font-weight:600;font-size:12px;padding:7px 14px;border-radius:999px;cursor:pointer}
.trend-toggle button.active{background:var(--primary);color:#fff}
.trend-total{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;margin-bottom:14px}
.trend-total span{color:var(--muted);font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.06em}
#dashboard .chart-wrap{border-radius:14px}
@media (max-width:760px){
  #dashboard .cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-bottom:16px}
  #dashboard .cards .card:last-child:nth-child(odd){grid-column:1/-1}
  #dashboard .card{padding:14px 14px 14px 18px}
  #dashboard .panel{padding:16px;border-radius:14px;margin-bottom:16px}
  #dashboard .dashboard-grid{gap:16px;margin-bottom:16px}
  #dashboard .stats-stack{grid-template-columns:repeat(2,minmax(0,1fr))}
  .trend-toggle{width:100%}.trend-toggle button{flex:1}
}

/* ===== Reports ===== */
.report-tabs{display:flex;gap:6px;overflow-x:auto;margin-bottom:16px;padding:4px;background:var(--surface-soft);border:1px solid var(--line);border-radius:14px;-webkit-overflow-scrolling:touch}
.report-tabs button{flex:0 0 auto;border:0;background:transparent;color:var(--muted);font-weight:600;font-size:13px;padding:9px 16px;border-radius:10px;cursor:pointer;white-space:nowrap}
.report-tabs button.active{background:var(--primary);color:#fff}
.report-filters{display:flex;flex-wrap:wrap;gap:12px;align-items:flex-end;margin-bottom:16px;padding:14px 16px}
.report-filters input[type=search]{flex:2 1 220px;min-width:0}
.report-filters label{display:flex;flex-direction:column;gap:4px;font-size:12px;color:var(--muted);font-weight:600;flex:1 1 140px}
.report-filters label input{min-width:0}
#reports .report-cards{grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:14px;margin-bottom:16px}
#reports .report-cards:empty{display:none}

/* Grouped payment totals (Cash / E-Wallet tabs) */
#reports .grouped-cards{display:block}
#reports .pay-top{display:grid;grid-template-columns:2fr 1fr 1fr;gap:12px;margin-bottom:14px}
#reports .pay-stat{background:var(--surface);border:1px solid var(--line);border-left:4px solid var(--primary);border-radius:14px;padding:12px 16px;min-width:0}
#reports .pay-stat-main{border-left-color:#10b981}
#reports .pay-stat small,#reports .pay-group-rows span{color:var(--muted);font-weight:600;font-size:11px;text-transform:uppercase;letter-spacing:.04em}
#reports .pay-stat h2{margin:4px 0 0;font-size:clamp(1.15rem,2vw,1.6rem);word-break:break-word}
#reports .pay-section-title{margin:18px 0 10px;font-size:13px;color:var(--muted);text-transform:uppercase;letter-spacing:.05em}
#reports .pay-groups{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:12px}
#reports .pay-group{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:12px 14px;min-width:0}
#reports .pay-group-total{grid-column:1/-1;border-color:var(--primary)}
#reports .pay-group-head{display:flex;justify-content:space-between;align-items:baseline;gap:10px;padding-bottom:8px;margin-bottom:8px;border-bottom:1px solid var(--line)}
#reports .pay-group-head h3{margin:0;font-size:14px;min-width:0;overflow-wrap:anywhere}
#reports .pay-group-head strong{font-size:1.1rem;white-space:nowrap}
#reports .pay-group-rows{display:grid;grid-template-columns:1fr 1fr;gap:10px}
#reports .pay-group-rows div{display:flex;flex-direction:column;gap:2px;min-width:0}
#reports .pay-group-rows strong{font-size:14px;word-break:break-word}
@media (max-width:768px){
  #reports .pay-top{grid-template-columns:1fr 1fr}
  #reports .pay-stat-main{grid-column:1/-1}
  #reports .pay-groups{grid-template-columns:1fr}
}
@media (max-width:420px){
  #reports .pay-group-head{flex-direction:column;align-items:flex-start;gap:2px}
}
#reports .card{padding:16px 18px;border-radius:16px;border-left:4px solid var(--primary)}
#reports .card h2{font-size:clamp(1.25rem,2vw,1.7rem);margin-top:8px}
#reports .panel{border-radius:16px;margin-bottom:16px}
#reports .panel h3{margin:0 0 14px}

/* Overview */
#reports .overview-cards{grid-template-columns:repeat(5,minmax(0,1fr));gap:12px;margin-bottom:18px}
#reports .overview-cards .ov-card{position:relative;overflow:hidden;min-width:0;min-height:96px;border:1px solid var(--line);border-left:4px solid var(--ov,var(--primary));padding:14px 16px;border-radius:14px;grid-column:span 1;display:flex;flex-direction:column;justify-content:space-between;gap:10px;background:var(--surface);box-shadow:var(--shadow-soft)}
#reports .overview-cards .ov-card small{display:block;min-height:2.6em;color:var(--muted);font-weight:700;font-size:clamp(10px,.85vw,12px);text-transform:uppercase;letter-spacing:.045em;line-height:1.35;overflow-wrap:anywhere}
#reports .overview-cards .ov-card h2{margin:0;font-size:clamp(1.15rem,1.55vw,1.55rem);line-height:1.15;word-break:normal;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
#reports .overview-cards .ov-gross{--ov:#10b981}
#reports .overview-cards .ov-expense{--ov:#ef4444}
#reports .overview-cards .ov-net{--ov:#3b82f6}
#reports .overview-cards .ov-negative{--ov:#ef4444}
#reports .overview-cards .ov-negative h2{color:#ef4444}
#reports .overview-cards .ov-info{--ov:#8b5cf6}
#reports .overview-cards .ov-pos{--ov:#f59e0b}
#reports .overview-cards .ov-billiard{--ov:#14b8a6}
#reports .overview-cards .ov-cash{--ov:#22c55e}
#reports .overview-cards .ov-wallet{--ov:#0ea5e9}
#reports .overview-cards .ov-converted{--ov:#8b5cf6}
#reportOverview{display:grid;grid-template-columns:minmax(0,1fr);gap:10px;align-items:start}
#reportOverview .panel{margin-bottom:0;min-width:0;padding:12px 14px}
#reportOverview .panel h3{margin:0 0 8px;font-size:15px}
#reportOverview .panel:first-child{grid-column:1/-1}
@media (max-width:1100px){
  #reports .overview-cards{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
}
@media (max-width:560px){
  #reports .overview-cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin-bottom:14px}
  #reports .overview-cards .ov-card{min-height:88px;padding:12px}
  #reports .overview-cards .ov-card small{font-size:10px}
  #reports .overview-cards .ov-card h2{font-size:clamp(1.05rem,5vw,1.35rem)}
}
@media (max-width:360px){
  #reports .report-cards.overview-cards{grid-template-columns:minmax(0,1fr)}
}@media (max-width:700px){
  .report-filters{padding:12px}
  .report-filters .btn{flex:1 1 100%}
  #reports .report-cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  #reports .panel{padding:14px}
  .report-data-table thead{display:none}
  .report-data-table,.report-data-table tbody,.report-data-table tr,.report-data-table td{display:block;width:100%}
  .report-data-table tr{border:1px solid var(--line);border-radius:12px;padding:8px 12px;margin-bottom:10px;background:var(--surface-soft)}
  .report-data-table td{display:flex;justify-content:space-between;gap:12px;padding:6px 0;border:0;text-align:right;word-break:break-word}
  .report-data-table td::before{content:attr(data-label);color:var(--muted);font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;text-align:left;flex:0 0 38%}
}

/* Cashier Shifts / Store Sessions responsive tables */
.overview-table{width:100%;border-collapse:collapse}
.overview-table th,.overview-table td{padding:10px 12px;text-align:left;white-space:nowrap}
.overview-table td:last-child{white-space:normal}
#reportOverview .table-wrap{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
@media (min-width:701px) and (max-width:1100px){
  .overview-table th,.overview-table td{padding:8px 9px;font-size:12.5px}
}
.ewallet-receiver-table{table-layout:auto}
.ewallet-receiver-table th:nth-child(n+4),.ewallet-receiver-table td:nth-child(n+4){text-align:right}
.ewallet-receiver-table td:last-child{white-space:nowrap;color:var(--primary)}
@media (max-width:700px){
  .ewallet-receiver-table td:nth-child(n+4){text-align:right}
  .ewallet-receiver-table td:last-child{padding-top:8px;margin-top:4px;border-top:1px dashed var(--line);font-size:15px}
  .overview-table th,.overview-table td{white-space:normal}
  .overview-table td{align-items:center}
  .overview-table td:last-child{padding-top:10px}
  .overview-table td .btn{width:100%}
  .overview-table td[data-label="Report"]::before,.overview-table td[data-label="Sales"]::before{display:none}
}

/* ===== User menu & profile ===== */
.syslog-details{display:grid;gap:2px;font-size:12px;line-height:1.4;min-width:180px;max-width:360px;white-space:normal;word-break:break-word}
.syslog-details strong{color:var(--muted,#64748b)}
.user-dropdown{min-width:230px;max-width:calc(100vw - 24px)}
.user-dropdown-header strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.user-role-badge{justify-self:start;margin-top:4px;padding:2px 10px;border-radius:999px;background:var(--primary-soft);color:var(--primary-dark);font-size:11px;font-weight:700}
.profile-modal{width:min(560px,94vw);max-height:92vh;overflow-y:auto}
.profile-section{margin-top:16px;padding:14px;border:1px solid var(--line);border-radius:14px;background:var(--surface-soft)}
.profile-section h3{margin:0 0 12px;font-size:1rem}
.profile-section h3 small{color:var(--muted);font-weight:500}
.profile-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.profile-grid label{display:flex;flex-direction:column;gap:4px;font-size:13px;font-weight:600;min-width:0}
.profile-grid label.wide{grid-column:1/-1}
.profile-grid input{width:100%;min-width:0}
.profile-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:16px}
@media (max-width:560px){
  .profile-grid{grid-template-columns:1fr}
  .profile-actions{flex-direction:column-reverse}
  .profile-actions .btn{width:100%}
  .user-dropdown{right:-8px}
}

/* ===== Sales trend chart: mobile controls ===== */
@media (max-width:760px){
  #dashboard .chart-panel .panel-head{flex-direction:column;align-items:stretch}
}

/* ===== Payroll ===== */
.payroll-toolbar{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-bottom:14px}
.payroll-toolbar input[type=search]{flex:1 1 220px;min-width:0}
.report-filters > select{flex:1 1 180px;min-width:0}
.report-filters label select{width:100%;min-width:0;max-width:100%;box-sizing:border-box;text-overflow:ellipsis}
.report-filters label:has(select){flex:1 1 220px;max-width:100%}
.payroll-time-row{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.modal-content label.payroll-check{display:flex;align-items:center;gap:8px;font-size:13px}
.modal-content label.payroll-check input{width:auto;margin:0}
.modal-content select{width:100%;margin-top:4px}
.pay-summary{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:6px}
.pay-summary div{display:flex;flex-direction:column;gap:2px;padding:10px 12px;background:var(--surface-soft);border:1px solid var(--line);border-radius:10px}
.pay-summary span{font-size:12px;color:var(--muted)}
.pay-net{margin:14px 0 0;font-size:1.05rem}
.pay-net strong{color:var(--primary);font-size:1.3rem}
#employeePayTypeButtons{margin-bottom:6px}
#payroll .product-table-actions{flex-wrap:wrap}
@media (max-width:600px){
  .payroll-time-row{grid-template-columns:1fr}
  .payroll-toolbar .btn{width:100%}
}

/* ===== Logo & splash ===== */
.splash-screen{position:fixed;inset:0;z-index:9999;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;background:#18232b;color:#fff;transition:opacity .45s ease,visibility .45s ease}
.splash-screen.hide{opacity:0;visibility:hidden;pointer-events:none}
.splash-bar{width:clamp(120px,40vw,200px);height:4px;border-radius:4px;background:rgba(255,255,255,.15);overflow:hidden}
.splash-bar span{display:block;height:100%;width:40%;border-radius:4px;background:#ffb5a3;animation:splashBar 1.1s ease-in-out infinite}
@keyframes splashBar{0%{transform:translateX(-100%)}100%{transform:translateX(350%)}}
.brand-logo-img{display:block;width:clamp(72px,9vw,110px);height:auto;aspect-ratio:1;object-fit:contain;margin-bottom:14px}
.login-card-logo{display:none;width:64px;height:64px;object-fit:contain;margin:0 auto 10px}
.topbar-brand{display:flex;align-items:center;gap:10px}
.topbar-brand .brand-mark{width:clamp(30px,3.2vw,40px);height:clamp(30px,3.2vw,40px);object-fit:contain;flex:0 0 auto}
.topbar-brand .brand-text{font-size:clamp(1.3rem,1.8vw,2rem);font-weight:800;line-height:1}
.topbar-brand .brand-text span{color:var(--accent-dark);font-weight:600}
.uploaded-brand-logo-divider{width:1px;height:28px;background:var(--line);opacity:.85}
.uploaded-brand-logo{height:48px;width:auto;max-width:240px;object-fit:contain;display:block;image-rendering:auto}
@media (max-width:560px){.uploaded-brand-logo-divider{height:26px}.uploaded-brand-logo{height:32px;max-width:140px}}
@media (max-width:900px){
  .brand-logo-img{width:64px;margin-bottom:8px}
  .login-card-logo{display:block}
}
@media (max-width:480px){
  .topbar-brand .brand-text{font-size:1.15rem}
  .topbar-brand .brand-mark{width:28px;height:28px}
}
@media (prefers-reduced-motion:reduce){.splash-bar span{animation:none}}

/* Theme-aware logos */
.logo-dark{display:none}
body.dark .logo-light{display:none}
body.dark .logo-dark{display:inline-block}
body .login-card-logo.logo-light,body.dark .login-card-logo.logo-dark{display:none}
@media (max-width:900px){
  body:not(.dark) .login-card-logo.logo-light{display:block}
  body.dark .login-card-logo.logo-dark{display:block}
}

.splash-footer{position:absolute;left:0;right:0;bottom:max(18px,env(safe-area-inset-bottom,0px));text-align:center;font-size:.78rem;line-height:1.6;color:rgba(255,255,255,.6);padding:0 16px}
.splash-footer div:first-child{font-weight:600;color:rgba(255,255,255,.8)}

/* ===== Sales trend chart (v3, simple) ===== */
#dashboard .trend-total{display:grid;grid-template-columns:1.6fr 1fr 1fr;gap:10px;margin-bottom:14px}
#dashboard .tc-stat{display:flex;flex-direction:column;gap:4px;min-width:0;padding:12px 14px;border-radius:14px;background:var(--surface-soft);border:1px solid var(--line)}
#dashboard .tc-stat span{font-size:11px;font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.05em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#dashboard .tc-stat strong{font-size:1.05rem;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#dashboard .tc-stat.total{background:var(--primary);border-color:var(--primary)}
#dashboard .tc-stat.total span{color:rgba(255,255,255,.85)}
#dashboard .tc-stat.total strong{color:#fff;font-size:1.3rem}
#dashboard .chart-wrap{overflow:visible}
.tc-readout{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin-bottom:10px;font-size:.85rem;color:var(--muted)}
.tc-readout strong{color:var(--ink);font-size:1rem}
.tc-body{display:grid;grid-template-columns:auto minmax(0,1fr);gap:8px;height:240px}
.tc-axis{display:flex;flex-direction:column;justify-content:space-between;padding-bottom:24px;font-size:10px;color:var(--muted);text-align:right;line-height:1}
.tc-plot{position:relative;min-width:0}
.tc-lines{position:absolute;inset:0 0 24px 0;display:flex;flex-direction:column;justify-content:space-between;pointer-events:none}
.tc-lines i{display:block;border-top:1px dashed var(--line)}
.tc-cols{position:absolute;inset:0;display:grid;grid-template-columns:repeat(var(--cols,7),minmax(0,1fr));gap:8px}
.tc-plot.month .tc-cols{gap:3px}
.tc-plot.year .tc-cols{gap:6px}
.tc-col{display:flex;flex-direction:column;justify-content:flex-end;align-items:center;min-width:0;padding:0;border:0;background:transparent;cursor:pointer;height:100%}
.tc-bar{display:block;width:100%;max-width:34px;height:max(2px,calc((100% - 24px) * var(--h,0)));border-radius:6px 6px 2px 2px;background:var(--primary);opacity:.45;transition:opacity .15s;flex:0 0 auto}
.tc-plot.month .tc-bar{max-width:12px;border-radius:4px 4px 1px 1px}
.tc-col:hover .tc-bar,.tc-col.selected .tc-bar{opacity:1}
.tc-col.current .tc-bar{opacity:.8}
.tc-col.selected .tc-bar{opacity:1}
.tc-label{display:block;height:24px;line-height:24px;font-size:11px;color:var(--muted);white-space:nowrap;overflow:visible}
.tc-col.selected .tc-label{color:var(--primary);font-weight:700}
@media (max-width:640px){
  #dashboard .trend-total{grid-template-columns:1fr 1fr}
  #dashboard .tc-stat.total{grid-column:1/-1}
  .tc-body{height:200px;gap:6px}
  .tc-cols{gap:5px}
  .tc-plot.month .tc-cols{gap:1px}
  .tc-plot.year .tc-cols{gap:3px}
  .tc-bar{max-width:26px}
  .tc-plot.month .tc-bar{max-width:6px}
  .tc-label{font-size:10px}
  .tc-plot.year .tc-label{font-size:9px}
}
.trend-toggle button{white-space:nowrap}
@media (max-width:640px){
  #dashboard .trend-toggle{display:flex;width:100%}
  #dashboard .trend-toggle button{flex:1;padding:8px 4px;font-size:12px}
}
#dashboard .chart-wrap{padding:12px 12px 4px;border:1px solid var(--line);background:var(--surface)}
.tc-readout{padding:0 2px}
@media (max-width:1100px){
  #dashboard .trend-total{grid-template-columns:1fr 1fr}
  #dashboard .tc-stat.total{grid-column:1/-1}
}

.switch-cashier{white-space:nowrap;font-weight:700}
.switch-cashier.hidden{display:none}
@media (max-width:640px){.switch-cashier{padding:8px 10px;font-size:12px}}
#shiftReportNote{margin:8px 0 0;font-size:13px}

.user-dropdown .store-toggle,.user-dropdown .switch-cashier{width:100%;background:transparent;border:0;color:inherit;font-weight:600;text-align:left}
.user-dropdown .store-toggle.store-open{background:transparent;color:#dc2626}
.user-dropdown .store-toggle:not(.store-open){color:#16a34a}
.user-dropdown button.hidden{display:none}
.menu-divider{border:0;border-top:1px solid var(--line,#e5e7eb);margin:6px 0;width:100%}
.user-dropdown .store-toggle,.user-dropdown .switch-cashier{display:flex;align-items:center;gap:8px}
.user-dropdown .store-toggle svg,.user-dropdown .switch-cashier svg{flex:none}

.user-dropdown-content button,.user-dropdown-footer button{display:flex;align-items:center;gap:12px;width:100%;line-height:1.2;font-size:14px}
.user-dropdown .ud-ico{flex:none;width:20px;height:20px;display:inline-flex;align-items:center;justify-content:center;font-size:16px;line-height:1;text-align:center}
.user-dropdown button>span:not(.ud-ico){flex:1;min-width:0}

#shiftReportBody{display:block;max-width:none;margin:0}#shiftReportBody .line{display:flex;justify-content:space-between;gap:16px;padding:8px 0;border-bottom:1px dashed var(--line)}#shiftReportBody .line.grand{font-size:16px;border-bottom:0;border-top:1px solid var(--line);margin-top:4px}#shiftReportBody .biz{text-align:center;margin-bottom:10px}#shiftReportBody .biz h2{margin:0;font-size:18px}#shiftReportBody .biz div{color:var(--muted,#667);font-size:12px}
#shiftReportModal .modal-box{max-width:460px;width:calc(100% - 24px);max-height:90vh;overflow-y:auto}

#closeStoreSummary{display:block;max-width:none;margin:0 0 12px}#closeStoreSummary>div{display:flex;justify-content:space-between;align-items:baseline;gap:16px;padding:8px 0;border-bottom:1px dashed var(--line)}#closeStoreSummary>div strong{text-align:right;word-break:break-word}#closeStoreSummary>div.grand{font-size:16px;border-bottom:0;border-top:1px solid var(--line);margin-top:4px}#closeStoreSummary .form-error{margin:10px 0 0}#closeStoreModal .modal-box{max-width:460px;width:calc(100% - 24px);max-height:90vh;overflow-y:auto}

#switchCashierSummary{display:block;max-width:none;margin:0 0 12px}#switchCashierSummary>div{display:flex;justify-content:space-between;align-items:baseline;gap:16px;padding:8px 0;border-bottom:1px dashed var(--line)}#switchCashierSummary>div strong{text-align:right;word-break:break-word}#switchCashierSummary>div.grand{font-size:16px;border-bottom:0;border-top:1px solid var(--line);margin-top:4px}#switchCashierModal .modal-box{max-width:460px;width:calc(100% - 24px);max-height:90vh;overflow-y:auto}

#pageLoader{position:fixed;inset:0;z-index:9000;display:none;align-items:center;justify-content:center;background:rgba(0,0,0,.18);backdrop-filter:blur(1px)}#pageLoader.show{display:flex}.page-loader-box{display:flex;align-items:center;gap:10px;padding:12px 18px;border-radius:12px;background:var(--surface,#fff);color:var(--ink,#111);font-weight:600;box-shadow:0 8px 24px rgba(0,0,0,.2)}.page-loader-spinner{width:18px;height:18px;border:3px solid var(--line,#ddd);border-top-color:var(--primary,#2563eb);border-radius:50%;animation:pageLoaderSpin .7s linear infinite}@keyframes pageLoaderSpin{to{transform:rotate(360deg)}}

.search-clear-wrap {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
}

.search-clear-wrap > input {
    max-width: none;
    padding-right: 38px;
}

.search-clear-btn {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted, #888);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: none;
}

.search-clear-wrap.has-value > .search-clear-btn {
    display: block;
}

.search-clear-btn:hover {
    transform: translateY(-50%);

    background: rgba(128, 128, 128, .2);
}

.search-clear-wrap > input[type="search"]::-webkit-search-cancel-button {
    display: none;
}

/* ===== Mobile fit: Reports / Payroll / Sales filters and tables ===== */
@media (max-width: 768px) {
    .report-filters label,
    .sales-filter-toolbar label {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
    }

    .report-filters input[type="date"],
    .sales-filter-toolbar input[type="date"] {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        min-height: 42px;
        box-sizing: border-box;
        font-size: 14px;
    }

    .report-filters input[type="search"],
    .report-filters > select,
    .report-filters label:has(select),
    .report-filters .btn {
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
    }

    .sales-filter-toolbar {
        gap: 10px;
    }

    #reports .report-filters label:has(input[type="date"]),
    #finance .report-filters label:has(input[type="date"]),
    #sales .sales-filter-toolbar label:has(input[type="date"]) {
        flex: 1 1 100%;
    }

    .sales-filter-toolbar input[type="search"],
    .sales-filter-toolbar select {
        flex: 1 1 100%;
        width: 100%;
        max-width: none;
        min-width: 0;
    }

    .page:not(#pos) .table-wrap:has(.report-data-table) {
        overflow-x: visible;
    }

    .page:not(#pos) table.report-data-table {
        min-width: 0;
        width: 100%;
        font-size: 13px;
    }

    .page:not(#pos) table.report-data-table thead {
        display: none;
    }

    .page:not(#pos) table.report-data-table,
    .page:not(#pos) table.report-data-table tbody,
    .page:not(#pos) table.report-data-table tr,
    .page:not(#pos) table.report-data-table td {
        display: block;
        width: 100%;
    }

    .page:not(#pos) table.report-data-table tr {
        border: 1px solid var(--line);
        border-radius: 12px;
        padding: 8px 12px;
        margin-bottom: 10px;
        background: var(--surface-soft);
    }

    .page:not(#pos) table.report-data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 6px 0;
        border: 0;
        text-align: right;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .page:not(#pos) table.report-data-table td::before {
        content: attr(data-label);
        flex: 0 0 38%;
        color: var(--muted);
        font-size: 11px;
        font-weight: 700;
        letter-spacing: .05em;
        text-align: left;
        text-transform: uppercase;
    }

    .page:not(#pos) table.report-data-table td .btn,
    .page:not(#pos) table.report-data-table td .table-action {
        width: auto;
    }
}

.ewallet-convert-btn{margin-top:10px;width:100%}
#ewalletConversionHistory{margin-top:18px}
#ewalletConvertModal label{display:flex;flex-direction:column;gap:4px;margin-top:12px;font-weight:600}
#ewalletConvertModal .form-error{color:#b91c1c;min-height:1.2em;margin:8px 0 0}

/* By Account cards */
#reports .pay-groups .pay-group{display:flex;flex-direction:column;transition:box-shadow .15s,border-color .15s}
#reports .pay-groups .pay-group:not(.pay-group-total):hover{border-color:var(--primary);box-shadow:0 4px 14px rgba(0,0,0,.08)}
#reports .pay-group-rows div:nth-child(3){grid-column:1/-1;flex-direction:row;justify-content:space-between;align-items:center;gap:10px;margin-top:2px;padding:8px 10px;border-radius:10px;background:rgba(16,185,129,.12)}
#reports .pay-group-rows div:nth-child(3) strong{color:var(--report-positive);font-size:15px;white-space:nowrap}
#reports .ewallet-convert-btn{margin-top:auto;padding:9px 12px;min-height:40px;width:100%}
#reports .pay-group-rows+.ewallet-convert-btn{margin-top:12px}
@media (min-width:1200px){#reports .pay-groups{grid-template-columns:repeat(auto-fill,minmax(300px,1fr))}}
@media (min-width:561px) and (max-width:1024px){#reports .pay-groups{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:560px){
  #reports .pay-groups{grid-template-columns:1fr;gap:10px}
  #reports .pay-group{padding:12px}
  #reports .pay-group-head{flex-direction:row;align-items:center;flex-wrap:wrap}
  #reports .pay-group-head strong{font-size:1.05rem}
  #reports .ewallet-convert-btn{min-height:44px;font-size:14px}
}

#reports .pay-group-total .pay-group-rows{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}
#reports .pay-group-total .pay-group-rows div:nth-child(3){grid-column:auto;flex-direction:column;align-items:stretch;padding:0;background:none;margin:0}
#reports .pay-group-total .pay-group-rows div:nth-child(3) strong{color:inherit;font-size:14px}
#reports .pay-group-total .pay-group-rows div:nth-child(4) strong{color:var(--report-positive)}

/* Cash Breakdown card */
#reports .cash-card .pay-group-rows{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
#reports .cash-card .pay-group-rows div{padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:var(--surface-soft,rgba(0,0,0,.02))}
#reports .cash-card .pay-group-rows span{font-size:11px;line-height:1.3}
#reports .cash-card .pay-group-rows strong{font-size:16px;color:inherit}
#reports .cash-card .row-converted strong{color:#b45309}
#reports .cash-card .row-grand{grid-column:1/-1;flex-direction:row;justify-content:space-between;align-items:center;gap:12px;padding:14px 16px;background:rgba(16,185,129,.14);border-color:#10b981}
#reports .cash-card .row-grand span{font-size:12px;font-weight:700;color:var(--text,inherit)}
#reports .cash-card .row-grand strong{font-size:clamp(1.25rem,3vw,1.7rem);color:var(--report-positive);white-space:nowrap}
@media (max-width:760px){#reports .cash-card .pay-group-rows{grid-template-columns:1fr 1fr}#reports .cash-card .row-converted{grid-column:1/-1}}
@media (max-width:420px){
  #reports .cash-card .pay-group-rows{grid-template-columns:1fr}
  #reports .cash-card .row-grand{flex-direction:column;align-items:flex-start;gap:4px}
}

/* Cash Converted row fix (overrides the generic 3rd-row highlight) */
#reports .pay-group.cash-card .pay-group-rows div.row-converted{grid-column:auto;display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;gap:2px;margin:0;padding:10px 12px;border:1px solid #f59e0b;border-radius:10px;background:rgba(245,158,11,.12)}
#reports .pay-group.cash-card .pay-group-rows div.row-converted span{color:#92400e}
#reports .pay-group.cash-card .pay-group-rows div.row-converted strong{color:#b45309;font-size:16px;white-space:normal}
@media (max-width:760px){#reports .pay-group.cash-card .pay-group-rows div.row-converted{grid-column:1/-1}}

/* Cash Converted: identical to POS / Billiard Sales boxes */
#reports .pay-group.cash-card .pay-group-rows div.row-converted{border:1px solid var(--line);background:var(--surface-soft,rgba(0,0,0,.02))}
#reports .pay-group.cash-card .pay-group-rows div.row-converted span{color:var(--muted)}
#reports .pay-group.cash-card .pay-group-rows div.row-converted strong{color:inherit}

/* Checkout total & change */
.checkout-total-card,.checkout-change-card{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:14px 16px;border-radius:14px;border:1px solid var(--line)}
.checkout-total-card{margin:0 0 14px;background:var(--primary-soft);border-color:var(--primary)}
.checkout-change-card{margin:14px 0 0;background:color-mix(in srgb, #10b981 12%, var(--surface));border-color:#10b981}
.checkout-total-card span,.checkout-change-card span{font-size:12px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
.checkout-total-card strong,.checkout-change-card strong{font-size:clamp(1.5rem,5vw,2rem);font-weight:800;line-height:1.1;white-space:nowrap}
.checkout-total-card strong{color:var(--primary)}
.checkout-change-card strong{color:var(--report-positive)}
@media (max-width:420px){.checkout-total-card,.checkout-change-card{padding:12px 14px}}

.savings-available{display:flex;justify-content:space-between;align-items:center;padding:12px 14px;border:1px solid var(--line);border-radius:12px;background:var(--surface-soft);color:var(--muted);font-weight:600;margin-bottom:12px}
.savings-available strong{color:var(--primary);font-size:18px}
.savings-badge{display:inline-block;padding:3px 10px;border-radius:999px;font-size:12px;font-weight:700}
.savings-badge.deposit{background:rgba(22,163,74,.15);color:#16a34a}
.savings-badge.withdraw{background:rgba(217,119,6,.15);color:#d97706}

.connection-status{position:fixed;top:12px;right:auto;left:50%;transform:translateX(-50%);z-index:10001;box-sizing:border-box;display:flex;align-items:center;gap:10px;width:max-content;max-width:min(620px,calc(100vw - 24px));padding:11px 16px;border:1px solid #dc2626;border-radius:14px;background:var(--surface);color:var(--ink);box-shadow:0 10px 30px rgba(15,23,42,.16);font-size:13px;font-weight:600;line-height:1.45;backdrop-filter:blur(12px)}
.connection-status::before{content:"";flex:0 0 9px;width:9px;height:9px;border-radius:50%;background:#dc2626;box-shadow:0 0 0 4px rgba(220,38,38,.18);animation:connectionBlink 1s ease-in-out infinite}
@keyframes connectionBlink{0%,100%{opacity:1}50%{opacity:.15}}

.connection-status-text{min-width:0}
.connection-status[hidden],.connection-status-review[hidden]{display:none}
.connection-status-review{flex:0 0 auto;border:0;border-radius:9px;padding:8px 11px;background:var(--primary);color:#fff;font:inherit;font-size:12px;cursor:pointer;transition:filter .15s ease,transform .15s ease}
.connection-status-review:hover{filter:brightness(1.08)}
.connection-status-review:active{transform:scale(.98)}
@media (max-width:560px){.connection-status{top:calc(10px + env(safe-area-inset-top,0px));width:max-content;max-width:calc(100vw - 150px);gap:7px;padding:6px 10px;border-radius:999px;font-size:11px;white-space:nowrap}.connection-status::before{flex-basis:7px;width:7px;height:7px;box-shadow:0 0 0 3px rgba(220,38,38,.18)}.connection-status-review{padding:5px 8px;font-size:11px}}

/* Settings: general & e-wallet */
.settings-panel{display:flex;flex-direction:column;gap:16px}
.settings-section-head h3{margin:0 0 4px;font-size:18px}
.settings-section-head p{margin:0;color:var(--muted);font-size:13px}
.settings-section-head-row{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.settings-card{border:1px solid var(--line);border-radius:14px;background:var(--surface-soft);padding:16px 18px}
.settings-card-title{margin:0 0 14px;font-size:14px;font-weight:700;display:flex;align-items:center;gap:8px}
.settings-optional{font-size:11px;font-weight:600;color:var(--muted);background:var(--surface);border:1px solid var(--line);border-radius:999px;padding:2px 8px}
.settings-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.settings-field{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:600}
.settings-field-wide{grid-column:1 / -1}
.settings-field input{margin:0}
.settings-logo-row{display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.settings-logo-row .settings-logo-preview{grid-column:auto;min-width:120px;min-height:64px;justify-content:center;padding:12px 16px;background:var(--surface)}
.settings-logo-upload{flex:1 1 240px;min-width:0}
.settings-logo-upload input[type=file]{width:100%;margin:0}
.settings-logo-upload .settings-help{margin:8px 0 0}
.settings-panel .settings-form-actions{padding-top:2px}
.ewallet-account-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:14px}
.ewallet-account-grid .empty{grid-column:1 / -1}
.ewallet-account-card{display:flex;align-items:center;gap:14px;flex-wrap:wrap;padding:14px 16px;border:1px solid var(--line);border-radius:14px;background:var(--surface);box-shadow:var(--shadow-soft);transition:transform .15s ease,border-color .15s ease}
.ewallet-account-card:hover{transform:translateY(-2px);border-color:var(--primary)}
.ewallet-account-badge{flex:0 0 44px;width:44px;height:44px;border-radius:12px;display:grid;place-items:center;color:#fff;font-weight:800;font-size:18px;background:linear-gradient(135deg,var(--primary) 0%,var(--primary-dark) 100%)}
.ewallet-account-info{flex:1 1 140px;min-width:0;display:flex;flex-direction:column;gap:2px}
.ewallet-account-info strong{font-size:15px}
.ewallet-account-number{font-variant-numeric:tabular-nums;letter-spacing:.3px;font-weight:600}
.ewallet-account-name{color:var(--muted);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ewallet-account-actions{display:flex;gap:6px;width:100%;padding-top:10px;border-top:1px dashed var(--line)}
.ewallet-account-actions .btn{flex:1}
@media (max-width:640px){
  .settings-fields{grid-template-columns:1fr}
  .settings-card{padding:14px}
  .ewallet-account-grid{grid-template-columns:1fr}
  .settings-panel .settings-form-actions .btn{width:100%}
}
.settings-tabs::-webkit-scrollbar{display:none}

/* iOS Safari: date inputs have an intrinsic width that overflows their panel */
input[type="date"]{-webkit-appearance:none;appearance:none;box-sizing:border-box;max-width:100%;min-width:0;display:block}
input[type="date"]::-webkit-date-and-time-value{text-align:left;min-height:1.2em;margin:0}
input[type="date"]::-webkit-datetime-edit{padding:0;max-width:100%}
@media (max-width:768px){
  .report-filters,.sales-filter-toolbar{max-width:100%;box-sizing:border-box}
  .report-filters label,.sales-filter-toolbar label,#finance .report-filters label{display:flex;flex-direction:column;gap:4px;flex:1 1 100%;width:100%;max-width:100%;min-width:0;box-sizing:border-box}
  .report-filters input[type="date"],.sales-filter-toolbar input[type="date"]{width:100%;max-width:100%;min-width:0;min-height:42px;box-sizing:border-box;font-size:16px}
}
/* Products table: card layout on phones */
@media (max-width:640px){
  #productsTable{overflow:visible}
  #productsTableContent table.products-table{display:block;width:100%;min-width:0!important;border:0}
  #productsTableContent .products-table thead{display:none}
  #productsTableContent .products-table tbody{display:grid;gap:12px}
  #productsTableContent .products-table tr{display:grid;grid-template-columns:1fr 1fr;gap:10px 12px;padding:14px;border:1px solid var(--line);border-radius:14px;background:var(--surface);box-shadow:var(--shadow-soft)}
  #productsTableContent .products-table td{display:flex;flex-direction:column;gap:2px;padding:0;border:0;min-width:0;width:auto;font-size:14px;font-weight:600;overflow:visible;word-break:break-word}
  #productsTableContent .products-table td::before{content:attr(data-label);color:var(--muted);font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.05em}
  #productsTableContent .products-table td:nth-child(1){grid-column:1 / -1;font-size:16px;font-weight:800;padding-bottom:8px;border-bottom:1px dashed var(--line)}
  #productsTableContent .products-table td:nth-child(1)::before{display:none}
  #productsTableContent .products-table td:nth-child(3){display:flex}
  #productsTableContent .products-table td:nth-child(5){color:var(--primary)}
  #productsTableContent .products-table td:last-child{grid-column:1 / -1;padding-top:10px;border-top:1px dashed var(--line)}
  #productsTableContent .products-table td:last-child::before{display:none}
  #productsTableContent .products-table .product-table-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  #productsTableContent .products-table .table-action{min-height:40px;font-size:13px;padding:8px}
}
/* Users & Roles */
.users-panel .table-toolbar{margin-bottom:14px}
.users-panel .table-toolbar input{max-width:420px;width:100%}
.users-table td{vertical-align:middle}
.user-cell{display:flex;align-items:center;gap:12px;min-width:0}
.user-avatar{flex:0 0 38px;width:38px;height:38px;border-radius:50%;display:grid;place-items:center;color:#fff;font-weight:800;font-size:15px;background:linear-gradient(135deg,var(--primary) 0%,var(--primary-dark) 100%)}
.user-cell-text{display:flex;flex-direction:column;min-width:0}
.user-cell-text strong{font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.user-cell-text small{color:var(--muted);font-size:12px}
.role-chip,.status-chip{display:inline-flex;align-items:center;gap:6px;padding:3px 10px;border-radius:999px;font-size:12px;font-weight:700;white-space:nowrap}
.role-admin{background:var(--primary-soft);color:var(--primary-dark)}
.role-cashier{background:var(--surface-soft);color:var(--ink);border:1px solid var(--line)}
.status-chip::before{content:"";width:7px;height:7px;border-radius:50%;background:currentColor}
.status-active{background:rgba(22,163,74,.12);color:#15803d}
.status-off{background:rgba(220,38,38,.1);color:#b91c1c}
@media (max-width:900px){
  .users-table th:nth-child(4),.users-table td:nth-child(4){display:none}
}
@media (max-width:640px){
  #usersTable{overflow:visible}
  #usersTable table.users-table{display:block;width:100%;min-width:0!important;border:0}
  #usersTable .users-table thead{display:none}
  #usersTable .users-table tbody{display:grid;gap:12px}
  #usersTable .users-table tr{display:grid;grid-template-columns:1fr 1fr;gap:10px 12px;padding:14px;border:1px solid var(--line);border-radius:14px;background:var(--surface);box-shadow:var(--shadow-soft)}
  #usersTable .users-table td{display:flex;flex-direction:column;align-items:flex-start;gap:4px;padding:0;border:0;min-width:0;width:auto;font-size:13px;font-weight:600}
  #usersTable .users-table td::before{content:attr(data-label);color:var(--muted);font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.05em}
  #usersTable .users-table td:nth-child(1){grid-column:1 / -1;padding-bottom:10px;border-bottom:1px dashed var(--line)}
  #usersTable .users-table td:nth-child(1)::before,#usersTable .users-table td:last-child::before{display:none}
  #usersTable .users-table td:nth-child(4){display:flex;grid-column:1 / -1}
  #usersTable .users-table td:last-child{grid-column:1 / -1;padding-top:10px;border-top:1px dashed var(--line)}
  #usersTable .users-table td:last-child .btn{width:100%;min-height:40px}
}
/* Customers */
.customers-table td{vertical-align:middle}
.customers-table th:nth-child(3),.customers-table td:nth-child(3){text-align:right}
.customers-table th:last-child,.customers-table td:last-child{text-align:right;width:1%;white-space:nowrap}
.balance-chip{display:inline-flex;padding:3px 10px;border-radius:999px;font-size:13px;font-weight:700;font-variant-numeric:tabular-nums}
.balance-owing{background:rgba(220,38,38,.1);color:#b91c1c}
.balance-clear{background:var(--surface-soft);color:var(--muted);border:1px solid var(--line)}
@media (max-width:640px){
  #customerProfilesTable{overflow:visible}
  #customerProfilesTable table.customers-table{display:block;width:100%;min-width:0!important;border:0}
  #customerProfilesTable .customers-table thead{display:none}
  #customerProfilesTable .customers-table tbody{display:grid;gap:12px}
  #customerProfilesTable .customers-table tr{display:grid;grid-template-columns:1fr 1fr;gap:10px 12px;padding:14px;border:1px solid var(--line);border-radius:14px;background:var(--surface);box-shadow:var(--shadow-soft)}
  #customerProfilesTable .customers-table td{display:flex;flex-direction:column;align-items:flex-start;gap:4px;padding:0;border:0;min-width:0;width:auto;font-size:13px;font-weight:600;text-align:left;white-space:normal}
  #customerProfilesTable .customers-table td::before{content:attr(data-label);color:var(--muted);font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.05em}
  #customerProfilesTable .customers-table td:nth-child(1){grid-column:1 / -1;padding-bottom:10px;border-bottom:1px dashed var(--line)}
  #customerProfilesTable .customers-table td:nth-child(1)::before,#customerProfilesTable .customers-table td:last-child::before{display:none}
  #customerProfilesTable .customers-table td:last-child{grid-column:1 / -1;width:auto;padding-top:10px;border-top:1px dashed var(--line)}
  #customerProfilesTable .customers-table td:last-child .btn{width:100%;min-height:40px}
}
/* Payroll filters: same date picker layout as Reports / Sales */
@media (max-width:768px){
  #payroll .report-filters label:has(input[type="date"]){flex:1 1 100%;width:100%;max-width:100%;min-width:0}
  #payroll .report-filters input[type="date"]{width:100%;max-width:100%;min-width:0;min-height:42px;box-sizing:border-box;font-size:16px}
  #payroll .report-filters > select,#payroll .report-filters input[type="search"],#payroll .report-filters .btn{flex:1 1 100%;width:100%;min-width:0}
}

.partial-payment-field { display: grid; gap: 6px; margin: 10px 0; padding: 12px; border: 1px dashed #94a3b8; border-radius: 12px; background: #f8fafc; }
.partial-payment-field.hidden { display: none; }
.partial-payment-field label { display: grid; gap: 6px; font-weight: 600; }
.partial-payment-field input { min-height: 44px; font-size: 16px; }
.partial-paid-note { display: block; margin-top: 2px; color: #b45309; font-size: 11px; font-weight: 600; }

/* Dashboard: low stock + recent transactions */
.dash-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.dash-table th { position: sticky; top: 0; background: var(--surface-soft, #f8fafc); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.dash-table th, .dash-table td { padding: 12px 14px; text-align: left; vertical-align: middle; }
.dash-table tbody tr:hover { background: var(--surface-soft, #f8fafc); }
.dash-table td:last-child, .dash-table th:last-child { text-align: right; }
.dash-sales-table td:first-child { font-weight: 600; word-break: break-all; }
.stock-pill { display: inline-block; min-width: 36px; padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: 13px; text-align: center; }
.stock-pill.stock-low { background: #fef3c7; color: #92400e; }
.stock-pill.stock-out { background: #fee2e2; color: #b91c1c; }
@media (max-width: 768px) {
  .dash-table thead { display: none; }
  .dash-table, .dash-table tbody { display: block; }
  .dash-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 12px; margin-bottom: 10px; border: 1px solid var(--line, #e2e8f0); border-radius: 12px; background: var(--surface, #fff); }
  .dash-table td, .dash-table td:last-child { display: flex; flex-direction: column; gap: 2px; padding: 2px 0; border: 0; text-align: left; }
  .dash-table td::before { content: attr(data-label); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #64748b); }
  .dash-sales-table td:first-child, .dash-stock-table td:first-child { grid-column: 1 / -1; }
  .dash-table td[data-label="Total"], .dash-table td[data-label="Stock"] { align-items: flex-start; }
  .dash-table td[data-label="Total"] { font-weight: 700; }
}
@media (max-width: 768px) {
  .page:not(#pos) table.dash-table { min-width: 0; width: 100%; font-size: 14px; }
  #dashboardLowStock, #recentSales { overflow: visible; }
}

/* iPhone/Safari: prefixed animations; alerts must keep blinking even with Reduce Motion on */
.connection-status::before{-webkit-animation:connectionBlink 1s ease-in-out infinite;animation:connectionBlink 1s ease-in-out infinite;will-change:opacity}
@-webkit-keyframes connectionBlink{0%,100%{opacity:1}50%{opacity:.15}}
.billiard-card.alarm-reached{-webkit-animation:billiardAlarmBlink 1.2s ease-in-out infinite;animation:billiardAlarmBlink 1.2s ease-in-out infinite}
@keyframes billiardAlarmBlink{0%,100%{background-color:var(--surface);box-shadow:0 0 0 0 rgba(220,38,38,.1)}50%{background-color:rgba(220,38,38,.16);box-shadow:0 0 0 6px rgba(220,38,38,.25)}}
@-webkit-keyframes billiardAlarmBlink{0%,100%{background-color:var(--surface);box-shadow:0 0 0 0 rgba(220,38,38,.1)}50%{background-color:rgba(220,38,38,.16);box-shadow:0 0 0 6px rgba(220,38,38,.25)}}

/* "Sync pending" after coming back online is a warning (orange), not an error */
.connection-status.connection-status-syncing{border-color:#f59e0b}
.connection-status.connection-status-syncing::before{background:#f59e0b;box-shadow:0 0 0 4px rgba(245,158,11,.22)}
