:root {
    --kc-dark: #111827;
    --kc-deep: #0f172a;
    --kc-accent: #f59e0b;
    --kc-soft: #f8fafc;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(245, 158, 11, .12), transparent 320px),
        linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    color: #111827;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

.app-navbar {
    background: linear-gradient(135deg, var(--kc-deep), #1f2937);
    --bs-navbar-padding-y: .7rem;
    z-index: 1030;
}

.kc-navbar-simple {
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.kc-navbar-brand {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    margin: 0;
    font-weight: 800;
}

.kc-navbar-brand i {
    flex: 0 0 auto;
    font-size: 1.4rem;
}

.navbar-brand-text {
    max-width: min(34vw, 320px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kc-navbar-actions {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem;
}

.kc-company-form {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .45rem;
}

.kc-company-current {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .5rem;
    color: #fef3c7;
    background: rgba(255, 255, 255, .1);
}

.main-shell {
    min-height: calc(100vh - 56px);
}

.company-switch {
    width: clamp(180px, 24vw, 340px);
    min-width: 0;
    border-color: rgba(255, 255, 255, .25);
    background-color: rgba(255, 255, 255, .96);
}

.kc-user-pill {
    min-width: 0;
    max-width: 270px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: 0 .75rem;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: .5rem;
    background: rgba(255, 255, 255, .08);
}

.kc-user-pill i {
    flex: 0 0 auto;
}

.kc-user-pill span {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kc-logout-link {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fecaca;
    text-decoration: none;
    border-radius: .45rem;
}

.kc-logout-link:hover,
.kc-logout-link:focus {
    color: #fff;
    background: rgba(239, 68, 68, .35);
}

.kc-card {
    border: 0;
    border-radius: 1.2rem;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .08);
}

.kc-metric {
    border-radius: 1.2rem;
    border: 1px solid rgba(15, 23, 42, .06);
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 12px 28px rgba(15, 23, 42, .08);
}

.kc-metric .icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 158, 11, .14);
    color: #92400e;
}

.odoo-launcher {
    padding: 1.35rem;
    border: 1px solid rgba(15, 23, 42, .06);
    border-radius: 1.25rem;
    background: rgba(255, 255, 255, .78);
    box-shadow: 0 14px 35px rgba(15, 23, 42, .07);
    backdrop-filter: blur(10px);
}

.odoo-app-section + .odoo-app-section {
    margin-top: 1.35rem;
    padding-top: 1.2rem;
    border-top: 1px solid rgba(15, 23, 42, .08);
}

.odoo-app-section-title {
    margin-bottom: .85rem;
    color: #334155;
    font-weight: 800;
    font-size: .95rem;
}

.odoo-app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 1.05rem .85rem;
}

.odoo-app-tile {
    min-width: 0;
    min-height: 138px;
    padding: .9rem .6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .7rem;
    color: #1f2937;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 1rem;
    transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.odoo-app-tile:hover,
.odoo-app-tile:focus-visible {
    color: #111827;
    background: #fff;
    border-color: rgba(15, 23, 42, .06);
    box-shadow: 0 12px 28px rgba(15, 23, 42, .1);
    transform: translateY(-4px);
    outline: 0;
}

.odoo-app-icon {
    width: 84px;
    height: 84px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 84px;
    border-radius: 22px;
    color: #fff;
    font-size: 2.35rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 8px 16px rgba(15,23,42,.16);
}

.odoo-app-copy {
    min-width: 0;
    display: grid;
    gap: .15rem;
}

.odoo-app-copy strong,
.odoo-app-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
}

.odoo-app-copy strong { font-size: .92rem; }
.odoo-app-copy small { color: #6b7280; font-size: .76rem; }
.odoo-app-purple { background: linear-gradient(145deg, #875a7b, #6f4566); }
.odoo-app-blue { background: linear-gradient(145deg, #3b82f6, #2563eb); }
.odoo-app-teal { background: linear-gradient(145deg, #14b8a6, #0f766e); }
.odoo-app-orange { background: linear-gradient(145deg, #f59e0b, #d97706); }
.odoo-app-indigo { background: linear-gradient(145deg, #6366f1, #4338ca); }
.odoo-app-red { background: linear-gradient(145deg, #ef4444, #b91c1c); }
.odoo-app-cyan { background: linear-gradient(145deg, #06b6d4, #0e7490); }
.odoo-app-green { background: linear-gradient(145deg, #22c55e, #15803d); }
.odoo-app-navy { background: linear-gradient(145deg, #334155, #0f172a); }
.odoo-app-gold { background: linear-gradient(145deg, #eab308, #a16207); }
.odoo-app-slate { background: linear-gradient(145deg, #64748b, #334155); }
.odoo-app-pink { background: linear-gradient(145deg, #ec4899, #be185d); }

.table thead th {
    background: #f3f4f6;
    color: #374151;
    white-space: nowrap;
}

.badge-soft {
    background: #fef3c7;
    color: #92400e;
}

.pos-screen {
    min-height: calc(100vh - 112px);
    display: grid;
    gap: 1rem;
}

.pos-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1rem;
    color: #fff;
    background: linear-gradient(135deg, #111827, #334155);
    border-radius: .75rem;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .16);
}

.pos-topbar h1,
.pos-section-title h2,
.pos-cart-head h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
}

.pos-muted {
    color: #64748b;
    font-size: .9rem;
}

.pos-topbar .pos-muted {
    color: rgba(255, 255, 255, .72);
}

.pos-touch-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    border-radius: .6rem;
}

.pos-layout {
    min-height: calc(100vh - 245px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
    gap: 1rem;
}

.pos-products-panel,
.pos-cart-panel,
.pos-recent,
.pos-empty-state {
    min-width: 0;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: .8rem;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 14px 34px rgba(15, 23, 42, .08);
}

.pos-products-panel {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    padding: .85rem;
}

.pos-searchbar {
    min-height: 56px;
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 0 1rem;
    border: 1px solid rgba(15, 23, 42, .1);
    border-radius: .7rem;
    background: #f8fafc;
}

.pos-searchbar i {
    color: #64748b;
    font-size: 1.15rem;
}

.pos-searchbar input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 1.05rem;
}

.pos-product-grid {
    min-height: 0;
    margin-top: .85rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    grid-auto-rows: minmax(142px, auto);
    gap: .75rem;
    overflow: auto;
    padding: .1rem .1rem .4rem;
}

.pos-product-tile {
    min-width: 0;
    padding: .85rem;
    display: grid;
    grid-template-rows: 1fr auto auto;
    gap: .45rem;
    text-align: start;
    color: #111827;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: .75rem;
    background: linear-gradient(180deg, #fff, #f8fafc);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .06);
    touch-action: manipulation;
}

.pos-product-tile:hover,
.pos-product-tile:focus {
    border-color: rgba(245, 158, 11, .55);
    box-shadow: 0 12px 24px rgba(15, 23, 42, .12);
    outline: 0;
}

.pos-product-name {
    min-width: 0;
    font-weight: 800;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.pos-product-code {
    color: #64748b;
    font-size: .85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pos-product-meta {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: .5rem;
}

.pos-product-meta strong {
    color: #0f766e;
}

.pos-product-meta small {
    color: #64748b;
    font-size: .75rem;
}

.pos-cart-panel {
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    overflow: hidden;
}

.pos-cart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .9rem;
    border-bottom: 1px solid rgba(15, 23, 42, .08);
}

.pos-cart-head span {
    color: #64748b;
    font-size: .86rem;
}

.pos-customer-row {
    padding: .9rem;
    border-bottom: 1px solid rgba(15, 23, 42, .08);
}

.pos-cart-items {
    min-height: 220px;
    overflow: auto;
    padding: .75rem;
}

.pos-cart-empty {
    min-height: 190px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: .7rem;
    color: #94a3b8;
    text-align: center;
}

.pos-cart-empty i {
    font-size: 2rem;
}

.pos-cart-item {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .75rem;
    padding: .8rem 2.6rem .8rem .8rem;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: .75rem;
    background: #fff;
}

.pos-cart-item + .pos-cart-item {
    margin-top: .65rem;
}

.pos-cart-main {
    min-width: 0;
    display: grid;
    gap: .2rem;
}

.pos-cart-main strong,
.pos-cart-main small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pos-cart-main small {
    color: #64748b;
}

.pos-cart-controls {
    display: inline-grid;
    grid-template-columns: 44px 76px 44px;
    align-items: center;
    gap: .3rem;
}

.pos-qty-btn,
.pos-remove-btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(15, 23, 42, .12);
    border-radius: .6rem;
    background: #f8fafc;
    color: #111827;
}

.pos-qty-input,
.pos-discount-control input {
    min-height: 44px;
    border: 1px solid rgba(15, 23, 42, .12);
    border-radius: .6rem;
    text-align: center;
}

.pos-discount-control {
    display: flex;
    align-items: center;
    gap: .45rem;
    grid-column: 1 / -1;
}

.pos-discount-control label {
    color: #64748b;
    font-size: .82rem;
}

.pos-discount-control input {
    width: 120px;
}

.pos-line-total {
    grid-column: 1 / -1;
    color: #0f766e;
    font-size: 1.05rem;
    font-weight: 800;
}

.pos-remove-btn {
    position: absolute;
    top: .75rem;
    right: .75rem;
    min-width: 36px;
    min-height: 36px;
    color: #dc2626;
}

.pos-checkout {
    display: grid;
    gap: .8rem;
    padding: .9rem;
    border-top: 1px solid rgba(15, 23, 42, .08);
    background: #f8fafc;
}

.pos-pay-row {
    display: grid;
    gap: .35rem;
}

.pos-pay-row label {
    color: #475569;
    font-weight: 700;
}

.pos-total-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .85rem 1rem;
    color: #fff;
    border-radius: .75rem;
    background: #111827;
}

.pos-total-box span {
    color: rgba(255, 255, 255, .7);
}

.pos-total-box strong {
    font-size: clamp(1.35rem, 3vw, 2rem);
}

.pos-pay-button {
    min-height: 64px;
    font-size: 1.2rem;
    font-weight: 800;
    border-radius: .75rem;
}

.pos-recent {
    padding: .9rem;
}

.pos-section-title {
    margin-bottom: .75rem;
}

.pos-recent-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .6rem;
}

.pos-recent-item {
    min-width: 0;
    display: grid;
    gap: .25rem;
    padding: .75rem;
    color: #111827;
    text-decoration: none;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: .65rem;
    background: #fff;
}

.pos-recent-item:hover,
.pos-recent-item:focus {
    border-color: rgba(245, 158, 11, .45);
}

.pos-empty-state {
    min-height: 420px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: .75rem;
    padding: 2rem;
    text-align: center;
}

.pos-empty-state i {
    color: #f59e0b;
    font-size: 3rem;
}

.pos-empty-state h2 {
    margin: 0;
    font-weight: 800;
}

.pos-empty-state p {
    margin: 0;
    color: #64748b;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 430px;
    border: 0;
    border-radius: 1.5rem;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .15);
}

.account-code {
    font-family: Consolas, monospace;
    direction: ltr;
    display: inline-block;
}

.level-1 { padding-right: .25rem; }
.level-2 { padding-right: 1.25rem; }
.level-3 { padding-right: 2.25rem; }
.level-4 { padding-right: 3.25rem; }
.level-5 { padding-right: 4.25rem; }

@media (max-width: 767.98px) {
    .kc-navbar-simple {
        flex-wrap: wrap;
        gap: .65rem;
    }

    .kc-navbar-actions {
        width: 100%;
        justify-content: space-between;
        gap: .6rem;
    }

    .kc-company-form {
        flex: 1 1 auto;
    }

    .company-switch {
        width: 100%;
    }

    .kc-user-pill {
        flex: 0 1 42%;
        justify-content: center;
    }

    .pos-layout {
        grid-template-columns: 1fr;
    }

    .pos-products-panel {
        min-height: 520px;
    }

    .pos-cart-panel {
        min-height: 620px;
    }
}

@media (max-width: 575.98px) {
    .app-navbar {
        --bs-navbar-padding-y: .5rem;
    }

    .navbar-brand-text {
        max-width: calc(100vw - 6.5rem);
        font-size: .95rem;
    }

    .kc-navbar-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .kc-company-form,
    .kc-user-pill {
        width: 100%;
        max-width: none;
    }

    .kc-user-pill {
        justify-content: flex-start;
    }

    .pos-screen {
        gap: .75rem;
    }

    .pos-topbar {
        align-items: stretch;
        flex-direction: column;
        border-radius: .65rem;
    }

    .pos-topbar-actions .btn {
        width: 100%;
    }

    .pos-products-panel,
    .pos-cart-panel,
    .pos-recent,
    .pos-empty-state {
        border-radius: .65rem;
    }

    .pos-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-rows: minmax(132px, auto);
        gap: .55rem;
    }

    .pos-product-tile {
        padding: .7rem;
    }

    .pos-product-meta {
        display: grid;
    }

    .pos-cart-item {
        grid-template-columns: 1fr;
        padding: .75rem 2.5rem .75rem .75rem;
    }

    .pos-cart-controls {
        width: 100%;
        grid-template-columns: 48px minmax(0, 1fr) 48px;
    }

    .pos-discount-control input {
        flex: 1 1 auto;
        width: auto;
    }

    .pos-recent-list {
        grid-template-columns: 1fr;
    }

    .odoo-launcher {
        padding: 1rem .75rem;
    }

    .odoo-app-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: .6rem .35rem;
    }

    .odoo-app-tile {
        padding: .65rem .2rem;
    }

    .odoo-app-icon {
        width: 58px;
        height: 58px;
        flex-basis: 58px;
        border-radius: 15px;
        font-size: 1.55rem;
    }

    .odoo-app-copy small {
        display: none;
    }

    .odoo-app-copy strong {
        font-size: .78rem;
    }
}
