:root {
    --crm-primary: #9333ea;
    --crm-primary-hover: #7e22ce;
    --crm-primary-light: #a855f7;
    --crm-primary-deep: #5b21b6;
    --crm-primary-soft: #f5f0fe;
    --crm-primary-muted: #ede9fe;
    --crm-primary-rgb: 147, 51, 234;
    --crm-primary-gradient: linear-gradient(135deg, #5b21b6 0%, #9333ea 55%, #a855f7 100%);
    --crm-sidebar-active: linear-gradient(135deg, #6d28d9 0%, #9333ea 100%);
    --crm-sidebar-active-hover: linear-gradient(135deg, #5b21b6 0%, #7e22ce 100%);
    --crm-sidebar-active-shadow: 0 4px 18px rgba(147, 51, 234, 0.38), 0 2px 6px rgba(91, 33, 182, 0.22);
    --crm-success: #059669;
    --crm-success-soft: #ecfdf5;
    --crm-danger: #dc2626;
    --crm-warning: #d97706;
    --crm-info: #0284c7;
    --crm-bg: #f8f6fc;
    --crm-surface: #ffffff;
    --crm-text: #1e1b4b;
    --crm-text-secondary: #4c4585;
    --crm-text-muted: #8b85a8;
    --crm-border: #e8e4f3;
    --crm-border-light: #f3f0fa;
    --crm-shadow-sm: 0 1px 2px rgba(30, 27, 75, 0.05);
    --crm-shadow: 0 4px 16px rgba(30, 27, 75, 0.06);
    --crm-shadow-md: 0 8px 28px rgba(30, 27, 75, 0.10);
    --crm-shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.15);
    --crm-radius: 10px;
    --crm-radius-lg: 16px;
    --crm-sidebar-width: 260px;
    --crm-header-height: 66px;
    --crm-transition: 0.2s ease;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    background-color: var(--crm-bg) !important;
    color: var(--crm-text);
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
    overflow-x: hidden;
}

a { text-decoration: none; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d8cff0; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--crm-primary-light); }

@keyframes crmFadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes crmFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
@keyframes crmPulseSoft {
    0%, 100% { box-shadow: 0 0 0 0 rgba(var(--crm-primary-rgb), 0); }
    50% { box-shadow: 0 0 0 8px rgba(var(--crm-primary-rgb), 0.10); }
}

/* ================= Topbar ================= */
#page-topbar {
    position: fixed;
    top: 0; left: var(--crm-sidebar-width); right: 0;
    height: var(--crm-header-height);
    background: var(--crm-surface);
    box-shadow: 0 4px 20px rgba(30, 27, 75, 0.06);
    z-index: 1002;
    display: flex;
    align-items: center;
    transition: left var(--crm-transition);
}
.navbar-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 16px;
}
.crm-header-left { display: flex; align-items: center; gap: 4px; }
.crm-header-icon, #vertical-menu-btn {
    width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px; color: var(--crm-text-secondary); border: none; background: transparent; font-size: 18px;
    transition: background var(--crm-transition), color var(--crm-transition);
}
.crm-header-icon:hover, #vertical-menu-btn:hover { background: var(--crm-primary-soft); color: var(--crm-primary); }
.crm-header-search { flex: 1; max-width: 420px; margin: 0 12px; }
.crm-search-wrap { position: relative; }
.crm-search-wrap i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--crm-text-muted); }
.crm-search-wrap input {
    width: 100%; height: 40px; border-radius: 10px; border: 1px solid var(--crm-border);
    background: var(--crm-bg); padding: 0 12px 0 40px; font-size: 13.5px; outline: none; transition: var(--crm-transition);
}
.crm-search-wrap input:focus { border-color: var(--crm-primary-light); background: var(--crm-surface); box-shadow: 0 0 0 3px rgba(var(--crm-primary-rgb), .12); }
.crm-search-results {
    display: none; position: absolute; top: calc(100% + 8px); left: 0; right: 0; max-height: 420px; overflow-y: auto;
    background: var(--crm-surface); border: 1px solid var(--crm-border); border-radius: 12px;
    box-shadow: var(--crm-shadow-lg); z-index: 1050; padding: 8px;
}
.crm-search-results.is-open { display: block; }
.crm-search-group-title { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--crm-text-muted); padding: 8px 10px 4px; }
.crm-search-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; transition: background var(--crm-transition); }
.crm-search-item:hover, .crm-search-item.is-active { background: var(--crm-primary-soft); }
.crm-search-item-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--crm-primary-soft); color: var(--crm-primary); display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.crm-search-item-label { font-size: 13.3px; font-weight: 600; color: var(--crm-text); line-height: 1.3; }
.crm-search-item-sub { font-size: 11.5px; color: var(--crm-text-muted); }
.crm-search-empty, .crm-search-hint { padding: 16px 10px; text-align: center; font-size: 12.5px; color: var(--crm-text-muted); }
.crm-header-right { display: flex; align-items: center; gap: 6px; }
.crm-notif-badge {
    position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
    background: var(--crm-danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.crm-notif-dropdown { width: 340px; max-width: 90vw; padding: 0; overflow: hidden; }
.crm-notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--crm-border-light); font-weight: 700; font-size: 13.5px; }
.crm-notif-markall { border: none; background: transparent; color: var(--crm-primary); font-size: 11.5px; font-weight: 600; padding: 0; }
.crm-notif-markall:hover { color: var(--crm-primary-deep); }
.crm-notif-list { max-height: 360px; overflow-y: auto; }
.crm-notif-empty { padding: 24px 14px; text-align: center; font-size: 12.5px; color: var(--crm-text-muted); }
.crm-notif-item { display: block; padding: 11px 14px; border-bottom: 1px solid var(--crm-border-light); font-size: 13px; color: var(--crm-text); }
.crm-notif-item:hover { background: var(--crm-primary-soft); }
.crm-notif-item.is-unread { background: var(--crm-primary-soft); }
.crm-notif-item:last-child { border-bottom: none; }
.crm-notif-time { display: block; font-size: 11px; color: var(--crm-text-muted); margin-top: 3px; }
.crm-user-btn { display: flex; align-items: center; gap: 8px; border: none; background: transparent; padding: 6px 10px 6px 6px; border-radius: 10px; }
.crm-user-btn:hover { background: var(--crm-primary-soft); }
.crm-user-avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--crm-primary-gradient);
    color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px;
    box-shadow: 0 4px 12px rgba(var(--crm-primary-rgb), .35);
}
.crm-user-name { display: block; font-weight: 600; font-size: 13px; color: var(--crm-text); text-align: left; }
.crm-user-role { display: block; font-size: 11px; color: var(--crm-text-muted); text-align: left; }

/* ================= Sidebar ================= */
.vertical-menu {
    position: fixed; top: 0; left: 0; bottom: 0; width: var(--crm-sidebar-width);
    background: linear-gradient(180deg, #ffffff 0%, #fcfbff 100%);
    border-right: 1px solid var(--crm-border);
    z-index: 1003; overflow-y: auto; transition: left var(--crm-transition), transform var(--crm-transition);
}
.crm-sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--crm-border-light); min-height: var(--crm-header-height); background: linear-gradient(180deg, #ffffff 0%, #faf8ff 100%); }
.crm-sidebar-brand .crm-logo-icon {
    width: 40px; height: 40px; border-radius: 12px; background: var(--crm-primary-gradient);
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 20px; flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(var(--crm-primary-rgb), .35);
}
.crm-sidebar-brand .crm-logo-text { font-weight: 700; font-size: 17px; color: var(--crm-text); line-height: 1.1; }
.crm-sidebar-brand .crm-logo-sub { font-size: 10.5px; color: var(--crm-text-muted); letter-spacing: .05em; font-weight: 600; }
#sidebar-menu { padding: 14px 12px 30px; }
#sidebar-menu .menu-title { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--crm-text-muted); padding: 16px 12px 6px; font-weight: 700; }
#sidebar-menu .menu-title:first-child { padding-top: 4px; }
#sidebar-menu ul { list-style: none; margin: 0; padding: 0; }
#sidebar-menu li a {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 3px;
    border-radius: 10px; color: var(--crm-text-secondary); font-size: 13.7px; font-weight: 500;
    transition: background var(--crm-transition), color var(--crm-transition), box-shadow var(--crm-transition);
}
#sidebar-menu li a i { font-size: 17px; width: 20px; text-align: center; color: var(--crm-text-muted); transition: color var(--crm-transition); }
#sidebar-menu li a:hover:not(.active) { background: var(--crm-primary-soft); color: var(--crm-primary-deep); }
#sidebar-menu li a:hover:not(.active) i { color: var(--crm-primary); }
#sidebar-menu li a.active {
    background: var(--crm-sidebar-active); color: #fff; font-weight: 600;
    box-shadow: var(--crm-sidebar-active-shadow);
}
#sidebar-menu li a.active i { color: #fff; }
#sidebar-menu li a.active:hover { background: var(--crm-sidebar-active-hover); }

/* ================= Main content ================= */
.main-content { margin-left: var(--crm-sidebar-width); padding-top: var(--crm-header-height); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left var(--crm-transition); }
.page-content { flex: 1; padding: 24px 28px 32px; }
.footer { padding: 16px 28px; border-top: 1px solid var(--crm-border); font-size: 12.5px; color: var(--crm-text-muted); background: var(--crm-surface); }

body.sidebar-collapsed .vertical-menu { left: calc(-1 * var(--crm-sidebar-width)); }
body.sidebar-collapsed #page-topbar { left: 0; }
body.sidebar-collapsed .main-content { margin-left: 0; }

/* ================= Page header ================= */
.crm-page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; animation: crmFadeUp .45s ease both; }
.crm-page-title { font-size: 22px; font-weight: 700; color: var(--crm-text); margin: 0; letter-spacing: -0.01em; }
.crm-page-sub { font-size: 13px; color: var(--crm-text-muted); margin: 3px 0 0; }
.crm-breadcrumb { font-size: 12.5px; color: var(--crm-text-muted); font-weight: 500; }
.crm-breadcrumb:hover { color: var(--crm-primary); }

/* ================= Dashboard hero ================= */
.crm-hero {
    position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    margin-bottom: 24px; padding: 30px 34px; border-radius: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f6f1fe 45%, #ede4fb 100%);
    border: 1px solid #e4d9f7;
    box-shadow: 0 10px 30px rgba(91, 33, 182, 0.08);
    animation: crmFadeUp .5s ease both;
}
.crm-hero::before {
    content: ''; position: absolute; top: -70px; right: 120px; width: 240px; height: 240px; border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--crm-primary-rgb), .16) 0%, transparent 70%); pointer-events: none;
}
.crm-hero-greeting { display: block; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--crm-primary-deep); margin-bottom: 6px; }
.crm-hero h1 { font-size: 30px; font-weight: 800; color: var(--crm-text); margin: 0 0 8px; line-height: 1.15; position: relative; z-index: 1; }
.crm-hero p { font-size: 14px; color: var(--crm-text-secondary); margin: 0; max-width: 460px; line-height: 1.55; position: relative; z-index: 1; }
.crm-hero-orb { position: absolute; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffffff 0%, #ede4fb 60%, #ddd0f5 100%); border: 1px solid rgba(147,51,234,.12); box-shadow: 0 12px 30px rgba(91,33,182,.14), inset 0 1px 0 rgba(255,255,255,.9); display: flex; align-items: center; justify-content: center; }
.crm-hero-orb i { color: var(--crm-primary); }
.crm-hero-orb--1 { width: 150px; height: 150px; right: 30px; bottom: -10px; font-size: 48px; animation: crmFloat 4s ease-in-out infinite; z-index: 1; }
.crm-hero-orb--2 { width: 96px; height: 96px; right: 150px; top: 6px; font-size: 32px; animation: crmFloat 3.3s ease-in-out infinite reverse; z-index: 2; }
.crm-hero-date {
    position: absolute; top: 20px; right: 20px; z-index: 3;
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px;
    background: #ffffff; border: 1px solid #e4d9f7; color: var(--crm-primary-deep); font-size: 12px; font-weight: 600;
    box-shadow: 0 4px 14px rgba(91,33,182,.08);
}

/* ================= Cards ================= */
.card { border: 1px solid var(--crm-border); border-radius: var(--crm-radius-lg); box-shadow: var(--crm-shadow-sm); animation: crmFadeUp .5s ease both; }
.card-header { background: transparent; border-bottom: 1px solid var(--crm-border-light); font-weight: 600; padding: 16px 20px; }
.card-body { padding: 20px; }

.crm-kpi-card {
    position: relative; overflow: hidden; height: 100%; min-height: 118px;
    border-radius: var(--crm-radius-lg); border: 1px solid var(--crm-border); border-left: 4px solid var(--crm-primary);
    background: var(--crm-surface); padding: 20px; box-shadow: var(--crm-shadow-sm);
    display: flex; align-items: center; gap: 16px;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
    animation: crmFadeUp .5s ease both;
}
.crm-kpi-card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(91,33,182,.12); border-color: #ddd6fe; }
.crm-kpi-icon { width: 50px; height: 50px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff; flex-shrink: 0; animation: crmPulseSoft 2.8s ease-in-out infinite; }
.crm-kpi-body { min-width: 0; }
.crm-kpi-value { font-size: 26px; font-weight: 800; color: var(--crm-text); margin: 0 0 2px; line-height: 1; }
.crm-kpi-label { font-size: 12.5px; color: var(--crm-text-muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-kpi-hint { font-size: 11px; color: var(--crm-text-muted); font-weight: 500; margin-top: 2px; }

/* ================= Buttons ================= */
.btn { border-radius: 9px !important; font-weight: 600 !important; font-size: 13.5px !important; transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease !important; }
.btn-primary { background: var(--crm-primary-gradient); border: none; box-shadow: none; }
.btn-primary:hover, .btn-primary:focus { background: var(--crm-sidebar-active-hover); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(var(--crm-primary-rgb), .3); }
.btn-outline-primary { color: var(--crm-primary); border-color: var(--crm-primary-light); }
.btn-outline-primary:hover { background: var(--crm-primary); border-color: var(--crm-primary); transform: translateY(-1px); }
.btn-soft-primary { background: var(--crm-primary-soft); color: var(--crm-primary-deep); border: 1px solid #d8b4fe; }
.btn-soft-primary:hover { background: var(--crm-primary); color: #fff; border-color: var(--crm-primary); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(var(--crm-primary-rgb), .28); }
.btn-outline-danger { color: var(--crm-danger); border-color: #fca5a5; background: #fef2f2; }
.btn-outline-danger:hover { background: var(--crm-danger); border-color: var(--crm-danger); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(220,38,38,.28); }
.btn-outline-success { color: var(--crm-success); border-color: #6ee7b7; background: #ecfdf5; }
.btn-outline-success:hover { background: var(--crm-success); border-color: var(--crm-success); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(5,150,105,.28); }
.crm-page-header .btn { border-radius: 999px !important; padding: 10px 20px !important; }

/* ================= Tables ================= */
.table thead th { background: var(--crm-bg); color: var(--crm-text-secondary); font-size: 11.3px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; border-bottom: 1px solid var(--crm-border); border-top: none; white-space: nowrap; padding: 13px 16px; position: sticky; top: 0; z-index: 1; }
.table td { vertical-align: middle; font-size: 13.3px; color: var(--crm-text); padding: 12px 16px; border-bottom: 1px solid var(--crm-border-light); }
.table-hover tbody tr { transition: background var(--crm-transition); }
.table-hover tbody tr:hover { background: var(--crm-primary-soft); }
.badge { font-weight: 700; font-size: 10.8px; padding: 5px 10px; letter-spacing: .02em; }
.card > .table-responsive { padding: 6px; }
.card > .table-responsive .table { margin-bottom: 0; }

/* Table action buttons */
.table td .btn-sm { min-width: 32px; min-height: 32px; padding: 6px 10px !important; font-size: 12px !important; border-radius: 8px !important; }

/* ================= Auth pages ================= */
.crm-auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
    background:
        radial-gradient(circle at top right, rgba(var(--crm-primary-rgb), .14) 0%, transparent 42%),
        radial-gradient(circle at bottom left, rgba(91, 33, 182, .12) 0%, transparent 40%),
        var(--crm-bg);
}
.crm-auth-card { background: var(--crm-surface); border: 1px solid var(--crm-border); border-radius: 18px; width: 100%; max-width: 410px; box-shadow: 0 20px 60px rgba(30, 27, 75, .14); overflow: hidden; animation: crmFadeUp .5s ease both; }
.crm-auth-brand { text-align: center; padding: 34px 28px 26px; border-bottom: 1px solid var(--crm-border-light); background: linear-gradient(180deg, #ffffff 0%, #faf8ff 100%); }
.crm-auth-body { padding: 28px 30px 32px; }
.crm-auth-logo { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.crm-auth-logo .crm-logo-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--crm-primary-gradient); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 26px; box-shadow: 0 8px 20px rgba(var(--crm-primary-rgb), .3); }

/* ================= Misc ================= */
.crm-avatar-sm { width: 32px; height: 32px; border-radius: 50%; background: var(--crm-primary-soft); color: var(--crm-primary-deep); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px; flex-shrink: 0; }
.progress { height: 8px; border-radius: 6px; background: var(--crm-primary-soft); overflow: hidden; }
.progress-bar { background: var(--crm-primary-gradient); transition: width .5s ease; }
.nav-tabs { border-bottom: 1px solid var(--crm-border); }
.nav-tabs .nav-link { color: var(--crm-text-muted); font-weight: 600; font-size: 13.3px; border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 4px; margin-right: 22px; }
.nav-tabs .nav-link.active { color: var(--crm-primary); border-color: var(--crm-primary); background: transparent; }
.modal-content { border: 1px solid var(--crm-border); border-radius: var(--crm-radius-lg); box-shadow: var(--crm-shadow-lg); }
.modal-header { border-bottom: 1px solid var(--crm-border-light); padding: 18px 22px; }
.modal-body { padding: 22px; }
.modal-footer { border-top: 1px solid var(--crm-border-light); padding: 16px 22px; }
.form-label { font-size: 12.5px; font-weight: 600; color: var(--crm-text-secondary); }
.form-control, .form-select { font-size: 13.5px; border-color: var(--crm-border); border-radius: 9px; padding: 9px 13px; min-height: 40px; }
.form-control:focus, .form-select:focus { border-color: var(--crm-primary-light); box-shadow: 0 0 0 3px rgba(var(--crm-primary-rgb), .12); }
.dropdown-menu { border: 1px solid var(--crm-border); border-radius: var(--crm-radius); box-shadow: var(--crm-shadow-md); padding: 6px; }
.dropdown-item { border-radius: 7px; padding: 8px 12px; font-size: 13.5px; }
.dropdown-item:hover { background: var(--crm-primary-soft); }
.crm-sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(30, 27, 75, .45); z-index: 1001; }

/* Animation stagger for stat card rows */
.row.g-3 > [class*="col-"]:nth-child(1) .crm-kpi-card { animation-delay: .04s; }
.row.g-3 > [class*="col-"]:nth-child(2) .crm-kpi-card { animation-delay: .09s; }
.row.g-3 > [class*="col-"]:nth-child(3) .crm-kpi-card { animation-delay: .14s; }
.row.g-3 > [class*="col-"]:nth-child(4) .crm-kpi-card { animation-delay: .19s; }

/* ================= Project timeline ================= */
.crm-project-strip { display: flex; flex-wrap: wrap; gap: 22px 34px; align-items: center; }
.crm-project-strip-item { min-width: 140px; }
.crm-project-strip-progress { flex: 1; min-width: 220px; }

.crm-timeline { position: relative; }
.crm-timeline-item { display: flex; gap: 18px; }
.crm-timeline-marker { display: flex; flex-direction: column; align-items: center; width: 40px; flex-shrink: 0; }
.crm-timeline-num { font-size: 11px; color: var(--crm-text-muted); font-weight: 700; margin-bottom: 6px; }
.crm-timeline-dot {
    width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 700; color: #fff; flex-shrink: 0; z-index: 1;
}
.crm-timeline-dot.is-done { background: var(--crm-success); }
.crm-timeline-dot.is-progress { background: var(--crm-info); box-shadow: 0 0 0 4px rgba(2, 132, 199, .15); }
.crm-timeline-dot.is-progress i { animation: crmSpin 1.8s linear infinite; }
.crm-timeline-dot.is-pending { background: var(--crm-surface); color: var(--crm-text-muted); border: 2px solid var(--crm-border); }
.crm-timeline-dot.is-pending::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--crm-border); }
.crm-timeline-dot.is-payment { background: var(--crm-warning); }
.crm-timeline-line { flex: 1; width: 2px; min-height: 26px; background: var(--crm-border); margin-top: 4px; }
.crm-timeline-item.is-done .crm-timeline-line { background: var(--crm-success); }
.crm-timeline-item.is-progress .crm-timeline-line { background: var(--crm-info); }
@keyframes crmSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.crm-timeline-content { flex: 1; min-width: 0; padding-bottom: 26px; border-bottom: 1px solid var(--crm-border-light); margin-bottom: 26px; }
.crm-timeline-item:last-child .crm-timeline-content { padding-bottom: 0; border-bottom: none; margin-bottom: 0; }
.crm-timeline-title { font-weight: 700; font-size: 15px; color: var(--crm-text); margin-bottom: 8px; }
.crm-timeline-pill { display: inline-flex; align-items: center; flex-shrink: 0; white-space: nowrap; padding: 3px 11px; border-radius: 999px; font-size: 11.3px; font-weight: 700; line-height: 1.4; }
.crm-timeline-pill.done { background: var(--crm-success-soft); color: var(--crm-success); }
.crm-timeline-pill.inprogress { background: #e0f2fe; color: var(--crm-info); }
.crm-timeline-pill.pending { background: var(--crm-border-light); color: var(--crm-text-muted); }
.crm-timeline-pill.payment-due { background: #fef3c7; color: #b45309; }
.crm-timeline-meta { font-size: 12.3px; color: var(--crm-text-muted); }
.crm-timeline-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.crm-timeline-actions .form-select { min-height: 32px; font-size: 12px; padding: 4px 28px 4px 10px; width: auto; }
.crm-timeline-actions .task-assign { max-width: 150px; }
.crm-timeline-actions .btn-sm { min-height: 32px; }

.crm-payment-card { background: #fffaf0; border: 1px solid #fde3c4; border-radius: 14px; padding: 18px; margin-top: 4px; }
.crm-payment-label { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #b45309; }
.crm-payment-amount { font-size: 24px; font-weight: 800; color: #b45309; }
.crm-payment-progress { height: 8px; background: #fde3c4; margin-top: 12px; }
.crm-payment-progress .progress-bar { background: var(--crm-warning); }
.crm-payment-sub { font-size: 12.3px; color: #92400e; margin: 10px 0 0; }
.crm-payment-btn { display: block; width: 100%; margin-top: 14px; background: var(--crm-warning); color: #fff; border: none; padding: 11px; font-size: 14px; text-align: center; }
.crm-payment-btn:hover { background: #b45309; color: #fff; }

@media print {
    #page-topbar, .vertical-menu, .footer, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; padding-top: 0 !important; }
}

/* ================= Responsive ================= */
@media (max-width: 991.98px) {
    .vertical-menu { transform: translateX(-100%); transition: transform .28s ease; box-shadow: none; }
    body.sidebar-open .vertical-menu { transform: translateX(0); box-shadow: 4px 0 24px rgba(30,27,75,.18); }
    body.sidebar-open .crm-sidebar-overlay { display: block; }
    body.sidebar-open { overflow: hidden; }
    #page-topbar { left: 0; }
    .main-content { margin-left: 0; }
    #page-topbar, .navbar-header { height: 58px; }
    .main-content { padding-top: 58px; }
    .navbar-header { padding: 0 14px; }
    .crm-header-search { display: none; }
    .crm-hero { flex-direction: column; align-items: flex-start; padding: 24px 20px; }
    .crm-hero h1 { font-size: 24px; }
    .crm-hero-orb { display: none; }
    .crm-hero-date { position: static; margin-top: 14px; }
    .card-body { padding: 16px; }
    .card-header { padding: 13px 16px; }
}

@media (max-width: 767.98px) {
    .page-content { padding: 16px; padding-bottom: 24px; }
    .crm-page-header { flex-direction: column; align-items: flex-start; }
    .crm-page-header .btn { width: 100%; justify-content: center; }
    .crm-page-title { font-size: 19px; }
    .crm-kpi-card { min-height: 100px; padding: 16px; }
    .crm-kpi-value { font-size: 21px; }
    .modal-body, .modal-header, .modal-footer { padding: 16px; }
    .crm-timeline-item { gap: 10px; flex-wrap: nowrap; }
    .crm-timeline-marker { width: 30px; }
    .crm-timeline-dot { width: 28px; height: 28px; font-size: 13px; }
    .crm-timeline-title { font-size: 14px; }
    .crm-timeline-actions { flex-wrap: wrap; }
    .crm-payment-card { padding: 14px; }
    .crm-payment-amount { font-size: 20px; }
}

@media (max-width: 575.98px) {
    .crm-auth-card { max-width: 100%; }
    .crm-auth-body { padding: 22px 20px 26px; }
    .table td, .table th { padding: 10px 12px; }
}
