@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --primary: hsl(262, 83%, 58%);
    --primary-light: hsl(262, 83%, 68%);
    --primary-bg: hsl(262, 83%, 58%, 0.1);
    --blue: hsl(199, 89%, 48%);
    --bg: hsl(0, 0%, 99%);
    --card-bg: #ffffff;
    --text: hsl(222, 47%, 11%);
    --text-muted: hsl(215, 16%, 47%);
    --border: hsl(214, 32%, 91%);
    --muted-bg: hsl(210, 40%, 96%);
    --radius: 0.75rem;
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #eab308;

    /* Shadows (elevation system) */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.10);
    --shadow-xl: 0 16px 40px rgba(0,0,0,0.12);
    --shadow-primary: 0 4px 14px hsla(262, 83%, 58%, 0.2);
    --shadow-primary-lg: 0 10px 30px hsla(262, 83%, 58%, 0.25);

    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* Elevated surface */
    --card-bg-elevated: #ffffff;
}

/* === Dark Theme === */
html[data-theme="dark"] {
    --bg: hsl(225, 15%, 10%);
    --card-bg: hsl(225, 15%, 14%);
    --text: hsl(210, 20%, 92%);
    --text-muted: hsl(215, 12%, 55%);
    --border: hsl(220, 12%, 22%);
    --muted-bg: hsl(225, 14%, 18%);
    --primary-bg: hsl(262, 83%, 58%, 0.15);
    --primary-light: hsl(262, 75%, 72%);
    --green: #34d399;
    --red: #f87171;
    --yellow: #fbbf24;

    /* Dark shadow system */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.15);
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.3);
    --shadow-xl: 0 16px 40px rgba(0,0,0,0.35);
    --shadow-primary: 0 4px 14px hsla(262, 83%, 58%, 0.3);
    --shadow-primary-lg: 0 10px 30px hsla(262, 83%, 58%, 0.35);
    --card-bg-elevated: hsl(225, 15%, 16%);
}

* {
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* === Gradient & Glass === */
.gradient-solid {
    background: linear-gradient(135deg, var(--primary) 0%, var(--blue) 100%);
}

.glass {
    background: hsla(0, 0%, 100%, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

html[data-theme="dark"] .glass {
    background: hsla(225, 15%, 14%, 0.85);
}

/* === Sidebar === */
.sidebar {
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    min-height: 100vh;
    padding: 1.5rem 1rem;
    position: fixed;
    width: 240px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.sidebar .brand {
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 800;
    padding: 0 0.5rem 1.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.sidebar .brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--blue) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 800;
    flex-shrink: 0;
}

.sidebar .brand small {
    display: block;
    font-weight: 400;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.4rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: background 0.15s;
}

.sidebar-user-card:hover {
    background: var(--muted-bg);
    color: var(--text);
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--blue) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-avatar span {
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.8rem;
    line-height: 1.2;
}

.sidebar-user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.profile-avatar-lg {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--blue) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.profile-avatar-lg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-lg span {
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.sidebar .nav-link {
    color: var(--text-muted);
    border-radius: var(--radius);
    padding: 0.6rem 0.85rem;
    margin-bottom: 0.2rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    position: relative;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    display: block;
}

.sidebar .nav-link:hover {
    background: var(--muted-bg);
    color: var(--text);
}

.sidebar .nav-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity var(--transition-fast), color var(--transition-fast);
}
.sidebar .nav-link:hover svg {
    opacity: 0.8;
}
.sidebar .nav-link.active {
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 600;
}
.sidebar .nav-link.active svg {
    opacity: 1;
    color: var(--primary);
}
.sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 55%;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.sidebar hr {
    border-color: var(--border);
    margin: 0.75rem 0;
}

/* === Main Content === */
.main-content {
    margin-left: 240px;
    padding: 2rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--text);
    letter-spacing: -0.025em;
}

/* === KPI Cards === */
.kpi-card {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 1.25rem;
    border: 1px solid var(--border);
    height: 100%;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, var(--primary), var(--blue));
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.kpi-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.kpi-card:hover::before {
    opacity: 1;
}

.kpi-card .kpi-value {
    font-size: 1.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.kpi-card .kpi-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.35rem;
    font-weight: 500;
}

/* === Cards === */
.card-custom {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.card-custom:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.card-custom h5 {
    font-weight: 700;
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text);
}

/* === Tables === */
.table-custom {
    font-size: 0.85rem;
}

.table-custom th {
    border-top: none;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    padding: 0.6rem 0.5rem;
    background: var(--muted-bg);
}

.table-custom th:first-child {
    border-radius: var(--radius) 0 0 var(--radius);
}

.table-custom th:last-child {
    border-radius: 0 var(--radius) var(--radius) 0;
}

.table-custom td {
    padding: 0.6rem 0.5rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

.table-custom tbody tr:hover {
    background: var(--primary-bg);
}

.badge-rank {
    background: linear-gradient(135deg, var(--primary), var(--blue));
    color: #fff;
    border-radius: 8px;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}

.progress-thin {
    height: 6px;
    border-radius: 3px;
    background: var(--muted-bg);
}

.text-accent { color: var(--blue); }
.text-primary-custom { color: var(--primary); }

.chart-container {
    position: relative;
    height: 300px;
}

/* === AI Insights === */
.insight-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.insight-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.insight-critical { border-left-color: var(--red); }
.insight-warning { border-left-color: var(--yellow); }
.insight-opportunity { border-left-color: var(--blue); }
.insight-positive { border-left-color: var(--green); }

.insight-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.insight-type-badge {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    white-space: nowrap;
}

.insight-badge-critical { background: hsl(0, 100%, 95%); color: var(--red); }
.insight-badge-warning { background: hsl(48, 100%, 93%); color: hsl(48, 80%, 35%); }
.insight-badge-opportunity { background: hsl(199, 89%, 93%); color: var(--blue); }
.insight-badge-positive { background: hsl(152, 69%, 93%); color: hsl(152, 69%, 35%); }

.insight-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}

.insight-metric {
    text-align: center;
    padding: 1.25rem 1rem;
    background: var(--muted-bg);
    border-radius: var(--radius);
}

.insight-metric-value {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}

.insight-metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.insight-description {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 1rem;
}

.insight-recommendations {
    margin-top: 0.75rem;
}
.insight-recommendations .rec-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.badge-insight {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.3rem 0.7rem;
    border-radius: 9999px;
}

.badge-critical { background: hsl(0, 100%, 95%); color: var(--red); }
.badge-warning { background: hsl(48, 100%, 93%); color: hsl(48, 80%, 35%); }
.badge-opportunity { background: hsl(199, 89%, 93%); color: var(--blue); }
.badge-positive { background: hsl(152, 69%, 93%); color: hsl(152, 69%, 35%); }

/* === Chat Widget === */
.chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--blue));
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(108,92,231,0.3), 0 4px 6px -4px rgba(108,92,231,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.2s;
}

.chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 25px 50px -12px rgba(108,92,231,0.35);
}

.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    z-index: 1001;
    overflow: hidden;
    border: 1px solid var(--border);
}

.chat-widget.open {
    display: flex;
}

.chat-header {
    background: linear-gradient(135deg, var(--primary), var(--blue));
    color: #fff;
    padding: 0.9rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-header-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    padding: 0;
}

.chat-close:hover {
    opacity: 1;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-msg {
    max-width: 88%;
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius);
    font-size: 0.83rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-msg.bot {
    background: var(--muted-bg);
    color: var(--text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-msg.user {
    background: linear-gradient(135deg, var(--primary), var(--blue));
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-msg.chat-loading {
    color: var(--text-muted);
    font-style: italic;
}

.chat-input-area {
    display: flex;
    padding: 0.6rem;
    border-top: 1px solid var(--border);
    gap: 0.4rem;
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px hsl(262, 83%, 58%, 0.1);
}

.chat-send {
    background: linear-gradient(135deg, var(--primary), var(--blue));
    color: #fff;
    border: none;
    border-radius: var(--radius);
    width: 38px;
    height: 38px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.chat-send:hover {
    opacity: 0.9;
}

/* === Mobile Header === */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: color-mix(in srgb, var(--card-bg) 80%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 1100;
    align-items: center;
    padding: 0 1rem;
    gap: 0.75rem;
}

.mobile-brand {
    color: var(--text);
    font-weight: 800;
    font-size: 1.1rem;
    flex: 1;
}

.mobile-header .theme-switch {
    flex-shrink: 0;
    box-shadow: none;
}

.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 28px;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.active span:nth-child(2) {
    opacity: 0;
}
.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1049;
}
.sidebar-overlay.open {
    display: block;
}

/* === Report: Score Circle === */
.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    border: 6px solid;
}

.score-circle.score-good { border-color: var(--green); }
.score-circle.score-warning { border-color: var(--yellow); }
.score-circle.score-bad { border-color: var(--red); }

.score-value {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary), var(--blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Report: Score Rows */
.score-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
    font-size: 0.85rem;
}

.score-row-name {
    width: 180px;
    flex-shrink: 0;
    font-weight: 600;
}

.score-bar-wrap {
    flex: 1;
    height: 8px;
    background: var(--muted-bg);
    border-radius: 4px;
    overflow: hidden;
}

.score-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.score-row-pts {
    width: 40px;
    text-align: right;
    font-weight: 700;
    flex-shrink: 0;
}

.score-row-detail {
    width: 200px;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Report: Export button */
.btn-export {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, var(--primary), var(--blue));
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 0.6rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.2s;
    box-shadow: 0 4px 12px rgba(108,92,231,0.25);
}

.btn-export:hover {
    opacity: 0.9;
}

/* Print-only header */
.print-header {
    display: none;
}

/* === Theme Toggle (toggle switch) === */
.theme-switch {
    position: relative;
    width: 48px;
    height: 26px;
    border-radius: 13px;
    border: none;
    background: hsl(214, 32%, 91%);
    cursor: pointer;
    transition: background 0.3s;
    padding: 0;
    display: flex;
    align-items: center;
}

.theme-switch::after {
    content: '';
    position: absolute;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.3s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

html[data-theme="dark"] .theme-switch {
    background: var(--primary);
}

html[data-theme="dark"] .theme-switch::after {
    transform: translateX(22px);
}

.theme-switch-icon {
    position: absolute;
    font-size: 0.7rem;
    line-height: 1;
    transition: opacity 0.3s;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-switch-icon svg {
    width: 14px;
    height: 14px;
}

.theme-switch-sun {
    left: 6px;
    opacity: 1;
}

.theme-switch-moon {
    right: 6px;
    opacity: 0;
}

html[data-theme="dark"] .theme-switch-sun {
    opacity: 0;
}

html[data-theme="dark"] .theme-switch-moon {
    opacity: 1;
}

.theme-switch-desktop {
    position: fixed;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 99;
}

/* Dark mode: insight badges */
html[data-theme="dark"] .insight-badge-critical { background: hsl(0, 60%, 20%); color: var(--red); }
html[data-theme="dark"] .insight-badge-warning { background: hsl(48, 50%, 18%); color: var(--yellow); }
html[data-theme="dark"] .insight-badge-opportunity { background: hsl(199, 50%, 18%); color: var(--blue); }
html[data-theme="dark"] .insight-badge-positive { background: hsl(152, 40%, 18%); color: var(--green); }

html[data-theme="dark"] .badge-critical { background: hsl(0, 60%, 20%); color: var(--red); }
html[data-theme="dark"] .badge-warning { background: hsl(48, 50%, 18%); color: var(--yellow); }
html[data-theme="dark"] .badge-opportunity { background: hsl(199, 50%, 18%); color: var(--blue); }
html[data-theme="dark"] .badge-positive { background: hsl(152, 40%, 18%); color: var(--green); }

/* === AI Recommendations (Пункт В) === */

/* Recommendation cards inside insight */
.rec-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border-left: 3px solid var(--border);
    background: var(--muted-bg);
    margin-bottom: 0.5rem;
    transition: background 0.15s, opacity 0.3s, transform 0.2s;
}
.rec-card:hover {
    transform: translateX(3px);
}
.rec-card.completed {
    opacity: 0.5;
    text-decoration: line-through;
}
.rec-card.completed .rec-action {
    text-decoration: line-through;
}
.rec-high { border-left-color: var(--red); }
.rec-medium { border-left-color: var(--yellow); }
.rec-low { border-left-color: var(--blue); }

/* Custom checkbox */
.rec-checkbox-wrap {
    display: flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}
.rec-checkbox-wrap input[type="checkbox"] {
    display: none;
}
.rec-check-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.rec-checkbox-wrap input:checked + .rec-check-custom {
    background: var(--green);
    border-color: var(--green);
}
.rec-checkbox-wrap input:checked + .rec-check-custom::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: 700;
}

/* Recommendation body */
.rec-body {
    flex: 1;
    min-width: 0;
}
.rec-action {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 4px;
}
.rec-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.rec-owner {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary);
    background: hsla(262, 83%, 58%, 0.08);
    padding: 2px 8px;
    border-radius: 6px;
}
.rec-impact {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--green);
}
.rec-confidence-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}
.rec-conf-high {
    background: hsla(160, 84%, 39%, 0.12);
    color: var(--green);
}
.rec-conf-med {
    background: hsla(45, 93%, 47%, 0.12);
    color: var(--yellow);
}
.rec-conf-low {
    background: hsla(0, 84%, 60%, 0.1);
    color: var(--red);
}
.rec-priority-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.rec-pri-high {
    background: hsla(0, 84%, 60%, 0.1);
    color: var(--red);
}
.rec-pri-medium {
    background: hsla(45, 93%, 47%, 0.12);
    color: var(--yellow);
}
.rec-pri-low {
    background: hsla(199, 89%, 48%, 0.1);
    color: var(--blue);
}

/* Insight confidence and total impact */
.insight-confidence {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--green);
    background: hsla(160, 84%, 39%, 0.1);
    padding: 3px 8px;
    border-radius: 6px;
    margin-left: 0.5rem;
}
.insight-total-impact {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--green);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

/* === To-Do Section === */
.todo-section {
    background: var(--card-bg);
    border: 2px solid var(--primary);
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    position: relative;
    overflow: hidden;
}
.todo-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--green), var(--blue));
}
.todo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.todo-title {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
    margin: 0;
    letter-spacing: -0.02em;
}
.todo-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.todo-progress {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
}
.todo-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.todo-filter {
    padding: 5px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.todo-filter.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.todo-filter:hover:not(.active) {
    border-color: var(--primary);
    color: var(--text);
}

/* To-Do items */
.todo-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.todo-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: var(--muted-bg);
    border-left: 3px solid var(--border);
    transition: background 0.15s, opacity 0.3s, transform 0.15s;
    animation: fadeSlideUp 0.3s ease-out backwards;
}
.todo-item:nth-child(1) { animation-delay: 0s; }
.todo-item:nth-child(2) { animation-delay: 0.03s; }
.todo-item:nth-child(3) { animation-delay: 0.06s; }
.todo-item:nth-child(4) { animation-delay: 0.09s; }
.todo-item:nth-child(5) { animation-delay: 0.12s; }
.todo-item:nth-child(6) { animation-delay: 0.15s; }
.todo-item:nth-child(7) { animation-delay: 0.18s; }
.todo-item:nth-child(8) { animation-delay: 0.21s; }
.todo-item:nth-child(n+9) { animation-delay: 0.24s; }
.todo-item:hover {
    transform: translateX(3px);
}
.todo-item.completed {
    opacity: 0.45;
}
.todo-item.completed .todo-action {
    text-decoration: line-through;
}
.todo-pri-high { border-left-color: var(--red); }
.todo-pri-medium { border-left-color: var(--yellow); }
.todo-pri-low { border-left-color: var(--blue); }
.todo-body {
    flex: 1;
    min-width: 0;
}
.todo-action {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 4px;
}
.todo-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

/* Staggered animation for rec cards */
.rec-card {
    animation: fadeSlideUp 0.25s ease-out backwards;
}
.rec-card:nth-child(1) { animation-delay: 0s; }
.rec-card:nth-child(2) { animation-delay: 0.03s; }
.rec-card:nth-child(3) { animation-delay: 0.06s; }
.rec-card:nth-child(4) { animation-delay: 0.09s; }

/* Dark mode overrides for AI Recommendations */
html[data-theme="dark"] .rec-card {
    background: hsl(225, 14%, 16%);
}
html[data-theme="dark"] .rec-check-custom {
    border-color: hsl(220, 12%, 30%);
}
html[data-theme="dark"] .rec-owner {
    background: hsla(262, 83%, 58%, 0.12);
}
html[data-theme="dark"] .todo-section {
    border-color: hsla(262, 83%, 58%, 0.4);
}
html[data-theme="dark"] .todo-item {
    background: hsl(225, 14%, 16%);
}
html[data-theme="dark"] .todo-filter {
    background: hsl(225, 15%, 14%);
    border-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .todo-filter.active {
    background: var(--primary);
    border-color: var(--primary);
}
html[data-theme="dark"] .insight-confidence {
    background: hsla(160, 84%, 39%, 0.12);
}

/* Dark mode: form controls */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
    background-color: var(--muted-bg);
    color: var(--text);
    border-color: var(--border);
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
    background-color: var(--card-bg);
    color: var(--text);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px hsl(262, 83%, 58%, 0.15);
}

/* Dark mode: chat input */
html[data-theme="dark"] .chat-input {
    background-color: var(--muted-bg);
    color: var(--text);
    border-color: var(--border);
}

html[data-theme="dark"] .chat-input:focus {
    background-color: var(--card-bg);
    color: var(--text);
}

/* Dark mode: filter controls */
html[data-theme="dark"] .filter-input,
html[data-theme="dark"] .filter-select {
    background-color: var(--muted-bg);
    color: var(--text);
    border-color: var(--border);
}

html[data-theme="dark"] .filter-input:focus,
html[data-theme="dark"] .filter-select:focus {
    background-color: var(--card-bg);
    color: var(--text);
}

html[data-theme="dark"] .filter-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Dark mode: Bootstrap table overrides */
html[data-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-striped-bg: var(--muted-bg);
    --bs-table-hover-bg: var(--primary-bg);
}

/* Dark mode: alert overrides */
html[data-theme="dark"] .alert {
    background-color: var(--muted-bg);
    border-color: var(--border);
    color: var(--text);
}

/* Dark mode: Bootstrap text-muted override */
html[data-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}

/* Dark mode: progress bar track */
html[data-theme="dark"] .progress,
html[data-theme="dark"] .progress-thin {
    background: var(--muted-bg);
}

/* Dark mode: Bootstrap modal & dropdown */
html[data-theme="dark"] .dropdown-menu {
    background-color: var(--card-bg);
    border-color: var(--border);
    color: var(--text);
}

html[data-theme="dark"] .dropdown-item {
    color: var(--text);
}

html[data-theme="dark"] .dropdown-item:hover {
    background-color: var(--muted-bg);
}

/* Dark mode: sidebar overlay */
html[data-theme="dark"] .sidebar-overlay.open {
    background: rgba(0, 0, 0, 0.6);
}

/* Dark mode: code tags */
html[data-theme="dark"] code {
    background-color: var(--muted-bg);
    color: var(--primary-light);
}

/* Dark mode: form labels */
html[data-theme="dark"] .form-label {
    color: var(--text);
}

/* Dark mode: upload zone */
html[data-theme="dark"] .upload-zone {
    border-color: var(--border) !important;
}

html[data-theme="dark"] .upload-zone.drag-over {
    border-color: var(--primary) !important;
    background: var(--primary-bg) !important;
}

/* === Filter Bar === */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
}

.filter-bar label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
    display: block;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group.flex-grow {
    flex: 1;
    min-width: 180px;
}

.filter-input,
.filter-select {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-input:focus,
.filter-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px hsl(262, 83%, 58%, 0.1);
}

.filter-select {
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    padding-right: 2rem;
}

.filter-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: auto;
    align-self: flex-end;
    padding-bottom: 0.3rem;
    white-space: nowrap;
}

/* === Print Styles === */
@media print {
    html[data-theme="dark"] {
        --bg: hsl(0, 0%, 99%);
        --card-bg: #ffffff;
        --text: hsl(222, 47%, 11%);
        --text-muted: hsl(215, 16%, 47%);
        --border: hsl(214, 32%, 91%);
        --muted-bg: hsl(210, 40%, 96%);
    }

    .sidebar, .mobile-header, .sidebar-overlay,
    .chat-toggle, .chat-widget, .no-print,
    .theme-switch-desktop {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .print-header {
        display: block !important;
        border-bottom: 2px solid var(--text);
        padding-bottom: 0.5rem;
        margin-bottom: 1rem;
    }

    body {
        background: #fff;
        font-size: 11px;
    }

    .card-custom, .kpi-card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }

    .page-title {
        font-size: 1.2rem;
    }

    .score-circle {
        width: 90px;
        height: 90px;
        border-width: 4px;
    }

    .score-value {
        font-size: 1.8rem;
        -webkit-text-fill-color: var(--primary);
    }

    .kpi-card .kpi-value {
        -webkit-text-fill-color: var(--primary);
    }

    .score-row-detail {
        width: 160px;
    }

    .score-row-name {
        width: 140px;
    }
}

/* === Responsive === */
@media (max-width: 767.98px) {
    .mobile-header {
        display: flex !important;
    }

    .theme-switch-desktop {
        display: none !important;
    }

    .sidebar {
        position: fixed;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        top: 0;
        left: 0;
        width: 260px;
        min-height: 100vh;
        padding-top: 1.5rem;
        box-shadow: 4px 0 24px rgba(0,0,0,0.1);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        padding: 1rem;
        padding-top: calc(56px + 1rem);
    }

    .page-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    /* KPI cards: 2 per row */
    .row .col-md-3 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    .row .col-md-4 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    .kpi-card {
        padding: 0.85rem;
    }

    .kpi-card .kpi-value {
        font-size: 1.2rem;
    }

    .kpi-card .kpi-label {
        font-size: 0.7rem;
    }

    /* Charts full width */
    .row .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    .chart-container {
        height: 250px;
    }

    /* Tables scroll */
    .card-custom {
        padding: 1rem;
        overflow-x: auto;
    }

    .table-custom {
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .table-custom th,
    .table-custom td {
        padding: 0.35rem 0.4rem;
    }

    /* Insights */
    .insight-card {
        padding: 1rem;
    }

    .insight-card .col-md-3,
    .insight-card .col-md-9 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    .insight-metric {
        margin-bottom: 0.75rem;
    }

    .insight-metric-value {
        font-size: 1.6rem;
    }

    .insight-title {
        font-size: 0.95rem;
    }

    .insight-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Filter bar responsive */
    .filter-bar {
        flex-direction: column;
        gap: 0.5rem;
    }

    .filter-group,
    .filter-group.flex-grow {
        width: 100%;
        min-width: 0;
    }

    .filter-input,
    .filter-select {
        width: 100%;
    }

    .filter-count {
        margin-left: 0;
        align-self: flex-start;
    }

    /* Chat widget full width */
    .chat-widget {
        width: calc(100% - 16px);
        height: calc(100% - 80px);
        bottom: 8px;
        right: 8px;
    }

    .chat-toggle {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
        font-size: 0.95rem;
    }
}

/* ═══ Empty States ═══ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    min-height: 320px;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}
.empty-state-icon svg {
    width: 28px;
    height: 28px;
    color: var(--primary);
}

.empty-state-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.empty-state-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 420px;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.empty-state-btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    background: linear-gradient(135deg, hsl(262, 83%, 58%), hsl(199, 89%, 48%));
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.2s;
}

.empty-state-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    color: #fff;
}

/* ═══ Multi-Select ═══ */
.multi-select {
    position: relative;
    min-width: 160px;
}

.multi-select-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.4;
    text-align: left;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.multi-select-toggle:hover {
    border-color: var(--primary);
}

.multi-select.open .multi-select-toggle {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px hsl(262, 83%, 58%, 0.1);
}

.multi-select-toggle::after {
    content: '';
    border: solid var(--text-muted);
    border-width: 0 1.5px 1.5px 0;
    padding: 2.5px;
    transform: rotate(45deg);
    flex-shrink: 0;
    margin-top: -2px;
    transition: transform 0.2s;
}

.multi-select.open .multi-select-toggle::after {
    transform: rotate(-135deg);
    margin-top: 2px;
}

.multi-select-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multi-select-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.multi-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    min-width: 220px;
    max-height: 260px;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 100;
    padding: 0.35rem 0;
}

.multi-select.open .multi-select-dropdown {
    display: block;
}

.multi-select-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text);
    transition: background 0.15s;
    user-select: none;
    margin: 0;
}

.multi-select-option:hover {
    background: var(--muted-bg);
}

/* Hide native checkbox, use custom */
.multi-select-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.multi-select-check {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-radius: 4px;
    flex-shrink: 0;
    transition: all 0.15s;
    background: transparent;
}

.multi-select-option input[type="checkbox"]:checked + .multi-select-check {
    background: var(--primary);
    border-color: var(--primary);
}

.multi-select-check::after {
    content: '';
    display: none;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -1px;
}

.multi-select-option input[type="checkbox"]:checked + .multi-select-check::after {
    display: block;
}

.multi-select-option span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multi-select-all {
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    margin-bottom: 0.2rem;
    padding-bottom: 0.5rem;
}

html[data-theme="dark"] .multi-select-toggle {
    background: var(--muted-bg);
}

html[data-theme="dark"] .multi-select.open .multi-select-toggle {
    background: var(--card-bg);
}

html[data-theme="dark"] .multi-select-dropdown {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .multi-select-check {
    border-color: hsl(220, 12%, 40%);
}

/* === AI Schedule Calendar === */
.schedule-calendar {
    width: 100%;
    border-spacing: 6px;
    border-collapse: separate;
}

.schedule-calendar th {
    background: var(--muted-bg);
    border-radius: 10px;
    text-align: center;
    padding: 10px 8px;
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.sch-day-cell {
    background: var(--card-bg);
    border-radius: 12px;
    vertical-align: top;
    padding: 10px !important;
    min-height: 90px;
    min-width: 110px;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.25s, transform 0.15s;
}

.sch-day-cell:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 24px hsla(262, 83%, 58%, 0.1);
    transform: translateY(-2px);
}

.sch-day-cell.weekend {
    border-color: hsla(262, 83%, 58%, 0.2);
    background: linear-gradient(135deg, var(--card-bg), hsla(262, 83%, 58%, 0.04), hsla(199, 89%, 48%, 0.03));
}

.sch-day-cell.modified {
    border-color: var(--yellow) !important;
    box-shadow: 0 0 0 2px hsla(45, 93%, 47%, 0.15);
}

.sch-day-cell.has-vacation {
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 8px,
        hsla(330, 80%, 70%, 0.06) 8px,
        hsla(330, 80%, 70%, 0.06) 16px
    ), var(--card-bg);
}

.sch-day-cell.accepting {
    border-style: dashed;
}

.sch-day-cell.today {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px hsla(262, 83%, 58%, 0.2), 0 4px 12px hsla(262, 83%, 58%, 0.08);
}

.sch-day-cell.today .sch-day-num {
    background: var(--primary);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
}

.sch-day-cell.drag-over {
    border-color: var(--green) !important;
    box-shadow: 0 0 0 3px hsla(160, 84%, 39%, 0.2);
    background: hsla(160, 84%, 39%, 0.04);
}

.sch-other-month-day {
    background: var(--card-bg);
    border-radius: 10px;
    vertical-align: top;
    padding: 10px !important;
    min-height: 90px;
    min-width: 110px;
    border: 2px solid var(--border);
    opacity: 0.5;
    cursor: pointer;
}

.sch-other-month {
    background: transparent;
    border: none;
}

.sch-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.sch-day-num {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.sch-day-rev {
    font-size: 11px;
    color: var(--green);
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 6px;
    font-family: 'Outfit', sans-serif;
}

/* Revenue color coding */
.sch-day-rev-good {
    background: hsla(160, 84%, 39%, 0.12);
    color: var(--green);
}
.sch-day-rev-low {
    background: hsla(0, 84%, 60%, 0.1);
    color: var(--red);
}
.sch-day-rev-zero {
    background: hsla(220, 12%, 50%, 0.08);
    color: var(--text-muted);
}

/* AI deviation delta badge */
.sch-day-delta {
    display: inline-block;
    font-family: 'Outfit', sans-serif;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0 4px;
    border-radius: 4px;
    margin-left: 2px;
    line-height: 1.4;
}
.sch-day-delta.positive {
    color: var(--green);
    background: hsla(160, 84%, 39%, 0.1);
}
.sch-day-delta.negative {
    color: var(--red);
    background: hsla(0, 84%, 60%, 0.08);
}

/* Aggregate deviation summary */
.sch-deviation-summary {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    display: inline-block;
}
.sch-deviation-summary.positive {
    color: var(--green);
    background: hsla(160, 84%, 39%, 0.1);
}
.sch-deviation-summary.negative {
    color: var(--red);
    background: hsla(0, 84%, 60%, 0.08);
}

/* Dark mode */
html[data-theme="dark"] .sch-day-rev-good {
    background: hsla(160, 84%, 39%, 0.15);
}
html[data-theme="dark"] .sch-day-rev-low {
    background: hsla(0, 84%, 60%, 0.12);
}
html[data-theme="dark"] .sch-day-delta.positive {
    background: hsla(160, 84%, 39%, 0.12);
}
html[data-theme="dark"] .sch-day-delta.negative {
    background: hsla(0, 84%, 60%, 0.1);
}

.sch-master-list {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

/* Master Chips */
.master-chip {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.15s, box-shadow 0.2s;
    user-select: none;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.master-chip:hover {
    transform: scale(1.08) translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.master-chip:active {
    transform: scale(0.95);
}

.master-chip.removable:hover::after {
    content: ' ×';
    font-weight: 400;
}

.master-chip.dragging {
    opacity: 0.5;
}

/* Master Panel */
.master-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.master-chip-panel {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 8px;
    transition: transform 0.15s, box-shadow 0.15s, outline 0.15s;
}

.master-chip-panel.selected {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    transform: scale(1.08);
    box-shadow: 0 0 12px hsla(262, 83%, 58%, 0.4);
}

/* Color dot for master table */
.color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

/* KPI flash animation */
@keyframes kpiFlash {
    0% { color: var(--primary); transform: scale(1.05); }
    100% { color: inherit; transform: scale(1); }
}
.kpi-flash {
    animation: kpiFlash 0.4s ease-out;
}

/* === Schedule Loader === */
.sch-loader-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    transition: opacity 0.3s ease;
}
.sch-loader-content {
    text-align: center; max-width: 320px;
}
.sch-loader-spinner {
    width: 48px; height: 48px; margin: 0 auto 20px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: sch-spin 0.8s linear infinite;
}
@keyframes sch-spin { to { transform: rotate(360deg); } }
.sch-loader-title {
    font-size: 1.25rem; font-weight: 600; color: var(--text-primary);
    margin-bottom: 8px;
}
.sch-loader-text {
    font-size: 0.875rem; color: var(--text-muted);
    margin-bottom: 16px;
}
.sch-loader-progress {
    width: 100%; height: 4px; background: var(--border-color);
    border-radius: 2px; overflow: hidden;
}
.sch-loader-bar {
    height: 100%; width: 0;
    background: linear-gradient(90deg, var(--primary), var(--accent, #8b5cf6));
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* === Schedule Header === */
.sch-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}
.sch-header-left { flex: 1; }
.sch-header-right { flex-shrink: 0; }
.sch-title {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 1.65rem;
    font-weight: 900;
    margin: 0 0 0.35rem;
    color: var(--text);
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.sch-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    letter-spacing: 0.01em;
}

/* === KPI Row === */
.sch-kpi-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}
.sch-kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.1rem 1.15rem;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}
.sch-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, transparent);
    transition: background 0.3s;
}
.sch-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}
.sch-kpi-card:hover::before {
    background: linear-gradient(90deg, var(--primary), var(--blue));
}
.sch-kpi-potential {
    background: linear-gradient(135deg, hsla(199, 89%, 48%, 0.06), hsla(262, 83%, 58%, 0.06));
    border-color: hsla(199, 89%, 48%, 0.25);
}
html[data-theme="dark"] .sch-kpi-potential {
    background: linear-gradient(135deg, hsla(199, 89%, 48%, 0.08), hsla(262, 83%, 58%, 0.08));
    border-color: hsla(199, 89%, 48%, 0.2);
}
.sch-kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    font-weight: 700;
    flex-shrink: 0;
}
.sch-kpi-value {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.02em;
}
.sch-kpi-label {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 2px;
    letter-spacing: 0.01em;
}
.sch-kpi-compare {
    font-size: 0.72rem;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.sch-kpi-compare span:last-child {
    color: var(--text-muted);
}
.sch-kpi-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.sch-kpi-body {
    flex: 1;
    min-width: 0;
}
.sch-kpi-chevron {
    margin-left: 4px;
    vertical-align: middle;
    opacity: 0.5;
}

/* KPI icon color variants */
.sch-kpi-icon-revenue { background: rgba(99,102,241,0.12); color: #6366f1; }
.sch-kpi-icon-days { background: rgba(16,185,129,0.12); color: #10b981; }
.sch-kpi-icon-hours { background: rgba(245,158,11,0.12); color: #f59e0b; }
.sch-kpi-icon-rpd { background: rgba(236,72,153,0.12); color: #ec4899; }
.sch-kpi-icon-util { background: rgba(14,165,233,0.12); color: #0ea5e9; }

/* Table alignment helpers */
.th-right { text-align: right; }
.th-center { text-align: center; }

/* === Calendar Toolbar === */
.sch-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.sch-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sch-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sch-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}
.sch-nav-btn:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
}
.sch-nav-title {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    min-width: 180px;
    text-align: center;
    color: var(--text);
    letter-spacing: -0.01em;
}
.sch-view-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.sch-view-btn {
    padding: 6px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    background: var(--card-bg);
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.sch-view-btn.active {
    background: var(--primary);
    color: white;
}
.sch-view-btn:hover:not(.active) {
    background: var(--muted-bg);
}

/* === Schedule Buttons === */
.sch-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s, transform 0.1s;
}
.sch-btn:active {
    transform: scale(0.97);
}
.sch-btn-ghost {
    background: var(--muted-bg);
    color: var(--text);
}
.sch-btn-ghost:hover {
    background: var(--border);
}
.sch-btn-warning {
    background: var(--yellow);
    color: #1a1a2e;
}
.sch-btn-warning:hover {
    opacity: 0.85;
}

/* === Week Navigation === */
.sch-week-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.sch-week-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 200px;
    text-align: center;
}

/* === Master Panel Wrapper === */
.sch-master-panel-wrap {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.15rem 1.35rem;
    margin-bottom: 1.25rem;
    position: relative;
    overflow: hidden;
}
.sch-master-panel-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--blue), var(--green));
    opacity: 0.5;
}
.sch-panel-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}
.sch-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}
.sch-legend {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.sch-legend-modified {
    color: var(--yellow);
}

/* === Calendar Wrapper === */
.sch-calendar-wrap {
    margin-bottom: 1.5rem;
    overflow-x: auto;
}
.sch-weekend-th {
    color: var(--primary) !important;
}

/* === Day Cell Layout === */
.sch-day-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.sch-today-num {
    background: var(--primary);
    color: white !important;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.other-month {
    opacity: 0.35;
    pointer-events: none;
}

/* === Section & Table === */
.sch-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.35rem;
    margin-bottom: 1.35rem;
}
.sch-section-title {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: var(--text);
    letter-spacing: -0.01em;
}
.sch-table-wrap {
    overflow-x: auto;
}

/* === Master Sidebar === */
.sch-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.sch-sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.sch-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 92vw;
    height: 100vh;
    background: var(--card-bg);
    border-left: 1px solid var(--border);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 40px rgba(0,0,0,0.08);
}
.sch-sidebar.open {
    transform: translateX(0);
}
.sch-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sch-sidebar-master-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}
.sch-sidebar-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.sch-sidebar-name {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sch-sidebar-spec {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.sch-sidebar-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.sch-sidebar-close:hover {
    background: var(--muted-bg);
    color: var(--text);
}
.sch-sidebar-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}
.sch-sidebar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.sch-sidebar-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

/* Hours control */
.sch-hours-control {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.sch-hours-btn {
    width: 36px;
    height: 34px;
    border: none;
    background: var(--muted-bg);
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.sch-hours-btn:hover {
    background: var(--primary-bg);
    color: var(--primary);
}
.sch-hours-value {
    padding: 0 14px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    min-width: 48px;
    text-align: center;
}

/* Mini calendar */
.sch-mini-cal {
    width: 100%;
    border-spacing: 4px;
    border-collapse: separate;
    margin-bottom: 1rem;
}
.sch-mini-cal th {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    padding: 4px;
    font-weight: 600;
}
.sch-mini-day {
    text-align: center;
    padding: 8px 4px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    border: 2px solid transparent;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.sch-mini-day:hover:not(.sch-mini-other) {
    background: var(--primary-bg);
    transform: scale(1.08);
}
.sch-mini-active {
    background: var(--primary);
    color: white !important;
    border-color: var(--primary);
}
.sch-mini-active:hover {
    background: var(--primary-light) !important;
}
.sch-mini-changed {
    border-color: var(--yellow) !important;
}
.sch-mini-other {
    color: var(--text-muted);
    opacity: 0.3;
}

/* Sidebar quick actions */
.sch-sidebar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 1rem;
}
.sch-btn-sm {
    padding: 5px 10px;
    font-size: 0.75rem;
}

/* Sidebar stats */
.sch-sidebar-stats {
    background: var(--muted-bg);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
}
.sch-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 0.82rem;
    color: var(--text);
}
.sch-stat-row + .sch-stat-row {
    border-top: 1px solid var(--border);
}

/* Clickable master table row */
.sch-master-row {
    cursor: pointer;
    transition: background 0.15s;
}
.sch-master-row:hover {
    background: var(--primary-bg) !important;
}

/* === Time Select === */
.sch-time-select {
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.sch-time-select:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
}
.sch-time-sm {
    padding: 3px 6px;
    font-size: 0.78rem;
}
.sch-time-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sch-time-duration {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

/* Shift pattern row */
.sch-shift-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.sch-shift-select {
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.78rem;
    cursor: pointer;
}
.sch-shift-start-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}
.sch-shift-start {
    padding: 3px 6px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.75rem;
    max-width: 130px;
}

.sch-chip-time {
    display: inline-block;
    margin-left: 3px;
    opacity: 0.75;
    font-size: 9px;
    font-weight: 400;
}

/* === Day Detail Modal === */
.sch-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.sch-modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.sch-day-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateY(20px) scale(0.97);
    width: 720px;
    max-width: 94vw;
    max-height: 88vh;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    z-index: 1002;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.03);
}
.sch-day-modal.open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) translateY(0) scale(1);
}
.sch-day-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sch-day-modal-title {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}
.sch-day-modal-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
}
/* Day potential bar */
.sch-day-potential {
    padding: 0 0 12px;
}
.sch-day-pot-label {
    display: flex; justify-content: space-between;
    font-size: 0.78rem; color: var(--text-muted); margin-bottom: 6px;
}
.sch-day-pot-label b { color: var(--text); }
.sch-day-pot-track {
    position: relative; height: 8px; border-radius: 4px;
    background: var(--border); overflow: hidden;
}
.sch-day-pot-fill {
    position: absolute; top: 0; left: 0; height: 100%; border-radius: 4px;
    background: linear-gradient(90deg, var(--green), hsl(142, 60%, 50%));
    transition: width 0.4s ease;
}
.sch-day-pot-gap {
    position: absolute; top: 0; height: 100%;
    background: repeating-linear-gradient(90deg, hsla(45, 90%, 55%, 0.35) 0, hsla(45, 90%, 55%, 0.35) 4px, transparent 4px, transparent 8px);
    border-radius: 0 4px 4px 0;
}
.sch-day-pot-hint {
    font-size: 0.75rem; color: var(--yellow); margin-top: 4px; font-weight: 600;
}
html[data-theme="dark"] .sch-day-pot-track { background: hsla(220, 12%, 30%, 0.5); }
html[data-theme="dark"] .sch-day-pot-gap {
    background: repeating-linear-gradient(90deg, hsla(45, 80%, 50%, 0.3) 0, hsla(45, 80%, 50%, 0.3) 4px, transparent 4px, transparent 8px);
}

.sch-day-modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Timeline */
.sch-timeline {
    position: relative;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}
.sch-timeline-hours {
    position: relative;
    height: 20px;
    margin-bottom: 4px;
    margin-left: 60px;
    margin-right: 50px;
}
.sch-timeline-hours span {
    position: absolute;
    font-size: 0.7rem;
    color: var(--text-muted);
    transform: translateX(-50%);
    white-space: nowrap;
}
.sch-timeline-grid {
    position: absolute;
    top: 0;
    left: 60px;
    right: 50px;
    height: 100%;
    pointer-events: none;
}
.sch-timeline-gridline {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border, rgba(0,0,0,0.06));
}
.sch-timeline-prime {
    position: absolute;
    top: 20px;
    left: 60px;
    right: 50px;
    bottom: 28px;
    pointer-events: none;
}
.sch-timeline-prime-band {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(245, 158, 11, 0.06);
    border-radius: 4px;
}
.sch-timeline-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}
.sch-timeline-label {
    width: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sch-timeline-track {
    flex: 1;
    height: 28px;
    background: var(--muted-bg, rgba(0,0,0,0.02));
    border-radius: 4px;
    position: relative;
}
.sch-timeline-bar {
    position: absolute;
    top: 2px;
    bottom: 2px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
    font-weight: 500;
    min-width: 40px;
    opacity: 0.9;
    overflow: visible;
}
.sch-timeline-bar {
    overflow: visible;
    transition: opacity 0.15s, box-shadow 0.15s;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
    cursor: grab;
}
.sch-timeline-bar::before,
.sch-timeline-bar::after {
    content: '';
    position: absolute;
    top: 0;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    z-index: 2;
    border-radius: 2px;
    transition: background 0.15s;
}
.sch-timeline-bar::before { left: -2px; }
.sch-timeline-bar::after { right: -2px; }
.sch-timeline-bar:hover::before,
.sch-timeline-bar:hover::after {
    background: rgba(99, 102, 241, 0.3);
}
.sch-timeline-bar.sch-resizing {
    opacity: 0.8;
    box-shadow: 0 0 0 2px var(--primary, #6366f1);
}
.sch-timeline-bar.sch-moving {
    opacity: 0.85;
    box-shadow: 0 0 0 2px var(--primary, #6366f1);
    cursor: grabbing;
}
.sch-timeline-bar span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}
.sch-timeline-rev {
    width: 46px;
    font-size: 0.75rem;
    text-align: right;
    color: var(--text-muted, #6b7280);
    flex-shrink: 0;
}
.sch-timeline-summary {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    margin-top: 6px;
    border-top: 1px solid var(--border, rgba(0,0,0,0.08));
    font-size: 0.8rem;
    color: var(--text-secondary, #6b7280);
}

/* Day master cards */
.sch-day-master-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1rem;
}
.sch-day-master-card {
    background: var(--muted-bg);
    border-radius: 10px;
    padding: 10px 12px;
}
.sch-day-master-info {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 0.85rem;
}
.sch-day-master-time {
    display: flex;
    align-items: center;
    gap: 6px;
}
.sch-remove-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--red);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    transition: background 0.15s;
    flex-shrink: 0;
}
.sch-remove-btn:hover {
    background: hsla(0, 84%, 60%, 0.1);
}
.sch-add-master-select {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.85rem;
}
/* === Day Cell Add Button (+) === */
.sch-day-top-right {
    display: flex;
    align-items: center;
    gap: 6px;
}
.sch-day-add-btn {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1.5px dashed var(--text-muted);
    background: transparent;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    opacity: 0;
}
.sch-day-cell:hover .sch-day-add-btn {
    opacity: 1;
}
.sch-day-add-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: hsla(262, 83%, 58%, 0.08);
    border-style: solid;
}

/* === Day Capacity Badge === */
.sch-day-capacity-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--yellow, #f59e0b);
    background: hsla(38, 92%, 50%, 0.12);
    padding: 1px 5px;
    border-radius: 4px;
    letter-spacing: 0.03em;
}
html[data-theme="dark"] .sch-day-capacity-badge {
    background: hsla(38, 92%, 50%, 0.18);
}

/* === Day Modal Add Section === */
.sch-day-add {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.sch-day-add-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}
.sch-day-add-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.sch-add-master-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 8px;
    border: 1.5px dashed color-mix(in srgb, var(--chip-color) 50%, transparent);
    background: color-mix(in srgb, var(--chip-color) 8%, transparent);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.sch-add-master-btn:hover {
    border-style: solid;
    border-color: var(--chip-color);
    background: color-mix(in srgb, var(--chip-color) 18%, transparent);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--chip-color) 25%, transparent);
}
.sch-add-master-btn:active {
    transform: translateY(0);
}
.sch-add-master-emoji {
    font-size: 1rem;
}

/* Add master form */
.sch-add-master-form { display: flex; flex-direction: column; gap: 12px; }
.sch-form-group { display: flex; flex-direction: column; gap: 4px; }
.sch-form-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.sch-form-input {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--card-bg); color: var(--text); font-size: 0.85rem;
}
.sch-form-input:focus { outline: 2px solid var(--primary); outline-offset: -2px; }
html[data-theme="dark"] .sch-form-input { background: hsl(225, 15%, 14%); border-color: hsl(220, 12%, 22%); }

/* Dark mode overrides for schedule */
html[data-theme="dark"] .sch-sidebar {
    background: hsl(225, 15%, 12%);
    border-color: hsl(220, 12%, 22%);
    box-shadow: -4px 0 24px rgba(0,0,0,0.4);
}
html[data-theme="dark"] .sch-sidebar-header {
    border-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .sch-sidebar-close {
    border-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .sch-hours-control {
    border-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .sch-hours-btn {
    background: hsl(225, 14%, 18%);
}
html[data-theme="dark"] .sch-sidebar-stats {
    background: hsl(225, 14%, 16%);
}
html[data-theme="dark"] .sch-shift-select {
    background: hsl(225, 15%, 18%);
    border-color: hsl(220, 12%, 28%);
}
html[data-theme="dark"] .sch-shift-start {
    background: hsl(225, 15%, 18%);
    border-color: hsl(220, 12%, 28%);
}
html[data-theme="dark"] .sch-sidebar-overlay,
html[data-theme="dark"] .sch-modal-overlay {
    background: rgba(0,0,0,0.6);
}
html[data-theme="dark"] .sch-day-modal {
    background: hsl(225, 15%, 12%);
    border-color: hsl(220, 12%, 22%);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
html[data-theme="dark"] .sch-day-modal-header {
    border-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .sch-time-select {
    background: hsl(225, 14%, 18%);
    border-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .sch-day-master-card {
    background: hsl(225, 14%, 16%);
}
html[data-theme="dark"] .sch-timeline-track {
    background: hsl(225, 14%, 18%);
}
html[data-theme="dark"] .sch-timeline-prime-band {
    background: rgba(245, 158, 11, 0.08);
}
html[data-theme="dark"] .sch-timeline-gridline {
    background: rgba(255,255,255,0.06);
}
html[data-theme="dark"] .sch-remove-btn {
    border-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .schedule-calendar th {
    background: hsla(225, 15%, 18%, 1);
}

html[data-theme="dark"] .sch-day-add-btn {
    border-color: hsl(220, 12%, 35%);
    color: hsl(220, 12%, 45%);
}
html[data-theme="dark"] .sch-day-add-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: hsla(262, 83%, 58%, 0.12);
}
html[data-theme="dark"] .sch-day-add {
    border-top-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .sch-day-cell {
    background: hsl(225, 15%, 14%);
    border-color: hsl(225, 12%, 22%);
}

html[data-theme="dark"] .sch-day-cell:hover {
    border-color: var(--primary);
}

html[data-theme="dark"] .sch-day-cell.weekend {
    border-color: hsla(262, 83%, 58%, 0.3);
}
html[data-theme="dark"] .sch-kpi-card,
html[data-theme="dark"] .sch-master-panel-wrap,
html[data-theme="dark"] .sch-section {
    background: hsl(225, 15%, 14%);
    border-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .sch-nav-btn {
    background: hsl(225, 15%, 14%);
    border-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .sch-view-btn {
    background: hsl(225, 15%, 14%);
    color: var(--text-muted);
}
html[data-theme="dark"] .sch-btn-ghost {
    background: hsl(225, 14%, 18%);
}

/* === Potential Analysis Panel === */
.sch-kpi-clickable {
    cursor: pointer;
}
.sch-kpi-clickable:hover {
    border-color: #0ea5e9 !important;
    box-shadow: 0 4px 20px hsla(199, 89%, 48%, 0.15);
}

.sch-potential-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 1.35rem;
    overflow: hidden;
    animation: fadeSlideUp 0.3s ease-out;
}
.sch-potential-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 1.35rem;
    border-bottom: 1px solid var(--border);
}
.sch-potential-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    padding: 0 1.35rem;
    gap: 0;
}
.sch-pot-tab {
    padding: 0.6rem 1.2rem;
    border: none;
    background: none;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}
.sch-pot-tab:hover { color: var(--text); }
.sch-pot-tab.active {
    color: var(--primary, #6366f1);
    border-bottom-color: var(--primary, #6366f1);
}
.sch-potential-title {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}
.sch-potential-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0.2rem 0 0;
}
.sch-potential-body {
    padding: 1.35rem;
}

/* Progress bar */
.sch-potential-bar-wrap {
    margin-bottom: 1.5rem;
}
.sch-potential-bar-bg {
    height: 28px;
    background: var(--muted-bg);
    border-radius: 14px;
    position: relative;
    overflow: hidden;
}
.sch-potential-bar-fill {
    height: 100%;
    border-radius: 14px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s;
    min-width: 4px;
}
.sch-potential-bar-optimal {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 3px;
    background: var(--green);
    border-radius: 2px;
    transition: left 0.4s;
    z-index: 1;
}
.sch-potential-bar-optimal::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -3px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--green);
}
.sch-potential-bar-labels {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-top: 6px;
    font-size: 0.7rem;
    color: var(--text-muted);
}
.sch-potential-bar-labels span:nth-child(2),
.sch-potential-bar-labels span:nth-child(3) {
    position: absolute;
    transform: translateX(-50%);
    font-weight: 600;
}
.sch-potential-bar-labels span:nth-child(2) {
    color: #0ea5e9;
}
.sch-potential-bar-labels span:nth-child(3) {
    color: var(--green);
}

/* Breakdown rows */
.sch-potential-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 1.25rem;
}
.sch-pot-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.sch-pot-row:last-child {
    border-bottom: none;
}
.sch-pot-sep {
    border-top: 2px solid var(--border);
    margin-top: 2px;
    padding-top: 0.65rem;
}
.sch-pot-label {
    color: var(--text-muted);
}

/* Editable workstations input */
.sch-pot-editable {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.sch-pot-adj-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--muted-bg);
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.sch-pot-adj-btn:hover {
    background: var(--primary-bg);
    color: var(--primary);
}
.sch-pot-input {
    width: 44px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 700;
    font-family: inherit;
    height: 32px;
    -moz-appearance: textfield;
}
.sch-pot-input::-webkit-inner-spin-button,
.sch-pot-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.sch-pot-input:focus {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}
html[data-theme="dark"] .sch-pot-adj-btn {
    background: hsl(225, 14%, 18%);
}
html[data-theme="dark"] .sch-pot-input {
    background: hsl(225, 15%, 14%);
    border-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .sch-pot-editable {
    border-color: hsl(220, 12%, 22%);
}

/* Admin name text input */
.sch-pot-text-input {
    width: 180px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.82rem;
}
.sch-pot-text-input:focus {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}
.sch-pot-text-input::placeholder { color: var(--text-muted); }
html[data-theme="dark"] .sch-pot-text-input {
    background: hsl(225, 15%, 14%);
    border-color: hsl(220, 12%, 22%);
}

/* Salon hours row */
.sch-pot-time-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.sch-pot-select {
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}
.sch-pot-select:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
}
.sch-pot-hours-badge {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    margin-left: 4px;
}
.sch-pot-pct-badge {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 0 6px;
}
html[data-theme="dark"] .sch-pot-select {
    background: hsl(225, 14%, 18%);
    border-color: hsl(220, 12%, 22%);
}

/* Potential section title */
.sch-potential-section-title {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    margin: 1.25rem 0 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    letter-spacing: -0.01em;
}

/* Lever cards */
.sch-potential-levers {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}
.sch-lever-card {
    background: hsla(0, 0%, 100%, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid hsla(0, 0%, 100%, 0.3);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    transition: transform 0.15s;
}
.sch-lever-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.sch-lever-header {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
}
.sch-lever-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-bg);
    border-radius: 10px;
}
.sch-lever-icon svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
}
.sch-lever-info {
    flex: 1;
    min-width: 0;
}
.sch-lever-title {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
}
.sch-lever-desc {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 1px;
}
.sch-lever-gain {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--green);
    white-space: nowrap;
    flex-shrink: 0;
}
.sch-lever-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px dashed var(--border);
    line-height: 1.45;
}

/* Summary breakdown line */
.sch-pot-summary-breakdown {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.6rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.sch-pot-summary-breakdown strong {
    color: var(--green);
}

/* Dark mode levers */
html[data-theme="dark"] .sch-lever-card {
    background: hsla(225, 15%, 18%, 0.6);
    border-color: hsla(225, 15%, 25%, 0.5);
}
html[data-theme="dark"] .sch-lever-icon {
    background: hsl(225, 15%, 20%);
}
html[data-theme="dark"] .sch-lever-hint {
    border-top-color: hsl(220, 12%, 22%);
}

/* Lever chevron */
.sch-lever-chevron {
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: transform 0.25s ease;
    margin-left: auto;
    flex-shrink: 0;
}
.sch-lever-chevron-open {
    transform: rotate(90deg);
}

/* Lever To-Do list */
.sch-lever-todos {
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--border);
}
.sch-lever-todos-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.sch-todo-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0;
    font-size: 0.82rem;
    line-height: 1.4;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
}
.sch-todo-item:hover {
    background: hsla(220, 20%, 50%, 0.06);
}
.sch-todo-check {
    margin-top: 2px;
    accent-color: var(--purple);
    flex-shrink: 0;
    cursor: pointer;
}
.sch-todo-who {
    font-weight: 600;
    color: var(--purple);
    white-space: nowrap;
    flex-shrink: 0;
}
.sch-todo-task {
    color: var(--text);
}
.sch-todo-item:has(.sch-todo-check:checked) .sch-todo-task {
    text-decoration: line-through;
    opacity: 0.5;
}
.sch-todo-item:has(.sch-todo-check:checked) .sch-todo-who {
    opacity: 0.5;
}

/* Admin toggle */
.sch-pot-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0;
}
.sch-pot-toggle input[type="checkbox"] {
    accent-color: var(--purple);
    cursor: pointer;
}
.sch-pot-toggle-label {
    font-size: 0.82rem;
    color: var(--text);
    cursor: pointer;
}

/* Dark mode todos */
html[data-theme="dark"] .sch-lever-todos {
    border-top-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .sch-todo-item:hover {
    background: hsla(220, 20%, 60%, 0.08);
}

/* Enhanced todo items */
.sch-todo-body {
    flex: 1;
    min-width: 0;
}
.sch-todo-action {
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--text);
}
.sch-todo-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 4px;
    align-items: center;
}
.sch-todo-impact {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--green);
}
.sch-todo-conf {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 4px;
}
.sch-todo-conf-high {
    background: hsla(160, 84%, 39%, 0.12);
    color: var(--green);
}
.sch-todo-conf-med {
    background: hsla(45, 93%, 47%, 0.12);
    color: var(--yellow);
}
.sch-todo-conf-low {
    background: hsla(0, 84%, 60%, 0.1);
    color: var(--red);
}
.sch-todo-pri {
    font-size: 0.62rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.sch-todo-pri-high {
    background: hsla(0, 84%, 60%, 0.1);
    color: var(--red);
}
.sch-todo-pri-medium {
    background: hsla(45, 93%, 47%, 0.12);
    color: var(--yellow);
}
.sch-todo-pri-low {
    background: hsla(199, 89%, 48%, 0.1);
    color: var(--blue);
}
.sch-todo-lever {
    font-size: 0.65rem;
    color: var(--text-muted);
}
.sch-todo-completed {
    opacity: 0.4;
}
.sch-todo-completed .sch-todo-action,
.sch-todo-completed .sch-ai-todo-action {
    text-decoration: line-through;
}

/* === AI To-Do Section (consolidated) === */
.sch-ai-todo-section {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 2px solid var(--primary);
    position: relative;
}
.sch-ai-todo-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--green), var(--blue));
}
.sch-ai-todo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.sch-ai-todo-title {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    margin: 0;
    letter-spacing: -0.02em;
}
.sch-ai-todo-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sch-ai-todo-progress {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
}
.sch-ai-todo-filters {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.sch-ai-todo-filter {
    padding: 4px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sch-ai-todo-filter.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.sch-ai-todo-filter:hover:not(.active) {
    border-color: var(--primary);
    color: var(--text);
}
.sch-ai-todo-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 500px;
    overflow-y: auto;
}
.sch-ai-todo-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    background: var(--muted-bg);
    border-left: 3px solid var(--border);
    transition: background 0.15s, opacity 0.3s, transform 0.15s;
    animation: fadeSlideUp 0.25s ease-out backwards;
}
.sch-ai-todo-item:hover {
    transform: translateX(2px);
}
.sch-todo-pri-border-high { border-left-color: var(--red); }
.sch-todo-pri-border-medium { border-left-color: var(--yellow); }
.sch-todo-pri-border-low { border-left-color: var(--blue); }

.sch-ai-todo-body {
    flex: 1;
    min-width: 0;
}
.sch-ai-todo-action {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 3px;
}
.sch-ai-todo-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

/* Staggered animation for todo items */
.sch-ai-todo-item:nth-child(1) { animation-delay: 0s; }
.sch-ai-todo-item:nth-child(2) { animation-delay: 0.02s; }
.sch-ai-todo-item:nth-child(3) { animation-delay: 0.04s; }
.sch-ai-todo-item:nth-child(4) { animation-delay: 0.06s; }
.sch-ai-todo-item:nth-child(5) { animation-delay: 0.08s; }
.sch-ai-todo-item:nth-child(6) { animation-delay: 0.1s; }
.sch-ai-todo-item:nth-child(7) { animation-delay: 0.12s; }
.sch-ai-todo-item:nth-child(8) { animation-delay: 0.14s; }
.sch-ai-todo-item:nth-child(n+9) { animation-delay: 0.16s; }

/* Dark mode */
html[data-theme="dark"] .sch-ai-todo-item {
    background: hsl(225, 14%, 16%);
}
html[data-theme="dark"] .sch-ai-todo-filter {
    background: hsl(225, 15%, 14%);
    border-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .sch-ai-todo-filter.active {
    background: var(--primary);
    border-color: var(--primary);
}
html[data-theme="dark"] .sch-ai-todo-section {
    border-top-color: hsla(262, 83%, 58%, 0.3);
}

/* Summary */
.sch-potential-summary {
    background: var(--muted-bg);
    border-radius: 12px;
    padding: 1rem 1.15rem;
}
.sch-pot-summary-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.sch-pot-summary-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}
.sch-pot-summary-value {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}
.sch-pot-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    line-height: 1.5;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}
.sch-pot-summary-ok {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--green);
    font-weight: 600;
}

/* Dark mode */
html[data-theme="dark"] .sch-potential-panel {
    background: hsl(225, 15%, 14%);
    border-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .sch-potential-header {
    border-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .sch-potential-tabs { border-color: hsl(220, 12%, 22%); }
html[data-theme="dark"] .sch-pot-tab.active { color: #818cf8; border-bottom-color: #818cf8; }
html[data-theme="dark"] .sch-potential-bar-bg {
    background: hsl(225, 14%, 18%);
}
html[data-theme="dark"] .sch-potential-summary {
    background: hsl(225, 14%, 16%);
}

/* === Vacation Styles === */
.sch-mini-vacation {
    background: linear-gradient(135deg, hsla(330, 80%, 70%, 0.2), hsla(330, 80%, 60%, 0.1)) !important;
    color: #f472b6 !important;
    border-color: hsla(330, 80%, 70%, 0.4) !important;
    position: relative;
}
.sch-mini-vacation::after {
    content: '🏖';
    position: absolute;
    font-size: 8px;
    bottom: 1px;
    right: 2px;
    line-height: 1;
}
html[data-theme="dark"] .sch-mini-vacation {
    background: linear-gradient(135deg, hsla(330, 80%, 50%, 0.2), hsla(330, 80%, 40%, 0.15)) !important;
    color: #f9a8d4 !important;
}

.sch-btn-vacation-active {
    background: linear-gradient(135deg, #f472b6, #ec4899) !important;
    color: white !important;
}

.sch-vacation-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    background: hsla(330, 80%, 70%, 0.08);
    border: 1px solid hsla(330, 80%, 70%, 0.2);
    border-radius: 10px;
    margin-bottom: 1rem;
}
.sch-vacation-hint-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: #f472b6;
}
html[data-theme="dark"] .sch-vacation-hint {
    background: hsla(330, 80%, 50%, 0.08);
    border-color: hsla(330, 80%, 50%, 0.2);
}

.sch-legend-vacation {
    color: #f472b6;
}

/* === Enhanced Animations === */
@keyframes kpiFlash {
    0% { color: var(--primary); transform: scale(1.06); }
    50% { color: var(--primary-light); }
    100% { color: inherit; transform: scale(1); }
}
.kpi-flash {
    animation: kpiFlash 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(12px); }
    to { opacity: 1; transform: translateX(0); }
}

.sch-kpi-card {
    animation: fadeSlideUp 0.4s ease-out backwards;
}
.sch-kpi-card:nth-child(1) { animation-delay: 0s; }
.sch-kpi-card:nth-child(2) { animation-delay: 0.05s; }
.sch-kpi-card:nth-child(3) { animation-delay: 0.1s; }
.sch-kpi-card:nth-child(4) { animation-delay: 0.15s; }
.sch-kpi-card:nth-child(5) { animation-delay: 0.2s; }

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

.sch-master-panel-wrap {
    animation: fadeSlideUp 0.4s ease-out 0.1s backwards;
}
.sch-calendar-wrap {
    animation: fadeSlideUp 0.5s ease-out 0.15s backwards;
}
.sch-section {
    animation: fadeSlideUp 0.4s ease-out 0.2s backwards;
}

/* === Staggered animations for master chips & lever cards === */
.master-chip-panel {
    animation: fadeSlideUp 0.3s ease-out backwards;
}
.master-chip-panel:nth-child(1) { animation-delay: 0s; }
.master-chip-panel:nth-child(2) { animation-delay: 0.02s; }
.master-chip-panel:nth-child(3) { animation-delay: 0.04s; }
.master-chip-panel:nth-child(4) { animation-delay: 0.06s; }
.master-chip-panel:nth-child(5) { animation-delay: 0.08s; }
.master-chip-panel:nth-child(6) { animation-delay: 0.1s; }
.master-chip-panel:nth-child(7) { animation-delay: 0.12s; }
.master-chip-panel:nth-child(8) { animation-delay: 0.14s; }
.master-chip-panel:nth-child(9) { animation-delay: 0.16s; }
.master-chip-panel:nth-child(10) { animation-delay: 0.18s; }
.master-chip-panel:nth-child(n+11) { animation-delay: 0.2s; }

.sch-lever-card {
    animation: fadeSlideUp 0.3s ease-out backwards;
}
.sch-lever-card:nth-child(1) { animation-delay: 0s; }
.sch-lever-card:nth-child(2) { animation-delay: 0.04s; }
.sch-lever-card:nth-child(3) { animation-delay: 0.08s; }
.sch-lever-card:nth-child(4) { animation-delay: 0.12s; }
.sch-lever-card:nth-child(5) { animation-delay: 0.16s; }

/* === Master row hover enhancement === */
.sch-master-row td:first-child {
    font-weight: 600;
}
.sch-master-row {
    transition: background 0.15s, transform 0.1s;
}
.sch-master-row:hover {
    background: var(--primary-bg) !important;
}

/* === Sidebar Stats Enhancement === */
.sch-sidebar-stats {
    border-radius: 12px;
}

/* === Day Number Enhancement === */
.sch-day-num {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

/* === Calendar wrap enhancement === */
.sch-calendar-wrap {
    border-radius: 14px;
}

/* ======================================================================
   v18.0: KPI Dashboard, Root Cause, Process Refs, Matrix, Master Cards
   ====================================================================== */

/* === KPI Dashboard v2 === */
.sch-kpi-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

/* KPI card */
.kd-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    cursor: pointer;
    transition: all var(--transition-base);
    overflow: hidden;
}
.kd-card:hover {
    box-shadow: var(--shadow-md);
}
.kd-card-main {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
}
.kd-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--muted-bg);
    transition: background var(--transition-fast);
}
.kd-card-icon svg { width: 18px; height: 18px; }
.kd-card-body { flex: 1; min-width: 0; }
.kd-card-name {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}
.kd-chevron {
    width: 12px !important;
    height: 12px !important;
    margin-left: auto;
    opacity: 0.4;
    transition: transform var(--transition-fast);
}
.kd-card.open .kd-chevron { transform: rotate(180deg); opacity: 0.8; }
.kd-card-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-top: 2px;
}
.kd-card-value {
    font-size: 1.15rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    line-height: 1.2;
}
.kd-card-grade {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

/* Grade colors */
.kd-card-super .kd-card-icon { background: #10b98115; }
.kd-card-super .kd-card-icon svg { color: #10b981; }
.kd-card-super .kd-card-value { color: #10b981; }
.kd-card-super .kd-card-grade { color: #10b981; background: #10b98112; }
.kd-card-super { border-color: #10b98125; }

.kd-card-excellent .kd-card-icon { background: #22c55e15; }
.kd-card-excellent .kd-card-icon svg { color: #22c55e; }
.kd-card-excellent .kd-card-value { color: #22c55e; }
.kd-card-excellent .kd-card-grade { color: #22c55e; background: #22c55e12; }
.kd-card-excellent { border-color: #22c55e25; }

.kd-card-good .kd-card-icon { background: #84cc1615; }
.kd-card-good .kd-card-icon svg { color: #84cc16; }
.kd-card-good .kd-card-value { color: #84cc16; }
.kd-card-good .kd-card-grade { color: #84cc16; background: #84cc1612; }
.kd-card-good { border-color: #84cc1625; }

.kd-card-bad .kd-card-icon { background: #f59e0b15; }
.kd-card-bad .kd-card-icon svg { color: #f59e0b; }
.kd-card-bad .kd-card-value { color: #f59e0b; }
.kd-card-bad .kd-card-grade { color: #f59e0b; background: #f59e0b12; }
.kd-card-bad { border-color: #f59e0b25; }

.kd-card-terrible .kd-card-icon { background: #ef444415; }
.kd-card-terrible .kd-card-icon svg { color: #ef4444; }
.kd-card-terrible .kd-card-value { color: #ef4444; }
.kd-card-terrible .kd-card-grade { color: #ef4444; background: #ef444412; }
.kd-card-terrible { border-color: #ef444425; }

.kd-card-unknown .kd-card-icon { background: var(--muted-bg); }
.kd-card-unknown .kd-card-icon svg { color: var(--text-muted); }
.kd-card-unknown .kd-card-value { color: var(--text-muted); }

/* Scale bar */
.kd-scale-bar {
    position: relative;
    margin-top: 6px;
    height: 6px;
}
.kd-scale-track {
    display: flex;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    gap: 1px;
}
.kd-scale-seg {
    height: 100%;
    border-radius: 1px;
}
.kd-scale-marker {
    position: absolute;
    top: -1px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text);
    transform: translateX(-50%);
    box-shadow: 0 0 0 2px var(--card-bg);
}

/* Expandable detail */
.kd-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0;
}
.kd-card.open .kd-detail {
    max-height: 300px;
    padding-top: 0.75rem;
    margin-top: 0.65rem;
    border-top: 1px solid var(--border);
}
.kd-detail-row {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    line-height: 1.45;
}
.kd-detail-label {
    font-weight: 600;
    color: var(--text);
}
.kd-detail-tip {
    font-size: 0.73rem;
    color: var(--text);
    background: var(--primary-bg);
    padding: 6px 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    line-height: 1.45;
}
.kd-detail-note {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 4px;
}
.kd-detail-scale {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-top: 4px;
}
.kd-detail-scale-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
}
.kd-detail-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.kd-detail-range {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.kd-detail-grade-label {
    font-weight: 600;
}

/* Mobile */
@media (max-width: 768px) {
    .sch-kpi-dashboard {
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
    }
    .kd-card { padding: 0.6rem; }
    .kd-card-icon { width: 30px; height: 30px; }
    .kd-card-icon svg { width: 15px; height: 15px; }
    .kd-card-value { font-size: 1rem; }
}

/* Inline KPI badge (in lever titles) */
.sch-kpi-badge-inline {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 6px;
    margin-left: 6px;
    vertical-align: middle;
}

/* === Root Cause Block === */
.sch-root-cause {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem;
    margin-top: 0.4rem;
    background: var(--bg-body);
    border-radius: 8px;
    border-left: 3px solid var(--border);
    line-height: 1.5;
}
.sch-root-cause strong {
    color: var(--text);
}
html[data-theme="dark"] .sch-root-cause {
    background: hsl(220, 12%, 14%);
    border-left-color: hsl(220, 12%, 28%);
}

/* === Process Reference Tag === */
.sch-process-ref {
    display: inline-block;
    font-size: 0.68rem;
    color: #6c5ce7;
    background: #6c5ce710;
    padding: 2px 8px;
    border-radius: 6px;
    margin-top: 4px;
    border: 1px solid #6c5ce720;
}
html[data-theme="dark"] .sch-process-ref {
    color: #a29bfe;
    background: #a29bfe12;
    border-color: #a29bfe20;
}

/* === Data Verification Alerts === */
.sch-data-alert {
    font-size: 0.8rem;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border-left: 3px solid;
    line-height: 1.45;
}
.sch-data-alert-warning {
    background: #f59e0b0a;
    border-left-color: #f59e0b;
    color: #b45309;
}
.sch-data-alert-danger {
    background: #ef44440a;
    border-left-color: #ef4444;
    color: #dc2626;
}
.sch-data-alert-info {
    background: #3b82f60a;
    border-left-color: #3b82f6;
    color: #2563eb;
}
html[data-theme="dark"] .sch-data-alert-warning { color: #fbbf24; background: #f59e0b10; }
html[data-theme="dark"] .sch-data-alert-danger { color: #f87171; background: #ef444410; }
html[data-theme="dark"] .sch-data-alert-info { color: #60a5fa; background: #3b82f610; }

/* === Grade Badge === */
.sch-grade-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 5px;
    vertical-align: middle;
    margin-left: 4px;
}
.sch-matrix-name .sch-grade-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid;
}
.sch-grade-beginner { color: #94a3b8; background: #94a3b820; border-color: #94a3b840; }
.sch-grade-master { color: #3b82f6; background: #3b82f620; border-color: #3b82f640; }
.sch-grade-top { color: #8b5cf6; background: #8b5cf620; border-color: #8b5cf640; }
.sch-grade-artdirector { color: #f59e0b; background: #f59e0b20; border-color: #f59e0b40; }

/* === Collapse Arrow === */
.sch-collapse-arrow {
    display: inline-block;
    transition: transform 0.25s ease;
    vertical-align: middle;
    margin-left: 4px;
}
.sch-collapse-arrow.open {
    transform: rotate(180deg);
}

/* === Master × Services Matrix === */
.sch-matrix-wrap {
    margin-bottom: 1rem;
}
.sch-matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
}
.sch-matrix-table th,
.sch-matrix-table td {
    padding: 4px 6px;
    text-align: center;
    border: 1px solid var(--border);
    white-space: nowrap;
}
.sch-matrix-table th {
    background: var(--bg-body);
    font-weight: 600;
    font-size: 0.65rem;
    color: var(--text-muted);
}
.sch-matrix-cat-header {
    writing-mode: vertical-lr;
    text-orientation: mixed;
    max-width: 28px;
    padding: 8px 4px !important;
}
.sch-matrix-name {
    text-align: left !important;
    font-weight: 600;
    white-space: nowrap;
    min-width: 100px;
}
.sch-matrix-cell {
    font-weight: 500;
    min-width: 42px;
}
.sch-matrix-empty {
    color: var(--text-muted);
    opacity: 0.5;
}
.sch-matrix-total {
    font-weight: 700;
    background: var(--bg-body) !important;
}
.sch-matrix-insight {
    margin-top: 0.75rem;
    padding: 0.6rem 0.85rem;
    background: #6c5ce708;
    border: 1px solid #6c5ce720;
    border-radius: 8px;
    font-size: 0.78rem;
    color: var(--text);
    line-height: 1.5;
}
html[data-theme="dark"] .sch-matrix-table th {
    background: hsl(220, 12%, 14%);
}
html[data-theme="dark"] .sch-matrix-insight {
    background: #a29bfe08;
    border-color: #a29bfe15;
}

/* === Master Cards === */
.sch-master-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.sch-master-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem;
    transition: box-shadow 0.2s;
}
.sch-master-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.sch-master-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}
.sch-master-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.sch-master-avatar-placeholder { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 0.8rem; flex-shrink: 0; }
.sch-master-card-name {
    font-weight: 700;
    font-size: 0.88rem;
    flex: 1;
}
.sch-master-card-metrics {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.sch-master-metric {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
}
.sch-metric-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sch-dot-green { background: #22c55e; }
.sch-dot-yellow { background: #f59e0b; }
.sch-dot-red { background: #ef4444; }
.sch-metric-label {
    color: var(--text-muted);
    flex: 1;
}
.sch-metric-value {
    font-weight: 600;
    text-align: right;
}
.sch-master-card-footer {
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.72rem;
}
.sch-master-strengths {
    color: #22c55e;
}
.sch-master-growth {
    color: #f59e0b;
}
html[data-theme="dark"] .sch-master-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

/* === Master Comparison === */
.sch-comparison-wrap { margin-top: 0.5rem; }
.sch-cmp-ranking { margin-bottom: 1.5rem; }
.sch-cmp-ranking-title,
.sch-cmp-table-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}
.sch-cmp-rank-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 4px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border, #e5e7eb);
    flex-wrap: wrap;
}
.sch-cmp-rank-row:first-child { border-color: #f59e0b40; background: #f59e0b08; }
.sch-cmp-medal { font-size: 1.1rem; min-width: 28px; text-align: center; font-weight: 700; }
.sch-cmp-avatar {
    width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.sch-cmp-avatar-placeholder {
    width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; color: #fff; font-size: 0.75rem; font-weight: 600; flex-shrink: 0;
}
.sch-cmp-rank-name { font-weight: 600; font-size: 0.85rem; min-width: 80px; }
.sch-cmp-score {
    font-size: 0.9rem; font-weight: 700; color: var(--primary, #6366f1);
    margin-left: auto; min-width: 55px; text-align: right;
}
.sch-cmp-score small { font-size: 0.65rem; color: var(--text-muted); font-weight: 400; }
.sch-cmp-bar {
    width: 80px; height: 6px; background: var(--border, #e5e7eb); border-radius: 3px;
    overflow: hidden; flex-shrink: 0;
}
.sch-cmp-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.sch-cmp-top { background: #22c55e; }
.sch-cmp-mid { background: #3b82f6; }
.sch-cmp-low { background: #f59e0b; }
.sch-cmp-bottom { background: #ef4444; }
.sch-cmp-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.sch-cmp-tag-good {
    font-size: 0.68rem; padding: 1px 6px; border-radius: 4px;
    background: #22c55e18; color: #22c55e; font-weight: 500;
}
.sch-cmp-tag-weak {
    font-size: 0.68rem; padding: 1px 6px; border-radius: 4px;
    background: #f59e0b18; color: #f59e0b; font-weight: 500;
}

/* Comparison table */
.sch-cmp-table-wrap { margin-bottom: 1.5rem; }
.sch-cmp-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sch-cmp-table {
    width: 100%; border-collapse: collapse; font-size: 0.78rem;
}
.sch-cmp-table th {
    background: var(--card-bg, #f8fafc); padding: 8px 6px; text-align: center;
    font-weight: 600; font-size: 0.72rem; color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.sch-cmp-table td { padding: 6px; border-bottom: 1px solid var(--border); }
.sch-cmp-table-name {
    white-space: nowrap; font-weight: 500;
    display: flex; align-items: center; gap: 4px;
}
.sch-cmp-cell { text-align: center; }
.sch-cmp-cell-val { font-weight: 600; font-size: 0.78rem; }
.sch-cmp-cell-bar {
    width: 100%; height: 4px; background: var(--border, #e5e7eb);
    border-radius: 2px; margin-top: 3px; overflow: hidden;
}
.sch-cmp-cell-bar-fill { height: 100%; border-radius: 2px; transition: width 0.3s; }

/* Grade-normalized */
.sch-cmp-grade-section { margin-bottom: 1rem; }
.sch-cmp-grade-group { margin-bottom: 1rem; }
.sch-cmp-grade-label { font-size: 0.82rem; font-weight: 600; margin-bottom: 0.5rem; }
.sch-cmp-grade-row {
    display: flex; align-items: center; gap: 6px; padding: 6px 8px;
    border-radius: 6px; margin-bottom: 3px;
    background: var(--card-bg); border: 1px solid var(--border);
    flex-wrap: wrap;
}

/* Dark mode for comparison */
html[data-theme="dark"] .sch-cmp-rank-row { background: hsl(225, 14%, 14%); border-color: hsl(220, 12%, 22%); }
html[data-theme="dark"] .sch-cmp-rank-row:first-child { background: #f59e0b0a; border-color: #f59e0b30; }
html[data-theme="dark"] .sch-cmp-table th { background: hsl(225, 14%, 12%); }
html[data-theme="dark"] .sch-cmp-grade-row { background: hsl(225, 14%, 14%); border-color: hsl(220, 12%, 22%); }
html[data-theme="dark"] .sch-cmp-bar { background: hsl(220, 12%, 25%); }

/* === Responsive for new components === */
@media (max-width: 768px) {
    .sch-kpi-dashboard {
        gap: 0.35rem;
    }
    .sch-kpi-badge {
        min-width: 75px;
        padding: 0.35rem 0.5rem;
    }
    .sch-master-cards {
        grid-template-columns: 1fr;
    }
    .sch-matrix-cat-header {
        font-size: 0.58rem;
    }
}

/* === Matrix Insights & Tasks === */
.sch-matrix-insights-block {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: hsla(45, 90%, 55%, 0.06);
    border: 1px solid hsla(45, 80%, 50%, 0.15);
    border-radius: 10px;
}
.sch-matrix-insights-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    color: hsl(45, 80%, 40%);
    margin-bottom: 0.5rem;
}
.sch-matrix-insights-title svg {
    color: hsl(45, 80%, 45%);
}
.sch-matrix-insight-item {
    font-size: 0.8rem;
    padding: 0.3rem 0;
    color: var(--text);
    border-bottom: 1px solid hsla(45, 80%, 50%, 0.08);
}
.sch-matrix-insight-item:last-child {
    border-bottom: none;
}
.sch-matrix-tasks-block {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--card-bg-elevated, var(--card-bg));
    border: 1px solid var(--border);
    border-radius: 10px;
}
.sch-matrix-tasks-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}
.sch-matrix-tasks-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text);
}
.sch-matrix-tasks-title svg {
    color: var(--primary);
}
.sch-matrix-tasks-potential {
    font-size: 0.78rem;
    font-weight: 600;
    color: #22c55e;
    background: hsla(142, 71%, 45%, 0.08);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
}
.sch-matrix-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
html[data-theme="dark"] .sch-matrix-insights-block {
    background: hsla(45, 70%, 50%, 0.05);
    border-color: hsla(45, 70%, 50%, 0.1);
}
html[data-theme="dark"] .sch-matrix-insights-title {
    color: hsl(45, 80%, 65%);
}
html[data-theme="dark"] .sch-matrix-tasks-potential {
    background: hsla(142, 71%, 45%, 0.12);
}

/* === Grade selector in sidebar === */
.sch-grade-select {
    width: 100%;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}
.sch-grade-select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-bg);
}
.sch-grade-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
    padding-left: 2px;
}

/* === Role icons (Lucide SVG replacing emoji) === */
.role-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}
.role-icon svg {
    width: 14px;
    height: 14px;
}

/* Lever icon dark mode fix */
html[data-theme="dark"] .sch-lever-icon {
    background: hsla(262, 83%, 58%, 0.15);
}
html[data-theme="dark"] .sch-lever-icon svg {
    color: var(--primary-light);
}

/* ===== Week View: Expanded Cells ===== */
.sch-week-view .sch-day-cell {
    min-height: 180px;
    vertical-align: top;
}
.sch-week-view .sch-master-list {
    flex-direction: column;
    gap: 4px;
}
.sch-week-view .master-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    font-size: 0.85rem;
    border-radius: 6px;
    width: 100%;
    justify-content: space-between;
}
.sch-week-view .sch-chip-rev {
    font-size: 0.75rem;
    opacity: 0.85;
    margin-left: auto;
}
.sch-week-view .sch-day-top {
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border, rgba(0,0,0,0.08));
    margin-bottom: 6px;
}
.sch-week-view .sch-day-rev {
    font-size: 1rem;
    font-weight: 600;
}

/* ==================== PREDICTIONS PANEL ==================== */
.sch-predictions-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 1.35rem;
    overflow: hidden;
}
.sch-predictions-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 1rem 1.35rem;
    margin: 0;
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.sch-predictions-toggle:hover {
    background: var(--muted-bg);
}
.sch-predictions-arrow {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}
#predictionsContent {
    padding: 0 1.35rem 1.35rem;
}

/* Predictions grid */
.sch-pred-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
@media (max-width: 900px) {
    .sch-pred-grid {
        grid-template-columns: 1fr;
    }
}

/* Prediction card */
.sch-pred-card {
    background: var(--muted-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.sch-pred-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.sch-pred-card-header svg {
    flex-shrink: 0;
    opacity: 0.6;
}
.sch-pred-card-body {
    padding: 1rem;
}

/* Big number */
.sch-pred-big-number {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.15;
    margin-bottom: 0.35rem;
}
.sch-pred-big-unit {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Meta & detail text */
.sch-pred-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
}
.sch-pred-detail {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* Trend indicators */
.sch-pred-trend {
    font-size: 0.85rem;
}
.sch-pred-trend-up { color: #10b981; }
.sch-pred-trend-down { color: #ef4444; }
.sch-pred-trend-flat { color: var(--text-muted); }

/* Churn list */
.sch-pred-churn-list {
    margin-top: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sch-pred-churn-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    background: var(--card-bg);
    border-radius: 6px;
    font-size: 0.78rem;
}
.sch-pred-churn-left {
    display: flex;
    align-items: center;
    gap: 6px;
}
.sch-pred-churn-id {
    font-weight: 600;
    color: var(--text);
}
.sch-pred-churn-right {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: right;
}
.sch-pred-churn-risk {
    font-weight: 700;
    color: #ef4444;
}
.sch-pred-churn-meta {
    color: var(--text-muted);
    font-size: 0.72rem;
}

/* Tier badges */
.sch-pred-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.sch-pred-tier-vip {
    background: #fef3c7;
    color: #92400e;
}
.sch-pred-tier-high {
    background: #dbeafe;
    color: #1e40af;
}
.sch-pred-tier-normal {
    background: var(--muted-bg);
    color: var(--text-muted);
}

/* Seasonality chart */
.sch-pred-season-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    margin-top: 0.5rem;
    height: 80px;
    padding-bottom: 18px;
    position: relative;
}
.sch-pred-season-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}
.sch-pred-season-bar {
    width: 100%;
    max-width: 28px;
    border-radius: 4px 4px 0 0;
    background: #6366f1;
    opacity: 0.35;
    transition: opacity 0.15s;
    cursor: default;
}
.sch-pred-season-bar:hover {
    opacity: 0.65;
}
.sch-pred-season-current {
    opacity: 0.85;
    background: #6366f1;
}
.sch-pred-season-peak {
    opacity: 0.9;
    background: #10b981;
}
.sch-pred-season-low {
    opacity: 0.9;
    background: #ef4444;
}
.sch-pred-season-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: 3px;
    text-align: center;
}
.sch-pred-season-label-current {
    font-weight: 700;
    color: var(--primary, #6366f1);
}
.sch-pred-season-insight {
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--text);
    padding: 0.5rem 0.6rem;
    background: var(--primary, #6366f1)10;
    border-left: 3px solid var(--primary, #6366f1);
    border-radius: 0 6px 6px 0;
    margin-bottom: 0.5rem;
}
.sch-pred-season-next {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    padding: 0.3rem 0;
}
.sch-pred-season-extremes {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.6rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}
.sch-pred-season-ext-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.sch-pred-season-ext-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    min-width: 100px;
}
.sch-pred-season-ext-tag {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
}
.sch-pred-season-ext-peak {
    color: #10b981;
    background: #10b98118;
}
.sch-pred-season-ext-low {
    color: #ef4444;
    background: #ef444418;
}

/* Staffing table */
.sch-pred-staff-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    margin-top: 0.5rem;
}
.sch-pred-staff-table th {
    text-align: left;
    padding: 4px 6px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.sch-pred-staff-table td {
    padding: 5px 6px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.sch-pred-staff-table tr:last-child td {
    border-bottom: none;
}

/* Dark mode adjustments */
html[data-theme="dark"] .sch-pred-tier-vip {
    background: #78350f;
    color: #fef3c7;
}
html[data-theme="dark"] .sch-pred-tier-high {
    background: #1e3a5f;
    color: #bfdbfe;
}
html[data-theme="dark"] .sch-pred-churn-item {
    background: var(--muted-bg);
}

/* KPI Goals Modal Form */
.sch-kpi-goals-form { padding: 4px 0; }
.sch-kpi-goal-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border, rgba(0,0,0,0.06)); }
.sch-kpi-goal-row label { font-size: 0.85rem; }
.sch-kpi-goal-input { display: flex; align-items: center; gap: 6px; }
.sch-kpi-goal-input span { font-size: 0.8rem; color: var(--text-muted, #9ca3af); width: 20px; }

/* Dark mode — Timeline */
html[data-theme="dark"] .sch-timeline { background: hsl(225, 14%, 14%); }
html[data-theme="dark"] .sch-timeline-hours span { color: rgba(255,255,255,0.45); }
html[data-theme="dark"] .sch-timeline-label { color: var(--text); }
html[data-theme="dark"] .sch-timeline-rev { color: rgba(255,255,255,0.6); }
html[data-theme="dark"] .sch-timeline-row { border-bottom-color: hsl(220, 12%, 20%); }
html[data-theme="dark"] .sch-timeline-summary { background: hsl(225, 14%, 16%); color: var(--text); border-top-color: hsl(220, 12%, 22%); }
html[data-theme="dark"] .sch-timeline-bar span { color: #fff; }
html[data-theme="dark"] .sch-timeline-bar:hover::before,
html[data-theme="dark"] .sch-timeline-bar:hover::after {
    background: rgba(129, 140, 248, 0.35);
}
html[data-theme="dark"] .sch-timeline-bar.sch-resizing,
html[data-theme="dark"] .sch-timeline-bar.sch-moving {
    box-shadow: 0 0 0 2px var(--primary, #818cf8);
}

/* Dark mode — Predictions panel */
html[data-theme="dark"] .sch-predictions-panel { background: hsl(225, 14%, 12%); }
html[data-theme="dark"] .sch-pred-card { background: hsl(225, 14%, 16%); border-color: hsl(220, 12%, 22%); }
html[data-theme="dark"] .sch-pred-card-header { border-bottom-color: hsl(220, 12%, 22%); color: var(--text); }
html[data-theme="dark"] .sch-pred-card-body { color: var(--text); }
html[data-theme="dark"] .sch-pred-big-number { color: var(--primary, #6366f1); }
html[data-theme="dark"] .sch-pred-meta { color: rgba(255,255,255,0.5); }
html[data-theme="dark"] .sch-pred-detail { color: rgba(255,255,255,0.65); }
html[data-theme="dark"] .sch-pred-season-chart { background: hsl(225, 14%, 14%); }
html[data-theme="dark"] .sch-pred-staff-table td { border-bottom-color: hsl(220, 12%, 20%); color: var(--text); }

/* Dark mode — KPI Goals modal */
html[data-theme="dark"] .sch-kpi-goals-form { color: var(--text); }
html[data-theme="dark"] .sch-kpi-goal-row { border-bottom-color: hsl(220, 12%, 22%); }
html[data-theme="dark"] .sch-kpi-goal-input input { background: hsl(225, 14%, 18%); border-color: hsl(220, 12%, 25%); color: var(--text); }
html[data-theme="dark"] .sch-kpi-goal-row label { color: var(--text); }

/* ═══════════════════════════════════════════════════════════════
   Dark Mode Audit: Missing rules for AI Calendar components
   ═══════════════════════════════════════════════════════════════ */

/* --- Predictions panel: border & toggle hover --- */
html[data-theme="dark"] .sch-predictions-panel { border-color: hsl(220, 12%, 22%); }
html[data-theme="dark"] .sch-predictions-toggle:hover { background: hsl(225, 14%, 18%); }

/* --- Predictions: staff table header --- */
html[data-theme="dark"] .sch-pred-staff-table th {
    color: rgba(255,255,255,0.5);
    border-bottom-color: hsl(220, 12%, 22%);
    background: hsl(225, 14%, 14%);
}

/* --- Week view: day-top border & week-nav --- */
html[data-theme="dark"] .sch-week-view .sch-day-top {
    border-bottom-color: hsl(220, 12%, 22%);
}

/* --- View toggle: dark borders --- */
html[data-theme="dark"] .sch-view-toggle {
    border-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .sch-view-btn:hover:not(.active) {
    background: hsl(225, 14%, 18%);
}

/* --- Other-month day cell --- */
html[data-theme="dark"] .sch-other-month-day {
    background: hsl(225, 15%, 13%);
    border-color: hsl(220, 12%, 20%);
}

/* --- Day cell: has-vacation dark --- */
html[data-theme="dark"] .sch-day-cell.has-vacation {
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 8px,
        hsla(330, 80%, 50%, 0.06) 8px,
        hsla(330, 80%, 50%, 0.06) 16px
    ), hsl(225, 15%, 14%);
}

/* --- Mini calendar: dark day cells --- */
html[data-theme="dark"] .sch-mini-day {
    color: rgba(255,255,255,0.8);
    border-color: transparent;
}
html[data-theme="dark"] .sch-mini-day:hover:not(.sch-mini-other) {
    background: hsla(262, 83%, 58%, 0.15);
}
html[data-theme="dark"] .sch-mini-other {
    color: rgba(255,255,255,0.25);
}
html[data-theme="dark"] .sch-mini-cal th {
    color: rgba(255,255,255,0.4);
}

/* --- Grade selector in sidebar --- */
html[data-theme="dark"] .sch-grade-select {
    background: hsl(225, 14%, 18%);
    border-color: hsl(220, 12%, 22%);
    color: var(--text);
}

/* --- KPI Dashboard cards (kd-*) --- */
html[data-theme="dark"] .kd-card {
    background: hsl(225, 15%, 14%);
    border-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .kd-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}
html[data-theme="dark"] .kd-card-icon {
    background: hsl(225, 14%, 18%);
}
html[data-theme="dark"] .kd-card.open .kd-detail {
    border-top-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .kd-scale-marker {
    box-shadow: 0 0 0 2px hsl(225, 15%, 14%);
}

/* --- Master cards (sch-master-card) --- */
html[data-theme="dark"] .sch-master-card {
    background: hsl(225, 15%, 14%);
    border-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .sch-master-card-header {
    border-bottom-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .sch-master-card-footer {
    border-top-color: hsl(220, 12%, 22%);
}

/* --- Matrix table: dark borders --- */
html[data-theme="dark"] .sch-matrix-table td {
    border-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .sch-matrix-total {
    background: hsl(225, 14%, 14%) !important;
}

/* --- Potential bar: dark background --- */
html[data-theme="dark"] .sch-potential-bar-bg {
    background: hsl(225, 14%, 16%);
}

/* --- Add master button: dark dashed border --- */
html[data-theme="dark"] .sch-add-master-btn {
    color: rgba(255,255,255,0.8);
}

/* --- Day modal: close button dark --- */
html[data-theme="dark"] .sch-day-modal-subtitle {
    color: rgba(255,255,255,0.5);
}

/* --- Potential section title border --- */
html[data-theme="dark"] .sch-potential-section-title {
    border-top-color: hsl(220, 12%, 22%);
}

/* --- Potential note border --- */
html[data-theme="dark"] .sch-pot-note {
    border-top-color: hsl(220, 12%, 22%);
}

/* --- Matrix tasks block dark --- */
html[data-theme="dark"] .sch-matrix-tasks-block {
    background: hsl(225, 15%, 16%);
    border-color: hsl(220, 12%, 22%);
}
html[data-theme="dark"] .sch-matrix-tasks-header {
    border-bottom-color: hsl(220, 12%, 22%);
}

/* --- Conflict warning --- */
.sch-conflict-warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.82rem;
    color: #92400e;
    margin-bottom: 8px;
}
html[data-theme="dark"] .sch-conflict-warning {
    background: #78350f;
    color: #fef3c7;
    border-color: #b45309;
}

/* --- Export toast --- */
.sch-export-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #10b981;
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 2000;
}
.sch-export-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
html[data-theme="dark"] .sch-export-toast {
    background: #059669;
}
