:root {
  --bg: #f7fbfa;
  --sidebar: #ffffff;
  --card: #ffffff;
  --card-2: #f2f8f7;
  --border: #dce9e7;
  --border-soft: #e9f1f0;
  --primary: #2f9d97;
  --accent: #1f858f;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text: #172b2f;
  --muted: #667b80;
  --shadow: 0 16px 36px rgba(23, 43, 47, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI Variable", "Segoe UI", "Aptos", "Helvetica Neue", sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(47, 157, 151, 0.12), transparent 34rem),
    var(--bg);
}

button,
input,
select { font: inherit; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(34, 199, 201, 0.28);
  outline-offset: 2px;
}

.hidden { display: none !important; }

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  width: min(420px, 100%);
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.login-card h2 { margin: 22px 0 8px; font-size: 24px; }
.login-card p { color: var(--muted); }
.login-brand { margin-bottom: 8px; }
.login-form { display: grid; gap: 12px; margin-top: 18px; }
.login-hint { margin: 16px 0 0; font-size: 13px; color: var(--muted); }

.login-form input,
.global-search input,
.inline-form input,
.inline-form select,
.form-block input,
.form-block select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #ffffff;
  color: var(--text);
  padding: 9px 11px;
  outline: none;
  font-weight: 520;
}

.login-form input::placeholder,
.global-search input::placeholder,
.inline-form input::placeholder,
.form-block input::placeholder { color: #718096; }

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.app-shell.locked {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 14px 10px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  box-shadow: 10px 0 30px rgba(23, 43, 47, 0.04);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 16px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  background: linear-gradient(135deg, #1aa8b0, #31c48d);
  color: #ffffff;
  font-weight: 750;
}

.brand h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 750;
  line-height: 1.1;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.nav { display: grid; gap: 14px; }
.nav-group p {
  margin: 0 8px 6px;
  color: #91a2a6;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.nav-item {
  width: 100%;
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  background: transparent;
  color: #5f7378;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  font-weight: 520;
}

.nav-item span {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--primary);
  display: grid;
  place-items: center;
}

.nav-item span svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

.nav-item:hover {
  background: rgba(47, 157, 151, 0.08);
  color: var(--text);
}

.nav-item.active {
  border-left-color: var(--primary);
  background: rgba(47, 157, 151, 0.12);
  color: #1f858f;
  font-weight: 680;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 520px) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar h2 {
  margin: 0;
  font-size: 27px;
  line-height: 1.15;
  font-weight: 720;
}

.subtle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.primary-btn,
.ghost-btn,
.action-btn,
.icon-btn {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 650;
  font-size: 13px;
}

.primary-btn {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(47, 157, 151, 0.16);
}
.primary-btn:hover { background: #278984; }
.ghost-btn,
.action-btn,
.icon-btn {
  border-color: var(--border);
  background: #ffffff;
  color: var(--text);
}
.ghost-btn:hover,
.action-btn:hover,
.icon-btn:hover { background: rgba(47, 157, 151, 0.08); }
.icon-btn { width: 38px; padding: 0; color: var(--warning); }

.action-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.action-btn {
  border-color: var(--border);
  background: #ffffff;
  color: var(--text);
}

.assign-pill {
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  border: 1px solid rgba(47, 157, 151, 0.22);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(47, 157, 151, 0.08);
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  text-align: left;
  white-space: normal;
}

.assign-pill:hover,
.assign-pill:focus-visible {
  border-color: rgba(47, 157, 151, 0.42);
  background: rgba(47, 157, 151, 0.14);
  outline: none;
}

.danger-btn {
  border-color: rgba(239, 68, 68, 0.24);
  background: #ffffff;
  color: #dc2626;
}

.danger-btn:hover {
  background: rgba(239, 68, 68, 0.07);
  color: #b91c1c;
}

.record-actions,
.module-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.record-actions {
  justify-content: flex-start;
  margin-top: 10px;
}

.profile-menu {
  position: relative;
}

.profile-menu summary {
  min-height: 36px;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--card);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.profile-menu summary::-webkit-details-marker { display: none; }
.profile-menu div {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 10;
  display: grid;
  gap: 8px;
  min-width: 180px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.stats-grid,
.section-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.section-stats-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stat,
.chart-card,
.view,
.panel-inner,
.module-card,
.mini-item,
.employee-card,
.request,
.alert,
.dept-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
}

.stat {
  min-height: 84px;
  padding: 12px 14px;
}

.clickable-card {
  position: relative;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.clickable-card::after {
  content: "Open";
  position: absolute;
  right: 14px;
  top: 12px;
  opacity: 0;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.clickable-card:hover,
.clickable-card:focus-visible {
  border-color: rgba(47, 157, 151, 0.34);
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(47, 157, 151, 0.11);
  transform: translateY(-2px);
}

.clickable-card:hover::after,
.clickable-card:focus-visible::after {
  opacity: 1;
  transform: translateX(2px);
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.stat-value {
  margin-top: 10px;
  font-size: 28px;
  line-height: 1;
  font-weight: 720;
  color: var(--text);
}

.stat-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.view { display: none; padding: 16px; }

.view.active { display: block; }

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 720;
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.chart-card {
  min-height: 240px;
  padding: 16px;
}

.chart-card.wide {
  grid-column: span 2;
}

.bar-chart {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 118px 1fr 42px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef7f6;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.bar-chart.compact .bar-fill {
  background: var(--accent);
}

.donut-wrap {
  display: grid;
  place-items: center;
  min-height: 150px;
}

.donut {
  width: 144px;
  height: 144px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) 0 62%, var(--success) 62% 82%, var(--warning) 82% 92%, var(--danger) 92% 100%);
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 28px;
  border-radius: 50%;
  background: var(--card);
}

.legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.line-chart svg {
  width: 100%;
  height: 160px;
}

.activity-item,
.alert-item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}

.activity-item:last-child,
.alert-item:last-child { border-bottom: 0; }
.dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--primary);
}
.alert-item .dot { background: var(--warning); }
.activity-item strong,
.alert-item strong { display: block; font-size: 13px; }
.activity-item p,
.alert-item p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel-inner { padding: 16px; background: #ffffff; }
.panel-wide { grid-column: 1 / -1; }

.org-shell {
  display: grid;
  gap: 16px;
}

.org-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(47, 157, 151, 0.12), rgba(255, 255, 255, 0.92) 48%),
    #ffffff;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.org-hero h3 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
}

.org-hero p:not(.eyebrow) {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.org-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.org-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.org-stat {
  min-height: 104px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
}

.org-stat span {
  display: block;
  color: #6b8085;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.org-stat strong {
  display: block;
  margin-top: 10px;
  color: var(--text);
  font-size: 26px;
  line-height: 1;
}

.org-stat p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.org-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.75fr);
  gap: 16px;
  align-items: start;
}

#view-org .org-layout {
  grid-template-columns: 1fr;
}

.org-main {
  min-width: 0;
}

.org-side {
  display: grid;
  gap: 16px;
}

.org-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
}

.org-table {
  min-width: 980px;
}

.org-table th:nth-child(1),
.org-table td:nth-child(1) { width: 46px; }
.org-table th:nth-child(4),
.org-table td:nth-child(4),
.org-table th:nth-child(5),
.org-table td:nth-child(5),
.org-table th:nth-child(6),
.org-table td:nth-child(6) { width: 96px; text-align: center; }
.org-table th:nth-child(8),
.org-table td:nth-child(8) { width: 154px; }

.metric-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 28px;
  border-radius: 999px;
  background: rgba(47, 157, 151, 0.1);
  color: var(--accent);
  font-weight: 760;
}

.permission-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 360px;
}

.permission-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid rgba(47, 157, 151, 0.2);
  border-radius: 999px;
  background: rgba(47, 157, 151, 0.08);
  color: var(--accent);
  font-size: 11px;
  font-weight: 680;
  white-space: nowrap;
}

.permission-pill.muted {
  border-color: var(--border);
  background: #f7fbfa;
  color: var(--muted);
}

.org-chip-list {
  display: grid;
  gap: 10px;
}

.org-chip-list.tall {
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
}

.org-chip-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
}

.org-chip-card:hover {
  border-color: rgba(47, 157, 151, 0.24);
  background: #f8fcfb;
}

.org-chip-card strong,
.org-chip-card span,
.org-chip-card small {
  display: block;
}

.org-chip-card strong {
  font-size: 14px;
  font-weight: 720;
}

.org-chip-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
}

.org-chip-card small {
  margin-top: 3px;
  color: #7d9094;
  font-size: 12px;
  line-height: 1.4;
}

.org-chip-card.compact {
  align-items: start;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 920px;
}

.form-block {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.helper-text {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.helper-text.success { color: #4ade80; }
.helper-text.error { color: #f87171; }

.module-grid,
.dept-grid,
.mini-list,
.stack { display: grid; gap: 10px; }

.module-grid,
.dept-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.module-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 78px;
  padding: 13px;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.module-card:hover,
.mini-item:hover,
.employee-card:hover,
.request:hover,
.alert:hover,
.dept-card:hover {
  border-color: rgba(47, 157, 151, 0.24);
  background: #f8fcfb;
  color: var(--text);
}

.stat:hover,
.chart-card:hover,
.panel-inner:hover,
.org-stat:hover,
.org-chip-card:hover {
  border-color: rgba(47, 157, 151, 0.22);
  background: #ffffff;
}

.dept-card:hover strong,
.dept-card:hover p,
.dept-card:hover .stat-label,
.module-card:hover strong,
.mini-item:hover strong,
.employee-card:hover strong,
.request:hover strong,
.alert:hover strong {
  color: inherit;
}

.module-card strong,
.mini-item strong,
.employee-card strong,
.request strong,
.alert strong {
  display: block;
  margin-bottom: 4px;
  font-weight: 680;
}

.module-card p,
.mini-item div,
.employee-card p,
.request p,
.alert p,
.dept-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.mini-item,
.employee-card,
.request,
.alert,
.dept-card { padding: 12px; }

.employee-head,
.request-head,
.alert-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
}

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.list-table {
  min-width: 1180px;
}

.module-list-table {
  min-width: 920px;
}

.module-grid > .table-wrap,
.module-grid > .table-pager,
.module-grid > .empty-row-wrap,
.stack > .table-wrap {
  grid-column: 1 / -1;
  width: 100%;
}

.list-table th:nth-child(1),
.list-table td:nth-child(1) { width: 46px; }
.list-table th:nth-child(2),
.list-table td:nth-child(2) { width: 104px; }
.list-table th:nth-child(4),
.list-table td:nth-child(4) { width: 104px; }
.list-table th:nth-child(5),
.list-table td:nth-child(5) { min-width: 210px; }
.list-table th:nth-child(9),
.list-table td:nth-child(9) { width: 96px; }
.list-table th:nth-child(10),
.list-table td:nth-child(10) { width: 62px; text-align: center; }
.list-table th:nth-child(11),
.list-table td:nth-child(11) { width: 136px; }

th,
td {
  padding: 8px 11px;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  line-height: 1.28;
  vertical-align: middle;
}

th {
  color: #6b8085;
  background: #f2f8f7;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

td {
  color: #24393d;
  font-weight: 520;
}

.list-table tbody tr:nth-child(odd),
.list-table tbody tr:nth-child(even) { background: transparent; }
.list-table tbody tr:hover { background: rgba(34, 199, 201, 0.055); }

.row-index {
  width: 44px;
  color: var(--primary);
  background: transparent;
  font-weight: 720;
  text-align: center;
}

.code-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(34, 199, 201, 0.09);
  color: #1f858f;
  font-weight: 680;
  font-size: 12px;
  letter-spacing: 0;
}

.muted-line {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 480;
}

.row-actions {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  white-space: nowrap;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.active-page {
  background: var(--primary);
  color: #04100f;
}

.pager-gap {
  color: var(--muted);
  padding: 0 4px;
}

.pager-size {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--card);
  color: var(--text);
  font-weight: 650;
}

.detail-form {
  margin-top: 16px;
}

.employee-detail-shell {
  display: grid;
  gap: 18px;
}

.employee-detail-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: none;
}

.profile-avatar {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(34, 199, 201, 0.24);
  border-radius: 18px;
  background: rgba(34, 199, 201, 0.12);
  color: var(--primary);
  font-size: 22px;
  font-weight: 760;
  letter-spacing: 0.04em;
}

.brand-logo {
  width: 38px;
  height: 38px;
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
}

.login-brand .brand-logo {
  width: 46px;
  height: 46px;
}

.employee-detail-hero h3 {
  margin: 4px 0 6px;
  font-size: 26px;
  font-weight: 720;
}

.employee-detail-hero p {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  color: var(--primary) !important;
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.employee-detail-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.detail-section {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
}

.detail-section:nth-child(1) { grid-column: 1 / -1; }

.section-title {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.section-title > span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(34, 199, 201, 0.1);
  color: var(--primary);
  font-weight: 720;
}

.section-title h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.section-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.field-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-grid label {
  display: grid;
  gap: 7px;
  color: #6b8085;
  font-size: 12px;
  font-weight: 720;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field-grid input,
.field-grid select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 560;
  text-transform: none;
  letter-spacing: normal;
}

.field-grid input::placeholder {
  color: #617c79;
  font-weight: 600;
}

.field-grid select {
  cursor: pointer;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--primary) 50%),
    linear-gradient(135deg, var(--primary) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 20px,
    calc(100% - 12px) 20px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 38px;
}

.detail-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #f7fbfa;
}

.detail-footer > div {
  display: flex;
  gap: 10px;
}

.record-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 8, 7, 0.72);
  backdrop-filter: blur(10px);
}

.record-modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

.record-modal-large {
  width: min(1080px, 100%);
  padding: 22px;
}

.record-modal-head,
.record-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.record-modal-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 720;
}

.record-modal-grid {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.record-modal-large .record-modal-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.record-modal-section {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
  padding: 14px 0 2px;
  border-top: 1px solid var(--border-soft);
}

.record-modal-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.record-modal-section strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 760;
}

.record-modal-section p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.record-modal-grid label {
  display: grid;
  gap: 7px;
  color: #6b8085;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.record-modal-grid input,
.record-modal-grid select,
.record-modal-grid textarea {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  padding: 9px 11px;
  outline: none;
}

.record-modal-grid textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}

.record-modal-grid select {
  cursor: pointer;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--primary) 50%),
    linear-gradient(135deg, var(--primary) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 12px) 18px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 38px;
}

.record-modal-actions {
  justify-content: flex-end;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f2f8f7;
  color: #6b8085;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

tr:last-child td { border-bottom: 0; }

.pill,
.badge,
.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  border: 1px solid transparent;
}

.pill.warning,
.status.stock,
.status.idle,
.badge.medium {
  border-color: rgba(245, 158, 11, 0.22);
  background: rgba(245, 158, 11, 0.07);
  color: #e6bd68;
}
.status.active,
.status.in-use,
.badge.low {
  border-color: rgba(47, 157, 151, 0.24);
  background: rgba(47, 157, 151, 0.1);
  color: var(--accent);
}
.status.service,
.status.blocked,
.badge.high {
  border-color: rgba(239, 68, 68, 0.24);
  background: rgba(239, 68, 68, 0.08);
  color: #f99a9a;
}
.status.retired,
.status.absent {
  border-color: rgba(128, 153, 150, 0.16);
  background: rgba(128, 153, 150, 0.08);
  color: #aebebb;
}

.dev-only { display: none; }

@media (max-width: 1260px) {
  .dashboard-grid,
  .stats-grid,
  .section-stats-grid,
  .org-stats-grid,
  .module-grid,
  .dept-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .org-layout { grid-template-columns: 1fr; }
  .chart-card.wide { grid-column: span 2; }
  .topbar { grid-template-columns: 1fr; }
  .topbar-actions { justify-content: flex-start; flex-wrap: wrap; }
}

@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { grid-template-columns: 1fr 1fr; gap: 12px; }
  .main { padding: 18px; }
  .content-grid,
  .org-stats-grid,
  .inline-form,
  .form-block { grid-template-columns: 1fr; }
  .org-hero {
    display: grid;
    align-items: start;
  }
  .org-actions { justify-content: flex-start; }
  .employee-detail-hero,
  .employee-detail-form,
  .record-modal-large .record-modal-grid,
  .field-grid,
  .field-grid.two-col {
    grid-template-columns: 1fr;
  }
  .hero-actions,
  .detail-footer {
    align-items: stretch;
    flex-direction: column;
  }
  .detail-footer > div {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .dashboard-grid,
  .stats-grid,
  .section-stats-grid,
  .org-stats-grid,
  .module-grid,
  .dept-grid,
  .nav,
  .quick-actions { grid-template-columns: 1fr; }
  .chart-card.wide { grid-column: span 1; }
  .topbar h2 { font-size: 24px; }
}

/* ─── Employee card grid ───────────────────────────────────────────────── */
.emp-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 1440px) { .emp-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .emp-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px)  { .emp-card-grid { grid-template-columns: 1fr; } }

.emp-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.emp-card:hover {
  border-color: rgba(47, 157, 151, 0.32);
  box-shadow: 0 6px 20px rgba(47, 157, 151, 0.1);
}

.emp-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.emp-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  background: rgba(34, 199, 201, 0.12);
  border: 1px solid rgba(34, 199, 201, 0.24);
  color: var(--primary);
  font-size: 15px;
  font-weight: 760;
  display: grid;
  place-items: center;
  letter-spacing: 0;
}

.emp-card-info strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.emp-card-info span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.emp-card-dept {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(47, 157, 151, 0.08);
  color: var(--accent);
  font-size: 11px;
  font-weight: 680;
}

.emp-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
  gap: 8px;
}

.emp-card-foot .row-actions { gap: 6px; }
.emp-card-foot .action-btn { padding: 5px 9px; font-size: 12px; min-height: 28px; }

.emp-card-empty {
  grid-column: 1 / -1;
  padding: 32px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 14px;
}

/* ─── Inline table pager ──────────────────────────────────────────────── */
.table-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid var(--border-soft);
  background: #f9fcfc;
  border-radius: 0 0 14px 14px;
  flex-wrap: wrap;
}

.table-pager .page-info {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.table-pager-btns {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.table-pager .action-btn {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
}

.table-pager .active-page {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* ─── Employee pagination bar ─────────────────────────────────────────── */
.emp-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0 0;
  flex-wrap: wrap;
}

.emp-pager .page-info {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.emp-pager-btns {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ─── Compact stat value ──────────────────────────────────────────────── */
.stat-value {
  margin-top: 6px;
  font-size: 24px;
}

.stat-meta {
  margin-top: 4px;
  font-size: 12px;
}

/* ─── Page header breadcrumb ──────────────────────────────────────────── */
.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.page-num-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ─── View toggle (List / Thumbnail) ─────────────────────────────────── */
.view-toggle {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.vtog-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}

.vtog-btn.active {
  background: rgba(47,157,151,0.12);
  color: var(--primary);
}

.vtog-btn:hover:not(.active) {
  background: rgba(47,157,151,0.06);
  color: var(--text);
}

/* ─── Page size select ────────────────────────────────────────────────── */
.page-size-select {
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 650;
  color: var(--text);
  background: #fff;
  cursor: pointer;
}

/* ─── Employee list-view table ────────────────────────────────────────── */
.emp-list-table {
  min-width: 900px;
}

.emp-list-name-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.emp-list-name-btn:hover { color: var(--primary); }

/* ─── Employee profile page ───────────────────────────────────────────── */
.profile-back-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.profile-back-actions { display: flex; gap: 8px; }

.profile-hero-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(47,157,151,0.08) 0%, #fff 60%);
  margin-bottom: 20px;
}

@media (max-width: 820px) { .profile-hero-card { grid-template-columns: auto 1fr; } }

.profile-hero-avatar {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: rgba(34,199,201,0.14);
  border: 2px solid rgba(34,199,201,0.28);
  color: var(--primary);
  font-size: 24px;
  font-weight: 780;
  display: grid;
  place-items: center;
  letter-spacing: 0;
}

.profile-hero-info h2 { margin: 0 0 4px; font-size: 22px; font-weight: 750; }
.profile-hero-info p { margin: 2px 0; color: var(--muted); font-size: 13px; }

.profile-hero-meta { text-align: right; }
.profile-hero-meta .status { margin-bottom: 12px; }

.profile-quick-stats {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.pqs-item {
  text-align: center;
  min-width: 56px;
}

.pqs-item strong {
  display: block;
  font-size: 18px;
  font-weight: 760;
  color: var(--text);
  line-height: 1.1;
}

.pqs-item span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─── Profile 2-column grid ───────────────────────────────────────────── */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 1100px) { .profile-grid { grid-template-columns: 1fr; } }

.profile-col-main { display: grid; gap: 16px; }
.profile-col-side { display: grid; gap: 16px; position: sticky; top: 16px; }

.profile-section-card {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}

.profile-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 750;
  color: var(--text);
  letter-spacing: -0.01em;
}

.profile-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.profile-field {
  display: grid;
  gap: 3px;
}

.profile-field label {
  font-size: 10.5px;
  font-weight: 750;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.profile-field span {
  font-size: 13px;
  font-weight: 560;
  color: var(--text);
}

/* ─── Profile assigned items rows ─────────────────────────────────────── */
.profile-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}

.profile-item-row:last-child { border-bottom: 0; }
.profile-item-row > span:nth-child(2) { flex: 1; font-size: 13px; color: var(--text); }

/* ─── Change log timeline ─────────────────────────────────────────────── */
.profile-log-list { display: grid; gap: 0; }

.log-entry {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}

.log-entry:last-child { border-bottom: 0; }

.log-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 4px;
  flex: 0 0 10px;
}

.log-dot.deleted { background: var(--danger); }
.log-dot.assigned { background: var(--success); }
.log-dot.unassigned { background: var(--warning); }

.log-body { display: grid; gap: 2px; }
.log-body strong { font-size: 12.5px; font-weight: 700; color: var(--text); text-transform: capitalize; }
.log-body span { font-size: 12px; color: var(--muted); }
.log-body time { font-size: 11px; color: #9ab0b4; }

/* ─── Profile in employees list (thumbnail card click area) ────────────── */
.emp-card-name-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--text);
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
  line-height: 1.2;
}
.emp-card-name-btn:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }

/* ─── Section tabs (Asset List / Change Log, Stock List / Change Log) ─── */
.section-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}

.stab {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 680;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: 8px 8px 0 0;
  transition: color 0.14s, border-color 0.14s;
}

.stab:hover { color: var(--text); }

.stab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(47,157,151,0.06);
}



