:root {
    /* Brand - ALCV red, refined into a deeper, richer scarlet */
    --primary: #C40D17;
    --primary-dark: #8E0610;
    --primary-light: #F0353F;

    /* Accent - champagne gold for a premium, understated highlight */
    --accent: #CBA864;
    --accent-soft: rgba(203, 168, 100, 0.14);

    /* Surfaces - deep, warm near-black with layered elevation */
    --bg-dark: #0B0E15;
    --bg-base: #0B0E15;
    --bg-card: #141925;
    --bg-card-hover: #1C2333;
    --surface-2: #1C2333;

    /* Text - soft off-white, never harsh pure white */
    --text-primary: #EEF1F6;
    --text-secondary: #A6AEBF;
    --text-muted: #7B8499;

    /* Borders - subtle translucent hairlines */
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.12);

    /* Alias tokens (đồng bộ - tránh fallback sáng lòi ra trên nền tối) */
    --bg-secondary: #1C2333;
    --bg-tertiary: #232B3D;
    --border-color: rgba(255, 255, 255, 0.07);

    --success: #2BBF6E;
    --warning: #E0A437;
    --info: #4C8DF6;
    --danger: #E5484D;

    --gradient-primary: linear-gradient(135deg, #C40D17 0%, #F0353F 100%);
    --gradient-accent: linear-gradient(135deg, #CBA864 0%, #E7CE97 100%);

    /* Layered, soft shadows for depth */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 8px 28px rgba(196, 13, 23, 0.32);

    --radius-sm: 8px;
    --radius-md: 10px;
    --radius: 14px;
    --radius-lg: 20px;

    /* Easing & thời lượng chuẩn cho vi tương tác (tránh transition: all rời rạc) */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --dur: 0.2s;
}

/* Loading Overlay - tông nền brand + mờ hậu cảnh, hiện/ẩn mượt bằng opacity */
.loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 1.15rem;
    background: rgba(11, 14, 21, 0.72);
    backdrop-filter: blur(10px) saturate(115%);
    -webkit-backdrop-filter: blur(10px) saturate(115%);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s var(--ease, ease), visibility 0.3s var(--ease, ease);
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Badge môi trường UAT — luôn nổi trên cùng để không nhầm với production */
.uat-badge {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    padding: 0.2rem 0.9rem;
    background: var(--warning, #E0A437);
    color: #1a1205;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    user-select: none;
}

/* M6 — form ghi nhận cuộc hẹn (Sale): gợi ý mặc định + sticky submit + tap target */
.form-hint-inline {
    font-weight: 400;
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0;
}

/* Nút "Lưu cuộc hẹn" của thẻ LP luôn trong tầm tay khi cuộn (đặc biệt trên mobile) */
.lp-submit-sticky {
    position: sticky;
    bottom: 12px;
    z-index: 5;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

@media (max-width: 768px) {
    .outcome-option { min-height: 56px; }
    .grade-option { min-height: 44px; }
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(192, 0, 0, 0.2);
    border-top-color: #C00000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Speed Optimizations */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Instant feedback on touch */
.btn:active,
.grade-option:active,
.outcome-option:active,
.export-card:active,
.lead-row-card:active,
.time-btn:active {
    transform: scale(0.97);
}

/* Smooth page transitions */
.admin-onepage-container,
.lp-simple-container {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Toast slide animation */
.toast {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

/* Optimistic update pulse */
.updating {
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
}

/*
   LOGIN SCREEN
 */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1a2e 100%);
}

.login-card {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.login-card h2 {
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.demo-accounts {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.demo-accounts p {
    margin-bottom: 0.5rem;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/*
   LOGO
 */
.logo,
.login-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
}

.logo-text {
    font-weight: 600;
    font-size: 1.1rem;
}

.logo-text span {
    color: var(--primary);
}

/*
   ADMIN/MANAGER: ALL-IN-ONE PAGE
 */
.admin-onepage-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 0.4rem;
}

.admin-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-header-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.welcome-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.welcome-text strong {
    color: var(--text-primary);
}

.logout-header-btn {
    color: var(--danger) !important;
}

.admin-main {
    flex: 1;
    padding: 1rem 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* Stats Row - 5 equal columns for better alignment */
.admin-stats-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

/* Leads list section (full width) */
.admin-leads-section {
    margin-bottom: 1rem;
}

/* Widget */
.admin-widget {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.admin-full-width {
    margin-bottom: 1.5rem;
}

.widget-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.widget-header h2 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.widget-actions {
    display: flex;
    gap: 0.6rem 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Filter trong header widget: không co quá hẹp, vẫn xuống dòng khi chật */
.widget-actions .form-select-sm {
    min-width: 132px;
}

.widget-body {
    max-height: 350px;
    overflow-y: auto;
}

/* Export Row */
.admin-export-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

/*
   LP: SIMPLE CENTERED VIEW
 */
.lp-simple-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1a2e 100%);
}

.lp-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    gap: 0.5rem;
}

.lp-header-center {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lp-user-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card-hover);
    padding: 0.5rem 1rem;
    border-radius: 12px;
}

/* LP Score Stats in Header */
.lp-score-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0 0.5rem;
    max-width: 400px;
}

.lp-stat-item {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    background: var(--bg-card-hover);
    transition: all var(--dur) var(--ease);
}

.lp-stat-item .stat-grade {
    font-weight: 700;
    font-size: 0.85rem;
}

.lp-stat-item .stat-count {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.lp-stat-item.grade-a {
    border-left: 3px solid #15803d;
}

.lp-stat-item.grade-a .stat-grade {
    color: #4ade80;
}

.lp-stat-item.grade-b {
    border-left: 3px solid #22c55e;
}

.lp-stat-item.grade-b .stat-grade {
    color: #86efac;
}

.lp-stat-item.grade-c {
    border-left: 3px solid #eab308;
}

.lp-stat-item.grade-c .stat-grade {
    color: #fde047;
}

.lp-stat-item.grade-d {
    border-left: 3px solid #f97316;
}

.lp-stat-item.grade-d .stat-grade {
    color: #fdba74;
}

.lp-stat-item.grade-s {
    border-left: 3px solid #FFD700;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 193, 7, 0.05));
}

.lp-stat-item.grade-s .stat-grade {
    color: #FFD700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.lp-stat-item.grade-f {
    border-left: 3px solid #ef4444;
}

.lp-stat-item.grade-f .stat-grade {
    color: #fca5a5;
}

.lp-stat-item .stat-pct {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

.lp-stat-total {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
}

/* Admin Score Stats in Header */
.admin-score-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-right: 0.5rem;
    max-width: 320px;
}

.admin-stat-item {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    background: var(--bg-card-hover);
    font-size: 0.7rem;
}

.admin-stat-item .stat-grade {
    font-weight: 700;
    font-size: 0.75rem;
}

.admin-stat-item .stat-count {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.admin-stat-item .stat-pct {
    display: none;
    /* Hidden to save space */
}

.admin-stat-item.grade-a {
    border-left: 2px solid #15803d;
}

.admin-stat-item.grade-a .stat-grade {
    color: #4ade80;
}

.admin-stat-item.grade-b {
    border-left: 2px solid #22c55e;
}

.admin-stat-item.grade-b .stat-grade {
    color: #86efac;
}

.admin-stat-item.grade-c {
    border-left: 2px solid #eab308;
}

.admin-stat-item.grade-c .stat-grade {
    color: #fde047;
}

.admin-stat-item.grade-d {
    border-left: 2px solid #f97316;
}

.admin-stat-item.grade-d .stat-grade {
    color: #fdba74;
}

.admin-stat-item.grade-s {
    border-left: 2px solid #FFD700;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 193, 7, 0.05));
}

.admin-stat-item.grade-s .stat-grade {
    color: #FFD700;
    text-shadow: 0 0 6px rgba(255, 215, 0, 0.4);
}

.admin-stat-item.grade-f {
    border-left: 2px solid #ef4444;
}

.admin-stat-item.grade-f .stat-grade {
    color: #fca5a5;
}

.admin-stat-total {
    display: flex;
    align-items: center;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    background: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
}

.lp-user-info {
    text-align: left;
}

.lp-main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 1.25rem;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    align-items: start;
}

.lp-stat-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    background: var(--bg-card-hover);
    transition: all var(--dur) var(--ease);
    cursor: pointer;
}

.lp-stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* LP Cards - Compact */
.lp-card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 1.25rem;
    width: 100%;
}

.lp-meeting-card h2 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.lp-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.lp-select {
    font-size: 1rem;
    padding: 1rem;
}

.lp-toggle .toggle-option {
    padding: 1rem;
    font-size: 1rem;
}

.lp-time-picker {
    justify-content: center;
}

.lp-time-picker .time-btn {
    padding: 0.75rem 1rem;
}

.lp-outcome {
    grid-template-columns: repeat(2, 1fr);
}

.lp-outcome .outcome-option {
    padding: 0.875rem;
}

.lp-outcome .outcome-icon {
    font-size: 1.5rem;
}

.lp-stars {
    justify-content: center;
    font-size: 2rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* LP Leads Card */
.lp-leads-card {
    padding: 1.25rem;
}

.lp-leads-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.lp-leads-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.lp-lead-count {
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.lp-leads-list {
    max-height: 600px;
    overflow-y: auto;
}

.lp-lead-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem;
    background: var(--bg-dark);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all var(--dur) var(--ease);
}

.lp-lead-item:hover {
    background: var(--bg-card-hover);
}

.lp-lead-item .lead-info {
    flex: 1;
}

.lp-lead-item .lead-name {
    font-weight: 500;
    margin-bottom: 0.125rem;
}

.lp-lead-item .lead-phone {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/*
   COMMON COMPONENTS
 */

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--dur) var(--ease);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Stats Cards - Compact */
.stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 0.875rem;
    border: 1px solid var(--border);
    transition: all 0.3s var(--ease);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.stat-icon.red {
    background: rgba(192, 0, 0, 0.15);
    color: var(--primary);
}

.stat-icon.green {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.stat-icon.blue {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.stat-icon.yellow {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Search & Filter */
.search-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card-hover);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    min-width: 200px;
}

.search-box input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 100%;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.form-select-sm {
    background: var(--bg-card-hover);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
}

/* Table */
.table-container {
    overflow-x: auto;
}

.lead-table {
    width: 100%;
    border-collapse: collapse;
}

.lead-table th,
.lead-table td {
    padding: 1rem 1.25rem;
    text-align: left;
}

.lead-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.lead-table tr {
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--dur) var(--ease);
}

.lead-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.lead-name {
    font-weight: 500;
}

.lead-phone {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Badges */
.stage-badge {
    display: inline-block;
    white-space: nowrap;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
}

.stage-badge.contacted {
    background: rgba(168, 85, 247, 0.2);
    color: #d8b4fe;
}

.stage-badge.meeting {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

.stage-badge.negotiating {
    background: rgba(192, 0, 0, 0.2);
    color: #fca5a5;
}

.stage-badge.won {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.stage-badge.lost {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* Meetings Count */
.meetings-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meeting-dots {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.meeting-dots-row {
    display: flex;
    gap: 3px;
}

.meeting-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

.lp-score {
    color: var(--warning);
}

/* Panels & Modals */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s var(--ease);
}

.overlay.show {
    opacity: 1;
    visibility: visible;
}

.slide-panel {
    position: fixed;
    top: 0;
    right: -500px;
    width: 500px;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    z-index: 1000;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.slide-panel.open {
    right: 0;
}

.panel-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;
}

.panel-content {
    padding: 1.25rem;
}

.close-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: var(--bg-card-hover);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.25rem;
}

.close-btn:hover {
    background: var(--danger);
}

/* Forms - Compact */
.form-group {
    margin-bottom: 0.75rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

/* Outcome Options */
.outcome-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.outcome-option {
    padding: 0.875rem;
    background: var(--bg-dark);
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    transition: all var(--dur) var(--ease);
}

.outcome-option:hover {
    border-color: var(--text-muted);
}

.outcome-option.selected {
    border-color: var(--primary);
    background: rgba(192, 0, 0, 0.1);
}

.outcome-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.outcome-text {
    font-size: 0.8rem;
}

/* Grade Rating */
.grade-rating {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.grade-option {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border);
    cursor: pointer;
    font-weight: 700;
    transition: all var(--dur) var(--ease);
    background: var(--bg-dark);
}

.grade-option:hover {
    border-color: var(--text-muted);
}

.grade-option.selected {
    color: white;
    border-color: transparent;
    transform: scale(1.1);
}

.grade-option[data-value="A"].selected {
    background: #15803d;
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.4);
}

.grade-option[data-value="B"].selected {
    background: #22c55e;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.grade-option[data-value="C"].selected {
    background: #eab308;
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.4);
}

.grade-option[data-value="D"].selected {
    background: #f97316;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

.grade-option[data-value="F"].selected {
    background: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.grade-option[data-value="S"].selected {
    background: linear-gradient(135deg, #FFD700, #FFC107);
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.6);
    animation: goldPulse 2s ease-in-out infinite;
}

@keyframes goldPulse {

    0%,
    100% {
        box-shadow: 0 4px 16px rgba(255, 215, 0, 0.6);
    }

    50% {
        box-shadow: 0 4px 24px rgba(255, 215, 0, 0.9);
    }
}

.grade-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    font-weight: 700;
}

.grade-badge.grade-none {
    width: auto;
    padding: 0 0.5rem;
    height: 22px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted, #94a3b8);
    background: var(--bg-secondary, #f1f5f9);
    border: 1px dashed var(--border, #cbd5e1);
}

.grade-badge.A {
    background: rgba(21, 128, 61, 0.2);
    color: #4ade80;
    border-color: #15803d;
}

.grade-badge.B {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
    border-color: #22c55e;
}

.grade-badge.C {
    background: rgba(234, 179, 8, 0.2);
    color: #fde047;
    border-color: #eab308;
}

.grade-badge.D {
    background: rgba(249, 115, 22, 0.2);
    color: #fdba74;
    border-color: #f97316;
}

.grade-badge.F {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-color: #ef4444;
}

.grade-badge.S {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 193, 7, 0.2));
    color: #FFD700;
    border-color: #FFD700;
    font-weight: 800;
    text-shadow: 0 0 4px rgba(255, 215, 0, 0.3);
}

/* LP Edit Panel - sửa ABCDSF theo từng cuộc hẹn (Director trở lên) */
.lp-meeting-history-head {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}
.lp-meeting-history-empty {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0.75rem;
}
.lp-meeting-row {
    background: var(--bg-secondary);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.6rem;
}
.lp-meeting-meta {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.lp-meeting-tag {
    display: inline-block;
    font-size: 0.66rem;
    font-weight: 700;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 999px;
    padding: 0 0.4rem;
    margin-left: 0.25rem;
    vertical-align: middle;
}
.lp-meeting-grades {
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin: 0.25rem 0 0.6rem;
}
.lp-meeting-grades .grade-option {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
}
.lp-meeting-save {
    width: 100%;
}
.lp-meeting-score {
    margin-top: 0.25rem;
}
.lp-meeting-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: pre-wrap;
    margin-top: 0.4rem;
}

/* Sửa nhanh ABCDSF cuộc hẹn đầu ngay đầu panel Chi tiết Lead (Director+) */
.lead-score-edit {
    background: var(--bg-card-hover);
    border-radius: 12px;
    padding: 0.85rem 0.75rem;
    margin-bottom: 1rem;
    text-align: center;
}
.lead-score-edit-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.55rem;
}
.lead-score-edit-grades {
    gap: 0.5rem;
    flex-wrap: wrap;
}
.lead-score-edit-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.55rem;
}

/* Trình sửa TOÀN BỘ cuộc hẹn đầu (Giám đốc trở lên) - căn trái, nhãn từng field. */
.fme-box {
    text-align: left;
}
.fme-box .grade-rating {
    justify-content: flex-start;
}
.fme-box .toggle-options {
    flex-wrap: wrap;
    gap: 0.5rem;
}
.fme-label {
    display: block;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 0.7rem 0 0.3rem;
}
.fme-warn {
    font-size: 0.72rem;
    color: var(--danger);
    margin-top: 0.35rem;
}

/* Lead Profile */
.lead-profile {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-card-hover);
    border-radius: 16px;
    margin-bottom: 1.5rem;
}

.lead-avatar-lg {
    width: 80px;
    height: 80px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    margin: 0 auto 1rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1rem 0;
}

.info-item {
    background: var(--bg-dark);
    padding: 0.875rem;
    border-radius: 10px;
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.info-value {
    font-weight: 500;
}

.section-title {
    font-weight: 600;
    margin: 1.5rem 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Meeting Timeline */
.meeting-timeline {
    position: relative;
}

.meeting-item {
    position: relative;
    padding-left: 2rem;
    padding-bottom: 1.5rem;
    border-left: 2px solid var(--border);
    margin-left: 0.5rem;
}

.meeting-item:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}

.meeting-dot-lg {
    position: absolute;
    left: -9px;
    top: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--success);
    border: 3px solid var(--bg-card);
}

.meeting-item-card {
    background: var(--bg-dark);
    border-radius: 12px;
    padding: 1rem;
}

.meeting-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.meeting-title {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.meeting-notes {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.75rem;
}

/* Export Card */
.export-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s var(--ease);
}

.export-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
}

.export-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.export-card h3 {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Toggle Options */
.toggle-options {
    display: flex;
    gap: 0.75rem;
}

.toggle-option {
    flex: 1;
    padding: 0.875rem 1rem;
    background: var(--bg-dark);
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    font-weight: 500;
    transition: all var(--dur) var(--ease);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.toggle-option:hover {
    border-color: var(--text-muted);
}

.toggle-option.selected {
    border-color: var(--primary);
    background: rgba(192, 0, 0, 0.15);
}

.toggle-option.success.selected {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.15);
}

.toggle-option.danger.selected {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.15);
}

/* Quick Time Picker */
.quick-time-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.time-btn {
    padding: 0.5rem 0.875rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all var(--dur) var(--ease);
}

.time-btn:hover {
    border-color: var(--primary);
    background: rgba(192, 0, 0, 0.1);
}

.time-btn.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all var(--dur) var(--ease);
}

.logout-btn:hover {
    background: var(--danger);
    color: white;
}

/* User Management Panel */
.slide-panel-wide {
    width: 600px;
    right: -600px;
}

.slide-panel-wide.open {
    right: 0;
}

.user-form-section {
    background: var(--bg-card-hover);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.user-form-section h4,
.user-list-section h4 {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-primary);
}

.user-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-card-hover);
    border-radius: 10px;
    transition: all var(--dur) var(--ease);
}

.user-item:hover {
    background: var(--bg-dark);
}

.user-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.user-item-email {
    font-weight: 500;
    color: var(--text-primary);
}

.user-item-name {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.user-item-role {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: var(--primary);
    color: white;
    display: inline-block;
    margin-top: 0.25rem;
}

.user-item-role.sale,
.user-item-role.agent {
    background: rgba(255, 255, 255, 0.10);
    color: var(--text-secondary);
}

.user-item-role.sale_manager,
.user-item-role.manager {
    background: var(--info);
}

.user-item-role.sale_director {
    background: var(--gradient-accent);
    color: #2A2310;
}

.user-item-role.admin {
    background: var(--primary);
}

.user-item-actions {
    display: flex;
    gap: 0.5rem;
}

.user-item-actions .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.user-item.inactive {
    opacity: 0.5;
}

.user-item.inactive .user-item-email::after {
    content: ' (Đã vô hiệu)';
    color: var(--danger);
    font-size: 0.8rem;
}

/* Confirmation Modal */
.modal-confirm {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    z-index: 1100;
    width: 90%;
    max-width: 400px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid var(--border);
}

.modal-confirm.show {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.modal-confirm h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.modal-confirm p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.modal-confirm-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.modal-confirm-actions .btn {
    min-width: 100px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--success);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    transform: translateX(calc(100% + 2rem));
    transition: transform 0.3s ease;
    z-index: 2000;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    background: var(--danger);
}

/*
   RESPONSIVE
 */
@media (max-width: 1200px) {
    .admin-export-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .admin-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-header {
        padding: 1rem;
    }

    .admin-main {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .admin-stats-row {
        grid-template-columns: 1fr;
    }

    .admin-export-row {
        grid-template-columns: 1fr;
    }

    .slide-panel {
        width: 100%;
        right: -100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .lp-header {
        flex-direction: column;
        gap: 1rem;
    }

    .lp-main {
        padding: 1rem;
    }

    .lp-card {
        padding: 1.5rem;
    }

    .admin-header-right {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .welcome-text {
        display: none;
    }
}

/*
   MINI CHART CARD & MODAL
 */

/* Mini Chart Card */
.stat-card-chart {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card-chart:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3);
}

.stat-icon.purple {
    background: var(--accent-soft);
    color: var(--accent);
}

.mini-chart-container {
    height: 80px;
    width: 100%;
    margin: 0.5rem 0;
}

.expand-hint {
    font-size: 0.7rem;
    opacity: 0.6;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.stat-card-chart:hover .expand-hint {
    opacity: 1;
    transform: translateX(3px);
}

/* Chart Modal */
.chart-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.chart-modal.open {
    display: flex;
}

.chart-modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.chart-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.chart-modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s, transform 0.2s;
}

.close-modal-btn:hover {
    color: var(--danger);
    transform: scale(1.1);
}

.chart-modal-controls {
    display: flex;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.chart-modal-body {
    padding: 1.5rem;
}

/* Responsive Chart Modal */
@media (max-width: 640px) {
    .chart-modal-content {
        width: 95%;
        max-height: 85vh;
    }

    .chart-modal-controls {
        flex-direction: column;
        gap: 0.75rem;
    }

    .control-group {
        width: 100%;
        justify-content: space-between;
    }

    .chart-modal-body {
        padding: 1rem;
    }
}

/*
   ITSHOVER-STYLE ANIMATED SVG ICONS
   Motion-first design inspired by itshover.com
 */

/* Base Icon Styles */
.icon {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
    vertical-align: middle;
}

.icon-sm {
    width: 18px;
    height: 18px;
}

.icon-lg {
    width: 32px;
    height: 32px;
}

.icon-xl {
    width: 40px;
    height: 40px;
}

/* Stat Card Icon Sizes */
.stat-icon .icon {
    width: 28px;
    height: 28px;
}

/* Button Icon Alignment */
.btn .icon {
    margin-right: 0.375rem;
    width: 18px;
    height: 18px;
}

.btn-sm .icon {
    width: 16px;
    height: 16px;
    margin-right: 0.25rem;
}

/*
   ICON ANIMATIONS - Hover Effects
 */

/* Users Icon - Scale bounce on hover */
.icon-users {
    transform-origin: center;
}

.stat-card:hover .icon-users,
.btn:hover .icon-users {
    animation: iconBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes iconBounce {
    0% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.2);
    }

    50% {
        transform: scale(0.95);
    }

    70% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Calendar Icon - Flip animation */
.icon-calendar {
    transform-origin: center;
}

.stat-card:hover .icon-calendar,
.btn:hover .icon-calendar {
    animation: iconFlip 0.6s ease-in-out;
}

@keyframes iconFlip {
    0% {
        transform: rotateY(0deg);
    }

    50% {
        transform: rotateY(180deg);
    }

    100% {
        transform: rotateY(360deg);
    }
}

/* Check Icon - Draw animation */
.icon-check path.check-mark {
    stroke-dasharray: 20;
    stroke-dashoffset: 20;
    transition: stroke-dashoffset 0.4s ease;
}

.stat-card:hover .icon-check path.check-mark,
.btn:hover .icon-check path.check-mark {
    stroke-dashoffset: 0;
}

.stat-card:hover .icon-check,
.btn:hover .icon-check {
    animation: iconPop 0.4s ease;
}

@keyframes iconPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

/* Chart Icon - Bars grow animation */
.icon-chart rect {
    transform-origin: bottom;
    transition: transform 0.3s ease;
}

.stat-card:hover .icon-chart rect:nth-child(1) {
    animation: barGrow 0.5s ease 0s;
}

.stat-card:hover .icon-chart rect:nth-child(2) {
    animation: barGrow 0.5s ease 0.1s;
}

.stat-card:hover .icon-chart rect:nth-child(3) {
    animation: barGrow 0.5s ease 0.2s;
}

@keyframes barGrow {
    0% {
        transform: scaleY(0.3);
    }

    50% {
        transform: scaleY(1.2);
    }

    100% {
        transform: scaleY(1);
    }
}

/* Trophy Icon - Shine effect */
.icon-trophy {
    position: relative;
}

.stat-card:hover .icon-trophy,
.btn:hover .icon-trophy {
    animation: trophyShine 0.8s ease;
}

@keyframes trophyShine {
    0% {
        filter: brightness(1) drop-shadow(0 0 0 transparent);
    }

    50% {
        filter: brightness(1.3) drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
    }

    100% {
        filter: brightness(1) drop-shadow(0 0 0 transparent);
    }
}

/* Search Icon - Magnify pulse */
.icon-search {
    transform-origin: 60% 60%;
}

.search-box:hover .icon-search,
.btn:hover .icon-search {
    animation: searchPulse 0.5s ease;
}

@keyframes searchPulse {
    0% {
        transform: scale(1) rotate(0deg);
    }

    25% {
        transform: scale(1.1) rotate(-5deg);
    }

    50% {
        transform: scale(1.15) rotate(5deg);
    }

    75% {
        transform: scale(1.1) rotate(-3deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Refresh Icon - Spin rotation */
.icon-refresh {
    transform-origin: center;
}

.btn:hover .icon-refresh {
    animation: refreshSpin 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes refreshSpin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* User Plus Icon - User pop animation */
.icon-user-plus {
    transform-origin: center;
}

.btn:hover .icon-user-plus {
    animation: userPop 0.5s ease;
}

@keyframes userPop {
    0% {
        transform: scale(1);
    }

    30% {
        transform: scale(0.9) translateX(-2px);
    }

    60% {
        transform: scale(1.1) translateX(2px);
    }

    100% {
        transform: scale(1) translateX(0);
    }
}

/* Download Icon - Arrow down animation */
.icon-download path.arrow {
    transition: transform 0.3s ease;
}

.btn:hover .icon-download path.arrow,
.export-card:hover .icon-download path.arrow {
    animation: arrowDown 0.5s ease infinite;
}

@keyframes arrowDown {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(3px);
    }
}

/* Logout Icon - Door slide animation */
.icon-logout {
    transform-origin: center;
}

.btn:hover .icon-logout {
    animation: logoutSlide 0.5s ease;
}

@keyframes logoutSlide {
    0% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(4px);
    }

    100% {
        transform: translateX(0);
    }
}

/* Plus Icon - Rotate animation */
.icon-plus {
    transform-origin: center;
}

.btn:hover .icon-plus {
    animation: plusRotate 0.4s ease;
}

@keyframes plusRotate {
    0% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(90deg) scale(1.1);
    }

    100% {
        transform: rotate(90deg) scale(1);
    }
}

/* Close Icon - Shrink animation */
.icon-close {
    transform-origin: center;
}

.close-btn:hover .icon-close,
.close-modal-btn:hover .icon-close {
    animation: closeShrink 0.3s ease;
}

@keyframes closeShrink {
    0% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(0.8) rotate(90deg);
    }

    100% {
        transform: scale(1) rotate(90deg);
    }
}

/* Save Icon - Flash animation */
.icon-save {
    transform-origin: center;
}

.btn:hover .icon-save {
    animation: saveFlash 0.5s ease;
}

@keyframes saveFlash {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    30% {
        opacity: 0.5;
        transform: scale(0.95);
    }

    60% {
        opacity: 1;
        transform: scale(1.05);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Export Card Icons */
.export-card .icon {
    width: 36px;
    height: 36px;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.export-card:hover .icon {
    color: var(--primary);
}

/* Widget Header Icons */
.widget-header h2 .icon {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
}

/* Panel Header Icons */
.panel-header h3 .icon {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
}

/* LP Card Icons */
.lp-card h2 .icon,
.lp-card h3 .icon {
    width: 24px;
    height: 24px;
    margin-right: 0.5rem;
}

/* Outcome Option Icons Enhancement */
.outcome-icon .icon {
    width: 32px;
    height: 32px;
}

.outcome-option:hover .icon {
    transform: scale(1.1);
}

/* Grade Rating Icons */
.grade-option:hover .icon {
    transform: scale(1.15);
}

/* Modal Title Icons */
.chart-modal-header h2 .icon {
    width: 24px;
    height: 24px;
    margin-right: 0.5rem;
}

/* Mobile Responsive Icons */
@media (max-width: 768px) {
    .icon {
        width: 20px;
        height: 20px;
    }

    .stat-icon .icon {
        width: 24px;
        height: 24px;
    }

    .btn .icon {
        width: 16px;
        height: 16px;
    }

    .export-card .icon {
        width: 28px;
        height: 28px;
    }
}

/* Accessibility - Reduce motion */
@media (prefers-reduced-motion: reduce) {
    .icon {
        animation: none !important;
        transition: none !important;
    }

    .icon path,
    .icon rect,
    .icon circle {
        animation: none !important;
        transition: none !important;
    }
}

/*
   LP EDIT PANEL STYLES
 */

/* Read-only input display */
.form-input-readonly {
    background: var(--bg-card-hover);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    color: var(--text-primary);
    font-weight: 500;
    border: 1px solid var(--border);
}

/* Meeting history list */
.lp-meeting-history {
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-card-hover);
    border-radius: 10px;
    padding: 0.5rem;
}

.lp-meeting-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
}

.lp-meeting-history-item:last-child {
    margin-bottom: 0;
}

.lp-meeting-history-info {
    flex: 1;
}

.lp-meeting-history-info .meeting-number {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.lp-meeting-history-info .meeting-details {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.lp-meeting-history-item .edit-meeting-btn {
    background: var(--bg-card-hover);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all var(--dur) var(--ease);
}

.lp-meeting-history-item .edit-meeting-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* LP Lead List Edit Button */
.lp-lead-item {
    position: relative;
}

.lp-lead-item .lp-edit-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-card-hover);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    opacity: 0;
    transition: all var(--dur) var(--ease);
    z-index: 10;
}

.lp-lead-item:hover .lp-edit-btn {
    opacity: 1;
}

.lp-lead-item .lp-edit-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Empty state for meeting history */
.lp-meeting-history-empty {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/*
   CARE STATUS BADGES (tình trạng chăm sóc)
 */
.care-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    border: 1px solid transparent;
}
/* Tông tối: nền mờ + chữ sáng + viền mảnh - đồng bộ với bar-fill.care-* và grade-badge */
.care-none  { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; border-color: rgba(148, 163, 184, 0.35); }
.care-new   { background: rgba(148, 163, 184, 0.16); color: #e2e8f0; border-color: rgba(148, 163, 184, 0.38); }
.care-zalo  { background: rgba(56, 189, 248, 0.15);  color: #7dd3fc; border-color: rgba(56, 189, 248, 0.40); }
.care-phone { background: rgba(139, 92, 246, 0.15);  color: #c4b5fd; border-color: rgba(139, 92, 246, 0.40); }
.care-wait  { background: rgba(234, 179, 8, 0.15);   color: #fde047; border-color: rgba(234, 179, 8, 0.40); }
.care-appo  { background: rgba(59, 130, 246, 0.15);  color: #93c5fd; border-color: rgba(59, 130, 246, 0.40); }
.care-active{ background: rgba(34, 197, 94, 0.15);   color: #86efac; border-color: rgba(34, 197, 94, 0.40); }
.care-pause { background: rgba(156, 163, 175, 0.14); color: #cbd5e1; border-color: rgba(156, 163, 175, 0.35); }
.care-cold  { background: rgba(239, 68, 68, 0.15);   color: #fca5a5; border-color: rgba(239, 68, 68, 0.40); }

/* Care box in lead detail panel */
.care-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    margin: 1rem 0;
}
.care-box .form-group { margin-bottom: 0.6rem; }
.care-box .form-group:last-of-type { margin-bottom: 0.85rem; }

/*
   DASHBOARD WIDGETS (manager / director / admin)
 */
.dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 0 0 1.25rem;
}
@media (max-width: 980px) { .dashboard-widgets { grid-template-columns: 1fr; } }

.dash-card {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.dash-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
    color: var(--text-primary, #1e293b);
}
.dash-scope {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
.kpi {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.5rem;
    text-align: center;
}
.kpi-num { font-size: 1.6rem; font-weight: 800; line-height: 1.1; color: var(--text-primary, #1e293b); }
.kpi-green { color: #15803d; }
.kpi-blue { color: #1d4ed8; }
.kpi-muted { color: #94a3b8; }
.kpi-lbl { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; }

/* Horizontal bar list */
.bar-list { display: flex; flex-direction: column; gap: 0.5rem; }
.bar-row { display: grid; grid-template-columns: 42% 1fr auto; align-items: center; gap: 0.5rem; }
.bar-label {
    font-size: 0.8rem;
    color: var(--text-primary, #334155);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bar-track { background: var(--bg-secondary, #f1f5f9); border-radius: 999px; height: 0.6rem; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--primary, #ef4444); transition: width 0.4s ease; min-width: 2px; }
.bar-fill.care-zalo  { background: #38bdf8; }
.bar-fill.care-phone { background: #8b5cf6; }
.bar-fill.care-wait  { background: #eab308; }
.bar-fill.care-appo  { background: #3b82f6; }
.bar-fill.care-active{ background: #22c55e; }
.bar-fill.care-pause { background: #9ca3af; }
.bar-fill.care-cold  { background: #ef4444; }
.bar-fill.care-none, .bar-fill.care-new { background: #cbd5e1; }
.bar-count { font-size: 0.8rem; font-weight: 700; color: var(--text-primary, #334155); min-width: 1.5rem; text-align: right; }

/* Channel (Online/Offline) bar colors */
.bar-fill.chan-online  { background: #6366f1; }
.bar-fill.chan-offline { background: #0ea5e9; }
.bar-fill.chan-other   { background: #cbd5e1; }
/* Grade bar colors (match grade-badge palette) */
.bar-fill.grade-bar-S { background: linear-gradient(90deg, #FFD700, #f59e0b); }
.bar-fill.grade-bar-A { background: #15803d; }
.bar-fill.grade-bar-B { background: #22c55e; }
.bar-fill.grade-bar-C { background: #eab308; }
.bar-fill.grade-bar-D { background: #f97316; }
.bar-fill.grade-bar-F { background: #ef4444; }

/* Clickable rows / KPIs */
.bar-clickable { cursor: pointer; border-radius: 0.4rem; padding: 0.15rem 0.3rem; margin: 0 -0.3rem; transition: background 0.15s ease; }
.bar-clickable:hover { background: var(--bg-secondary, #f1f5f9); }
.kpi-click { cursor: pointer; transition: box-shadow 0.15s ease, transform 0.1s ease; }
.kpi-click:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); transform: translateY(-1px); }
.dash-hint { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.6rem; font-style: italic; }

/* Wide card spans full row (org chart) */
.dash-card-wide { grid-column: 1 / -1; }

/* M7: nhóm dashboard gập (native <details> - accessible) + nút mở biểu đồ */
.dash-accordion {
    grid-column: 1 / -1;
    border: 1px solid var(--border-strong, rgba(255, 255, 255, 0.12));
    border-radius: var(--radius-md, 12px);
    background: var(--bg-card, rgba(255, 255, 255, 0.02));
    overflow: hidden;
}
.dash-accordion + .dash-accordion { margin-top: 0.85rem; }
.dash-accordion > summary {
    cursor: pointer;
    padding: 0.85rem 1rem;
    font-weight: 700;
    font-size: 0.95rem;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}
.dash-accordion > summary::-webkit-details-marker { display: none; }
.dash-accordion > summary::after {
    content: '▸';
    color: var(--text-muted);
    transition: transform 0.2s ease;
}
.dash-accordion[open] > summary::after { transform: rotate(90deg); }
.dash-accordion > summary:focus-visible { box-shadow: 0 0 0 3px rgba(203, 168, 100, 0.65); border-radius: 6px; }
.dash-accordion-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    padding: 0 1rem 1rem;
}
.dash-accordion-body .dash-card-wide { grid-column: 1 / -1; }
.dash-chart-btns { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.dash-chart-btns .btn { flex: 1 1 auto; min-height: 40px; }
@media (max-width: 980px) { .dash-accordion-body { grid-template-columns: 1fr; } }

/* M7: thanh bộ lọc gập trên mobile (desktop giữ nguyên hàng ngang nhờ display:contents) */
.admin-filters { display: contents; }
.filter-toggle-btn {
    display: none;
    align-items: center; gap: 0.35rem;
    padding: 0.45rem 0.8rem; min-height: 38px;
    font-size: 0.82rem; font-weight: 600;
    background: var(--surface-2, rgba(255, 255, 255, 0.05));
    color: var(--text, #e6e9ef);
    border: 1px solid var(--border-strong, rgba(255, 255, 255, 0.18));
    border-radius: 8px; cursor: pointer;
}
@media (max-width: 768px) {
    .filter-toggle-btn { display: inline-flex; }
    .admin-filters {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }
    .admin-filters.show { display: flex; }
    .admin-filters .search-box,
    .admin-filters .form-select-sm { width: 100%; }
}

/*
   ORG CHART (sơ đồ tổ chức)
 */
.org-chart { display: flex; flex-direction: column; gap: 0.9rem; }
.org-top { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; }
.org-branches { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.9rem; }
.org-branch {
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-md);
    padding: 0.6rem;
    background: var(--bg-secondary, #f8fafc);
}
.org-children { display: flex; flex-direction: column; gap: 0.4rem; margin: 0.5rem 0 0 0.8rem; padding-left: 0.6rem; border-left: 2px dashed var(--border-color, #cbd5e1); }
.org-node {
    display: flex; flex-direction: column; gap: 0.1rem;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.6rem;
    cursor: pointer;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.org-node:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); border-color: var(--primary, #ef4444); }
.org-name { font-size: 0.85rem; font-weight: 700; color: var(--text-primary, #1e293b); }
.org-role { font-size: 0.7rem; color: var(--text-muted); }
.org-count { font-size: 0.72rem; font-weight: 700; color: var(--primary-light); }
.org-dir { border-left: 4px solid var(--accent); }
.org-mgr { border-left: 4px solid var(--info); font-weight: 700; }
.org-sale { border-left: 4px solid var(--text-muted); }

/* Phân cấp: Head of Distribution (apex) → Giám đốc vận hành */
.org-apex { margin-bottom: 0.2rem; }
.org-apex-node {
    border: 1px solid var(--accent) !important;
    border-left: 4px solid var(--accent) !important;
    background: linear-gradient(180deg, rgba(203,168,100,0.14), rgba(203,168,100,0.04)) !important;
    box-shadow: 0 4px 16px rgba(203,168,100,0.12);
}
.org-connector { text-align: center; color: var(--accent); font-size: 1.1rem; line-height: 1; margin: -0.2rem 0 0.1rem; opacity: 0.8; }

/* Dòng nhân sự hỗ trợ / back-office (đồng hành cùng giám đốc) */
.org-support {
    border: 1.5px dashed var(--info);
    border-radius: var(--radius-md);
    padding: 0.55rem 0.7rem;
    background: rgba(76,141,246,0.05);
    margin: 0.2rem 0 0.3rem;
}
.org-support-label { font-size: 0.76rem; font-weight: 700; color: var(--info); margin-bottom: 0.45rem; }
.org-support-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.org-support-row .org-node { flex: 1 1 200px; }
.org-support-node { border-left: 4px solid var(--info) !important; }
.org-branch-note { font-size: 0.7rem; color: var(--text-muted); font-style: italic; margin: 0.35rem 0 0; }
.org-team-sum { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); margin-top: 0.5rem; text-align: right; }
.org-empty { font-size: 0.75rem; color: var(--text-muted); font-style: italic; padding: 0.3rem; }
/* M8: fallback chọn nhóm bằng dropdown (cảm ứng/bàn phím) trong thẻ Sale của sơ đồ tổ chức */
.org-move-select {
    margin-top: 0.4rem;
    width: 100%;
    min-height: 34px;            /* tap target đủ lớn cho cảm ứng */
    font-size: 0.68rem;
    padding: 0.3rem 0.35rem;
    background: var(--surface-2, rgba(255, 255, 255, 0.05));
    color: var(--text, #e6e9ef);
    border: 1px solid var(--border-strong, rgba(255, 255, 255, 0.18));
    border-radius: 6px;
    cursor: pointer;
}
.org-move-select:hover { border-color: var(--accent, #cba864); }

/* M9-A: chips chọn nhiều nguồn (LP Edit Panel) + badge nguồn (read-only) */
.source-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.source-chip {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.4rem 0.7rem; min-height: 36px;
    font-size: 0.8rem; font-weight: 600;
    background: var(--surface-2, rgba(255, 255, 255, 0.05));
    color: var(--text, #e6e9ef);
    border: 1px solid var(--border-strong, rgba(255, 255, 255, 0.18));
    border-radius: 999px; cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.source-chip:hover { border-color: var(--accent, #cba864); }
.source-chip.on { background: rgba(203, 168, 100, 0.18); border-color: var(--accent, #cba864); }
.source-chip.primary { background: var(--accent, #cba864); color: #0b0e15; border-color: var(--accent, #cba864); }
.source-badge {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.18rem 0.5rem; font-size: 0.72rem; font-weight: 600;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-strong, rgba(255, 255, 255, 0.15));
    border-radius: 999px; color: var(--text-muted);
}
.source-badge.source-primary { color: var(--accent, #cba864); border-color: var(--accent, #cba864); }
.source-badge.source-none { font-style: italic; }

/*
   LUXURY POLISH - tinh chỉnh giao diện theo hướng tinh tế, sang trọng
   (đặt cuối file để override nhờ thứ tự cascade)
 */

/* Nền tối sâu nhiều lớp + chữ mượt hơn */
body {
    background: radial-gradient(1200px 700px at 82% -8%, rgba(196, 13, 23, 0.10), transparent 60%),
        radial-gradient(900px 600px at 0% 100%, rgba(203, 168, 100, 0.06), transparent 55%),
        var(--bg-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: 0.1px;
}

h1, h2, h3, h4 { letter-spacing: -0.2px; }
.section-title, .form-label, .stat-label {
    letter-spacing: 0.3px;
}
.stat-label { text-transform: none; }

::selection { background: rgba(196, 13, 23, 0.35); color: #fff; }

/* Thanh cuộn tinh tế */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); background-clip: content-box; }

/* Đăng nhập - sang trọng, có ánh sáng nhẹ và viền vàng champagne */
.login-screen {
    background:
        radial-gradient(900px 600px at 50% -10%, rgba(196, 13, 23, 0.18), transparent 60%),
        linear-gradient(160deg, #0B0E15 0%, #11151F 100%);
}
.login-card {
    position: relative;
    background: linear-gradient(180deg, rgba(28, 35, 51, 0.92), rgba(20, 25, 37, 0.92));
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(8px);
    overflow: hidden;
}
.login-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--gradient-accent);
    opacity: 0.85;
}

/* Header - kính mờ, viền chân tinh tế */
.admin-header,
.lp-header {
    background: linear-gradient(180deg, rgba(20, 25, 37, 0.86), rgba(20, 25, 37, 0.72));
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* Nút - bo mềm, có chiều sâu; primary có ánh sáng + quầng đỏ khi hover */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    letter-spacing: 0.2px;
    border: 1px solid transparent;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.btn-primary {
    background: var(--gradient-primary);
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-strong);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
    transform: translateY(-1px);
}
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(203, 168, 100, 0.65);
}

/* Thẻ thống kê - bề mặt chuyển sắc, nhấn vàng champagne khi hover */
.stat-card,
.lp-card,
.admin-widget {
    background: linear-gradient(180deg, var(--surface-2), var(--bg-card));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}
.lp-card:hover,
.admin-widget:hover {
    box-shadow: var(--shadow-md);
}
.stat-value {
    letter-spacing: -0.5px;
    font-weight: 800;
}

/* Panel trượt - đổ bóng sâu, viền tinh tế */
.slide-panel {
    background: linear-gradient(180deg, #11151F, var(--bg-card));
    border-left: 1px solid var(--border-strong);
    box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5);
}
.panel-header {
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

/* Ô nhập - viền tinh tế, focus quầng đỏ mềm */
.form-input,
.form-select,
.form-select-sm,
.form-textarea,
.form-input-readonly {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.form-input:focus,
.form-select:focus,
.form-select-sm:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(196, 13, 23, 0.18);
    background: rgba(255, 255, 255, 0.05);
}

/* Hạng S - ánh kim champagne cho cảm giác "thành tựu" */
.grade-badge.S,
.grade-option[data-value="S"].selected {
    background: var(--gradient-accent);
    color: #2A2310;
    border: none;
    box-shadow: 0 4px 14px rgba(203, 168, 100, 0.35);
}

/* Khoá thao tác tài khoản (Director không đủ quyền) */
.user-locked-hint {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    opacity: 0.75;
    cursor: not-allowed;
}

/* Badge vai trò / trạng thái - viền mảnh tinh tế.
   (.care-badge KHÔNG gộp ở đây để giữ border-color ngữ nghĩa của .care-* tông tối) */
.user-item-role,
.stage-badge {
    border: 1px solid var(--border-strong);
    letter-spacing: 0.2px;
}
.care-badge { letter-spacing: 0.2px; }

/*
   RUBIK - logo & hiệu ứng "lắp ráp" cho mọi trạng thái chờ
   Khối Rubik 3×3 dựng bằng CSS thuần, tông màu theo brand (đỏ/vàng/sáng/tối).
 */
.rubik-face {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: var(--rubik-gap, 4px);
    padding: var(--rubik-pad, 5px);
    width: var(--rubik-size, 60px);
    height: var(--rubik-size, 60px);
    background: linear-gradient(145deg, #11151F, #05070C);
    border-radius: calc(var(--rubik-size, 60px) * 0.16);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transform: rotateX(20deg) rotateZ(-3deg);
    transform-style: preserve-3d;
}

.rubik-face .rt {
    border-radius: calc(var(--rubik-size, 60px) * 0.07);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* Bảng màu Rubik theo brand (thay vì 6 màu chói) */
.rubik-face .rt:nth-child(3n+1) { background: linear-gradient(145deg, #F0353F, #C40D17); }
.rubik-face .rt:nth-child(3n+2) { background: linear-gradient(145deg, #E7CE97, #CBA864); }
.rubik-face .rt:nth-child(3n+3) { background: linear-gradient(145deg, #EEF1F6, #C7CEDC); }
.rubik-face .rt:nth-child(5)    { background: linear-gradient(145deg, #F0353F, #8E0610); }
.rubik-face .rt:nth-child(7)    { background: linear-gradient(145deg, #4C8DF6, #2C5FB0); }

/* Hiệu ứng loading: mảnh ghép rời rạc bay vào -> lắp ráp -> xoay từng LỚP như giải Rubik
   (lần lượt cột trái -> giữa -> phải, mỗi cột tự xoay quanh trục dọc của nó)
   -> tất cả về cùng một màu thương hiệu (tool thống nhất toàn diện). KHÔNG xoay tròn cả khối. */
.rubik-loader {
    --rubik-size: 64px;
    display: inline-block;
    perspective: 520px;
    filter: drop-shadow(0 12px 26px rgba(196, 13, 23, 0.28));
}

/* Mỗi ô khởi đầu ở một vị trí rời rạc rồi hội tụ về đúng chỗ của mình */
.rubik-loader .rt {
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translate(var(--tx, 0), var(--ty, 0)) rotateZ(var(--rot, 0deg)) rotateY(0deg) scale(0.35);
    animation-duration: 4.6s;
    animation-iteration-count: infinite;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}
/* Mỗi CỘT là một "lớp" Rubik, xoay lệch pha: trái -> giữa -> phải */
.rubik-loader .rt:nth-child(3n+1) { animation-name: rubikSolveL; }
.rubik-loader .rt:nth-child(3n+2) { animation-name: rubikSolveM; }
.rubik-loader .rt:nth-child(3n)   { animation-name: rubikSolveR; }

/* Lớp phủ màu brand: bật lên ở pha "thống nhất" để mọi ô về cùng một màu */
.rubik-loader .rt::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(145deg, #F0353F, #C40D17);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
    opacity: 0;
    animation: rubikUnify 4.6s infinite ease-in-out;
}

/* Hướng bay vào của từng ô (toả ra từ tâm khối) */
.rubik-loader .rt:nth-child(1) { --tx: -170%; --ty: -170%; --rot: -200deg; }
.rubik-loader .rt:nth-child(2) { --tx:    0%; --ty: -215%; --rot:  170deg; }
.rubik-loader .rt:nth-child(3) { --tx:  170%; --ty: -170%; --rot:  210deg; }
.rubik-loader .rt:nth-child(4) { --tx: -215%; --ty:    0%; --rot: -160deg; }
.rubik-loader .rt:nth-child(5) { --tx:    0%; --ty:    0%; --rot:  235deg; }
.rubik-loader .rt:nth-child(6) { --tx:  215%; --ty:    0%; --rot:  160deg; }
.rubik-loader .rt:nth-child(7) { --tx: -170%; --ty:  170%; --rot: -210deg; }
.rubik-loader .rt:nth-child(8) { --tx:    0%; --ty:  215%; --rot:  190deg; }
.rubik-loader .rt:nth-child(9) { --tx:  170%; --ty:  170%; --rot:  205deg; }

/* Cùng giữ danh sách hàm transform giống nhau ở mọi mốc để góc rotateY nội suy mượt
   (rotateY 360deg có ma trận = identity, nếu đổi cấu trúc hàm sẽ mất luôn chuyển động). */
@keyframes rubikSolveL {
    0%   { opacity: 0; transform: translate(var(--tx), var(--ty)) rotateZ(var(--rot)) rotateY(0deg) scale(0.35); }
    20%  { opacity: 1; transform: translate(0, 0) rotateZ(0deg) rotateY(0deg) scale(1); }
    24%  { transform: translate(0, 0) rotateZ(0deg) rotateY(0deg) scale(1); animation-timing-function: cubic-bezier(0.62, 0.04, 0.3, 1); }
    42%  { transform: translate(0, 0) rotateZ(0deg) rotateY(360deg) scale(1); }
    90%  { opacity: 1; transform: translate(0, 0) rotateZ(0deg) rotateY(360deg) scale(1); }
    100% { opacity: 0; transform: translate(var(--tx), var(--ty)) rotateZ(var(--rot)) rotateY(360deg) scale(0.35); }
}
@keyframes rubikSolveM {
    0%   { opacity: 0; transform: translate(var(--tx), var(--ty)) rotateZ(var(--rot)) rotateY(0deg) scale(0.35); }
    20%  { opacity: 1; transform: translate(0, 0) rotateZ(0deg) rotateY(0deg) scale(1); }
    36%  { transform: translate(0, 0) rotateZ(0deg) rotateY(0deg) scale(1); animation-timing-function: cubic-bezier(0.62, 0.04, 0.3, 1); }
    54%  { transform: translate(0, 0) rotateZ(0deg) rotateY(-360deg) scale(1); }
    90%  { opacity: 1; transform: translate(0, 0) rotateZ(0deg) rotateY(-360deg) scale(1); }
    100% { opacity: 0; transform: translate(var(--tx), var(--ty)) rotateZ(var(--rot)) rotateY(-360deg) scale(0.35); }
}
@keyframes rubikSolveR {
    0%   { opacity: 0; transform: translate(var(--tx), var(--ty)) rotateZ(var(--rot)) rotateY(0deg) scale(0.35); }
    20%  { opacity: 1; transform: translate(0, 0) rotateZ(0deg) rotateY(0deg) scale(1); }
    48%  { transform: translate(0, 0) rotateZ(0deg) rotateY(0deg) scale(1); animation-timing-function: cubic-bezier(0.62, 0.04, 0.3, 1); }
    66%  { transform: translate(0, 0) rotateZ(0deg) rotateY(360deg) scale(1); }
    90%  { opacity: 1; transform: translate(0, 0) rotateZ(0deg) rotateY(360deg) scale(1); }
    100% { opacity: 0; transform: translate(var(--tx), var(--ty)) rotateZ(var(--rot)) rotateY(360deg) scale(0.35); }
}

@keyframes rubikUnify {
    0%, 66%  { opacity: 0; }
    76%, 90% { opacity: 1; }
    100%     { opacity: 0; }
}

/* Logo Rubik (tĩnh trên header/đăng nhập); hover = xoay lắp ghép từng cột + về cùng màu */
.rubik-logo {
    --rubik-size: 38px;
    --rubik-gap: 3px;
    --rubik-pad: 4px;
    display: inline-block;
    flex-shrink: 0;
    perspective: 420px;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.rubik-logo .rt { position: relative; overflow: hidden; opacity: 1; }
.rubik-logo .rt::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(145deg, #F0353F, #C40D17);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
    opacity: 0;
    transition: opacity 0.5s ease;
}
.login-logo .rubik-logo { --rubik-size: 52px; }
.rubik-logo:hover { transform: scale(1.06); }
.rubik-logo:hover .rt::after { opacity: 1; transition-delay: 0.55s; }
.rubik-logo:hover .rt:nth-child(3n+1) { animation: rubikTurnL 1.6s cubic-bezier(0.5, 0.05, 0.2, 1); }
.rubik-logo:hover .rt:nth-child(3n+2) { animation: rubikTurnM 1.6s cubic-bezier(0.5, 0.05, 0.2, 1); }
.rubik-logo:hover .rt:nth-child(3n)   { animation: rubikTurnR 1.6s cubic-bezier(0.5, 0.05, 0.2, 1); }
@keyframes rubikTurnL { 0%, 8%  { transform: rotateY(0deg); } 42% { transform: rotateY(360deg); } 100% { transform: rotateY(360deg); } }
@keyframes rubikTurnM { 0%, 22% { transform: rotateY(0deg); } 56% { transform: rotateY(-360deg); } 100% { transform: rotateY(-360deg); } }
@keyframes rubikTurnR { 0%, 36% { transform: rotateY(0deg); } 70% { transform: rotateY(360deg); } 100% { transform: rotateY(360deg); } }

/* Skeleton dùng chung tông gold-accent nhẹ thay vì xám lệch */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--surface-2) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
}

/* Tôn trọng tuỳ chọn giảm chuyển động của hệ điều hành (accessibility) */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rubik-loader .rt,
    .rubik-loader .rt::after,
    .rubik-logo:hover .rt { animation: none !important; }
    .rubik-loader .rt { opacity: 1; transform: none; }
    .rubik-loader .rt::after { opacity: 0; }
}

/*
   ORG CHART - thẻ "Chưa thuộc nhóm" + tóm tắt hiệu suất
 */
/* Thẻ team "Chưa thuộc nhóm": cùng dạng thẻ team, chỉ khác viền gạch chấm */
.org-branch-orphan {
    border: 1.5px dashed var(--border-strong);
    background: var(--surface-2, rgba(255, 255, 255, 0.02));
}
.org-mgr-orphan {
    border-left: 4px dashed var(--text-muted) !important;
    background: transparent;
    cursor: default;
}
.org-mgr-orphan:hover { box-shadow: none; border-color: var(--border-strong); }

/* Lưới ô số liệu tóm tắt (theo sale & tổng quan dưới sơ đồ tổ chức) */
.mini-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.6rem;
    margin-top: 0.4rem;
}
.mini-stat {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md, 0.6rem);
    padding: 0.65rem 0.5rem;
    text-align: center;
}
.mini-stat-num { font-size: 1.35rem; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.mini-stat-lbl { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; }
.mini-stat-num.ms-green { color: var(--success, #34d399); }
.mini-stat-num.ms-red { color: var(--primary-light, #ef4444); }
.mini-stat-num.ms-blue { color: var(--info, #4c8df6); }
.mini-stat-num.ms-gold { color: var(--accent, #cba864); }
.mini-stat-note { font-size: 0.72rem; color: var(--text-muted); margin: 0.55rem 0 0; font-style: italic; }

/* Khối tóm tắt hiệu suất sale đặt trên đầu panel danh sách lead */
.sale-perf-summary {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md, 0.6rem);
    padding: 0.8rem;
    margin-bottom: 0.9rem;
}
.sale-perf-head { font-size: 0.9rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.5rem; }

/*
   DANH SÁCH LEADS - nhóm theo Sale + phân cấp (Sale ▸ TN ▸ GĐ)
 */
.leads-container { display: flex; flex-direction: column; gap: 0.6rem; }

/* Nút chuyển chế độ xem */
.leads-view-toggle {
    display: inline-flex;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}
.lvt-btn {
    border: 0; background: transparent; cursor: pointer;
    color: var(--text-muted);
    font-size: 0.78rem; font-weight: 600;
    padding: 0.32rem 0.7rem; border-radius: 999px;
    transition: background 0.15s ease, color 0.15s ease;
}
.lvt-btn:hover { color: var(--text-primary); }
.lvt-btn.active {
    background: var(--gradient-accent, var(--accent));
    color: #1a1205;
}

/* Thẻ nhóm theo Sale (accordion) */
.lead-group {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md, 0.6rem);
    overflow: hidden;
}
.lead-group-head {
    display: flex; align-items: center; gap: 0.7rem;
    padding: 0.7rem 0.85rem;
    cursor: pointer;
    background: var(--bg-secondary);
    border-left: 3px solid var(--accent);
    transition: background 0.15s ease;
}
.lead-group-head:hover { background: var(--bg-card-hover); }
.lgh-avatar {
    flex: 0 0 auto;
    width: 38px; height: 38px; border-radius: 50%;
    display: grid; place-items: center;
    font-weight: 800; font-size: 0.85rem; color: #1a1205;
    background: var(--gradient-accent, var(--accent));
}
.lgh-avatar-none { background: var(--surface-2); color: var(--text-muted); border: 1px dashed var(--border-strong); }
.lgh-info { flex: 1 1 auto; min-width: 0; }
.lgh-title { font-size: 0.92rem; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 0.5rem; }
.lgh-count {
    font-size: 0.7rem; font-weight: 700; color: var(--accent);
    background: rgba(203, 168, 100, 0.14);
    padding: 0.05rem 0.5rem; border-radius: 999px;
}
.lgh-crumb { margin-top: 0.3rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
.lgh-chip {
    font-size: 0.72rem; font-weight: 600;
    padding: 0.1rem 0.5rem; border-radius: 6px;
    background: var(--surface-2); color: var(--text-secondary, #cbd5e1);
    border: 1px solid var(--border-color);
}
.lgh-sale-chip { border-left: 3px solid var(--accent); }
.lgh-mgr-chip { border-left: 3px solid var(--info); }
.lgh-dir-chip { border-left: 3px solid var(--primary-light); }
/* Dòng "LP phụ trách + Trưởng nhóm" trong drill-down (Giám đốc+ / Analyst) */
.lp-lead-owner { margin-top: 0.3rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
.lgh-arrow { color: var(--text-muted); font-size: 0.7rem; }
.lgh-warn { font-size: 0.74rem; font-weight: 600; color: var(--primary-light); }
.lgh-chevron { flex: 0 0 auto; color: var(--text-muted); transition: transform 0.2s ease; }
.lead-group.open .lgh-chevron { transform: rotate(180deg); }

.lead-group-body { display: none; flex-direction: column; padding: 0.45rem; gap: 0.4rem; }
.lead-group.open .lead-group-body { display: flex; }

/* Dòng lead gọn trong nhóm */
.lead-row-card {
    display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
    padding: 0.55rem 0.7rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.1s ease;
}
.lead-row-card:hover { border-color: var(--accent); transform: translateX(2px); }
.lrc-main { min-width: 0; }
.lrc-name { font-size: 0.88rem; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.lrc-sub { font-size: 0.74rem; color: var(--text-muted); margin-top: 0.12rem; }
.lrc-care { margin-top: 0.25rem; }
.lrc-meta { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; }
.lrc-meet { font-size: 0.74rem; font-weight: 600; color: var(--text-secondary, #cbd5e1); }

/* Cột phụ trách trong bảng phẳng */
.tbl-assignee { font-size: 0.84rem; font-weight: 600; color: var(--text-primary); }
.tbl-hier { font-size: 0.73rem; color: var(--text-muted); margin-top: 0.15rem; }

/*
   SUMMARY BY LP - bảng tổng hợp theo người phụ trách
 */
.lp-summary-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.lp-summary-table th {
    text-align: left; padding: 0.55rem 0.7rem;
    color: var(--text-muted); font-weight: 600; font-size: 0.76rem;
    text-transform: uppercase; letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border-color);
}
.lp-summary-table td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border-color); color: var(--text-primary); }
.lp-summary-table .lp-sum-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.lp-summary-table th.th-num { text-align: right; } /* header cột số căn phải để thẳng hàng với dữ liệu */
.lp-summary-table .lp-sum-no { color: var(--text-muted); width: 2.5rem; }
.lp-summary-table .lp-sum-name { font-weight: 600; }
.lp-summary-table .lp-sum-succ { color: var(--success); }
.lp-summary-table .lp-sum-row { cursor: pointer; transition: background 0.12s ease; }
.lp-summary-table .lp-sum-row:hover { background: var(--bg-card-hover); }
.lp-summary-table .lp-sum-total {
    background: rgba(203, 168, 100, 0.10);
    font-weight: 800;
}
.lp-summary-table .lp-sum-total td { color: var(--accent); border-bottom: 2px solid var(--accent); }
.lp-summary-table .lp-sum-unassigned td { color: var(--text-muted); font-style: italic; }

/*
   TỰ ĐỘNG DỊCH - Google Translate widget (giám đốc người Nhật)
 */
.lang-switcher {
    position: fixed;
    /* Góc dưới-trái: tránh đè nút "Đăng xuất"/Export ở header (trên-phải)
       và tránh đè toast thông báo (dưới-phải). */
    bottom: 14px; left: 14px;
    top: auto; right: auto;
    z-index: 9999;
    display: flex; align-items: center; gap: 0.35rem;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: 0.25rem 0.6rem;
    box-shadow: var(--shadow-md, 0 4px 14px rgba(0,0,0,0.3));
    backdrop-filter: blur(8px);
    opacity: 0.92;
}
.lang-switcher:hover { opacity: 1; }
.lang-switcher .lang-globe { font-size: 0.95rem; line-height: 1; }
.lang-switcher #langSelect {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.18rem 0.45rem;
    font-size: 0.78rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    outline: none;
}
.lang-switcher #langSelect option { color: #111; }
/* Engine Google Translate chạy ẩn - không hiện UI mặc định */
#googleTranslateWidget { display: none !important; }

/* Ẩn banner trên cùng + khôi phục vị trí body mà Google Translate hay chèn */
.goog-te-banner-frame.skiptranslate,
.goog-te-gadget-icon,
#goog-gt-tt, .goog-te-balloon-frame { display: none !important; }
.skiptranslate iframe { visibility: hidden !important; height: 0 !important; }
body { top: 0 !important; }
body > .skiptranslate { display: none !important; }

@media (max-width: 640px) {
    .lgh-crumb { font-size: 0.68rem; }
    .lead-group-head { padding: 0.6rem; }
}

/*
   FIX TƯƠNG PHẢN DROPDOWN - option trên nền tối phải đọc được
   (native <option> đổ nền trắng/chữ đen để không bị mờ)
 */
select.form-input,
select.form-select,
select.form-select-sm,
.form-group select,
#careStatusSelect,
#newUserRole,
#editUserRole,
#adminStageFilter,
#adminTimeFilter,
#adminManagerFilter {
    color: var(--text-primary);
    background-color: var(--bg-card-hover);
}
select.form-input option,
select.form-select option,
select.form-select-sm option,
.form-group select option,
#careStatusSelect option,
select option {
    color: #11151f;        /* chữ tối */
    background-color: #ffffff; /* nền sáng -> đọc rõ trên mọi OS */
}

/*
   STACKED BAR - Lead theo nhân viên (Online/Offline tách màu)
 */
.bar-track-stacked { display: flex; overflow: hidden; }
.bar-seg {
    height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.68rem; font-weight: 700; color: #0b0e15;
    min-width: 0; transition: filter 0.15s ease;
}
.bar-seg.seg-offline { background: var(--accent); }            /* Offline = vàng champagne */
.bar-seg.seg-online  { background: var(--info); color: #fff; } /* Online = xanh */
.bar-seg.seg-other   { background: var(--border-strong); color: var(--text-secondary); } /* Chưa rõ */
.bar-clickable:hover .bar-seg { filter: brightness(1.12); }
.dash-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.5rem; }
.dash-legend-item { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.74rem; color: var(--text-muted); }
.lg-dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.lg-dot.lg-offline { background: var(--accent); }
.lg-dot.lg-online { background: var(--info); }
.lg-dot.lg-other { background: var(--border-strong); }

/*
   KÉO-THẢ trong sơ đồ tổ chức (Director/Admin)
 */
.org-drag-hint {
    font-size: 0.74rem; color: var(--info);
    background: rgba(76,141,246,0.08);
    border: 1px dashed var(--info);
    border-radius: 0.5rem; padding: 0.4rem 0.6rem; margin-bottom: 0.6rem;
}
.org-draggable { cursor: grab; }
.org-draggable:active { cursor: grabbing; }
.org-droptarget.org-drop-hover {
    outline: 2px dashed var(--accent);
    outline-offset: 2px;
    background: rgba(203,168,100,0.10);
}

/*
   CHẾ ĐỘ CHỈ ĐỌC (Analyst) - ẩn mọi nút chỉnh sửa còn sót
 */
body.role-readonly #userMgmtBtn,
body.role-readonly .requires-edit,
body.role-readonly .leads-view-toggle ~ * .btn-danger { display: none !important; }
body.role-analyst .lang-switcher { box-shadow: 0 0 0 2px var(--accent), var(--shadow-md, 0 4px 14px rgba(0,0,0,0.3)); }

/* Nút export nhỏ trên đầu mỗi bảng (analyst & quản lý) */
.table-export-bar { display: flex; justify-content: flex-end; margin-bottom: 0.4rem; }
.btn-export-csv {
    border: 1px solid var(--border-color);
    background: var(--bg-card-hover);
    color: var(--text-secondary);
    border-radius: 6px; padding: 0.22rem 0.6rem;
    font-size: 0.74rem; font-weight: 600; cursor: pointer;
}
.btn-export-csv:hover { color: var(--accent); border-color: var(--accent); }

/*
   EMPTY STATE - trạng thái rỗng thống nhất (icon mờ + text căn giữa)
 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 2rem 1rem;
}
.empty-state .empty-icon { opacity: 0.4; line-height: 0; }
.empty-state .empty-icon .icon { width: 34px; height: 34px; }

/*
   A11Y - focus bàn phím, reduced-motion mở rộng, tap target
 */

/* Focus ring nhất quán cho mọi phần tử tương tác (kể cả div[role=button]) */
.outcome-option:focus-visible,
.grade-option:focus-visible,
.lp-stat-item:focus-visible,
.admin-stat-item:focus-visible,
.export-card:focus-visible,
.stat-card-chart:focus-visible,
.lead-row-card:focus-visible,
.lead-group-head:focus-visible,
.lp-lead-item:focus-visible,
.time-btn:focus-visible,
.lvt-btn:focus-visible,
.close-btn:focus-visible,
.close-modal-btn:focus-visible,
.org-node:focus-visible,
.bar-clickable:focus-visible,
.kpi-click:focus-visible,
.lp-sum-row:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(203, 168, 100, 0.65);
    border-radius: var(--radius-sm);
}
/* Phần tử dùng làm nút bằng bàn phím - bỏ outline mặc định, chỉ hiện khi focus-visible */
[role="button"],
[role="radio"] {
    outline: none;
}

/* Tap target >= ~40px trên mobile cho nút nhỏ */
@media (max-width: 768px) {
    .time-btn {
        padding: 0.7rem 1rem;
        min-height: 40px;
    }
    .lvt-btn {
        padding: 0.55rem 0.9rem;
        min-height: 40px;
    }
}

/* Reduced-motion: tắt mọi animation/hiệu ứng trang trí, giữ chuyển trạng thái tối thiểu */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    .btn:hover,
    .stat-card:hover,
    .export-card:hover,
    .lp-card:hover,
    .admin-widget:hover,
    .lp-stat-item:hover,
    .lead-row-card:hover,
    .kpi-click:hover {
        transform: none !important;
    }
    .grade-option[data-value="S"].selected {
        animation: none !important;
    }
}