:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --bg: #f1f5f9;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-sec: #475569;
    --text-muted: #94a3b8;
    --nav-bg: #1e293b;
    --radius: 0.5rem;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ── */
.navbar { background: linear-gradient(135deg, var(--nav-bg) 0%, #0f172a 100%); color: #fff; position: sticky; top: 0; z-index: 100; }
.navbar-inner { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; padding: 0 1.25rem; height: 56px; gap: 1.5rem; }
.navbar-brand { color: #fff; font-weight: 700; font-size: 1.15rem; white-space: nowrap; }
.navbar-brand:hover { text-decoration: none; color: #fff; }
.navbar-toggle { display: none; background: none; border: 1px solid rgba(255,255,255,.25); color: #fff; font-size: 1.3rem; padding: .25rem .55rem; border-radius: 4px; cursor: pointer; }
.navbar-menu { display: flex; gap: .25rem; flex: 1; }
.navbar-menu a { color: rgba(255,255,255,.75); padding: .4rem .75rem; border-radius: 4px; font-size: .9rem; white-space: nowrap; }
.navbar-menu a:hover { color: #fff; background: rgba(255,255,255,.1); text-decoration: none; }
.navbar-menu a.active { color: #fff; background: var(--primary); box-shadow: 0 2px 8px rgba(37,99,235,.3); }
.navbar-user { display: flex; align-items: center; gap: .75rem; font-size: .875rem; color: rgba(255,255,255,.7); white-space: nowrap; }
.logout-link { color: rgba(255,255,255,.7); }
.logout-link:hover { color: #fff; }

/* ── Nav Dropdown ── */
.nav-drop { position: relative; }
.nav-drop-toggle { color: rgba(255,255,255,.75); padding: .4rem .75rem; border-radius: 4px; font-size: .9rem; white-space: nowrap; cursor: pointer; text-decoration: none; display: inline-block; }
.nav-drop-toggle:hover { color: #fff; background: rgba(255,255,255,.1); text-decoration: none; }
.nav-drop-toggle.active { color: #fff; background: var(--primary); box-shadow: 0 2px 8px rgba(37,99,235,.3); }
.nav-drop-menu { display: none; position: absolute; top: calc(100% + 4px); left: 0; background: #1e293b; border: 1px solid rgba(255,255,255,.12); border-radius: 6px; min-width: 170px; box-shadow: 0 8px 24px rgba(0,0,0,.35); z-index: 200; overflow: hidden; }
.nav-drop.open .nav-drop-menu { display: block; }
.nav-drop-menu a { display: block; padding: .55rem 1rem; color: rgba(255,255,255,.8); font-size: .85rem; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.06); }
.nav-drop-menu a:last-child { border-bottom: none; }
.nav-drop-menu a:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }

@media (max-width: 768px) {
    .navbar-inner { flex-wrap: wrap; height: auto; padding: .75rem 1rem; }
    .navbar-toggle { display: block; margin-left: auto; }
    .navbar-menu { display: none; flex-basis: 100%; flex-direction: column; gap: .15rem; padding: .5rem 0; }
    .navbar-menu.open { display: flex; }
    .navbar-user { display: none; }
    .nav-drop-menu { position: static; box-shadow: none; border: none; background: rgba(255,255,255,.05); border-radius: 4px; margin: .15rem 0 .15rem 1rem; min-width: 0; }
}

/* ── Layout ── */
.container { max-width: 1280px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.page-header { margin-bottom: 1.5rem; padding-bottom: .75rem; border-bottom: 2px solid var(--primary-light); }
.page-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--primary-dark); }

/* ── Stats Cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); border-top: 3px solid var(--primary); transition: transform .15s, box-shadow .15s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--primary-dark); line-height: 1.2; }
.stat-label { font-size: .85rem; color: var(--text-muted); margin-top: .25rem; }

@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .stats-grid { grid-template-columns: 1fr; } }

/* ── Cards ── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.5rem; overflow: hidden; }
.card-header { padding: .85rem 1.25rem; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 1rem; display: flex; align-items: center; justify-content: space-between; background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%); }
.card-body { padding: 1.25rem; }

.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
@media (max-width: 900px) { .chart-row { grid-template-columns: 1fr; } }
.chart-container { position: relative; height: 300px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th, .data-table td { padding: .7rem .85rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: var(--nav-bg); color: #fff; font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.data-table tbody tr:nth-child(odd) { background: #eff6ff; }
.data-table tbody tr:nth-child(even) { background: #dbeafe; }
.data-table tbody tr:hover { background: #bfdbfe; }
.data-table td.actions { white-space: nowrap; }
.data-table td.center, .data-table th.center { text-align: center; }
.data-table td.right, .data-table th.right { text-align: right; }

/* ── Heatmap ── */
.heatmap-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.heatmap-table th, .heatmap-table td { padding: .6rem .75rem; text-align: center; border: 1px solid var(--border); }
.heatmap-table th { background: var(--nav-bg); color: #fff; font-weight: 600; font-size: .8rem; }
.heatmap-table th.area-label { text-align: left; min-width: 160px; }
.heatmap-table td.area-label { font-weight: 500; text-align: left; }
.heatmap-table tbody tr:nth-child(odd) td.area-label { background: #fff; }
.heatmap-table tbody tr:nth-child(even) td.area-label { background: #f8fafc; }
.heatmap-green { background: var(--success); color: #fff; font-weight: 600; }
.heatmap-amber { background: var(--warning); color: #fff; font-weight: 600; }
.heatmap-red { background: var(--danger); color: #fff; font-weight: 600; }
.heatmap-na { background: #f1f5f9; color: var(--text-muted); font-style: italic; font-size: .8rem; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-weight: 600; font-size: .875rem; margin-bottom: .3rem; color: var(--text-sec); }
.form-control { display: block; width: 100%; padding: .55rem .75rem; font-size: .925rem; border: 1px solid var(--border); border-radius: 4px; background: #fff; color: var(--text); transition: border-color .15s; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); transition: border-color .15s, box-shadow .15s; }
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.form-row .flex-2 { flex: 2; }
.form-actions { display: flex; gap: .75rem; margin-top: 1.5rem; }
.form-inline { display: flex; gap: .75rem; align-items: end; flex-wrap: wrap; margin-bottom: 1.25rem; }
.form-inline .form-group { margin-bottom: 0; }

@media (max-width: 600px) { .form-row { flex-direction: column; gap: 0; } }

/* ── Filters ── */
.filters { display: flex; gap: 1rem; align-items: end; flex-wrap: wrap; margin-bottom: 1.5rem; padding: 1rem 1.25rem; background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.filters .form-group { margin-bottom: 0; min-width: 180px; }
.filters .btn { align-self: end; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: .5rem 1rem; font-size: .875rem; font-weight: 600; border: 1px solid transparent; border-radius: 4px; cursor: pointer; transition: background .15s, border-color .15s; text-decoration: none; line-height: 1.5; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: #fff; }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark) 0%, #1e3a8a 100%); color: #fff; }
.btn-secondary { background: #fff; color: var(--text-sec); border-color: var(--border); }
.btn-secondary:hover { background: #f1f5f9; color: var(--text); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #b45309; color: #fff; }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }
.btn-lg { padding: .7rem 2rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn + .btn { margin-left: .25rem; }

/* ── Alerts ── */
.alert { padding: .85rem 1.1rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: .9rem; }
.alert-success { background: var(--success-light); color: #15803d; border: 1px solid #bbf7d0; }
.alert-error { background: var(--danger-light); color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #93c5fd; }

/* ── Badges ── */
.badge { display: inline-block; padding: .2rem .6rem; font-size: .75rem; font-weight: 600; border-radius: 50px; letter-spacing: .02em; }
.badge-success { background: var(--success); color: #fff; }
.badge-warning { background: var(--warning); color: #fff; }
.badge-danger { background: var(--danger); color: #fff; }
.badge-primary { background: var(--primary); color: #fff; }
.badge-secondary { background: #94a3b8; color: #fff; }

/* ── Decision Support ── */
.decision-box { padding: 1rem 1.25rem; border-radius: var(--radius); border-left: 4px solid var(--primary); background: var(--primary-light); margin: 1rem 0; font-size: .9rem; line-height: 1.7; }
.decision-box em { display: block; margin-top: .5rem; font-size: .825rem; color: var(--text-muted); }

/* ── Competency Scores ── */
.score-grid { display: grid; gap: .75rem; margin: 1rem 0; }
.score-row { display: flex; align-items: center; gap: 1rem; }
.score-row .label { flex: 1; font-size: .9rem; }
.score-row .value { font-weight: 700; font-size: 1rem; min-width: 2.5rem; text-align: center; }
.score-bar { flex: 0 0 120px; height: 10px; background: #e2e8f0; border-radius: 5px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 5px; transition: width .4s ease; }

/* ── KPI Row ── */
.kpi-row { display: flex; align-items: end; gap: .75rem; margin-bottom: .5rem; }
.kpi-row .form-group { margin-bottom: 0; }
.kpi-row .btn-danger { align-self: center; }

/* ── Login Page ── */
.login-page { background: linear-gradient(135deg, var(--nav-bg) 0%, #0f172a 50%, #1e3a5f 100%); display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.login-card { background: var(--card); border-radius: var(--radius); padding: 2.5rem 2rem; width: 100%; max-width: 400px; box-shadow: 0 4px 24px rgba(0,0,0,.15); text-align: center; }
.login-card h1 { font-size: 1.5rem; margin-bottom: .25rem; color: var(--text); }
.login-subtitle { color: var(--text-muted); font-size: .9rem; margin-bottom: 1.75rem; }
.login-card .form-group { text-align: left; }
.login-card .btn { margin-top: .5rem; }
.login-card .alert { text-align: left; }

/* ── Survey Form (mobile-first) ── */
.survey-page { background: #fff; min-height: 100vh; }
.survey-container { max-width: 640px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.survey-header { text-align: center; margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 2px solid var(--primary-light); }
.survey-header h1 { font-size: 1.5rem; color: var(--text); margin-bottom: .75rem; }
.anon-notice { background: var(--success-light); color: #15803d; padding: .85rem 1rem; border-radius: var(--radius); font-size: .9rem; font-weight: 500; line-height: 1.5; margin-bottom: .75rem; }
.survey-header .time-est { color: var(--text-muted); font-size: .85rem; }

.survey-section { margin-bottom: 2rem; }
.survey-section-title { font-size: 1.1rem; font-weight: 700; color: var(--primary-dark); margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }
.survey-question { margin-bottom: 1.25rem; }
.survey-question p { font-size: .95rem; margin-bottom: .6rem; line-height: 1.5; color: var(--text); }

.rating-group { display: flex; gap: .5rem; }
.rating-group input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.rating-group label { display: flex; align-items: center; justify-content: center; min-width: 48px; height: 48px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 1rem; font-weight: 600; cursor: pointer; transition: all .15s; background: #fff; color: var(--text-sec); flex: 1; max-width: 70px; }
.rating-group label:hover { border-color: var(--primary); color: var(--primary); }
.rating-group input[type="radio"]:checked + label { background: var(--primary); color: #fff; border-color: var(--primary); }

.rating-legend { display: flex; justify-content: space-between; font-size: .75rem; color: var(--text-muted); margin-top: .3rem; padding: 0 .15rem; }

.residence-options { display: flex; flex-direction: column; gap: .5rem; }
.residence-options label { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; border: 2px solid var(--border); border-radius: var(--radius); cursor: pointer; font-size: 1rem; transition: all .15s; }
.residence-options label:hover { border-color: var(--primary); }
.residence-options input[type="radio"]:checked + span { font-weight: 600; }
.residence-options input[type="radio"] { width: 20px; height: 20px; accent-color: var(--primary); }

.enps-question { margin-bottom: 1.5rem; }
.enps-question > p { font-size: .95rem; margin-bottom: .75rem; line-height: 1.5; }
.enps-group { display: flex; gap: .35rem; flex-wrap: wrap; }
.enps-group input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.enps-group label { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 2px solid var(--border); border-radius: 50%; font-size: .95rem; font-weight: 600; cursor: pointer; transition: all .15s; background: #fff; color: var(--text-sec); }
.enps-group label:hover { border-color: var(--primary); color: var(--primary); }
.enps-group input[type="radio"]:checked + label { background: var(--primary); color: #fff; border-color: var(--primary); }
.enps-legend { display: flex; justify-content: space-between; font-size: .75rem; color: var(--text-muted); margin-top: .4rem; }

.comment-section textarea { width: 100%; padding: .85rem; font-size: .95rem; border: 1px solid var(--border); border-radius: var(--radius); resize: vertical; min-height: 100px; font-family: inherit; }
.comment-section textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.comment-warning { font-size: .85rem; color: var(--warning); margin-bottom: .5rem; }

.submit-section { text-align: center; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.submit-section .btn { padding: .85rem 3rem; font-size: 1.1rem; }

.thank-you { text-align: center; padding: 4rem 1rem; }
.thank-you h1 { font-size: 1.75rem; color: var(--success); margin-bottom: 1rem; }
.thank-you p { font-size: 1rem; color: var(--text-sec); max-width: 400px; margin: 0 auto; }

.error-page { text-align: center; padding: 4rem 1rem; }
.error-page h1 { font-size: 1.5rem; color: var(--danger); margin-bottom: .75rem; }
.error-page p { color: var(--text-sec); }

/* ── Token List ── */
.token-list { font-family: "Courier New", monospace; font-size: .85rem; background: #f8fafc; padding: 1rem; border-radius: var(--radius); border: 1px solid var(--border); max-height: 400px; overflow-y: auto; line-height: 1.8; word-break: break-all; }
.token-used { color: var(--text-muted); text-decoration: line-through; }

/* ── Utilities ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.d-flex { display: flex; }
.gap-1 { gap: .5rem; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ── Comparison side-by-side ── */
.block-header td { background: var(--primary-light); font-weight: 700; color: var(--primary-dark); font-size: .85rem; padding: .5rem .85rem; }
.block-avg td { background: #f8fafc; }
.diff-zero { color: var(--success); font-weight: 600; }
.diff-small { color: var(--warning); font-weight: 600; }
.diff-large { color: var(--danger); font-weight: 700; }

.token-display input[type="text"] { font-family: "Courier New", monospace; font-size: .85rem; background: #f8fafc; }

/* ── Employee Profile ── */
/* ── Inline Avatar ── */
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; color: #fff; flex-shrink: 0; }

.profile-header { display: flex; align-items: center; gap: 1.25rem; padding: 1.5rem; background: linear-gradient(135deg, var(--nav-bg) 0%, #1e3a5f 100%); border-radius: var(--radius); color: #fff; margin-bottom: 1.5rem; flex-wrap: wrap; }
.profile-avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 700; color: #fff; flex-shrink: 0; border: 3px solid rgba(255,255,255,.25); }
.profile-info { flex: 1; min-width: 200px; }
.profile-name { font-size: 1.3rem; font-weight: 700; margin-bottom: .35rem; }
.profile-name .badge { vertical-align: middle; margin-left: .5rem; font-size: .7rem; }
.profile-meta { display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: .875rem; color: rgba(255,255,255,.8); }
.profile-tag strong { color: rgba(255,255,255,.55); font-weight: 500; }
.profile-actions { display: flex; gap: .5rem; flex-shrink: 0; }
@media (max-width: 640px) {
    .profile-header { flex-direction: column; align-items: flex-start; }
    .profile-actions { width: 100%; }
    .profile-actions .btn { flex: 1; }
}

/* ── Detail grid & rows ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
@media (max-width: 768px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-card { margin-bottom: 0; }
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: .6rem 0; border-bottom: 1px solid #f1f5f9; }
.detail-row:last-child { border-bottom: none; }
.detail-label { font-size: .875rem; color: var(--text-muted); }
.detail-value { font-size: .925rem; font-weight: 500; color: var(--text); text-align: right; }

/* ── Tab Bar ── */
.tab-bar { display: flex; gap: .25rem; border-bottom: 2px solid var(--border); padding-bottom: 0; }
.tab-item { padding: .6rem 1.25rem; font-size: .9rem; font-weight: 600; color: var(--text-muted); border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all .15s; text-decoration: none; }
.tab-item:hover { color: var(--primary); text-decoration: none; }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 .4rem; border-radius: 50px; background: var(--danger); color: #fff; font-size: .7rem; margin-left: .35rem; vertical-align: middle; }

/* ── Comment Feed ── */
.comment-feed { display: flex; flex-direction: column; gap: 1rem; }
.comment-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); border-left: 4px solid var(--primary-light); transition: border-color .15s; }
.comment-card:hover { border-left-color: var(--primary); }
.comment-card.comment-reviewed { border-left-color: var(--success); opacity: .8; }
.comment-meta { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: .75rem; }
.comment-residence { background: var(--primary); color: #fff; padding: .15rem .6rem; border-radius: 50px; font-size: .8rem; font-weight: 600; }
.comment-date { font-size: .85rem; color: var(--text-muted); }
.comment-text { font-size: .95rem; line-height: 1.65; color: var(--text); white-space: pre-wrap; margin-bottom: .75rem; padding: .75rem; background: #f8fafc; border-radius: 4px; }
.comment-actions { display: flex; gap: .5rem; }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-icon { font-size: 3rem; margin-bottom: .75rem; opacity: .5; }
.empty-state p { font-size: 1rem; }

/* ── Period Stats ── */
.period-stat { font-size: .85rem; color: var(--text-sec); padding: .25rem .75rem; background: #f1f5f9; border-radius: 50px; white-space: nowrap; }
.period-stat strong { color: var(--primary-dark); }

.attendance-note { font-size: .8rem; color: var(--text-muted); margin-top: .5rem; }

/* ── Training Matrix ── */
.training-matrix { width: 100%; border-collapse: collapse; font-size: .85rem; }
.training-matrix th, .training-matrix td { padding: .55rem .65rem; text-align: left; border-bottom: 1px solid var(--border); }
.training-matrix th { background: var(--nav-bg); color: #fff; font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.training-matrix th.mod-header { max-width: 100px; white-space: normal; font-size: .7rem; text-transform: none; letter-spacing: 0; }
.training-matrix th.mod-header a { color: rgba(255,255,255,.85); }
.training-matrix th.mod-header a:hover { color: #fff; text-decoration: underline; }
.training-matrix th.sticky-col, .training-matrix td.sticky-col { position: sticky; left: 0; z-index: 2; background: var(--card); min-width: 160px; }
.training-matrix th.sticky-col { background: var(--nav-bg); z-index: 3; }
.training-matrix tbody tr:nth-child(odd) { background: #eff6ff; }
.training-matrix tbody tr:nth-child(odd) td.sticky-col { background: #eff6ff; }
.training-matrix tbody tr:nth-child(even) { background: #dbeafe; }
.training-matrix tbody tr:nth-child(even) td.sticky-col { background: #dbeafe; }
.training-matrix tbody tr:hover { background: #bfdbfe; }
.training-matrix tbody tr:hover td.sticky-col { background: #bfdbfe; }
.training-behind td:first-child { border-left: 3px solid var(--danger); }

.training-cell { width: 48px; height: 36px; }
.training-green { background: var(--success) !important; color: #fff; font-weight: 600; font-size: .75rem; }
.training-amber { background: var(--warning) !important; color: #fff; font-weight: 600; }
.training-grey { background: #cbd5e1 !important; }
.training-red { background: var(--danger) !important; color: #fff; font-weight: 600; font-size: .75rem; }
.training-blue { background: #3b82f6 !important; color: #fff; font-weight: 600; font-size: .85rem; }
.training-na { background: #f1f5f9 !important; color: var(--text-muted); font-size: .75rem; }

.training-pct-bar { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.training-pct-fill { height: 100%; border-radius: 4px; transition: width .3s ease; }

.training-hours-bar { height: 28px; background: #e2e8f0; border-radius: 6px; overflow: hidden; }
.training-hours-fill { height: 100%; border-radius: 6px; transition: width .4s ease; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: .85rem; min-width: fit-content; padding: 0 .75rem; }

.training-legend-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; margin-right: .2rem; }

/* ── Module Detail Page ── */
.mod-hero { background: linear-gradient(135deg, var(--nav-bg) 0%, #1e3a5f 100%); border-radius: var(--radius); padding: 1.75rem; color: #fff; margin-bottom: 1.5rem; display: flex; gap: 2rem; flex-wrap: wrap; align-items: center; }
.mod-hero-content { flex: 1; min-width: 280px; }
.mod-hero-title { font-size: 1.4rem; font-weight: 700; margin-bottom: .4rem; }
.mod-hero-desc { font-size: .9rem; color: rgba(255,255,255,.75); margin-bottom: .75rem; line-height: 1.5; }
.mod-hero-tags { display: flex; gap: .4rem; flex-wrap: wrap; }
.mod-tag { background: rgba(255,255,255,.12); padding: .2rem .65rem; border-radius: 50px; font-size: .75rem; color: rgba(255,255,255,.85); white-space: nowrap; }
.mod-tag strong { color: #fff; }
.mod-tag-practical { background: rgba(59,130,246,.5); color: #fff; }
.mod-hero-stats { display: flex; gap: 1.5rem; flex-shrink: 0; }
.mod-hero-stat { text-align: center; }
.mod-hero-stat-val { display: block; font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.mod-hero-stat-lbl { font-size: .7rem; color: rgba(255,255,255,.6); text-transform: uppercase; letter-spacing: .03em; }
@media (max-width: 640px) { .mod-hero { flex-direction: column; gap: 1rem; } .mod-hero-stats { gap: 1rem; } }

.mod-lesson-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1rem; display: flex; overflow: hidden; box-shadow: var(--shadow); transition: border-color .15s; }
.mod-lesson-card:hover { border-color: var(--primary); }
.mod-lesson-num { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: #fff; font-size: 1.1rem; font-weight: 800; min-width: 48px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mod-lesson-content { padding: 1rem 1.25rem; flex: 1; min-width: 0; }
.mod-lesson-header { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; margin-bottom: .75rem; }
.mod-lesson-header h3 { font-size: 1rem; font-weight: 700; color: var(--text); margin: 0; line-height: 1.4; }
.mod-lesson-actions { display: flex; gap: .35rem; flex-shrink: 0; }

.mod-video-preview { margin-bottom: .75rem; border-radius: 6px; overflow: hidden; background: #0f172a; }
.mod-video-embed { position: relative; padding-bottom: 56.25%; height: 0; }
.mod-video-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.mod-video-placeholder { display: flex; align-items: center; gap: .65rem; padding: .75rem 1rem; background: #f1f5f9; border: 2px dashed #cbd5e1; border-radius: 6px; margin-bottom: .75rem; color: var(--text-muted); font-size: .85rem; }
.mod-video-icon { font-size: 1.5rem; opacity: .5; }

.mod-lesson-body-preview { font-size: .85rem; color: var(--text-sec); line-height: 1.6; }

.mod-question-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.mod-question-header { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: .75rem; }
.mod-question-num { background: var(--primary); color: #fff; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 700; flex-shrink: 0; }
.mod-question-text { flex: 1; font-size: .95rem; font-weight: 600; color: var(--text); margin: 0; line-height: 1.4; padding-top: .15rem; }

.mod-question-options { display: flex; flex-direction: column; gap: .4rem; padding-left: 2.75rem; }
.mod-option { display: flex; align-items: center; gap: .5rem; padding: .45rem .75rem; border-radius: 4px; font-size: .875rem; color: var(--text-sec); background: #f8fafc; border: 1px solid #e2e8f0; }
.mod-option-correct { background: var(--success-light); border-color: #bbf7d0; color: #15803d; font-weight: 600; }
.mod-option-marker { font-size: .85rem; flex-shrink: 0; width: 1.2rem; text-align: center; }

.mod-opt-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.mod-opt-row input[type="radio"] { width: 18px; height: 18px; accent-color: var(--success); flex-shrink: 0; }
.mod-opt-row .form-control { flex: 1; }

.tab-panel { min-height: 200px; }

/* ── Print ── */
@media print {
    .navbar, .filters, .btn, .form-actions { display: none; }
    .container { max-width: 100%; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}
