/* ══════════════════════════════════════════════════
   TRAINING HUB v3.0 — COMMON CSS (Design System)
   ══════════════════════════════════════════════════ */

/* ── SYSTEM FONT STACK (OFFLINE FIRST-PARTY TYPOGRAPHY) ── */

/* ── CSS VARIABLES ── */
:root {
    --ice-header: linear-gradient(135deg, #e6f1fd 0%, #dceefe 50%, #d0e6fc 100%);
    --ice-surface: linear-gradient(135deg, #ffffff 0%, #edf7ff 100%);
    --accent-purple-light: #f3edff;
    --accent-cyan-light: #e6faff;
    --accent-amber-light: #fff7e6;
    --accent-rose-light: #fff0f5;
    --border-subtle: #e7f1fb;
    --button-hover: #e8f3ff;
    --shadow-popover: 0 12px 36px #00000016;
    --ring-focus: #0066ff1a;
    /* Typography: one offline-safe family across every application surface. */
    --font-sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    --font-mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Menlo, Monaco, Consolas, monospace;

    /* Semibold text remains readable on every portal and authentication page. */
    --font-weight-body: 600;
    --font-weight-heading: 700;

    /* Background */
    --bg-primary: #f0f7ff;
    --bg-secondary: #f0f7ff;
    --bg-tertiary: #dceefe;
    --bg-card:      #ffffff;
    --bg-card-solid:#ffffff;
    --bg-hover: #f0f7ff;
    --bg-input:     #ffffff;

    /* Text */
    --text-primary: #17324d;
    --text-secondary: #52677d;
    --text-muted: #52677d;
    --text-dark: #17324d;

    /* Theme body */
    --bg-body: var(--bg-primary);

    /* Light theme base vars */
    --bg-light-primary: #f0f7ff;
    --bg-light-card:     #ffffff;
    --text-light-primary: #17324d;
    --text-light-muted: #52677d;
    --border-light-theme: #d6e6f5;

    /* Accent Colors */
    --accent-blue:    #0066FF;
    --accent-blue-hover:#0052CC;
    --accent-purple:  #6366f1;
    --accent-cyan:    #0EA5E9;
    --accent-cyan-text: #0369a1;
    --accent-purple-text: #6d28d9;
    --accent-emerald: #10B981;
    --accent-amber:   #d97706;
    --accent-rose:    #e11d48;
    --accent-indigo:  #0066FF;

    /* Semantic status palette: status meaning stays identical on every portal. */
    --status-info-bg:      #EFF6FF;
    --status-info-text: #0052cc;
    --status-info-border:  #BFDBFE;
    --status-success-bg:   #ECFDF5;
    --status-success-text: #047857;
    --status-success-border:#A7F3D0;
    --status-warning-bg:   #FFFBEB;
    --status-warning-text: #B45309;
    --status-warning-border:#FDE68A;
    --status-danger-bg:    #FEF2F2;
    --status-danger-text:  #BE123C;
    --status-danger-border:#FECACA;
    --status-neutral-bg: #f0f7ff;
    --status-neutral-text: #52677d;
    --status-neutral-border: #d6e6f5;

    /* Prime Blue Palette */
    --primary-blue:       #0066FF;
    --primary-blue-hover: #0052CC;
    --primary-blue-light: #EFF6FF;
    --primary-blue-border:#BFDBFE;

    /* Gradients / Prime Themes */
    --gradient-blue:   #0066FF;
    --gradient-cyan: linear-gradient(135deg, #0066ff, #38bdf8);
    --gradient-amber: linear-gradient(135deg, #d97706, #f59e0b);
    --gradient-rose: linear-gradient(135deg, #e11d48, #f43f5e);
    --gradient-indigo: linear-gradient(135deg, #0066ff, #60a5fa);
    --gradient-emerald: linear-gradient(135deg, #10b981, #34d399);

    /* Borders & Shadows */
    --border-glass: #d6e6f5;
    --border-light: #d6e6f5;
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: 0 12px 36px #00000016;
    --shadow-glow-blue:   none;
    --shadow-glow-purple: none;

    /* Layout */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 12px;
    --radius-xl: 12px;
    --radius-2xl:  16px;
    --radius-full: 9999px;

    /* Shared component density. */
    --control-height-sm: 32px;
    --control-height-md: 40px;
    --control-height-lg: 44px;
    --sidebar-brand-row-height: 78px;
    --sidebar-brand-logo-height: 54px;

    /* Transitions */
    --transition-fast:   0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow:   0.4s ease;
}

/* Preserve a visible keyboard focus indicator across page-specific styles. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--primary-blue) !important;
    outline-offset: 2px !important;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {font-family: var(--font-sans);
    font-size: 14px;
    font-weight: var(--font-weight-body);
    color: #17324d;
    background: #f0f7ff;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    background-image: none;
}

h1, h2, h3, h4, h5, h6, strong, b { font-weight: var(--font-weight-heading); }

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button, input, select, textarea { font-family: var(--font-sans); font-weight: inherit; }
select{
    min-height: 40px;
    border: 1px solid #d6e6f5;
    border-radius: 12px;
    background-color: #fff;
    color: #17324d;
    font-size: 14px;
    box-shadow: none;
}
img { display: block; max-width: 100%; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: transparent; border-radius: 8px; }
*:hover::-webkit-scrollbar-thumb { background: #b8b8be; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* ══════════════════════════════════════════════════
   TYPOGRAPHY
   ══════════════════════════════════════════════════ */
.text-xs    { font-size: 12px; }
.text-sm    { font-size: 12px; }
.text-md    { font-size: 13px; }
.text-base  { font-size: 14px; }
.text-lg    { font-size: 16px; }
.text-xl    { font-size: 18px; }
.text-2xl   { font-size: 22px; }
.text-3xl   { font-size: 28px; }
.fw-500  { font-weight: var(--font-weight-body); }
.fw-600  { font-weight: var(--font-weight-body); }

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-blue      { color: var(--accent-blue); }
.text-purple    { color: var(--accent-purple); }
.text-emerald   { color: var(--accent-emerald); }
.text-amber     { color: var(--accent-amber); }
.text-rose      { color: var(--accent-rose); }
.text-cyan      { color: var(--accent-cyan); }

/* ══════════════════════════════════════════════════
   LAYOUT HELPERS
   ══════════════════════════════════════════════════ */
.flex           { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.mt-1 { margin-top: 4px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden { display: none !important; }

/* ══════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════ */
.card {
    background: #fff;
    border: 1px solid #d6e6f5;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: none;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}
.card-title {
    font-size: 16px;
    font-weight: var(--font-weight-heading);
    color: #17324d;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: normal;
}
.card-title i { color: var(--accent-blue); font-size: 15px; }

/* ── STAT CARDS ── */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    box-shadow: none;
}
.stat-card:hover {
    transform: none;
    box-shadow: none; }

.stat-header { display: flex; align-items: flex-start; justify-content: space-between; }
.stat-icon {width: 42px; height: 42px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px;
    background: #f0f7ff;
    color: #52677d;
    box-shadow: none;
}
.stat-value {font-size: 28px;
    font-weight: var(--font-weight-heading);
    letter-spacing: normal;
    color: #17324d;
}
.stat-label {
    font-size: 12px;
    color: #52677d;
    font-weight: var(--font-weight-body); }

/* ══════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════ */
.btn {display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: var(--font-weight-body);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    white-space: nowrap;
    user-select: none;
    outline: none;
    position: relative;
    font-family: var(--font-sans);
    box-shadow: none;
    transform: none;
    line-height: 1.3;
}
.btn:hover {
    transform: none;
    box-shadow: none;
}
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.65; cursor: not-allowed; transform: none !important; box-shadow: none; }

.btn-primary {
    background: #0066ff;
    color: #fff;
    border-color: transparent;
    box-shadow: none;
    font-size: 14px;
    font-weight: var(--font-weight-body);
    border-radius: 12px;
    min-height: 40px;
    transform: none;
    line-height: 1.3;
}
.btn-primary:hover {
    background: #0052cc;
    box-shadow: none;
}

.btn-secondary,
.btn-outline {
    background: var(--bg-card);
    color: var(--text-secondary);
    border-color: var(--border-light);
}
.btn-outline{
    font-size: 14px;
    font-weight: var(--font-weight-body);
    border-radius: 12px;
    min-height: 40px;
    box-shadow: none;
    transform: none;
    line-height: 1.3;
    background: #fff;
    color: #17324d;
    border: 1px solid #d6e6f5;
}
.btn-secondary{
    font-size: 14px;
    font-weight: var(--font-weight-body);
    border-radius: 12px;
    min-height: 40px;
    box-shadow: none;
    transform: none;
    line-height: 1.3;
    background: #fff;
    color: #17324d;
    border: 1px solid #d6e6f5;
}
.btn-secondary:hover,
.btn-outline:hover {
    background: var(--bg-primary);
    border-color: var(--text-muted);
    color: var(--text-primary);
}
.btn-outline:hover{
    background: #e8f3ff;
    border-color: #d6e6f5;
}
.btn-secondary:hover{
    background: #e8f3ff;
    border-color: #d6e6f5;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-glass);
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }

.btn-danger,
.btn-rose {
    background: #EF4444;
    color: #FFFFFF;
    border-color: #EF4444;
}
.btn-danger{
    background: #fff1f2;
    color: #be123c;
    border-color: transparent;
}
.btn-danger:hover,
.btn-rose:hover { background: #DC2626; border-color: #DC2626; }

.btn-emerald {
    background: var(--status-success-bg);
    color: var(--status-success-text);
    border-color: var(--status-success-border);
}
.btn-emerald:hover { background: #D1FAE5; }

.btn-edit {
    background: rgba(0, 102, 255, 0.1);
    color: #0066FF;
    border-color: rgba(0, 102, 255, 0.2);
}
.btn-edit:hover { background: rgba(0, 102, 255, 0.2); }

.btn-sm {
    min-height: 32px; padding: 0 12px;
    font-size: 12px;
    border-radius: 8px; }
.btn-lg { min-height: var(--control-height-lg); padding: 0 28px; font-size: 14px; border-radius: var(--radius-md); }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: var(--radius-sm); }
.btn-icon.btn-sm { width: 28px; height: 28px; }
.btn-block { width: 100%; }

/* ══════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════ */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
    display: block;
    font-size: 12px;
    font-weight: var(--font-weight-body);
    color: #17324d;
    margin-bottom: 6px;
    text-transform: none;
    letter-spacing: normal;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    font-weight: var(--font-weight-body);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    outline: none;
}
.form-input, .form-select { min-height: var(--control-height-md); }
.form-input{
    min-height: 40px;
    border: 1px solid #d6e6f5;
    border-radius: 12px;
    background-color: #fff;
    color: #17324d;
    font-size: 14px;
    box-shadow: none;
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent-blue);
    background: rgba(79,142,247,0.07);
    box-shadow: 0 0 0 3px rgba(79,142,247,0.13);
}
.form-select:focus{
    border-color: #0066ff;
    box-shadow: 0 0 0 2px #0066ff1a;
}
.form-input:focus{
    border-color: #0066ff;
    box-shadow: 0 0 0 2px #0066ff1a;
}
.form-input.error { border-color: var(--accent-rose); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-select {cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b97b5' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    background-color: #fff;
    border: 1px solid #d6e6f5;
    box-shadow: none;
    font-weight: var(--font-weight-body);
    min-height: 40px;
    border-radius: 12px;
    color: #17324d;
    font-size: 14px;
}
.form-select:hover {
    border-color: rgba(79,142,247,0.5);
    background-color: rgba(79,142,247,0.03);
}
.form-select option { background: var(--bg-card); color: var(--text-primary); font-weight: var(--font-weight-body); }

/* Search input */
.search-input-wrap { position: relative; }
.search-input-wrap .search-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); pointer-events: none;
}
.search-input-wrap .form-input { padding-left: 38px; }

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    user-select: none;
}
.checkbox-label input[type="checkbox"] { display: none; }
.checkbox-custom {
    width: 17px; height: 17px;
    border: 1.5px solid var(--border-light);
    border-radius: 4px;
    background: var(--bg-input);
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.checkbox-label input:checked + .checkbox-custom {
    background: var(--gradient-blue);
    border-color: transparent;
}
.checkbox-label input:checked + .checkbox-custom::after {
    content: '';
    width: 9px; height: 5px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translateY(-1px);
}
.checkbox-label:hover .checkbox-custom { border-color: var(--accent-blue); }

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    min-width: 40px;
    height: 22px;
    flex-shrink: 0;
    cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
    position: absolute; inset: 0;
    background: var(--border-glass);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-glass);
    transition: all var(--transition-fast);
}
.toggle-track::before {
    content: '';
    position: absolute;
    left: 2px; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all var(--transition-normal);
}
.toggle-switch input:checked + .toggle-track { background: var(--gradient-blue); border-color: transparent; }
.toggle-switch input:checked + .toggle-track::before { left: 20px; background: #fff; }

/* ══════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: var(--font-weight-body);
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
    text-align: center;
}
.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-blue,
.badge-info    { background: var(--status-info-bg); color: var(--status-info-text); border: 1px solid var(--status-info-border); }
.badge-ice     { background: #E0F2FE; color: var(--accent-cyan-text); border: 1px solid #BAE6FD; }
.badge-purple  { background: #f5f3ff; color: #6d28d9; border: 1px solid #ede9fe; }
.badge-emerald,
.badge-green,
.badge-success { background: var(--status-success-bg); color: var(--status-success-text); border: 1px solid var(--status-success-border); }
.badge-amber,
.badge-warning { background: var(--status-warning-bg); color: var(--status-warning-text); border: 1px solid var(--status-warning-border); }
.badge-rose,
.badge-red,
.badge-danger  { background: var(--status-danger-bg); color: var(--status-danger-text); border: 1px solid var(--status-danger-border); }
.badge-cyan    { background: #ecfeff; color: #0e7490; border: 1px solid #cffafe; }
.badge-gray,
.badge-secondary,
.badge-default { background: var(--status-neutral-bg); color: var(--status-neutral-text); border: 1px solid var(--status-neutral-border); }
.badge-locked  { background: var(--bg-secondary); color: var(--text-muted); border: 1px solid var(--border-glass); }

/* Icon backgrounds */
.icon-bg-blue    { background: #E6F1FD;  color: var(--accent-blue); }
.icon-bg-purple  { background: rgba(157,110,247,0.12); color: var(--accent-purple); }
.icon-bg-emerald { background: #ecfdf5;  color: var(--accent-emerald); }
.icon-bg-amber   { background: rgba(245,158,11,0.12);  color: var(--accent-amber); }
.icon-bg-rose    { background: rgba(251,92,122,0.12);  color: var(--accent-rose); }
.icon-bg-cyan    { background: rgba(34,211,238,0.12);  color: var(--accent-cyan); }

/* ══════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-family: var(--font-sans) !important;
}
.table th {
    padding: 12px 18px;
    text-align: left;
    font-size: 12px;
    font-weight: var(--font-weight-heading);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: rgba(255,255,255,0.025);
    border-bottom: 1px solid var(--border-glass);
    white-space: nowrap;
    font-family: var(--font-sans) !important;
}
.table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-primary);
    vertical-align: middle;
    font-family: var(--font-sans) !important;
}
.table tbody tr { transition: background var(--transition-fast); }
.table tbody tr:hover { background: var(--bg-hover); }
.table tbody tr:last-child td { border-bottom: none; }
.table .clickable { cursor: pointer; }
.table .cell-muted { color: var(--text-muted); font-family: var(--font-sans) !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.action-btns { display: flex; gap: 5px; }

/* Employee directory: keep management columns stable regardless of unusually long imported values. */
.employee-table-wrap { overflow-x: auto; max-width: 100%; }
.employee-table {
    min-width: 1040px;
    width: 100%;
    table-layout: fixed;
}
.employee-table th,
.employee-table td {
    padding: 12px 8px;
    overflow: hidden;
    vertical-align: middle;
}
.employee-table .employee-col-select { width: 44px; }
.employee-table .employee-col-id { width: 130px; }
.employee-table .employee-col-name { width: 58%; min-width: 270px; }
.employee-table .employee-col-department { width: 42%; min-width: 230px; }
.employee-table .employee-col-type { width: 135px; }
.employee-table .employee-col-status { width: 115px; }
.employee-table .employee-col-actions { width: 140px; }
.employee-table td[data-label="Phòng ban"] { font-weight: var(--font-weight-body); }
.employee-table .cell-truncate,
.employee-table td:nth-child(3) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.status-indicator-active {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: var(--font-weight-body);
    color: #15803d;
    white-space: nowrap;
}
.status-dot-active {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: none;
    flex-shrink: 0;
}
.cell-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.employee-table .cell-user {
    min-width: 0;
    overflow: visible;
    flex-wrap: nowrap;
}
.employee-table .cell-name {
    color: var(--primary-blue, #0066FF);
    min-width: 0;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    overflow: visible;
    line-height: 1.3;
}
.employee-table .action-btns {
    flex-wrap: nowrap;
    gap: 4px;
}

/* ══════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.25);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal-overlay.show .modal { transform: scale(1) translateY(0); }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-normal);
    box-shadow: var(--shadow-popover);
}
.modal.sm  { max-width: 420px; }
.modal.lg  { max-width: 780px; }
.modal.xl  { max-width: 980px; }

.modal-header {display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-glass);
    border-color: #e7f1fb;
    background: #fff;
}
.modal-title {
    font-size: 16px;
    font-weight: var(--font-weight-heading);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.modal-title i { color: var(--accent-blue); flex-shrink: 0; }
.modal-close {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }

.modal-body { padding: 24px; }
.modal-footer {padding: 16px 24px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-color: #e7f1fb;
    background: #fff;
}

/* Course editing must keep its actions reachable even when the employee list
   needs more vertical space than a laptop viewport provides. */
.course-editor-modal {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);
    overflow: hidden;
}
.course-editor-modal .modal-header,
.course-editor-modal .modal-footer {
    flex: 0 0 auto;
}
.course-editor-modal .modal-body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.course-assignment-panel {
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    background: var(--bg-glass);
}
.course-employment-types {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    background: var(--bg-glass);
}
.course-employment-types .course-assignment-item:nth-child(odd) {
    border-right: 1px solid var(--border-glass);
}
@media (max-width: 600px) {
    .course-employment-types { grid-template-columns: 1fr; }
    .course-employment-types .course-assignment-item:nth-child(odd) { border-right: 0; }
}
.course-assignment-placeholder {
    margin: 0;
    padding: 12px;
    color: var(--text-muted);
    font-size: 13px;
}
.course-assignment-list {
    max-height: 180px;
    overflow-y: auto;
}
.course-assignment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-glass);
    cursor: pointer;
}
.course-assignment-item:last-child { border-bottom: 0; }
.course-assignment-item:hover { background: var(--bg-hover); }
.course-assignment-item small { color: var(--text-muted); }
.course-assignment-item input { flex: 0 0 auto; width: 18px; height: 18px; accent-color: var(--accent-blue); }

@media (max-height: 720px) {
    .course-editor-modal .modal-header { padding: 14px 20px; }
    .course-editor-modal .modal-body { padding: 16px 20px; }
    .course-editor-modal .modal-footer { padding: 12px 20px; }
    .course-editor-modal .form-group { margin-bottom: 12px; }
}

/* ══════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    bottom: 28px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

/* Keep validation feedback away from the inline question score controls. */
body:has(#page-test-detail.active) .toast-container {
    top: 16px;
    bottom: auto;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: var(--font-weight-body);
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-popover);
    min-width: 260px;
    max-width: 380px;
    pointer-events: all;
    animation: slideInRight 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.toast.hide { animation: slideOutRight 0.25s ease forwards; }
.toast i { font-size: 16px; flex-shrink: 0; }
.toast.success { border-left: 3px solid var(--accent-emerald); }
.toast.success i { color: var(--accent-emerald); }
.toast.error   { border-left: 3px solid var(--accent-rose); }
.toast.error i { color: var(--accent-rose); }
.toast.warning { border-left: 3px solid var(--accent-amber); }
.toast.warning i { color: var(--accent-amber); }
.toast.info    { border-left: 3px solid var(--accent-blue); }
.toast.info i  { color: var(--accent-blue); }

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

/* ══════════════════════════════════════════════════
   NOTIFICATION PANEL
   ══════════════════════════════════════════════════ */
.notif-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 340px;
    background: #fff;
    border: 1px solid #e7f1fb;
    border-radius: 12px;
    box-shadow: 0 12px 36px #00000016;
    z-index: 500;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all var(--transition-normal);
}
.notif-panel.show { opacity: 1; visibility: visible; transform: translateY(0); }

.notif-panel-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: var(--font-weight-body);
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border-glass);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: rgba(79,142,247,0.04); }

/* ══════════════════════════════════════════════════
   PROGRESS BARS
   ══════════════════════════════════════════════════ */
.progress-bar {
    height: 5px;
    background: rgba(255,255,255,0.06);
    border-radius: var(--radius-full);
    overflow: hidden;
    flex: 1;
}
.progress-fill {
    height: 100%;
    background: var(--gradient-blue);
    border-radius: var(--radius-full);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-fill.emerald { background: var(--gradient-emerald); }
.progress-fill.amber   { background: var(--accent-amber); }
.progress-fill.rose    { background: var(--accent-rose); }

/* ══════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
    gap: 12px;
}
.empty-state i {
    font-size: 40px;
    opacity: 0.4;
    color: var(--text-muted);
}
.empty-state h4 { font-size: 16px; font-weight: var(--font-weight-heading); color: var(--text-secondary); }
.empty-state p  { font-size: 13px; }

/* ══════════════════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════════════════ */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
    padding: 16px 0;
}
.page-btn {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: var(--font-weight-body);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
}
.page-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.page-btn.active { background: var(--gradient-blue); color: #fff; border-color: transparent; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ══════════════════════════════════════════════════
   SIDEBAR & LAYOUT (shared)
   ══════════════════════════════════════════════════ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99;
}
.sidebar-overlay.show { display: block; }

/* ══════════════════════════════════════════════════
   MISC UTILITIES
   ══════════════════════════════════════════════════ */
.ui-tooltip {
    position: fixed;
    z-index: 12000;
    max-width: min(320px, calc(100vw - 24px));
    padding: 6px 9px;
    border-radius: var(--radius-md);
    background: var(--text-primary);
    color: #FFFFFF;
    box-shadow: none;
    font-size: 12px;
    font-weight: var(--font-weight-body);
    line-height: 1.4;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    pointer-events: none;
    opacity: 0;
    transform: translateY(2px);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.ui-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

/* Points input */
.points-input {
    width: 60px; padding: 5px 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 13px; text-align: center;
    outline: none;
}
.points-input:focus { border-color: var(--accent-blue); }

/* Section tabs */
.section-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 4px;
}
.section-tab {
    flex: 1;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: var(--font-weight-body);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: none;
    font-family: var(--font-sans);
    white-space: nowrap;
    text-align: center;
}
.section-tab:hover { color: var(--text-primary); }
.section-tab.active {
    background: var(--primary-blue, #0066FF);
    color: #fff;
}

/* Filter bar */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 0;
}

/* Divider */
.divider {
    height: 1px;
    background: var(--border-glass);
    margin: 16px 0;
}

/* Avatar */
.avatar {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    background: var(--gradient-blue);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    font-weight: var(--font-weight-body);
    color: #fff;
    flex-shrink: 0;
}
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }
.avatar.rounded { border-radius: 50%; }

/* Page sections */
.page { display: none; }
.page.active { display: block; animation: fadeUp 0.25s ease both; }

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

/* Skeleton loaders */
.skeleton {
    background: var(--bg-secondary);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── RESPONSIVE ── */

@media (min-width: 769px) {
    .hide-desktop { display: none !important; }
}

/* Touch devices include tablets wider than the phone breakpoint. Keep shared
   controls comfortably operable without changing mouse/desktop density. */
@media (hover: none) and (pointer: coarse) {
    button,
    .btn,
    [role="button"],
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
    select {
        min-height: 44px;
    }
select{
    min-height: 40px;
    border: 1px solid #d6e6f5;
    border-radius: 12px;
    background-color: #fff;
    color: #17324d;
    font-size: 14px;
    box-shadow: none;
}

    button,
    .btn,
    [role="button"] {
        min-width: 44px;
    }
.btn{
    font-size: 14px;
    font-weight: var(--font-weight-body);
    border-radius: 12px;
    min-height: 40px;
    box-shadow: none;
    transform: none;
    line-height: 1.3;
}

    .btn-icon,
    .page-btn,
    .modal-close {
        min-width: 44px;
    }
}

/* ── MODAL RESPONSIVE ── */
@media (max-width: 767px) {
    input,
    select,
    textarea {
        font-size: 16px;
    }
select{
    min-height: 40px;
    border: 1px solid #d6e6f5;
    border-radius: 12px;
    background-color: #fff;
    color: #17324d;
    font-size: 14px;
    box-shadow: none;
}

    button,
    .btn,
    [role="button"] {
        min-height: 44px;
    }
.btn{
    font-size: 14px;
    font-weight: var(--font-weight-body);
    border-radius: 12px;
    min-height: 40px;
    box-shadow: none;
    transform: none;
    line-height: 1.3;
}

    .table-wrap,
    .employee-table-wrap {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-overlay:not(:where(.global-search-overlay)) {
        padding: 12px !important;
        align-items: center !important;
        overflow: hidden !important;
    }
    .modal:not(:where(.global-search-modal)) {
        display: flex;
        flex-direction: column;
        max-height: calc(100dvh - 24px) !important;
        overflow: hidden !important;
        max-width: 100% !important;
        width: 100% !important;
        border-radius: 12px;
    }
    .modal.sm, .modal.lg, .modal.xl {
        max-width: 100% !important;
    }
    .modal-body {
        min-height: 0;
        padding: 16px !important;
        overflow-y: auto !important;
        overscroll-behavior: contain;
    }
    .modal-header,
    .modal-footer { flex: 0 0 auto; }
    .modal-header {padding: 14px 16px !important;
    border-color: #e7f1fb;
    background: #fff;
}
    .modal-footer {padding: 12px 16px !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    border-color: #e7f1fb;
    background: #fff;
}
    .modal-footer .btn { width: 100%; justify-content: center; }

    .modal [style*="grid-template-columns:1fr 1fr"],
    .modal [style*="grid-template-columns: 1fr 1fr"],
    .modal [style*="grid-template-columns:repeat(3"],
    .modal [style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr !important;
    }
}

/* ── TOAST RESPONSIVE ── */
@media (max-width: 767px) {
    .toast-container {
        bottom: 12px !important;
        right: 12px !important;
        left: 12px !important;
        width: auto !important;
        max-width: none !important;
    }
    .toast {
        max-width: 100% !important;
        min-width: 0 !important;
        width: 100%;
    }
}

/* ── EMPTY STATE RESPONSIVE ── */
@media (max-width: 480px) {
    .empty-state { padding: 24px 12px; }
    .empty-state i { font-size: 28px; }
    .empty-state h4 { font-size: 14px; }
    .empty-state p { font-size: 12px; }
}

/* ── NOTIFICATION PANEL RESPONSIVE ── */
@media (max-width: 767px) {
    .notif-panel {width: calc(100vw - 24px) !important;
        right: -8px !important;
    background: #fff;
    border: 1px solid #e7f1fb;
    border-radius: 12px;
    box-shadow: 0 12px 36px #00000016;
}
}
/* Localized date inputs keep a fixed Vietnamese display regardless of browser locale. */
.localized-date-field {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 100%;
    min-width: 0;
}

.localized-date-field > input.form-input,
.localized-date-field > input.maint-input {
    width: 100% !important;
    padding-right: 42px;
}

.localized-date-native-picker {
    position: absolute;
    right: 12px;
    top: 50%;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%);
}

.localized-date-picker-button {
    position: absolute;
    right: 8px;
    top: 50%;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transform: translateY(-50%);
}

.localized-date-picker-button:hover,
.localized-date-picker-button:focus-visible {
    color: var(--primary-blue, #0866ff);
    background: rgba(8, 102, 255, 0.08);
    outline: none;
}

/* Shared surfaces and navigation derived from the approved UI proposal. */
body.emp-portal-body { background:#f0f7ff;background-image:none;color:#17324d;font-size:14px }
h1 { letter-spacing:normal;font-weight:var(--font-weight-heading);color:#17324d }
h2 { letter-spacing:normal;font-weight:var(--font-weight-heading);color:#17324d }
h3 { letter-spacing:normal;font-weight:var(--font-weight-heading);color:#17324d }
.page-title { letter-spacing:normal;font-weight:var(--font-weight-heading);color:#17324d }
.page-title { font-size:20px;line-height:1.4 }
.header-left h1 { font-size:20px;line-height:1.4 }
.header-left h2 { font-size:20px;line-height:1.4 }
#maintenance-sidebar { background:#fff;border-right:1px solid #e7f1fb;box-shadow:none }
.nav-item::before { display:none }
.nav-item::after { display:none }
.sidebar-footer .user-info { display:grid;grid-template-columns:36px minmax(0,1fr);gap:8px;background:transparent;border:0;padding:0 }
.sidebar-footer .user-info-text { min-width:0 }
.sidebar-footer .user-info-text .name { font-size:14px;font-weight:var(--font-weight-heading);line-height:1.4 }
.sidebar-footer .user-info-text .role { font-size:12px;font-weight:var(--font-weight-body);color:#52677d;letter-spacing:normal }
.sidebar-footer .user-info>div:last-child:not(.user-info-text) { grid-column:2;margin-left:0 }
.sidebar-footer [data-action="logout"] { color:#be123c;background:#fff1f2 }
#maintenance-logout { color:#be123c;background:#fff1f2 }
.header { background:#fff;border-bottom:1px solid #e7f1fb;box-shadow:none }
.survey-card {
 background:#fff;border:1px solid #d6e6f5;border-radius:12px;box-shadow:none;
 }
.maintenance-panel {
 background:#fff;border:1px solid #d6e6f5;border-radius:12px;box-shadow:none;
 }
.panel {
 background:#fff;border:1px solid #d6e6f5;border-radius:12px;box-shadow:none;
 }
.card:hover { transform:none;box-shadow:none }
.survey-card:hover { transform:none;box-shadow:none }
.stats-grid .stat-card { background:transparent;border:0;border-radius:0;border-right:1px solid #d6e6f5;box-shadow:none;min-height:112px;padding:20px }
.emp-stats-row .stat-card { background:transparent;border:0;border-radius:0;border-right:1px solid #d6e6f5;box-shadow:none;min-height:112px;padding:20px }
.stats-grid .stat-card:last-child { border-right:0 }
.emp-stats-row .stat-card:last-child { border-right:0 }
.btn.btn-sm { min-height:32px;border-radius:8px;font-size:12px }
.btn-danger-outline { background:#fff1f2;color:#be123c;border-color:transparent }
.search-input { min-height:40px;border:1px solid #d6e6f5;border-radius:12px;background-color:#fff;color:#17324d;font-size:14px;box-shadow:none }
input::placeholder { color:#52677d;opacity:1 }
textarea::placeholder { color:#52677d;opacity:1 }
.form-footer-links .footer-link-item { display:inline-flex;align-items:center;min-height:32px }
table th { background:#f1f8ff;color:#52677d;font-size:12px;font-weight:var(--font-weight-body);text-transform:none;letter-spacing:normal }
table td { font-size:14px;border-color:#e8f3ff }
table tbody tr:hover { background:#f1f8ff }
.dropdown-menu { background:#fff;border:1px solid #e7f1fb;border-radius:12px;box-shadow:0 12px 36px #00000016 }
.checkbox-text { font-size:14px;color:#52677d;letter-spacing:normal }
.login-page .form-heading { font-size:20px }
#emp-topnav {box-shadow:none;border-color:#e7f1fb;
    background: var(--ice-header);
    background-image: var(--ice-header);
}
.emp-main .stat-icon { background:#eff6ff;color:#0066ff;border-color:transparent }
.sidebar .nav-item.active i {
    color: var(--primary-blue-hover);
}
.sidebar .nav-item.active { box-shadow:none;border:0 }

/* Color families distinguish dashboard metrics while the main surfaces stay white. */
.stat-card.stat-blue { --metric-bg:#edf6ff; --metric-ink:#0052cc; }
.stat-card.stat-purple { --metric-bg:#f3edff; --metric-ink:#6d28d9; }
.stat-card.stat-cyan { --metric-bg:#e6faff; --metric-ink:#0e7490; }
.stat-card.stat-amber { --metric-bg:#fff7e6; --metric-ink:#a65b00; }
.stat-card.stat-emerald { --metric-bg:#e9fbf3; --metric-ink:#047857; }
.stat-card.stat-rose { --metric-bg:#fff0f5; --metric-ink:#be123c; }
.stat-card[class*="stat-"] .stat-icon { background:var(--metric-bg,var(--primary-blue-light)); color:var(--metric-ink,var(--primary-blue)); border-color:transparent; }
.stats-grid .stat-card[class*="stat-"],.emp-stats-row .stat-card[class*="stat-"] { background:linear-gradient(160deg,#ffffff 35%,var(--metric-bg,#edf6ff)); }

/* Compact desktop controls still need full-size targets on touch screens.
   Keep this selector more specific than the compact variants in page styles. */
@media (hover: none) and (pointer: coarse) {
    .btn.btn-sm {
        min-width: 44px;
        min-height: 44px;
        height: auto;
    }
    .btn-icon.btn-sm {
        width: 44px;
        height: 44px;
    }
}
