:root {
    --sidebar-width: 250px;
    --sidebar-width-collapsed: 70px;
    --topbar-height: 56px;
}

body {
    background-color: #f4f6f9;
}

/* ---------- Sidebar ---------- */
#sidebar {
    position: fixed;
    top: var(--topbar-height);
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    background-color: #1e2537;
    color: #c8ccd8;
    overflow-y: auto;
    transition: width 0.2s ease, transform 0.2s ease;
    z-index: 1030;
}

#sidebar .nav-link {
    color: #c8ccd8;
    padding: 0.65rem 1rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#sidebar .nav-link .nav-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

#sidebar .nav-link i {
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

#sidebar .nav-link:hover,
#sidebar .nav-link.active {
    background-color: #2c3550;
    color: #fff;
}

#sidebar .nav-section-title {
    color: #6c7597;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem 0.25rem;
}

body.sidebar-collapsed #sidebar {
    width: var(--sidebar-width-collapsed);
}

body.sidebar-collapsed #sidebar .nav-text,
body.sidebar-collapsed #sidebar .nav-section-title {
    display: none;
}

/* ---------- Topbar ---------- */
#topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background-color: #ffffff;
    border-bottom: 1px solid #e3e6ef;
    z-index: 1040;
    display: flex;
    align-items: center;
    padding: 0 1rem;
}

/* ---------- Main content ---------- */
#main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 1.5rem;
    transition: margin-left 0.2s ease;
    min-height: calc(100vh - var(--topbar-height));
}

body.sidebar-collapsed #main-content {
    margin-left: var(--sidebar-width-collapsed);
}

@media (max-width: 991.98px) {
    #sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }
    body.sidebar-mobile-open #sidebar {
        transform: translateX(0);
    }
    #main-content,
    body.sidebar-collapsed #main-content {
        margin-left: 0;
    }
}

.card {
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.table > :not(caption) > * > * {
    vertical-align: middle;
}

@media print {
    #sidebar,
    #topbar,
    .no-print {
        display: none !important;
    }
    #main-content {
        margin: 0 !important;
    }
}

/* ---------- Searchable select (type-and-search combobox) ---------- */
.ss-wrap {
    position: relative;
}

.ss-menu {
    display: none;
    position: absolute;
    z-index: 1055;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 2px;
    max-height: 240px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ss-option {
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ss-option:hover,
.ss-option.active {
    background-color: #0d6efd;
    color: #fff;
}

.ss-empty {
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    color: #6c757d;
    font-style: italic;
}

/* Numeric inputs (qty/rate) inside line-item tables should read right-aligned */
.table input[type="number"] {
    text-align: right;
}
