:root {
  --navy: #0e192e;
  --blue: #275c8a;
  --page: #f0f5fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe4ee;
  --shadow: 0 1px 3px rgba(15, 23, 42, .13);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font: 14px/1.45 "Segoe UI", Arial, sans-serif; color: var(--text); background: var(--page); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
select { font: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 208px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--navy); color: #e8eef8; }
.brand { min-height: 70px; display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-size: 11px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; background: #183c6b; color: #6aa5ff; font-size: 21px; font-weight: 800; }
.nav-heading { margin: 22px 17px 7px; color: #8190aa; font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.nav-list { display: grid; gap: 4px; padding: 0 8px; }
.nav-list a { display: flex; gap: 11px; align-items: center; min-height: 37px; padding: 8px 12px; border-radius: 7px; font-size: 12px; font-weight: 600; }
.nav-list a:hover, .nav-list a.active { background: var(--blue); color: white; }
.user-panel { margin-top: auto; min-height: 56px; display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-top: 1px solid rgba(255,255,255,.1); }
.avatar { flex: 0 0 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #1d6399; font-weight: 700; }
.user-meta { min-width: 0; display: grid; flex: 1; }
.user-meta strong { overflow: hidden; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.user-meta small { color: #b8c5d8; font-size: 10px; }
.logout-button { border: 0; color: white; background: transparent; cursor: pointer; }

.content-shell { min-width: 0; }
.topbar { height: 40px; display: flex; align-items: center; justify-content: space-between; padding: 0 21px; border-bottom: 1px solid var(--line); background: white; font-size: 12px; }
.content { padding: 19px 21px 40px; }
.welcome h1 { margin: 0; font-size: 21px; }
.welcome p { margin: 1px 0 16px; color: var(--muted); font-size: 11px; }
h2 { margin: 0 0 9px; font-size: 13px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.status-badge { padding: 4px 8px; border: 1px solid #f0d998; border-radius: 999px; background: #fff9e8; color: #8b6508; font-size: 10px; }
.status-badge.connected { border-color: #b8d9c9; background: #eefbf4; color: #14734b; font-weight: 700; }
.status-badge:hover { filter: brightness(.97); }

.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.stat-card { min-height: 65px; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); box-shadow: var(--shadow); }
.stat-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; font-size: 18px; background: #e4efff; }
.stat-icon.green { background: #d8f7e8; }.stat-icon.yellow { background: #fff1c9; }.stat-icon.red { background: #fde0e0; }.stat-icon.rose { background: #f5e1e5; }.stat-icon.amber { background: #fff2c9; }
.stat-card > span:last-child { min-width: 0; display: grid; }
.stat-card strong { font-size: 19px; line-height: 1.1; }
.stat-card small { margin-top: 4px; color: #48566b; font-size: 10px; }

.birthday-card { margin-top: 20px; padding: 17px 16px 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); box-shadow: var(--shadow); }
.birthday-columns { display: grid; grid-template-columns: 1fr 1fr; }
.birthday-column { min-height: 180px; padding-right: 18px; }
.birthday-column + .birthday-column { padding-right: 0; padding-left: 20px; border-left: 1px solid var(--line); }
.birthday-column h3 { margin: 0 0 10px; color: #164b81; font-size: 10px; }
.today-column h3 { color: #e06600; }
.birthday-person { min-height: 56px; display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-bottom: 1px dashed var(--line); }
.person-initial { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #ffeadb; color: #d95c00; font-weight: 700; }
.person-info { min-width: 0; display: grid; flex: 1; }
.person-info strong { font-size: 12px; }.person-info small { color: var(--muted); font-size: 10px; }
.birthday-message { color: #e06600; font-size: 10px; font-weight: 600; }
.birthday-date { display: grid; justify-items: center; gap: 2px; }
.birthday-date strong { padding: 4px 7px; border: 1px solid var(--line); border-radius: 5px; background: #f7faff; font-size: 10px; }
.birthday-date small { color: #00966d; font-size: 9px; }
.empty-state { margin: 13px 0; color: var(--muted); font-size: 11px; font-style: italic; }

.quick-access { margin-top: 20px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.quick-card { min-height: 65px; position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); box-shadow: var(--shadow); }
.quick-card > span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; background: #e7f2ff; font-size: 18px; }
.quick-card div { display: grid; }.quick-card strong { font-size: 12px; }.quick-card small { color: var(--muted); font-size: 10px; }
.quick-card em { position: absolute; top: 9px; right: 9px; padding: 2px 5px; border-radius: 4px; background: #fff4cf; color: #b08a21; font-size: 8px; font-style: normal; }
.quick-card.muted { opacity: .65; }

.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.page-heading h1 { margin: 0; font-size: 22px; }.page-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.readonly-badge { padding: 5px 9px; border: 1px solid #b8d9c9; border-radius: 999px; background: #eefbf4; color: #14734b; font-size: 10px; font-weight: 700; }
.month-picker { width: fit-content; display: flex; align-items: center; gap: 17px; margin: 0 auto 16px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 9px; background: white; box-shadow: var(--shadow); }
.month-picker a { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; color: var(--blue); background: #edf5ff; font-size: 22px; }
.month-picker strong { min-width: 125px; text-align: center; }
.attendance-alert { padding: 14px 16px; border: 1px solid #efc8c8; border-radius: 9px; background: #fff1f1; color: #9f2626; }
.attendance-summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 11px; }
.attendance-summary article { min-height: 82px; display: grid; grid-template-columns: 32px 1fr; align-content: center; column-gap: 7px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: white; box-shadow: var(--shadow); }
.attendance-summary article > span { grid-row: 1 / 3; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: #edf5ff; }
.attendance-summary strong { font-size: 19px; line-height: 1.1; }.attendance-summary small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.attendance-panel { margin-top: 16px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: var(--shadow); overflow: hidden; }
.attendance-panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.attendance-panel-heading h2 { margin: 0; }.attendance-panel-heading p { margin: 2px 0 0; color: var(--muted); font-size: 10px; }
.cache-badge { padding: 3px 7px; border-radius: 999px; background: #eef2f7; color: var(--muted); font-size: 9px; }
.attendance-table-wrap { overflow-x: auto; }
.attendance-table { width: 100%; border-collapse: collapse; font-size: 11px; white-space: nowrap; }
.attendance-table th { padding: 10px 11px; background: #f5f8fc; color: #45556c; text-align: left; font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
.attendance-table td { padding: 10px 11px; border-top: 1px solid #edf1f5; }
.attendance-table tbody tr:hover { background: #f9fbfd; }
.attendance-status { display: inline-block; padding: 4px 7px; border-radius: 999px; background: #eef2f7; color: #475569; font-size: 9px; font-weight: 700; }
.status-du_cong, .status-da_duyet { background: #dcf7e9; color: #13734b; }.status-thieu_gio, .status-chi_1_lan_cham { background: #fff0cf; color: #916000; }.status-khong_du_lieu { background: #fee2e2; color: #a22a2a; }
.minute-warning { color: #c34d00; font-weight: 700; }.table-empty { height: 90px; color: var(--muted); text-align: center; }
.readonly-note { margin: 10px 2px 0; color: var(--muted); font-size: 10px; }

.directory-heading { margin-bottom: 12px; }
.directory-filters { display: flex; align-items: flex-end; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: var(--shadow); }
.directory-filters label { display: grid; gap: 5px; color: #42526a; font-size: 10px; font-weight: 700; }
.directory-filters .directory-search { flex: 1; }
.directory-filters input, .directory-filters select { min-height: 38px; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 7px; color: var(--text); background: white; outline: none; }
.directory-filters input:focus, .directory-filters select:focus { border-color: #4b83b5; box-shadow: 0 0 0 3px rgba(39, 92, 138, .12); }
.directory-filters select { min-width: 185px; }
.directory-filters button { min-height: 38px; padding: 8px 17px; border: 0; border-radius: 7px; color: white; background: var(--blue); font-weight: 700; cursor: pointer; }
.filter-reset { min-height: 38px; display: grid; place-items: center; padding: 8px 10px; color: var(--muted); font-size: 11px; }
.directory-result-row { display: flex; justify-content: space-between; margin: 13px 2px 9px; color: var(--muted); font-size: 10px; }
.directory-result-row strong { color: var(--text); font-size: 12px; }
.employee-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.employee-card { min-width: 0; min-height: 88px; display: flex; align-items: center; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: white; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.employee-card:hover { border-color: #8db2d5; transform: translateY(-1px); }
.employee-initial, .employee-profile-initial { flex: 0 0 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: #245b89; background: #e6f1fc; font-size: 16px; font-weight: 800; }
.employee-card-info { min-width: 0; display: grid; flex: 1; }
.employee-card-info strong, .employee-card-info small, .employee-card-info em { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.employee-card-info strong { font-size: 12px; }
.employee-card-info small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.employee-card-meta { min-width: 0; display: flex; align-items: center; gap: 5px; margin-top: 5px; }
.employee-card-info em { min-width: 0; flex: 1; color: #345d83; font-size: 9px; font-style: normal; }
.employee-state { flex: 0 0 auto; padding: 2px 5px; border-radius: 999px; font-size: 8px; font-weight: 700; }
.employee-state-active { color: #14734b; background: #dcf7e9; }.employee-state-inactive { color: #9f3232; background: #fee5e5; }
.employee-card-arrow { color: #8ca0b8; font-size: 22px; }
.directory-empty { grid-column: 1 / -1; min-height: 190px; display: grid; place-items: center; align-content: center; padding: 25px; border: 1px dashed #bdcad9; border-radius: 10px; color: var(--muted); background: rgba(255,255,255,.55); text-align: center; }
.directory-empty > span { font-size: 28px; }.directory-empty strong { margin-top: 8px; color: var(--text); }.directory-empty p { margin: 3px 0 0; font-size: 11px; }
.pagination { width: fit-content; display: flex; align-items: center; gap: 13px; margin: 18px auto 0; }
.pagination a, .pagination span { min-width: 72px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: white; text-align: center; font-size: 10px; }
.pagination .disabled { color: #a4afbd; background: #f3f6f9; }.pagination strong { font-size: 10px; }
.back-link { display: inline-block; margin-bottom: 12px; color: var(--blue); font-size: 11px; font-weight: 700; }
.employee-profile-card { max-width: 920px; border: 1px solid var(--line); border-radius: 11px; background: white; box-shadow: var(--shadow); overflow: hidden; }
.employee-profile-header { display: flex; align-items: center; gap: 14px; padding: 22px; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, #f7fbff, #edf5fc); }
.employee-profile-initial { flex-basis: 58px; height: 58px; font-size: 22px; }
.employee-profile-header > span:nth-child(2) { min-width: 0; flex: 1; }.employee-profile-header small { color: var(--blue); font-weight: 700; }.employee-profile-header h1 { margin: 2px 0 0; font-size: 22px; }.employee-profile-header p { margin: 2px 0 0; color: var(--muted); }
.employee-status-badge { padding: 5px 9px; border-radius: 999px; font-size: 9px; font-weight: 700; }
.employee-status-active { color: #14734b; background: #dcf7e9; }.employee-status-inactive { color: #9f3232; background: #fee5e5; }
.employee-profile-body { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; padding: 22px; }
.employee-profile-body h2 { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.profile-fields { display: grid; gap: 0; margin: 0; }
.profile-fields div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px dashed #e6ecf3; }
.profile-fields dt { color: var(--muted); font-size: 10px; }.profile-fields dd { margin: 0; font-size: 11px; font-weight: 600; }.profile-fields dd a { color: var(--blue); }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #0e192e, #225d90); }
.login-card { width: min(390px, 100%); padding: 34px; border-radius: 14px; background: white; box-shadow: 0 20px 55px rgba(0,0,0,.25); }
.login-logo { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 15px; border-radius: 12px; background: #183c6b; color: #6aa5ff; font-size: 27px; font-weight: 800; }
.login-card h1 { margin: 0; }.login-card > p { margin: 4px 0 24px; color: var(--muted); }
.login-card form { display: grid; gap: 8px; }.login-card label { margin-top: 5px; font-weight: 600; }
.login-card input { width: 100%; padding: 10px 11px; border: 1px solid #cbd5e1; border-radius: 7px; }
.login-card button { margin-top: 13px; padding: 11px; border: 0; border-radius: 7px; background: #275c8a; color: white; font-weight: 700; cursor: pointer; }
.form-error { margin-bottom: 12px; padding: 9px; border-radius: 6px; background: #fee2e2; color: #a51c1c; font-size: 12px; }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .attendance-summary { grid-template-columns: repeat(3, 1fr); }
  .employee-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }.nav-heading, .nav-list, .user-panel { display: none; }
  .brand { min-height: 54px; }.content { padding: 16px; }.topbar { padding: 0 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .birthday-columns { grid-template-columns: 1fr; }
  .birthday-column { min-height: 120px; padding-right: 0; }
  .birthday-column + .birthday-column { margin-top: 15px; padding: 15px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .quick-grid { grid-template-columns: 1fr; }
  .attendance-summary { grid-template-columns: repeat(2, 1fr); }.page-heading { flex-direction: column; }
  .directory-filters { align-items: stretch; flex-direction: column; }.directory-filters select { width: 100%; min-width: 0; }
  .employee-grid, .employee-profile-body { grid-template-columns: 1fr; }
  .employee-profile-header { align-items: flex-start; flex-wrap: wrap; }.employee-status-badge { margin-left: 72px; }
}
@media (max-width: 430px) {
  .stats-grid { grid-template-columns: 1fr; }.section-title-row { align-items: flex-start; flex-direction: column; }
  .employee-grid { grid-template-columns: 1fr; }.profile-fields div { grid-template-columns: 1fr; gap: 3px; }
}
