/* Havis POS — Square / Toast inspired register dashboard */

.pos-dash {
    --pos-ink: #0f172a;
    --pos-muted: #64748b;
    --pos-line: #e2e8f0;
    --pos-bg: #f1f5f9;
    --pos-card: #ffffff;
    --pos-brand: #1e3a8a;
    --pos-sell: #059669;
    --pos-sell-dark: #047857;
    --pos-warn: #d97706;
    --pos-danger: #dc2626;
    --pos-info: #0284c7;
    --pos-radius: 16px;
    --pos-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
    background: var(--pos-bg);
    min-height: 100vh;
    color: var(--pos-ink);
    font-family: "Nunito Sans", "Segoe UI", sans-serif;
    padding: 1.25rem 1.25rem 3rem;
}

.pos-dash * { box-sizing: border-box; }

.pos-dash a { text-decoration: none; }

.pos-top {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.pos-greet h1 {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 0.2rem;
    color: var(--pos-ink);
}

.pos-greet p {
    margin: 0;
    color: var(--pos-muted);
    font-size: 0.95rem;
}

.pos-greet strong { color: var(--pos-ink); }

.pos-top-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.pos-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--pos-card);
    border: 1px solid var(--pos-line);
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--pos-ink);
    box-shadow: var(--pos-shadow);
}

.pos-chip i { color: var(--pos-brand); }

.pos-chip.is-live i { color: #16a34a; }

.btn-pos-sell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    background: var(--pos-sell);
    color: #fff !important;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    border: 0;
    border-radius: 14px;
    padding: 0.95rem 1.5rem;
    box-shadow: 0 10px 24px rgba(5, 150, 105, 0.28);
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    min-height: 52px;
}

.btn-pos-sell:hover {
    background: var(--pos-sell-dark);
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(5, 150, 105, 0.35);
}

.btn-pos-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--pos-card);
    color: var(--pos-ink) !important;
    border: 1px solid var(--pos-line);
    border-radius: 12px;
    padding: 0.7rem 1rem;
    font-weight: 700;
    font-size: 0.88rem;
    box-shadow: var(--pos-shadow);
}

.btn-pos-ghost:hover { border-color: #94a3b8; }

.pos-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.25rem;
}

.pos-kpi {
    background: var(--pos-card);
    border: 1px solid var(--pos-line);
    border-radius: var(--pos-radius);
    padding: 1.1rem 1.15rem;
    box-shadow: var(--pos-shadow);
    min-height: 118px;
}

.pos-kpi .label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--pos-muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.55rem;
}

.pos-kpi .value {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.15;
}

.pos-kpi .hint {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--pos-muted);
    font-weight: 600;
}

.pos-kpi .icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 0.95rem;
}

.pos-kpi.is-sales .icon { background: #dcfce7; color: #166534; }
.pos-kpi.is-tickets .icon { background: #dbeafe; color: #1d4ed8; }
.pos-kpi.is-avg .icon { background: #f3e8ff; color: #7e22ce; }
.pos-kpi.is-alert .icon { background: #ffedd5; color: #c2410c; }

.pos-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.pos-card {
    background: var(--pos-card);
    border: 1px solid var(--pos-line);
    border-radius: var(--pos-radius);
    box-shadow: var(--pos-shadow);
    overflow: hidden;
}

.pos-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.15rem 0.35rem;
}

.pos-card-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.pos-card-head a {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--pos-brand);
}

.pos-card-body { padding: 0.5rem 1.15rem 1.15rem; }

.pos-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.7rem;
}

.pos-action {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.55rem;
    background: #f8fafc;
    border: 1px solid var(--pos-line);
    border-radius: 14px;
    padding: 0.95rem 0.9rem;
    color: var(--pos-ink) !important;
    min-height: 108px;
    transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
    position: relative;
}

.pos-action:hover {
    background: #fff;
    border-color: #94a3b8;
    transform: translateY(-2px);
}

.pos-action .ico {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    color: #fff;
}

.pos-action span {
    font-size: 0.88rem;
    font-weight: 800;
    line-height: 1.2;
}

.pos-action small {
    color: var(--pos-muted);
    font-size: 0.74rem;
    font-weight: 600;
}

.pos-action .badge-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #ea580c;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    display: grid;
    place-items: center;
    padding: 0 6px;
}

.pos-sale-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.pos-sale-row:last-child { border-bottom: 0; }

.pos-sale-row .who {
    font-weight: 800;
    font-size: 0.9rem;
}

.pos-sale-row .meta {
    color: var(--pos-muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.pos-sale-row .amt {
    font-weight: 800;
    white-space: nowrap;
}

.pos-empty {
    text-align: center;
    color: var(--pos-muted);
    padding: 1.5rem 0.5rem;
    font-weight: 600;
}

.pos-alert-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.pos-alert-item:last-child { border-bottom: 0; }

.stock-pill {
    font-size: 0.72rem;
    font-weight: 800;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
}

.stock-pill.low { background: #ffedd5; color: #9a3412; }
.stock-pill.out { background: #fee2e2; color: #991b1b; }

.pos-section-title {
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--pos-muted);
    margin: 0 0 0.75rem;
}

@media (max-width: 1100px) {
    .pos-kpis, .pos-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pos-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .pos-dash { padding: 0.6rem 0.15rem 5.5rem; }
    .pos-greet h1 { font-size: 1.2rem; }
    .pos-kpis, .pos-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .btn-pos-sell { width: 100%; justify-content: center; }
    .pos-top-meta { width: 100%; }
    .pos-kpi .value { font-size: 1.1rem; word-break: break-word; }
    .pos-action { min-height: 0; padding: 0.7rem 0.65rem; }
}

/* ===== POS application chrome (sidebar + top bar) ===== */
.pos-app {
    margin: 0;
    min-height: 100vh;
    background: #f1f5f9;
    font-family: "Nunito Sans", "Segoe UI", sans-serif;
    color: #0f172a;
}
.pos-app a { text-decoration: none; }
.pos-shell {
    display: grid;
    grid-template-columns: 268px minmax(0, 1fr);
    grid-template-rows: 58px minmax(0, 1fr);
    min-height: 100vh;
}
.pos-side {
    background: #0b1220;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    grid-column: 1;
    grid-row: 1 / span 2;
}
.pos-side-brand {
    padding: 1.1rem 1rem 0.85rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.pos-side-brand .name {
    display: block;
    color: #fff;
    font-weight: 800;
    font-size: 0.98rem;
    letter-spacing: -0.02em;
    line-height: 1.25;
}
.pos-side-brand .sub {
    display: block;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 700;
    margin-top: 0.15rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.pos-side-sell {
    margin: 0.9rem 0.85rem 0.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    background: #059669;
    color: #fff !important;
    font-weight: 800;
    border-radius: 12px;
    padding: 0.78rem 0.7rem;
    box-shadow: 0 10px 22px rgba(5, 150, 105, 0.28);
}
.pos-side-sell:hover { background: #047857; color: #fff !important; }
.pos-side-nav {
    padding: 0.4rem 0.65rem 1.2rem;
    overflow-y: auto;
    flex: 1;
}
.pos-side-nav details { margin: 0.15rem 0 0.35rem; }
.pos-side-nav summary {
    list-style: none;
    cursor: pointer;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
    padding: 0.55rem 0.55rem 0.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.pos-side-nav summary::-webkit-details-marker { display: none; }
.pos-side-nav summary::after {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: rotate(45deg);
    margin-bottom: 3px;
}
.pos-side-nav details[open] summary::after { transform: rotate(225deg); margin-bottom: 0; }
.pos-side-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #cbd5e1 !important;
    border-radius: 10px;
    padding: 0.48rem 0.7rem;
    font-size: 0.86rem;
    font-weight: 700;
    margin: 0.08rem 0;
}
.pos-side-link i { width: 1.1rem; text-align: center; opacity: 0.9; }
.pos-side-link:hover { background: rgba(255,255,255,0.06); color: #fff !important; }
.pos-side-link.is-active {
    background: rgba(56, 189, 248, 0.14);
    color: #fff !important;
}
.pos-main { min-width: 0; display: flex; flex-direction: column; grid-column: 2; grid-row: 2; }
.pos-topbar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.65rem 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 20;
    grid-column: 2;
    grid-row: 1;
    height: auto !important;
    min-height: 56px;
    overflow: visible !important;
    flex-wrap: wrap;
}
.pos-topbar-left, .pos-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}
.pos-icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #0f172a !important;
    border-radius: 10px;
    padding: 0.38rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 800;
}
.pos-icon-btn:hover { background: #f8fafc; }
.pos-online {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #ecfdf5;
    color: #047857;
    border-radius: 999px;
    padding: 0.32rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 800;
}
.pos-online i { font-size: 0.5rem; }
.pos-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 999px;
    padding: 0.25rem 0.7rem 0.25rem 0.3rem;
    font-weight: 800;
    font-size: 0.82rem;
    color: #0f172a;
}
.pos-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1e3a8a;
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    font-weight: 800;
}
.pos-menu-btn {
    display: none;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 10px;
    width: 40px;
    height: 40px;
}
.pos-app .pos-dash { min-height: calc(100vh - 58px); }
.pos-side-backdrop {
    display: none;
}
.pos-page {
    padding: 80px 20px 24px 288px !important;
    min-width: 0;
}
.pos-page > .pos-shell,
.pos-page > .pos-app,
.pos-page > html,
.pos-page > nav.navbar,
.pos-page > .navbar {
    display: none !important;
}
.pos-app .app-content,
.pos-app .side-app,
.pos-app .main-content,
.pos-app .hor-content {
    margin-top: 0 !important;
    margin-left: 0 !important;
}

/* Old Spruha/Sash POS pages still wrap in .app-content (offset for a removed header/sidebar) */
.pos-app .app-content,
.pos-app .side-app,
.pos-app .main-content,
.pos-app .hor-content {
    margin: 0 !important;
    margin-top: 0 !important;
    margin-left: 0 !important;
    padding-top: 0 !important;
    min-width: 0 !important;
    overflow: visible !important;
}
.pos-app .app-header,
.pos-app .main-header,
.pos-app .app-sidebar,
.pos-app .main-sidebar,
.pos-app .horizontal-main,
.pos-app .header.top-header,
.pos-app .sticky.app-header,
.pos-app header.sticky {
    display: none !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}
.pos-page > .app-content,
.pos-page > .side-app,
.pos-page > .main-content,
.pos-page > .hor-content {
    margin-top: 0 !important;
}

.pos-app .app-content,
body.pos-has-fragment .app-content,
.pos-page .app-content {
    overflow: visible !important;
    min-height: auto !important;
}

.pos-app .page-header,
body.pos-has-fragment .page-header,
.pos-page .page-header {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 0.5rem 0.75rem !important;
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
}

.pos-app .page-options,
body.pos-has-fragment .page-options,
.pos-page .page-options,
.pos-app .page-header .ms-auto,
.pos-page .page-header .ms-auto {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
    max-width: 100%;
    flex: 1 1 auto;
    justify-content: flex-end;
}

.pos-app .page-header .btn,
.pos-app .page-options .btn,
.pos-page .page-header .btn,
.pos-page .page-options .btn,
.pos-app .btn-list .btn,
.pos-app .btn-toolbar .btn,
.pos-app .btn-group .btn {
    height: auto !important;
    min-height: 38px;
    overflow: visible !important;
    white-space: nowrap;
    flex: 0 0 auto;
    max-height: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.pos-app .btn-list,
.pos-app .btn-toolbar,
.pos-app .btn-group {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
}

#posTopbar,
.pos-shell-fragment .pos-topbar {
    height: auto !important;
    min-height: 56px !important;
    overflow: visible !important;
    flex-wrap: wrap !important;
}

/* Included (not @extended) on Quotations/Appointments — do not leave a blank 100vh column */
.pos-shell-fragment {
    display: contents;
}
.pos-shell-fragment .pos-side {
    position: fixed !important;
    left: 0;
    top: 0;
    bottom: 0;
    width: 268px;
    height: 100vh;
    z-index: 1040;
    grid-column: auto;
    grid-row: auto;
}
.pos-shell-fragment .pos-topbar {
    position: fixed !important;
    left: 268px;
    right: 0;
    top: 0;
    height: auto !important;
    min-height: 58px;
    overflow: visible !important;
    z-index: 1040;
    grid-column: auto;
    grid-row: auto;
}
body.pos-has-fragment {
    padding-left: 268px !important;
    padding-top: 72px !important;
    margin: 0 !important;
    background: #f1f5f9;
}
body.pos-has-fragment .app-content,
body.pos-has-fragment .side-app,
body.pos-has-fragment .main-content {
    margin: 0 !important;
    margin-top: 0 !important;
    margin-left: 0 !important;
    padding-top: 1rem !important;
    overflow: visible !important;
}
body.pos-has-fragment .app-header,
body.pos-has-fragment .app-sidebar,
body.pos-has-fragment .main-header,
body.pos-has-fragment .main-sidebar,
body.pos-has-fragment .horizontal-main,
body.pos-has-fragment .sticky.app-header,
body.pos-has-fragment header.sticky,
body:has(#posTopbar) .app-header:not(#posTopbar),
body:has(#posTopbar) header.app-header {
    display: none !important;
}
@media (max-width: 768px) {
    .pos-topbar {
        padding: 0.5rem 0.7rem;
        gap: 0.4rem;
    }
    .pos-topbar-left .pos-icon-btn span,
    .pos-icon-btn {
        font-size: 0.75rem;
    }
    .pos-topbar-left a.pos-icon-btn,
    .pos-topbar-left button.pos-icon-btn:not(.pos-menu-btn) {
        padding: 0.38rem 0.5rem;
    }
    .pos-user-btn {
        max-width: 46vw;
        overflow: hidden;
    }
    .pos-online { display: none; }
    .table-responsive { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .card-header.d-flex, .pos-page .d-flex.justify-content-between {
        flex-wrap: wrap !important;
        gap: 0.5rem;
    }
}
@media (max-width: 576px) {
    .pos-topbar-left a.pos-icon-btn {
        display: none;
    }
}
@media (max-width: 992px) {
    .pos-shell { grid-template-columns: 1fr; }
    .pos-side {
        position: fixed;
        left: 0;
        top: 0;
        width: min(280px, 88vw);
        z-index: 40;
        transform: translateX(-105%);
        transition: transform 0.2s ease;
    }
    .pos-app.nav-open .pos-side { transform: none; }
    .pos-app.nav-open .pos-side-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 35;
    }
    .pos-menu-btn { display: grid; place-items: center; }
    .pos-shell-fragment .pos-topbar { left: 0; }
    body.pos-has-fragment {
        padding-left: 0 !important;
        padding-top: 58px !important;
    }
    body.pos-has-fragment.nav-open .pos-side { transform: none; }
}
