/* ==========================================================================
   HTMS Phase 2 — Shared Components
   Page toolbars, filter bars, enterprise tables, drawers, modals, tabs,
   toggles, Iqama lookup, empty states — all built on the Phase 1 tokens.
   ========================================================================== */

/* ---- Page toolbar (title + actions), lighter variant of page-hero ---- */
.page-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-5);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}
.page-toolbar-text h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.page-toolbar-text .toolbar-subtitle {
  font-size: 13px;
  color: var(--text-tertiary);
  max-width: 560px;
  line-height: 1.5;
}
.page-toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---- Breadcrumb link back ---- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: var(--sp-3);
  transition: color var(--dur-fast) var(--ease);
}
.back-link:hover { color: var(--accent-600); }
.back-link i { font-size: 11px; }

/* ---- Toolbar / filter bar panel ---- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
  box-shadow: var(--shadow-xs);
}
.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  flex: 1;
  min-width: 220px;
  max-width: 380px;
  transition: border-color var(--dur-fast) var(--ease);
}
.search-field:focus-within { border-color: var(--accent-400); background: var(--surface-card); }
.search-field i { color: var(--text-tertiary); font-size: 13px; }
.search-field input {
  border: none; outline: none; background: transparent;
  font-size: 13px; color: var(--text-primary); width: 100%;
}
.search-field input::placeholder { color: var(--text-tertiary); }

.filter-bar-divider { width: 1px; height: 24px; background: var(--border-subtle); }
.filter-bar .filter-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-bar select.filter-select {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--dur-fast) var(--ease);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%238891a1' d='M0 0h10L5 6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 26px;
  cursor: pointer;
}
.filter-bar select.filter-select:hover { border-color: var(--border-strong); }
.filter-bar select.filter-select:focus { border-color: var(--accent-400); }
.filter-bar-results { margin-left: auto; font-size: 12px; color: var(--text-tertiary); font-weight: 500; white-space: nowrap; }

/* ---- Enterprise data table wrapper (list pages) ---- */
.table-panel {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.table-panel .table-scroll { overflow-x: auto; }
.enterprise-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 900px; }
.enterprise-table thead th {
  position: sticky; top: 0;
  background: var(--surface-muted);
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  padding: 12px var(--sp-4);
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
  z-index: 2;
}
.enterprise-table thead th.sortable { cursor: pointer; user-select: none; }
.enterprise-table thead th.sortable:hover { color: var(--text-secondary); }
.enterprise-table thead th .sort-icon { font-size: 9px; margin-left: 4px; opacity: 0.5; }
.enterprise-table thead th.sort-active .sort-icon { opacity: 1; color: var(--accent-600); }
.enterprise-table tbody td {
  padding: 12px var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
  white-space: nowrap;
}
.enterprise-table tbody tr { transition: background var(--dur-fast) var(--ease); cursor: pointer; }
.enterprise-table tbody tr:hover { background: var(--surface-muted); }
.enterprise-table tbody tr:last-child td { border-bottom: none; }
.enterprise-table tbody td.no-click { cursor: default; }

.cell-person { display: flex; align-items: center; gap: 10px; }
.cell-person .person-name { font-weight: 600; color: var(--text-primary); font-size: 13px; }
.cell-person .person-sub { font-size: 11.5px; color: var(--text-tertiary); margin-top: 1px; }
.person-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-50);
  color: var(--accent-600);
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700;
  flex-shrink: 0;
  border: 1px solid var(--accent-100);
}
.person-avatar.lg { width: 68px; height: 68px; font-size: 22px; border-width: 2px; }
.person-avatar.md { width: 44px; height: 44px; font-size: 15px; }

.mono-id { font-family: 'SF Mono', 'Consolas', monospace; font-size: 12px; color: var(--text-secondary); }

/* Row actions menu */
.row-actions { position: relative; }
.row-actions-btn {
  width: 30px; height: 30px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
  border: 1px solid transparent;
  transition: all var(--dur-fast) var(--ease);
}
.row-actions-btn:hover { background: var(--surface-hover); color: var(--text-primary); border-color: var(--border-subtle); }
.row-actions-menu {
  position: absolute;
  right: 0; top: calc(100% + 4px);
  min-width: 180px;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-2);
  z-index: 50;
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.row-actions-menu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.row-actions-menu .ra-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 7px;
  font-size: 12.5px; font-weight: 500; color: var(--text-secondary);
  white-space: nowrap;
}
.row-actions-menu .ra-item i { width: 14px; text-align: center; color: var(--text-tertiary); font-size: 12px; }
.row-actions-menu .ra-item:hover { background: var(--surface-hover); color: var(--text-primary); }
.row-actions-menu .ra-item:hover i { color: var(--accent-600); }
.row-actions-menu .ra-item.danger:hover { background: var(--red-50); color: var(--red-600); }
.row-actions-menu .ra-item.danger:hover i { color: var(--red-600); }
.row-actions-menu .ra-divider { height: 1px; background: var(--border-subtle); margin: 4px 2px; }

/* ---- Pagination ---- */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4);
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.pagination-info { font-size: 12.5px; color: var(--text-tertiary); }
.pagination-controls { display: flex; align-items: center; gap: 4px; }
.page-btn {
  min-width: 30px; height: 30px;
  padding: 0 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--surface-card);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  transition: all var(--dur-fast) var(--ease);
}
.page-btn:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--border-strong); }
.page-btn.active { background: var(--accent-500); color: #fff; border-color: var(--accent-600); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Empty / no-results states ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  gap: var(--sp-3);
}
.empty-state .empty-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--text-tertiary);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  border: 1px solid var(--border-subtle);
}
.empty-state .empty-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.empty-state .empty-text { font-size: 13px; color: var(--text-tertiary); max-width: 340px; line-height: 1.5; }

/* ==========================================================================
   MODAL (centered) — used for Reflect to Register, confirmations
   ========================================================================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 15, 26, 0.5);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-5);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-base) var(--ease);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-box {
  width: 100%; max-width: 520px;
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-default);
  overflow: hidden;
  transform: translateY(-10px) scale(0.98);
  transition: transform var(--dur-base) var(--ease);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.modal-overlay.open .modal-box { transform: translateY(0) scale(1); }
.modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: var(--sp-5); border-bottom: 1px solid var(--border-subtle);
  gap: var(--sp-3); flex-shrink: 0;
}
.modal-header .modal-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.modal-header .modal-subtitle { font-size: 12.5px; color: var(--text-tertiary); margin-top: 3px; }
.modal-close-btn {
  width: 30px; height: 30px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary); flex-shrink: 0;
  transition: all var(--dur-fast) var(--ease);
}
.modal-close-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
.modal-body { padding: var(--sp-5); overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border-subtle);
  flex-shrink: 0; background: var(--surface-muted);
}

/* Reflect summary rows inside modal */
.reflect-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.reflect-stat {
  background: var(--surface-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
}
.reflect-stat .rs-label { font-size: 11px; color: var(--text-tertiary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.reflect-stat .rs-value { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--text-primary); margin-top: 4px; }
.reflect-stat.accent .rs-value { color: var(--accent-600); }
.reflect-stat.emerald .rs-value { color: var(--emerald-600); }
.reflect-stat.amber .rs-value { color: var(--amber-600); }
.reflect-meta-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: var(--sp-4); }
.reflect-meta-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; padding: 4px 0; }
.reflect-meta-row .rm-label { color: var(--text-tertiary); font-weight: 500; }
.reflect-meta-row .rm-value { color: var(--text-primary); font-weight: 600; }
.reflect-note {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--amber-50); color: var(--amber-700);
  border: 1px solid var(--amber-100);
  border-radius: var(--radius-md);
  padding: var(--sp-3);
  font-size: 12.5px;
  line-height: 1.5;
}
.reflect-note i { margin-top: 1px; }
.reflect-success {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--sp-3); padding: var(--sp-4) 0;
}
.reflect-success .success-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--emerald-50); color: var(--emerald-600);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.reflect-success .success-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.reflect-success .success-text { font-size: 13px; color: var(--text-tertiary); max-width: 360px; line-height: 1.5; }

/* ==========================================================================
   DRAWER (right side) — used for Add Employee, attendee quick-add
   ========================================================================== */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 15, 26, 0.45);
  z-index: 110;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-base) var(--ease);
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 440px; max-width: 92vw;
  background: var(--surface-card);
  box-shadow: -8px 0 30px rgba(16,24,40,0.14);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--dur-base) var(--ease);
  z-index: 111;
}
.drawer-overlay.open .drawer-panel { transform: translateX(0); }
.drawer-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: var(--sp-5); border-bottom: 1px solid var(--border-subtle); flex-shrink: 0;
  gap: var(--sp-3);
}
.drawer-header .drawer-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.drawer-header .drawer-subtitle { font-size: 12.5px; color: var(--text-tertiary); margin-top: 3px; }
.drawer-body { padding: var(--sp-5); overflow-y: auto; flex: 1; }
.drawer-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border-subtle);
  flex-shrink: 0; background: var(--surface-muted);
}

/* ---- Form fields (shared) ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.form-grid.single { grid-template-columns: 1fr; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field.span-2 { grid-column: 1 / -1; }
.form-field label {
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
}
.form-field label .req { color: var(--red-500); margin-left: 2px; }
.form-field input, .form-field select, .form-field textarea {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--surface-card);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  width: 100%;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--accent-400);
  box-shadow: 0 0 0 3px var(--accent-50);
}
.form-field textarea { resize: vertical; min-height: 72px; font-family: inherit; }
.form-hint { font-size: 11.5px; color: var(--text-tertiary); }
.form-error { font-size: 11.5px; color: var(--red-600); }

/* ==========================================================================
   IQAMA LOOKUP COMPONENT
   ========================================================================== */
.iqama-lookup-box {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  background: var(--surface-muted);
}
.iqama-input-row { display: flex; gap: 8px; }
.iqama-input-row input {
  flex: 1;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 14px;
  letter-spacing: 0.02em;
  font-family: 'SF Mono', 'Consolas', monospace;
  background: var(--surface-card);
}
.iqama-input-row input:focus { outline: none; border-color: var(--accent-400); box-shadow: 0 0 0 3px var(--accent-50); }
.iqama-input-row .btn { flex-shrink: 0; }

.iqama-result { margin-top: var(--sp-3); }

.iqama-result-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--emerald-50);
  border: 1px solid var(--emerald-100);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  animation: htms-fade-in 0.25s ease;
}
.iqama-result-card .irc-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--surface-card); color: var(--emerald-600);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; flex-shrink: 0;
  border: 1.5px solid var(--emerald-100);
}
.iqama-result-card .irc-info { flex: 1; min-width: 0; }
.iqama-result-card .irc-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.iqama-result-card .irc-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.iqama-result-card .irc-bp { font-size: 11.5px; color: var(--emerald-700); font-weight: 600; margin-top: 3px; }
.iqama-result-card .irc-check { color: var(--emerald-600); font-size: 18px; flex-shrink: 0; }
.iqama-found-message { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--emerald-700); font-weight: 600; margin-top: 8px; }

.iqama-not-found {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--red-50); border: 1px solid var(--red-100);
  border-radius: var(--radius-md); padding: var(--sp-3) var(--sp-4);
  animation: htms-fade-in 0.25s ease;
}
.iqama-not-found i { color: var(--red-500); font-size: 16px; margin-top: 1px; flex-shrink: 0; }
.iqama-not-found .inf-text { font-size: 13px; color: var(--red-700); font-weight: 600; flex: 1; }
.iqama-not-found .inf-sub { font-size: 12px; color: var(--red-600); font-weight: 400; margin-top: 2px; }

.iqama-loading {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-tertiary); font-size: 12.5px; font-weight: 600;
  padding: var(--sp-3) var(--sp-4);
}
.spinner-sm {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent-500);
  animation: htms-spin 0.65s linear infinite;
}
@keyframes htms-spin { to { transform: rotate(360deg); } }
@keyframes htms-fade-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }

/* ==========================================================================
   TOGGLE SWITCH — Reflect in Register Yes/No
   ========================================================================== */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 42px; height: 24px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
  flex-shrink: 0;
  border: none;
  padding: 0;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: transform var(--dur-fast) var(--ease);
}
.toggle-switch.on { background: var(--emerald-500); }
.toggle-switch.on::after { transform: translateX(18px); }
.toggle-label-pair { display: flex; align-items: center; gap: 8px; }
.toggle-label-pair .tl-text { font-size: 12px; font-weight: 600; color: var(--text-tertiary); }
.toggle-label-pair.is-on .tl-text { color: var(--emerald-600); }

/* ==========================================================================
   TABS — Employee Profile
   ========================================================================== */
.tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--sp-5);
  overflow-x: auto;
}
.tab-btn {
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  transition: all var(--dur-fast) var(--ease);
  white-space: nowrap;
  background: transparent;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent-600); border-color: var(--accent-500); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: htms-fade-in 0.2s ease; }

/* ==========================================================================
   SUMMARY / STAT CARDS (compact) — Employee Profile
   ========================================================================== */
.stat-card-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.stat-card-sm {
  min-width: 0;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-xs);
}
.stat-card-sm .sc-icon {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent-50); color: var(--accent-600);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; margin-bottom: var(--sp-3);
}
.stat-card-sm .sc-value { font-family: var(--font-display); font-size: 21px; font-weight: 700; color: var(--text-primary); }
.stat-card-sm .sc-label { font-size: 11.5px; color: var(--text-tertiary); font-weight: 600; margin-top: 3px; }

/* ==========================================================================
   TRAINING HISTORY TIMELINE — Employee Profile
   ========================================================================== */
.history-timeline { display: flex; flex-direction: column; }
.history-item {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: var(--sp-4);
  align-items: center;
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}
.history-item:last-child { border-bottom: none; }
.history-date { font-size: 12.5px; font-weight: 700; color: var(--text-secondary); }
.history-date .hd-year { display: block; font-size: 11px; color: var(--text-tertiary); font-weight: 500; margin-top: 1px; }
.history-main .hm-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.history-main .hm-meta { font-size: 12px; color: var(--text-tertiary); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
.history-main .hm-meta span { display: inline-flex; align-items: center; gap: 4px; }
.history-right { display: flex; align-items: center; gap: 10px; }

/* ==========================================================================
   DOCUMENTS GRID — Employee Profile
   ========================================================================== */
.doc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
.doc-card {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--sp-3);
  background: var(--surface-muted);
}
.doc-card .doc-icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--accent-50); color: var(--accent-600);
  display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0;
}
.doc-card .doc-name { font-size: 12.5px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-card .doc-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }

/* ==========================================================================
   ATTENDEE GRID — Create/Edit Attendance Sheet
   ========================================================================== */
.attendee-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4);
}
.attendee-add-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.summary-bar {
  display: flex; align-items: center; gap: var(--sp-5);
  background: var(--accent-ink);
  background: linear-gradient(90deg, var(--navy-900), var(--navy-800));
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
  color: #fff;
}
.summary-stat { display: flex; flex-direction: column; gap: 2px; }
.summary-stat .ss-value { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: #fff; }
.summary-stat .ss-label { font-size: 11.5px; color: var(--navy-text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.summary-stat.emerald .ss-value { color: #4ade95; }
.summary-stat.amber .ss-value { color: #f0b656; }
.summary-bar-spacer { flex: 1; }
.summary-bar .btn { flex-shrink: 0; }

.attendee-table td, .attendee-table th { white-space: nowrap; }
.attendee-table .cell-num { color: var(--text-tertiary); font-weight: 600; font-size: 12px; }
.attendee-table input.inline-edit {
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-primary);
  width: 100%;
  transition: all var(--dur-fast) var(--ease);
}
.attendee-table input.inline-edit:hover { background: var(--surface-hover); }
.attendee-table input.inline-edit:focus { outline: none; border-color: var(--accent-400); background: var(--surface-card); box-shadow: 0 0 0 2px var(--accent-50); }
.sig-status { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; }
.sig-status.signed { color: var(--emerald-600); }
.sig-status.pending { color: var(--amber-600); }
.remove-row-btn {
  width: 28px; height: 28px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary); transition: all var(--dur-fast) var(--ease);
}
.remove-row-btn:hover { background: var(--red-50); color: var(--red-600); }

/* ---- Quick add attendee mini-panel inline in toolbar ---- */
.quick-iqama-popover {
  position: absolute;
  top: calc(100% + 8px); left: 0;
  width: 360px;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-4);
  z-index: 55;
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.quick-iqama-popover.open { opacity: 1; transform: translateY(0); pointer-events: auto; }

/* ---- Header info block (Employee Profile) ---- */
.profile-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-5); flex-wrap: wrap;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-5);
  box-shadow: var(--shadow-xs);
}
.profile-header-left { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; }
.profile-identity { min-width: 0; }
.profile-identity .pi-name { font-size: 19px; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-identity .pi-meta { display: flex; gap: var(--sp-4); flex-wrap: wrap; margin-top: 6px; }
.profile-identity .pi-meta-item { font-size: 12.5px; color: var(--text-tertiary); display: flex; align-items: center; gap: 6px; }
.profile-identity .pi-meta-item strong { color: var(--text-secondary); font-weight: 600; }
.profile-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Header form fields (attendance sheet create) */
.sheet-header-panel {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-5);
  box-shadow: var(--shadow-xs);
}
.sheet-header-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-stack {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}
.toast-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--navy-900);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 600;
  min-width: 240px;
  max-width: 380px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
}
.toast-item.show { opacity: 1; transform: translateY(0); }
.toast-item i { font-size: 14px; flex-shrink: 0; }
.toast-item.toast-success i { color: #4ade95; }
.toast-item.toast-info i { color: #6ba3e8; }
.toast-item.toast-warn i { color: #f0b656; }

/* ==========================================================================
   RESPONSIVE — Phase 2
   ========================================================================== */
@media (max-width: 1300px) {
  .stat-card-row { grid-template-columns: repeat(3, 1fr); }
  .doc-grid { grid-template-columns: repeat(2, 1fr); }
  .sheet-header-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .form-grid { grid-template-columns: 1fr; }
  .stat-card-row { grid-template-columns: repeat(2, 1fr); }
  .summary-bar { gap: var(--sp-4); }
  .profile-header { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 700px) {
  .doc-grid { grid-template-columns: 1fr; }
  .sheet-header-grid { grid-template-columns: 1fr; }
  .history-item { grid-template-columns: 1fr; gap: var(--sp-2); }
  .history-right { justify-content: flex-start; }
  .filter-bar-results { margin-left: 0; }
}
@media (max-width: 560px) {
  .stat-card-row { grid-template-columns: 1fr 1fr; }
}
