/* MediCare HMS — Design System (Cloud UI) */

:root {
    --mc-primary: #7c5cff;
    --mc-primary-dark: #5b3fd6;
    --mc-primary-light: #9b7dff;
    --mc-teal: #60a5fa;
    --mc-cyan: #38bdf8;
    --mc-accent: #a78bfa;
    --mc-success: #10b981;
    --mc-warning: #f59e0b;
    --mc-danger: #ef4444;
    --mc-bg: #f4f7fe;
    --mc-surface: #ffffff;
    --mc-sidebar-width: 260px;
    --mc-sidebar-collapsed: 80px;
    --mc-dark: #1e1e2d;
    --mc-sidebar-bg: #1e1e2d;
    --mc-text: #1b2559;
    --mc-muted: #8f9bba;
    --mc-border: rgba(27, 37, 89, 0.08);
    --mc-shadow-sm: 0 6px 18px rgba(112, 144, 176, 0.08);
    --mc-shadow: 0 14px 36px rgba(112, 144, 176, 0.12);
    --mc-shadow-lg: 0 22px 48px rgba(112, 144, 176, 0.16);
    --mc-radius: 20px;
    --mc-radius-sm: 14px;
    --mc-gradient: linear-gradient(135deg, #868cff 0%, #4318ff 100%);
    --mc-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --mc-spring: cubic-bezier(0.34, 1.2, 0.64, 1);
    --mc-font: "DM Sans", system-ui, sans-serif;
    --mc-display: "DM Sans", system-ui, sans-serif;
    --bs-primary: #4318ff;
    --bs-primary-rgb: 67, 24, 255;
    --bs-link-color: #4318ff;
    --bs-link-hover-color: #2b0fcc;
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(67, 24, 255, 0.28) transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--mc-font);
    min-height: 100vh;
    background: var(--mc-bg);
    color: var(--mc-text);
    -webkit-font-smoothing: antialiased;
}

/* ─── Layout ─── */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--mc-sidebar-width);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #fff;
    background: var(--mc-sidebar-bg);
    border-right: none;
    box-shadow: 18px 0 40px rgba(30, 30, 45, 0.12);
    transition: width 0.35s var(--mc-ease), transform 0.35s var(--mc-ease);
}

.sidebar-glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 40% at 10% 0%, rgba(67, 24, 255, 0.22), transparent 55%),
        radial-gradient(ellipse 60% 35% at 90% 100%, rgba(134, 140, 255, 0.12), transparent 50%);
    animation: sidebarAura 12s ease-in-out infinite alternate;
}

@keyframes sidebarAura {
    from { opacity: 0.85; transform: scale(1); }
    to { opacity: 1; transform: scale(1.04); }
}

.sidebar.collapsed {
    width: var(--mc-sidebar-collapsed);
}

.sidebar-brand {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    padding: 1.25rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    transition: background 0.25s var(--mc-ease);
}

.sidebar-brand:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
}

.brand-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 14px;
    font-size: 1.25rem;
    color: #fff;
    background: var(--mc-gradient);
    box-shadow: 0 10px 24px rgba(67, 24, 255, 0.35);
    animation: none;
}

.brand-icon--logo {
    padding: 4px;
    background: #fff;
    animation: none;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

.brand-icon--logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@keyframes brandPulse {
    0%, 100% { box-shadow: 0 10px 28px rgba(134, 140, 255, 0.3); }
    50% { box-shadow: 0 12px 34px rgba(134, 140, 255, 0.4); }
}

.brand-copy {
    min-width: 0;
}

.sidebar-brand .brand-name {
    display: block;
    font-family: var(--mc-font);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
    letter-spacing: -0.02em;
}

.sidebar-brand small {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.sidebar-nav {
    position: relative;
    z-index: 1;
    padding: 0.65rem 0.75rem 1rem;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section + .nav-section {
    margin-top: 0.35rem;
}

.nav-section-title {
    padding: 0.85rem 0.75rem 0.35rem;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.nav-section-links {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.sidebar .nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem 0.9rem;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 16px;
    transition: color 0.2s var(--mc-ease), background 0.2s var(--mc-ease), box-shadow 0.2s var(--mc-ease);
}

.sidebar .nav-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: transparent;
    border: none;
    transition: none;
}

.sidebar .nav-link i {
    font-size: 1.05rem;
    line-height: 1;
}

.sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar .nav-link:hover .nav-icon {
    background: transparent;
    border-color: transparent;
}

.sidebar .nav-link.active {
    color: #fff;
    background: var(--mc-gradient);
    box-shadow: 0 10px 24px rgba(67, 24, 255, 0.35);
}

.sidebar .nav-link.active .nav-icon {
    background: transparent;
    border-color: transparent;
}

.sidebar .nav-link.active::after {
    display: none;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.65; transform: scale(1.25); }
}

.submenu {
    margin-left: 0.35rem;
    padding-left: 0.7rem;
    border-left: 1px dashed rgba(255, 255, 255, 0.14);
}

.submenu .nav-link {
    padding: 0.55rem 0.75rem;
    font-size: 0.82rem;
}

.sidebar-footer {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    margin: 0.75rem 0.9rem 1rem;
    padding: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    border-radius: 18px;
    background: var(--mc-gradient);
    border: none;
    box-shadow: 0 12px 28px rgba(67, 24, 255, 0.28);
}

.sidebar-user-meta small {
    display: block;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.72);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-sidebar-logout {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    transition: background 0.2s var(--mc-ease), color 0.2s var(--mc-ease), transform 0.2s var(--mc-spring);
}

.btn-sidebar-logout:hover {
    background: rgba(255, 255, 255, 0.28);
    color: #fff;
    transform: scale(1.05);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    flex: 1;
}

.sidebar-user-meta {
    min-width: 0;
}

.sidebar-user-meta strong {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar.collapsed .brand-copy,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .submenu,
.sidebar.collapsed .sidebar-user-meta,
.sidebar.collapsed .sidebar-logout {
    display: none !important;
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
    padding-inline: 0.75rem;
}

.sidebar.collapsed .sidebar-nav {
    padding-inline: 0.55rem;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.45rem;
}

.sidebar.collapsed .nav-link:hover {
    transform: none;
}

.sidebar.collapsed .nav-link.active::after {
    display: none;
}

.sidebar.collapsed .sidebar-footer {
    justify-content: center;
    padding: 0.55rem;
}

.sidebar.collapsed .sidebar-user {
    justify-content: center;
}

.main-content {
    margin-left: var(--mc-sidebar-width);
    min-height: 100vh;
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.35s var(--mc-ease);
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--mc-sidebar-collapsed);
}

/* ─── Top navbar ─── */

.top-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    margin: 1.1rem 1.35rem 0;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: none;
    border-radius: 20px;
    background: #fff;
    backdrop-filter: none;
    box-shadow: var(--mc-shadow-sm);
    animation: slideDown 0.45s var(--mc-ease) both;
}

.top-navbar-left,
.top-navbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.top-navbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 0;
    max-width: 520px;
    margin: 0 auto;
}

.top-search {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 48px;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    background: #f4f7fe;
    border: 1px solid transparent;
    color: var(--mc-muted);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.top-search:focus-within {
    background: #fff;
    border-color: rgba(67, 24, 255, 0.2);
    box-shadow: 0 0 0 4px rgba(67, 24, 255, 0.08);
}

.top-search i {
    font-size: 1rem;
    opacity: 0.75;
}

.top-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--mc-text);
    font-size: 0.92rem;
    box-shadow: none !important;
}

.top-search input::placeholder {
    color: var(--mc-muted);
}

.user-greeting {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
    text-align: left;
}

.user-greeting strong {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--mc-text);
}

.user-greeting small {
    font-size: 0.72rem;
    color: var(--mc-muted);
}

@media (min-width: 768px) {
    .user-greeting { display: flex; }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.btn-icon-toggle,
.btn-nav-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
}

.page-title-bar {
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--mc-text);
}

.page-crumb {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.15rem;
    font-size: 0.74rem;
    color: var(--mc-muted);
}

.page-crumb i {
    font-size: 0.7rem;
    opacity: 0.7;
}

.btn-user-menu {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.3rem 0.55rem 0.3rem 0.3rem !important;
}

.user-menu-copy {
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
    text-align: left;
}

.user-menu-copy strong {
    font-size: 0.8rem;
    font-weight: 700;
}

.user-menu-copy small {
    font-size: 0.68rem;
    color: var(--mc-muted);
    font-weight: 500;
}

.user-menu-caret {
    font-size: 0.7rem;
    color: var(--mc-muted);
}

.dropdown-panel {
    min-width: 260px;
}

.dropdown-item-icon {
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: #f1f5f4;
    margin-right: 0.55rem;
}

.dropdown-item--center {
    justify-content: center;
    text-align: center;
}

.page-content {
    flex: 1;
    padding: 1.15rem 1.35rem 2rem;
}

.page-shell {
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
}

/* ─── Page animations ─── */

.animate-in {
    animation: fadeInUp 0.55s var(--mc-ease) both;
}

.animate-in-delay-1 { animation-delay: 0.06s; }
.animate-in-delay-2 { animation-delay: 0.12s; }
.animate-in-delay-3 { animation-delay: 0.18s; }
.animate-in-delay-4 { animation-delay: 0.24s; }
.animate-in-delay-5 { animation-delay: 0.3s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ─── Page header ─── */

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-family: var(--mc-display);
    font-size: clamp(1.4rem, 2.4vw, 1.85rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.3rem;
    color: var(--mc-text);
}

.page-header h1 i {
    color: var(--mc-primary);
    opacity: 1;
}

.page-header .text-muted {
    font-size: 0.9rem;
    color: var(--mc-muted) !important;
}

/* ─── Cards ─── */

.card {
    border: none;
    border-radius: var(--mc-radius);
    background: var(--mc-surface);
    box-shadow: var(--mc-shadow-sm);
    transition: transform 0.3s var(--mc-ease), box-shadow 0.3s var(--mc-ease);
    overflow: hidden;
}

.card:hover {
    border-color: transparent;
    box-shadow: var(--mc-shadow);
}

.card-header {
    background: #fff !important;
    border-bottom: 1px solid rgba(27, 37, 89, 0.06);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--mc-text);
    padding: 1rem 1.25rem;
    letter-spacing: -0.01em;
}

.card-body {
    padding: 1.25rem;
}

.stat-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.35s var(--mc-spring), box-shadow 0.35s var(--mc-ease);
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--mc-gradient);
    opacity: 0;
    transition: opacity 0.3s var(--mc-ease);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--mc-shadow-lg) !important;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    font-size: 1.3rem;
    transition: transform 0.35s var(--mc-spring);
}

.stat-card:hover .stat-icon {
    transform: scale(1.06) rotate(-2deg);
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

/* ─── Buttons ─── */

.btn {
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.55rem 1.15rem;
    transition: all 0.25s var(--mc-ease);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--mc-gradient);
    border: none;
    box-shadow: 0 10px 22px rgba(67, 24, 255, 0.28);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #9b7dff, #4318ff);
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(67, 24, 255, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-soft {
    border: none;
    background: #f4f7fe;
    color: var(--mc-text);
    box-shadow: none;
}

.btn-soft:hover {
    background: #fdf2f4;
    border-color: rgba(67, 24, 255, 0.28);
    color: var(--mc-primary);
    transform: translateY(-1px);
}

.btn-outline-primary {
    border-width: 1.5px;
    border-color: var(--mc-primary);
    color: var(--mc-primary);
    font-weight: 600;
}

.btn-outline-primary:hover {
    background: var(--mc-primary);
    border-color: var(--mc-primary);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(67, 24, 255, 0.22);
}

/* ─── Forms ─── */

.form-control,
.form-select {
    border-radius: var(--mc-radius-sm);
    border: 1.5px solid #e2e8f0;
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    transition: border-color 0.2s var(--mc-ease), box-shadow 0.2s var(--mc-ease), transform 0.2s var(--mc-ease);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--mc-primary);
    box-shadow: 0 0 0 4px rgba(67, 24, 255, 0.12);
    transform: translateY(-1px);
}

.form-label {
    font-weight: 600;
    font-size: 0.82rem;
    color: #334155;
    margin-bottom: 0.4rem;
}

/* ─── Tables ─── */

.table {
    vertical-align: middle;
    margin-bottom: 0;
}

.table thead th {
    padding: 0.95rem 1rem;
    color: var(--mc-muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
    border-bottom: 1px solid #e2e8f0;
}

.table tbody tr {
    transition: background 0.2s var(--mc-ease), transform 0.2s var(--mc-ease);
}

.table tbody tr:hover {
    background: rgba(67, 24, 255, 0.04) !important;
}

.table td {
    padding: 0.9rem 1rem;
    font-size: 0.9rem;
}

.table-hover tbody tr {
    cursor: default;
}

/* ─── Badges ─── */

.badge {
    font-weight: 600;
    padding: 0.4em 0.7em;
    border-radius: 8px;
    letter-spacing: 0.02em;
}

/* ─── Alerts (toast style) ─── */

.mc-alert {
    border: none;
    border-radius: var(--mc-radius-sm);
    padding: 1rem 1.15rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--mc-shadow-sm);
    animation: alertSlide 0.45s var(--mc-spring) both;
    border-left: 4px solid transparent;
}

@keyframes alertSlide {
    from {
        opacity: 0;
        transform: translateX(-16px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.mc-alert-success {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-left-color: var(--mc-success);
    color: #065f46;
}

.mc-alert-danger {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border-left-color: var(--mc-danger);
    color: #991b1b;
}

.mc-alert-warning {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border-left-color: var(--mc-warning);
    color: #92400e;
}

.mc-alert-info {
    background: linear-gradient(135deg, #fff1f2, #ffe4e6);
    border-left-color: var(--mc-primary);
    color: #4318ff;
}

/* ─── Dropdowns ─── */

.dropdown-menu {
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 16px;
    box-shadow: var(--mc-shadow);
    padding: 0.5rem;
    animation: dropdownIn 0.25s var(--mc-ease) both;
}

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dropdown-item {
    border-radius: 10px;
    padding: 0.6rem 0.85rem;
    font-weight: 500;
    font-size: 0.875rem;
    transition: background 0.15s var(--mc-ease), padding-left 0.15s var(--mc-ease);
}

.dropdown-item:hover {
    padding-left: 1rem;
}

/* ─── User avatar ─── */

.user-avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #fff;
    font-weight: 700;
    font-size: 0.88rem;
    background: linear-gradient(145deg, #868cff, #4318ff);
    box-shadow: 0 6px 16px rgba(67, 24, 255, 0.28);
    transition: transform 0.3s var(--mc-spring);
}

.user-avatar--sm {
    width: 34px;
    height: 34px;
    font-size: 0.78rem;
    border-radius: 10px;
}

.dropdown:hover .user-avatar {
    transform: scale(1.04);
}

.notification-badge {
    position: absolute;
    top: 6px;
    right: 7px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--mc-danger);
    border: 2px solid #fff;
    animation: notifPulse 2s ease-in-out infinite;
}

@keyframes notifPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* ─── Dashboard hero ─── */

.dashboard-hero {
    position: relative;
    padding: 1.7rem 1.45rem;
    border-radius: var(--mc-radius);
    background: linear-gradient(125deg, #4318ff 0%, #5b3fd6 48%, #868cff 100%);
    color: #fff;
    overflow: hidden;
    box-shadow: 0 18px 44px rgba(67, 24, 255, 0.28);
}

.dashboard-hero::before,
.dashboard-hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    animation: floatOrb 8s ease-in-out infinite;
}

.dashboard-hero::before {
    width: 200px;
    height: 200px;
    top: -80px;
    right: -40px;
}

.dashboard-hero::after {
    width: 120px;
    height: 120px;
    bottom: -40px;
    left: 20%;
    animation-delay: -4s;
}

@keyframes floatOrb {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(10px, -15px) scale(1.05); }
}

.dashboard-hero .hero-content {
    position: relative;
    z-index: 1;
}

.dashboard-hero h2 {
    font-family: var(--mc-display);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.35rem;
}

.hero-greeting-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
    font-size: 1.35rem;
    flex-shrink: 0;
}

.hero-role-badge {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #4318ff !important;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.hero-meta-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.8rem;
    font-weight: 600;
}

.hero-meta-pill--alert {
    background: rgba(254, 226, 226, 0.22);
    border-color: rgba(254, 202, 202, 0.45);
}

.dashboard-quick-actions .card-header,
.dashboard-panel .card-header {
    background: #fff;
}

.quick-action-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    height: 100%;
    padding: 1rem;
    border-radius: calc(var(--mc-radius) - 4px);
    border: 1px solid var(--mc-border, #e5e7eb);
    background: #fff;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.quick-action-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
    border-color: rgba(67, 24, 255, 0.28);
    color: inherit;
}

.quick-action-tile__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.85rem;
    font-size: 1.1rem;
}

.quick-action-tile__label {
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.3;
}

.dashboard-metric-card .stat-value {
    font-size: 2rem;
}

.dashboard-panel {
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05) !important;
}

.dashboard-table thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom-width: 1px;
    background: #f8fafc;
}

.dashboard-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 0.85rem;
    margin-bottom: 0.65rem;
    position: relative;
    border: 1px solid transparent;
}

.dashboard-alert-danger {
    background: rgba(254, 226, 226, 0.55);
    border-color: rgba(252, 165, 165, 0.45);
    color: #991b1b;
}

.dashboard-alert-warning {
    background: rgba(254, 243, 199, 0.55);
    border-color: rgba(252, 211, 77, 0.45);
    color: #92400e;
}

.dashboard-alert-info {
    background: rgba(219, 234, 254, 0.55);
    border-color: rgba(147, 197, 253, 0.45);
    color: #1d4ed8;
}

.dashboard-alert__icon {
    line-height: 1;
    font-size: 1rem;
    margin-top: 0.1rem;
}

.dashboard-alert__content {
    font-size: 0.875rem;
    line-height: 1.45;
}

/* ─── Empty state ─── */

.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--mc-muted);
}

.empty-state i {
    font-size: 2.5rem;
    opacity: 0.35;
    margin-bottom: 0.75rem;
    display: block;
    animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* ─── Pagination ─── */

.pagination .page-link {
    border-radius: 10px !important;
    margin: 0 2px;
    border: none;
    font-weight: 600;
    color: var(--mc-muted);
    transition: all 0.2s var(--mc-ease);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, var(--mc-primary), var(--mc-accent));
    box-shadow: 0 4px 12px rgba(67, 24, 255, 0.3);
}

.pagination .page-link:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
}

/* ─── Overlay mobile ─── */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1035;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.3s var(--mc-ease);
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
    animation: fadeIn 0.3s var(--mc-ease) both;
}

/* ─── Login page (glassmorphism) ─── */

.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    background: #2a1550;
    font-family: "DM Sans", system-ui, sans-serif;
}

.login-aurora {
    position: absolute;
    inset: -20%;
    background:
        radial-gradient(ellipse 55% 50% at 18% 28%, rgba(180, 90, 255, 0.85) 0%, transparent 55%),
        radial-gradient(ellipse 50% 45% at 82% 22%, rgba(90, 70, 255, 0.9) 0%, transparent 50%),
        radial-gradient(ellipse 60% 50% at 70% 78%, rgba(40, 30, 140, 0.95) 0%, transparent 55%),
        radial-gradient(ellipse 45% 40% at 25% 85%, rgba(120, 40, 200, 0.7) 0%, transparent 50%),
        linear-gradient(145deg, #1a0a3a 0%, #3b1d6e 40%, #5b2a9a 70%, #24105a 100%);
    filter: blur(28px);
    transform: scale(1.08);
    animation: loginAuroraDrift 18s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes loginAuroraDrift {
    from { transform: scale(1.05) translate(-1.5%, 1%); }
    to { transform: scale(1.12) translate(1.5%, -1.5%); }
}

.login-panel {
    width: 100%;
    max-width: 360px;
    position: relative;
    z-index: 1;
    text-align: center;
    animation: loginCardIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.25rem;
    border-radius: 18px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.28);
    display: grid;
    place-items: center;
    padding: 6px;
}

.login-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.login-title {
    margin: 0 0 1.75rem;
    font-size: 1.65rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: #fff;
    text-shadow: 0 2px 18px rgba(20, 10, 50, 0.35);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.login-field {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 52px;
    padding: 0.65rem 1.25rem;
    margin: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: text;
}

.login-field:focus-within {
    background: rgba(255, 255, 255, 0.26);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

.login-field i {
    color: rgba(255, 255, 255, 0.92);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.login-field input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #fff;
    font-size: 0.98rem;
    font-weight: 400;
    padding: 0;
    box-shadow: none !important;
}

.login-field input::placeholder {
    color: rgba(255, 255, 255, 0.62);
}

.login-field input:-webkit-autofill,
.login-field input:-webkit-autofill:hover,
.login-field input:-webkit-autofill:focus {
    -webkit-text-fill-color: #fff;
    transition: background-color 9999s ease-in-out 0s;
    box-shadow: 0 0 0 1000px rgba(90, 50, 150, 0.55) inset;
}

.login-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.15rem 0.35rem 0.35rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.82rem;
}

.login-remember {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    cursor: pointer;
    user-select: none;
}

.login-remember input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.login-remember-box {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1.5px solid rgba(255, 255, 255, 0.75);
    display: inline-grid;
    place-items: center;
    color: transparent;
    font-size: 0.7rem;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.login-remember input:checked + .login-remember-box {
    background: rgba(255, 255, 255, 0.95);
    border-color: #fff;
    color: #4c3480;
}

.login-forgot {
    color: rgba(255, 255, 255, 0.88);
    white-space: nowrap;
    opacity: 0.85;
}

.login-submit {
    width: 100%;
    min-height: 52px;
    margin-top: 0.35rem;
    border: 0;
    border-radius: 999px;
    background: #ebe4f5;
    color: #4a3f5c;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    box-shadow: 0 10px 28px rgba(20, 10, 50, 0.22);
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.login-submit:hover {
    background: #f4f0fa;
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(20, 10, 50, 0.28);
}

.login-submit:active {
    transform: translateY(0);
}

.login-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin: -0.5rem 0 1rem;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    background: rgba(67, 24, 255, 0.45);
    border: 1px solid rgba(255, 180, 180, 0.35);
    color: #fff;
    font-size: 0.86rem;
    text-align: left;
    backdrop-filter: blur(10px);
}

@keyframes loginCardIn {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ─── Responsive ─── */

html {
    overflow-x: clip;
}

body {
    overflow-x: clip;
}

body.sidebar-open,
html.sidebar-open {
    overflow: hidden;
}

.app-wrapper,
.main-content,
.page-content,
.page-shell {
    max-width: 100%;
    min-width: 0;
}

.main-content {
    width: 100%;
    overflow-x: clip;
}

img,
svg,
video,
canvas {
    max-width: 100%;
    height: auto;
}

.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    min-width: 520px;
}

.row > [class*="col-"] {
    min-width: 0;
}

.form-control,
.form-select,
.input-group,
textarea.form-control {
    max-width: 100%;
}

.card,
.card-body,
.card-header,
.card-footer {
    max-width: 100%;
}

.page-header,
.page-title-card__body,
.page-title-card__actions,
.d-flex.gap-2.flex-wrap {
    max-width: 100%;
}

.workflow-steps-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -0.25rem;
    padding: 0 0.25rem 0.25rem;
}

.workflow-steps-track {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: max-content;
    width: 100%;
}

.workflow-step-item {
    flex: 1 0 auto;
    min-width: 72px;
    max-width: 110px;
    text-align: center;
}

.workflow-step-circle {
    width: 32px;
    height: 32px;
}

.workflow-step-label {
    font-size: 0.72rem;
    line-height: 1.25;
    word-break: break-word;
}

.circuit-step-desc {
    font-size: 0.7rem;
    line-height: 1.25;
}

.circuit-step-tile {
    min-height: 100%;
}

@media (max-width: 991.98px) {
    .sidebar {
        width: min(var(--mc-sidebar-width), 86vw);
        transform: translateX(-105%);
        box-shadow: none;
    }

    .sidebar.collapsed {
        width: min(var(--mc-sidebar-width), 86vw);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 24px 0 48px rgba(0, 0, 0, 0.35);
    }

    .main-content {
        margin-left: 0 !important;
        width: 100%;
    }

    .top-navbar {
        margin: 0.65rem 0.65rem 0;
        border-radius: 14px;
        padding: 0.55rem 0.7rem;
    }

    .page-content {
        padding: 0.85rem 0.65rem 1.5rem;
    }

    .sidebar-footer {
        margin-bottom: 1rem;
    }

    .page-title-card__body {
        padding: 1rem;
        gap: 0.85rem;
    }

    .page-title-card__icon {
        width: 44px;
        height: 44px;
        font-size: 1.15rem;
    }

    .page-title-card__title {
        font-size: 1.2rem;
    }

    .dashboard-hero {
        padding: 1.15rem 1rem;
    }

    .dashboard-hero h2 {
        font-size: 1.25rem;
    }

    .stat-card .stat-value {
        font-size: 1.35rem;
    }

    .dashboard-chart-wrap {
        height: 220px;
    }

    .dashboard-chart-wrap--doughnut {
        height: 210px;
    }

    .dropdown-panel {
        min-width: min(280px, calc(100vw - 2rem));
        max-width: calc(100vw - 1.5rem);
    }

    .page-header.d-flex,
    .page-title-card__actions {
        width: 100%;
    }

    .page-header.d-flex > .d-flex,
    .page-header .btn,
    .page-title-card__actions .btn {
        flex: 1 1 auto;
    }

    .btn-group {
        flex-wrap: wrap;
        max-width: 100%;
    }

    .login-panel {
        margin: 0.5rem;
        max-width: 340px;
    }
}

@media (max-width: 767.98px) {
    .page-header h1 {
        font-size: 1.2rem;
    }

    .card-header,
    .card-body,
    .card-footer {
        padding-left: 0.95rem;
        padding-right: 0.95rem;
    }

    .form-card .card-body {
        padding: 1.1rem 0.95rem;
    }

    .table {
        min-width: 480px;
        font-size: 0.85rem;
    }

    .table thead th,
    .table td {
        padding: 0.7rem 0.65rem;
        white-space: nowrap;
    }

    .table .btn-sm {
        width: 32px;
        height: 32px;
    }

    /* Stack form action bars */
    form .d-flex.gap-2.mt-4,
    form .d-flex.gap-2.pt-3,
    .card-footer .d-flex {
        flex-direction: column;
        align-items: stretch !important;
    }

    form .d-flex.gap-2.mt-4 .btn,
    form .d-flex.gap-2.pt-3 .btn,
    .card-footer .d-flex .btn {
        width: 100%;
        justify-content: center;
    }

    .filter-panel .row > [class*="col-"] {
        margin-bottom: 0.15rem;
    }

    .dl.row dt,
    .dl.row dd,
    dl.row dt,
    dl.row dd {
        margin-bottom: 0.35rem;
    }

    .hero-meta {
        gap: 0.4rem !important;
    }

    .hero-meta-pill {
        font-size: 0.72rem;
        padding: 0.28rem 0.55rem;
    }
}

@media (max-width: 575.98px) {
    .top-navbar {
        margin: 0.5rem 0.5rem 0;
        padding: 0.5rem 0.55rem;
        gap: 0.4rem;
    }

    .breadcrumb-text {
        display: none !important;
    }

    .btn-user-menu .user-menu-caret,
    .btn-user-menu .user-menu-copy {
        display: none !important;
    }

    .page-content {
        padding: 0.7rem 0.5rem 1.35rem;
    }

    .page-title-card__main {
        width: 100%;
    }

    .page-title-card__actions {
        width: 100%;
    }

    .page-title-card__actions .btn {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: calc(50% - 0.25rem);
        justify-content: center;
    }

    .page-shell > .page-title-card ~ .page-header.d-flex {
        flex-direction: column;
        align-items: stretch !important;
    }

    .page-shell > .page-title-card ~ .page-header.d-flex > div:last-child,
    .page-header .d-flex.gap-2.flex-wrap {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem !important;
    }

    .page-header .btn {
        flex: 1 1 auto;
        justify-content: center;
        white-space: normal;
        text-align: center;
    }

    .circuit-step-desc {
        display: none;
    }

    .workflow-step-item {
        min-width: 64px;
        max-width: 88px;
    }

    .stat-card .card-body {
        padding: 0.95rem;
    }

    .quick-action-tile {
        padding: 0.85rem;
    }

    .quick-action-tile__label {
        font-size: 0.8rem;
    }

    .dashboard-alert {
        padding: 0.75rem;
    }

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.15rem;
    }

    .mc-pagination-meta {
        text-align: center;
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 400px) {
    .page-title-card__icon {
        display: none;
    }

    .brand-icon {
        width: 40px;
        height: 40px;
        font-size: 1.15rem;
    }

    .col-6.circuit-step-tile,
    .col-6 .circuit-step-tile {
        padding: 0.45rem 0.25rem !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ─── Extended UI polish ─── */

.filter-panel {
    margin-bottom: 1.25rem;
}

.filter-panel .card-body {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.95));
}

.filter-panel .form-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--mc-muted);
}

.data-card {
    overflow: hidden;
}

.data-card .card-footer {
    background: transparent;
    border-top: 1px solid rgba(226, 232, 240, 0.85);
    padding: 0.85rem 1.25rem;
}

.table .btn-group-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.btn-icon,
.table .btn-sm {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    line-height: 1;
    transition: transform 0.2s var(--mc-spring), box-shadow 0.2s var(--mc-ease), background 0.2s var(--mc-ease);
}

.table .btn-sm:not(.btn-icon-auto) {
    width: 34px;
    height: 34px;
}

.table .btn-sm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.1);
}

.table .btn-light {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.table .btn-light:hover {
    background: #fff;
    border-color: rgba(67, 24, 255, 0.28);
}

.table td.empty-cell {
    padding: 0 !important;
    border: none !important;
}

.mc-status {
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.45em 0.75em;
}

.mc-status-waiting { background: rgba(245, 158, 11, 0.15); color: #b45309; }
.mc-status-in_consultation { background: rgba(67, 24, 255, 0.12); color: #4318ff; }
.mc-status-completed { background: rgba(16, 185, 129, 0.15); color: #047857; }
.mc-status-cancelled { background: rgba(100, 116, 139, 0.15); color: #475569; }
.mc-status-active { background: rgba(16, 185, 129, 0.15); color: #047857; }
.mc-status-discharged { background: rgba(100, 116, 139, 0.15); color: #475569; }
.mc-status-critical { background: rgba(239, 68, 68, 0.15); color: #b91c1c; }
.mc-status-high { background: rgba(249, 115, 22, 0.15); color: #c2410c; }
.mc-status-medium { background: rgba(245, 158, 11, 0.15); color: #b45309; }
.mc-status-low { background: rgba(16, 185, 129, 0.15); color: #047857; }

.input-group-text {
    border-radius: var(--mc-radius-sm) 0 0 var(--mc-radius-sm);
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
}

.input-group .form-control {
    border-radius: 0 var(--mc-radius-sm) var(--mc-radius-sm) 0;
}

.input-group:focus-within .input-group-text {
    border-color: var(--mc-primary);
}

.input-group:focus-within {
    box-shadow: 0 0 0 4px rgba(67, 24, 255, 0.1);
    border-radius: var(--mc-radius-sm);
}

.mc-pagination-meta {
    font-size: 0.82rem;
    color: var(--mc-muted);
    font-weight: 500;
}

.mc-pagination-meta strong {
    color: var(--mc-text);
}

.form-card .card-header {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.form-card .card-body {
    padding: 1.5rem 1.35rem;
}

.form-section-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--mc-muted);
    margin: 1.25rem 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed #e2e8f0;
}

.form-section-title:first-child {
    margin-top: 0;
}

.sidebar .nav-link {
    animation: navFadeIn 0.4s var(--mc-ease) both;
}

.sidebar .nav-link:nth-child(2) { animation-delay: 0.02s; }
.sidebar .nav-link:nth-child(3) { animation-delay: 0.04s; }
.sidebar .nav-link:nth-child(4) { animation-delay: 0.06s; }
.sidebar .nav-link:nth-child(5) { animation-delay: 0.08s; }

@keyframes navFadeIn {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

.row.g-3 > [class*="col-"] .card,
.row.g-4 > [class*="col-"] .card {
    animation: fadeInUp 0.5s var(--mc-ease) both;
}

.row.g-3 > [class*="col-"]:nth-child(1) .card { animation-delay: 0.05s; }
.row.g-3 > [class*="col-"]:nth-child(2) .card { animation-delay: 0.1s; }
.row.g-3 > [class*="col-"]:nth-child(3) .card { animation-delay: 0.15s; }
.row.g-3 > [class*="col-"]:nth-child(4) .card { animation-delay: 0.2s; }

.dropdown-menu .dropdown-header {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mc-muted);
}

.top-navbar .breadcrumb-text .fw-bold,
.top-navbar .page-title-bar {
    letter-spacing: -0.02em;
}

.card.border-0.shadow-sm {
    border: 1px solid rgba(67, 24, 255, 0.08) !important;
    box-shadow: var(--mc-shadow-sm) !important;
}

.card.border-0.shadow-sm:hover {
    box-shadow: var(--mc-shadow) !important;
}

/* Bootstrap primary alignment */
.text-primary { color: var(--mc-primary) !important; }
.bg-primary { background-color: var(--mc-primary) !important; }
.bg-primary-subtle { background-color: rgba(67, 24, 255, 0.12) !important; }
.text-bg-primary { background-color: var(--mc-primary) !important; }
.btn-primary { --bs-btn-bg: var(--mc-primary); --bs-btn-border-color: var(--mc-primary); }
.link-primary { color: var(--mc-primary) !important; }
.border-primary { border-color: var(--mc-primary) !important; }
.form-check-input:checked {
    background-color: var(--mc-primary);
    border-color: var(--mc-primary);
}

.page-shell > .page-header,
.page-shell > .page-title-card,
.page-shell > .dashboard-hero,
.page-shell > .card,
.page-shell > .row,
.page-shell > .alert,
.page-shell > .mc-alert {
    animation: fadeInUp 0.5s var(--mc-ease) both;
}

/* ─── Page title card (cloud) ─── */

.page-title-card {
    position: relative;
    margin-bottom: 1.35rem;
    border-radius: var(--mc-radius);
    overflow: hidden;
    border: none;
    background: #fff;
    color: var(--mc-text);
    box-shadow: var(--mc-shadow-sm);
}

.page-title-card__glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 92% 18%, rgba(67, 24, 255, 0.08), transparent 42%),
        radial-gradient(circle at 8% 85%, rgba(134, 140, 255, 0.1), transparent 45%);
    animation: none;
}

@keyframes titleCardGlow {
    from { opacity: 0.85; }
    to { opacity: 1; }
}

.page-title-card__body {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.25rem 1.35rem;
}

.page-title-card__main {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.page-title-card__icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 16px;
    font-size: 1.35rem;
    color: #4318ff;
    background: rgba(67, 24, 255, 0.08);
    border: none;
    box-shadow: none;
}

.page-title-card__crumb {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--mc-muted);
    margin-bottom: 0.25rem;
}

.page-title-card__title {
    font-family: var(--mc-font);
    font-size: clamp(1.25rem, 2.2vw, 1.65rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0;
    line-height: 1.15;
    color: var(--mc-text);
}

.page-title-card__subtitle {
    margin: 0.35rem 0 0;
    font-size: 0.9rem;
    color: var(--mc-muted);
}

.page-title-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.page-title-card__actions .btn-light,
.page-title-card__actions .btn-outline-light {
    box-shadow: none;
    background: #f4f7fe;
    color: var(--mc-text);
    border: none;
}

/* Inline page-header after global title card → keep actions only */
.page-shell > .page-title-card ~ .page-title-card--inline {
    background: #fff;
    color: var(--mc-text);
    border: none;
    box-shadow: var(--mc-shadow-sm);
    margin-bottom: 1.15rem;
}

.page-shell > .page-title-card ~ .page-title-card--inline .page-title-card__glow {
    display: none;
}

.page-shell > .page-title-card ~ .page-title-card--inline .page-title-card__main {
    display: none;
}

.page-shell > .page-title-card ~ .page-title-card--inline .page-title-card__body {
    justify-content: flex-end;
    padding: 0.75rem 1rem;
}

.page-shell > .page-title-card ~ .page-header.d-flex > div:first-child:has(h1) {
    display: none;
}

.page-shell > .page-title-card ~ .page-header.d-flex {
    justify-content: flex-end;
    margin-bottom: 1.15rem;
    padding: 0.75rem 1rem;
    border-radius: var(--mc-radius-sm);
    background: #fff;
    border: 1px solid rgba(67, 24, 255, 0.1);
    box-shadow: var(--mc-shadow-sm);
}

.page-shell > .page-title-card ~ .page-header.mb-4:not(.d-flex) {
    display: none;
}

.user-avatar {
    background: linear-gradient(145deg, #868cff, #4318ff) !important;
}

.brand-icon {
    background: linear-gradient(145deg, #868cff 0%, #4318ff 55%, #2b0fcc 100%) !important;
    box-shadow: 0 10px 28px rgba(67, 24, 255, 0.4) !important;
}

/* Dashboard charts */
.dashboard-chart-card .card-header {
    background: linear-gradient(180deg, #fff, #fffbfb) !important;
}

.dashboard-chart-wrap {
    position: relative;
    width: 100%;
    height: 260px;
}

.dashboard-chart-wrap--doughnut {
    height: 240px;
    max-width: 280px;
    margin: 0 auto;
}


/* ─── Final mobile overrides (must stay last) ─── */

@media (max-width: 991.98px) {
    .sidebar {
        width: min(var(--mc-sidebar-width), 86vw) !important;
        transform: translateX(-105%);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    .page-content {
        padding: 0.85rem 0.65rem 1.5rem;
    }
    .top-navbar {
        margin: 0.65rem 0.65rem 0;
    }
    .page-title-card__body {
        padding: 1rem;
    }
    .page-title-card__icon {
        width: 44px;
        height: 44px;
        font-size: 1.15rem;
    }
    .page-title-card__title {
        font-size: 1.2rem;
    }
    .dashboard-chart-wrap { height: 220px; }
    .dashboard-chart-wrap--doughnut { height: 210px; }
}

@media (max-width: 767.98px) {
    form .d-flex.gap-2.mt-4,
    form .d-flex.gap-2.pt-3,
    form .border-top.d-flex,
    .card-footer .d-flex.gap-2 {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    form .d-flex.gap-2.mt-4 > .btn,
    form .d-flex.gap-2.pt-3 > .btn,
    form .border-top.d-flex > .btn,
    .card-footer .d-flex.gap-2 > .btn {
        width: 100%;
    }
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
    }
}

@media (max-width: 575.98px) {
    .breadcrumb-text { display: none !important; }
    .btn-user-menu .user-menu-copy,
    .btn-user-menu .user-menu-caret { display: none !important; }
    .page-content { padding: 0.7rem 0.5rem 1.35rem; }
    .page-title-card__actions { width: 100%; }
    .page-title-card__actions .btn {
        flex: 1 1 calc(50% - 0.25rem);
        justify-content: center;
    }
    .circuit-step-desc { display: none; }
    .dashboard-chart-wrap { height: 200px; }
}

.login-apps {
    margin-top: 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.login-apps a {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-size: 0.92rem;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
}
.login-apps a:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}
.top-navbar-right .btn-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
