:root {
  /* Compatibility aliases: the approved palette lives in theme.css. */
  --navy: var(--yz-text);
  --navy-2: var(--yz-on-secondary);
  --teal: var(--yz-primary);
  --teal-dark: var(--yz-primary-hover);
  --brand-sky: var(--yz-primary);
  --brand-aqua: var(--yz-accent);
  --mint: var(--yz-accent);
  --mint-2: var(--yz-secondary);
  --gold: var(--yz-warning);
  --gold-soft: var(--yz-warning-soft);
  --canvas: var(--yz-background);
  --surface: var(--yz-card);
  --surface-2: var(--yz-muted);
  --ink: var(--yz-text);
  --muted: var(--yz-muted-text);
  --line: var(--yz-border);
  --danger: var(--yz-danger);
  --danger-soft: var(--yz-danger-soft);
  --warning: var(--yz-warning);
  --warning-soft: var(--yz-warning-soft);
  --success: var(--yz-success);
  --success-soft: var(--yz-success-soft);
  --blue: var(--yz-primary);
  --violet: #725a98;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --shadow: var(--yz-shadow-card);
  --shadow-lg: var(--yz-shadow-overlay);
  --safe-bottom: max(12px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--canvas); scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--canvas);
  font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--yz-focus);
  outline-offset: 2px;
}
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip-link { position: fixed; z-index: 1000; top: 10px; right: 12px; padding: 10px 14px; border-radius: 10px; color: #fff; background: var(--navy); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.noscript { margin: 20px; padding: 16px; border: 1px solid #edc6ca; border-radius: 12px; color: var(--danger); background: var(--danger-soft); text-align: center; }

.portal-shell { min-height: 100dvh; }
.sidebar { display: none; }
.app-main { min-width: 0; padding-bottom: calc(78px + var(--safe-bottom)); }
.topbar {
  position: sticky;
  z-index: 25;
  top: 0;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid rgba(210, 224, 222, .92);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(16px);
}
.topbar > div:first-child { min-width: 0; }
.topbar-identity { display: flex; align-items: center; gap: 10px; }
.topbar-identity > div { min-width: 0; }
.topbar-logo { width: 46px; height: 46px; display: grid; place-items: center; flex: 0 0 auto; overflow: hidden; border: 1px solid #e4e9e8; border-radius: 13px; background: #fff; }
.topbar-logo img { width: 100%; height: 100%; object-fit: contain; }
.topbar span { display: block; color: var(--teal); font-size: 13px; font-weight: 700; }
.topbar h1 { margin: 1px 0 0; overflow: hidden; font-size: 20px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.topbar .sync-state { display: none; }
.icon-button, .top-avatar {
  min-width: 46px;
  height: 46px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
}
.icon-button:active, .top-avatar:active, .primary-button:active, .outline-button:active { transform: scale(.98); }
.icon-button svg { width: 21px; height: 21px; }
.refresh-button {
  color: #087da7;
  border-color: #b9dbe6;
  background: #f4fbfd;
  box-shadow: 0 2px 8px rgba(18, 97, 127, .08);
}
.refresh-button svg { width: 24px; height: 24px; stroke-width: 2.25; }
.refresh-button:hover { border-color: #79bfd5; background: #eaf7fb; }
.refresh-button.is-refreshing svg { animation: refresh-spin .75s linear infinite; }
@keyframes refresh-spin { to { transform: rotate(360deg); } }
.top-avatar svg { width: 23px; height: 23px; color: var(--teal); stroke-width: 2; }
.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 20px 16px 28px; }
.environment-banner, .connection-message { margin: 12px 16px 0; padding: 12px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; }
.environment-banner { color: #6b5315; background: var(--gold-soft); }
.connection-message { color: #7f303b; background: var(--danger-soft); }

.portal-view { display: none; }
.portal-view.active { display: block; animation: view-in .2s ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } }
.welcome-strip { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 2px 0 20px; }
.welcome-strip span, .page-intro span, .section-head span, .card header span, .swap-step header span { color: var(--teal); font-size: 13px; font-weight: 700; }
.welcome-strip h2 { margin: 2px 0 3px; font-size: clamp(24px, 7vw, 32px); line-height: 1.3; }
.welcome-strip p, .page-intro p { margin: 0; color: var(--muted); font-size: 15px; }
.live-clock { display: none; }

.dashboard-grid, .team-layout, .admin-layout, .profile-grid { display: grid; gap: 16px; }
.card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.shift-card, .action-card, .team-card, .next-card, .overview-card, .quick-panel, .schedule-card, .team-directory-card,
.attendance-card, .doctor-directory, .permission-editor, .profile-info, .swap-step, .swap-summary, .upload-panel, .audit-card {
  padding: 18px;
}
.shift-card header { display: flex; align-items: center; gap: 14px; }
.shift-card header > div:last-child { min-width: 0; }
.shift-card h3, .action-card h3, .section-head h3, .swap-step h3, .swap-summary h3 { margin: 2px 0 0; font-size: 18px; }
.shift-card p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.shift-code { width: 56px; height: 56px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 16px; color: var(--navy); background: var(--mint-2); font-size: 22px; font-weight: 700; }
.shift-progress { height: 8px; margin: 22px 0 16px; overflow: hidden; border-radius: 999px; background: #e9efee; }
.shift-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--brand-sky), var(--brand-aqua)); transition: width .3s ease; }
.shift-times { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.shift-times span { min-width: 0; display: flex; flex-direction: column; padding: 9px; border-radius: 10px; background: var(--surface-2); text-align: center; }
.shift-times small { color: var(--muted); font-size: 13px; }
.shift-times strong { margin-top: 2px; font-size: 16px; font-variant-numeric: tabular-nums; }

.action-card { display: flex; flex-direction: column; }
.action-card > header, .section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.action-card > header svg { width: 42px; height: 42px; padding: 10px; border-radius: 13px; color: var(--teal); background: var(--mint); }
.category-summary { display: grid; gap: 8px; margin: 16px 0; }
.category-summary button, .category-summary > div:not(.skeleton-row) {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-2);
  text-align: right;
  cursor: pointer;
}
.category-summary button > span:nth-child(2) { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.category-summary button strong { font-size: 15px; }
.category-summary button small { color: var(--muted); font-size: 13px; }
.category-summary button > b { min-width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: #fff; font-size: 13px; }
.category-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px; font-size: 16px; font-weight: 700; }
.category-icon svg { width: 22px; height: 22px; }
.category-icon.mint { color: var(--teal); background: var(--mint); }
.category-icon.blue { color: var(--blue); background: #eaf2fb; }
.category-icon.violet { color: var(--violet); background: #f1ecf8; }

.primary-button, .outline-button, .text-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s ease, background-color .15s ease, opacity .15s ease;
}
.primary-button { border: 1px solid var(--teal); color: #fff; background: var(--teal); }
.primary-button:hover { background: var(--teal-dark); }
.outline-button { border: 1px solid var(--line); color: var(--ink); background: #fff; }
.text-button { min-height: 44px; padding: 8px 0; border: 0; color: var(--teal); background: transparent; }
.primary-button:disabled, .outline-button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.primary-button svg, .outline-button svg { width: 19px; height: 19px; }
.full { width: 100%; }

.overview-card > header > svg, .quick-panel > header > svg { width: 42px; height: 42px; padding: 10px; border-radius: 13px; color: var(--teal); background: var(--mint); }
.overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.overview-grid button {
  min-width: 0;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  text-align: right;
  cursor: pointer;
}
.overview-icon { width: 38px; height: 38px; display: grid; place-items: center; margin-bottom: 8px; border-radius: 11px; font-size: 14px; font-weight: 700; }
.overview-icon svg { width: 20px; height: 20px; }
.overview-icon.gold { color: #8b651d; background: var(--gold-soft); }
.overview-icon.teal { color: var(--teal); background: var(--mint); }
.overview-icon.green { color: #08733e; background: #e4f6eb; }
.overview-icon.blue { color: #315c96; background: #eaf0ff; }
.overview-icon.training-pair {
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  color: #294c8f;
  background: #edf0ff;
}
.overview-icon.training-pair svg { width: 16px; height: 16px; }
.overview-icon.training-pair svg.intern { color: #294c8f; }
.overview-icon.training-pair svg.student { color: #3b5ceb; }
.overview-grid b { font-size: 24px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.overview-grid small { margin-top: 3px; color: var(--muted); font-size: 13px; }

.section-head > b, .count-chip, .month-chip, .shift-chip { min-width: 34px; min-height: 34px; display: inline-grid; place-items: center; padding: 6px 9px; border-radius: 10px; color: var(--teal); background: var(--mint); font-size: 14px; }
.doctor-list { display: grid; gap: 8px; margin-top: 14px; }
.doctor-row { min-height: 58px; display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid #edf2f1; }
.doctor-row:last-child { border-bottom: 0; }
.mini-avatar, .avatar { display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; color: #fff; background: var(--teal); font-weight: 700; }
.mini-avatar { width: 40px; height: 40px; font-size: 13px; }
.mini-avatar svg { width: 22px; height: 22px; }
.mini-avatar.doctor-icon { color: var(--teal); background: var(--mint); }
.avatar { width: 46px; height: 46px; }
.avatar.large { width: 68px; height: 68px; border-radius: 20px; font-size: 20px; }
.doctor-row > span:nth-child(2) { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.doctor-row strong { font-size: 15px; }
.doctor-row small { color: var(--muted); font-size: 13px; }
.doctor-row > b { color: var(--success); font-size: 13px; }
.team-status { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.team-status svg { width: 16px; height: 16px; }

.next-shift { display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 12px; margin: 18px 0 14px; padding: 14px; border-radius: 14px; background: var(--surface-2); }
.next-shift > b { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 13px; color: var(--navy); background: var(--mint-2); font-size: 18px; }
.next-shift > div { display: flex; flex-direction: column; }
.next-shift strong { font-size: 16px; }
.next-shift small { color: var(--muted); font-size: 13px; }
.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.quick-actions button {
  min-width: 0;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-align: right;
  cursor: pointer;
}
.quick-actions button > svg { width: 42px; height: 42px; padding: 10px; border-radius: 12px; color: var(--teal); background: var(--mint); }
.quick-actions button > span { min-width: 0; display: flex; flex-direction: column; }
.quick-actions b { font-size: 15px; }
.quick-actions small { color: var(--muted); font-size: 13px; }

.page-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.page-intro > div { min-width: 0; }
.page-intro h2 { margin: 2px 0 3px; font-size: 26px; line-height: 1.3; }
.safe-note { flex: 0 0 auto; padding: 7px 10px; border-radius: 999px; color: var(--success) !important; background: var(--success-soft); font-size: 13px !important; }
.shift-calendar-host { min-width: 0; display: grid; gap: 16px; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 7px; }
.calendar-legend > span { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 999px; background: var(--surface-2); }
.calendar-legend small { color: var(--muted); font-size: 12px; font-weight: 600; }
.shift-calendar { width: 100%; max-width: 760px; margin-inline: auto; padding: 13px; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.calendar-month-title { margin: 0 0 11px; color: var(--teal); font-size: 16px; }
.calendar-weekdays, .calendar-days {
  direction: ltr;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.calendar-weekdays { margin-bottom: 6px; }
.calendar-weekdays span { overflow: hidden; color: var(--muted); font-size: 12px; font-weight: 700; text-align: center; text-overflow: ellipsis; white-space: nowrap; direction: rtl; }
.calendar-cell {
  min-width: 0;
  min-height: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 8px 3px 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}
button.calendar-cell { cursor: pointer; touch-action: manipulation; }
.calendar-cell.placeholder { visibility: hidden; }
.calendar-cell.empty { border-color: #edf1f1; background: #fbfcfc; }
.calendar-cell.past { opacity: .52; }
.calendar-cell.off { background: #fafbfb; }
.calendar-cell.today { border-color: var(--yz-warning); box-shadow: inset 0 0 0 1px rgba(139, 94, 21, .26); }
.calendar-cell.selected { border-color: var(--yz-primary); background: var(--yz-accent); box-shadow: 0 0 0 2px var(--yz-focus), inset 0 -3px var(--yz-primary); opacity: 1; transform: translateY(-1px); }
.calendar-cell.selected .calendar-day-number {
  color: var(--yz-text);
  opacity: 1;
  visibility: visible;
  -webkit-text-fill-color: currentColor;
}
.calendar-cell.disabled { cursor: default; }
.calendar-day-number { color: #526a70; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.calendar-shift { min-width: 30px; min-height: 29px; display: grid; place-items: center; padding: 2px 5px; border: 1px solid transparent; border-radius: 9px; color: var(--teal); background: var(--mint); font-size: 13px; font-weight: 700; line-height: 1; }
.calendar-cell.empty .calendar-shift { visibility: hidden; }
.calendar-shift.tone-M { color: var(--yz-shift-m); background: var(--yz-shift-m-soft); border-color: var(--yz-shift-m-border); }
.calendar-shift.tone-E,
.calendar-shift.tone-OL-E { color: var(--yz-shift-e); background: var(--yz-shift-e-soft); border-color: var(--yz-shift-e-border); }
.calendar-shift.tone-N,
.calendar-shift.tone-OL-N { color: var(--yz-shift-n); background: var(--yz-shift-n-soft); border-color: var(--yz-shift-n-border); }
.calendar-shift.tone-O { color: #fff; background: #000; border-color: #333; }
.calendar-shift.tone-AL { color: #fff; background: #1e5aa8; border-color: #2e75b6; }
.calendar-shift.tone-SL { color: #fff; background: #6aa84f; border-color: #38761d; }
.calendar-shift.tone-SR { color: #fff; background: #1155cc; border-color: #0b3d91; }
.calendar-shift.tone-AC { color: #fff; background: #6a329f; border-color: #351c75; }
.calendar-shift.tone-ABSENCE { color: #fff; background: #cc0000; border-color: #990000; }
.calendar-shift.tone-EXT { color: #3b1f00; background: #f6b26b; border-color: #e69138; }
.calendar-shift.tone-CL, .calendar-shift.tone-MCA { color: #0d665d; background: #dff3ed; border-color: #8cc9ba; }
.calendar-shift.tone-ADMIN, .calendar-shift.tone-PHCA { color: #24455f; background: #e5f1fb; border-color: #a8c8df; }
.calendar-shift.tone-EOR, .calendar-shift.tone-XTR, .calendar-shift.tone-NH,
.calendar-shift.tone-HJ, .calendar-shift.tone-OC, .calendar-shift.tone-EL,
.calendar-shift.tone-DL { color: #173f43; background: #eef3f2; border-color: #c3d3d0; }
.calendar-shift.tone-OTHER { color: #173f43; background: #e5f1ee; border-color: #b9d4ce; }
.calendar-legend .calendar-shift { min-width: 27px; min-height: 25px; font-size: 12px; }
.shift-calendar-host.compact { gap: 12px; }
.shift-calendar-host.compact .shift-calendar { padding: 10px; }
.shift-calendar-host.compact .calendar-cell { min-height: 62px; }
.shift-badge { min-width: 44px; height: 38px; display: grid; place-items: center; padding: 0 8px; border-radius: 11px; font-size: 14px; font-weight: 700; }
.shift-badge.M { color: #74520d; background: #fff1bd; }
.shift-badge.E { color: #176654; background: #dff4ee; }
.shift-badge.N { color: #285481; background: #e2eefb; }
.shift-badge.O { color: #647277; background: #edf1f1; }

.team-banner { padding: 18px; border-radius: var(--radius); color: #fff; background: var(--navy); }
.team-directory-card > .primary-button { margin-top: 18px; }
.roster-group { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.roster-group > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.roster-group > header > span { display: flex; align-items: center; gap: 8px; color: var(--teal); }
.roster-group > header svg { width: 24px; height: 24px; }
.roster-group > header strong { font-size: 17px; }
.roster-group > header b { min-width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: var(--teal); background: var(--mint); font-size: 13px; }
.roster-group .doctor-list { margin-top: 0; }
.roster-group-note { margin: -2px 0 12px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.overlap-doctors { border-top-style: dashed; }
.overlap-doctors .team-status { color: #6b5a27; }
.team-category-list { display: grid; }
.team-person {
  width: 100%;
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-inline-start-width: 4px;
  border-radius: 13px;
  color: inherit;
  background: var(--surface-2);
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.team-person + .team-person { margin-top: 8px; }
.team-person:active { transform: scale(.985); }
.team-person:hover { box-shadow: 0 7px 18px rgba(18, 59, 93, .08); }
.team-person > span:nth-child(2) { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.team-person strong { font-size: 15px; }
.team-person small { color: var(--muted); font-size: 13px; }
.team-person > b { color: var(--muted); font-size: 12px; }
.roster-group.volunteers > header > span, .roster-group.volunteers .team-person { color: #087b46; }
.roster-group.interns > header > span, .roster-group.interns .team-person { color: #294c8f; }
.roster-group.students > header > span, .roster-group.students .team-person { color: #3b5ceb; }
.roster-group.volunteers .team-person { border-inline-start-color: #12a15e; }
.roster-group.interns .team-person { border-inline-start-color: #294c8f; }
.roster-group.students .team-person { border-inline-start-color: #3b5ceb; }
.team-person .mini-avatar.volunteers { background: #0e9760; }
.team-person .mini-avatar.interns { background: #294c8f; }
.team-person .mini-avatar.students { background: #3b5ceb; }
.roster-empty { margin: 0; padding: 13px; border-radius: 12px; color: var(--muted); background: var(--surface-2); font-size: 14px; }

.attendance-stats, .document-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.attendance-stats.loading { opacity: .42; }
.attendance-stats > span, .document-stats > span { min-height: 72px; display: flex; flex-direction: column; justify-content: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.attendance-stats small, .document-stats small { color: var(--muted); font-size: 13px; }
.attendance-stats b, .document-stats b { margin-top: 2px; font-size: 23px; line-height: 1.2; }
.attendance-date-card { margin-bottom: 14px; padding: 16px; overflow: hidden; }
.attendance-date-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.attendance-date-head > div { min-width: 0; }
.attendance-date-head span { color: var(--teal); font-size: 12px; font-weight: 800; }
.attendance-date-head h3 { margin: 2px 0; color: var(--navy); font-size: 20px; }
.attendance-date-head p { margin: 0; color: var(--muted); font-size: 13px; }
.attendance-date-head .outline-button { min-width: 70px; }
.attendance-date-nav { display: grid; grid-template-columns: minmax(76px, auto) 1fr minmax(76px, auto); align-items: center; gap: 8px; margin-bottom: 10px; }
.attendance-date-nav > strong { color: var(--navy); font-size: 15px; text-align: center; }
.attendance-date-nav button { min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 11px; color: var(--navy); background: var(--surface-2); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.attendance-date-nav button span { font-size: 22px; font-weight: 400; line-height: 1; }
.attendance-date-nav button:disabled { opacity: .38; cursor: default; }
.attendance-calendar { padding: 10px; border: 1px solid var(--yz-border); border-radius: 16px; background: var(--yz-card); }
.attendance-calendar-weekdays, .attendance-calendar-days {
  direction: ltr;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}
.attendance-calendar-weekdays { margin-bottom: 5px; }
.attendance-calendar-weekdays span { padding-block: 4px; color: var(--muted); font-size: 11px; font-weight: 700; text-align: center; direction: rtl; }
.attendance-calendar-day { position: relative; min-width: 0; min-height: 44px; display: grid; place-items: center; padding: 3px; border: 1px solid transparent; border-radius: 10px; color: var(--yz-text); background: var(--yz-card); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.attendance-calendar-day::after { position: absolute; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: transparent; content: ""; }
.attendance-calendar-day.today::after { background: var(--gold); }
.attendance-calendar-day.selected {
  color: var(--yz-on-primary);
  border-color: var(--yz-primary);
  background: var(--yz-primary);
  box-shadow: 0 7px 15px rgba(32, 117, 182, .2), inset 0 0 0 1px rgba(255, 255, 255, .16);
  font-weight: 800;
  opacity: 1;
  text-shadow: none;
  -webkit-text-fill-color: var(--yz-on-primary);
}
.attendance-calendar-day.selected::after { background: var(--gold); }
.attendance-calendar-day:disabled { color: var(--yz-muted-text); background: var(--yz-muted); cursor: default; opacity: .58; }
.attendance-calendar-blank { min-height: 44px; }
.attendance-toolbar { display: grid; gap: 12px; margin-bottom: 14px; }
.attendance-controls-card { margin-bottom: 14px; }
.attendance-groups { display: grid; gap: 14px; }
.attendance-groups.loading { opacity: .48; pointer-events: none; }
.attendance-group-card { position: relative; overflow: hidden; }
.attendance-group-card::before { position: absolute; inset: 0 0 auto; height: 4px; content: ""; }
.current-shift-card::before { background: linear-gradient(90deg, var(--teal), var(--brand-sky), var(--brand-aqua)); }
.rest-day-card::before { background: linear-gradient(90deg, var(--navy), #d7b95c); }
.attendance-group-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 15px; padding-top: 3px; }
.attendance-group-head > div { min-width: 0; }
.attendance-group-head span { color: var(--teal); font-size: 12px; font-weight: 700; }
.attendance-group-head h3 { margin: 2px 0 2px; font-size: 19px; }
.attendance-group-head p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.attendance-group-head > b { min-width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; color: var(--teal); background: var(--mint); font-size: 16px; }
.rest-day-card .attendance-group-head > b { color: var(--navy); background: var(--gold-soft); }
.tabs, .subnav { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar, .subnav::-webkit-scrollbar { display: none; }
.tabs button, .subnav button {
  min-height: 44px;
  flex: 0 0 auto;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.tabs button.active, .subnav button.active { border-color: var(--navy); color: #fff; background: var(--navy); }
.subnav { margin-bottom: 16px; }
.subnav b { min-width: 20px; display: inline-grid; place-items: center; margin-inline-start: 5px; padding: 0 5px; border-radius: 999px; color: var(--navy); background: #fff; font-size: 11px; }
.attendance-bulk {
  position: sticky;
  z-index: 8;
  top: 72px;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 9px;
  border: 1px solid #b9ddea;
  border-radius: 14px;
  background: rgba(246, 251, 254, .97);
  box-shadow: 0 8px 20px rgba(18, 59, 93, .08);
  backdrop-filter: blur(8px);
}
.attendance-bulk > span { min-width: 58px; display: flex; align-items: baseline; justify-content: center; gap: 4px; color: var(--teal); }
.attendance-bulk > span b { font-size: 20px; }
.attendance-bulk > span small { font-size: 12px; font-weight: 700; }
.attendance-bulk button { min-height: 44px; }
.attendance-bulk .primary-button { width: 100%; }
.select-visible-button { padding: 8px 10px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: #fff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.select-visible-button:disabled { opacity: .45; cursor: default; }
.attendance-sync-queue { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 11px 12px; border-radius: 13px; color: #285481; background: #edf5fd; }
.attendance-sync-queue > i { width: 18px; height: 18px; flex: 0 0 auto; border: 2px solid #bad2e8; border-top-color: #285481; border-radius: 50%; animation: spin .8s linear infinite; }
.attendance-sync-queue > span { display: flex; flex-direction: column; }
.attendance-sync-queue strong { font-size: 14px; }
.attendance-sync-queue small { color: #4e6b86; font-size: 12px; }
.attendance-list, .request-list, .document-list { display: grid; gap: 14px; }
.attendance-shift-block {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
}
.attendance-shift-block > header {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border-bottom: 1px solid currentColor;
}
.attendance-shift-block.tone-M > header { color: var(--yz-shift-m); background: var(--yz-shift-m-soft); border-color: var(--yz-shift-m-border); }
.attendance-shift-block.tone-E > header,
.attendance-shift-block.tone-OL-E > header { color: var(--yz-shift-e); background: var(--yz-shift-e-soft); border-color: var(--yz-shift-e-border); }
.attendance-shift-block.tone-N > header,
.attendance-shift-block.tone-OL-N > header { color: var(--yz-shift-n); background: var(--yz-shift-n-soft); border-color: var(--yz-shift-n-border); }
.attendance-shift-block.tone-OTHER > header { color: #31565c; background: #e5f1ee; border-color: #b9d4ce; }
.attendance-shift-identity { min-width: 0; display: grid; grid-template-columns: 38px auto; align-items: center; column-gap: 10px; }
.attendance-shift-identity > b {
  width: 38px;
  height: 38px;
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 11px;
  background: rgba(255, 255, 255, .72);
  font-size: 16px;
}
.attendance-shift-identity > span { align-self: end; font-size: 16px; font-weight: 800; }
.attendance-shift-identity > small { align-self: start; opacity: .75; font-size: 12px; font-weight: 600; direction: ltr; text-align: right; }
.attendance-shift-count {
  min-width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, .75);
  font-size: 14px;
}
.attendance-category-group { padding: 13px; }
.attendance-category-group + .attendance-category-group { border-top: 1px solid #e5ecee; }
.attendance-category-group > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.attendance-category-group > header > b { min-width: 28px; color: var(--muted); text-align: center; font-size: 13px; }
.attendance-category-label { width: fit-content; display: inline-flex; align-items: center; gap: 7px; font-size: 14px; }
.attendance-category-label svg { width: 18px; height: 18px; }
.attendance-category-label.mint { color: #087b46; }
.attendance-category-label.blue { color: #294c8f; }
.attendance-category-label.violet { color: #3b5ceb; }
.attendance-category-list { display: grid; gap: 10px; }
.attendance-person {
  padding: 15px;
  border: 1px solid var(--line);
  border-inline-start-width: 4px;
  border-radius: 15px;
  background: var(--surface-2);
}
.attendance-person.arrival-highlight,
.attendance-category-group.arrival-highlight,
.attendance-shift-block.arrival-highlight {
  animation: attendance-arrival 1.7s ease both;
  scroll-margin-block: 110px;
}
@keyframes attendance-arrival {
  0%, 100% { box-shadow: none; }
  22%, 72% { box-shadow: 0 0 0 4px rgba(8, 120, 168, .2), 0 12px 28px rgba(18, 59, 93, .12); }
}
.attendance-person.selected { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(8,120,168,.13); }
.attendance-person.approved { border-color: #a6d7ca; background: #f1faf7; }
.attendance-person.incomplete { border-color: #ead098; background: #fffbef; }
.attendance-person.locked { border-color: #d6dfe1; background: #f7f9f9; }
.attendance-person.syncing { border-color: #a9c7e3; background: #f2f7fd; }
.attendance-person.sync-failed { border-color: #e3aeb5; background: #fff7f8; }
.attendance-person[data-category="volunteers"] { border-inline-start-color: #12a15e; }
.attendance-person[data-category="interns"] { border-inline-start-color: #294c8f; }
.attendance-person[data-category="students"] { border-inline-start-color: #3b5ceb; }
.attendance-person > header { display: flex; align-items: center; gap: 10px; }
.attendance-selector { position: relative; width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 auto; cursor: pointer; }
.attendance-selector input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.attendance-selector span { width: 30px; height: 30px; display: grid; place-items: center; border: 2px solid #aec0c3; border-radius: 9px; color: #fff; background: #fff; font-size: 16px; font-weight: 700; transition: .18s ease; }
.attendance-selector input:checked + span::after { content: "✓"; line-height: 1; }
.attendance-person[data-category="volunteers"] .attendance-selector input:checked + span { border-color: #12a15e; background: #12a15e; transform: scale(1.05); }
.attendance-person[data-category="interns"] .attendance-selector input:checked + span { border-color: #294c8f; background: #294c8f; transform: scale(1.05); }
.attendance-person[data-category="students"] .attendance-selector input:checked + span { border-color: #3b5ceb; background: #3b5ceb; transform: scale(1.05); }
.attendance-selector input:focus-visible + span { outline: 3px solid rgba(8,120,168,.22); outline-offset: 2px; }
.person-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.person-copy strong { font-size: 16px; }
.person-copy small { color: var(--muted); font-size: 13px; }
.category-pill, .row-status, .event-pill {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.category-pill.mint { color: #087b46; background: #e5f6ed; }
.category-pill.blue { color: #294c8f; background: #eaf0fb; }
.category-pill.violet { color: #3b5ceb; background: #edf0ff; }
.category-pill svg { width: 16px; height: 16px; }
.row-status.pending { color: var(--teal); background: var(--mint); }
.row-status.approved { color: #fff; background: var(--success); }
.row-status.incomplete { color: var(--warning); background: var(--warning-soft); }
.row-status.locked { color: #52656a; background: #e8edef; }
.row-status.denied { color: var(--danger); background: var(--danger-soft); }
.row-status.syncing { color: #285481; background: #e2eefb; }
.row-status.sync-failed { color: var(--danger); background: var(--danger-soft); }
.row-status.absence { color: #991b1b; background: #fee2e2; }
.attendance-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 13px 0; }
.attendance-meta span { min-width: 0; display: flex; flex-direction: column; padding: 9px; border-radius: 10px; background: #fff; text-align: center; }
.attendance-meta small { color: var(--muted); font-size: 13px; }
.attendance-meta b { font-size: 14px; font-variant-numeric: tabular-nums; }
.attendance-events { display: grid; gap: 7px; margin-bottom: 12px; }
.early-event { padding: 10px; border-radius: 11px; color: #6d5118; background: var(--gold-soft); font-size: 13px; }
.early-event strong { display: block; }
.attendance-sync-error { margin-bottom: 12px; padding: 9px 10px; border-radius: 10px; color: var(--danger); background: var(--danger-soft); font-size: 13px; }
.attendance-time-lock {
    min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 9px 10px;
  border-radius: 10px;
  color: #52656a;
  background: #e8edef;
  font-size: 13px;
  font-weight: 600;
}
.attendance-time-lock svg { width: 18px; height: 18px; flex: 0 0 auto; }
.attendance-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
.attendance-actions button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 11px; font-size: 14px; font-weight: 700; cursor: pointer; }
.attendance-actions button svg { width: 18px; height: 18px; }
.attendance-actions button:disabled { border-color: #d8e0e2; color: #75868a; background: #edf1f2; cursor: not-allowed; opacity: .82; }
.attendance-absence-note { margin-top: 10px; padding: 9px 11px; border: 1px solid #fecaca; border-radius: 10px; color: #991b1b; background: #fff1f2; font-size: 13px; font-weight: 700; }
.approve-button { border: 1px solid var(--teal); color: #fff; background: var(--teal); }
.override-button { border: 1px solid #d7b05b; color: #6d4e0e; background: var(--warning-soft); }
.early-button { border: 1px solid var(--line); color: var(--ink); background: #fff; }
.revoke-button { border: 1px solid #e7c8cc; color: var(--danger); background: #fff; }

.swap-panel { display: none; }
.swap-panel.active { display: block; }
.swap-flow { display: grid; gap: 14px; }
.swap-step, .swap-summary { scroll-margin-top: 92px; }
.swap-step > header { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.swap-step > header > b { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; color: #fff; background: var(--teal); }
.swap-step.step-arrived, .swap-summary.step-arrived { border-color: #77bfdc; box-shadow: 0 0 0 3px rgba(8,120,168,.12), var(--shadow); }
.choice-grid { display: grid; gap: 9px; }
.choice-grid button {
  min-height: 74px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  text-align: right;
  cursor: pointer;
}
.choice-grid button.active { border-color: var(--teal); background: var(--mint); box-shadow: 0 0 0 2px rgba(8, 120, 168, .08); }
.choice-grid strong { font-size: 15px; }
.choice-grid small { color: var(--muted); font-size: 13px; }
.search-field, .upload-panel label { display: grid; gap: 6px; }
.search-field > span, .upload-panel label > span { font-size: 13px; font-weight: 700; }
.search-field input, .upload-panel input, .upload-panel select, .modal-card input, .modal-card textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: #fff;
  font-size: 16px;
  outline: none;
}
.selectable-list { display: grid; gap: 8px; max-height: 360px; overflow-y: auto; overscroll-behavior: contain; }
.selectable-card {
  width: 100%;
  min-height: 66px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
  text-align: right;
  cursor: pointer;
}
.selectable-card.selected { border-color: var(--teal); background: var(--mint); box-shadow: inset 4px 0 var(--teal); }
.selectable-card > span { min-width: 0; display: flex; flex-direction: column; }
.selectable-card strong { font-size: 15px; }
.selectable-card small { color: var(--muted); font-size: 13px; }
.swap-summary-body { display: grid; gap: 8px; margin: 14px 0; }
.swap-compare { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 7px; }
.swap-side { min-width: 0; padding: 11px; border-radius: 12px; background: var(--surface-2); }
.swap-side small { color: var(--muted); font-size: 13px; }
.swap-side strong { display: block; margin-top: 3px; font-size: 14px; }
.swap-arrow { color: var(--teal); font-weight: 700; }
.request-card { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: var(--shadow); }
.request-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.request-card h3 { margin: 0; font-size: 16px; }
.request-card p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.request-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.request-detail > div { padding: 10px; border-radius: 11px; background: var(--surface-2); }
.request-detail small { color: var(--muted); font-size: 13px; }
.request-detail strong { display: block; font-size: 13px; }
.request-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.request-actions button { min-height: 46px; border-radius: 11px; font-size: 14px; font-weight: 700; cursor: pointer; }
.request-actions .accept { border: 1px solid var(--teal); color: #fff; background: var(--teal); }
.request-actions .reject { border: 1px solid #e8c8cc; color: var(--danger); background: #fff; }
.status-chip { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.status-chip.pending { color: var(--warning); background: var(--warning-soft); }
.status-chip.approved { color: var(--success); background: var(--success-soft); }
.status-chip.rejected { color: var(--danger); background: var(--danger-soft); }

.profile-hero { display: flex; align-items: center; gap: 14px; }
.profile-hero > div { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.profile-hero small { color: var(--teal); font-size: 13px; font-weight: 700; }
.profile-hero h2 { margin: 2px 0; font-size: 21px; }
.profile-hero p { margin: 0; color: var(--muted); font-size: 14px; }
.profile-grid { margin-top: 14px; }
.profile-item { min-height: 78px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.profile-item span { display: block; color: var(--muted); font-size: 13px; }
.profile-item strong { display: block; margin-top: 4px; overflow-wrap: anywhere; font-size: 15px; }
.profile-item .profile-national-id {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.profile-info { margin-top: 14px; }
.profile-info h3 { margin: 0 0 12px; font-size: 17px; }
.permission-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.permission-tags span { padding: 7px 9px; border-radius: 999px; color: #2e675d; background: var(--mint); font-size: 13px; }

.profile-completion { margin-top: 14px; padding: 18px; }
.profile-completion > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.profile-completion h3 { margin: 2px 0 3px; font-size: 18px; }
.profile-completion p { margin: 0; color: var(--muted); font-size: 13px; }
.completion-percent {
  min-width: 70px;
  padding: 8px 10px;
  border-radius: 14px;
  color: var(--teal-dark);
  background: var(--mint);
  font-size: 25px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.document-readiness-rail { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; margin: 18px 0 15px; }
.document-readiness-rail span { min-width: 0; height: 10px; border-radius: 999px; background: #dfe8e7; }
.document-readiness-rail span.approved { background: var(--success); }
.document-readiness-rail span.pending { background: var(--gold); }
.document-readiness-rail span.rejected, .document-readiness-rail span.expired { background: var(--danger); }
.document-readiness-rail span.missing { background: #dfe8e7; box-shadow: inset 0 0 0 1px #c6d5d3; }
.completion-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.completion-metrics span { min-width: 0; padding: 10px; border-radius: 12px; background: var(--surface-2); text-align: center; }
.completion-metrics small { display: block; color: var(--muted); font-size: 12px; }
.completion-metrics b { display: block; margin-top: 2px; font-size: 18px; font-variant-numeric: tabular-nums; }
.profile-missing-docs { display: flex; flex-wrap: wrap; gap: 6px; margin: 13px 0; }
.profile-missing-docs:empty { display: none; }
.profile-missing-docs span { padding: 6px 8px; border-radius: 999px; color: #8a4c16; background: var(--warning-soft); font-size: 12px; font-weight: 700; }

.document-card { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: var(--shadow); }
.document-card.missing { border-style: dashed; box-shadow: none; }
.document-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.document-card h3 { margin: 0; font-size: 16px; }
.document-card p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.document-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.document-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.document-actions a, .document-actions button { min-height: 44px; display: grid; place-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 11px; background: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.upload-panel { margin-top: 16px; }
.upload-panel form { display: grid; gap: 14px; margin-top: 16px; }
.upload-panel label small { color: var(--muted); font-size: 13px; }
.file-field input { padding: 9px; }
.upload-progress { display: grid; gap: 7px; }
.upload-progress > i { height: 8px; overflow: hidden; border-radius: 999px; background: #e5eeee; }
.upload-progress > i span { display: block; width: 20%; height: 100%; border-radius: inherit; background: var(--teal); transition: width .25s ease; }
.upload-progress b { color: var(--muted); font-size: 13px; }
.form-message { padding: 11px; border-radius: 11px; font-size: 14px; font-weight: 600; }
.form-message.good { color: var(--success); background: var(--success-soft); }
.form-message.bad { color: var(--danger); background: var(--danger-soft); }

.staff-file-overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 14px; }
.staff-file-overview article { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: var(--shadow); }
.staff-file-overview small { display: block; color: var(--muted); font-size: 12px; }
.staff-file-overview strong { display: block; margin-top: 4px; color: var(--navy); font-size: 24px; font-variant-numeric: tabular-nums; }
.staff-files-panel { padding: 16px; }
.staff-files-toolbar { display: grid; gap: 10px; margin-bottom: 16px; }
.staff-files-toolbar .outline-button { width: 100%; }
.staff-file-list { display: grid; gap: 10px; }
.staff-file-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--warning);
  border-radius: 15px;
  background: #fff;
}
.staff-file-card.complete { border-inline-start-color: var(--success); }
.staff-file-card.action { border-inline-start-color: var(--danger); }
.staff-file-toggle {
  width: 100%;
  min-height: 88px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 0;
  color: var(--ink);
  background: #fff;
  text-align: right;
  cursor: pointer;
}
.staff-file-toggle:hover { background: #fbfdfd; }
.staff-file-heading { min-width: 0; }
.staff-file-heading strong { display: block; overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.staff-file-heading small { display: block; margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.staff-file-heading p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.staff-file-score { min-width: 56px; height: 56px; display: grid; place-items: center; border-radius: 16px; color: var(--teal-dark); background: var(--mint); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.staff-file-card.action .staff-file-score { color: var(--danger); background: var(--danger-soft); }
.staff-file-card .document-readiness-rail { margin: 0 14px 14px; }
.admin-staff-upload { margin-bottom:14px; padding:18px; border-color:#bae6fd; background:linear-gradient(145deg,#fff 0%,#f0f9ff 100%); }
.admin-staff-upload[hidden] { display:none; }
.admin-staff-upload > .section-head { margin-bottom:14px; }
.requirement-manager { margin-bottom: 14px; padding: 18px; border-color: #bae6fd; background: linear-gradient(145deg, #fff 0%, #f4fbff 100%); }
.requirement-manager[hidden], .requirement-form[hidden] { display: none; }
.requirement-manager .section-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.primary-button.compact { width: auto; min-height: 42px; padding: 9px 14px; }
.requirement-list { display: grid; gap: 9px; }
.requirement-rule { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 13px; border: 1px solid var(--line); border-inline-start: 4px solid var(--sky); border-radius: 14px; background: #fff; }
.requirement-rule.inactive { opacity: .65; border-inline-start-color: var(--muted); }
.requirement-rule strong, .requirement-rule small { display: block; }
.requirement-rule small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.requirement-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.requirement-badges span { padding: 4px 8px; border-radius: 999px; color: var(--teal-dark); background: var(--mint); font-size: 11px; font-weight: 700; }
.requirement-badges span.optional { color: #4b5563; background: #eef2f3; }
.requirement-rule button { min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--navy); background: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.requirement-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.requirement-choice { min-height: 72px; display: flex !important; flex-direction: row !important; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; cursor: pointer; }
.requirement-choice input { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--sky); }
.requirement-choice strong, .requirement-choice small { display: block; }
.requirement-choice small { margin-top: 3px; color: var(--muted); }
.requirement-form-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.ai-review-result { grid-column: 1 / -1; padding: 11px; border: 1px solid #bae6fd; border-radius: 12px; background: #f0f9ff; }
.ai-review-result header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px; }
.ai-review-result strong { color: var(--navy); }
.ai-review-result b { padding: 4px 8px; border-radius: 999px; color: var(--teal-dark); background: var(--mint); font-size: 11px; }
.ai-review-result p { margin: 7px 0 0; color: var(--ink); font-size: 13px; line-height: 1.65; }
.ai-review-result small { display: block; margin-top: 6px; color: var(--muted); }
.staff-file-detail { padding: 0 14px 14px; border-top: 1px solid var(--line); }
.staff-file-detail[hidden] { display: none; }
.staff-file-detail > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 0; }
.staff-file-detail > header strong { font-size: 14px; }
.staff-file-detail > header span { color: var(--muted); font-size: 12px; }
.staff-document-grid { display: grid; gap: 7px; }
.staff-document-item {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
}
.staff-document-item > span { min-width: 0; }
.staff-document-item strong { display: block; font-size: 13px; }
.staff-document-item small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.staff-document-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.staff-document-actions > b, .staff-document-actions > a, .staff-document-actions > button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border: 0;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.staff-document-actions > b { color: var(--muted); background: #fff; }
.staff-document-actions > a { color: var(--success); background: var(--success-soft); }
.staff-document-actions > button { color: #164e63; background: #e0f2fe; cursor: pointer; }
.staff-document-item.pending .staff-document-actions > b { color: #8a5b13; background: var(--warning-soft); }
.staff-document-item.rejected .staff-document-actions > b,
.staff-document-item.expired .staff-document-actions > b { color: var(--danger); background: var(--danger-soft); }

.information-hero { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; margin-bottom: 16px; padding: 22px; border-radius: var(--radius); color: #fff; background: var(--navy); }
.information-hero span { color: #91d7c7; font-size: 13px; font-weight: 700; }
.information-hero h2 { margin: 3px 0; font-size: 25px; }
.information-hero p { margin: 0; color: #c9d9dc; font-size: 14px; }
.information-hero > svg { width: 56px; height: 56px; padding: 13px; border: 1px solid rgba(255,255,255,.16); border-radius: 16px; color: #9edccd; }
.resource-grid { display: grid; gap: 12px; }
.resource-card { min-height: 94px; display: flex; align-items: center; gap: 13px; padding: 16px; text-align: right; cursor: pointer; }
button.resource-card { width: 100%; color: inherit; }
.resource-card > svg { width: 44px; height: 44px; flex: 0 0 auto; padding: 10px; border-radius: 13px; color: var(--teal); background: var(--mint); }
.resource-card > span { display: flex; flex-direction: column; }
.resource-card strong { font-size: 16px; }
.resource-card small { color: var(--muted); font-size: 13px; }

.doctor-directory header { display: grid; gap: 11px; }
.doctor-directory h3 { margin: 0; font-size: 18px; }
#permissionDoctorList { display: grid; gap: 7px; max-height: 540px; margin-top: 13px; overflow-y: auto; }
.directory-row { width: 100%; min-height: 62px; display: flex; align-items: center; gap: 9px; padding: 9px; border: 1px solid transparent; border-radius: 12px; background: var(--surface-2); text-align: right; cursor: pointer; }
.directory-row.active { border-color: #9bcfc3; background: var(--mint); }
.directory-row > span:nth-child(2) { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.directory-row strong { font-size: 14px; }
.directory-row small { color: var(--muted); font-size: 13px; }
.editor-person { display: flex; align-items: center; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.editor-person > div { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.editor-person strong { font-size: 16px; }
.editor-person small { color: var(--muted); font-size: 13px; }
.version-chip { padding: 5px 8px; border-radius: 999px; color: var(--muted); background: var(--surface-2); font-size: 13px; }
.permission-group { margin-top: 16px; }
.permission-group > span { color: var(--teal); font-size: 13px; font-weight: 700; }
.permission-options { display: grid; gap: 8px; margin-top: 9px; }
.permission-option { min-height: 64px; display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.permission-option input { width: 21px; height: 21px; accent-color: var(--teal); }
.permission-option span { display: flex; flex-direction: column; }
.permission-option strong { font-size: 14px; }
.permission-option small { color: var(--muted); font-size: 13px; }
.permission-option.disabled { opacity: .48; cursor: not-allowed; }

.audit-toolbar { display: grid; gap: 10px; margin-bottom: 16px; }
.select-field { display: grid; gap: 5px; }
.select-field > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.select-field select { width: 100%; min-height: 46px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff; }
.audit-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.audit-stats > span { min-width: 0; display: flex; flex-direction: column; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.audit-stats small { color: var(--muted); font-size: 12px; }
.audit-stats b { font-size: 21px; }
.audit-list { display: grid; gap: 10px; }
.audit-entry { position: relative; padding: 14px; border: 1px solid var(--line); border-inline-start-width: 4px; border-radius: 14px; background: var(--surface-2); }
.audit-entry.attendance { border-inline-start-color: var(--teal); }
.audit-entry.early { border-inline-start-color: var(--gold); }
.audit-entry.permissions { border-inline-start-color: var(--blue); }
.audit-entry > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.audit-entry > header > div { min-width: 0; }
.audit-entry h3 { margin: 0; font-size: 16px; }
.audit-entry header p { margin: 3px 0 0; color: var(--ink); font-size: 14px; font-weight: 700; }
.audit-entry .audit-actor { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.audit-type { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; color: var(--teal); background: var(--mint); font-size: 11px; font-weight: 700; }
.audit-entry.early .audit-type { color: #805912; background: var(--gold-soft); }
.audit-entry.permissions .audit-type { color: #315c83; background: #eaf2fb; }
.audit-details { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.audit-details span { padding: 5px 8px; border-radius: 8px; color: #465f64; background: #fff; font-size: 12px; }
.audit-reason { margin: 10px 0 0; padding: 9px 10px; border-radius: 10px; color: #5f4b21; background: #fff8e8; font-size: 13px; }
.editor-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.editor-actions small { color: var(--muted); font-size: 13px; }
.access-denied, .empty-state { display: flex; flex-direction: column; align-items: center; padding: 48px 16px; text-align: center; }
.access-denied > b { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; color: var(--danger); background: var(--danger-soft); font-size: 22px; }
.empty-state > svg { width: 48px; height: 48px; padding: 11px; border-radius: 14px; color: var(--teal); background: var(--mint); }
.access-denied h2, .empty-state strong { margin: 13px 0 4px; font-size: 18px; }
.access-denied p, .empty-state p { max-width: 480px; margin: 0; color: var(--muted); font-size: 14px; }
.empty-state.compact { padding: 34px 12px; }
.empty-inline { padding: 18px; border-radius: 12px; color: var(--muted); background: var(--surface-2); font-size: 14px; text-align: center; }

.view-loading { min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 14px; }
.view-loading i { width: 32px; height: 32px; border: 3px solid var(--mint-2); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
.swap-target-loading { min-height: 180px; border: 1px dashed #c9dad7; border-radius: 14px; background: var(--surface-2); }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton-row { min-height: 58px; border-radius: 12px; background: linear-gradient(90deg, #edf2f1 25%, #f8faf9 45%, #edf2f1 65%); background-size: 240% 100%; animation: shimmer 1.3s ease infinite; }
.skeleton-value { position: relative; overflow: hidden; }
.skeleton-value::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.72), transparent); transform: translateX(-100%); animation: shimmer-move 1.2s infinite; }
@keyframes shimmer { to { background-position: -240% 0; } }
@keyframes shimmer-move { to { transform: translateX(100%); } }

.app-footer { display: none; }
.mobile-nav {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  height: calc(68px + var(--safe-bottom));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 5px 6px var(--safe-bottom);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 -10px 28px rgba(10, 46, 54, .09);
  backdrop-filter: blur(16px);
}
.mobile-nav a, .mobile-nav button { position: relative; min-width: 0; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 3px; border: 0; color: #71858a; background: transparent; cursor: pointer; }
.mobile-nav svg { width: 23px; height: 23px; }
.mobile-nav small { font-size: 13px; font-weight: 600; }
.mobile-nav .active { color: var(--teal); }
.mobile-nav b { position: absolute; top: 1px; left: 18%; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; border: 2px solid #fff; border-radius: 999px; color: #fff; background: var(--danger); font-size: 10px; }

.sheet-backdrop { position: fixed; z-index: 70; inset: 0; background: rgba(5, 31, 38, .58); }
.more-sheet {
  position: fixed;
  z-index: 75;
  right: 0;
  bottom: 0;
  left: 0;
  height: min(92dvh, 780px);
  max-height: 780px;
  display: flex;
  flex-direction: column;
  padding: 16px 16px calc(16px + var(--safe-bottom));
  border-radius: 24px 24px 0 0;
  background: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateY(110%);
  transition: transform .22s ease;
}
.more-sheet.open { transform: translateY(0); }
.more-sheet > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.more-sheet > header > div { display: flex; align-items: center; gap: 10px; }
.more-sheet > header img { width: 48px; height: 48px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 13px; object-fit: contain; }
.more-sheet > header span:last-child { display: flex; flex-direction: column; }
.more-sheet > header small { color: var(--muted); font-size: 13px; }
.more-sheet > header button { width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--surface-2); font-size: 25px; cursor: pointer; }
.more-scroll { min-height: 0; overflow-y: auto; padding: 2px 1px 12px; overscroll-behavior: contain; }
.more-group { margin-top: 15px; }
.more-group h3 { margin: 0 2px 7px; color: var(--muted); font-size: 13px; }
.more-sheet nav { display: grid; gap: 8px; margin: 0; }
.more-sheet nav button, .more-sheet nav a { min-height: 68px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; font-size: 14px; font-weight: 700; text-align: right; cursor: pointer; }
.more-sheet nav svg { width: 24px; height: 24px; color: var(--teal); }
.more-sheet nav span { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.more-sheet nav span small { color: var(--muted); font-size: 12px; font-weight: 500; }
.more-sheet nav > button > b, .more-sheet nav > a > b { color: var(--teal); font-size: 22px; font-weight: 400; }
.logout-sheet { width: 100%; min-height: 48px; flex: 0 0 auto; margin-top: 8px; border: 1px solid #ebcdd1; border-radius: 12px; color: var(--danger); background: #fff; font-weight: 700; cursor: pointer; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; place-items: end center; padding: 14px; background: rgba(5, 29, 37, .7); backdrop-filter: blur(4px); }
.modal-card { width: min(100%, 500px); max-height: calc(100dvh - 28px); overflow-y: auto; display: flex; flex-direction: column; align-items: center; padding: 24px; border-radius: 24px; background: #fff; box-shadow: var(--shadow-lg); text-align: center; }
.modal-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; color: var(--teal); background: var(--mint); font-size: 20px; }
.modal-card h2 { margin: 13px 0 5px; font-size: 21px; }
.modal-card > p { margin: 0; color: var(--muted); font-size: 15px; }
.modal-card label { width: 100%; display: grid; gap: 6px; margin-top: 14px; text-align: right; }
.modal-card label span { font-size: 13px; font-weight: 700; }
.modal-card textarea { min-height: 96px; resize: vertical; }
.modal-card > div { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.toast { position: fixed; z-index: 130; right: 16px; bottom: calc(80px + var(--safe-bottom)); left: 16px; display: flex; align-items: center; gap: 10px; padding: 13px; border-radius: 15px; color: #fff; background: var(--navy); box-shadow: var(--shadow-lg); animation: toast-in .22s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
.toast > b { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px; color: var(--navy); background: #b7e5f1; }
.toast > div { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.toast strong { font-size: 15px; }
.toast small { color: #c4d5d8; font-size: 13px; }
.toast button { width: 42px; height: 42px; border: 0; color: #c4d5d8; background: transparent; font-size: 22px; cursor: pointer; }

@media (min-width: 560px) {
  .content { padding-inline: 22px; }
  .dashboard-grid, .profile-grid, .resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .attendance-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .document-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-backdrop { place-items: center; }
  .toast { right: auto; width: 390px; }
}

@media (min-width: 821px) {
  body { font-size: 15px; }
  .portal-shell { display: flex; }
  .sidebar {
    position: fixed;
    z-index: 50;
    top: 0;
    right: 0;
    bottom: 0;
    width: 250px;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    color: #dcebec;
    background: var(--navy);
  }
  .brand { display: flex; align-items: center; gap: 11px; padding: 0 6px 19px; border-bottom: 1px solid rgba(255,255,255,.1); }
  .brand-mark { width: 45px; height: 45px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; color: var(--navy); background: #a9dced; font-size: 17px; font-weight: 700; }
  .brand > span:last-child { display: flex; flex-direction: column; }
  .brand strong { color: #fff; font-size: 16px; }
  .brand small { color: #a2c1d2; font-size: 13px; }
  .sidebar-shift { margin: 17px 0 13px; padding: 13px; border: 1px solid rgba(255,255,255,.08); border-radius: 14px; background: rgba(255,255,255,.05); }
  .sidebar-shift > small { color: #9fc0d1; font-size: 13px; }
  .sidebar-shift > strong { display: flex; align-items: center; gap: 9px; margin-top: 7px; }
  .sidebar-shift > strong b { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: var(--navy); background: #a8dcea; }
  .sidebar-shift > strong span { color: #fff; font-size: 13px; }
  .sidebar-shift p { margin: 6px 0 0; color: #aac4d1; font-size: 13px; }
  .side-nav { display: grid; align-content: start; gap: 7px; overflow-y: auto; padding-inline: 1px 4px; }
  .side-nav a { position: relative; min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 11px; color: #bad0dc; font-size: 13px; font-weight: 600; }
  .side-nav a:hover { color: #fff; background: rgba(255,255,255,.06); }
  .side-nav a.active { color: #fff; background: rgba(58, 168, 213, .18); box-shadow: inset -3px 0 #70c2e1; }
  .side-nav svg { width: 20px; height: 20px; }
  .side-nav .nav-count { position: absolute; left: 8px; min-width: 22px; height: 22px; display: grid; place-items: center; padding: 0 5px; border-radius: 999px; color: var(--navy); background: #d9c272; font-size: 11px; }
  .side-nav-root { border: 1px solid transparent; }
  .side-nav-branch { border: 1px solid rgba(255,255,255,.08); border-radius: 13px; background: rgba(255,255,255,.025); }
  .side-nav-branch[open] { background: rgba(255,255,255,.045); }
  .side-nav-branch > summary {
    min-height: 50px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 12px;
    color: #d8e7ee;
    cursor: pointer;
    list-style: none;
  }
  .side-nav-branch > summary::-webkit-details-marker { display: none; }
  .side-nav-branch > summary:hover { color: #fff; background: rgba(255,255,255,.05); }
  .side-nav-branch > summary > svg { flex: 0 0 auto; color: #80c9e3; }
  .side-nav-branch > summary > span { min-width: 0; display: flex; flex: 1; flex-direction: column; }
  .side-nav-branch > summary strong { color: inherit; font-size: 13px; }
  .side-nav-branch > summary small { overflow: hidden; margin-top: 1px; color: #8fb0c0; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
  .side-nav-branch > summary > i { font-style: normal; font-size: 21px; line-height: 1; transition: transform .18s ease; }
  .side-nav-branch[open] > summary > i { transform: rotate(-90deg); }
  .side-nav-children {
    position: relative;
    display: grid;
    gap: 2px;
    margin: 0 13px 8px 0;
    padding-right: 13px;
    border-right: 1px solid rgba(112,194,225,.32);
  }
  .side-nav-children::before {
    position: absolute;
    top: 0;
    right: -1px;
    bottom: 13px;
    width: 1px;
    content: "";
    background: linear-gradient(#70c2e1, rgba(112,194,225,.08));
  }
  .side-nav-children a { min-height: 40px; padding: 7px 9px; font-size: 12px; }
  .side-nav-children a::before {
    position: absolute;
    top: 50%;
    right: -14px;
    width: 11px;
    height: 1px;
    content: "";
    background: rgba(112,194,225,.42);
  }
  .side-nav-children svg { width: 18px; height: 18px; }
  .side-nav-branch.admin-branch { border-color: rgba(217,194,114,.2); }
  .side-nav-branch.admin-branch > summary > svg { color: #d9c272; }
  .sidebar-profile { display: flex; align-items: center; gap: 9px; margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.1); }
  .sidebar-profile > span:nth-child(2) { min-width: 0; display: flex; flex: 1; flex-direction: column; }
  .sidebar-profile strong { overflow: hidden; color: #fff; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar-profile small { color: #a2c1d2; font-size: 13px; }
  .sidebar-profile button { min-width: 42px; height: 38px; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; color: #d3e1e3; background: transparent; font-size: 13px; cursor: pointer; }
  .app-main { width: calc(100% - 250px); margin-right: 250px; padding-bottom: 0; }
  .topbar { min-height: 76px; padding: 10px clamp(28px, 4vw, 48px); }
  .topbar h1 { font-size: 21px; }
  .topbar .sync-state { height: 36px; display: flex; align-items: center; gap: 7px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface-2); font-size: 13px; }
  .sync-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
  .sync-state.loading i { animation: pulse 1.1s infinite; }
  .sync-state.offline i { background: var(--danger); }
  @keyframes pulse { 50% { opacity: .3; transform: scale(.7); } }
  .content { padding: 28px clamp(28px, 4vw, 48px) 36px; }
  .environment-banner, .connection-message { margin-inline: clamp(28px, 4vw, 48px); }
  .live-clock { display: flex; flex-direction: column; align-items: flex-end; }
  .live-clock strong { font-size: 28px; font-variant-numeric: tabular-nums; }
  .live-clock span { color: var(--muted); font-size: 13px; }
  .dashboard-grid { grid-template-columns: 1.2fr .8fr; }
  .shift-card, .action-card, .team-card, .next-card, .overview-card, .quick-panel, .schedule-card, .team-directory-card,
  .attendance-card, .doctor-directory, .permission-editor, .profile-info, .swap-step, .swap-summary, .upload-panel, .audit-card { padding: 21px; }
  .quick-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .quick-actions button { min-height: 108px; }
  .attendance-stats, .document-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .attendance-date-card { padding: 21px; }
  .attendance-calendar-day { min-height: 48px; font-size: 14px; }
  .attendance-toolbar { display: flex; align-items: center; justify-content: space-between; }
  .attendance-person { display: grid; grid-template-columns: minmax(210px, 1.5fr) minmax(220px, 1fr) minmax(190px, auto); align-items: center; gap: 16px; }
  .attendance-person > header { min-width: 0; }
  .attendance-person .attendance-meta { margin: 0; }
  .attendance-person .attendance-side { min-width: 0; }
  .attendance-actions { grid-template-columns: repeat(2, minmax(100px, 1fr)); }
  .swap-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .swap-summary { grid-column: 1 / -1; }
  .request-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .document-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .staff-files-toolbar { grid-template-columns: minmax(260px, 1fr) minmax(190px, auto) auto; align-items: end; }
  .staff-file-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-layout { grid-template-columns: minmax(300px, .8fr) minmax(0, 1.2fr); }
  .permission-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-toolbar { grid-template-columns: minmax(260px, 1fr) minmax(190px, auto) auto; align-items: end; }
  .audit-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-footer { display: flex; justify-content: space-between; padding: 0 clamp(28px, 4vw, 48px) 24px; color: #7b8d91; font-size: 13px; }
  .mobile-nav, .more-sheet, .sheet-backdrop { display: none !important; }
  .toast { bottom: 24px; }
}

@media (min-width: 1180px) {
  .sidebar { width: 270px; }
  .app-main { width: calc(100% - 270px); margin-right: 270px; }
  .document-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 380px) {
  .topbar { padding-inline: 12px; }
  .content { padding-inline: 12px; }
  .topbar h1 { font-size: 18px; }
  .welcome-strip h2 { font-size: 23px; }
  .page-intro { flex-direction: column; }
  .page-intro > button { width: 100%; }
  .schedule-card, .swap-step { padding-inline: 10px; }
  .shift-calendar { padding: 9px; border-radius: 14px; }
  .calendar-weekdays, .calendar-days { gap: 4px; }
  .calendar-weekdays span { font-size: 11px; }
  .calendar-cell, .shift-calendar-host.compact .calendar-cell { min-height: 58px; padding-inline: 2px; border-radius: 10px; }
  .calendar-day-number { font-size: 12px; }
  .calendar-shift { min-width: 27px; min-height: 27px; font-size: 12px; }
  .attendance-date-card { padding-inline: 10px; }
  .attendance-calendar { padding: 7px; }
  .attendance-calendar-weekdays, .attendance-calendar-days { gap: 3px; }
  .attendance-calendar-day, .attendance-calendar-blank { min-height: 44px; }
  .attendance-date-nav { grid-template-columns: 70px 1fr 70px; }
  .attendance-date-nav button { padding-inline: 6px; }
  .attendance-bulk { grid-template-columns: auto 1fr; top: 70px; }
  .attendance-bulk > span { order: -1; justify-self: start; }
  .attendance-bulk .primary-button { grid-column: 1 / -1; }
  .attendance-meta { gap: 5px; }
  .attendance-meta span { padding-inline: 5px; }
  .profile-hero { flex-wrap: wrap; }
  .profile-hero .outline-button { width: 100%; }
  .profile-completion > header { align-items: center; }
  .completion-percent { min-width: 62px; font-size: 22px; }
  .staff-file-overview article { padding-inline: 10px; }
  .staff-file-overview strong { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Pull to refresh — Doctor Portal */
.yzpr-indicator {
  width: min(calc(100vw - 32px), 340px);
  min-height: 56px;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 11px;
  padding: 10px 15px;
  border-color: rgba(44, 160, 197, .3);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .98), rgba(237, 249, 252, .98));
  box-shadow:
    0 18px 48px rgba(18, 59, 93, .2),
    0 4px 12px rgba(44, 160, 197, .1),
    inset 0 1px 0 rgba(255, 255, 255, .96);
  font-family: "IBM Plex Sans Arabic", sans-serif;
}

.yzpr-spinner {
  position: relative;
  width: 32px;
  height: 32px;
  border-color: rgba(44, 160, 197, .18);
  border-top-color: var(--blue);
  border-left-color: var(--aqua);
}

.yzpr-text {
  overflow: hidden;
  color: var(--navy);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yzpr-indicator.yzpr-ready {
  border-color: transparent;
  background: linear-gradient(135deg, var(--navy), var(--blue) 58%, var(--aqua));
  box-shadow:
    0 20px 50px rgba(18, 59, 93, .32),
    0 5px 16px rgba(44, 160, 197, .2);
}

.yzpr-indicator.yzpr-ready .yzpr-text { color: #fff; }
.yzpr-indicator.yzpr-ready .yzpr-spinner {
  border-color: rgba(255, 255, 255, .28);
  border-top-color: #fff;
  border-left-color: #8ee6ee;
}

.yzpr-indicator.yzpr-loading {
  border-color: rgba(44, 160, 197, .42);
  background: rgba(247, 253, 255, .98);
}

.yzpr-indicator.yzpr-error {
  border-color: rgba(181, 52, 65, .28);
  background: rgba(255, 246, 247, .98);
}

.yzpr-indicator.yzpr-error .yzpr-text { color: #a32f3b; }
.yzpr-indicator.yzpr-error .yzpr-spinner {
  border-color: rgba(181, 52, 65, .16);
  border-top-color: #b53441;
}

/* مركز القيادة — امتداد أصيل لبوابة الأطباء */
.admin-command-hero { position:relative; overflow:hidden; display:flex; align-items:center; justify-content:space-between; gap:22px; margin-bottom:16px; padding:26px; border:1px solid rgba(83,180,201,.28); border-radius:24px; color:#fff; background:radial-gradient(circle at 14% 20%,rgba(73,187,209,.32),transparent 34%),linear-gradient(135deg,#0a2741 0%,#123b5d 58%,#176f83 100%); box-shadow:0 20px 44px rgba(18,59,93,.18); }
.admin-command-hero::after { position:absolute; inset-inline-end:-22px; bottom:-42px; width:210px; height:112px; border:2px solid rgba(255,255,255,.12); border-radius:50%; content:""; }
.admin-command-hero > div { position:relative; z-index:1; }
.admin-command-hero span { color:#9bdbe6; font-size:13px; font-weight:700; }
.admin-command-hero h2 { margin:5px 0 7px; font-size:clamp(28px,4vw,42px); letter-spacing:-.035em; }
.admin-command-hero p { max-width:680px; margin:0; color:#d7ebf0; line-height:1.8; }
.command-pulse { min-width:140px; display:grid; place-items:center; gap:9px; padding:18px; border:1px solid rgba(255,255,255,.16); border-radius:18px; background:rgba(255,255,255,.08); backdrop-filter:blur(10px); }
.command-pulse i { width:12px; height:12px; border-radius:50%; background:#7ee0c2; box-shadow:0 0 0 7px rgba(126,224,194,.14); }
.command-pulse b { color:#fff; font-size:13px; }
.admin-module-tabs { display:flex; gap:8px; margin-bottom:16px; padding:6px; overflow-x:auto; border:1px solid var(--line); border-radius:16px; background:#fff; scrollbar-width:none; }
.admin-module-tabs::-webkit-scrollbar { display:none; }
.admin-module-tabs button { min-height:44px; flex:0 0 auto; padding:9px 15px; border:0; border-radius:11px; color:var(--muted); background:transparent; font:inherit; font-size:13px; font-weight:700; cursor:pointer; }
.admin-module-tabs button.active { color:#fff; background:var(--navy); box-shadow:0 7px 18px rgba(18,59,93,.18); }
.admin-module:not(.active) { display:none; }
.admin-module-card { padding:20px; }
.admin-module-card > .section-head { margin-bottom:16px; }
.admin-module-card > .section-head span { color:var(--teal); font-size:12px; font-weight:700; }
.admin-module-card > .section-head h3 { margin:3px 0 0; }
.admin-kpi-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:14px; }
.admin-kpi { min-height:116px; display:flex; flex-direction:column; justify-content:space-between; padding:17px; border:1px solid var(--line); border-radius:18px; background:#fff; }
.admin-kpi small { color:var(--muted); font-weight:600; }
.admin-kpi strong { color:var(--navy); font-size:30px; font-variant-numeric:tabular-nums; }
.admin-kpi b { color:var(--teal); font-size:12px; }
.admin-module-map { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.admin-module-link { min-height:76px; display:flex; align-items:center; justify-content:space-between; gap:10px; padding:14px; border:1px solid var(--line); border-radius:15px; color:var(--ink); background:var(--surface); font:inherit; text-align:start; cursor:pointer; }
.admin-module-link span { display:flex; flex-direction:column; gap:3px; }
.admin-module-link small { color:var(--muted); }
.admin-module-link b { color:var(--teal); }
.admin-toolbar,.admin-inline-form { display:flex; align-items:center; gap:10px; margin-bottom:14px; }
.admin-toolbar select,.admin-inline-form input { min-height:46px; flex:1; padding:10px 13px; border:1px solid var(--line); border-radius:12px; color:var(--ink); background:#fff; font:inherit; }
.admin-list { display:grid; gap:10px; }
.admin-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; padding:15px; border:1px solid var(--line); border-inline-start:4px solid #50b5c9; border-radius:15px; background:#fff; }
.admin-row > div:first-child { min-width:0; }
.admin-row h4 { margin:0 0 4px; color:var(--navy); font-size:15px; }
.admin-row p { margin:0; color:var(--muted); font-size:13px; line-height:1.7; overflow-wrap:anywhere; }
.admin-row .admin-row-actions { display:flex; align-items:center; gap:7px; flex-wrap:wrap; justify-content:flex-end; }
.admin-row button { min-height:40px; padding:8px 11px; border:1px solid var(--line); border-radius:10px; color:var(--navy); background:#fff; font:inherit; font-size:12px; font-weight:700; cursor:pointer; }
.admin-row button.primary { color:#fff; border-color:var(--teal); background:var(--teal); }
.admin-row button.danger { color:var(--danger); border-color:#efc9cf; }
.admin-status { display:inline-flex; margin-top:7px; padding:5px 9px; border-radius:999px; color:#176b62; background:#e6f6f2; font-size:11px; font-weight:700; }
.admin-status.pending { color:#8b6414; background:#fff5d8; }
.admin-status.bad { color:#9e3947; background:#fdecef; }
.admin-audit-row { position:relative; grid-template-columns:1fr; overflow:hidden; padding:18px; border-inline-start-width:5px; background:linear-gradient(135deg,#fff 0%,#f8fcfd 100%); }
.admin-audit-row::after { content:""; position:absolute; inset-inline-end:-42px; inset-block-start:-46px; width:110px; height:110px; border-radius:50%; background:rgba(80,181,201,.08); pointer-events:none; }
.admin-audit-module { display:inline-flex; width:max-content; margin-bottom:9px; padding:5px 9px; border-radius:999px; color:#086b82; background:#e9f7fb; font-size:11px; font-weight:800; }
.admin-audit-headline { max-width:850px; margin-bottom:9px!important; color:var(--ink)!important; font-size:16px!important; line-height:1.8; }
.admin-audit-meta { display:flex; align-items:center; gap:7px; flex-wrap:wrap; color:var(--muted); font-size:12px; }
.admin-audit-meta > span { display:inline-flex; align-items:center; min-height:28px; padding:4px 8px; border:1px solid #dce9ec; border-radius:999px; background:#fff; }
.admin-audit-result.success { color:#176b62; border-color:#ccebe4; background:#eaf8f4; font-weight:800; }
.admin-audit-result.failed { color:#9e3947; border-color:#f3d1d7; background:#fff1f3; font-weight:800; }
.admin-audit-reason { display:grid; gap:3px; margin-top:12px; padding:10px 12px; border-inline-start:3px solid var(--gold); border-radius:10px; color:#6e561a; background:#fff8e5; font-size:13px; line-height:1.7; }
.admin-audit-reason strong { font-size:11px; }
.admin-audit-reference { margin-top:9px!important; color:#91a0aa!important; font-size:11px!important; text-align:start; direction:ltr; }
.admin-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:13px; }
.admin-form-grid label { display:grid; gap:7px; color:var(--muted); font-size:13px; font-weight:700; }
.admin-form-grid .wide { grid-column:1/-1; }
.admin-form-grid input,.admin-form-grid select,.admin-form-grid textarea { width:100%; min-height:46px; padding:11px 13px; border:1px solid var(--line); border-radius:12px; color:var(--ink); background:#fff; font:inherit; }
.admin-form-grid textarea { min-height:110px; resize:vertical; }
.admin-dependency { min-height:220px; display:grid; place-items:center; align-content:center; gap:9px; text-align:center; }
.admin-dependency svg { width:40px; height:40px; color:var(--teal); fill:none; stroke:currentColor; stroke-width:1.7; }
.admin-dependency p { max-width:480px; margin:0; color:var(--muted); }
.admin-dependency.connected { min-height:auto; grid-template-columns:auto 1fr; justify-items:start; place-items:center start; padding:14px 16px; border:1px solid #bae6fd; border-radius:14px; background:#f0f9ff; text-align:right; }
.admin-dependency.connected svg { grid-row:1/3; width:34px; height:34px; }
.admin-dependency.connected strong { color:#0c4a6e; }
.admin-honor-editor { display:grid; gap:16px; margin-top:16px; }
.admin-honor-editor[hidden] { display:none; }
.admin-honor-doctors { display:grid; gap:12px; }
.admin-honor-doctor { margin:0; padding:16px; border:1px solid var(--line); border-radius:18px; background:linear-gradient(145deg,#fff 0%,var(--surface-2) 100%); }
.admin-honor-doctor legend { padding:0 8px; color:var(--navy); font-weight:800; }
.admin-honor-photo { grid-column:1/-1; display:grid; grid-template-columns:92px minmax(0,1fr); gap:14px; align-items:center; padding:13px; border:1px solid #d8e8ec; border-radius:16px; background:#fff; }
.admin-honor-photo-preview { position:relative; width:88px; aspect-ratio:1; overflow:hidden; border:3px solid #fff; border-radius:50%; background:#edf5f7; box-shadow:0 0 0 1px #c9dde3,0 8px 20px rgba(19,60,78,.12); }
.admin-honor-photo-preview img { width:100%; height:100%; display:block; object-fit:cover; }
.admin-honor-photo-preview::after { content:""; position:absolute; inset:0; border-radius:inherit; box-shadow:inset 0 0 0 1px rgba(17,59,77,.08); pointer-events:none; }
.admin-honor-photo-copy { min-width:0; display:grid; gap:4px; }
.admin-honor-photo-copy strong { color:var(--navy); font-size:14px; }
.admin-honor-photo-copy p { margin:0; color:var(--muted); font-size:12px; line-height:1.65; }
.admin-honor-photo-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:7px; }
.admin-honor-photo-actions button { min-height:40px; padding:8px 12px; border:1px solid #bcd8df; border-radius:11px; color:#0b718d; background:#f4fbfd; font:inherit; font-size:12px; font-weight:800; cursor:pointer; }
.admin-honor-photo-actions button.danger { color:var(--danger); border-color:#efcdd3; background:#fff8f9; }
.admin-honor-photo-actions button:disabled { opacity:.45; cursor:not-allowed; }
.admin-honor-photo-state { display:inline-flex; width:max-content; margin-top:3px; padding:4px 8px; border-radius:999px; color:#176b62; background:#e5f7f1; font-size:10px; font-weight:800; }
.admin-honor-photo-state.removed { color:#805f19; background:#fff3cf; }
.honor-crop-backdrop { position:fixed; z-index:140; inset:0; display:grid; place-items:end center; padding:16px 16px max(16px,env(safe-area-inset-bottom)); background:rgba(4,25,36,.72); backdrop-filter:blur(10px); }
.honor-crop-backdrop[hidden] { display:none; }
.honor-crop-sheet { width:min(100%,520px); max-height:calc(100dvh - 32px); overflow:auto; padding:10px 18px 20px; border-radius:28px; background:#fff; box-shadow:0 30px 80px rgba(4,25,36,.35); }
.honor-crop-sheet > header { display:flex; justify-content:space-between; gap:14px; align-items:flex-start; margin:4px 0 14px; text-align:right; }
.honor-crop-sheet > header span { color:#1582a7; font-size:12px; font-weight:800; }
.honor-crop-sheet > header h2 { margin:2px 0 0; color:var(--navy); font-size:22px; }
.honor-crop-sheet > header p { margin:4px 0 0; color:var(--muted); font-size:13px; }
.honor-crop-sheet > header button { width:44px; height:44px; flex:0 0 auto; border:1px solid var(--line); border-radius:14px; color:var(--navy); background:#f5f9fa; font-size:24px; cursor:pointer; }
.honor-crop-stage { position:relative; width:min(100%,390px); aspect-ratio:1; margin:auto; overflow:hidden; border-radius:24px; background:#092f42; touch-action:none; user-select:none; }
.honor-crop-stage canvas { width:100%; height:100%; display:block; }
.honor-crop-stage > span { position:absolute; inset:7%; border:2px solid rgba(255,255,255,.92); border-radius:50%; box-shadow:0 0 0 100vmax rgba(4,25,36,.42); pointer-events:none; }
.honor-crop-stage::after { content:"حرّك الصورة"; position:absolute; inset-inline-start:50%; inset-block-end:12px; translate:-50% 0; padding:5px 10px; border-radius:999px; color:#fff; background:rgba(4,25,36,.62); font-size:11px; font-weight:700; pointer-events:none; }
.honor-crop-zoom { display:grid; grid-template-columns:auto 1fr; gap:12px; align-items:center; margin-top:16px; color:var(--navy); font-size:13px; font-weight:800; }
.honor-crop-zoom input { width:100%; accent-color:#0c88b2; direction:ltr; }
.honor-crop-note { margin:8px 0 0; color:var(--muted); font-size:11px; text-align:center; }
.honor-crop-actions { display:grid; grid-template-columns:1fr 1.4fr; gap:9px; margin-top:16px; }
.honor-crop-actions button { min-height:48px; }
.admin-data-table { max-width:100%; overflow:auto; border:1px solid var(--line); border-radius:14px; }
.admin-data-table table { width:100%; border-collapse:collapse; direction:ltr; text-align:left; font-size:12px; }
.admin-data-table th,.admin-data-table td { max-width:260px; padding:10px; border-bottom:1px solid var(--line); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.admin-data-table th { position:sticky; top:0; color:var(--navy); background:#edf6f8; }
.danger-admin-card { border-color:#efcbd1; background:linear-gradient(180deg,#fff,#fff8f8); }
.danger-admin-card > .section-head svg { width:28px; height:28px; color:var(--danger); fill:none; stroke:currentColor; }

@media (max-width:820px) {
  .admin-command-hero { align-items:flex-start; padding:20px; border-radius:20px; }
  .command-pulse { min-width:112px; padding:13px; }
  .admin-kpi-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .admin-module-map { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:560px) {
  .admin-command-hero { display:block; }
  .command-pulse { width:fit-content; grid-auto-flow:column; margin-top:16px; }
  .admin-module-tabs { margin-inline:-4px; border-radius:14px; }
  .admin-kpi-grid { gap:9px; }
  .admin-kpi { min-height:100px; padding:14px; }
  .admin-kpi strong { font-size:25px; }
  .admin-module-card { padding:15px; }
  .admin-module-map,.admin-form-grid { grid-template-columns:1fr; }
  .admin-form-grid .wide { grid-column:auto; }
  .admin-toolbar,.admin-inline-form { align-items:stretch; flex-direction:column; }
  .admin-toolbar > *,.admin-inline-form > * { width:100%; }
  .admin-row { grid-template-columns:1fr; }
  .admin-row .admin-row-actions { justify-content:flex-start; }
  .admin-honor-photo { grid-template-columns:76px minmax(0,1fr); padding:11px; }
  .admin-honor-photo-preview { width:72px; }
  .honor-crop-backdrop { padding:0; }
  .honor-crop-sheet { max-height:94dvh; border-radius:28px 28px 0 0; padding-bottom:max(20px,env(safe-area-inset-bottom)); }
}
