/* =============================================================================
   mobile.css — Employee and manager mobile-specific styles
   Applies to all screen widths; desktop.css overrides at >= 900px.
   ============================================================================= */

/* ── Bottom tab navigation ──────────────────────────────────────────────────── */
.nav-bottom {
  inset-inline-start: 0;
  inset-inline-end: 0;
  inset-block-end: 0;
  display: flex;
  align-items: stretch;
  height: var(--nav-h);
  background: var(--c-surface);
  border-block-start: 1px solid var(--c-border);
  box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.06);
  padding-block-end: env(safe-area-inset-bottom, 0);
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding-block: var(--sp-2);
  color: var(--c-text-muted);
  transition: color var(--dur-fast);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.nav-tab:active {
  background: var(--c-primary-dim);
}

.nav-tab.nav-active {
  color: var(--c-primary);
}

.nav-tab-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-tab-icon svg { width: 22px; height: 22px; }

.nav-tab-label {
  font-size: 10px;
  font-weight: var(--fw-medium);
  line-height: 1;
  text-align: center;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Language toggle tab — never squeezes the navigation items */
.nav-tab-lang {
  flex: 0 0 auto;
  min-width: 62px;
  padding-inline: var(--sp-2);
}

.nav-tab.nav-active .nav-tab-label {
  font-weight: var(--fw-bold);
}

/* Active indicator dot above the active tab */
.nav-tab.nav-active::before {
  content: '';
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--c-primary);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
}

/* ── Employee check-in screen ───────────────────────────────────────────────── */

.checkin-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--sp-6) var(--sp-4) var(--sp-8);
  min-height: 100%;
  gap: var(--sp-5);
}

.checkin-header {
  text-align: center;
  width: 100%;
}

.checkin-greeting {
  font-size: var(--text-lg);
  font-weight: var(--fw-semi);
  color: var(--c-text);
}

.checkin-date {
  font-size: var(--text-sm);
  color: var(--c-text-secondary);
  margin-block-start: var(--sp-1);
}

/* GPS indicator row */
.checkin-gps-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--c-text-secondary);
  min-height: 24px;
}

.gps-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--c-text-muted);
  flex-shrink: 0;
  transition: background var(--dur-base);
}
.gps-dot[data-state="loading"] { background: var(--c-late); animation: gps-blink 1s infinite; }
.gps-dot[data-state="success"] { background: var(--c-present); }
.gps-dot[data-state="error"]   { background: var(--c-absent); }

@keyframes gps-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* Action area */
.checkin-action-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-5);
  flex: 1;
  justify-content: center;
  width: 100%;
}

/* Button + pulse ring wrapper */
.checkin-btn-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 180px;
}

/* Pulse ring — only visible when .checkin-ring-active */
.checkin-ring {
  position: absolute;
  inset: 0;
  border-radius: var(--r-full);
  border: 3px solid var(--c-primary-mid);
  opacity: 0;
  pointer-events: none;
}
.checkin-ring-active {
  animation: ring-pulse 2s var(--ease-out) infinite;
}
@keyframes ring-pulse {
  0%   { transform: scale(1);    opacity: 0.7; }
  70%  { transform: scale(1.35); opacity: 0;   }
  100% { transform: scale(1.35); opacity: 0;   }
}

/* Check-in button — gradient + glow ring, matches prototype exactly */
.checkin-btn {
  position: relative;
  z-index: 1;
  width: 160px;
  height: 160px;
  border-radius: var(--r-full);
  background: linear-gradient(145deg, var(--c-primary) 0%, var(--c-primary-hover) 100%);
  color: var(--c-text-inverse);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  box-shadow:
    0 8px 40px oklch(0.62 0.195 254 / 0.35),
    0 0 0 12px oklch(0.62 0.195 254 / 0.08);
  transition: transform var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-base);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.checkin-btn:active:not(:disabled) {
  transform: scale(0.96);
  box-shadow:
    0 4px 20px oklch(0.62 0.195 254 / 0.30),
    0 0 0 8px oklch(0.62 0.195 254 / 0.06);
}

.checkin-btn:disabled {
  cursor: default;
  opacity: 0.6;
}

.checkin-btn-label {
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  line-height: var(--lh-tight);
  text-align: center;
}

/* Checkout variant — green */
.checkin-btn-checkout {
  background: var(--c-present);
  box-shadow: var(--shadow-lg), 0 0 0 6px var(--c-present-bg);
}
.checkin-btn-checkout:active:not(:disabled) {
  box-shadow: var(--shadow-md), 0 0 0 4px var(--c-present-bg);
}

/* Success flash — green, no interaction */
.checkin-btn-success {
  background: var(--c-present);
  box-shadow: var(--shadow-lg), 0 0 0 6px var(--c-present-bg);
  animation: success-pop 0.3s var(--ease-out) forwards;
}
@keyframes success-pop {
  0%   { transform: scale(0.95); }
  60%  { transform: scale(1.04); }
  100% { transform: scale(1);    }
}

/* Done (checked out) — muted */
.checkin-btn-done {
  background: var(--c-present);
  opacity: 0.75;
}

/* Status/error message below button */
.checkin-msg {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  text-align: center;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  max-width: 280px;
  line-height: var(--lh-snug);
}
.checkin-msg-error   { color: var(--c-absent);  background: var(--c-absent-bg);  }
.checkin-msg-success { color: var(--c-present); background: var(--c-present-bg); }
.checkin-msg-pending { color: var(--c-pending); background: var(--c-pending-bg); }

/* Biometric registration card */
.bio-reg-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-8) var(--sp-4);
  text-align: center;
  width: 100%;
  max-width: 320px;
}

.bio-reg-icon { color: var(--c-primary); }

.bio-reg-title {
  font-size: var(--text-md);
  font-weight: var(--fw-semi);
}

.bio-reg-sub {
  font-size: var(--text-sm);
  color: var(--c-text-secondary);
}

.bio-reg-btn { min-width: 160px; }

/* Step-by-step recovery instructions when the device cannot do WebAuthn */
.bio-help {
  width: 100%;
  text-align: start;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-xs);
}

.bio-help-title {
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  color: var(--c-text);
  margin-block-end: var(--sp-3);
}

.bio-help-steps {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding-inline-start: var(--sp-5);
  margin: 0;
  list-style: decimal;
}

.bio-help-steps li {
  font-size: var(--text-sm);
  color: var(--c-text-secondary);
  line-height: var(--lh-snug);
}

/* Device facts for HR — deliberately plain and copyable, never translated */
.bio-help-diag {
  margin-block-start: var(--sp-2);
  font-size: 10px;
  line-height: 1.5;
  color: var(--c-text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
  text-align: start;
  user-select: all;
}

.bio-help-footer {
  margin-block-start: var(--sp-3);
  padding-block-start: var(--sp-3);
  border-block-start: 1px dashed var(--c-border);
  font-size: var(--text-xs);
  color: var(--c-text-muted);
  line-height: var(--lh-snug);
}

/* ── Employee: attendance history list ──────────────────────────────────────── */

.att-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: 0;
}

.att-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-fast);
}

.att-row-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.att-date {
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  color: var(--c-text);
  /* Dates are always LTR regardless of UI language */
  direction: ltr;
  text-align: start;
  unicode-bidi: embed;
}

.att-hours {
  font-size: var(--text-xs);
  color: var(--c-text-muted);
}

.att-row-times {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.att-time-in,
.att-time-out {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: embed;
}

.att-time-in  { color: var(--c-present); }
.att-time-out { color: var(--c-text-muted); }

.att-row-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* Empty / error state inside a list */
.emp-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-12) var(--sp-8);
  text-align: center;
  list-style: none;
}

.emp-empty-icon { font-size: 2.5rem; line-height: 1; opacity: 0.35; }

.emp-empty-msg {
  font-size: var(--text-sm);
  color: var(--c-text-muted);
}

/* ── Employee: leave request form ───────────────────────────────────────────── */

.leave-balance-link {
  font-size: var(--text-xs);
  color: var(--c-primary);
  white-space: nowrap;
}

.leave-form-card {
  margin-block-end: var(--sp-5);
}

.leave-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.leave-dates-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

.leave-reason-input {
  resize: vertical;
  min-height: 72px;
}

.leave-form-error {
  background: var(--c-absent-bg);
  border: 1px solid var(--c-absent-border);
  color: var(--c-absent);
  font-size: var(--text-sm);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  line-height: var(--lh-snug);
}
.leave-form-error[hidden] { display: none; }

.leave-submit-btn {
  width: 100%;
  padding-block: var(--sp-3);
  font-weight: var(--fw-semi);
}

/* Success confirmation (replaces form card content on submit) */
.leave-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-8) var(--sp-4);
  text-align: center;
}

.leave-success-icon { color: var(--c-present); }

.leave-success-msg {
  font-size: var(--text-base);
  font-weight: var(--fw-medium);
  color: var(--c-present);
}

/* Section header above leave history lists */
.leave-section-title {
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-block-end: var(--sp-3);
}

.leave-history-section {
  margin-block-start: var(--sp-2);
}

.leave-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: 0;
}

.leave-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-xs);
}

.leave-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.leave-row-type {
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  color: var(--c-text);
}

.leave-row-dates {
  font-size: var(--text-xs);
  color: var(--c-text-secondary);
  direction: ltr;
  text-align: start;
  unicode-bidi: embed;
}

.leave-row-reason {
  font-size: var(--text-xs);
  color: var(--c-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Back button inside leave-balance header */
.leave-back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}

/* ── Employee: leave balance cards ──────────────────────────────────────────── */

.balance-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
  margin-block-end: var(--sp-5);
}

.balance-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-3);
  text-align: center;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  transition: box-shadow var(--dur-base) var(--ease-io),
              transform var(--dur-base) var(--ease-io);
}

.balance-card:hover,
.balance-card:focus-within {
  box-shadow: 0 0 0 1px var(--c-primary-mid),
              0 0 24px 4px var(--c-primary-dim),
              var(--shadow-md);
  transform: translateY(-3px);
}

.balance-card-primary {
  background: var(--c-primary-dim);
  border-color: var(--c-primary-mid);
}

.balance-card-pending {
  background: var(--c-pending-bg);
  border-color: var(--c-pending-border);
}

.balance-card-num {
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  color: var(--c-text);
  line-height: 1;
}

.balance-card-primary .balance-card-num { color: var(--c-primary); }
.balance-card-pending .balance-card-num { color: var(--c-pending); }

.balance-card-label {
  font-size: var(--text-xs);
  color: var(--c-text-secondary);
  line-height: var(--lh-snug);
}

.balance-error {
  font-size: var(--text-sm);
  color: var(--c-absent);
  text-align: center;
  padding: var(--sp-4);
}

/* ── Manager: live badge ────────────────────────────────────────────────────── */

.mgr-live-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  color: var(--c-present);
  background: var(--c-present-bg);
  border: 1px solid var(--c-present-border);
  padding: 3px var(--sp-3);
  border-radius: var(--r-full);
  flex-shrink: 0;
}

.mgr-live-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  background: var(--c-present);
  flex-shrink: 0;
  animation: mgr-live-pulse 1.6s ease-in-out infinite;
}

@keyframes mgr-live-pulse {
  0%, 100% { opacity: 1;   transform: scale(1);    }
  50%       { opacity: 0.4; transform: scale(0.82); }
}

/* ── Executive (CEO / MD): company status grouped by manager ───────────────── */

/* Company totals — 2×2 on mobile, one row of four once there is width */
.exec-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-block-end: var(--sp-5);
}

@media (min-width: 900px) {
  .exec-summary-grid   { grid-template-columns: repeat(4, 1fr); }
  /* On days somebody is out on duty the grid gains a fifth tile rather than
     wrapping one card onto a lonely second row */
  .exec-summary-grid-5 { grid-template-columns: repeat(5, 1fr); }
}

/* Each total is a button that opens the matching employee list. It inherits the
   whole .mgr-stat-card look — these overrides only undo the browser's button
   defaults so it renders identically to the card it replaced. */
.exec-stat-btn {
  font-family: inherit;
  color: inherit;
  width: 100%;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.exec-stat-btn:active { transform: translateY(-1px); }

.exec-stat-btn:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}

/* Nothing to open behind a zero — stays legible, drops the affordance */
.exec-stat-btn:disabled {
  cursor: default;
  opacity: 0.7;
}

.exec-stat-btn:disabled:hover {
  box-shadow: var(--shadow-xs);
  transform: none;
}

/* Status list modal — the list already sits on the modal surface, so it drops
   the inset panel treatment the group cards use */
.exec-list-modal-list {
  padding: 0;
  border: 0;
  background: transparent;
}

/* Department + reporting line. Allowed to wrap: in a company-wide list the
   manager name is the point of the row, and nowrap would ellipsis it away. */
.exec-list-sub {
  white-space: normal;
  overflow: visible;
  line-height: var(--lh-snug);
}

.exec-list-empty {
  font-size: var(--text-sm);
  color: var(--c-text-muted);
  text-align: center;
  padding: var(--sp-5) 0;
}

/* One <details> per manager — collapsed by default */
.exec-group {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  margin-block-end: var(--sp-2);
  overflow: hidden;
}

.exec-group-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  list-style: none; /* hide the default disclosure triangle */
}

.exec-group-head::-webkit-details-marker { display: none; }

.exec-group-head:hover { background: var(--c-surface-hover); }

.exec-group-head:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: -2px;
}

.exec-group-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.exec-group-name {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
}

.exec-group-dept {
  font-size: var(--text-xs);
  color: var(--c-text-secondary);
}

/* The manager's own status, shown on the collapsed header */
.exec-group-mgr-badge { flex-shrink: 0; }

.exec-group-counts {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* present / total */
.exec-ratio {
  font-variant-numeric: tabular-nums;
  font-size: var(--text-sm);
  white-space: nowrap;
}

.exec-ratio-num   { font-weight: var(--fw-bold); color: var(--c-present); }
.exec-ratio-sep,
.exec-ratio-total { color: var(--c-text-muted); }

/* Exception chips — rendered only when the count is non-zero, so a healthy
   team stays visually quiet and a team with problems draws the eye */
.exec-chip {
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  border-radius: var(--r-full);
  padding: 2px var(--sp-2);
  white-space: nowrap;
}

.exec-chip-late    { background: var(--c-late-bg);    color: var(--c-late);    }
.exec-chip-absent  { background: var(--c-absent-bg);  color: var(--c-absent);  }
.exec-chip-leave   { background: var(--c-leave-bg);   color: var(--c-leave);   }
.exec-chip-mission { background: var(--c-mission-bg); color: var(--c-mission); }

.exec-member-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  margin: 0;
  border-block-start: 1px solid var(--c-border);
  background: var(--c-surface-alt);
}

.exec-group-empty {
  padding: var(--sp-3) var(--sp-4);
  border-block-start: 1px solid var(--c-border);
  font-size: var(--text-xs);
  color: var(--c-text-muted);
}

/* Employees with no manager set — flagged rather than hidden */
.exec-group-unassigned { border-style: dashed; }

/* ── Manager: own-attendance card — links to the check-in screen ───────────── */

.mgr-self-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4);
  margin-block-end: var(--sp-4);
  box-shadow: var(--shadow-xs);
  text-decoration: none;
  color: inherit;
  transition: box-shadow var(--dur-base) var(--ease-io),
              transform var(--dur-base) var(--ease-io);
}

.mgr-self-card:hover,
.mgr-self-card:focus-visible {
  box-shadow: 0 0 0 1px var(--c-primary-mid),
              0 0 24px 4px var(--c-primary-dim),
              var(--shadow-md);
  transform: translateY(-2px);
}

.mgr-self-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.mgr-self-title {
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
}

.mgr-self-sub {
  font-size: var(--text-xs);
  color: var(--c-text-secondary);
  font-variant-numeric: tabular-nums;
}

/* Pill showing the next action — Check In / Check Out / day complete */
.mgr-self-action {
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  color: var(--c-primary);
  background: var(--c-primary-dim);
  border-radius: var(--r-full);
  padding: var(--sp-2) var(--sp-3);
}

.mgr-self-action-done {
  color: var(--c-text-muted);
  background: var(--c-surface-alt);
}

/* "You" marker on the manager's own row in the team list */
.mgr-self-tag {
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  color: var(--c-primary);
  background: var(--c-primary-dim);
  border-radius: var(--r-full);
  padding: 1px var(--sp-2);
  margin-inline-start: var(--sp-2);
}

/* ── Manager: 2×2 summary stat grid ────────────────────────────────────────── */

.mgr-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-block-end: var(--sp-5);
}

.mgr-stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  text-align: center;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur-base) var(--ease-io),
              transform var(--dur-base) var(--ease-io);
}

.mgr-stat-card:hover,
.mgr-stat-card:focus-within {
  box-shadow: 0 0 0 1px var(--c-primary-mid),
              0 0 24px 4px var(--c-primary-dim),
              var(--shadow-md);
  transform: translateY(-3px);
}

.mgr-stat-num {
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.mgr-stat-label {
  font-size: var(--text-xs);
  color: var(--c-text-secondary);
  line-height: var(--lh-snug);
}

.mgr-stat-present { background: var(--c-present-bg); border-color: var(--c-present-border); }
.mgr-stat-present .mgr-stat-num { color: var(--c-present); }

.mgr-stat-absent  { background: var(--c-absent-bg);  border-color: var(--c-absent-border);  }
.mgr-stat-absent  .mgr-stat-num { color: var(--c-absent);  }

.mgr-stat-late    { background: var(--c-late-bg);    border-color: var(--c-late-border);    }
.mgr-stat-late    .mgr-stat-num { color: var(--c-late);    }

.mgr-stat-leave   { background: var(--c-leave-bg);   border-color: var(--c-leave-border);   }
.mgr-stat-leave   .mgr-stat-num { color: var(--c-leave);   }

.mgr-stat-mission { background: var(--c-mission-bg); border-color: var(--c-mission-border); }
.mgr-stat-mission .mgr-stat-num { color: var(--c-mission); }

/* ── Missions ──────────────────────────────────────────────────────────────── */

/* One-line explanation above the request form — a mission is not time off, and
   an employee filing one for the first time needs to be told the difference */
.mission-hint {
  font-size: var(--text-xs);
  color: var(--c-text-secondary);
  line-height: var(--lh-snug);
  margin-block-end: var(--sp-4);
  padding: var(--sp-3);
  background: var(--c-mission-bg);
  border-radius: var(--r-md);
  border-inline-start: 3px solid var(--c-mission);
}

/* Section heading on the approvals screen, which now stacks two queues */
.mgr-queue-title {
  display: block;
  margin-block: var(--sp-4) var(--sp-2);
}

.mgr-queue-title:first-child { margin-block-start: 0; }

/* Destination row on a pending mission card */
.mgr-mission-dest {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-block-start: var(--sp-2);
}

.mgr-mission-dest-value {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  flex: 1;
  min-width: 0;
}

/* ── Manager: section header row ────────────────────────────────────────────── */

.mgr-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-block-end: var(--sp-3);
}

.mgr-section-title {
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mgr-refresh-time {
  font-size: var(--text-xs);
  color: var(--c-text-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Manager: team member list ──────────────────────────────────────────────── */

.mgr-member-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: 0;
}

.mgr-member-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-xs);
  list-style: none;
}

/* Circular avatar with coloured background and member initials */
.mgr-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  background: var(--c-primary-dim);
  color: var(--c-primary);
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.04em;
  user-select: none;
}

.mgr-member-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mgr-member-name {
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mgr-member-dept {
  font-size: var(--text-xs);
  color: var(--c-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mgr-member-right {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--sp-1);
}

.mgr-member-time {
  font-size: var(--text-xs);
  color: var(--c-text-secondary);
  font-variant-numeric: tabular-nums;
  /* Times are always LTR regardless of UI language */
  direction: ltr;
  unicode-bidi: embed;
}

/* ── Manager: team attendance list ──────────────────────────────────────────── */

.mgr-date-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-block-end: var(--sp-4);
  flex-wrap: wrap;
}

.mgr-date-input {
  width: auto;
  flex-shrink: 0;
  /* Date inputs are always LTR */
  direction: ltr;
}

.mgr-att-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: 0;
}

.mgr-att-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-xs);
  list-style: none;
}

.mgr-att-name {
  flex: 1;
  min-width: 0;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mgr-att-times {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.mgr-att-right {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--sp-1);
}

.mgr-att-hours {
  font-size: var(--text-xs);
  color: var(--c-text-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Manager: leave approval cards ──────────────────────────────────────────── */

.mgr-leave-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: 0;
}

.mgr-leave-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  list-style: none;
  transition: box-shadow var(--dur-base) var(--ease-io),
              transform var(--dur-base) var(--ease-io);
}

.mgr-leave-card:hover,
.mgr-leave-card:focus-within {
  box-shadow: 0 0 0 1px var(--c-primary-mid),
              0 0 24px 4px var(--c-primary-dim),
              var(--shadow-md);
  transform: translateY(-3px);
}

.mgr-leave-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.mgr-leave-name {
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  color: var(--c-text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mgr-leave-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mgr-leave-type {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--c-text);
}

.mgr-leave-dates {
  font-size: var(--text-xs);
  color: var(--c-text-secondary);
  direction: ltr;
  text-align: start;
  unicode-bidi: embed;
}

.mgr-leave-reason {
  font-size: var(--text-xs);
  color: var(--c-text-muted);
  line-height: var(--lh-snug);
  margin: 0;
}

.mgr-leave-actions {
  display: flex;
  gap: var(--sp-2);
}

.mgr-leave-actions .btn {
  flex: 1;
  justify-content: center;
}

/* Remaining annual balance of the requester, inside the approval card */
.mgr-leave-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding-block-start: var(--sp-2);
  border-block-start: 1px dashed var(--c-border);
}

.mgr-leave-balance-label {
  font-size: var(--text-xs);
  color: var(--c-text-muted);
}

/* ── Manager: team annual leave balances ────────────────────────────────────── */

.mgr-balance-section {
  margin-block-start: var(--sp-6);
}

.mgr-balance-section .mgr-section-title {
  display: block;
  margin-block-end: var(--sp-3);
}

.mgr-balance-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: 0;
}

.mgr-balance-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-xs);
  list-style: none;
}

.mgr-balance-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Proportion of the annual entitlement already taken */
.mgr-balance-bar {
  display: block;
  height: 5px;
  border-radius: var(--r-full);
  background: var(--c-surface-hover);
  overflow: hidden;
}

.mgr-balance-bar-fill {
  display: block;
  height: 100%;
  background: var(--c-primary);
  border-radius: var(--r-full);
  transition: width var(--dur-base) var(--ease-io);
}

.mgr-balance-sub {
  font-size: var(--text-xs);
  color: var(--c-text-muted);
}

.mgr-balance-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.mgr-balance-label {
  font-size: 10px;
  color: var(--c-text-muted);
}

/* ── Manager: error state ───────────────────────────────────────────────────── */

.mgr-error {
  padding: var(--sp-6) var(--sp-5);
  color: var(--c-absent);
  font-size: var(--text-sm);
  text-align: center;
  background: var(--c-absent-bg);
  border: 1px solid var(--c-absent-border);
  border-radius: var(--r-lg);
  margin-block-end: var(--sp-3);
}

/* ── Scrollable bottom nav for HR (many items) ──────────────────────────── */
.nav-bottom.nav-bottom-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  justify-content: flex-start;
  -webkit-overflow-scrolling: touch;
}

.nav-bottom.nav-bottom-scroll::-webkit-scrollbar {
  display: none;
}

.nav-bottom.nav-bottom-scroll .nav-tab {
  flex: 0 0 64px;
  min-width: 64px;
}

.nav-bottom.nav-bottom-scroll .nav-tab-label {
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 58px;
}

/* ── Panel / modal overlays — must work on all screen sizes ─────────────── */
.panel-overlay {
  position: fixed;
  inset: 0;
  background: var(--c-overlay);
  z-index: 1050;
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
  pointer-events: none;
}

.panel-overlay.overlay-visible {
  opacity: 1;
  pointer-events: all;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--c-overlay);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay[hidden] { display: none; }

/* ── Modal dialog — base styles for all screen sizes ───────────────────── */
.modal {
  background: var(--c-surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  width: calc(100vw - var(--sp-8));
  max-width: 480px;
  max-height: 90dvh;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-block-end: 1px solid var(--c-border);
  flex-shrink: 0;
}

.modal-title {
  font-size: var(--text-md);
  font-weight: var(--fw-semi);
  flex: 1;
  min-width: 0;
}

.modal-bd {
  padding: var(--sp-5);
  flex: 1;
  overflow-y: auto;
}

.modal-ft {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5);
  border-block-start: 1px solid var(--c-border);
  flex-shrink: 0;
}

/* ── Mobile view padding ────────────────────────────────────────────────────── */
@media (max-width: 899px) {
  #app {
    padding-block-end: var(--nav-h);
  }

  .view-content {
    padding: var(--sp-4);
    padding-block-end: var(--sp-10);
    max-width: 100%;
  }

  .view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-4);
    background: var(--c-surface);
    border-block-end: 1px solid var(--c-border);
    position: sticky;
    inset-block-start: 0;
    z-index: 10;
  }

  /* When view-header is a direct child of view-content (HR views pattern),
     negate the parent's padding so the header spans the full viewport width
     and the sticky element has no side gaps when scrolling.
     margin-block-end restores the 16px gap below the header that the
     view-content's top padding would normally provide in the correct pattern. */
  .view-content > .view-header {
    margin-inline: calc(-1 * var(--sp-4));
    margin-block-start: calc(-1 * var(--sp-4));
    margin-block-end: var(--sp-4);
  }

  .view-title {
    font-size: var(--text-md);
    font-weight: var(--fw-semi);
  }

  /* HR views: view-hd (title + action button row) */
  .view-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    flex-wrap: wrap;
    margin-block-end: var(--sp-4);
  }

  /* Data tables scroll horizontally on mobile */
  .table-wrap,
  .data-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Stat grid: 2 columns on mobile */
  .stat-grid { grid-template-columns: 1fr 1fr; }

  /* Calendar: single column on mobile */
  .cal-grid { grid-template-columns: 1fr; }

  /* Form rows: stack vertically on mobile */
  .form-row { grid-template-columns: 1fr; }

  /* Live summary bar: wrap on mobile */
  .live-summary-bar { flex-wrap: wrap; gap: var(--sp-2); }

  /* Table toolbar: wrap on mobile */
  .table-toolbar { flex-wrap: wrap; }

  /* Pagination: compact on mobile */
  .pagination-bar { flex-wrap: wrap; gap: var(--sp-2); }

  /* Detail field label: shorter on mobile */
  .detail-field-label { width: 80px; }

  /* Config form: no max-width restriction on mobile */
  .config-form { max-width: 100%; }

  /* Location map: shorter on mobile */
  .loc-map { height: 240px; }
  .loc-picker-map { height: 180px; }
}

/* =============================================================================
   HR component base styles — apply at ALL screen sizes.
   desktop.css overrides layout-specific properties at min-width: 900px.
   ============================================================================= */

/* ── Shared .input class ────────────────────────────────────────────────────── */
.input {
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  color: var(--c-text);
  outline: none;
  width: 100%;
  font-family: var(--font);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-dim);
}

/* ── View header row (title + action button) ────────────────────────────────── */
.view-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-block-end: var(--sp-4);
}

.view-hd-title {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--c-text);
}

/* ── Dashboard header ───────────────────────────────────────────────────────── */
.dashboard-date {
  font-size: var(--text-sm);
  color: var(--c-text-muted);
  margin-block-start: var(--sp-1);
}

.dashboard-refresh-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-full);
  background: var(--c-surface-raised);
  border: 1px solid var(--c-border);
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  color: var(--c-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: background var(--dur-fast);
}
.dashboard-refresh-indicator:hover { background: var(--c-surface-hover); }

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  background: var(--c-present);
  flex-shrink: 0;
  animation: _live-pulse 2.4s ease-in-out infinite;
}
@keyframes _live-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

/* ── Stat grid and cards ────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-block-end: var(--sp-5);
}

.stat-card {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border);
  border-inline-start-width: 3px;
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur-base) var(--ease-io),
              transform var(--dur-base) var(--ease-io);
}

.stat-card:hover,
.stat-card:focus-within {
  box-shadow: 0 0 0 1px var(--c-primary-mid),
              0 0 24px 4px var(--c-primary-dim),
              var(--shadow-md);
  transform: translateY(-3px);
}

.stat-card-present { border-inline-start-color: var(--c-present); }
.stat-card-absent  { border-inline-start-color: var(--c-absent); }
.stat-card-late    { border-inline-start-color: var(--c-late); }
.stat-card-leave   { border-inline-start-color: var(--c-leave); }

.stat-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
}

.stat-card-label {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--c-text-secondary);
  line-height: var(--lh-snug);
}

.stat-card-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.stat-card-icon svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}

.stat-icon-present { background: var(--c-present-bg); color: var(--c-present); }
.stat-icon-absent  { background: var(--c-absent-bg);  color: var(--c-absent); }
.stat-icon-late    { background: var(--c-late-bg);    color: var(--c-late); }
.stat-icon-leave   { background: var(--c-leave-bg);   color: var(--c-leave); }

.stat-card-value {
  font-size: var(--text-2xl);
  font-weight: var(--fw-black);
  color: var(--c-text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-card-value.stat-present { color: var(--c-present); }
.stat-card-value.stat-absent  { color: var(--c-absent); }
.stat-card-value.stat-late    { color: var(--c-late); }
.stat-card-value.stat-leave   { color: var(--c-leave); }

/* ── Live summary bar ───────────────────────────────────────────────────────── */
.live-summary-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  margin-block-end: var(--sp-4);
  flex-wrap: wrap;
}

.live-summary-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
}
.live-summary-count {
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
}
.live-summary-label { color: var(--c-text-secondary); }

/* ── Activity feed / recent activity ───────────────────────────────────────── */
.activity-card {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-block-end: var(--sp-5);
  transition: box-shadow var(--dur-base) var(--ease-io),
              transform var(--dur-base) var(--ease-io);
}

.activity-card:hover,
.activity-card:focus-within {
  box-shadow: 0 0 0 1px var(--c-primary-mid),
              0 0 24px 4px var(--c-primary-dim),
              var(--shadow-md);
  transform: translateY(-3px);
}

.activity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4);
  border-block-end: 1px solid var(--c-border);
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.activity-title {
  font-size: var(--text-base);
  font-weight: var(--fw-semi);
  color: var(--c-text);
}

.pending-leave-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3) var(--sp-1) var(--sp-2);
  border-radius: var(--r-full);
  background: var(--c-pending-bg, #fff8e1);
  border: 1px solid var(--c-pending-border, #ffe082);
  color: var(--c-pending, #f59e0b);
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: background var(--dur-fast);
}
.pending-leave-btn:hover { background: var(--c-late-bg); }

.pending-leave-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--r-full);
  background: var(--c-pending, #f59e0b);
  color: #fff;
  font-size: 10px;
  font-weight: var(--fw-bold);
  line-height: 1;
  flex-shrink: 0;
}

.activity-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-block-end: 1px solid var(--c-border);
}
.activity-row:last-child { border-block-end: none; }

.activity-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  flex-shrink: 0;
  text-transform: uppercase;
}

.avatar-present  { background: var(--c-present-bg); color: var(--c-present); }
.avatar-late     { background: var(--c-late-bg);    color: var(--c-late); }
.avatar-absent   { background: var(--c-absent-bg);  color: var(--c-absent); }
.avatar-leave    { background: var(--c-leave-bg);   color: var(--c-leave); }
.avatar-on_leave { background: var(--c-leave-bg);   color: var(--c-leave); }

.activity-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.activity-name {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-dept {
  font-size: var(--text-xs);
  color: var(--c-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-time {
  font-size: var(--text-xs);
  color: var(--c-text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.activity-empty {
  padding: var(--sp-8) var(--sp-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  text-align: center;
  color: var(--c-text-muted);
  font-size: var(--text-sm);
}

.activity-skeleton { padding: var(--sp-1) 0; }

.activity-row-skeleton {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-block-end: 1px solid var(--c-border);
}
.activity-row-skeleton:last-child { border-block-end: none; }

/* ── Table container (card wrapper) ────────────────────────────────────────── */
.data-table-wrap,
.table-wrap {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Data table ─────────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  min-width: 480px;
}

.data-table thead {
  background: var(--c-surface-raised);
  border-block-end: 2px solid var(--c-border);
}

.data-table th {
  padding: var(--sp-3) var(--sp-4);
  font-weight: var(--fw-semi);
  color: var(--c-text-secondary);
  text-align: start;
  white-space: nowrap;
  user-select: none;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table td {
  padding: var(--sp-3) var(--sp-4);
  border-block-end: 1px solid var(--c-border);
  color: var(--c-text);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-block-end: none; }
.data-table tbody tr.row-absent   { background: var(--c-absent-bg); }
.data-table tbody tr.row-inactive { opacity: 0.45; }

.table-empty {
  text-align: center;
  padding: var(--sp-8) var(--sp-4);
  color: var(--c-text-muted);
  font-size: var(--text-sm);
  cursor: default;
  width: 100%;
}

.table-row-click { cursor: pointer; }
.table-row-click:hover > td { background: var(--c-surface-hover); }

/* ── Table toolbar ──────────────────────────────────────────────────────────── */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-surface);
  border-block-end: 1px solid var(--c-border);
  flex-wrap: wrap;
}

.table-search-wrap { flex: 1; min-width: 140px; }

.table-toolbar-search,
.table-search-input {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface-raised);
  color: var(--c-text);
  outline: none;
  font-family: var(--font);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.table-toolbar-search:focus,
.table-search-input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-dim);
}

.table-toolbar-select,
.table-toolbar-date {
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface-raised);
  color: var(--c-text);
  outline: none;
  font-family: var(--font);
  transition: border-color var(--dur-fast);
}
.table-toolbar-select:focus,
.table-toolbar-date:focus { border-color: var(--c-primary); }
.table-toolbar-date { direction: ltr; }

.toolbar-sep {
  color: var(--c-border);
  font-size: var(--text-base);
  flex-shrink: 0;
}

.count-badge {
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  color: var(--c-text-muted);
  background: var(--c-surface-raised);
  border: 1px solid var(--c-border);
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-full);
  white-space: nowrap;
  flex-shrink: 0;
}

.table-toolbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-inline-start: auto;
}

/* ── Icon button ────────────────────────────────────────────────────────────── */
.btn-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  color: var(--c-text-secondary);
  background: transparent;
  border: none;
  flex-shrink: 0;
  cursor: pointer;
  font-size: var(--text-base);
  line-height: 1;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.btn-icon:hover {
  background: var(--c-surface-hover);
  color: var(--c-text);
}

/* ── Nav badge (pending count) ──────────────────────────────────────────────── */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-full);
  background: var(--c-absent);
  color: #fff;
  font-size: 10px;
  font-weight: var(--fw-black);
  line-height: 1;
  flex-shrink: 0;
}

/* ── Pagination ─────────────────────────────────────────────────────────────── */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-block-start: 1px solid var(--c-border);
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* When pagination is a direct child of the page (outside a card), give it card styling */
.view-content > .pagination-bar {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-block-start: none;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.pagination-info {
  font-size: var(--text-sm);
  color: var(--c-text-secondary);
  font-variant-numeric: tabular-nums;
}

.pagination-controls { display: flex; gap: var(--sp-1); }

.pagination-btn {
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--c-text-secondary);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  cursor: pointer;
  font-family: var(--font);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.pagination-btn:hover:not(:disabled) {
  background: var(--c-surface-hover);
  color: var(--c-text);
}
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination-btn.pagination-active {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
}

/* ── Slide panel internals ──────────────────────────────────────────────────── */
.slide-panel { display: flex; flex-direction: column; }

.slide-panel-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-block-end: 1px solid var(--c-border);
  background: var(--c-surface-raised);
  flex-shrink: 0;
  gap: var(--sp-3);
}

.slide-panel-title {
  font-size: var(--text-md);
  font-weight: var(--fw-semi);
  color: var(--c-text);
  flex: 1;
  min-width: 0;
}

.slide-panel-bd {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-5);
}

/* ── Panel form and field groups ────────────────────────────────────────────── */
.panel-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.form-group label {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--c-text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  width: 100%;
}

.form-group textarea {
  resize: vertical;
  min-height: 76px;
  line-height: var(--lh-base);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
}

.form-required {
  color: var(--c-absent);
  margin-inline-start: 2px;
  font-weight: var(--fw-medium);
}

.form-field-error {
  font-size: var(--text-xs);
  color: var(--c-absent);
  margin-block-start: 2px;
}
.form-field-error[hidden] { display: none; }

.form-actions {
  display: flex;
  gap: var(--sp-2);
  padding-block-start: var(--sp-4);
  border-block-start: 1px solid var(--c-border);
  flex-wrap: wrap;
}

/* ── Employee detail view (inside panel) ────────────────────────────────────── */
.detail-emp-hd {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding-block-end: var(--sp-4);
  margin-block-end: var(--sp-4);
  border-block-end: 1px solid var(--c-border);
}

.detail-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--r-full);
  background: var(--c-primary-dim);
  color: var(--c-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  flex-shrink: 0;
  text-transform: uppercase;
}

.detail-emp-name {
  font-size: var(--text-md);
  font-weight: var(--fw-semi);
  color: var(--c-text);
}
.detail-emp-dept {
  font-size: var(--text-sm);
  color: var(--c-text-muted);
  margin-block-start: 2px;
}

.detail-fields {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-block-end: var(--sp-5);
}

.detail-field {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  font-size: var(--text-sm);
}

.detail-field-label {
  width: 100px;
  flex-shrink: 0;
  color: var(--c-text-secondary);
  font-weight: var(--fw-medium);
}

.detail-field-value {
  flex: 1;
  color: var(--c-text);
  word-break: break-word;
}

.detail-section-title {
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-block-end: var(--sp-3);
  margin-block-start: var(--sp-5);
  padding-block-end: var(--sp-2);
  border-block-end: 1px solid var(--c-border);
}

.detail-actions {
  display: flex;
  gap: var(--sp-2);
  padding-block-start: var(--sp-4);
  border-block-start: 1px solid var(--c-border);
  flex-wrap: wrap;
}

/* ── Config / settings page ─────────────────────────────────────────────────── */
.config-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  max-width: 680px;
}

.config-section {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  box-shadow: var(--shadow-sm);
}

.config-section-title {
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding-block-end: var(--sp-3);
  border-block-end: 1px solid var(--c-border);
}

.wd-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.wd-check-label {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--c-text);
  cursor: pointer;
  user-select: none;
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  font-family: var(--font);
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.wd-check-label:has(input:checked) {
  border-color: var(--c-primary);
  background: var(--c-primary-dim);
  color: var(--c-primary);
}
.wd-check-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--c-primary);
  flex-shrink: 0;
}

.cfg-toggles { display: flex; flex-direction: column; gap: 0; }

.cfg-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) 0;
  border-block-end: 1px solid var(--c-border);
}
.cfg-toggle-row:last-child { border-block-end: none; }

.cfg-toggle-label {
  font-size: var(--text-sm);
  color: var(--c-text);
  font-weight: var(--fw-medium);
}

.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-slider {
  width: 40px;
  height: 22px;
  background: var(--c-border);
  border-radius: 99px;
  transition: background var(--dur-base);
  position: relative;
  flex-shrink: 0;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--dur-base);
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.toggle-switch input:checked + .toggle-slider { background: var(--c-primary); }
.toggle-switch input:checked + .toggle-slider::after { transform: translateX(18px); }
[dir="rtl"] .toggle-switch input:checked + .toggle-slider::after { transform: translateX(-18px); }

/* ── Holiday calendar ───────────────────────────────────────────────────────── */
.cal-year-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-block-end: var(--sp-4);
}

.cal-year-label {
  font-size: var(--text-lg);
  font-weight: var(--fw-semi);
  color: var(--c-text);
  min-width: 60px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.cal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
}

.cal-month-block {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-3);
  box-shadow: var(--shadow-sm);
}

.cal-month-name {
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  color: var(--c-text);
  text-align: center;
  padding-block-end: var(--sp-2);
  margin-block-end: var(--sp-2);
  border-block-end: 1px solid var(--c-border);
}

.cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day-name {
  font-size: 9px;
  font-weight: var(--fw-semi);
  color: var(--c-text-muted);
  text-align: center;
  padding-block: 2px;
}

.cal-day {
  font-size: 11px;
  text-align: center;
  padding-block: 4px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--c-text);
  line-height: 1.5;
  user-select: none;
  transition: background var(--dur-fast);
}
.cal-day:hover:not(.cal-day--empty) { background: var(--c-surface-hover); }

.cal-day--empty { cursor: default; }

.cal-day--holiday {
  background: var(--c-primary-dim);
  color: var(--c-primary);
  font-weight: var(--fw-semi);
}
.cal-day--holiday:hover { background: var(--c-primary-dim); }

.cal-day--today {
  outline: 2px solid var(--c-primary);
  outline-offset: -1px;
  font-weight: var(--fw-semi);
}

/* ── Location map ───────────────────────────────────────────────────────────── */
.loc-map-wrap {
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--c-border);
  margin-block-end: var(--sp-4);
  box-shadow: var(--shadow-sm);
}

.loc-map { height: 280px; width: 100%; }

.loc-picker-map {
  height: 200px;
  width: 100%;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  margin-block-end: var(--sp-3);
  overflow: hidden;
  position: relative;
}

/* ── Skeleton shimmer ───────────────────────────────────────────────────────── */
.skeleton-line {
  height: 12px;
  border-radius: var(--r-sm);
  background: var(--c-surface-raised);
  background: linear-gradient(90deg, var(--c-surface-raised) 25%, var(--c-surface-hover) 50%, var(--c-surface-raised) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
