:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --line: #e4e9f1;
  --primary: #1d4ed8;
  --primary-dark: #163fae;
  --primary-soft: #eff6ff;
  --success: #15803d;
  --success-soft: #ecfdf3;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --danger: #c92a2a;
  --danger-soft: #fff1f2;
  --info: #0369a1;
  --info-soft: #f0f9ff;
  --shadow: 0 12px 35px rgba(30, 41, 59, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, .08), transparent 30rem),
    var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; }
button, .buttonLike { touch-action: manipulation; }
button { border: 0; }
a { color: inherit; }

.topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px max(22px, calc((100vw - 1240px) / 2));
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brandMark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8 55%, #153eaa);
  box-shadow: 0 8px 22px rgba(37, 99, 235, .25);
  font-size: 20px;
  font-weight: 900;
}
.brand h1 { margin: 0; font-size: 20px; letter-spacing: .02em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.syncBox { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.syncBadge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.syncBadge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.syncBadge.online { color: var(--success); background: var(--success-soft); border-color: #bbf7d0; }
.syncBadge.online::before { background: #22c55e; }
.syncBadge.syncing { color: var(--primary); background: var(--primary-soft); border-color: #bfdbfe; }
.syncBadge.syncing::before { background: #3b82f6; animation: pulse 1.1s infinite; }
.syncBadge.offline { color: var(--danger); background: var(--danger-soft); border-color: #fecdd3; }
.syncBadge.offline::before { background: #ef4444; }
@keyframes pulse { 50% { opacity: .35; } }

.mainNav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  background: rgba(244, 247, 251, .94);
  border-bottom: 1px solid rgba(228, 233, 241, .8);
  backdrop-filter: blur(12px);
}
.navItem {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 11px;
  background: transparent;
  color: #475467;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}
.navItem:hover { background: #fff; }
.navItem.active { color: var(--primary); background: #fff; box-shadow: 0 3px 14px rgba(30, 64, 175, .09); }
.navBadge { min-width: 18px; padding: 1px 5px; border-radius: 999px; color: #fff; background: var(--danger); font-size: 10px; }

.appShell { max-width: 1240px; margin: 0 auto; padding: 26px 20px 64px; }
.view { display: none; }
.view.active { display: block; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: .45; transform: translateY(3px); } }
.pageHead {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}
.pageHead h2 { margin: 0; font-size: clamp(25px, 3vw, 34px); letter-spacing: -.025em; }
.pageHead p:not(.eyebrow) { margin: 6px 0 0; color: var(--muted); }
.eyebrow { margin: 0 0 4px; color: var(--primary); font-size: 12px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.panel + .panel { margin-top: 16px; }
.panel h3, .panel h4 { margin: 0; }
.panelHead, .subHead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panelHead p, .subHead p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.subHead h4 { font-size: 15px; }

.primary, .secondary, .ghost, .danger, .buttonLike, .iconBtn, .textBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 780;
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.primary { color: #fff; background: var(--primary); box-shadow: 0 7px 18px rgba(37, 99, 235, .18); }
.primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.secondary { color: #fff; background: #263247; }
.secondary:hover { background: #111827; }
.ghost, .buttonLike.ghost { color: #344054; background: #fff; border: 1px solid var(--line); }
.ghost:hover { border-color: #b8c3d2; background: #f8fafc; }
.danger { color: #fff; background: var(--danger); }
.danger:hover { background: #a61e1e; }
.textBtn { min-height: 32px; padding: 5px 8px; color: var(--primary); background: transparent; }
.textBtn:hover { background: var(--primary-soft); }
.iconBtn { width: 38px; height: 38px; min-height: 38px; padding: 0; border-radius: 50%; color: #475467; background: #f2f4f7; font-size: 23px; font-weight: 400; }
.small { min-height: 34px; padding: 7px 10px; font-size: 12px; }
button:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

.metricGrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; }
.metricCard {
  min-height: 132px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto 1fr;
  align-items: end;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: linear-gradient(150deg, #fff, #f8fbff);
  box-shadow: 0 7px 22px rgba(30, 41, 59, .055);
}
.metricCard span { grid-column: 1 / -1; align-self: start; color: var(--muted); font-size: 13px; font-weight: 720; }
.metricCard strong { font-size: 38px; line-height: 1; color: var(--primary); }
.metricCard small { margin: 0 0 3px 5px; color: var(--muted); }
.metricCard.warn strong { color: var(--warning); }
.metricCard.danger strong { color: var(--danger); }
.metricCard.info strong { color: var(--info); }
.dashboardGrid { display: grid; grid-template-columns: 1.35fr .85fr; gap: 16px; }
.stackList, .issueList { display: grid; gap: 9px; }
.stackItem, .issueItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  text-align: left;
  color: var(--text);
  cursor: pointer;
}
.stackItem strong, .issueItem strong { display: block; }
.stackItem p, .issueItem p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.issueItem.warn { background: var(--warning-soft); border-color: #fde68a; }
.issueItem.danger { background: var(--danger-soft); border-color: #fecdd3; }
.emptyState { padding: 26px 14px; color: var(--muted); text-align: center; border: 1px dashed #cfd8e6; border-radius: 14px; }
.emptyState strong { display: block; margin-bottom: 4px; color: #475467; }

.formPanel { margin-bottom: 18px; }
.formGrid { display: grid; gap: 12px; }
.formGrid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.formGrid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }
.field { display: block; min-width: 0; color: #344054; font-size: 13px; font-weight: 720; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  padding: 10px 11px;
  border: 1px solid #d5dce7;
  border-radius: 11px;
  outline: none;
  background: #fff;
  color: var(--text);
  font-size: 15px;
  font-weight: 450;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(37, 99, 235, .11); }
.field.grow { flex: 1; }
.field.narrow { max-width: 120px; }
.formActions { display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap; margin-top: 16px; }
.formActions.left { justify-content: flex-start; }
.statusLine { min-height: 20px; margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.statusLine.error { color: var(--danger); }
.helpText { color: var(--muted); font-size: 13px; }
.alignEnd { align-self: end; }
.filterBar { display: flex; align-items: end; gap: 10px; margin-bottom: 14px; }
.filterBar.compact { margin-bottom: 16px; }

.roleBuilder, .courseEditor { margin-top: 17px; padding-top: 16px; border-top: 1px solid var(--line); }
.roleAddRow { display: grid; grid-template-columns: 1fr 120px 1.2fr auto; align-items: end; gap: 10px; }
.roleDraftList { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.roleDraft {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px 8px 11px;
  border: 1px solid #cbdaf5;
  border-radius: 999px;
  background: var(--primary-soft);
  color: #1e40af;
  font-size: 13px;
  font-weight: 720;
}
.roleDraft button { width: 24px; height: 24px; padding: 0; border-radius: 50%; color: #64748b; background: #fff; cursor: pointer; }

.cardGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.activityCard {
  display: flex;
  flex-direction: column;
  min-height: 250px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 8px 25px rgba(30, 41, 59, .06);
}
.activityCardTop { display: flex; justify-content: space-between; gap: 10px; }
.activityCard h3 { margin: 2px 0 0; font-size: 19px; }
.activityMeta { display: grid; gap: 5px; margin: 13px 0; color: #475467; font-size: 13px; }
.activityMeta span { display: block; }
.roleProgress { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.rolePill { padding: 5px 8px; border-radius: 999px; background: #f2f4f7; color: #475467; font-size: 12px; }
.rolePill.missing { color: var(--warning); background: var(--warning-soft); }
.rolePill.full { color: var(--success); background: var(--success-soft); }
.cardActions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: auto; }
.cardActions button { flex: 1 1 auto; min-height: 37px; padding: 8px 10px; font-size: 12px; }
.statusBadge, .availabilityBadge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.statusBadge.draft { color: #475467; background: #f2f4f7; }
.statusBadge.staffing { color: var(--primary); background: var(--primary-soft); }
.statusBadge.confirmed, .availabilityBadge.available { color: var(--success); background: var(--success-soft); }
.statusBadge.completed { color: #0369a1; background: #e0f2fe; }
.statusBadge.cancelled, .availabilityBadge.conflict { color: var(--danger); background: var(--danger-soft); }

.staffingPanel { margin-top: 20px; scroll-margin-top: 78px; }
.summaryStrip { display: flex; gap: 8px; flex-wrap: wrap; padding: 11px; border-radius: 13px; background: var(--surface-soft); }
.summaryChip { padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: #475467; font-size: 12px; font-weight: 730; }
.summaryChip.warn { color: var(--warning); border-color: #fde68a; background: var(--warning-soft); }
.summaryChip.danger { color: var(--danger); border-color: #fecdd3; background: var(--danger-soft); }
.pillTabs { display: flex; gap: 7px; overflow-x: auto; margin: 14px 0; padding-bottom: 3px; scrollbar-width: none; }
.pillTabs::-webkit-scrollbar { display: none; }
.pillTabs button { flex: 0 0 auto; min-height: 38px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: #475467; background: #fff; font-weight: 750; cursor: pointer; }
.pillTabs button.active { color: #fff; background: var(--primary); border-color: var(--primary); }
.staffingGrid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 18px; }
.assignedList, .candidateList { display: grid; gap: 8px; }
.personRow, .candidateRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}
.personRow strong, .candidateRow strong { display: inline-block; }
.rowMeta { margin-top: 3px; color: var(--muted); font-size: 12px; }
.candidateScore { display: inline-block; margin-left: 6px; color: var(--primary); font-size: 12px; font-weight: 850; }
.candidateReasons { margin-top: 5px; color: #475467; font-size: 12px; }
.candidateRow.unavailable { opacity: .72; background: #fbfbfc; }
.rowActions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.rowActions button { min-height: 32px; padding: 6px 9px; border-radius: 9px; font-size: 11px; font-weight: 800; cursor: pointer; }

.peopleLayout { display: grid; gap: 16px; }
.peopleCards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.personCard { padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.personCardTop { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.personCard h4 { margin: 0; font-size: 16px; }
.personContact { margin: 7px 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { display: inline-flex; padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: #475467; font-size: 11px; }
.tag.skill { color: #6d28d9; border-color: #ddd6fe; background: #f5f3ff; }
.tag.dept { color: #047857; border-color: #a7f3d0; background: #ecfdf5; }
.tag.role { color: #9a3412; border-color: #fed7aa; background: #fff7ed; }
.personCard .cardActions { margin-top: 11px; }
.blockPanel { margin-top: 16px; }
.inlineForm { display: flex; align-items: end; gap: 9px; flex-wrap: wrap; }
.inlineForm .field { min-width: 155px; }
.blockList { display: grid; gap: 8px; margin-top: 12px; }
.blockRow { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.blockRow strong { margin-right: 7px; }
.blockRow p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.weekMode { display: flex; gap: 7px; margin-bottom: 10px; }
.weekModeBtn { min-height: 38px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; color: #475467; background: #fff; font-weight: 760; cursor: pointer; }
.weekModeBtn.active { color: #fff; background: var(--primary); border-color: var(--primary); }
.weekModeBtn.odd.active { background: #d97706; border-color: #d97706; }
.weekModeBtn.even.active { background: var(--success); border-color: var(--success); }
.tableScroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); text-align: left; vertical-align: top; }
th:last-child, td:last-child { border-right: 0; }
tr:last-child td, tr:last-child th { border-bottom: 0; }
th { color: #344054; background: #f8fafc; font-weight: 830; white-space: nowrap; }
.courseGrid th:first-child, .courseGrid td:first-child { position: sticky; left: 0; z-index: 2; min-width: 122px; background: #f8fafc; }
.courseCell { min-width: 100px; padding: 0; text-align: center; }
.courseCell button { width: 100%; min-height: 58px; padding: 7px; color: #98a2b3; background: #fff; cursor: pointer; }
.courseCell.week-all button { color: #1d4ed8; background: #dbeafe; }
.courseCell.week-odd button { color: #92400e; background: #fef3c7; }
.courseCell.week-even button { color: #166534; background: #dcfce7; }
.courseCell b { display: block; font-size: 13px; }
.courseCell small { display: block; margin-top: 2px; font-size: 10px; }

.scheduleFilters { flex-wrap: wrap; }
.scheduleFilters .field { min-width: 145px; flex: 1; }
.segmented { display: inline-flex; padding: 4px; border-radius: 12px; background: #f2f4f7; }
.segmented button { min-height: 36px; padding: 7px 13px; border-radius: 9px; color: #667085; background: transparent; font-weight: 760; cursor: pointer; }
.segmented button.active { color: var(--primary); background: #fff; box-shadow: 0 2px 7px rgba(30, 41, 59, .09); }
.scheduleActions { display: flex; gap: 8px; flex-wrap: wrap; margin: 13px 0; }
.resultHead h3 { margin: 16px 0 4px; }
.resultHead p { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.scheduleResult { margin-top: 10px; }
.scheduleResult td { min-width: 170px; }
.scheduleName { display: inline-block; margin: 2px 4px 2px 0; padding: 4px 7px; border-radius: 8px; background: #f2f4f7; }
.scheduleName.assigned { color: #1e3a8a; background: #dbeafe; font-weight: 750; }
.statsGrid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 16px; }
.skillCloud { display: flex; flex-wrap: wrap; gap: 8px; }
.skillStat { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border: 1px solid #ddd6fe; border-radius: 999px; color: #6d28d9; background: #f5f3ff; font-size: 13px; }
.skillStat b { color: #4c1d95; }
.settingsGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.settingsGrid .panel + .panel { margin-top: 0; }
.dangerPanel { border-color: #fecdd3; background: #fffafb; }

.rosterDialog {
  width: min(680px, calc(100vw - 24px));
  max-height: calc(100vh - 36px);
  padding: 0;
  border: 0;
  border-radius: 20px;
  box-shadow: 0 30px 90px rgba(15, 23, 42, .28);
  color: var(--text);
}
.rosterDialog::backdrop { background: rgba(15, 23, 42, .56); backdrop-filter: blur(3px); }
.dialogHead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 14px; border-bottom: 1px solid var(--line); }
.dialogHead h2 { margin: 0; }
.rosterContent { padding: 20px; }
.rosterHeader { padding: 15px; border-radius: 14px; color: #fff; background: linear-gradient(135deg, #1d4ed8, #1e3a8a); }
.rosterHeader h2 { margin: 0 0 7px; }
.rosterHeader p { margin: 3px 0; font-size: 13px; opacity: .93; }
.rosterRole { margin-top: 16px; }
.rosterRole h3 { margin: 0 0 7px; padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.rosterRole ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; padding: 0; margin: 0; list-style: none; }
.rosterRole li { padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.dialogActions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 14px 20px 20px; }

.toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; max-width: min(440px, calc(100vw - 28px)); transform: translate(-50%, 20px); padding: 10px 14px; border-radius: 11px; color: #fff; background: #172033; box-shadow: 0 12px 32px rgba(15, 23, 42, .28); opacity: 0; pointer-events: none; transition: .2s ease; font-size: 13px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }
.siteFooter { padding: 0 16px 22px; color: var(--muted); font-size: 12px; text-align: center; }
.siteFooter a { text-decoration: none; }

@media (max-width: 980px) {
  .metricGrid { grid-template-columns: repeat(3, 1fr); }
  .dashboardGrid, .staffingGrid, .statsGrid { grid-template-columns: 1fr; }
  .peopleCards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .roleAddRow { grid-template-columns: 1fr 110px; }
  .roleAddRow .field:nth-child(3) { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  body { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
  .topbar { min-height: 66px; padding: 10px 13px; }
  .brandMark { width: 38px; height: 38px; border-radius: 12px; }
  .brand h1 { font-size: 17px; }
  .brand p { display: none; }
  .syncBox .textBtn { display: none; }
  .syncBadge { max-width: 135px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mainNav {
    position: fixed;
    inset: auto 0 0;
    z-index: 50;
    justify-content: flex-start;
    gap: 2px;
    overflow-x: auto;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 -8px 30px rgba(15, 23, 42, .1);
    scrollbar-width: none;
  }
  .mainNav::-webkit-scrollbar { display: none; }
  .navItem { flex: 1 1 0; min-width: 0; min-height: 48px; justify-content: center; padding: 7px 3px; font-size: 11px; white-space: nowrap; }
  .navItem .navBadge { position: absolute; top: 1px; right: 2px; min-width: 15px; padding: 0 3px; font-size: 9px; }
  .navItem.active { background: var(--primary-soft); box-shadow: none; }
  .appShell { padding: 18px 10px 28px; }
  .pageHead { align-items: flex-start; }
  .pageHead h2 { font-size: 27px; }
  .pageHead > button, .pageHead > .buttonLike { min-height: 40px; padding: 9px 11px; white-space: nowrap; }
  .panel { padding: 14px; border-radius: 15px; }
  .metricGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .metricCard { min-height: 105px; padding: 13px; }
  .metricCard strong { font-size: 31px; }
  .metricCard:last-child { grid-column: 1 / -1; min-height: 90px; }
  .dashboardGrid, .cardGrid, .peopleCards, .settingsGrid { grid-template-columns: 1fr; }
  .formGrid.two, .formGrid.three { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: auto; }
  .filterBar { align-items: stretch; flex-direction: column; }
  .filterBar .field { width: 100%; }
  .roleAddRow { grid-template-columns: 1fr 95px; }
  .roleAddRow .field:nth-child(3) { grid-column: 1 / -1; }
  .roleAddRow .alignEnd { grid-column: 1 / -1; }
  .inlineForm { display: grid; grid-template-columns: 1fr 1fr; }
  .inlineForm .field { min-width: 0; }
  .inlineForm .grow, .inlineForm .alignEnd { grid-column: 1 / -1; }
  .personRow, .candidateRow { grid-template-columns: 1fr; }
  .rowActions { justify-content: flex-start; }
  .activityCard { min-height: 0; }
  .formActions > *, .cardActions > * { flex: 1; }
  .rosterRole ul { grid-template-columns: 1fr; }
  .dialogActions > * { flex: 1; }
  .toast { bottom: calc(82px + env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .metricGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pageHead { gap: 8px; }
  .pageHead p:not(.eyebrow) { font-size: 13px; }
  .inlineForm { grid-template-columns: 1fr; }
  .inlineForm .grow, .inlineForm .alignEnd { grid-column: auto; }
  .roleAddRow { grid-template-columns: 1fr; }
  .roleAddRow .field:nth-child(3), .roleAddRow .alignEnd { grid-column: auto; }
}

@media print {
  body { background: #fff; padding: 0; }
  body.printingRoster > *:not(.rosterDialog) { display: none !important; }
  body.printingRoster .rosterDialog { position: static; display: block; width: 100%; max-height: none; box-shadow: none; }
  .noPrint, .mainNav, .toast, .dialogActions { display: none !important; }
  .appShell { max-width: none; padding: 0; }
  .view:not(#view-schedule) { display: none !important; }
  #view-schedule { display: block !important; }
  #view-schedule .pageHead, #view-schedule .filterBar, #view-schedule .segmented, #view-schedule .statusLine { display: none !important; }
  .panel, .tableScroll { border: 0; box-shadow: none; overflow: visible; }
  table { font-size: 11px; }
}
