/* ── Base ─────────────────────────────────────────────────────────── */
html, body {
    /* --app-ui-font is set at runtime by appFonts.applyUi() from the SystemFont setting. */
    font-family: var(--app-ui-font, 'Inter', 'El Messiri', sans-serif);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Equal compact footprints for inline quantity (including +/−) and unit cost. */
.line-inline-number {
    width: 10rem;
    min-width: 10rem;
    max-width: 10rem;
}

/* ── Thin modern scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.3);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.5);
}
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 116, 139, 0.3) transparent;
}

/* ── Focus ring ───────────────────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Skip-to-main accessibility ──────────────────────────────────── */
.skip-link {
    position: absolute;
    top: -100%;
    inset-inline-start: 0;
    padding: 0.5rem 1rem;
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    z-index: 9999;
    transition: top 0.1s;
    border-radius: 0 0 6px 0;
}

.skip-link:focus {
    top: 0;
}

/* ── MudBlazor drawer nav refinements ────────────────────────────── */
.mud-nav-item .mud-nav-link {
    border-radius: 8px !important;
    margin: 1px 8px !important;
    font-size: 0.875rem;
}

.mud-nav-item .mud-nav-link:hover {
    background: color-mix(in srgb, var(--mud-palette-text-primary) 8%, transparent) !important;
}

.mud-nav-item .mud-nav-link.active {
    background: color-mix(in srgb, var(--mud-palette-primary) 14%, transparent) !important;
    color: var(--mud-palette-primary) !important;
    font-weight: 600;
}

.mud-nav-group .mud-nav-link {
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.7;
}

/* ── MudDataGrid refinements ──────────────────────────────────────── */
.mud-table-toolbar {
    border-bottom: 1px solid var(--mud-palette-lines-default);
    padding: 10px 16px !important;
}

/* ── Card / Paper ─────────────────────────────────────────────────── */
.mud-paper {
    transition: box-shadow 0.15s ease;
}

/* Shared surface for paged directory cards. Kept global so MudPaper roots
   receive the same theme-aware treatment from every feature component. */
.app-directory-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    border-color: color-mix(in srgb, var(--mud-palette-text-primary) 14%, transparent);
    background-color: color-mix(in srgb, var(--mud-palette-surface) 96%, var(--mud-palette-primary) 4%);
    box-shadow: var(--mud-elevation-1);
    transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.app-directory-card:hover,
.app-directory-card:focus-within {
    border-color: color-mix(in srgb, var(--mud-palette-primary) 42%, var(--mud-palette-text-primary) 12%);
    background-color: color-mix(in srgb, var(--mud-palette-surface) 93%, var(--mud-palette-primary) 7%);
    box-shadow: var(--mud-elevation-2);
}

/* These classes are attached directly to MudPaper roots. They must remain
   global because scoped CSS attributes are not emitted on child components. */
.app-paged-cards {
    overflow: hidden;
}

.app-footer {
    min-height: 44px;
    margin-top: auto;
    border-top: 1px solid var(--mud-palette-lines-default);
}

/* ── MudChip refinements ──────────────────────────────────────────── */
.mud-chip {
    font-weight: 500;
}

/* ── MudButton — remove uppercase (fallback for older versions) ───── */
.mud-button-root {
    letter-spacing: 0 !important;
}

/* ── AppBar branding ──────────────────────────────────────────────── */
.evo-appbar-title {
    font-weight: 700;
    font-size: 1.0625rem;
    letter-spacing: -0.01em;
}

/* ── Auth split layout ────────────────────────────────────────── */
.auth-main-content {
    min-height: 100vh;
    padding-top: 0 !important;
}

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

/* Left branded panel */
.auth-brand-panel {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, var(--mud-palette-primary-darken) 0%, var(--mud-palette-primary) 60%, color-mix(in srgb, var(--mud-palette-primary) 70%, #000) 100%);
}

.auth-brand-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 48px;
    max-width: 480px;
}

/* Decorative circles */
.auth-brand-deco {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
}
.auth-brand-deco-1 {
    width: 480px;
    height: 480px;
    top: -140px;
    right: -120px;
}
.auth-brand-deco-2 {
    width: 300px;
    height: 300px;
    bottom: -80px;
    left: -80px;
    background: rgba(255, 255, 255, 0.04);
}
.auth-brand-deco-3 {
    width: 160px;
    height: 160px;
    bottom: 120px;
    right: 60px;
    background: rgba(255, 255, 255, 0.08);
}

/* Right form panel */
.auth-form-panel {
    width: 480px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    background: var(--mud-palette-background);
    position: relative;
}

.auth-form-card {
    width: 100%;
    max-width: 380px;
}

.auth-mobile-brand {
    display: none;
}

.auth-form-header {
    margin-bottom: 28px;
}

.auth-footer-text {
    position: absolute;
    bottom: 20px;
    opacity: 0.6;
}

@media (max-width: 768px) {
    .auth-brand-panel {
        display: none;
    }
    .auth-form-panel {
        width: 100%;
        padding: 32px 24px;
    }
    .auth-mobile-brand {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 28px;
        color: var(--mud-palette-text-primary);
        font-size: 1.125rem;
        font-weight: 700;
        letter-spacing: -0.02em;
    }
    .auth-mobile-brand img {
        width: 44px;
        height: 44px;
        object-fit: contain;
    }
}

/* ── POS full-screen three-panel layout ───────────────────────── */
.pos-wrapper {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pos-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.pos-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 8px;
    padding: 8px;
}

.pos-panel-left {
    width: 300px;
    min-width: 260px;
    flex-shrink: 0;
    overflow-y: auto;
}

.pos-panel-center {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pos-panel-right {
    width: 340px;
    min-width: 280px;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pos-panel-paper {
    height: 100%;
    overflow-y: auto;
}

.mud-table-row.pos-row-selected td {
    background-color: color-mix(in srgb, var(--mud-palette-primary) 14%, transparent) !important;
}

/* Responsive: stack panels below 992px */
@media (max-width: 992px) {
    .pos-body {
        flex-direction: column;
        overflow-y: auto;
    }

    .pos-panel-left,
    .pos-panel-center,
    .pos-panel-right {
        width: 100%;
        min-width: unset;
        flex-shrink: unset;
        overflow: visible;
    }
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--mud-palette-success);
}

.invalid {
    outline: 1px solid var(--mud-palette-error);
}

.validation-message {
    color: var(--mud-palette-error);
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: var(--mud-palette-secondary);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
/* ── Touch POS layout ─────────────────────────────────────────────── */
.touch-pos-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 8px;
    padding: 8px;
}

.touch-pos-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.touch-pos-right {
    width: 380px;
    min-width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.touch-pos-search-bar {
    flex-shrink: 0;
}

.touch-pos-categories {
    flex-shrink: 0;
    overflow-x: auto;
    white-space: nowrap;
}

.touch-pos-grid {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 10px;
}

/* ── Product card ─────────────────────────────────────────────────── */
.touch-product-card {
    width: 140px;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
    overflow: hidden;
    user-select: none;
    -webkit-touch-callout: none;
}

.touch-product-card:active {
    transform: scale(0.97);
}

.touch-product-image {
    width: 140px;
    height: 100px;
    overflow: hidden;
}

.touch-product-img {
    width: 100% !important;
    height: 100% !important;
    display: block;
    object-fit: cover;
}

.touch-product-no-image {
    width: 140px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--mud-palette-text-primary) 6%, transparent);
}

.touch-product-info {
    padding: 6px 8px;
    width: 100%;
    text-align: center;
}

.touch-product-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 130px;
}

/* ── Open-carts rail (Touch POS parallel carts) ───────────────────── */
/* A vertical column of identity cards — one per parked sale. Each card leads with
   the customer name, then items · parked-time, then the running total, so a cashier
   recognizes a cart in under a second. The active card gains a primary ring + raised
   shadow + tint; everything else stays quiet. Sits between the product grid and the
   cart so it borrows width from the wide product area, not the cart's height. */
.pos-cart-rail {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 166px;
    flex-shrink: 0;
    overflow-y: auto;
    /* A surface paper, matching the cart panel beside it — the rail reads as its own card. The
       cards inside drop to the page-background colour so they stay distinct on the paper.
       Left/right padding is also load-bearing — overflow-y:auto forces overflow-x to compute as
       auto too, so the active card's elevation shadow would be clipped sideways without it. */
    padding: 10px;
    background: var(--mud-palette-surface);
    border-radius: 12px;
    box-shadow: var(--mud-elevation-2);
    scrollbar-width: thin;
}

.pos-cart-rail-head {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 2px 2px;
    min-height: 32px;
}

.pos-cart-rail-title {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
}

.pos-cart-rail-toggle {
    flex-shrink: 0;
}

/* Collapsed rail — a thin strip that frees the width for the product grid. */
.pos-cart-rail.collapsed {
    width: 46px;
    min-width: 46px;
    padding: 10px 4px;
    align-items: center;
}

.pos-cart-rail.collapsed .pos-cart-rail-head {
    justify-content: center;
}

.pos-cart-rail-collapsed {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding-top: 6px;
    cursor: pointer;
    user-select: none;
    color: var(--mud-palette-text-secondary);
}

.pos-cart-rail-count {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--mud-palette-primary);
}

.pos-cart-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 0 0 auto;
    min-height: 60px;
    padding: 6px 10px 8px;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    background: var(--mud-palette-background);
    border: 1px solid var(--mud-palette-lines-default);
    transition: box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.pos-cart-card:hover {
    border-color: color-mix(in srgb, var(--mud-palette-primary) 45%, var(--mud-palette-lines-default));
}

.pos-cart-card.active {
    border: 2px solid var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 9%, var(--mud-palette-surface));
    box-shadow: var(--mud-elevation-4);
    padding: 5px 9px 7px; /* compensate the +1px border so content doesn't shift */
}

.pos-cart-card-eyebrow {
    display: flex;
    align-items: center;
    min-height: 16px;
}

.pos-cart-card-ord {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--mud-palette-text-secondary);
}

.pos-cart-card.active .pos-cart-card-ord {
    color: var(--mud-palette-primary);
}

.pos-cart-card-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-inline-end: -4px;
    border-radius: 6px;
    opacity: 0.45;
    transition: opacity 0.1s, background 0.1s;
}

.pos-cart-card-close:hover {
    opacity: 1;
    background: color-mix(in srgb, var(--mud-palette-error) 16%, transparent);
    color: var(--mud-palette-error);
}

.pos-cart-card-name {
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--mud-palette-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pos-cart-card-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: var(--mud-palette-text-secondary);
}

.pos-cart-card-items {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.pos-cart-card-items .mud-icon-root {
    font-size: 0.9rem;
}

.pos-cart-card-total {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--mud-palette-text-primary);
}

.pos-cart-card.active .pos-cart-card-total {
    color: var(--mud-palette-primary);
}

.pos-cart-card-new {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 0 0 auto;
    min-height: 42px;
    border-radius: 10px;
    cursor: pointer;
    border: 1px dashed var(--mud-palette-lines-default);
    color: var(--mud-palette-text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.pos-cart-card-new:hover {
    background: color-mix(in srgb, var(--mud-palette-primary) 8%, transparent);
    border-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary);
}

@media (prefers-reduced-motion: reduce) {
    .pos-cart-card {
        transition: none;
    }
}

/* On narrow screens the body stacks vertically — fold the rail back into a horizontal
   scrolling strip so it doesn't claim a full column. */
@media (max-width: 768px) {
    .pos-cart-rail {
        flex-direction: row;
        align-items: stretch;
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 8px 6px 12px;
    }

    /* Collapse is a desktop space-saver; on the stacked mobile strip keep full width so the
       layout doesn't jump, but leave the toggle reachable so a collapsed rail can reopen. */
    .pos-cart-rail.collapsed {
        width: 100%;
        min-width: 0;
        padding: 8px 6px 12px;
    }

    .pos-cart-rail-title {
        display: none;
    }

    .pos-cart-rail-head {
        min-height: 0;
        align-self: center;
    }

    .pos-cart-card {
        width: 160px;
    }

    .pos-cart-card-new {
        width: 80px;
        flex-direction: column;
        gap: 2px;
        font-size: 0.7rem;
    }
}

/* ── Cart panel ───────────────────────────────────────────────────── */
.touch-pos-cart-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.touch-cart-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    flex-shrink: 0;
}

.touch-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.touch-cart-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    cursor: pointer;
    transition: background 0.1s;
}

.touch-cart-row:active {
    background: color-mix(in srgb, var(--mud-palette-text-primary) 5%, transparent);
}

.touch-cart-row-selected {
    background: color-mix(in srgb, var(--mud-palette-primary) 14%, transparent);
}

.touch-cart-row-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.touch-cart-row-total {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* ── Numpad ───────────────────────────────────────────────────────── */
.touch-numpad-section {
    border-top: 1px solid var(--mud-palette-lines-default);
    padding: 8px;
    flex-shrink: 0;
}

.touch-numpad-mode-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}

.touch-numpad-mode-bar .mud-button-root {
    flex: 1;
    min-width: 0;
    font-size: 0.75rem;
}

.touch-numpad-display {
    display: flex;
    align-items: center;
    text-align: center;
    padding: 4px 0 6px;
    background: color-mix(in srgb, var(--mud-palette-text-primary) 4%, transparent);
    border-radius: 6px;
    margin-bottom: 6px;
}

.touch-numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

.touch-numpad-btn {
    min-height: 48px;
    font-size: 1.1rem;
    font-weight: 600;
}

.touch-numpad-backspace {
    font-size: 1.3rem;
}

/* Payment dialog numpad (same grid) */
.touch-payment-dialog .touch-numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

.touch-payment-dialog .touch-numpad-btn {
    min-height: 52px;
    font-size: 1.2rem;
    font-weight: 600;
}

/* ── Cart footer ──────────────────────────────────────────────────── */
.touch-cart-footer {
    border-top: 2px solid var(--mud-palette-lines-default);
    padding: 10px;
    flex-shrink: 0;
}

.touch-cart-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

/* ── Payment dialog ───────────────────────────────────────────────── */
.touch-pay-layout {
    min-width: 280px;
}

.touch-pay-total {
    text-align: center;
    padding: 16px 0 8px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    margin-bottom: 12px;
}

.touch-pay-currency {
    font-size: 0.7em;
    opacity: 0.7;
}

.touch-pay-tabs {
    margin-bottom: 8px;
}

.touch-pay-method-panel {
    padding: 12px 0;
}

.touch-pay-amount-display {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    padding: 8px;
    background: color-mix(in srgb, var(--mud-palette-text-primary) 4%, transparent);
    border-radius: 8px;
}

.touch-pay-quick-amounts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.touch-pay-change {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: color-mix(in srgb, var(--mud-palette-success) 12%, transparent);
    border-radius: 8px;
}

/* ── Variant picker overlay ───────────────────────────────────────── */
.touch-variant-picker {
    padding: 24px;
    max-width: 400px;
    width: 90vw;
    max-height: 70vh;
    overflow-y: auto;
}

.touch-context-menu {
    padding: 16px;
    min-width: 240px;
    max-width: 320px;
    width: 80vw;
}

/* App launcher */
.app-launcher-panel {
    background: var(--mud-palette-surface);
    width: 88vw;
    max-width: 960px;
    max-height: 82vh;
    border-radius: 12px;
    overflow-y: auto;
    padding: 24px 28px;
}

.app-launcher-group {
    margin-bottom: 24px;
}

.app-launcher-group-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Quick Nav panel icon badges */
.qnav-icon-badge {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Nav menu gradient icon badges */
.nav-icon-badge {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.app-launcher-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.app-launcher-tile {
    width: 88px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding: 10px 6px;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.12s;
}

.app-launcher-tile:hover {
    background-color: var(--mud-palette-action-default-hover);
}

.app-launcher-tile-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

.app-launcher-tile-label {
    line-height: 1.2;
    word-break: break-word;
    max-width: 80px;
}

/* POS product image gallery */
.pos-gallery-main {
    position: relative;
    width: 100%;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mud-palette-surface);
    border-radius: 8px;
    overflow: hidden;
}

.pos-gallery-main-img {
    width: 100%;
    height: 100%;
}

.pos-gallery-main-badge {
    position: absolute;
    top: 8px;
    inset-inline-start: 8px;
    background: rgba(0,0,0,.45);
    border-radius: 50%;
    padding: 2px;
    display: flex;
}

.pos-gallery-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pos-gallery-thumb {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color .15s;
    flex-shrink: 0;
}

.pos-gallery-thumb.selected {
    border-color: var(--mud-palette-primary);
}

.pos-gallery-thumb-img {
    width: 100%;
    height: 100%;
}

.pos-gallery-thumb-star {
    position: absolute;
    bottom: 2px;
    inset-inline-end: 2px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.6));
}

.touch-variant-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.touch-variant-grid .mud-button-root {
    min-width: 120px;
    min-height: 52px;
    font-size: 1rem;
}

/* Responsive touch POS */
@media (max-width: 768px) {
    .touch-pos-body {
        flex-direction: column;
        overflow-y: auto;
    }

    .touch-pos-right {
        width: 100%;
        min-width: unset;
        flex-shrink: unset;
        max-height: 50vh;
    }

    .touch-product-card {
        width: 110px;
        min-height: 130px;
    }

    .touch-product-image,
    .touch-product-no-image {
        height: 80px;
        width: 110px;
    }
}

/* Touch payment dialog — split payment additions */
.touch-pay-added-list {
    margin: 8px 0;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    overflow: hidden;
}

.touch-pay-added-row {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.touch-pay-added-row:last-child {
    border-bottom: none;
}

.touch-pay-remaining {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: color-mix(in srgb, var(--mud-palette-warning) 12%, transparent);
    border-radius: 6px;
    margin-top: 6px;
}

/* Touch POS subcategory chip row */
.touch-pos-subcategories {
    border-top: 1px dashed var(--mud-palette-lines-default);
    background: color-mix(in srgb, var(--mud-palette-text-primary) 2%, transparent);
}

/* ── POS Receipt ─────────────────────────────────────────────────── */
.pos-receipt-dialog .mud-dialog { max-width: 380px !important; }

.pos-receipt {
    font-family: 'El Messiri', sans-serif;
    font-size: 13px;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    padding: 4px;
    color: #111;
}

.pos-receipt-header {
    text-align: center;
    margin-bottom: 6px;
}

.pos-receipt-store-name {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.pos-receipt-sub {
    font-size: 12px;
    color: #555;
}

.pos-receipt-divider {
    border-top: 1px dashed #888;
    margin: 5px 0;
}

.pos-receipt-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    gap: 8px;
}

.pos-receipt-label {
    color: #666;
}

.pos-receipt-lines-header {
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
}

.pos-receipt-line {
    display: flex;
    padding: 2px 0;
}

.pos-receipt-item-name {
    flex: 1;
    padding-right: 6px;
    word-break: break-word;
}

.pos-receipt-item-qty {
    width: 42px;
    text-align: right;
    padding-right: 6px;
}

.pos-receipt-item-price {
    width: 70px;
    text-align: right;
}

.pos-receipt-total {
    font-weight: 700;
    font-size: 14px;
}

.pos-receipt-change {
    color: #1a7a1a;
    font-weight: 700;
}

.pos-receipt-footer {
    text-align: center;
    margin-top: 8px;
    font-style: italic;
    font-size: 12px;
    color: #555;
}

/* ── Sales Invoice A4 Print ─────────────────────────────────────── */
.sales-invoice-print-dialog .mud-dialog {
    max-width: 960px !important;
}

.a4-invoice {
    background: #fff;
    color: #111;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    padding: 20px;
}

.a4-invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.a4-invoice-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.a4-invoice-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.a4-invoice-company {
    font-size: 1.125rem;
    font-weight: 700;
}

.a4-invoice-subtitle {
    color: #666;
    font-size: 0.9rem;
}

.a4-invoice-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.a4-invoice-divider {
    border-top: 1px solid var(--mud-palette-lines-default);
    margin: 12px 0 16px;
}

.a4-invoice-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 20px;
    margin-bottom: 16px;
}

.a4-invoice-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #666;
}

.a4-invoice-value {
    font-size: 0.95rem;
    font-weight: 600;
}

.a4-invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.a4-invoice-table th,
.a4-invoice-table td {
    border: 1px solid var(--mud-palette-lines-default);
    padding: 8px;
    font-size: 0.86rem;
}

.a4-invoice-table th {
    background: #f5f5f5;
    text-align: left;
}

.a4-invoice-table .align-right {
    text-align: right;
}

.a4-invoice-totals {
    margin-left: auto;
    width: 360px;
    max-width: 100%;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 6px;
    padding: 10px;
}

.a4-invoice-total-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px dashed var(--mud-palette-lines-default);
}

.a4-invoice-total-row:last-child {
    border-bottom: none;
}

.a4-invoice-notes {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid var(--mud-palette-lines-default);
}

@media (max-width: 760px) {
    .a4-invoice-meta-grid {
        grid-template-columns: 1fr;
    }

    .a4-invoice-header {
        flex-direction: column;
    }
}

/* Account movement: keep the opening/activity/closing figures together without
   repeating the base-currency totals in a second card. */
.account-movement-identity {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.account-movement-summary-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.account-movement-summary-stat {
    min-width: 0;
    font-variant-numeric: tabular-nums;
}

.account-movement-summary-stat--closing {
    border-inline-start: 1px solid var(--mud-palette-lines-default);
    padding-inline-start: 1rem;
}

/* Keep optional delivery guidance beside its action, in every workflow stage. */
.delivery-info-heading {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
}

@media (max-width: 900px) {
    .account-movement-summary-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .account-movement-summary-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    .account-movement-summary-stat--closing {
        border-inline-start: 0;
        border-top: 1px solid var(--mud-palette-lines-default);
        padding-inline-start: 0;
        padding-top: .75rem;
        grid-column: 1 / -1;
    }
}
