/* =====================================================================
   EHS BASE — Design System
   Built on Bootstrap 5.3 · Inter Font · Custom Properties
   ===================================================================== */

/* ─── Tokens ────────────────────────────────────────────────────────── */
:root {
  --sidebar-w: 256px;
  --primary: #2563eb;
  --primary-light: #eff6ff;
  --primary-dark: #1d4ed8;
  --primary-500: #3b82f6;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --info: #0891b2;
  --info-light: #ecfeff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --ring: rgba(37,99,235,.15);
  --shadow-xs: 0 1px 2px rgba(15,23,42,.04);
  --shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 4px 12px rgba(15,23,42,.07);
  --shadow-lg: 0 10px 28px rgba(15,23,42,.09);
  --shadow-xl: 0 16px 48px rgba(15,23,42,.12);
  --shadow-primary: 0 4px 14px rgba(37,99,235,.25);
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;
  --ease: cubic-bezier(.4,0,.2,1);
  --fast: .15s ease;
  --base: .2s ease;
  --font-size-xs: .65rem;
  --font-size-sm: .8rem;

  /* Bootstrap overrides */
  --bs-primary: var(--primary);
  --bs-primary-rgb: 37,99,235;
  --bs-body-font-family: 'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  --bs-body-bg: var(--gray-50);
  --bs-body-color: var(--gray-700);
  --bs-border-radius: var(--radius);
  --bs-border-radius-sm: var(--radius-sm);
  --bs-border-radius-lg: var(--radius-lg);
  --bs-card-border-radius: var(--radius);
  --bs-card-cap-bg: var(--surface);
  --bs-card-cap-padding-x: 1.25rem;
  --bs-card-cap-padding-y: .85rem;
  --bs-card-body-padding: 1.25rem;
  --bs-table-cell-padding: .6rem .75rem;
  --bs-btn-border-radius: var(--radius-sm);
  --bs-btn-padding-x: .85rem;
  --bs-btn-padding-y: .4rem;
  --bs-btn-font-size: .83rem;
  --bs-btn-font-weight: 500;
  --bs-modal-border-radius: var(--radius);
  --bs-alert-border-radius: var(--radius-sm);
  --bs-focus-ring-color: var(--ring);
  --bs-focus-ring-width: 3px;
}

/* ─── Reset / Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { background: var(--gray-50); font-family: var(--bs-body-font-family); }
::selection { background: rgba(37,99,235,.14); color: var(--primary-dark); }
img { max-width: 100%; }

/* ─── Scrollbar ─────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ─── Wrapper ───────────────────────────────────────────────────────── */
.wrapper { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ─── Sidebar ───────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed; top: 0; left: 0; height: 100vh; z-index: 1040;
  display: flex; flex-direction: column;
  transition: transform var(--base);
}
.sidebar-brand {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .7rem; flex-shrink: 0;
}
.sidebar-brand .brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: .85rem; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37,99,235,.22);
  letter-spacing: -.02em;
}
.sidebar-brand .brand-text { font-weight: 700; font-size: 1rem; color: var(--gray-900); line-height: 1.3; }
.sidebar-brand .brand-text small { font-weight: 400; font-size: .65rem; color: var(--gray-400); display: block; margin-top: 1px; }
.sidebar-close { display: none; background: none; border: none; font-size: 1rem; color: var(--gray-400); cursor: pointer; padding: .3rem; margin-left: auto; border-radius: 6px; line-height: 1; }
.sidebar-close:hover { background: var(--gray-100); color: var(--gray-800); }

.sidebar-nav { padding: .5rem 0; flex: 1; overflow-y: auto; }
.sidebar-nav .nav-section {
  padding: .6rem 1.25rem .25rem; font-size: .62rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--gray-400);
}
.sidebar-nav .nav-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .5rem 1.25rem; color: var(--gray-500);
  text-decoration: none; font-size: .8rem; font-weight: 500;
  border-left: 3px solid transparent; position: relative;
  transition: all var(--fast);
}
.sidebar-nav .nav-item:hover { background: var(--gray-100); color: var(--gray-800); }
.sidebar-nav .nav-item.active { background: var(--primary-light); color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.sidebar-nav .nav-item .nav-icon { width: 18px; text-align: center; font-size: .95rem; flex-shrink: 0; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 1035; backdrop-filter: blur(2px); }
.sidebar-overlay.show { display: block; }

/* ─── Main Content ──────────────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

/* ─── Topbar ────────────────────────────────────────────────────────── */
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: .6rem 1.75rem; display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; min-height: 56px;
}
.topbar-left { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.topbar-left h5 { font-weight: 700; color: var(--gray-900); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; font-size: 1rem; letter-spacing: -.01em; }
.topbar-right { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.sidebar-toggle {
  display: none; background: none; border: none; font-size: 1.25rem;
  color: var(--gray-500); cursor: pointer; padding: .2rem;
  border-radius: var(--radius-sm); width: 34px; height: 34px;
  align-items: center; justify-content: center; transition: background var(--fast);
}
.sidebar-toggle:hover { background: var(--gray-100); color: var(--gray-800); }

/* ─── Breadcrumb ────────────────────────────────────────────────────── */
.app-breadcrumb {
  display: flex; align-items: center; gap: .35rem;
  font-size: .72rem; color: var(--gray-400); flex-wrap: wrap; margin-bottom: .1rem;
}
.app-breadcrumb a { color: var(--gray-500); text-decoration: none; transition: color var(--fast); }
.app-breadcrumb a:hover { color: var(--primary); }
.app-breadcrumb .bi-chevron-right { font-size: .6rem; opacity: .5; }
.app-breadcrumb .active { color: var(--gray-600); font-weight: 600; }

/* ─── User chip / Avatar / Dropdown ─────────────────────────────────── */
.topbar-right .badge { font-weight: 500; padding: .3rem .6rem; font-size: .68rem; }
.topbar-right .avatar { width: 32px; height: 32px; font-size: .78rem; }
.user-chip {
  display: flex; align-items: center; gap: .55rem;
  padding: .2rem .2rem .2rem .7rem;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer;
  transition: all var(--fast);
}
.user-chip:hover { border-color: var(--primary-500); box-shadow: var(--shadow-sm); }
.user-chip .user-meta { line-height: 1.15; text-align: right; }
.user-chip .user-meta .uname { font-size: .78rem; font-weight: 600; color: var(--gray-900); }
.user-chip .user-meta .urole { font-size: .62rem; color: var(--gray-400); }
.user-chip .bi-chevron-down { font-size: .65rem; color: var(--gray-400); }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; font-weight: 600; flex-shrink: 0;
  letter-spacing: .02em; user-select: none;
  box-shadow: var(--shadow-primary);
}
.avatar-sm { width: 30px; height: 30px; font-size: .72rem; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.05rem; }

.dropdown-menu-app {
  border: none; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: .35rem; margin-top: .5rem;
  min-width: 210px;
}
.dropdown-menu-app .dropdown-header { font-size: .62rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-400); padding: .45rem .7rem .2rem; }
.dropdown-menu-app .dropdown-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .5rem .7rem; border-radius: var(--radius-sm);
  font-size: .8rem; color: var(--gray-600); transition: all var(--fast);
}
.dropdown-menu-app .dropdown-item i { font-size: .95rem; opacity: .65; }
.dropdown-menu-app .dropdown-item:hover { background: var(--primary-light); color: var(--primary); }
.dropdown-menu-app .dropdown-item.text-danger:hover { background: var(--danger-light); color: var(--danger); }
.dropdown-menu-app .dropdown-divider { margin: .3rem 0; border-color: var(--border); }

/* ─── Page Content ──────────────────────────────────────────────────── */
.page-content { padding: 1.5rem 1.75rem; flex: 1; overflow-y: auto; min-height: 0; }
.page-header { margin-bottom: 1.25rem; }
.page-header h4 { font-weight: 700; color: var(--gray-900); margin: 0; font-size: 1.15rem; letter-spacing: -.015em; }
.page-header .text-muted { font-size: .78rem; margin-top: .15rem; color: var(--gray-400); }
.page-header h4 { font-size: 1.3rem; }
.page-header .page-subtitle { font-size: .82rem; color: var(--gray-400); margin-top: .1rem; }
.page-actions { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.page-actions .btn { display: inline-flex; align-items: center; gap: .35rem; }

/* ─── Cards ─────────────────────────────────────────────────────────── */
.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.card.border-0 { border: none; }
.card-header {
  font-weight: 600; color: var(--gray-800); font-size: .82rem;
  display: flex; align-items: center; gap: .45rem;
  border-bottom: 1px solid var(--border);
}
.card-header .card-header-icon { font-size: 1rem; color: var(--primary); }
.card-title-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px; margin-right: .5rem;
  background: var(--primary-light); color: var(--primary); font-size: .9rem; flex-shrink: 0;
}
.card-hover { transition: transform var(--base), box-shadow var(--base); }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }

/* ─── Stat Cards ────────────────────────────────────────────────────── */
.stat-card {
  border-radius: var(--radius); border: 1px solid var(--border);
  padding: 1.2rem; background: var(--surface);
  transition: all var(--base); position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; width: 3.5px; height: 100%;
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  border-radius: 0 2px 2px 0;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card .stat-icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; margin-bottom: .7rem;
}
.stat-card .stat-number { font-size: 1.55rem; font-weight: 700; color: var(--gray-900); line-height: 1.15; letter-spacing: -.02em; }
.stat-card .stat-label { font-size: .78rem; color: var(--gray-400); font-weight: 500; }
.stat-card small { font-size: .7rem; font-weight: 600; }

/* Soft background helpers */
.bg-soft-primary { background: var(--primary-light); color: var(--primary); }
.bg-soft-success { background: var(--success-light); color: var(--success); }
.bg-soft-warning { background: var(--warning-light); color: var(--warning); }
.bg-soft-danger { background: var(--danger-light); color: var(--danger); }
.bg-soft-info { background: var(--info-light); color: var(--info); }

/* ─── Tables ────────────────────────────────────────────────────────── */
.table { margin-bottom: 0; }
.table > thead th {
  font-size: .68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--gray-400);
  border-bottom: 2px solid var(--gray-200) !important;
  white-space: nowrap; padding: .7rem .75rem; background: var(--gray-50);
}
.table > tbody td {
  vertical-align: middle; padding: .6rem .75rem;
  font-size: .8rem; color: var(--gray-600);
  border-bottom: 1px solid var(--gray-100);
}
.table > tbody tr { transition: background var(--fast); }
.table > tbody tr:hover { background: rgba(37,99,235,.025); }
.table-actions { white-space: nowrap; text-align: right; }
.table .text-muted { color: var(--gray-400) !important; }

/* ─── DataTables ────────────────────────────────────────────────────── */
div.dataTables_wrapper { padding: 0 !important; }
div.dataTables_wrapper .dataTables_top {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .5rem; padding: .7rem 1rem 0;
}
div.dataTables_wrapper div.dataTables_length,
div.dataTables_wrapper div.dataTables_filter { margin-bottom: 0; padding: 0; }
div.dataTables_wrapper div.dataTables_filter {
  display: flex; align-items: center; justify-content: flex-end; gap: .35rem;
}
div.dataTables_wrapper div.dataTables_length label,
div.dataTables_wrapper div.dataTables_filter label {
  font-size: .78rem; font-weight: 500; color: var(--gray-400); margin-bottom: 0;
}
div.dataTables_wrapper div.dataTables_length select {
  display: inline-block; width: auto; vertical-align: middle;
  margin: 0 .3rem; padding: .25rem 1.6rem .25rem .55rem;
  font-size: .78rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .45rem center; background-size: .7rem;
  color: var(--gray-600); cursor: pointer;
  transition: border-color var(--fast), box-shadow var(--fast);
  -webkit-appearance: none; appearance: none;
}
div.dataTables_wrapper div.dataTables_length select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); outline: none; }
div.dataTables_wrapper div.dataTables_filter input {
  display: inline-block; vertical-align: middle; margin-left: .4rem;
  padding: .35rem .8rem .35rem 1.85rem; font-size: .78rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); outline: none;
  transition: border-color var(--fast), box-shadow var(--fast);
  width: 240px; max-width: 100%;
  background: var(--gray-50) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") no-repeat .6rem center;
}
div.dataTables_wrapper div.dataTables_filter input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); background-color: var(--surface); }
div.dataTables_wrapper div.dataTables_filter input::placeholder { color: var(--gray-400); font-size: .78rem; }

div.dataTables_wrapper .dataTables_bottom {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .5rem; padding: 0 1rem .7rem;
}
div.dataTables_wrapper div.dataTables_info { font-size: .78rem; color: var(--gray-400); padding: 0; }
div.dataTables_wrapper div.dataTables_paginate { padding: 0; }

.dataTables_wrapper .dataTables_paginate .pagination { margin: 0; gap: 3px; }
.dataTables_wrapper .dataTables_paginate .pagination .page-item .page-link {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .3rem .65rem; font-size: .78rem; font-weight: 500;
  color: var(--gray-600); background: var(--surface);
  transition: all var(--fast); line-height: 1.4; text-decoration: none;
}
.dataTables_wrapper .dataTables_paginate .pagination .page-item .page-link:hover {
  background: var(--primary-light); border-color: var(--primary); color: var(--primary);
}
.dataTables_wrapper .dataTables_paginate .pagination .page-item.active .page-link {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 2px 6px rgba(37,99,235,.22);
}
.dataTables_wrapper .dataTables_paginate .pagination .page-item.disabled .page-link {
  color: var(--gray-300); background: var(--gray-50); border-color: var(--gray-100);
}
.dataTables_wrapper .dataTables_paginate .pagination .page-item .page-link i { font-size: .6rem; vertical-align: 1px; }

div.dataTables_wrapper table.dataTable { border-collapse: collapse !important; width: 100% !important; margin: 0 !important; background-color: var(--surface); }
div.dataTables_wrapper table.dataTable thead th {
  position: relative; padding-right: 1.4rem !important;
  font-weight: 600; font-size: .7rem; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: .03em;
  border-bottom: 2px solid var(--gray-200) !important; white-space: nowrap;
}
div.dataTables_wrapper table.dataTable thead th.sorting,
div.dataTables_wrapper table.dataTable thead th.sorting_asc,
div.dataTables_wrapper table.dataTable thead th.sorting_desc { cursor: pointer; }
div.dataTables_wrapper table.dataTable thead th.sorting:after,
div.dataTables_wrapper table.dataTable thead th.sorting_asc:after,
div.dataTables_wrapper table.dataTable thead th.sorting_desc:after {
  content: ''; position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
}
div.dataTables_wrapper table.dataTable thead th.sorting:after { border-bottom: 4px solid var(--gray-300); opacity: .4; top: calc(50% - 3px); }
div.dataTables_wrapper table.dataTable thead th.sorting_asc:after { border-bottom: 5px solid var(--primary); }
div.dataTables_wrapper table.dataTable thead th.sorting_desc:after { border-top: 5px solid var(--primary); }
div.dataTables_wrapper table.dataTable thead th.text-end.sorting:after,
div.dataTables_wrapper table.dataTable thead th.text-end.sorting_asc:after,
div.dataTables_wrapper table.dataTable thead th.text-end.sorting_desc:after,
div.dataTables_wrapper table.dataTable thead th.text-end:after { display: none; }
div.dataTables_wrapper table.dataTable tbody td {
  font-size: .78rem; color: var(--gray-600); vertical-align: middle;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
div.dataTables_wrapper table.dataTable tbody td.fw-medium { white-space: nowrap; }
div.dataTables_wrapper table.dataTable tbody td.text-end { max-width: none; white-space: nowrap; }
div.dataTables_wrapper table.dataTable tbody td small {
  display: block; font-size: .72rem; color: var(--gray-400);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px;
}
div.dataTables_wrapper table.dataTable tbody td > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
div.dataTables_wrapper table.dataTable tbody tr { transition: background-color var(--fast); }
div.dataTables_wrapper div.dataTables_empty { text-align: center; padding: 2.5rem 1rem; color: var(--gray-400); font-size: .8rem; }

.card-body.p-0 > .dataTables_wrapper { margin: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card-body.p-0 > .dataTables_wrapper .dataTables_top { padding-top: .7rem; }
.card-body.p-0 > .dataTables_wrapper .dataTables_bottom { padding-bottom: .7rem; }

/* ─── Forms ─────────────────────────────────────────────────────────── */
.form-label { font-weight: 500; font-size: .78rem; color: var(--gray-600); margin-bottom: .3rem; }
.form-control, .form-select {
  font-size: .85rem; border-color: var(--border);
  transition: border-color var(--fast), box-shadow var(--fast);
}
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.form-control::placeholder { color: var(--gray-400); font-size: .8rem; }
.detail-table td { padding: .5rem .75rem; }
.detail-table th { font-weight: 500; color: var(--gray-400); font-size: .78rem; }

/* ─── Definition Rows (dl-grid) ─────────────────────────────────────── */
.dl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .2rem 1.25rem; }
.dl-row { display: flex; flex-direction: column; gap: .1rem; padding: .6rem 0; border-bottom: 1px dashed var(--border); }
.dl-row:last-child { border-bottom: none; }
.dl-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-400); font-weight: 600; }
.dl-value { font-size: .85rem; color: var(--gray-900); font-weight: 500; }
.dl-value.text-muted { color: var(--gray-400) !important; font-weight: 400; }

/* ─── Buttons ───────────────────────────────────────────────────────── */
.btn { transition: all var(--fast); }
.btn:active { transform: scale(.97); }
.btn-sm { --bs-btn-padding-x: .5rem; --bs-btn-padding-y: .28rem; --bs-btn-font-size: .76rem; }
.btn-outline-primary:hover, .btn-outline-secondary:hover, .btn-outline-success:hover, .btn-outline-danger:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn i, .btn .bi { vertical-align: -1px; }

.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); }
.btn-icon.btn-sm { width: 28px; height: 28px; font-size: .76rem; }
.btn-soft { border: none; background: var(--primary-light); color: var(--primary); font-weight: 500; transition: all var(--fast); }
.btn-soft:hover { background: #dbeafe; color: var(--primary-dark); }
.btn-soft-secondary { background: var(--gray-100); color: var(--gray-600); }
.btn-soft-secondary:hover { background: var(--gray-200); color: var(--gray-900); }
.btn-soft-danger { background: var(--danger-light); color: var(--danger); }
.btn-soft-danger:hover { background: #fee2e2; color: #b91c1c; }
.btn-soft-success { background: var(--success-light); color: var(--success); }
.btn-soft-success:hover { background: #dcfce7; color: #15803d; }
.btn-soft-warning { background: var(--warning-light); color: var(--warning); }
.btn-soft-warning:hover { background: #fef3c7; color: #b45309; }

/* ─── Badges ────────────────────────────────────────────────────────── */
.badge { font-weight: 500; letter-spacing: .01em; padding: .28rem .5rem; font-size: .68rem; }
.badge.bg-light.text-dark { background: var(--gray-100) !important; color: var(--gray-600) !important; border: 1px solid var(--gray-200); }
.badge.fs-6 { font-size: var(--bs-body-font-size) !important; padding: .3rem .7rem; }
.badge-risk-low { background: var(--success-light); color: var(--success); border: 1px solid #bbf7d0; }
.badge-risk-medium { background: var(--warning-light); color: var(--warning); border: 1px solid #fde68a; }
.badge-risk-high { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.badge-risk-critical { background: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; }

/* ─── Alerts ────────────────────────────────────────────────────────── */
.alert { border: none; border-radius: var(--radius-sm); }
.alert-dismissible .btn-close { padding: 1rem; }

/* ─── Modals ────────────────────────────────────────────────────────── */
.modal-content { border: none; box-shadow: var(--shadow-xl); border-radius: var(--radius-lg); }
.modal-header { border-bottom-color: var(--gray-100); }
.modal-footer { border-top-color: var(--gray-100); }

/* ─── Footer ────────────────────────────────────────────────────────── */
footer {
  background: var(--surface); border-top: 1px solid var(--border);
  padding: .65rem 1.75rem; font-size: .72rem; color: var(--gray-400); flex-shrink: 0;
}

/* ─── Empty State ───────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: .7rem; opacity: .15; color: var(--gray-400); }
.empty-state .empty-illustration {
  width: 80px; height: 80px; margin: 0 auto 1rem; border-radius: 20px;
  display: flex; align-items: center; justify-content: center; font-size: 2.2rem;
  background: linear-gradient(135deg, rgba(37,99,235,.1), rgba(30,64,175,.06));
  color: var(--primary); position: relative;
}
.empty-state .empty-illustration::after {
  content: ''; position: absolute; inset: -7px; border-radius: 26px;
  border: 2px dashed var(--primary); opacity: .12;
}
.empty-state h5 { color: var(--gray-800); margin-bottom: .35rem; font-weight: 600; font-size: .95rem; }
.empty-state p { color: var(--gray-400); font-size: .8rem; max-width: 340px; margin: 0 auto 1.1rem; }

/* ─── Wizard ────────────────────────────────────────────────────────── */
.wizard-progress { display: flex; justify-content: space-between; position: relative; margin-bottom: 2.25rem; padding: 0 .75rem; }
.wizard-progress::before {
  content: ''; position: absolute; top: 20px; left: 50px; right: 50px; height: 3px;
  background: var(--gray-200); z-index: 0; border-radius: 2px;
}
.wizard-step { text-align: center; position: relative; z-index: 1; cursor: pointer; flex: 1; }
.wizard-step .step-circle {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--gray-200); color: var(--gray-500);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; font-weight: 700; margin: 0 auto .5rem;
  transition: all var(--base); border: 3px solid var(--surface);
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.wizard-step.active .step-circle { background: var(--primary); color: #fff; box-shadow: 0 0 0 4px var(--ring), var(--shadow-primary); transform: scale(1.08); }
.wizard-step.completed .step-circle { background: var(--success); color: #fff; box-shadow: 0 2px 8px rgba(34,197,94,.2); }
.wizard-step .step-label { font-size: .68rem; color: var(--gray-400); font-weight: 500; max-width: 85px; margin: 0 auto; }
.wizard-step.active .step-label { color: var(--primary); font-weight: 700; }
.wizard-step.completed .step-label { color: var(--success); font-weight: 600; }
.wizard-body { position: relative; }
.wizard-panel { display: none; }
.wizard-panel.active { display: block; }
.wizard-footer { border-top: 1px solid var(--border); padding-top: 1.1rem; margin-top: 1.25rem; }
.wizard-footer .btn-prev, .wizard-footer .btn-next { padding: .5rem 1.3rem; font-weight: 600; border-radius: var(--radius-sm); }
.wizard-footer .btn-submit { padding: .6rem 1.75rem; font-weight: 700; font-size: .95rem; border-radius: var(--radius-sm); box-shadow: 0 4px 14px rgba(34,197,94,.25); }
.wizard-footer .btn-submit:hover { box-shadow: 0 6px 20px rgba(34,197,94,.35); transform: translateY(-1px); }

/* ─── Safety Modules ────────────────────────────────────────────────── */
.safety-module .row.yn-row { border-left: 3px solid transparent; transition: all var(--fast); padding: .3rem .45rem; border-radius: 0 4px 4px 0; }
.safety-module .row.yn-row:nth-child(odd) { background: var(--gray-50); border-left-color: var(--primary); }
.safety-module .row.yn-row:nth-child(even) { border-left-color: transparent; }
.safety-module .card { border-radius: var(--radius); overflow: hidden; }
.safety-module .card-body { padding: 1rem 1.2rem; }
.safety-module .section-badge { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .75rem; border-radius: 50%; flex-shrink: 0; }
.safety-module .item-number { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; border-radius: 4px; font-size: .65rem; font-weight: 600; margin-right: .35rem; }
.safety-module .special-field { background: linear-gradient(135deg, #f8f9fa, #e9ecef); border: 1px solid #dee2e6; border-radius: var(--radius-sm); padding: .85rem; margin-bottom: .65rem; }
.safety-module .ppe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: .4rem; }
.safety-module .ppe-grid .form-check { padding-left: 1.6rem; margin: 0; padding: .25rem 0; }
.safety-module .ppe-grid .form-check-label { font-size: .78rem; }
.safety-module .date-time-bar { background: linear-gradient(135deg, #e8f4fd, #dbeafe); border: 1px solid #bfdbfe; border-radius: var(--radius); padding: .85rem 1.1rem; margin-bottom: 1.25rem; }

/* ─── Employee Search ───────────────────────────────────────────────── */
.employee-search-wrapper { position: relative; }
.employee-search-results {
  position: absolute; z-index: 1050; max-height: 240px; overflow-y: auto;
  display: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md); width: 100%;
}
.employee-search-results.show { display: block; }
.employee-search-results .dropdown-item { white-space: normal; padding: .35rem .7rem; cursor: pointer; font-size: .78rem; }
.employee-search-results .dropdown-item:hover { background-color: var(--primary-light); }
.employee-search-selected .badge { font-size: .78rem; font-weight: 500; padding: .35rem .6rem; }

/* ─── Checkbox Grids ────────────────────────────────────────────────── */
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .3rem; }
.checkbox-grid .form-check { padding-left: 1.5rem; margin-bottom: 0; }
.checkbox-grid .form-check-label { font-size: .78rem; }

/* ─── Status Bar ────────────────────────────────────────────────────── */
.status-bar { display: flex; gap: .2rem; }
.status-bar .bar { flex: 1; height: 4px; border-radius: 2px; background: var(--gray-200); transition: background var(--base); }

/* ─── Timeline ──────────────────────────────────────────────────────── */
.timeline-dot { font-size: .4rem; vertical-align: .1em; }
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before { content: ''; position: absolute; left: .4rem; top: .35rem; bottom: .35rem; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 1.1rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item .timeline-dot {
  position: absolute; left: -1.5rem; top: .12rem; width: .85rem; height: .85rem;
  border-radius: 50%; background: var(--surface); border: 3px solid var(--primary); z-index: 1;
}
.timeline-item.done .timeline-dot { background: var(--success); border-color: var(--success); }
.timeline-item.current .timeline-dot { background: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.timeline-item .tl-title { font-weight: 600; font-size: .82rem; color: var(--gray-900); }
.timeline-item .tl-sub { font-size: .75rem; color: var(--gray-400); }

/* ─── Toolbar ───────────────────────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: .65rem; flex-wrap: wrap; padding: .8rem 1rem;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
  border-radius: var(--radius) var(--radius) 0 0;
}
.toolbar .toolbar-left, .toolbar .toolbar-right { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }

/* ─── Section Title ─────────────────────────────────────────────────── */
.section-title { display: flex; align-items: center; gap: .5rem; margin: 1.25rem 0 .85rem; font-size: .95rem; font-weight: 700; color: var(--gray-900); }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

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

/* ─── Toasts ────────────────────────────────────────────────────────── */
#toastContainer { position: fixed; top: .85rem; right: .85rem; z-index: 1090; display: flex; flex-direction: column; gap: .5rem; max-width: 340px; }
.app-toast {
  display: flex; align-items: flex-start; gap: .6rem;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--primary); border-radius: var(--radius-sm);
  padding: .75rem .85rem; box-shadow: var(--shadow-lg);
  font-size: .8rem; animation: toastIn .25s var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
.app-toast.leaving { animation: toastOut .25s var(--ease) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(16px); } }
.app-toast .toast-icon { font-size: 1.1rem; line-height: 1.35; }
.app-toast .toast-body { flex: 1; color: var(--gray-600); }
.app-toast .toast-body strong { color: var(--gray-900); display: block; margin-bottom: .05rem; font-size: .78rem; }
.app-toast.success { border-left-color: var(--success); }
.app-toast.success .toast-icon { color: var(--success); }
.app-toast.danger { border-left-color: var(--danger); }
.app-toast.danger .toast-icon { color: var(--danger); }
.app-toast.warning { border-left-color: var(--warning); }
.app-toast.warning .toast-icon { color: var(--warning); }
.app-toast .toast-close { background: none; border: none; color: var(--gray-400); cursor: pointer; font-size: .9rem; line-height: 1; }

/* ─── Skeleton Loader ───────────────────────────────────────────────── */
.skeleton { background: linear-gradient(90deg, #eef2f7 25%, #e2e8f0 37%, #eef2f7 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ─── Page Load Bar ─────────────────────────────────────────────────── */
#pageLoadBar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, #38bdf8, var(--primary), var(--primary-dark));
  z-index: 2000; box-shadow: 0 0 8px rgba(37,99,235,.5);
  transition: width .25s var(--ease), opacity .35s var(--ease);
  opacity: 0; pointer-events: none;
}
#pageLoadBar.active { opacity: 1; }

/* ─── Ripple ────────────────────────────────────────────────────────── */
.ripple {
  position: absolute; border-radius: 50%; transform: scale(0);
  background: rgba(255,255,255,.45); animation: rippleAnim .55s var(--ease); pointer-events: none;
}
@keyframes rippleAnim { to { transform: scale(2.5); opacity: 0; } }

/* ─── Text Helpers ──────────────────────────────────────────────────── */
.text-high { color: var(--gray-900); }
.text-mid { color: var(--gray-600); }
.text-low { color: var(--gray-400); }

/* ─── Login Page ────────────────────────────────────────────────────── */
.login-page { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.login-row { flex: 1; min-height: 0; }
.login-hero {
  background: linear-gradient(135deg, var(--gray-900) 0%, #1e293b 35%, #1e3a5f 65%, var(--primary) 100%);
  position: relative; overflow: hidden;
}
.login-hero::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(37,99,235,.22) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 20%, rgba(255,255,255,.04) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 85%, rgba(37,99,235,.08) 0%, transparent 45%);
  pointer-events: none;
}
.login-hero::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 38px, rgba(255,255,255,.015) 38px, rgba(255,255,255,.015) 39px),
    repeating-linear-gradient(90deg, transparent, transparent 38px, rgba(255,255,255,.015) 38px, rgba(255,255,255,.015) 39px);
  pointer-events: none;
}
.login-hero > * { position: relative; z-index: 1; }
.login-form-side { background: var(--gray-50); }
.login-mobile-brand { display: flex; align-items: center; gap: .65rem; padding: .7rem .85rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.login-mobile-brand .brand-icon { width: 38px; height: 38px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); border-radius: 9px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1rem; color: #fff; }
.login-hero-content { max-width: 380px; margin: 0 auto; }
.login-hero .hero-brand-icon { width: 60px; height: 60px; background: rgba(255,255,255,.12); border-radius: 15px; backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 800; color: #fff; }
.login-hero h2 { font-size: 1.5rem; letter-spacing: -.02em; }
.login-hero .feature-item { display: flex; align-items: center; gap: .65rem; }
.login-hero .feature-icon { width: 38px; height: 38px; background: rgba(255,255,255,.1); border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; font-size: 1.05rem; }
.login-hero .feature-text .title { font-weight: 600; font-size: .78rem; color: #fff; }
.login-hero .feature-text .subtitle { font-size: .65rem; opacity: .45; color: #fff; }
.login-wrapper { max-width: 380px; margin: 0 auto; }
.login-wrapper h4 { font-weight: 700; color: var(--gray-900); }
.login-wrapper .subtitle { font-size: .78rem; color: var(--gray-400); }
.login-wrapper .nav-tabs .nav-link { font-weight: 500; font-size: .78rem; }
.login-wrapper .nav-tabs .nav-link i { vertical-align: -1px; }

@media (max-width: 767.98px) {
  .login-page { background: var(--gray-50); }
  .login-form-side { background: var(--surface); }
}

/* ─── Animations ────────────────────────────────────────────────────── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.page-content > .page-header { animation: fadeUp .25s var(--ease) both; }

/* ─── Print ─────────────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, footer, .page-actions, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
  body { background: #fff !important; }
}

/* ─── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .page-content { padding: 1.15rem; }
  .topbar { padding: .5rem 1.15rem; }
  footer { padding: .6rem 1.15rem; }
}
@media (max-width: 767.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar-close { display: block; }
  .sidebar.show { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.12); }
  .sidebar.show ~ .sidebar-overlay, .sidebar-overlay.show { display: block; }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: inline-flex; }
  .page-content { padding: .85rem; }
  .topbar { padding: .45rem .85rem; min-height: 48px; }
  .topbar-left h5 { font-size: .88rem; max-width: 180px; }
  .stat-card { padding: .85rem; }
  .stat-card .stat-number { font-size: 1.25rem; }
  .stat-card .stat-icon { width: 34px; height: 34px; font-size: .9rem; margin-bottom: .45rem; }
  .empty-state { padding: 1.5rem .6rem; }
  .empty-state .empty-icon { font-size: 2rem; }
  footer { padding: .5rem .85rem; font-size: .68rem; }
  .checkbox-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  div.dataTables_wrapper .dataTables_top { flex-direction: column; align-items: stretch; }
  div.dataTables_wrapper div.dataTables_filter { text-align: left !important; }
  div.dataTables_wrapper div.dataTables_filter input { width: 100%; }
  div.dataTables_wrapper .dataTables_bottom { flex-direction: column; align-items: center; gap: .65rem; }
  div.dataTables_wrapper div.dataTables_info { text-align: center; order: 2; }
  div.dataTables_wrapper div.dataTables_paginate { order: 1; }
  div.dataTables_wrapper table.dataTable tbody td { max-width: 140px; }
}
@media (max-width: 575.98px) {
  .page-content { padding: .65rem; }
  .topbar { padding: .35rem .65rem; }
  .topbar-left h5 { font-size: .82rem; max-width: 150px; }
  .sidebar-toggle { font-size: 1.15rem; width: 30px; height: 30px; }
  .stat-card .stat-number { font-size: 1.1rem; }
  .stat-card .stat-label { font-size: .68rem; }
  .stat-card { padding: .65rem; }
  footer { padding: .4rem .65rem; font-size: .62rem; }
  .checkbox-grid { grid-template-columns: 1fr 1fr; }
}