/* Creative dashboard skin — layered on top of the Metronic bundle so existing pages keep working. */

:root {
    --primary: var(--bs-primary);
    --primary-rgb: var(--bs-primary-rgb);
    --primary-end: color-mix(in srgb, var(--bs-primary) 72%, #8b5cf6);
    --primary-dark: color-mix(in srgb, var(--bs-primary) 82%, #000);
    --primary-light: color-mix(in srgb, var(--bs-primary) 70%, #fff);
    --primary-glow: rgba(var(--bs-primary-rgb), 0.18);
    --primary-ultra: rgba(var(--bs-primary-rgb), 0.07);

    --cd-sidebar-width: 265px;
    --cd-transition: all 0.22s cubic-bezier(.4, 0, .2, 1);
    --cd-radius: 14px;
    --cd-radius-sm: 10px;
    --cd-radius-lg: 20px;
    --cd-radius-xl: 24px;

    --cd-bg: #f0f2f8;
    --cd-bg-card: #ffffff;
    --cd-bg-sidebar: #ffffff;
    --cd-bg-header: rgba(255, 255, 255, 0.9);
    --cd-text: #1e293b;
    --cd-text-muted: #64748b;
    --cd-border: #e2e8f0;
    --cd-sidebar-text: #475569;
    --cd-sidebar-label: #94a3b8;
    --cd-shadow: 0 4px 30px rgba(0, 0, 0, 0.07);
    --cd-shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.05);
    --cd-shadow-card: 0 8px 32px var(--primary-ultra);
    --cd-shadow-hover: 0 16px 48px var(--primary-glow);
}

[data-bs-theme="dark"] {
    --cd-bg: #0f172a;
    --cd-bg-card: #1e293b;
    --cd-bg-sidebar: #0f172a;
    --cd-bg-header: rgba(13, 21, 38, 0.92);
    --cd-text: #f8fafc;
    --cd-text-muted: #94a3b8;
    --cd-border: #334155;
    --cd-sidebar-text: #94a3b8;
    --cd-sidebar-label: #475569;
    --cd-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
    --cd-shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.3);
    --cd-shadow-card: 0 8px 32px rgba(0, 0, 0, 0.25);
    --bs-body-bg: var(--cd-bg);
    --bs-body-color: var(--cd-text);
}

/* ===================== Base ===================== */
body.cd-body {
    background: var(--cd-bg) !important;
    color: var(--cd-text);
    overflow-x: hidden;
    transition: background 0.35s ease, color 0.35s ease;
}

#cd-bg-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.35;
}

/* ===================== Layout ===================== */
.cd-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.cd-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--cd-transition);
}

[dir="ltr"] .cd-main { margin-left: var(--cd-sidebar-width); }
[dir="rtl"] .cd-main { margin-right: var(--cd-sidebar-width); }

.cd-page {
    flex: 1;
    padding: 0 28px 32px;
}

.cd-page-toolbar { padding: 0 28px; position: relative; z-index: 2; }

:where(.cd-body) i.bi { color: inherit; font-size: inherit; line-height: 1; }

.cd-page .app-container { max-width: 100%; padding-left: 0; padding-right: 0; }
.cd-page .app-toolbar { padding-top: 0 !important; padding-bottom: 1.25rem !important; }

/* ===================== Sidebar ===================== */
.cd-sidebar {
    width: var(--cd-sidebar-width);
    background: var(--cd-bg-sidebar);
    border-inline-end: 1px solid var(--cd-border);
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    height: 100vh;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--cd-transition);
    box-shadow: var(--cd-shadow-sm);
}

.cd-sidebar::-webkit-scrollbar { width: 4px; }
.cd-sidebar::-webkit-scrollbar-thumb { background: var(--cd-border); border-radius: 10px; }

.cd-sidebar-brand {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    background: var(--cd-bg-sidebar);
    z-index: 2;
    border-bottom: 1px solid var(--cd-border);
    min-height: 72px;
}

.cd-sidebar-brand img { max-height: 40px; max-width: 100%; object-fit: contain; }

.cd-sidebar-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--cd-sidebar-label);
    padding: 20px 24px 6px;
}

[dir="rtl"] .cd-sidebar-label { font-size: 11.5px; letter-spacing: normal; }

.cd-sidebar .cd-menu-item { padding: 1.5px 10px; }

.cd-sidebar .cd-menu-link {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 10px 14px;
    color: var(--cd-sidebar-text);
    border: 0;
    background: transparent;
    border-radius: var(--cd-radius-sm);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    text-align: start;
    transition: var(--cd-transition);
}

.cd-sidebar .cd-menu-link:hover {
    background: var(--primary-ultra);
    color: var(--primary);
}

.cd-sidebar .cd-menu-link { position: relative; }

.cd-sidebar .cd-menu-link.active {
    background: var(--primary-ultra);
    color: var(--primary);
    font-weight: 700;
}

.cd-sidebar .cd-menu-link.active::after {
    content: '';
    position: absolute;
    inset-block: 8px;
    inset-inline-start: -10px;
    width: 4px;
    border-start-end-radius: 4px;
    border-end-end-radius: 4px;
    background: var(--primary);
}

[dir="rtl"] .cd-sidebar .cd-menu-link.active::after {
    border-radius: 4px 0 0 4px;
}

.cd-sidebar .cd-submenu .cd-menu-link.active::after { display: none; }

.cd-menu-badge {
    margin-inline-start: auto;
    min-width: 22px;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.cd-sidebar .cd-menu-icon {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.75;
}

.cd-sidebar .cd-menu-link:hover .cd-menu-icon,
.cd-sidebar .cd-menu-link.active .cd-menu-icon { opacity: 1; }

.cd-sidebar .cd-menu-arrow {
    margin-inline-start: auto;
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.cd-sidebar .cd-menu-link[aria-expanded="true"] .cd-menu-arrow { transform: rotate(90deg); }
[dir="rtl"] .cd-sidebar .cd-menu-link[aria-expanded="true"] .cd-menu-arrow { transform: rotate(-90deg); }

.cd-sidebar .cd-submenu { padding-inline-start: 22px; }

.cd-sidebar .cd-submenu .cd-menu-link { font-size: 0.85rem; padding: 8px 14px; }

.cd-sidebar .cd-submenu .cd-menu-link::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.45;
    flex-shrink: 0;
}

.cd-sidebar-footer {
    margin-top: auto;
    padding: 12px 10px 18px;
    border-top: 1px solid var(--cd-border);
}

.cd-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1035;
}

/* ===================== Top header ===================== */
.cd-header {
    background: var(--cd-bg-header);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--cd-border);
    padding: 12px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 1030;
    margin-bottom: 24px;
}

.cd-header-title { font-size: 1.2rem; font-weight: 800; color: var(--cd-text); margin: 0; line-height: 1.3; }

.cd-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 2px 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.78rem;
    color: var(--cd-text-muted);
}

.cd-breadcrumb a { color: inherit; text-decoration: none; }
.cd-breadcrumb a:hover { color: var(--primary); }
.cd-breadcrumb li + li::before { content: '/'; margin-inline-end: 6px; opacity: 0.5; }

.cd-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary-ultra);
    border: 1px solid var(--cd-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--cd-text-muted);
    transition: var(--cd-transition);
    cursor: pointer;
    text-decoration: none;
}

.cd-icon-btn:hover {
    color: var(--primary);
    border-color: var(--primary-light);
}

.cd-pill-btn {
    border-radius: 999px;
    border: 1px solid var(--cd-border);
    background: var(--cd-bg-card);
    color: var(--cd-text);
    padding: 7px 14px;
    font-weight: 600;
    font-size: 0.85rem;
}

.cd-user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    background: transparent;
    padding: 0;
    color: var(--cd-text);
}

.cd-user-btn img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--cd-border);
}

.cd-dropdown {
    background: var(--cd-bg-card);
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius);
    box-shadow: var(--cd-shadow);
    padding: 6px;
    min-width: 220px;
}

.cd-dropdown .dropdown-item {
    color: var(--cd-text);
    border-radius: var(--cd-radius-sm);
    font-size: 0.875rem;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cd-dropdown .dropdown-item:hover,
.cd-dropdown .dropdown-item.active {
    background: var(--primary-ultra);
    color: var(--primary);
}

/* ===================== Footer ===================== */
.cd-footer {
    padding: 14px 28px;
    border-top: 1px solid var(--cd-border);
    color: var(--cd-text-muted);
    font-size: 0.85rem;
    text-align: center;
}

.cd-footer a { color: var(--cd-text); font-weight: 600; text-decoration: none; }
.cd-footer a:hover { color: var(--primary); }

/* ===================== Page components restyle ===================== */
.cd-body .card {
    border: 1px solid var(--cd-border) !important;
    border-radius: var(--cd-radius-lg) !important;
    background-color: var(--cd-bg-card);
    color: var(--cd-text);
    box-shadow: var(--cd-shadow-card) !important;
    transition: box-shadow 0.25s ease, background 0.3s ease;
}

.cd-body .card .card-header {
    background: transparent;
    border-bottom-color: var(--cd-border);
}

.cd-body .form-control,
.cd-body .form-select {
    border-radius: var(--cd-radius-sm);
    border: 1px solid var(--cd-border);
    background-color: var(--cd-bg-card);
    color: var(--cd-text);
    transition: var(--cd-transition);
}

.cd-body .form-control.form-control-solid,
.cd-body .form-select.form-select-solid {
    background-color: var(--cd-bg);
    border-color: var(--cd-border);
}

.cd-body .form-control:focus,
.cd-body .form-select:focus {
    box-shadow: 0 0 0 3px var(--primary-glow);
    border-color: var(--primary-light);
}

.cd-body .btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-end)) !important;
    border: none !important;
    border-radius: var(--cd-radius-sm);
    font-weight: 600;
    color: #fff !important;
    box-shadow: 0 4px 14px var(--primary-glow);
    transition: var(--cd-transition);
}

.cd-body .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.cd-body .btn { border-radius: var(--cd-radius-sm); }

.cd-body .table { color: var(--cd-text); }
.cd-body .table > tbody > tr { transition: background 0.15s ease; }
.cd-body .table > tbody > tr:hover { background: var(--primary-ultra); }

.cd-body .modal-content {
    background: var(--cd-bg-card);
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius-xl);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.2);
}

.cd-body .dropdown-menu {
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius);
    box-shadow: var(--cd-shadow);
}

.cd-body .menu-sub-dropdown {
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius) !important;
    box-shadow: var(--cd-shadow) !important;
}

.cd-body .pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.cd-body .nav-tabs .nav-link.active,
.cd-body .nav-line-tabs .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.cd-body .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.cd-body ::-webkit-scrollbar { width: 6px; height: 6px; }
.cd-body ::-webkit-scrollbar-thumb { background: var(--cd-border); border-radius: 10px; }

/* ===================== Creative page building blocks ===================== */
.cd-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--cd-bg-card);
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius-lg);
    box-shadow: var(--cd-shadow-sm);
    padding: 16px 20px;
    margin-bottom: 1.5rem;
    animation: cdFadeInUp 0.35s ease-out both;
}

.cd-toolbar-filters,
.cd-toolbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.cd-toolbar-title {
    margin: 0;
    color: var(--cd-text);
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.35;
}

.cd-search { position: relative; }

.cd-search > i {
    position: absolute;
    top: 50%;
    inset-inline-start: 14px;
    transform: translateY(-50%);
    color: var(--cd-text-muted);
    pointer-events: none;
}

.cd-body .cd-search .form-control {
    border-radius: 999px;
    padding-inline-start: 40px;
    width: 260px;
    max-width: 100%;
}

.cd-body .cd-pill-select {
    border-radius: 999px;
    min-width: 150px;
    width: auto;
}

.cd-body .btn.rounded-pill { border-radius: 999px; }

.cd-table-card .card-body { padding: 1.25rem; }

.cd-body .cd-table { margin-bottom: 0; font-size: 0.875rem; }

.cd-body .cd-table > thead th {
    background: var(--cd-bg) !important;
    color: var(--cd-text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    border: none;
    padding: 12px 16px;
    white-space: nowrap;
}

[dir="rtl"] .cd-body .cd-table > thead th { font-size: 12px; letter-spacing: normal; }

.cd-body .cd-table > thead th:first-child { border-start-start-radius: var(--cd-radius-sm); border-end-start-radius: var(--cd-radius-sm); }
.cd-body .cd-table > thead th:last-child { border-start-end-radius: var(--cd-radius-sm); border-end-end-radius: var(--cd-radius-sm); }

.cd-body .cd-table > tbody > tr { border-bottom: 1px solid var(--cd-border); }
.cd-body .cd-table > tbody > tr:last-child { border-bottom: none; }
.cd-body .cd-table > tbody > tr > td {
    padding: 14px 16px;
    vertical-align: middle;
    background: transparent;
    color: var(--cd-text);
    border: none;
}

.cd-cell-title { font-weight: 700; color: var(--cd-text); }
.cd-cell-sub { font-size: 0.8rem; color: var(--cd-text-muted); }

.cd-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--cd-border);
}

.cd-thumb {
    width: 52px;
    height: 52px;
    border-radius: var(--cd-radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--cd-border);
    background: var(--cd-bg);
}

.cd-icon-tile {
    width: 42px;
    height: 42px;
    border-radius: var(--cd-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-ultra);
    color: var(--primary);
    font-size: 1.15rem;
    flex-shrink: 0;
}

.cd-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.cd-body .cd-action {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50% !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--cd-bg);
    border: 1px solid var(--cd-border);
    font-size: 0.85rem;
    transition: var(--cd-transition);
}

.cd-body .cd-action:hover { background: var(--primary-ultra); border-color: var(--primary-light); }

.cd-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
    white-space: nowrap;
}

.cd-badge-success { background: rgba(16, 185, 129, 0.1); color: #059669; border-color: rgba(16, 185, 129, 0.25); }
.cd-badge-danger { background: rgba(239, 68, 68, 0.1); color: #dc2626; border-color: rgba(239, 68, 68, 0.25); }
.cd-badge-warning { background: rgba(245, 158, 11, 0.12); color: #b45309; border-color: rgba(245, 158, 11, 0.3); }
.cd-badge-info { background: rgba(6, 182, 212, 0.1); color: #0891b2; border-color: rgba(6, 182, 212, 0.25); }
.cd-badge-primary { background: var(--primary-ultra); color: var(--primary); border-color: var(--primary-glow); }
.cd-badge-secondary { background: rgba(100, 116, 139, 0.1); color: var(--cd-text-muted); border-color: rgba(100, 116, 139, 0.2); }

[data-bs-theme="dark"] .cd-badge-success { color: #34d399; }
[data-bs-theme="dark"] .cd-badge-danger { color: #f87171; }
[data-bs-theme="dark"] .cd-badge-warning { color: #fbbf24; }
[data-bs-theme="dark"] .cd-badge-info { color: #22d3ee; }

.cd-empty {
    text-align: center;
    padding: 3rem 1rem !important;
    color: var(--cd-text-muted) !important;
}

.cd-empty i {
    width: 64px;
    height: 64px;
    margin: 0 auto 0.85rem;
    border-radius: var(--cd-radius);
    background: var(--primary-ultra);
    color: var(--primary);
    font-size: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cd-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 1.25rem;
    color: var(--cd-text-muted);
    font-size: 0.85rem;
}

.cd-pagination nav > div:first-child { display: none; }
.cd-pagination .pagination { margin-bottom: 0; }

.cd-modal-backdrop {
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
}

.cd-body .cd-modal .modal-content {
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius-xl);
    overflow: hidden;
    animation: cdFadeInUp 0.3s ease-out both;
}

.cd-body .cd-modal .modal-header {
    border-bottom: 1px solid var(--cd-border);
    padding: 20px 24px;
    background: var(--cd-bg-card);
}

.cd-body .cd-modal .modal-title { font-weight: 800; font-size: 1.15rem; color: var(--cd-text); }
.cd-body .cd-modal .modal-body { padding: 24px; max-height: calc(100vh - 220px); overflow-y: auto; }
.cd-body .cd-modal .modal-footer {
    border-top: 1px solid var(--cd-border);
    padding: 16px 24px;
    background: var(--cd-bg-card);
    gap: 8px;
}

.cd-modal-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--cd-border);
    background: var(--cd-bg);
    color: var(--cd-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--cd-transition);
}

.cd-modal-close:hover { color: #ef4444; transform: rotate(90deg); }

.cd-body .cd-modal .form-label,
.cd-form-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--cd-text-muted);
    margin-bottom: 6px;
}

.cd-form-section {
    background: var(--cd-bg);
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius);
    padding: 18px;
    margin-bottom: 1rem;
}

.cd-file-drop {
    border: 2px dashed var(--cd-border);
    border-radius: var(--cd-radius);
    padding: 14px;
    transition: border-color .15s ease, background-color .15s ease;
}

.cd-file-drop.is-dragging {
    border-color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle, rgba(13, 110, 253, .06));
}

/* nav-pills-custom drops the active background but nav-pills keeps the white text. */
.cd-body .nav.nav-pills.nav-pills-custom.cd-steps .nav-link.active {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}

@media (max-width: 767.98px) {
    .cd-body .nav.nav-pills.nav-pills-custom.cd-steps > .nav-item {
        flex: 0 0 auto;
    }

    .cd-body .nav.nav-pills.nav-pills-custom.cd-steps .nav-link {
        white-space: nowrap;
    }
}

/* ---------- Template wizard: project upload ---------- */
.cd-project-drop { padding: 0; }
.cd-project-drop.is-invalid { border-color: #ef4444; }
.cd-project-drop-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
}
.cd-project-drop-label > .bi { font-size: 2.2rem; color: var(--primary); }
.cd-project-drop-label:hover { background: var(--primary-ultra); border-radius: var(--cd-radius); }
.cd-project-drop-progress { padding: 26px 20px; }
.cd-project-drop [data-dropzone-error]:not(.d-none) { padding: 0 16px 12px; }

/* ---------- Template wizard: code workspace ---------- */
.cd-ide {
    --ide-bg: var(--cd-bg-card);
    --ide-panel: var(--cd-bg);
    --ide-line: var(--cd-border);
    --ide-text: var(--cd-text);
    --ide-muted: var(--cd-text-muted);
    --ide-hover: rgba(100, 116, 139, 0.1);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 210px);
    min-height: 620px;
    background: var(--ide-bg);
    color: var(--ide-text);
}
.cd-ide [hidden] { display: none !important; }
.cd-ide.is-fullscreen { position: fixed; inset: 0; z-index: 1090; height: 100vh; min-height: 0; }
html.cd-ide-locked { overflow: hidden; }

.cd-ide-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--ide-line);
}
.cd-ide-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.95rem; }
.cd-ide-title > .bi:first-child { color: var(--primary); font-size: 1.1rem; }
.cd-ide-actions,
.cd-ide-preview-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.cd-ide-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--ide-muted);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.cd-ide-btn:hover { background: var(--ide-hover); color: var(--ide-text); }
.cd-ide-btn.is-on { background: var(--primary-ultra); border-color: var(--primary-glow); color: var(--primary); }
.cd-ide-btn:disabled { opacity: .5; }
.cd-ide-btn-sm { height: 28px; padding: 0 8px; }
.cd-ide-sep { width: 1px; height: 20px; margin: 0 4px; background: var(--ide-line); }

.cd-ide-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr) minmax(0, 1fr);
}
.cd-ide.is-explorer-hidden .cd-ide-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cd-ide.is-preview-hidden .cd-ide-body { grid-template-columns: 240px minmax(0, 1fr); }
.cd-ide.is-explorer-hidden.is-preview-hidden .cd-ide-body { grid-template-columns: minmax(0, 1fr); }
.cd-ide.is-explorer-hidden .cd-ide-explorer,
.cd-ide.is-preview-hidden .cd-ide-preview { display: none; }

.cd-ide-pane-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 40px;
    padding: 4px 12px;
    border-bottom: 1px solid var(--ide-line);
    color: var(--ide-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.cd-ide-pane-title small { font-weight: 600; letter-spacing: 0; text-transform: none; }

.cd-ide-explorer {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-right: 1px solid var(--ide-line);
    background: var(--ide-panel);
}
.cd-ide-tree { flex: 1; overflow: auto; padding: 4px 0 12px; }
.cd-ide-group {
    padding: 8px 14px 4px;
    color: var(--ide-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.cd-ide-file {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 5px 14px;
    border: 0;
    background: transparent;
    color: var(--ide-text);
    font-size: 0.8rem;
    text-align: left;
}
.cd-ide-file:hover { background: var(--ide-hover); }
.cd-ide-file.is-active { background: var(--primary-ultra); color: var(--primary); box-shadow: inset 2px 0 0 var(--primary); }
.cd-ide-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-ide-file-meta { color: var(--ide-muted); font-size: 0.7rem; white-space: nowrap; }
.cd-ide-folder .cd-ide-file { padding-left: 34px; }
.cd-ide-folder > summary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    list-style: none;
    cursor: pointer;
    user-select: none;
}
.cd-ide-folder > summary::-webkit-details-marker { display: none; }
.cd-ide-folder > summary:hover { background: var(--ide-hover); }
.cd-ide-chevron { color: var(--ide-muted); font-size: 0.65rem; transition: transform .15s ease; }
.cd-ide-folder:not([open]) .cd-ide-chevron { transform: rotate(-90deg); }
.cd-ide-file-row { position: relative; display: flex; }
.cd-ide-file-action {
    position: absolute;
    top: 50%;
    right: 6px;
    display: none;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 6px;
    background: var(--ide-bg);
    color: #ef4444;
    font-size: 0.75rem;
    transform: translateY(-50%);
}
.cd-ide-file-row:hover .cd-ide-file-action,
.cd-ide-file-action:focus-visible { display: inline-flex; }
.cd-ide-file-row:hover .cd-ide-file-meta { visibility: hidden; }
.cd-ide-icon-html { color: #e34f26; }
.cd-ide-icon-css { color: #2965f1; }
.cd-ide-icon-js { color: #d4a20b; }
.cd-ide-icon-folder { color: #e0a526; }
.cd-ide-icon-image { color: #10b981; }
.cd-ide-icon-audio { color: #8b5cf6; }
.cd-ide-icon-video { color: #ec4899; }
.cd-ide-icon-text { color: #0ea5e9; }
.cd-ide-icon-font,
.cd-ide-icon-file { color: var(--ide-muted); }
.cd-ide-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 14px 12px;
    padding: 16px 12px;
    border: 1px dashed var(--ide-line);
    border-radius: 10px;
    color: var(--ide-muted);
    font-size: 0.78rem;
    text-align: center;
}
.cd-ide-empty > .bi { font-size: 1.5rem; }

.cd-ide-editor { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.cd-ide-tabs {
    display: flex;
    min-height: 40px;
    overflow-x: auto;
    overflow-y: hidden;
    border-bottom: 1px solid var(--ide-line);
    background: var(--ide-panel);
    scrollbar-width: none;
}
.cd-ide-tabs::-webkit-scrollbar { display: none; }
.cd-ide-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 12px;
    border: 0;
    border-right: 1px solid var(--ide-line);
    background: transparent;
    color: var(--ide-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}
.cd-ide-tab:hover { color: var(--ide-text); }
.cd-ide-tab.is-active { background: var(--ide-bg); color: var(--ide-text); }
.cd-ide-tab.is-active::after { content: ''; position: absolute; top: 0; right: 0; left: 0; height: 2px; background: var(--primary); }
.cd-ide-tab .bi-filetype-html { color: #e34f26; }
.cd-ide-tab .bi-filetype-css { color: #2965f1; }
.cd-ide-tab .bi-filetype-js { color: #d4a20b; }
.cd-ide-tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    font-size: 0.9rem;
    opacity: .6;
}
.cd-ide-tab-close:hover { background: var(--ide-hover); opacity: 1; }

.cd-ide-stage { position: relative; flex: 1; min-height: 0; }
.cd-ide-monaco,
.cd-ide-viewer { position: absolute; inset: 0; }
.cd-ide-loading { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--ide-muted); }
.cd-ide-viewer { overflow: auto; background: var(--ide-panel); }
.cd-ide-viewer-body { display: flex; flex-direction: column; min-height: 100%; }
.cd-ide-viewer-media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background-image: conic-gradient(rgba(100, 116, 139, 0.1) 25%, transparent 0 50%, rgba(100, 116, 139, 0.1) 0 75%, transparent 0);
    background-size: 20px 20px;
}
.cd-ide-viewer-media img,
.cd-ide-viewer-media video { max-width: 100%; max-height: 60vh; border-radius: 8px; box-shadow: var(--cd-shadow-sm); }
.cd-ide-viewer-media audio { width: min(420px, 100%); }
.cd-ide-font-sample { font-size: 2rem; line-height: 1.6; text-align: center; }
.cd-ide-viewer-icon { color: var(--ide-muted); font-size: 4rem; }
.cd-ide-viewer-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--ide-line);
    background: var(--ide-bg);
}
.cd-ide-viewer-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-width: 0; color: var(--ide-muted); font-size: 0.78rem; }
.cd-ide-viewer-meta code { color: var(--ide-text); }
.cd-ide-viewer-actions { display: flex; gap: 6px; }
.cd-ide-viewer-note { display: flex; align-items: center; justify-content: center; gap: 8px; height: 100%; color: var(--ide-muted); font-size: 0.85rem; }

.cd-ide-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 28px;
    padding: 0 12px;
    overflow: hidden;
    border-top: 1px solid var(--ide-line);
    background: var(--ide-panel);
    color: var(--ide-muted);
    font-size: 0.72rem;
    white-space: nowrap;
}
.cd-ide-status-group { display: flex; align-items: center; gap: 14px; min-width: 0; }
.cd-ide-status-strong { color: var(--ide-text); font-weight: 600; }
.cd-ide-status-flag { padding: 1px 6px; border-radius: 4px; background: rgba(245, 158, 11, 0.15); color: #b45309; }
.cd-ide-status .spinner-border-sm { width: .7rem; height: .7rem; border-width: .12em; }

.cd-ide-preview { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-left: 1px solid var(--ide-line); }
.cd-ide-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 4px;
    color: var(--ide-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
}
.cd-ide-preview-stage { flex: 1; min-height: 0; display: flex; justify-content: center; overflow: auto; background: var(--ide-panel); }
.cd-ide-device { height: 100%; max-width: 100%; background: #fff; transition: width .2s ease; }
.cd-ide-device:not([data-device="desktop"]) {
    height: calc(100% - 24px);
    margin: 12px 0;
    overflow: hidden;
    border-radius: 14px;
    box-shadow: 0 0 0 1px var(--ide-line), var(--cd-shadow);
}
.cd-ide-device iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }

@media (max-width: 1399.98px) {
    .cd-ide-body { grid-template-columns: 210px minmax(0, 1fr) minmax(0, 1fr); }
    .cd-ide.is-preview-hidden .cd-ide-body { grid-template-columns: 210px minmax(0, 1fr); }
    .cd-ide-actions .cd-ide-btn span { display: none; }
}

@media (max-width: 1199.98px) {
    .cd-ide { height: auto; min-height: 0; }
    .cd-ide.is-fullscreen { overflow: auto; }
    .cd-ide-body,
    .cd-ide.is-explorer-hidden .cd-ide-body,
    .cd-ide.is-preview-hidden .cd-ide-body { grid-template-columns: minmax(0, 1fr); }
    .cd-ide-explorer { max-height: 220px; border-right: 0; border-bottom: 1px solid var(--ide-line); }
    .cd-ide-editor { height: 70vh; min-height: 420px; }
    .cd-ide-preview { height: 80vh; border-left: 0; border-top: 1px solid var(--ide-line); }
}

.cd-form-section-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--primary);
    border-bottom: 1px solid var(--cd-border);
    padding-bottom: 8px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cd-modal-loading {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: color-mix(in srgb, var(--cd-bg-card) 85%, transparent);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--cd-text-muted);
}

.cd-filter-menu { min-width: 280px; padding: 16px !important; }

/* Hero + stat cards (home) */
.cd-hero {
    position: relative;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-end) 100%);
    border-radius: var(--cd-radius-lg);
    padding: 2.25rem 2.5rem;
    color: #fff;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px var(--primary-glow);
    margin-bottom: 1.5rem;
    animation: cdFadeInUp 0.4s ease-out both;
}

.cd-hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.cd-hero-greeting { font-size: 1.05rem; font-weight: 500; opacity: 0.9; margin-bottom: 0.25rem; }
.cd-hero-title { font-size: 2rem; font-weight: 800; margin-bottom: 0.25rem; color: #fff; }
.cd-hero-subtitle { opacity: 0.85; margin-bottom: 0; }

.cd-hero-date {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.12);
    padding: 15px 20px;
    border-radius: var(--cd-radius);
    backdrop-filter: blur(10px);
}

.cd-hero-date-day { font-size: 2.4rem; font-weight: 800; line-height: 1; }

.cd-hero-decoration {
    position: absolute;
    top: -50%;
    inset-inline-end: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
    z-index: 1;
}

.cd-stat-card {
    background: var(--cd-bg-card);
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--cd-shadow-sm);
    position: relative;
    overflow: hidden;
    height: 100%;
    transition: var(--cd-transition);
    animation: cdFadeInUp 0.4s ease-out both;
}

.cd-stat-card:hover { transform: translateY(-2px); box-shadow: var(--cd-shadow); }

.cd-stat-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 100% 0%, var(--primary-ultra) 0%, transparent 45%);
    pointer-events: none;
}

[dir="rtl"] .cd-stat-card::after { background: radial-gradient(circle at 0% 0%, var(--primary-ultra) 0%, transparent 45%); }

.cd-stat-card > * { position: relative; z-index: 1; }

[data-bs-theme="dark"] .cd-hero {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.55) 0%, rgba(var(--primary-rgb), 0.25) 100%);
    border: 1px solid rgba(var(--primary-rgb), 0.35);
    box-shadow: none;
}

.cd-stat-icon {
    width: 54px;
    height: 54px;
    border-radius: var(--cd-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 1.1rem;
}

.cd-stat-value { font-size: 1.8rem; font-weight: 800; color: var(--cd-text); line-height: 1.2; margin-bottom: 0.25rem; }
.cd-stat-label { color: var(--cd-text-muted); font-weight: 500; font-size: 0.9rem; margin-bottom: 0.75rem; }
.cd-stat-trend { font-size: 0.8rem; font-weight: 600; display: flex; align-items: center; gap: 4px; }

.cd-tone-primary { background: var(--primary-ultra); color: var(--primary); }
.cd-tone-success { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.cd-tone-danger { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.cd-tone-warning { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.cd-tone-info { background: rgba(6, 182, 212, 0.1); color: #06b6d4; }

.cd-card-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--cd-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cd-card-title i { color: var(--primary); }

.cd-quick-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--cd-radius);
    background: var(--cd-bg);
    border: 1px solid var(--cd-border);
    color: var(--cd-text);
    text-decoration: none;
    transition: var(--cd-transition);
}

.cd-quick-action:hover { border-color: var(--primary-light); background: var(--primary-ultra); color: var(--primary); }
.cd-quick-action .cd-chevron { margin-inline-start: auto; color: var(--cd-text-muted); }
[dir="rtl"] .cd-quick-action .cd-chevron { transform: scaleX(-1); }

.cd-list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--cd-radius);
    background: var(--primary-ultra);
}

[data-bs-theme="dark"] .cd-body .bg-light { background: rgba(255, 255, 255, 0.04) !important; }
[data-bs-theme="dark"] .cd-body .text-dark,
[data-bs-theme="dark"] .cd-body .text-gray-900,
[data-bs-theme="dark"] .cd-body .text-gray-800 { color: var(--cd-text) !important; }

/* ===================== Auth ===================== */
.cd-auth {
    display: flex;
    min-height: 100vh;
    background: var(--cd-bg);
}

.cd-auth-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--cd-bg-card);
    position: relative;
    z-index: 2;
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.05);
}

.cd-auth-form {
    width: 100%;
    max-width: 420px;
    animation: cdFadeInUp 0.5s ease-out;
}

.cd-auth-form h2 { color: var(--cd-text); }
.cd-auth-form p,
.cd-auth-form .form-label { color: var(--cd-text-muted); }

.cd-auth-form .form-label {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cd-auth-form .form-control.is-invalid { background-image: none; }

.cd-auth-image-side {
    flex: 1.2;
    display: none;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-end) 100%);
}

.cd-auth-image-side::after {
    content: '';
    position: absolute;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 70%);
    top: -160px;
    inset-inline-end: -140px;
}

.cd-auth-image-content {
    position: relative;
    z-index: 1;
    padding: 10%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #fff;
    animation: cdFadeInUp 0.8s ease-out 0.2s both;
}

.cd-auth-image-content img { max-height: 260px; max-width: 100%; object-fit: contain; }

@media (min-width: 992px) {
    .cd-auth-image-side { display: flex; }
}

/* ===================== Responsive ===================== */
@media (max-width: 991.98px) {
    .cd-sidebar { transform: translateX(-100%); box-shadow: none; }
    [dir="rtl"] .cd-sidebar { transform: translateX(100%); }
    .cd-sidebar.show { transform: translateX(0); box-shadow: var(--cd-shadow); }
    .cd-sidebar.show + .cd-sidebar-backdrop { display: block; }
    [dir="ltr"] .cd-main { margin-left: 0; }
    [dir="rtl"] .cd-main { margin-right: 0; }
    .cd-page { padding: 0 16px 24px; }
    .cd-page-toolbar { padding: 0 16px; }
    .cd-hero { padding: 1.75rem 1.5rem; }
    .cd-hero-title { font-size: 1.6rem; }
    .cd-header { padding: 12px 16px; }
}

@keyframes cdFadeInUp {
    from { transform: translateY(16px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ===================== Settings & profile ===================== */
.cd-tab-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cd-body .cd-tab-pills .btn { font-weight: 600; }

.cd-body .cd-tab-pills .btn-light {
    background: var(--cd-bg);
    border: 1px solid var(--cd-border);
    color: var(--cd-text-muted);
}

.cd-body .cd-tab-pills .btn-light:hover {
    background: var(--primary-ultra);
    border-color: var(--primary-glow);
    color: var(--primary);
}

.cd-dropzone {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 110px;
    padding: 20px;
    border: 2px dashed var(--cd-border);
    border-radius: var(--cd-radius);
    background: var(--cd-bg);
    text-align: center;
    cursor: pointer;
    transition: var(--cd-transition);
    margin-bottom: 0;
}

.cd-dropzone:hover,
.cd-dropzone:focus-within {
    border-color: var(--primary);
    background: var(--primary-ultra);
}

.cd-dropzone.is-invalid { border-color: #ef4444; }

.cd-dropzone-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.cd-dropzone-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.cd-dropzone-icon {
    font-size: 2rem;
    line-height: 1;
    color: var(--cd-text-muted);
    transition: var(--cd-transition);
}

.cd-dropzone:hover .cd-dropzone-icon { color: var(--primary); }

.cd-dropzone-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--cd-text-muted);
}

.cd-upload-preview {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 10px;
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius);
    background: var(--cd-bg-card);
}

.cd-upload-thumb {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    padding: 6px;
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius-sm);
    background: var(--cd-bg);
    overflow: hidden;
}

.cd-upload-thumb-wide { width: 120px; }

.cd-upload-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cd-font-preview {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 12px 16px;
    border: 1px solid var(--primary-glow);
    border-radius: var(--cd-radius);
    background: var(--primary-ultra);
    color: var(--cd-text);
}

.cd-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius);
    background: var(--cd-bg);
    color: var(--cd-text);
}

.cd-switch-row .form-check-input {
    width: 3rem;
    height: 1.5rem;
    cursor: pointer;
}

.cd-repeater-row {
    padding: 14px;
    margin-bottom: 12px;
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius-sm);
    background: var(--cd-bg-card);
}

.cd-color-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cd-color-swatch {
    width: 36px;
    height: 32px;
    flex-shrink: 0;
    padding: 2px;
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius-sm);
    background: var(--cd-bg-card);
    cursor: pointer;
}

.cd-color-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.cd-color-swatch::-webkit-color-swatch { border: none; border-radius: 6px; }
.cd-color-swatch::-moz-color-swatch { border: none; border-radius: 6px; }

.cd-body .cd-profile-card { overflow: hidden; }

.cd-profile-cover {
    position: relative;
    height: 130px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-end) 100%);
    overflow: hidden;
}

.cd-profile-cover::before,
.cd-profile-cover::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.cd-profile-cover::before {
    width: 300px;
    height: 300px;
    top: -110px;
    inset-inline-end: -60px;
}

.cd-profile-cover::after {
    width: 160px;
    height: 160px;
    bottom: -90px;
    inset-inline-start: 20%;
}

.cd-profile-body {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding: 0 1.5rem 1.5rem;
}

.cd-profile-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    margin-top: -48px;
    z-index: 2;
}

.cd-profile-avatar {
    width: 100px;
    height: 100px;
    display: block;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid var(--cd-bg-card);
    background: var(--cd-bg-card);
    box-shadow: 0 8px 24px var(--primary-glow);
}

.cd-profile-avatar-dot {
    position: absolute;
    bottom: 6px;
    inset-inline-end: 6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #10b981;
    border: 3px solid var(--cd-bg-card);
}

.cd-profile-info {
    flex: 1;
    min-width: 0;
    padding-top: 14px;
}

.cd-profile-name {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-weight: 800;
    color: var(--cd-text);
}

.cd-profile-email {
    color: var(--cd-text-muted);
    font-size: 0.9rem;
    word-break: break-all;
}

.cd-avatar-upload {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.cd-avatar-upload img {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--cd-border);
    box-shadow: var(--cd-shadow-sm);
    transition: var(--cd-transition);
}

.cd-avatar-upload:hover img {
    border-color: var(--primary);
    box-shadow: 0 4px 20px var(--primary-glow);
}

.cd-avatar-upload-btn {
    position: absolute;
    bottom: 4px;
    inset-inline-end: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--cd-bg-card);
    background: var(--primary);
    color: #fff;
    font-size: 0.8rem;
    box-shadow: 0 2px 8px var(--primary-glow);
    transition: var(--cd-transition);
}

.cd-avatar-upload:hover .cd-avatar-upload-btn { transform: scale(1.12); }

[data-bs-theme="dark"] .cd-profile-cover::before,
[data-bs-theme="dark"] .cd-profile-cover::after { background: rgba(255, 255, 255, 0.06); }
[data-bs-theme="dark"] .cd-dropzone:hover,
[data-bs-theme="dark"] .cd-dropzone:focus-within { background: rgba(var(--primary-rgb), 0.12); }
[data-bs-theme="dark"] .cd-body .cd-tab-pills .btn-light { background: rgba(255, 255, 255, 0.04); }

[data-bs-theme="dark"] .cd-body .btn.btn-light {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--cd-border);
    color: var(--cd-text);
}

[data-bs-theme="dark"] .cd-body .btn.btn-light:hover { background: var(--primary-ultra); color: var(--primary); }

@media (max-width: 575.98px) {
    .cd-profile-body { flex-direction: column; align-items: center; text-align: center; }
    .cd-profile-name { justify-content: center; }
    .cd-profile-info { padding-top: 0; }
}

/* ===================== Accessibility & tables ===================== */
.cd-body a:focus-visible,
.cd-body button:focus-visible,
.cd-body .btn:focus-visible,
.cd-body [tabindex]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    box-shadow: none;
}

.cd-body .table-responsive {
    background:
        linear-gradient(to right, var(--cd-bg-card) 30%, transparent) left / 24px 100% no-repeat local,
        linear-gradient(to left, var(--cd-bg-card) 30%, transparent) right / 24px 100% no-repeat local,
        radial-gradient(farthest-side at 0 50%, rgba(15, 23, 42, 0.12), transparent) left / 10px 100% no-repeat scroll,
        radial-gradient(farthest-side at 100% 50%, rgba(15, 23, 42, 0.12), transparent) right / 10px 100% no-repeat scroll;
}

/* ===================== Reservations ===================== */
.cd-mini-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--cd-radius);
    border: 1px solid var(--cd-border);
    background: var(--cd-bg-card);
    color: var(--cd-text);
    text-align: start;
    box-shadow: var(--cd-shadow-sm);
    transition: var(--cd-transition);
}

.cd-mini-stat:hover { border-color: var(--primary-light); }

.cd-mini-stat.is-active {
    border-color: var(--primary);
    background: var(--primary-ultra);
    box-shadow: 0 0 0 3px var(--primary-ultra);
}

.cd-mini-stat-dot {
    width: 36px;
    height: 36px;
    border-radius: var(--cd-radius-sm);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cd-mini-stat-dot::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
}

.cd-tone-secondary { background: rgba(100, 116, 139, 0.1); color: #64748b; }

.cd-mini-stat-label { font-size: 0.82rem; color: var(--cd-text-muted); font-weight: 600; }
.cd-mini-stat-value { font-size: 1.35rem; font-weight: 800; line-height: 1.1; margin-inline-start: auto; }

.cd-code {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--cd-bg);
    border: 1px solid var(--cd-border);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--cd-text);
}

.cd-initials {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-ultra);
    color: var(--primary);
    font-weight: 800;
    text-transform: uppercase;
}

.cd-segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    border-radius: var(--cd-radius);
    background: var(--cd-bg);
    border: 1px solid var(--cd-border);
}

.cd-segmented button {
    border: 0;
    background: transparent;
    color: var(--cd-text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: var(--cd-radius-sm);
    transition: var(--cd-transition);
}

.cd-segmented button:hover { color: var(--primary); }

.cd-segmented .cd-mini-stat-dot {
    width: auto;
    height: auto;
    background: none;
    margin-inline-end: 6px;
    vertical-align: middle;
}

.cd-segmented .cd-mini-stat-dot::before { width: 8px; height: 8px; }

.cd-segmented button[aria-pressed="true"] {
    background: var(--cd-bg-card);
    color: var(--primary);
    box-shadow: var(--cd-shadow-sm);
}

.cd-reservation-item {
    display: flex;
    gap: 14px;
    padding: 14px;
    border-radius: var(--cd-radius);
    border: 1px solid var(--cd-border);
    background: var(--cd-bg-card);
}

.cd-reservation-item .cd-thumb { width: 72px; height: 96px; }

.cd-swatch {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid var(--cd-border);
    display: inline-block;
    flex-shrink: 0;
}

@media (max-width: 575.98px) {
    .cd-reservation-item { flex-direction: column; }
    .cd-reservation-item .cd-thumb { width: 100%; height: 160px; }
}
