.card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.page-head-text { max-width: 70ch; color: var(--muted); font-size: 15px; }
.page-head-actions { display: flex; gap: 8px; }

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--selected);
  color: var(--primary-deep);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1;
}
.person-cell { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.person-text { display: grid; padding: 6px 0; line-height: 1.35; }

.tile-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 150px;
  padding: 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--tile);
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  transition: background-color var(--speed) var(--ease), border-color var(--speed) var(--ease),
    box-shadow var(--speed) var(--ease), transform var(--speed) var(--ease);
}
.tile:hover { border-color: var(--tile-border); background: var(--tile-hover); color: var(--ink); box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.tile:active { transform: none; }
.tile .icon, .tile-image { transition: transform var(--speed) var(--ease); }
.tile:hover .icon, .tile:hover .tile-image { transform: scale(1.06); }
.tile .icon { width: 44px; height: 44px; color: var(--accent); margin-bottom: 4px; }
.tile .icon > :last-child { stroke: var(--gold-ink); }
.tile-label { font-weight: 600; }
.tile-description { color: var(--muted); font-size: 12px; }
.tile .chip { background: var(--white); }
.tile-image { width: 44px; height: 44px; object-fit: contain; border-radius: var(--radius-sm); margin-bottom: 4px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}
.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.stat-card-header .icon { color: var(--muted); }
.stat-rows { display: grid; gap: 14px; padding: 14px 16px 16px; }
.stat-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: baseline; }
.stat-row dd { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.stat-note { padding: 0 16px 14px; }

.bar {
  grid-column: 1 / -1;
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 3px;
  background: var(--bar-track);
  appearance: none;
  --bar-fill: var(--bar-green);
}
.bar::-webkit-progress-bar { background: var(--bar-track); border-radius: 3px; }
.bar::-webkit-progress-value { background: var(--bar-fill); border-radius: 3px; }
.bar::-moz-progress-bar { background: var(--bar-fill); border-radius: 3px; }
.bar-purple { --bar-fill: var(--bar-purple); }
.bar-gold { --bar-fill: var(--bar-gold); }
.bar-green { --bar-fill: var(--bar-green); }

.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.chip-staff, .chip-active, .chip-role { background: var(--tile); color: var(--primary-deep); }
.chip-contractor, .chip-warn { background: var(--warn-soft); color: var(--gold-text); }
.chip-intern { background: var(--intern-soft); color: var(--intern-ink); }
.chip-disabled, .chip-danger { background: var(--danger-soft); color: var(--danger-text); }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}
.card .table-wrap { box-shadow: none; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.table th {
  height: 40px;
  padding: 0 16px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.table td { height: 48px; padding: 0 16px; border-top: 1px solid var(--border); }
.table tbody tr { transition: background-color var(--speed) var(--ease); }
.table tbody tr:hover { background: var(--row-hover); }
.table td a:not(.button) { color: var(--ink); font-weight: 600; text-decoration: none; }
.table td a:not(.button):hover { color: var(--primary-deep); text-decoration: underline; }
.table .num { text-align: right; }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; }

.side-panel {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}
.side-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 8px;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.side-panel-title .icon { width: 16px; height: 16px; }
.side-panel-list + .side-panel-title { margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.side-panel-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.side-panel-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
  transition: background-color var(--speed) var(--ease), color var(--speed) var(--ease);
}
.side-panel-list .icon { color: var(--accent); }
.side-panel-list a:hover { background: var(--panel); color: var(--ink); }
.side-panel-list a[aria-current] { background: var(--selected); color: var(--primary-deep); font-weight: 600; }

.modal {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  color: var(--ink);
}
.modal[open] { animation: modal-in 180ms var(--ease); }
.modal::backdrop { background: rgba(20, 34, 28, .42); backdrop-filter: blur(2px); }
.modal[open]::backdrop { animation: fade-in 180ms var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.modal-body { display: grid; gap: 12px; padding: 20px 24px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}
.icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background-color var(--speed) var(--ease);
}
.icon-button:hover { background: var(--panel); }

.empty-state { display: grid; justify-items: center; gap: 12px; padding: 40px 16px; text-align: center; }
.empty-state > .icon { width: 56px; height: 56px; padding: 14px; border-radius: 50%; background: var(--tile); color: var(--accent); }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--tile-border);
  border-radius: var(--radius-sm);
  background: var(--tile);
}
.alert[role="status"] { animation: rise-in 220ms var(--ease); }
.alert-warn { border-color: var(--warn-border); background: var(--warn-soft); color: var(--gold-text); }
.alert-danger { border-color: var(--danger-border); background: var(--danger-soft); color: var(--danger-text); }

.menu { position: relative; }
.menu > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 999px;
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  transition: background-color var(--speed) var(--ease);
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary > .icon:last-child { transition: transform var(--speed) var(--ease); }
.menu[open] > summary > .icon:last-child { transform: rotate(180deg); }
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 10;
  min-width: 200px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  box-shadow: var(--shadow-lift);
}
.menu[open] .menu-panel { animation: drop-in 140ms var(--ease); }
.menu-panel a, .menu-panel button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--speed) var(--ease);
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--panel); }

@media (max-width: 1023px) {
  .tile-grid, .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 599px) {
  .tile-grid, .stat-grid { grid-template-columns: 1fr; }
}
