:root {
    --ink: #172033;
    --muted: #667085;
    --line: #e6e9ef;
    --surface: #ffffff;
    --page: #f4f6f9;
    --brand: #1f6feb;
    --brand-dark: #0f4bb8;
    --green: #16a34a;
    --orange: #f97316;
    --rose: #db2777;
    --gray: #64748b;
}

* {
    letter-spacing: 0;
}

body {
    background: var(--page);
    color: var(--ink);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-navbar {
    background: #111827;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .06);
}

.app-shell {
    padding: 24px;
}

.eyebrow {
    color: var(--brand-dark);
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.login-wrap {
    min-height: calc(100vh - 96px);
    display: grid;
    place-items: center;
}

.login-card {
    width: min(100%, 440px);
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 16px 48px rgba(15, 23, 42, .08);
}

.vote-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    gap: 24px;
    align-items: stretch;
    margin-bottom: 20px;
}

.progress-panel,
.panel,
.unassigned-section,
.no-info-section {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
}

.progress-panel {
    padding: 20px;
}

.save-status {
    color: var(--muted);
    font-size: .92rem;
}

.save-status.is-saving {
    color: var(--brand);
}

.save-status.is-saved {
    color: var(--green);
}

.save-status.is-error {
    color: #dc2626;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px 0;
}

.section-heading h2,
.quadrant h2,
.panel h2 {
    font-size: 1rem;
    font-weight: 800;
    margin: 0;
}

.section-heading span,
.quadrant p {
    color: var(--muted);
    font-size: .9rem;
}

.axis-row {
    display: flex;
    justify-content: center;
    gap: 32px;
    padding: 16px;
    color: var(--muted);
    font-weight: 700;
}

.matrix-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    border: 1px solid var(--line);
    background: var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.quadrant {
    min-height: 270px;
    background: var(--surface);
    padding: 18px;
}

.quadrant:nth-child(1),
.quadrant:nth-child(2) {
    border-bottom: 1px solid var(--line);
}

.quadrant:nth-child(1),
.quadrant:nth-child(3) {
    border-right: 1px solid var(--line);
}

.quadrant-head {
    border-left: 4px solid var(--gray);
    padding-left: 12px;
    margin-bottom: 12px;
}

.quadrant-potential .quadrant-head {
    border-color: var(--orange);
}

.quadrant-a-player .quadrant-head {
    border-color: var(--green);
}

.quadrant-wrong-position .quadrant-head {
    border-color: var(--gray);
}

.quadrant-skilled-misaligned .quadrant-head {
    border-color: var(--rose);
}

.employee-list {
    min-height: 92px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 10px;
    padding: 16px;
    transition: background .16s ease, outline .16s ease;
}

.quadrant .employee-list {
    padding: 0;
}

.employee-list:empty::after {
    content: "Thả nhân viên vào đây";
    color: #98a2b3;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    display: grid;
    min-height: 74px;
    place-items: center;
}

.employee-card {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-height: 66px;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: grab;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .06);
}

.employee-card:hover {
    border-color: #b6c6e3;
    transform: translateY(-1px);
}

.employee-card:active {
    cursor: grabbing;
}

.avatar {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #e8f1ff;
    color: var(--brand-dark);
    font-weight: 800;
}

.drag-ghost {
    opacity: .45;
}

.dragging {
    opacity: .75;
}

.no-info-section,
.unassigned-section {
    margin-top: 20px;
}

.admin-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 24px;
}

.admin-sidebar {
    background: #111827;
    color: white;
    border-radius: 8px;
    padding: 16px;
    align-self: start;
    position: sticky;
    top: 20px;
}

.admin-title {
    font-weight: 800;
    margin-bottom: 16px;
}

.admin-sidebar a {
    display: block;
    color: #d1d5db;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 6px;
}

.admin-sidebar a.active,
.admin-sidebar a:hover {
    background: rgba(255, 255, 255, .1);
    color: white;
}

.admin-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 20px;
}

.admin-head h1 {
    font-size: 1.7rem;
    margin: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card,
.panel {
    padding: 20px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.stat-card span {
    color: var(--muted);
    display: block;
    margin-bottom: 8px;
}

.stat-card strong {
    display: block;
    font-size: 1.8rem;
}

.form-panel {
    max-width: 900px;
}

.filter-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 260px) auto;
    gap: 12px;
    margin-bottom: 16px;
}

.result-row + .result-row {
    margin-top: 20px;
}

.result-table {
    min-width: 1180px;
}

.result-table th {
    color: #111827;
    font-size: .92rem;
    white-space: nowrap;
}

.employee-result-link {
    font-weight: 700;
}

.vote-count,
.score-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #243b76;
    font-weight: 700;
    white-space: nowrap;
}

.vote-count.muted {
    background: #f1f5f9;
    color: #475569;
}

.score-pill {
    background: #f8fafc;
    color: #172033;
    border: 1px solid var(--line);
    min-width: 52px;
    justify-content: center;
}

.result-cell {
    min-width: 126px;
}

.result-cell-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.result-cell-top strong {
    font-size: .98rem;
}

.result-cell-top span {
    color: var(--muted);
    font-size: .82rem;
    white-space: nowrap;
}

.mini-progress {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e5e7eb;
}

.mini-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--brand);
}

.result-cell.is-a-player .mini-progress span {
    background: var(--green);
}

.result-cell.is-potential .mini-progress span {
    background: var(--orange);
}

.result-cell.is-misaligned .mini-progress span {
    background: var(--rose);
}

.result-cell.is-wrong .mini-progress span {
    background: var(--gray);
}

.progress {
    height: 18px;
}

.progress-bar {
    background: var(--brand);
}

@media (max-width: 900px) {
    .app-shell {
        padding: 16px;
    }

    .vote-hero,
    .admin-layout,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
    }

    .matrix-grid {
        grid-template-columns: 1fr;
    }

    .quadrant,
    .quadrant:nth-child(1),
    .quadrant:nth-child(2),
    .quadrant:nth-child(3) {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .section-heading,
    .admin-head {
        align-items: flex-start;
        flex-direction: column;
    }
}