:root {
    --rc-primary: #1a73e8;
    --rc-secondary: #0d1b2a;
    --rc-success: #28a745;
    --rc-warning: #ffc107;
    --rc-danger: #dc3545;
    --rc-light-bg: #f0f2f5;
    --rc-card-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --rc-sidebar-width: 250px;
    --rc-sidebar-collapsed-width: 60px;
    --rc-sidebar-bg: #0d1b2a;
    --rc-topbar-height: 56px;
}

body {
    background: var(--rc-light-bg);
    margin: 0;
    padding: 0;
}

/* ===========================
   SIDEBAR
   =========================== */
.rc-sidebar {
    width: var(--rc-sidebar-width);
    min-height: 100vh;
    background: var(--rc-sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
}

.rc-sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    font-size: 1.15rem;
    font-weight: 900;
    color: #fff;
    text-decoration: none;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

.rc-sidebar-brand span {
    color: var(--rc-primary);
}

.rc-sidebar-brand:hover {
    color: #fff;
}

/* Sidebar brand row (logo + collapse button) */
.rc-sidebar-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    flex-shrink: 0;
}

.rc-sidebar-brand-row .rc-sidebar-brand {
    border-bottom: none;
}

.rc-sidebar-collapse-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, .4);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1rem;
    transition: color .15s;
}

.rc-sidebar-collapse-btn:hover {
    color: #fff;
}

/* Section icons in sidebar */
.rc-sidebar-nav .nav-section-icon {
    font-size: 1rem;
    width: 1.1rem;
    text-align: center;
}

/* Sidebar storage indicator */
.rc-sidebar-storage {
    border-top: 1px solid rgba(255, 255, 255, .08);
}
.rc-sidebar-storage,
.rc-sidebar-storage .small,
.rc-sidebar-storage div {
    color: rgba(255, 255, 255, .5) !important;
}

/* Sidebar nav scrolling */
.rc-sidebar-nav {
    padding: .75rem .75rem;
    flex: 1;
    overflow-y: auto;
}

.rc-sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.rc-sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.rc-sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .15);
    border-radius: 2px;
}

/* Collapse chevron icon rotation */
.collapse-icon {
    transition: transform 0.2s;
}
.collapsed .collapse-icon {
    transform: rotate(180deg);
}

/* Collapsible section headers */
.rc-sidebar-nav .nav-section {
    font-size: .875rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: rgba(255, 255, 255, .7);
    padding: .45rem .75rem;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.rc-sidebar-nav .nav-section:hover {
    color: #fff;
}

.rc-sidebar-nav .nav-section .nav-section-arrow {
    font-size: .55rem;
    transition: transform .2s;
    margin-left: auto;
}

.rc-sidebar-nav .nav-section.collapsed .nav-section-arrow {
    transform: rotate(-90deg);
}

/* Collapsible nav groups */
.rc-sidebar-nav .nav-group {
    overflow: hidden;
    max-height: 500px;
    transition: max-height .25s ease;
    background: rgba(255, 255, 255, .04);
    border-radius: .4rem;
    margin-bottom: .15rem;
}

.rc-sidebar-nav .nav-group.collapsed {
    max-height: 0 !important;
}

/* Nav links inside sidebar */
.rc-sidebar-nav .nav-link {
    color: rgba(255, 255, 255, .7);
    border-radius: .4rem;
    padding: .45rem .75rem;
    font-size: .875rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: .1rem;
    transition: all .15s;
}

.rc-sidebar-nav .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, .07);
}

.rc-sidebar-nav .nav-link.active {
    color: #fff;
    background: var(--rc-primary);
}

.rc-sidebar-nav .nav-link i {
    font-size: 1rem;
    width: 1.1rem;
    text-align: center;
}

/* ===========================
   SIDEBAR COLLAPSED STATE
   =========================== */
.rc-sidebar.collapsed {
    width: var(--rc-sidebar-collapsed-width);
}

.rc-sidebar.collapsed .rc-sidebar-brand {
    display: none;
}

.rc-sidebar.collapsed .rc-sidebar-collapse-btn {
    padding: 1.25rem .75rem;
    width: 100%;
    text-align: left;
}

.rc-sidebar.collapsed .nav-label,
.rc-sidebar.collapsed .nav-section-arrow {
    display: none;
}

.rc-sidebar.collapsed .rc-sidebar-nav .nav-link {
    justify-content: flex-start;
    padding: .55rem .75rem;
}

.rc-sidebar.collapsed .rc-sidebar-nav .nav-link i {
    font-size: 1.15rem;
    margin: 0;
    width: 1.1rem;
    text-align: center;
}

.rc-sidebar.collapsed .rc-sidebar-nav .nav-section {
    justify-content: flex-start;
    padding: .5rem .75rem .2rem;
}

.rc-sidebar.collapsed .rc-sidebar-nav .nav-section .nav-section-icon {
    font-size: 1rem;
    margin: 0;
    width: 1.1rem;
    text-align: center;
}

/* Hide sub-nav indentation in collapsed */
.rc-sidebar.collapsed .rc-sidebar-nav .nav-link.ps-4 {
    padding-left: .75rem !important;
}

/* Hide nav-groups in collapsed state */
.rc-sidebar.collapsed .nav-group {
    max-height: 0 !important;
    overflow: hidden;
}

/* Nav-section wrapper for flyout positioning */
.rc-sidebar.collapsed .nav-section {
    position: relative;
}

/* Show nav-group on section hover in collapsed */
.rc-sidebar.collapsed .nav-section:hover + .nav-group,
.rc-sidebar.collapsed .nav-group:hover {
    max-height: 500px !important;
    position: absolute;
    left: var(--rc-sidebar-collapsed-width);
    top: 0;
    background: var(--rc-sidebar-bg);
    border-radius: 0 8px 8px 0;
    box-shadow: 4px 4px 12px rgba(0,0,0,.3);
    min-width: 200px;
    padding: .5rem;
    z-index: 1050;
}

.rc-sidebar.collapsed .nav-group .nav-link {
    justify-content: flex-start;
}

.rc-sidebar.collapsed .nav-group .nav-label {
    display: inline;
}

/* Tooltip on hover for single nav-links in collapsed */
.rc-sidebar.collapsed .rc-sidebar-nav > .nav-link {
    position: relative;
}

.rc-sidebar.collapsed .rc-sidebar-nav > .nav-link:hover::after {
    content: attr(title);
    position: absolute;
    left: var(--rc-sidebar-collapsed-width);
    top: 50%;
    transform: translateY(-50%);
    background: var(--rc-sidebar-bg);
    color: #fff;
    padding: .35rem .75rem;
    border-radius: 0 6px 6px 0;
    font-size: .8rem;
    white-space: nowrap;
    box-shadow: 4px 4px 12px rgba(0,0,0,.3);
    z-index: 1050;
}

/* Sidebar storage hidden when collapsed */
.rc-sidebar.collapsed .rc-sidebar-storage {
    display: none;
}

/* Content wrapper shift when sidebar collapsed */
.rc-sidebar.collapsed ~ .rc-content-wrapper {
    margin-left: var(--rc-sidebar-collapsed-width);
}

/* Sidebar transition */
.rc-sidebar {
    transition: width .2s ease;
}

.rc-content-wrapper {
    transition: margin-left .2s ease;
}

/* ===========================
   CONTENT WRAPPER
   =========================== */
.rc-content-wrapper {
    margin-left: var(--rc-sidebar-width);
}

/* ===========================
   TOPBAR
   =========================== */
.rc-topbar {
    height: var(--rc-topbar-height);
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

/* Search Box (in topbar - full width) */
.rc-search-box {
    position: relative;
    flex: 1;
    min-width: 0;
}

.rc-search-box i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: .875rem;
}

.rc-search-box .form-control {
    padding-left: 32px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #1f2937;
    border-radius: 8px;
    font-size: .8rem;
    height: 36px;
}

.rc-search-box .form-control::placeholder {
    color: #9ca3af;
}

.rc-search-box .form-control:focus {
    background: #fff;
    border-color: var(--rc-primary);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}

/* ===========================
   BREADCRUMB BAR
   =========================== */
.rc-breadcrumb-bar {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    padding: 0.5rem 1.5rem;
    position: sticky;
    top: var(--rc-topbar-height);
    z-index: 1019;
}

.rc-breadcrumb-bar .breadcrumb {
    margin: 0;
    font-size: 0.82rem;
    background: none;
    padding: 0;
}

.rc-breadcrumb-bar .breadcrumb-item a {
    color: var(--rc-primary);
    text-decoration: none;
}

.rc-breadcrumb-bar .breadcrumb-item a:hover {
    text-decoration: underline;
}

.rc-breadcrumb-bar .breadcrumb-item.active {
    color: #6c757d;
}

/* ===========================
   MAIN CONTENT
   =========================== */
.rc-main {
    padding: 1.75rem;
    min-height: calc(100vh - var(--rc-topbar-height));
    background: var(--rc-light-bg);
}

/* ===========================
   CARDS
   =========================== */
.rc-card {
    background: #fff;
    border: none;
    border-radius: 12px;
    box-shadow: var(--rc-card-shadow);
    overflow: hidden;
}

.rc-card .card-header {
    background: transparent;
    border-bottom: 1px solid #f0f0f0;
    padding: 1rem 1.25rem;
    font-weight: 600;
}

/* Table padding aligned with card-header */
.card > .card-body.p-0 table th:first-child,
.card > .card-body.p-0 table td:first-child {
    padding-left: 1rem;
}
.card > .card-body.p-0 table th:last-child,
.card > .card-body.p-0 table td:last-child {
    padding-right: 1rem;
}

/* Active toggle switch green */
.form-switch .form-check-input:checked {
    background-color: var(--rc-success);
    border-color: var(--rc-success);
}

/* ===========================
   STAT CARDS
   =========================== */
.rc-stat-card {
    background: #fff;
    border: none;
    border-radius: 12px;
    box-shadow: var(--rc-card-shadow);
    padding: 1.25rem;
    transition: transform 0.15s ease;
}

.rc-stat-card:hover {
    transform: translateY(-2px);
}

.rc-stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.rc-stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.rc-stat-card .stat-label {
    color: #6c757d;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===========================
   STATUS BADGES
   =========================== */
.badge-status-new { background: #6c757d; }
.badge-status-received { background: #0dcaf0; color: #000; }
.badge-status-quotation { background: #ffc107; color: #000; }
.badge-status-approved { background: #28a745; }
.badge-status-in_repair { background: var(--rc-primary); }
.badge-status-invoiced { background: #ffc107; color: #000; }
.badge-status-paid { background: #28a745; }
.badge-status-completed { background: #28a745; }
.badge-status-cancelled { background: #dc3545; }
.badge-status-disposed { background: #212529; }
.badge-status-purchase { background: #6f42c1; }
.badge-status-draft { background: #adb5bd; }
.badge-status-sent { background: #0d6efd; }
.badge-status-rejected { background: #dc3545; }

/* ===========================
   PAGE HEADER
   =========================== */
.rc-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.rc-page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: #1f2937;
}

/* ===========================
   TABLES
   =========================== */
.rc-table {
    font-size: 0.875rem;
}

.rc-table thead th {
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e5e7eb;
    padding: 0.75rem;
}

.rc-table tbody td {
    padding: 0.75rem;
    vertical-align: middle;
}

.rc-table tbody tr:hover {
    background: rgba(26, 115, 232, 0.02);
}

/* ===========================
   LOGIN PAGE (no sidebar)
   =========================== */
.rc-login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.rc-login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2.5rem;
    backdrop-filter: blur(10px);
}

.rc-login-card .form-control {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 0.625rem 0.875rem;
}

.rc-login-card .form-control::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.rc-login-card .form-control:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--rc-primary);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.25);
    color: #fff;
}

.rc-login-card .form-label {
    color: #94a3b8;
    font-size: 0.875rem;
}

/* ===========================
   ONBOARDING
   =========================== */
.rc-onboarding {
    max-width: 700px;
    margin: 0 auto;
}

.rc-step-indicator {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.rc-step-indicator .step {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: #e5e7eb;
    transition: background 0.2s;
}

.rc-step-indicator .step.active {
    background: var(--rc-primary);
}

.rc-step-indicator .step.done {
    background: var(--rc-success);
}


/* ===========================
   SEARCH RESULTS DROPDOWN
   =========================== */
.rc-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    margin-top: 4px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1050;
    display: none;
}

.rc-search-results.show {
    display: block;
}

.rc-search-group {
    border-bottom: 1px solid #f0f0f0;
}

.rc-search-group:last-child {
    border-bottom: none;
}

.rc-search-group-header {
    padding: 0.5rem 0.875rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    background: #f9fafb;
}

.rc-search-result-item a {
    display: block;
    padding: 0.5rem 0.875rem;
    text-decoration: none;
    color: #1f2937;
    transition: background 0.1s;
}

.rc-search-result-item a:hover,
.rc-search-result-item.active a {
    background: rgba(26, 115, 232, 0.06);
    color: var(--rc-primary);
}

.rc-search-result-title {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
}

.rc-search-result-subtitle {
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.3;
}

.rc-search-empty {
    padding: 1.25rem;
    text-align: center;
    color: #9ca3af;
    font-size: 0.85rem;
}

/* ===========================
   ACTIVITY TIMELINE
   =========================== */
.rc-activity-timeline {
    padding: 0;
}

.rc-activity-item {
    display: flex;
    gap: 0.875rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.1s;
}

.rc-activity-item:last-child {
    border-bottom: none;
}

.rc-activity-item:hover {
    background: rgba(26, 115, 232, 0.02);
}

.rc-activity-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.rc-activity-content {
    flex: 1;
    min-width: 0;
}

.rc-activity-content strong {
    font-size: 0.85rem;
}

.rc-activity-content small {
    font-size: 0.75rem;
}

/* ===========================
   EMPTY STATE
   =========================== */
.rc-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #9ca3af;
}

.rc-empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* ===========================
   RESPONSIVE (mobile)
   =========================== */
@media (max-width: 991.98px) {
    .rc-sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
        width: var(--rc-sidebar-width) !important;
    }

    .rc-sidebar.open {
        transform: translateX(0);
    }

    .rc-sidebar .nav-label { display: inline !important; }
    .rc-sidebar .nav-section-arrow { display: inline !important; }
    .rc-sidebar-collapse-btn { display: none; }

    .rc-content-wrapper {
        margin-left: 0 !important;
    }
}
