* { font-family: 'Inter', sans-serif; }

/* Desktop-only full column labels, mobile shows short labels */
.th-full-label .th-short { display: inline; }
.th-full-label .th-long { display: none; }
@media (min-width: 768px) {
    .th-full-label .th-short { display: none; }
    .th-full-label .th-long { display: inline; font-size: 9px; line-height: 1.2; }
}

/* Professional Color Scheme */
:root {
    --primary: #334155;      /* Slate 700 */
    --primary-dark: #1e293b; /* Slate 800 */
    --accent: #475569;       /* Slate 600 */
    --border: #e2e8f0;       /* Slate 200 */
    --bg-light: #f8fafc;     /* Slate 50 */
    --bg-section: #f1f5f9;   /* Slate 100 */
    --text: #334155;
    --text-muted: #64748b;
}

.gradient-bg { background: var(--primary-dark); }
.gradient-green { background: #374151; }
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Form Styles */
.form-section { background: white; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-bottom: 20px; overflow: hidden; border: 1px solid var(--border); }
.form-header { padding: 14px 20px; font-weight: 600; color: white; font-size: 13px; background: var(--primary); }

/* Table Styles */
.opcrf-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.opcrf-table.fixed-layout { table-layout: fixed; }
.opcrf-table th, .opcrf-table td { border: 1px solid var(--border); padding: 10px 8px; vertical-align: top; word-wrap: break-word; overflow-wrap: break-word; }
.opcrf-table th { background: var(--bg-light); font-weight: 600; text-align: center; font-size: 11px; color: var(--text); }
.opcrf-table .kra-row { font-weight: 600; color: white; background: var(--accent) !important; }
.opcrf-table .obj-row { background: var(--bg-light); }
.opcrf-table .qet-row { background: white; }
.opcrf-table .subtotal-row { background: var(--bg-section); font-weight: 600; }

/* Rating Buttons - Muted Professional */
.rating-group { display: flex; gap: 4px; justify-content: center; }
.rating-btn {
    width: 28px; height: 28px; border-radius: 4px; border: 1px solid var(--border);
    font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.15s; background: white; color: var(--text-muted);
}
.rating-btn:hover { background: var(--bg-section); border-color: var(--accent); transform: scale(1.05); }
.rating-btn.selected { background: var(--primary); color: white; border-color: var(--primary); }
.rating-btn.selected-5 { background: #374151; border-color: #374151; }
.rating-btn.selected-4 { background: #475569; border-color: #475569; }
.rating-btn.selected-3 { background: #64748b; border-color: #64748b; }
.rating-btn.selected-2 { background: #78716c; border-color: #78716c; }
.rating-btn.selected-1 { background: #991b1b; border-color: #991b1b; }

/* Self-Rating Buttons - Amber/Gold */
.self-rating-btn {
    width: 26px; height: 26px; border-radius: 4px; border: 1px solid #fbbf24;
    font-size: 11px; font-weight: 600; cursor: pointer; transition: all 0.15s; background: #fffbeb; color: #92400e;
}
.self-rating-btn:hover { background: #fef3c7; border-color: #f59e0b; transform: scale(1.05); }
.self-rating-btn.selected { background: #f59e0b; color: white; border-color: #d97706; }

/* Self-Rating Badge (read-only in ASDS/Focal view) */
.self-rating-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 4px; font-size: 11px; font-weight: 700;
    background: #fef3c7; color: #92400e; border: 1px solid #fbbf24;
}

/* Text Areas */
.accomplishment-input {
    width: 100%; min-height: 70px; padding: 10px; border: 1px solid var(--border);
    border-radius: 6px; font-size: 12px; resize: vertical; transition: all 0.2s; background: white;
    overflow: hidden; field-sizing: content;
}
.accomplishment-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(71,85,105,0.1); }
.accomplishment-display { background: var(--bg-light); padding: 10px; border-radius: 6px; font-size: 12px; min-height: 60px; border: 1px solid var(--border); }

/* Part IV table: uniform textarea height within each row */
.opcrf-table tbody tr { height: 1px; }
.opcrf-table tbody td { vertical-align: top; height: inherit; padding: 6px; }
.opcrf-table tbody td .accomplishment-input { field-sizing: normal; min-height: 100px; height: calc(100% - 4px); box-sizing: border-box; }

/* Computed Cells */
.avg-cell { background: var(--bg-section); font-weight: 700; color: var(--primary); text-align: center; font-size: 14px; }
.weighted-cell { background: var(--bg-light); font-weight: 700; color: var(--primary); text-align: center; font-size: 13px; }

/* MOV Upload */
.mov-upload {
    border: 1px dashed #cbd5e1; border-radius: 6px; padding: 12px; text-align: center;
    cursor: pointer; transition: all 0.2s; background: var(--bg-light);
}
.mov-upload:hover { border-color: var(--accent); background: white; }
.mov-upload.drag-over { border-color: var(--primary); background: var(--bg-section); }
.mov-file {
    display: flex; align-items: center; gap: 3px; padding: 3px 4px;
    background: var(--bg-light); border: 1px solid var(--border); border-radius: 3px;
    font-size: 10px; margin-top: 3px;
}
.mov-file .file-icon { color: var(--accent); font-size: 10px; }
.mov-file .file-name { flex: 1; color: var(--primary); word-break: break-all; }
.mov-file .file-size { display: none; }
.mov-file .remove-btn { color: #b91c1c; cursor: pointer; padding: 1px; font-size: 10px; }
.mov-file .remove-btn:hover { background: #fef2f2; border-radius: 3px; }

/* Upload overlay */
.mov-upload-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999; opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.mov-upload-overlay.active { opacity: 1; pointer-events: all; }
.mov-upload-card {
    background: white; border-radius: 16px; padding: 40px 48px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.15); text-align: center;
    max-width: 380px; width: 90%;
}
.mov-upload-spinner {
    width: 48px; height: 48px; border: 4px solid #e2e8f0;
    border-top-color: var(--accent, #2563eb); border-radius: 50%;
    animation: mov-spin 0.8s linear infinite; margin: 0 auto 20px;
}
@keyframes mov-spin { to { transform: rotate(360deg); } }
.mov-upload-title {
    font-size: 16px; font-weight: 600; color: #1e293b; margin-bottom: 6px;
}
.mov-upload-detail {
    font-size: 13px; color: #64748b; line-height: 1.5;
}
.mov-upload-progress {
    margin-top: 16px; height: 4px; background: #e2e8f0; border-radius: 4px; overflow: hidden;
}
.mov-upload-progress-bar {
    height: 100%; width: 0%; background: linear-gradient(90deg, #2563eb, #7c3aed);
    border-radius: 4px; transition: width 0.3s ease;
}

/* Upload success toast */
.mov-toast {
    position: fixed; bottom: 24px; right: 24px; z-index: 10000;
    background: #065f46; color: white; padding: 14px 20px;
    border-radius: 10px; font-size: 13px; font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    transform: translateY(80px); opacity: 0; transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 360px; line-height: 1.4;
}
.mov-toast.show { transform: translateY(0); opacity: 1; }
.mov-toast.error { background: #991b1b; }

/* Back to Top button */
.back-to-top {
    position: fixed; bottom: 24px; right: 24px; z-index: 9999;
    width: 44px; height: 44px; border-radius: 50%;
    background: #1e293b; color: white; border: none; cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
    transform: translateY(12px);
}
.back-to-top.visible {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.back-to-top:hover {
    background: #334155; transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}
.back-to-top svg { width: 20px; height: 20px; }
@media print { .back-to-top { display: none; } }

/* Section Navigation */
.section-nav {
    position: sticky; top: 64px; z-index: 40;
    background: white; border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 0 16px;
}
.section-nav-inner {
    display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
    -ms-overflow-style: none; max-width: 100%;
}
.section-nav-inner::-webkit-scrollbar { display: none; }
.section-nav-item {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 14px; font-size: 12px; font-weight: 500;
    color: var(--text-muted); white-space: nowrap; cursor: pointer;
    border-bottom: 2px solid transparent; transition: all 0.2s;
    flex-shrink: 0;
}
.section-nav-item:hover { color: var(--primary); background: var(--bg-light); }
.section-nav-item.active { color: var(--primary); border-bottom-color: #2563eb; font-weight: 600; }
.section-nav-dot {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
    border: 1.5px solid currentColor; transition: all 0.2s;
}
.section-nav-item.complete .section-nav-dot {
    background: #16a34a; border-color: #16a34a;
}

/* Collapsible KRA sections */
.kra-section, .form-section[id^="section-"], .form-section[id^="pmtSection_"] { scroll-margin-top: 120px; }
.kra-section { border-top: 1px solid var(--border); }
.kra-section:first-child { border-top: none; }
.kra-collapse-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; cursor: pointer; user-select: none;
    transition: background 0.15s;
}
.kra-collapse-header:hover { filter: brightness(1.15); }
.kra-collapse-body {
    max-height: 50000px; overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
    opacity: 1;
}
.kra-collapse-body.collapsed {
    max-height: 0; opacity: 0;
}
.kra-chevron {
    width: 18px; height: 18px; transition: transform 0.25s ease; flex-shrink: 0;
}
.kra-chevron.collapsed { transform: rotate(-90deg); }
.kra-collapse-meta {
    display: flex; align-items: center; gap: 10px; font-size: 11px;
}
.kra-collapse-badge {
    padding: 2px 8px; border-radius: 10px; font-weight: 600; font-size: 10px;
}

/* Innovation collapsible cards */
.inn-section .kra-collapse-header {
    background: #334155; color: white; border-radius: 8px;
    padding: 8px 12px; gap: 8px;
}
.inn-section .kra-collapse-header:hover { filter: brightness(1.2); }
.inn-section .kra-collapse-body { padding: 0; }
.inn-section .kra-collapse-body:not(.collapsed) { padding: 12px 16px 16px; }
.inn-rating-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 3px; font-size: 10px; font-weight: 700;
    border: 1px solid rgba(255,255,255,0.2); color: rgba(255,255,255,0.5);
}
.inn-rating-badge.rated { background: #f59e0b; color: #1e293b; border-color: #d97706; }
.inn-desc-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.inn-desc-grid .desc-col-label {
    font-size: 10px; font-weight: 700; margin-bottom: 2px;
}
.inn-desc-grid .desc-list { font-size: 10px; }
.inn-desc-grid .desc-edit-input { font-size: 10px; padding: 1px 3px; }
.inn-compact-mov {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
}
@media (max-width: 900px) {
    .inn-desc-grid { grid-template-columns: 1fr; }
}

/* Sidebar */
.sidebar { width: 260px; min-height: 100vh; background: var(--primary-dark); }
.sidebar-item {
    padding: 14px 20px; cursor: pointer; transition: all 0.2s;
    border-left: 3px solid transparent; display: flex; align-items: center; gap: 12px; color: #cbd5e1;
}
.sidebar-item:hover { background: rgba(255,255,255,0.05); color: white; }
.sidebar-item.active { background: rgba(255,255,255,0.1); border-left-color: white; color: white; }

/* Score Badge */
.score-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
}

/* Rating Scale Tooltip */
.rating-group { position: relative; }
.rating-btn { position: relative; }
.rating-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    background: #1e293b;
    color: #f1f5f9;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 11px;
    line-height: 1.5;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    pointer-events: none;
}
.rating-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1e293b;
}
.rating-tooltip .scale-title {
    font-weight: 700;
    font-size: 11px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #334155;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.rating-tooltip .scale-item {
    display: flex;
    gap: 8px;
    padding: 3px 0;
    align-items: baseline;
}
.rating-tooltip .scale-item.active {
    color: #fbbf24;
    font-weight: 600;
}
.rating-tooltip .scale-num {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    background: #334155;
    color: #94a3b8;
}
.rating-tooltip .scale-item.active .scale-num {
    background: #fbbf24;
    color: #1e293b;
}
.rating-tooltip .scale-text {
    flex: 1;
    font-size: 10.5px;
}

/* Show tooltip on rating group hover */
.rating-group:hover .rating-tooltip,
.self-rating-group:hover .rating-tooltip {
    display: block;
}
/* Ensure tooltip isn't clipped by table overflow */
.opcrf-table td { overflow: hidden; }
.rating-tooltip { z-index: 200; }

/* Competency tooltip variant */
.rating-tooltip.competency-tooltip .scale-label {
    font-weight: 600;
    color: #e2e8f0;
}
.rating-tooltip.competency-tooltip .scale-desc {
    color: #94a3b8;
    font-size: 10px;
}

/* Descriptor List (always-visible rating scale) */
.desc-list {
    border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
    text-align: left; width: 100%;
}
.desc-item {
    display: flex; align-items: flex-start; gap: 6px; padding: 4px 6px;
    border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: background 0.1s;
    font-size: 10.5px; line-height: 1.3;
}
.desc-item:last-child { border-bottom: none; }
.desc-item:hover { background: #e2e8f0; }
.desc-item.desc-active { background: #dcfce7; }
.desc-item.desc-disabled { opacity: 0.35; cursor: default; }
.desc-item.desc-disabled:hover { background: inherit; }
.desc-num {
    flex-shrink: 0; width: 18px; height: 18px; border-radius: 3px; display: flex;
    align-items: center; justify-content: center; font-size: 10px; font-weight: 700;
    background: white; border: 1px solid var(--border); color: var(--text-muted); margin-top: 1px;
}
.desc-num.desc-active { background: #16a34a; color: white; border-color: #16a34a; }
.desc-text { flex: 1; color: var(--text); }
.desc-item.desc-disabled .desc-text { font-style: italic; color: #94a3b8; }

/* Editable descriptor textarea (innovations) */
.desc-edit-input {
    flex: 1; border: 1px solid #e2e8f0; border-radius: 3px; padding: 2px 4px;
    font-size: 10.5px; line-height: 1.35; background: white; color: var(--text);
    outline: none; min-width: 0; resize: none; overflow: hidden;
    font-family: inherit; field-sizing: content;
    min-height: 1.35em; max-height: 4.1em;
}
.desc-edit-input:focus { border-color: #f59e0b; box-shadow: 0 0 0 1px #fbbf2440; }
.desc-item.desc-active .desc-edit-input { background: #fef9e7; border-color: #f59e0b; }
.desc-item.desc-no-rate { cursor: default; }
.desc-item.desc-no-rate:hover { background: inherit; }

/* Locked (read-only, focal-validated) */
.desc-item.desc-locked { cursor: default; }
.desc-item.desc-locked:hover { background: inherit; }
.desc-item.desc-locked.desc-active:hover { background: #dcfce7; }

/* Self-rating row highlight */
.desc-self-row { background: #fffbeb; }
.desc-self-row:hover { background: #fef3c7; }
.desc-self-badge {
    flex-shrink: 0; font-size: 8px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: #b45309; background: #fef3c7;
    border: 1px solid #fde68a; border-radius: 3px;
    padding: 1px 5px; margin-left: auto; white-space: nowrap; cursor: help;
}
.desc-self-badge.match { color: #166534; background: #dcfce7; border-color: #bbf7d0; }
.desc-focal-row { background: #eff6ff; }
.desc-focal-row:hover { background: #dbeafe; }
.desc-focal-badge {
    flex-shrink: 0; font-size: 8px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: #1d4ed8; background: #dbeafe;
    border: 1px solid #bfdbfe; border-radius: 3px;
    padding: 1px 5px; margin-left: auto; white-space: nowrap; cursor: help;
}
.desc-pmt-badge {
    flex-shrink: 0; font-size: 8px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: #7e22ce; background: #f3e8ff;
    border: 1px solid #e9d5ff; border-radius: 3px;
    padding: 1px 5px; margin-left: auto; white-space: nowrap; cursor: help;
}

/* PMT Dashboard Tabs */
.pmt-tab-active { border-color: #334155 !important; color: #1e293b !important; }

/* MOV upload button */
.mov-btn {
    display: inline-block; text-align: center; padding: 5px 10px;
    background: #2563eb; border: none; border-radius: 5px;
    font-size: 11px; font-weight: 600; color: white; cursor: pointer; transition: all 0.15s;
    white-space: normal; box-shadow: 0 1px 3px rgba(37,99,235,0.3); line-height: 1.4;
}
.mov-btn:hover { background: #1d4ed8; box-shadow: 0 2px 6px rgba(37,99,235,0.4); transform: translateY(-1px); }
.mov-not-required { text-align: center; padding: 4px 0; }

/* Compact focal status */
.focal-status-compact { text-align: center; }
.focal-status-dot {
    display: inline-block; font-size: 13px; font-weight: 700; cursor: help;
    width: 20px; height: 20px; line-height: 20px; text-align: center;
}

/* Self-rating variant */
.desc-list-self { border-color: #fbbf24; }
.desc-list-self .desc-item.desc-active { background: #fef3c7; }
.desc-list-self .desc-num.desc-active { background: #f59e0b; border-color: #d97706; }

/* Mobile responsive: sidebar drawer + layout toggles */
@media (max-width: 767px) {
    .sidebar { position: fixed; left: -280px; z-index: 100; transition: left 0.3s ease; height: 100vh; overflow-y: auto; }
    .sidebar.open { left: 0; }
    .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 99; }
    .sidebar-overlay.active { display: block; }
    .sidebar-hamburger { display: flex !important; }
    .asds-desktop-table { display: none !important; }
    .asds-mobile-cards { display: block !important; }
    .asds-desktop-form { display: none !important; }
    .asds-mobile-form { display: block !important; }
    .pmt-desktop-table { display: none !important; }
    .pmt-mobile-cards { display: block !important; }
    .pmt-desktop-header { display: none !important; }
    .pmt-mobile-header { display: block !important; }
    .sds-desktop-table { display: none !important; }
    .sds-mobile-cards { display: block !important; }
    .sds-desktop-header { display: none !important; }
    .sds-mobile-header { display: block !important; }
    .sds-desktop-form { display: none !important; }
    .sds-mobile-form { display: block !important; }
    .sh-desktop-header { display: none !important; }
    .sh-mobile-header { display: block !important; }
    .sh-desktop-form { display: none !important; }
    .sh-mobile-form { display: block !important; }
    .sidebar-item { min-height: 48px; }
}
@media (min-width: 768px) {
    .sidebar-hamburger { display: none !important; }
    .sidebar-overlay { display: none !important; }
    .asds-mobile-cards { display: none !important; }
    .asds-mobile-form { display: none !important; }
    .pmt-mobile-cards { display: none !important; }
    .pmt-mobile-header { display: none !important; }
    .sds-mobile-cards { display: none !important; }
    .sds-mobile-header { display: none !important; }
    .sds-mobile-form { display: none !important; }
    .sh-mobile-header { display: none !important; }
    .sh-mobile-form { display: none !important; }
}

/* PMT tab scroll — hide scrollbar */
.pmt-tab-scroll::-webkit-scrollbar { display: none; }
.pmt-tab-scroll { -ms-overflow-style: none; scrollbar-width: none; }

/* Print */
@media print {
    .no-print, .rating-tooltip, .desc-list { display: none !important; }
    body { font-size: 10px; margin: 0; padding: 0; }
    .form-section { box-shadow: none; border: 1px solid #000; page-break-inside: avoid; }

    /* Summary page: fit to exactly 1 landscape page */
    .summary-print-page {
        box-shadow: none !important;
        border-radius: 0 !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    .summary-print-page * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* ============ DISTRICT SUPERVISOR DASHBOARD ============ */
.ds-dashboard {
    max-width: 800px;
    margin: 0 auto;
    padding: 0;
    min-height: 100vh;
    background: #f8fafc;
}
.ds-header {
    background: linear-gradient(135deg, #1e3a5f, #2563eb);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.ds-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 16px;
}
.ds-stat-card {
    background: white;
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.ds-section {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin: 0 16px 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.ds-cards-mobile { display: flex; flex-direction: column; gap: 8px; }
.ds-table-desktop { display: none; }
.ds-school-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
}

@media (min-width: 768px) {
    .ds-dashboard { padding: 20px; }
    .ds-header { border-radius: 12px; padding: 20px 28px; }
    .ds-stats-grid { padding: 0; margin-bottom: 12px; }
    .ds-section { margin: 0 0 12px; }
    .ds-cards-mobile { display: none; }
    .ds-table-desktop { display: block; }
}
