:root {
    --brand: #FFC107;
    --brand-dark: #E6A800;
    --brand-light: #FFF8D6;

    --sidebar-w: 250px;

    --bg: #FFFDF6;
    --text-dark: #3E3A2F;

    --border: #F0E2A0;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg);
    color: var(--text-dark);
    margin: 0;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ===========================
   Sidebar
=========================== */

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #FFC91B, #FFC107);
    color: #2F2F2F;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1030;
    transition: transform .25s ease;
}

.sidebar-brand{
    display:flex;
    align-items:center;
    gap:12px;
    padding:20px 18px;
    border-bottom:1px solid rgba(0,0,0,.08);
}

.brand-logo{
    width:50px;
    height:50px;
    border-radius:12px;
   
    display:flex;
    justify-content:center;
    align-items:center;
    font-size:1.5rem;
    color:#2F2F2F;
}

.brand-text{
    display:flex;
    flex-direction:column;
    line-height:1.1;
}

.brand-text h3{
    margin:0;
    font-size:1.45rem;
    font-weight:800;
    letter-spacing:4px;
    color:#2F2F2F;
}

.brand-text span{
    margin-top:4px;
    font-size:.82rem;
    font-weight:600;
    color:#444;
}

.brand-text small{
    margin-top:2px;
    font-size:.72rem;
    letter-spacing:1px;
    color:#666;
    text-transform:uppercase;
}

.sidebar-nav {
    list-style: none;
    padding: 14px 10px;
    margin: 0;
    flex: 1;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #2F2F2F;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 4px;
    font-size: .95rem;
    font-weight: 500;
    transition: all .2s ease;
}

.sidebar-nav li a i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-nav li a:hover {
    background: rgba(255,255,255,.35);
    color: #000;
}

.sidebar-nav li a.active {
    background: #fff;
    color: var(--brand-dark);
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(0,0,0,.08);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(0,0,0,.08);
    color: rgba(0,0,0,.65);
}

/* ===========================
   Main Content
=========================== */

.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: #FFFDF8;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.page-title {
    font-weight: 600;
    color: var(--text-dark);
}

.content-area {
    padding: 24px;
}

/* ===========================
   Cards
=========================== */

.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    border: 1px solid var(--border);
    height: 100%;
}

.stat-card .icon-wrap {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
    margin-bottom: 12px;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-card .stat-label {
    color: #8A8AA3;
    font-size: .85rem;
}

.bg-brand,
.bg-purple {
    background: var(--brand);
}

.bg-green {
    background: #16A34A;
}

.bg-orange {
    background: #F59E0B;
}

.bg-red {
    background: #EF4444;
}

.bg-blue {
    background: #2563EB;
}

.card-panel {
    background: #fff;
    border-radius: 14px;
    border: 1px solid var(--border);
    padding: 20px;
}

/* ===========================
   Tables
=========================== */

table.table {
    font-size: .92rem;
}

.table thead th {
    background: var(--brand-light);
    color: var(--brand-dark);
    font-weight: 600;
    border-bottom: none;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

/* ===========================
   Badges
=========================== */

.badge-status-paid {
    background: #DCFCE7;
    color: #15803D;
}

.badge-status-partial {
    background: #FEF3C7;
    color: #B45309;
}

.badge-status-unpaid {
    background: #FEE2E2;
    color: #DC2626;
}

/* ===========================
   Buttons
=========================== */

.btn-brand {
    background: var(--brand);
    color: #000;
    border: none;
    font-weight: 600;
}

.btn-brand:hover {
    background: var(--brand-dark);
    color: #000;
}

/* ===========================
   Misc
=========================== */

.item-row input,
.item-row select {
    font-size: .88rem;
}

.search-box {
    max-width: 320px;
}

/* Searchable product combobox (New Sale Invoice item rows).
   The dropdown itself is a single element appended to <body> and positioned
   with `position: fixed` from JS (see positionProductDropdown in sales.js) —
   this lets it escape the table-responsive wrapper's overflow-x:auto, which
   would otherwise clip it vertically too. Only visual styling lives here. */
.product-cell {
    position: relative;
}

.product-dropdown {
    z-index: 3000; /* above the Bootstrap modal (1055) and its backdrop */
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: .375rem;
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15);
    max-height: 220px;
    overflow-y: auto;
}

.product-dropdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    padding: .4rem .6rem;
    font-size: .85rem;
    cursor: pointer;
}

.product-dropdown-item .pdi-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-dropdown-item .pdi-meta {
    flex-shrink: 0;
    color: #6c757d;
    font-size: .78rem;
}

.product-dropdown-item:hover,
.product-dropdown-item.active {
    background: var(--brand, #f0ad4e);
    color: #000;
}

.product-dropdown-item:hover .pdi-meta,
.product-dropdown-item.active .pdi-meta {
    color: #333;
}

.product-dropdown-empty {
    padding: .5rem .6rem;
    font-size: .85rem;
}

.barcode-svg {
    max-height: 34px;
}

.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover {
    color: var(--brand-dark);
}

#bulkBar.d-none {
    display: none !important;
}

@media (max-width: 767px) {
    .search-box {
        max-width: 100%;
    }
}

/* ===========================
   Responsive
=========================== */

@media (max-width: 991px) {

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

}