:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17222d;
  background: #f3f6f9;
  font-synthesis: none;
  --brand: #0f4c81;
  --brand-dark: #0a365c;
  --border: #dce4ea;
  --muted: #667785;
  --surface: #ffffff;
  --danger: #b42318;
  --success: #027a48;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: 28px; }
h2 { margin-bottom: 0; font-size: 18px; }
small { display: block; color: var(--muted); }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top left, #dceffc, #f3f6f9 52%); }
.login-card { width: min(420px, 100%); padding: 34px; background: white; border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 24px 70px rgba(23,34,45,.12); }
.brand-mark, .sidebar-brand > span { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; background: var(--brand); color: white; font-weight: 800; }
.login-card h1 { margin: 18px 0 4px; }
.stack-form { display: grid; gap: 16px; }
.login-card form { margin: 26px 0 18px; }
label { display: grid; gap: 7px; color: #2f3e4a; font-weight: 650; font-size: 14px; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid #cbd7df; border-radius: 9px; background: white; color: #17222d; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,76,129,.12); }
.password-field { display: flex; border: 1px solid #cbd7df; border-radius: 9px; overflow: hidden; }
.password-field input { border: 0; border-radius: 0; }
.primary-button, .secondary-button { border-radius: 9px; padding: 10px 15px; font-weight: 700; border: 1px solid transparent; }
.primary-button { background: var(--brand); color: white; }
.primary-button:hover { background: var(--brand-dark); }
.secondary-button { background: white; color: #243642; border-color: #cbd7df; }
.text-button { border: 0; padding: 4px 6px; background: transparent; color: var(--brand); font-weight: 700; }
.icon-button { border: 0; background: transparent; font-size: 28px; color: var(--muted); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 20px 14px; background: #102c43; color: white; display: flex; flex-direction: column; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 24px; }
.sidebar-brand small { color: #a8c3d8; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a { color: #d7e6f2; text-decoration: none; padding: 11px 12px; border-radius: 9px; }
.sidebar nav a:hover, .sidebar nav a.active { background: rgba(255,255,255,.12); color: white; }
.sidebar-footer { margin-top: auto; padding: 14px 8px 6px; display: grid; gap: 7px; }
.sidebar-footer small { color: #a8c3d8; }
.sidebar-footer button { margin-top: 8px; }
.main-content { padding: 30px; min-width: 0; }
.page-header { margin-bottom: 22px; }
.page-header p { color: var(--muted); margin-bottom: 0; }
.page-header.split, .panel-header, .header-actions, .form-actions, .pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: 20px; margin-bottom: 20px; box-shadow: 0 5px 20px rgba(23,34,45,.04); }
.panel-header { margin-bottom: 18px; }
.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; margin-bottom: 20px; }
.kpi-card { background: white; border: 1px solid var(--border); border-radius: 13px; padding: 20px; }
.kpi-card span { color: var(--muted); }
.kpi-card strong { display: block; margin-top: 10px; font-size: 30px; color: var(--brand); }
.status-summary { display: grid; gap: 10px; max-width: 620px; }
.status-row, .compact-item { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 11px 0; border-bottom: 1px solid #edf1f4; }
.status { display: inline-flex; align-items: center; border-radius: 99px; padding: 4px 9px; font-size: 12px; font-weight: 800; white-space: nowrap; background: #e9eef2; color: #425563; }
.status-valid, .status-active, .status-valid_no_expiry { background: #dff6e9; color: #067647; }
.status-expiring_90 { background: #e0f2fe; color: #075985; }
.status-expiring_60 { background: #fff4cc; color: #8a5b00; }
.status-expiring_30 { background: #ffead5; color: #9a3412; }
.status-expired, .status-resigned { background: #fee4e2; color: #b42318; }
.status-not_trained, .status-draft { background: #eceff2; color: #475467; }
.status-waiting_certificate { background: #eee4ff; color: #6941c6; }
.filters-panel { display: grid; grid-template-columns: minmax(220px, 1.5fr) repeat(3,minmax(150px,1fr)) auto; gap: 10px; }
.table-panel { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 850px; }
th, td { padding: 13px 15px; text-align: left; border-bottom: 1px solid #e8edf1; vertical-align: top; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: #f8fafb; }
td small { margin-top: 3px; }
.clickable-row:hover { background: #f4f9fc; cursor: pointer; }
.pagination { padding: 14px 16px; }
.loading-card, .empty-state { padding: 28px; text-align: center; color: var(--muted); }
.profile-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 20px; }
.detail-list { display: grid; gap: 0; margin: 0; }
.detail-list > div { display: grid; grid-template-columns: 140px 1fr; padding: 10px 0; border-bottom: 1px solid #edf1f4; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 650; }
.compact-item > div { display: grid; gap: 4px; }
.actions-cell { white-space: nowrap; }
.actions-cell button { margin-right: 4px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; background: rgba(8,24,36,.62); }
.modal { width: min(560px,100%); max-height: calc(100vh - 40px); background: white; border-radius: 15px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 25px 90px rgba(0,0,0,.3); }
.modal-large { width: min(850px,100%); }
.modal-fullscreen { width: min(1200px,100%); height: calc(100vh - 40px); }
.modal-header { padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 20px; overflow: auto; }
.modal-fullscreen .modal-body { padding: 0; flex: 1; }
.pdf-frame { width: 100%; height: 100%; border: 0; }
.form-grid { display: grid; gap: 15px; }
.two-columns { grid-template-columns: 1fr 1fr; }
.form-actions { justify-content: flex-end; padding-top: 5px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; }
.checkbox-label input { width: auto; }
.notice { padding: 12px 14px; border-radius: 9px; background: #eef6fc; color: #174b70; font-size: 14px; }
.file-status { min-height: 20px; color: var(--muted); font-size: 14px; }
#toast-root { position: fixed; right: 20px; top: 20px; z-index: 2000; display: grid; gap: 10px; }
.toast { min-width: 270px; max-width: 430px; padding: 13px 16px; border-radius: 10px; color: white; background: #344054; box-shadow: 0 12px 35px rgba(0,0,0,.22); opacity: 0; transform: translateY(-8px); transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { background: #b42318; }
.toast-success { background: #027a48; }
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 82px 1fr; }
  .sidebar-brand div, .sidebar nav a { font-size: 0; }
  .sidebar nav a::first-letter { font-size: 18px; }
  .sidebar-footer strong, .sidebar-footer small { display: none; }
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .filters-panel { grid-template-columns: 1fr 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; flex-direction: row; align-items: center; padding: 10px; }
  .sidebar-brand { padding: 0; }
  .sidebar-brand > span { width: 40px; height: 40px; }
  .sidebar nav { display: flex; margin-left: auto; }
  .sidebar nav a { font-size: 0; }
  .sidebar-footer { margin: 0 0 0 5px; padding: 0; }
  .sidebar-footer .secondary-button { padding: 8px; font-size: 0; }
  .sidebar-footer .secondary-button::after { content: '↪'; font-size: 18px; }
  .main-content { padding: 18px 12px; }
  .kpi-grid, .filters-panel, .two-columns { grid-template-columns: 1fr; }
  .page-header.split { align-items: flex-start; flex-direction: column; }
  .header-actions { width: 100%; }
  .header-actions button { flex: 1; }
}

.alert-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.active-filter { background: var(--brand); color: white; border-color: var(--brand); }
