/* =========================================================
   Royo Dispatch — Modern Sidebar & Topbar
   Replaces UBold layout styles for left-sidebar + topbar
   ========================================================= */

/* =========================================================
   UBOLD OVERRIDES — fix conflicts with existing UBold CSS
   ========================================================= */

/* UBold sets overflow:hidden on .content-page — this breaks
   horizontal table scroll. Override to visible/auto.         */
.content-page {
    overflow: visible !important;
}

/* UBold topbar was 70px; our topbar is 60px.
   Override margin-top so content starts at the right place.
   Flex column ensures the footer is always pinned to the bottom
   regardless of how much content the page has. */
.content-page,
.content-page.main_outter_box {
    /* margin-top: 60px !important; */
    margin-left: 240px !important;
    width: calc(100% - 240px) !important;
    min-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
}
/* Content area grows to fill available space, pushing footer down */
.content-page > .content,
.content-page.main_outter_box > .content {
    flex: 1 0 auto;
}
footer.footer {
    flex-shrink: 0;
}

/* UBold navbar-custom (old topbar) — hide it, we use rd-topbar */
.navbar-custom {
    display: none !important;
}

/* UBold left-side-menu — hide it, we use rd-sidebar */
.left-side-menu {
    display: none !important;
}

/* Fix horizontal scroll for tables inside content */
.content .table-responsive,
.content .dataTables_wrapper,
.content .dataTables_scroll {
    overflow-x: auto !important;
    width: 100% !important;
}
.content table {
    max-width: none !important;
}

/* Fix Bootstrap 4 pagination styling.
   Target ul.pagination only — NOT div.pagination (agent page wrapper div) */
ul.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 16px 0;
    padding: 0;
    list-style: none;
}
ul.pagination .page-item .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 6px !important;
    border: 1px solid #e5e7eb;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    background: #ffffff;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
ul.pagination .page-item .page-link:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #111827;
}
ul.pagination .page-item.active .page-link {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}
ul.pagination .page-item.disabled .page-link {
    color: #9ca3af;
    background: #f9fafb;
    border-color: #e5e7eb;
    cursor: not-allowed;
}

/* Remove UBold padding on .content — was adding gray strips top+left on dashboard.
   Each page controls its own padding via its container/card classes. */
.content {
    padding: 0 !important;
}

/* Twilio error alert row — ensure it takes no space when hidden */
.displaySettingsError[style*="display:none"],
.displaySettingsError[style*="display: none"] {
    margin: 0 !important;
    padding: 0 !important;
}

/* =========================================================
   DARK MODE — UBold card-box & legacy element overrides
   card-box is UBold's equivalent of .card — not covered by
   the Bootstrap .card rules above.
   ========================================================= */
body.dark .card-box {
    background: #1e2433 !important;
    border-color: #2d3547 !important;
    box-shadow: none !important;
}
body.dark .card-box .header-title,
body.dark .card-box h4,
body.dark .card-box h5,
body.dark .card-box h6 {
    color: #f1f5f9 !important;
}
body.dark .card-box .sub-header,
body.dark .card-box p,
body.dark .card-box label,
body.dark .card-box .primaryCurText,
body.dark .card-box .control-label {
    color: #d1d5db !important;
}
body.dark .card-box .font-weight-normal {
    color: #e2e8f0 !important;
}
body.dark .card-box .form-control,
body.dark .card-box textarea.form-control {
    background: #252d3d !important;
    border-color: #3d4a5e !important;
    color: #e2e8f0 !important;
}
body.dark .card-box .form-control::placeholder,
body.dark .card-box textarea::placeholder {
    color: #6b7280 !important;
}
body.dark .card-box #tags {
    color: #94a3b8 !important;
}
/* UBold thead-light inside card-box */
body.dark .card-box .thead-light th {
    background: #252d3d !important;
    color: #94a3b8 !important;
    border-color: #2d3547 !important;
}
body.dark .card-box .table td,
body.dark .card-box .table th {
    color: #e2e8f0 !important;
    border-color: #2d3547 !important;
}
body.dark .card-box .table tr:hover,
body.dark .card-box .table tr:hover td,
body.dark .card-box .table tr:hover th {
    background: #2a3447 !important;
}
/* UBold page title box */
body.dark .page-title-box .page-title,
body.dark .page-title-box h4 {
    color: #f1f5f9 !important;
}

/* Fix footer — UBold sets position:absolute which places it over table content.
   Make it flow naturally at the bottom of the page. */
footer.footer {
    position: relative !important;
    left: auto !important;
    bottom: auto !important;
    right: auto !important;
    padding: 14px 24px;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
    text-align: center;
    color: #6b7280;
    font-size: 13px;
}

/* Fix dashboard map height — was calc(100vh - 70px) for old topbar */
#map_canvas {
    height: calc(100vh - 60px) !important;
}

/* Fix dashboard left panel height */
.coolcheck .left-sidebar {
    height: calc(100vh - 60px) !important;
    overflow-y: auto;
}

/* ── Reset wrapper ── */
#wrapper {
    display: flex;
    min-height: 100vh;
    background: #f3f4f6;
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.rd-sidebar {
    width: 240px;
    min-height: 100vh;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: width 0.2s ease, transform 0.2s ease;
    overflow: hidden;
}

/* Logo area */
.rd-sidebar .rd-logo {
    display: flex;
    align-items: center;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #f3f4f6;
    min-height: 60px;
    flex-shrink: 0;
}
.rd-sidebar .rd-logo img {
    max-height: 36px;
    max-width: 160px;
    object-fit: contain;
}
.rd-sidebar .rd-logo-text {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.3px;
}

/* Scrollable nav area */
.rd-sidebar .rd-nav-wrap {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0 20px;
}
.rd-sidebar .rd-nav-wrap::-webkit-scrollbar {
    width: 4px;
}
.rd-sidebar .rd-nav-wrap::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 4px;
}

/* Section labels  e.g. ORDERS / SETTINGS */
.rd-sidebar .rd-section-label {
    padding: 14px 20px 4px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9ca3af;
    white-space: nowrap;
}

/* Nav list */
.rd-sidebar ul.rd-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}
.rd-sidebar ul.rd-menu li {
    margin: 1px 8px;
}

/* Nav item link */
.rd-sidebar ul.rd-menu li > a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 7px;
    color: #374151;
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.rd-sidebar ul.rd-menu li > a i {
    font-size: 16px;
    flex-shrink: 0;
    color: #6b7280;
    width: 18px;
    text-align: center;
    transition: color 0.15s;
}
.rd-sidebar ul.rd-menu li > a:hover {
    background: #eff6ff;
    color: #2563eb;
}
.rd-sidebar ul.rd-menu li > a:hover i {
    color: #2563eb;
}

/* Active state */
.rd-sidebar ul.rd-menu li > a.active,
.rd-sidebar ul.rd-menu li.active > a {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}
.rd-sidebar ul.rd-menu li > a.active i,
.rd-sidebar ul.rd-menu li.active > a i {
    color: #2563eb;
}

/* Sub-menu (collapsed) */
.rd-sidebar ul.rd-menu ul.rd-submenu {
    list-style: none;
    margin: 2px 0 2px 28px;
    padding: 0;
    border-left: 2px solid #e5e7eb;
}
.rd-sidebar ul.rd-menu ul.rd-submenu li {
    margin: 0;
}
.rd-sidebar ul.rd-menu ul.rd-submenu li > a {
    padding: 6px 12px;
    font-size: 13px;
    color: #4b5563;
    border-radius: 0 6px 6px 0;
}
.rd-sidebar ul.rd-menu ul.rd-submenu li > a:hover,
.rd-sidebar ul.rd-menu ul.rd-submenu li > a.active {
    background: #eff6ff;
    color: #2563eb;
}

/* Expand arrow */
.rd-sidebar ul.rd-menu li > a .rd-arrow {
    margin-left: auto;
    font-size: 12px;
    color: #9ca3af;
    transition: transform 0.2s;
}
.rd-sidebar ul.rd-menu li.open > a .rd-arrow {
    transform: rotate(90deg);
}

/* =========================================================
   TOPBAR
   ========================================================= */
.rd-topbar {
    position: fixed;
    top: 0;
    left: 240px;
    right: 0;
    height: 60px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 999;
    transition: left 0.2s ease;
}

/* Left: hamburger + page title */
.rd-topbar .rd-topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.rd-topbar .rd-hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: #6b7280;
    display: flex;
    align-items: center;
    transition: background 0.15s;
}
.rd-topbar .rd-hamburger:hover {
    background: #f3f4f6;
    color: #111827;
}
.rd-topbar .rd-hamburger i {
    font-size: 18px;
}
.rd-topbar .rd-page-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

/* Right: action buttons */
.rd-topbar .rd-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Generic topbar button */
.rd-topbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 7px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}
.rd-topbar-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #111827;
    text-decoration: none;
}
.rd-topbar-btn i {
    font-size: 14px;
    color: #6b7280;
}

/* Primary (Add Route) button */
.rd-topbar-btn.rd-btn-primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}
.rd-topbar-btn.rd-btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}
.rd-topbar-btn.rd-btn-primary i {
    color: #ffffff;
}

/* Dropdown arrow */
.rd-topbar-btn .rd-caret {
    font-size: 11px;
    color: #9ca3af;
    margin-left: 2px;
}

/* User button */
.rd-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 6px;
    border-radius: 7px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}
.rd-user-btn:hover {
    background: #f9fafb;
    text-decoration: none;
    color: #111827;
}
.rd-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

/* Loading spinner in topbar */
.rd-topbar .rd-spinner {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px;          /* prevent flex from squishing */
    flex-shrink: 0;
    box-sizing: border-box;
    border: 2px solid #e2e8f0 !important;
    border-top-color: #2563eb !important;
    border-radius: 50%;
    animation: rd-spin 0.75s linear infinite;
    display: none;
    align-self: center;
}
.rd-topbar .rd-spinner.active,
.rd-topbar .rd-spinner[style*="display: block"],
.rd-topbar .rd-spinner[style*="display:block"] {
    display: inline-block !important;
}
@keyframes rd-spin {
    to { transform: rotate(360deg); }
}

/* =========================================================
   CONTENT AREA  — offset handled in UBOLD OVERRIDES above
   ========================================================= */
.rd-content-wrap {
    transition: margin-left 0.2s ease, width 0.2s ease;
}

/* =========================================================
   COLLAPSED SIDEBAR  (toggle class on body)
   ========================================================= */
body.rd-sidebar-collapsed .rd-sidebar {
    width: 60px;
}
body.rd-sidebar-collapsed .rd-sidebar .rd-logo-text,
body.rd-sidebar-collapsed .rd-sidebar .rd-section-label,
body.rd-sidebar-collapsed .rd-sidebar ul.rd-menu li > a span,
body.rd-sidebar-collapsed .rd-sidebar ul.rd-menu li > a .rd-arrow,
body.rd-sidebar-collapsed .rd-sidebar ul.rd-menu ul.rd-submenu {
    display: none;
}
body.rd-sidebar-collapsed .rd-sidebar ul.rd-menu li {
    margin: 1px 6px;
}
body.rd-sidebar-collapsed .rd-sidebar ul.rd-menu li > a {
    justify-content: center;
    padding: 10px;
}
body.rd-sidebar-collapsed .rd-topbar {
    left: 60px;
}
body.rd-sidebar-collapsed .content-page,
body.rd-sidebar-collapsed .content-page.main_outter_box {
    margin-left: 60px !important;
    width: calc(100% - 60px) !important;
}

/* =========================================================
   DARK MODE
   ========================================================= */
body.dark .rd-sidebar {
    background: #1e2433;
    border-right-color: #2d3547;
}
body.dark .rd-sidebar .rd-logo-text { color: #f9fafb; }
body.dark .rd-sidebar .rd-section-label { color: #6b7280; }
body.dark .rd-sidebar ul.rd-menu li > a { color: #d1d5db; }
body.dark .rd-sidebar ul.rd-menu li > a i { color: #9ca3af; }
body.dark .rd-sidebar ul.rd-menu li > a:hover,
body.dark .rd-sidebar ul.rd-menu li > a.active,
body.dark .rd-sidebar ul.rd-menu li.active > a {
    background: rgba(37,99,235,0.18);
    color: #60a5fa;
}
body.dark .rd-sidebar ul.rd-menu li > a:hover i,
body.dark .rd-sidebar ul.rd-menu li > a.active i,
body.dark .rd-sidebar ul.rd-menu li.active > a i {
    color: #60a5fa;
}
body.dark .rd-topbar {
    background: #1e2433;
    border-bottom-color: #2d3547;
}
body.dark .rd-topbar .rd-page-title { color: #f9fafb; }
body.dark .rd-topbar-btn {
    background: #2d3547;
    border-color: #3d4a5e;
    color: #d1d5db;
}
body.dark .rd-topbar-btn:hover {
    background: #374151;
    color: #f9fafb;
}
body.dark .rd-user-btn {
    background: #2d3547;
    border-color: #3d4a5e;
    color: #d1d5db;
}

/* =========================================================
   DARK MODE — Global content area fixes
   Forces light text on dark backgrounds across all pages
   ========================================================= */

/* Page background */
body.dark #wrapper,
body.dark .content-page {
    background: #111827 !important;
}

/* Cards */
body.dark .card {
    background: #1e2433 !important;
    border-color: #2d3547 !important;
    color: #e2e8f0 !important;
}
body.dark .card-header,
body.dark .card-footer {
    background: #252d3d !important;
    border-color: #2d3547 !important;
    color: #e2e8f0 !important;
}

/* General text inside content */
body.dark .content-page h1,
body.dark .content-page h2,
body.dark .content-page h3,
body.dark .content-page h4,
body.dark .content-page h5,
body.dark .content-page h6 {
    color: #f1f5f9 !important;
}
body.dark .content-page p,
body.dark .content-page label,
body.dark .content-page span:not(.badge):not(.btn):not([class*="label-"]) {
    color: #d1d5db !important;
}
body.dark .content-page .text-muted,
body.dark .content-page small {
    color: #94a3b8 !important;
}
body.dark .content-page .text-dark,
body.dark .content-page .text-body {
    color: #e2e8f0 !important;
}

/* Tables */
body.dark .table,
body.dark .table th,
body.dark .table td {
    color: #e2e8f0 !important;
    border-color: #2d3547 !important;
}
body.dark .table thead th {
    background: #252d3d !important;
    color: #94a3b8 !important;
}
body.dark .table tbody tr {
    background: #1e2433 !important;
    transition: none !important;
}
body.dark .table tbody td,
body.dark .table tbody th {
    background: #1e2433 !important;
    transition: background .12s;
}
body.dark .table-striped tbody tr:nth-of-type(odd) {
    background: #222b3a !important;
}
body.dark .table tbody tr:hover,
body.dark .table tbody tr:hover td,
body.dark .table tbody tr:hover th {
    background: #2a3447 !important;
}
body.dark .thead-light th {
    background: #252d3d !important;
    color: #94a3b8 !important;
    border-color: #2d3547 !important;
}

/* Forms */
body.dark .form-control,
body.dark .form-control:focus {
    background: #252d3d !important;
    border-color: #3d4a5e !important;
    color: #e2e8f0 !important;
}
body.dark .form-control::placeholder {
    color: #6b7280 !important;
}
body.dark select.form-control option {
    background: #1e2433;
    color: #e2e8f0;
}
body.dark .input-group-text {
    background: #2d3547 !important;
    border-color: #3d4a5e !important;
    color: #94a3b8 !important;
}

/* Modals */
body.dark .modal-content {
    background: #1e2433 !important;
    border-color: #2d3547 !important;
    color: #e2e8f0 !important;
}
body.dark .modal-header {
    background: #252d3d !important;
    border-bottom-color: #2d3547 !important;
}
body.dark .modal-header .modal-title,
body.dark .modal-header h4,
body.dark .modal-header h5 {
    color: #f1f5f9 !important;
}
body.dark .modal-footer {
    border-top-color: #2d3547 !important;
    background: #1e2433 !important;
}
body.dark .modal-body label {
    color: #d1d5db !important;
}
body.dark .close {
    color: #94a3b8 !important;
}

/* Tabs */
body.dark .nav-tabs {
    border-color: #2d3547 !important;
}
body.dark .nav-tabs .nav-link {
    color: #94a3b8 !important;
}
body.dark .nav-tabs .nav-link.active {
    background: #1e2433 !important;
    border-color: #2d3547 #2d3547 #1e2433 !important;
    color: #f1f5f9 !important;
}
body.dark .tab-content {
    color: #e2e8f0 !important;
}

/* Dropdowns */
body.dark .dropdown-menu {
    background: #252d3d !important;
    border-color: #3d4a5e !important;
}
body.dark .dropdown-item {
    color: #d1d5db !important;
}
body.dark .dropdown-item:hover {
    background: rgba(255,255,255,0.07) !important;
    color: #f1f5f9 !important;
}
body.dark .dropdown-divider {
    border-color: #3d4a5e !important;
}

/* Pagination */
body.dark ul.pagination .page-item .page-link {
    background: #252d3d !important;
    border-color: #3d4a5e !important;
    color: #d1d5db !important;
}
body.dark ul.pagination .page-item .page-link:hover {
    background: #2d3547 !important;
    color: #f1f5f9 !important;
}
body.dark ul.pagination .page-item.disabled .page-link {
    background: #1e2433 !important;
    color: #6b7280 !important;
}

/* Footer */
body.dark footer.footer {
    background: #1e2433 !important;
    border-top-color: #2d3547 !important;
    color: #6b7280 !important;
}

/* =========================================================
   STAT CARDS  (.rd-stat-card)
   ========================================================= */
.rd-stat-card {
    background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
    padding: 16px 20px; display: flex; align-items: center; gap: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.rd-stat-icon {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--accent, #2563eb) 12%, transparent);
    color: var(--accent, #2563eb); font-size: 20px; flex-shrink: 0;
}
.rd-stat-body { min-width: 0; }
.rd-stat-value { font-size: 22px; font-weight: 700; color: #111827; line-height: 1.2; }
.rd-stat-label { font-size: 12px; color: #6b7280; margin-top: 2px; white-space: nowrap; }

body.dark .rd-stat-card { background: #1e2433 !important; border-color: #2d3547; box-shadow: none; }
body.dark .rd-stat-value { color: #f1f5f9; }
body.dark .rd-stat-label { color: #94a3b8; }

/* =========================================================
   TAB BAR  (.rd-tab-bar / .rd-tab / .rd-tab-count)
   ========================================================= */
.rd-tab-bar {
    display: flex; gap: 4px; padding: 14px 0 0;
    border-bottom: 2px solid #e5e7eb; margin-bottom: 0;
}
.rd-tab-bar a,
.rd-tab-bar a.rd-tab:not(.active) {
    display: inline-flex !important; align-items: center !important; gap: 7px !important;
    padding: 8px 16px !important; border-radius: 7px 7px 0 0 !important;
    font-size: 13px !important; font-weight: 500 !important;
    color: #6b7280 !important; text-decoration: none !important;
    background: transparent !important; border: 1px solid transparent !important;
    border-bottom: none !important; margin-bottom: -2px !important;
    box-shadow: none !important; outline: none !important; cursor: pointer;
}
.rd-tab-bar a.rd-tab:not(.active):hover {
    color: #374151 !important; background: #f3f4f6 !important;
}
.rd-tab-bar a.rd-tab.active {
    display: inline-flex !important; align-items: center !important; gap: 7px !important;
    padding: 8px 16px !important; border-radius: 7px 7px 0 0 !important;
    font-size: 13px !important; font-weight: 600 !important;
    color: #2563eb !important; background: #fff !important;
    border: 1px solid #e5e7eb !important; border-bottom-color: #fff !important;
    margin-bottom: -2px !important; box-shadow: none !important; text-decoration: none !important;
}
.rd-tab-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
    background: #eff6ff; color: #2563eb; font-size: 11px; font-weight: 700;
}
.rd-tab-count--orange { background: #fff7ed; color: #ea580c; }
.rd-tab-count--green  { background: #f0fdf4; color: #16a34a; }
.rd-tab-count--red    { background: #fef2f2; color: #dc2626; }

body.dark .rd-tab-bar { border-bottom-color: #2d3547; }
body.dark .rd-tab-bar a.rd-tab:not(.active) { color: #94a3b8 !important; }
body.dark .rd-tab-bar a.rd-tab:not(.active):hover { color: #e2e8f0 !important; background: rgba(255,255,255,0.07) !important; }
body.dark .rd-tab-bar a.rd-tab.active { color: #60a5fa !important; background: #1e2433 !important; border-color: #2d3547 !important; border-bottom-color: #1e2433 !important; }
body.dark .rd-tab-count { background: rgba(37,99,235,0.25); color: #93c5fd; }
body.dark .rd-tab-count--orange { background: rgba(234,88,12,0.25); color: #fb923c; }
body.dark .rd-tab-count--green  { background: rgba(22,163,74,0.25);  color: #4ade80; }
body.dark .rd-tab-count--red    { background: rgba(220,38,38,0.25);  color: #f87171; }

/* =========================================================
   FILTER BAR  (.rd-filter-bar / .rd-filter-select / .rd-filter-input)
   ========================================================= */
.rd-filter-bar {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px; padding: 12px 0 8px;
}
.rd-filter-left  { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rd-filter-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rd-filter-select {
    display: flex; align-items: center; gap: 6px;
    background: #fff; border: 1px solid #d1d5db; border-radius: 6px;
    padding: 0 10px; height: 36px;
}
.rd-filter-select i { color: #9ca3af; font-size: 14px; }
.rd-filter-select select { border: none; outline: none; background: transparent; font-size: 13px; color: #374151; }
.rd-filter-search,
.rd-filter-input {
    display: flex; align-items: center; gap: 6px;
    background: #fff; border: 1px solid #d1d5db; border-radius: 6px;
    padding: 0 10px; height: 36px; min-width: 190px;
}
.rd-filter-search i,
.rd-filter-input i { color: #9ca3af; font-size: 14px; flex-shrink: 0; }
.rd-filter-search input,
.rd-filter-input input { border: none; outline: none; background: transparent; font-size: 13px; color: #374151; width: 100%; }
.rd-filter-search input::placeholder,
.rd-filter-input input::placeholder { color: #9ca3af; }

body.dark .rd-filter-select { background: #252d3d; border-color: #3d4a5e; }
body.dark .rd-filter-select select { color: #e2e8f0; }
body.dark .rd-filter-select select option { background: #1e2433; }
body.dark .rd-filter-search,
body.dark .rd-filter-input { background: #252d3d; border-color: #3d4a5e; }
body.dark .rd-filter-search input,
body.dark .rd-filter-input input { color: #e2e8f0; }
body.dark .rd-filter-search input::placeholder,
body.dark .rd-filter-input input::placeholder { color: #6b7280; }

/* =========================================================
   ACTION BUTTONS  (.rd-action-btn)
   ========================================================= */
.rd-action-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 0 14px; height: 36px; border-radius: 6px;
    font-size: 13px; font-weight: 500; cursor: pointer;
    border: none; text-decoration: none; white-space: nowrap; transition: opacity .15s;
}
.rd-action-btn:hover { opacity: .88; text-decoration: none; }
.rd-btn-primary   { background: #2563eb; color: #fff !important; }
.rd-btn-secondary { background: #fff; color: #374151 !important; border: 1px solid #d1d5db !important; }
.rd-btn-warning   { background: #f59e0b; color: #fff !important; }
.rd-btn-outline   { background: #fff; color: #374151 !important; border: 1px solid #e5e7eb !important; }
.rd-btn-danger    { background: #dc2626; color: #fff !important; }

body.dark .rd-btn-secondary,
body.dark .rd-btn-outline { background: #2d3547 !important; color: #d1d5db !important; border-color: #3d4a5e !important; }

/* =========================================================
   MODAL CHROME  (.rd-modal-*)
   ========================================================= */
.rd-modal-header {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px 14px; border-bottom: 1px solid #f3f4f6;
    background: #fff; border-radius: 12px 12px 0 0; flex-shrink: 0;
}
.rd-modal-title-wrap { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.rd-modal-icon {
    width: 36px; height: 36px; border-radius: 10px;
    background: color-mix(in srgb, var(--mcolor, #2563eb) 12%, transparent);
    display: flex; align-items: center; justify-content: center;
    color: var(--mcolor, #2563eb); font-size: 16px; flex-shrink: 0;
}
.rd-modal-title { font-size: 15px; font-weight: 600; color: #111827; margin: 0; line-height: 1.3; }
.rd-modal-sub   { font-size: 12px; color: #6b7280; margin: 2px 0 0; }
.rd-modal-close {
    margin-left: auto; width: 28px; height: 28px; border-radius: 7px;
    background: transparent; border: none; display: flex; align-items: center;
    justify-content: center; color: #9ca3af; font-size: 18px; cursor: pointer; padding: 0; flex-shrink: 0;
}
.rd-modal-close:hover { background: #f3f4f6; color: #374151; }
.rd-modal-body { padding: 20px; overflow-y: auto; }
.rd-modal-footer {
    display: flex; align-items: center; justify-content: flex-end; gap: 8px;
    padding: 12px 20px; border-top: 1px solid #f3f4f6; background: #fff;
    border-radius: 0 0 12px 12px;
}
.rd-modal-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px; border-radius: 8px; font-size: 13px; font-weight: 600;
    cursor: pointer; border: none; transition: opacity .15s; text-decoration: none;
}
.rd-modal-btn:hover { opacity: .88; text-decoration: none; }
.rd-modal-btn-primary, .rd-modal-submit {
    background: #2563eb; color: #fff !important;
}
.rd-modal-btn-cancel, .rd-modal-cancel {
    background: #fff; color: #374151 !important; border: 1px solid #e5e7eb !important; font-weight: 500;
}
.rd-modal-btn-cancel:hover, .rd-modal-cancel:hover { background: #f9fafb; }

body.dark .rd-modal-header { background: #252d3d; border-bottom-color: #2d3547; }
body.dark .rd-modal-title { color: #f1f5f9; }
body.dark .rd-modal-sub { color: #64748b; }
body.dark .rd-modal-close:hover { background: #2d3547; color: #f1f5f9; }
body.dark .rd-modal-body { background: #1e2433; }
body.dark .rd-modal-footer { background: #252d3d; border-top-color: #2d3547; }
body.dark .rd-modal-btn-cancel, body.dark .rd-modal-cancel { background: #2d3547 !important; color: #d1d5db !important; border-color: #3d4a5e !important; }

/* =========================================================
   SECTION HEADER  (.rd-section-header / .rd-section-icon)
   ========================================================= */
.rd-section-header {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 20px 12px; border-bottom: 1px solid #f3f4f6; margin-bottom: 20px;
}
.rd-section-icon {
    width: 34px; height: 34px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.rd-section-icon.blue  { background: #eff6ff; }
.rd-section-icon.green { background: #f0fdf4; }
.rd-section-icon.purple { background: #f5f3ff; }
.rd-section-icon.amber  { background: #fffbeb; }
.rd-section-icon.blue   i { color: #2563eb; font-size: 16px; }
.rd-section-icon.green  i { color: #16a34a; font-size: 16px; }
.rd-section-icon.purple i { color: #7c3aed; font-size: 16px; }
.rd-section-icon.amber  i { color: #d97706; font-size: 16px; }
.rd-section-title { font-size: 14px; font-weight: 700; color: #111827; margin: 0; }
.rd-section-sub   { font-size: 12px; color: #6b7280; margin: 1px 0 0 0; }

body.dark .rd-section-header { border-bottom-color: #2d3547; }
body.dark .rd-section-icon.blue   { background: rgba(37,99,235,.15); }
body.dark .rd-section-icon.green  { background: rgba(22,163,74,.15); }
body.dark .rd-section-icon.purple { background: rgba(124,58,237,.15); }
body.dark .rd-section-icon.amber  { background: rgba(217,119,6,.15); }
body.dark .rd-section-title { color: #f1f5f9; }
body.dark .rd-section-sub   { color: #64748b; }

/* =========================================================
   FORM COMPONENTS  (.rd-label / .rd-input / .rd-submit-btn)
   ========================================================= */
.rd-label {
    font-size: 12px; font-weight: 600; color: #374151;
    text-transform: uppercase; letter-spacing: .04em; margin-bottom: 5px; display: block;
}
.rd-input {
    border: 1px solid #d1d5db !important; border-radius: 7px !important;
    font-size: 13.5px !important; color: #111827 !important;
    padding: 8px 12px !important; height: auto !important;
    transition: border-color .15s, box-shadow .15s;
}
.rd-input:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,.08) !important;
    outline: none !important;
}
.rd-input:read-only, .rd-input:disabled { background: #f9fafb !important; color: #9ca3af !important; }
.rd-submit-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 0 20px; height: 38px; border-radius: 7px;
    background: #2563eb; color: #fff !important;
    font-size: 13.5px; font-weight: 600; border: none; cursor: pointer;
    transition: background .15s; text-decoration: none;
}
.rd-submit-btn:hover { background: #1d4ed8; }

/* Phone input (intlTelInput) */
.rd-phone-input {
    border: 1px solid #d1d5db; border-radius: 7px;
    font-size: 13.5px; color: #111827; height: auto;
    transition: border-color .15s, box-shadow .15s; width: 100%;
}
.rd-phone-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.08); outline: none;
}
.iti { width: 100% !important; display: block !important; }

body.dark .rd-label { color: #94a3b8; }
body.dark .rd-input { background: #1e2433 !important; border-color: #3d4a5e !important; color: #e2e8f0 !important; }
body.dark .rd-input:focus { border-color: #3b82f6 !important; }
body.dark .rd-input:read-only, body.dark .rd-input:disabled { background: #252d3d !important; color: #64748b !important; }
body.dark .rd-phone-input { background: #1e2433; border-color: #3d4a5e; color: #e2e8f0; }

/* Password eye input group */
.input-group-merge .rd-input { border-right: none !important; border-radius: 7px 0 0 7px !important; }
.input-group-merge .input-group-append .input-group-text {
    border: 1px solid #d1d5db !important; border-left: none !important;
    border-radius: 0 7px 7px 0 !important; background: #fff;
}
body.dark .input-group-merge .input-group-append .input-group-text { background: #252d3d !important; }

/* =========================================================
   SHORTCODE BADGE  (.rd-shortcode)
   ========================================================= */
.rd-shortcode {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px; background: #f0fdf4; border: 1px solid #bbf7d0;
    border-radius: 8px; margin-top: 6px;
}
.rd-shortcode-label { font-size: 12px; color: #6b7280; font-weight: 500; }
.rd-shortcode-value { font-size: 18px; font-weight: 700; color: #16a34a; letter-spacing: .04em; }

body.dark .rd-shortcode { background: rgba(22,163,74,.1); border-color: rgba(22,163,74,.3); }
body.dark .rd-shortcode-label { color: #64748b; }
body.dark .rd-shortcode-value { color: #4ade80; }

/* =========================================================
   TOGGLE SWITCH  (.rd-toggle)
   ========================================================= */
.rd-toggle { position: relative; display: inline-block; width: 40px; height: 22px; vertical-align: middle; }
.rd-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.rd-toggle-track {
    position: absolute; inset: 0; background: #e5e7eb; border-radius: 22px;
    transition: background .2s; cursor: pointer;
}
.rd-toggle-track::before {
    content: ''; position: absolute; width: 16px; height: 16px;
    left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s;
}
.rd-toggle input:checked + .rd-toggle-track { background: #2563eb; }
.rd-toggle input:checked + .rd-toggle-track::before { transform: translateX(18px); }

body.dark .rd-toggle-track { background: #3d4a5e; }
body.dark .rd-toggle input:checked + .rd-toggle-track { background: #3b82f6; }

/* =========================================================
   AVATAR  (.rd-avatar / .rd-avatar-fallback)
   ========================================================= */
.rd-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    object-fit: cover; border: 2px solid #f3f4f6;
}
.rd-avatar-fallback {
    width: 36px; height: 36px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
/* 7-color palette */
.rd-avatar-fallback.c1 { background: #2563eb; }
.rd-avatar-fallback.c2 { background: #7c3aed; }
.rd-avatar-fallback.c3 { background: #db2777; }
.rd-avatar-fallback.c4 { background: #0891b2; }
.rd-avatar-fallback.c5 { background: #16a34a; }
.rd-avatar-fallback.c6 { background: #d97706; }
.rd-avatar-fallback.c7 { background: #dc2626; }

/* =========================================================
   UPLOAD BOX  (.upload_box / .choose-btn)
   ========================================================= */
.upload_box { margin-bottom: 12px; }
.upload_box p { font-size: 12px; color: #6b7280; margin-top: 6px; }
.choose-btn {
    border: 1.5px solid #e5e7eb; margin-bottom: 10px; border-radius: 8px;
    width: 140px; display: flex; color: #333; padding: 7px 10px;
    float: left; position: relative; justify-content: flex-start;
    align-items: center; gap: 8px; text-decoration: none;
    transition: border-color .15s, background .15s;
}
.choose-btn:hover { background: #f9fafb; border-color: #d1d5db; text-decoration: none; }
.choose-btn .icon { line-height: 1; flex-shrink: 0; }
.choose-btn .text { font-size: 8px; text-transform: uppercase; font-weight: 600; letter-spacing: 1px; line-height: 1.2; color: #6b7280; }
.choose-btn .text strong { font-size: 12px; display: block; font-weight: 700; letter-spacing: 0; text-transform: capitalize; color: #111827; }
.alDriveProfilePageAppBtns { list-style: none; padding: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.alDriveProfilePageAppBtns li { list-style: none; }

/* =========================================================
   TOOLTIP ERROR  (.tooltip_error)
   ========================================================= */
.tooltip_error {
    position: absolute; bottom: 105%; left: 50%; transform: translateX(-50%);
    background: #1f2937; color: #fff; font-size: 11px; border-radius: 6px;
    padding: 6px 10px; min-width: 160px; list-style: none; margin: 0; white-space: nowrap; z-index: 99;
}
.tooltip_error::after {
    content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
    border: 5px solid transparent; border-top-color: #1f2937;
}

/* =========================================================
   RESPONSIVE — mobile
   ========================================================= */
@media (max-width: 768px) {
    .rd-sidebar {
        transform: translateX(-100%);
    }
    body.rd-sidebar-open .rd-sidebar {
        transform: translateX(0);
    }
    .rd-topbar {
        left: 0;
    }
    .content-page,
    .content-page.main_outter_box {
        margin-left: 0 !important;
        width: 100% !important;
    }
    /* overlay */
    body.rd-sidebar-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.35);
        z-index: 999;
    }
}
