.coverage-page-head { margin-bottom: 17px; }
.coverage-summary { display: grid; grid-template-columns: repeat(4, minmax(135px, 1fr)); margin-bottom: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; }
.coverage-summary > div { padding: 13px 16px; border-right: 1px solid var(--line); border-top: 4px solid var(--blue-700); }
.coverage-summary > div:last-child { border-right: 0; }
.coverage-summary span, .coverage-summary small { display: block; }
.coverage-summary span { color: #455c67; font-size: 12px; font-weight: 700; }
.coverage-summary strong { display: block; margin: 1px 0; font-size: 25px; line-height: 1.2; }
.coverage-summary small { color: var(--muted); font-size: 11px; }
.coverage-summary .summary-shortage { border-top-color: var(--red); background: #fffafa; }
.coverage-summary .summary-over { border-top-color: var(--amber); background: #fffdf7; }

.coverage-toolbar { display: flex; align-items: end; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #e8eef1; }
.coverage-toolbar label { display: grid; gap: 4px; color: #3e545f; font-size: 12px; font-weight: 800; }
.coverage-toolbar select { min-width: 160px; min-height: 38px; }
.coverage-week-nav { display: flex; gap: 8px; margin-left: auto; }

.date-rail { position: sticky; z-index: 12; top: calc(var(--topbar-height) + 6px); display: grid; grid-template-columns: repeat(7, minmax(105px, 1fr)); gap: 5px; margin: 12px 0 0; padding: 7px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.96); box-shadow: 0 4px 14px rgba(13,43,59,.07); backdrop-filter: blur(8px); }
.date-rail a { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 0 8px; min-width: 0; padding: 8px 9px 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: #fff; }
.date-rail a:hover { border-color: #86acbd; text-decoration: none; }
.date-rail a::before { content: ""; position: absolute; inset: -1px auto -1px -1px; width: 4px; border-radius: 5px 0 0 5px; background: var(--green); }
.date-rail a.has-shortage::before { background: var(--red); }
.date-rail a.has-over::before { background: var(--amber); }
.date-rail a > span, .date-rail a > small { color: var(--muted); font-size: 11px; }
.date-rail a > strong { font-size: 15px; }
.date-rail a > b { grid-row: 1 / 3; grid-column: 2; align-self: center; color: var(--green); font-size: 11px; }
.date-rail a.has-shortage > b { color: var(--red); }
.date-rail a.has-over > b { color: var(--amber); }

.coverage-legend { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 10px 3px; color: var(--muted); font-size: 12px; }
.legend-dot { display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 2px; }
.legend-dot.shortage { background: var(--red); }
.legend-dot.met { background: var(--green); }
.legend-dot.over { background: var(--amber); }
.legend-note { margin-left: auto; }

.coverage-days { display: grid; gap: 18px; }
.coverage-day { min-width: 0; scroll-margin-top: calc(var(--topbar-height) + 105px); border: 1px solid #bdcbd1; border-radius: var(--radius); background: #fff; overflow: hidden; box-shadow: 0 4px 12px rgba(12,39,55,.045); }
.coverage-day-head { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 18px; padding: 12px 16px; background: var(--navy-900); color: #fff; }
.day-title { display: grid; padding-right: 18px; border-right: 1px solid rgba(255,255,255,.2); }
.day-title span { color: #a9c5d3; font-size: 11px; }
.day-title strong { font-size: 19px; }
.day-head-count { display: flex; align-items: baseline; gap: 5px; }
.day-head-count strong { font-size: 24px; }
.day-head-count span { color: #bcd0da; font-size: 12px; }
.day-status-line { display: flex; justify-content: flex-end; align-items: center; gap: 10px; color: #c8dae2; font-size: 12px; }
.status-count { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-weight: 800; }
.status-count.shortage { background: #ffdddd; color: #8a2727; }
.status-count.met { background: #d9f0e7; color: #125d45; }
.status-count.over { background: #ffe9ae; color: #735000; }
.status-count.available { background: #dcecf4; color: #174d68; }

.available-staff-strip { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 14px; padding: 11px 14px; border-bottom: 1px solid #b8d1dd; background: #eef7fa; }
.available-staff-title { display: grid; align-content: start; }
.available-staff-title > span { color: var(--blue-700); font-size: 10px; font-weight: 900; letter-spacing: .09em; }
.available-staff-title > strong { margin-top: 2px; font-size: 15px; }
.available-staff-title > small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.available-staff-list { display: flex; gap: 7px; min-width: 0; overflow-x: auto; padding-bottom: 3px; }
.available-person { display: grid; flex: 0 0 210px; min-width: 0; padding: 7px 8px; border: 1px solid #abc8d5; border-radius: 5px; background: #fff; color: var(--ink); }
a.available-person:hover { border-color: var(--blue-700); box-shadow: 0 2px 8px rgba(18,99,143,.1); text-decoration: none; }
.available-person-head { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.available-person-head b { font-size: 13px; }
.available-person-head em { padding: 2px 5px; border-radius: 999px; background: #dcecf4; color: #174d68; font-size: 9px; font-style: normal; font-weight: 800; white-space: nowrap; }
.available-person > small { margin: 2px 0 5px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.available-position-list { display: flex; gap: 3px; overflow: hidden; }
.available-position-list i { padding: 2px 4px; border-radius: 3px; background: #edf2f4; color: #4a626d; font-size: 9px; font-style: normal; white-space: nowrap; }
.available-empty { display: grid; align-content: center; min-height: 64px; color: var(--muted); }
.available-empty strong { color: #405660; font-size: 12px; }
.available-empty span { font-size: 10px; }

.coverage-area + .coverage-area { border-top: 8px solid var(--canvas); }
.coverage-area-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 14px; border-bottom: 1px solid var(--line); background: #edf2f4; }
.area-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.area-kicker { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.area-identity h2 { margin: 0; font-size: 18px; }
.area-total { padding-left: 10px; border-left: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }
.area-total b { color: var(--ink); font-size: 17px; }
.slot-counts { display: flex; gap: 6px; }
.slot-counts > span { display: grid; grid-template-columns: auto auto; gap: 2px 10px; align-items: baseline; min-width: 112px; padding: 6px 9px; border: 1px solid #b7c6cd; border-radius: 5px; background: #fff; }
.slot-counts small { color: var(--muted); }
.slot-counts b { justify-self: end; font-size: 15px; font-variant-numeric: tabular-nums; }
.slot-counts .slot-shortage { border-color: #d89393; background: var(--red-soft); color: #8a2929; }
.slot-counts .slot-over { border-color: #d5b364; background: var(--amber-soft); color: #735000; }

.department-roster { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fbfcfc; }
.department-roster > strong { padding-top: 6px; color: #415762; font-size: 12px; }
.roster-list { display: flex; gap: 6px; flex-wrap: wrap; }
.roster-person { display: inline-grid; min-width: 76px; padding: 4px 7px; border: 1px solid #c9d6dc; border-radius: 4px; background: #fff; }
.roster-person b { font-size: 12px; }
.roster-person small { max-width: 150px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.coverage-table-wrap { min-width: 0; max-width: 100%; overflow: auto; }
.coverage-table { min-width: 920px; }
.coverage-table th { padding: 9px 12px; background: #f3f6f7; color: #52656e; }
.coverage-table td { padding: 10px 12px; vertical-align: top; }
.coverage-table th:first-child, .coverage-table td:first-child { padding-left: 14px; }
.coverage-table th:nth-child(1) { width: 22%; }
.coverage-table th:nth-child(2) { width: 12%; }
.coverage-table th:nth-child(3), .coverage-table th:nth-child(4) { width: 7%; }
.coverage-table th:nth-child(5) { width: 32%; }
.coverage-table th:nth-child(6) { width: 20%; }
.coverage-row-shortage td { background: #fffafa; }
.coverage-row-over td { background: #fffdf6; }
.coverage-row-adjusted td { background: #f4fbff; }
.coverage-row-shortage td:first-child { box-shadow: inset 4px 0 var(--red); }
.coverage-row-over td:first-child { box-shadow: inset 4px 0 var(--amber); }
.coverage-row-adjusted td:first-child { box-shadow: inset 4px 0 var(--blue-700); }
.number-column { text-align: center; font-variant-numeric: tabular-nums; }
.number-column b, .number-column strong { display: block; font-size: 18px; }
.number-column small { display: block; color: var(--muted); font-size: 10px; }
.shift-name { display: inline-flex; padding: 3px 7px; border-radius: 4px; background: #e8f0f4; color: #294d61; font-size: 11px; font-weight: 800; }
.staff-list { white-space: normal; }
.staff-chip { display: inline-grid; min-width: 66px; margin: 0 4px 4px 0; padding: 4px 7px; border: 1px solid #aec9d5; border-radius: 4px; background: #edf6fa; color: #173d50; }
.staff-chip b { font-size: 12px; }
.staff-chip small { color: #58737f; font-size: 9px; }
.staff-chip.is-shared { border-style: dashed; border-color: #b99136; background: #fff8e5; color: #694b06; }
.empty-staff { color: var(--red); font-weight: 800; }
.coverage-status { display: inline-flex; min-height: 24px; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 900; }
.coverage-status.shortage { background: var(--red-soft); color: #8a2929; }
.coverage-status.met { background: var(--green-soft); color: #155e47; }
.coverage-status.over { background: var(--amber-soft); color: #735000; }
.reason-details { margin-top: 5px; white-space: normal; }
.reason-details summary { color: var(--blue-700); font-size: 11px; font-weight: 800; cursor: pointer; }
.reason-details ul { margin: 8px 0 0; padding-left: 18px; }
.reason-details li { margin: 6px 0; }
.reason-details small { display: block; color: var(--muted); }
.reason-details p { max-width: 360px; margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.coverage-empty { padding: 32px 18px; color: var(--muted); text-align: center; }

@media (max-width: 1100px) {
  .coverage-summary { grid-template-columns: repeat(2, 1fr); }
  .coverage-summary > div:nth-child(2) { border-right: 0; }
  .coverage-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .coverage-toolbar { align-items: stretch; flex-wrap: wrap; }
  .coverage-week-nav { margin-left: 0; }
  .date-rail { position: static; display: flex; overflow-x: auto; }
  .date-rail a { flex: 0 0 125px; }
  .coverage-area-head { align-items: flex-start; flex-direction: column; }
  .slot-counts { width: 100%; overflow-x: auto; }
  .slot-counts > span { flex: 1 0 112px; }
}

@media (max-width: 700px) {
  .coverage-summary > div { padding: 11px 12px; }
  .coverage-toolbar label, .coverage-toolbar select { width: 100%; }
  .coverage-toolbar .button { flex: 1; }
  .coverage-week-nav { width: 100%; }
  .coverage-week-nav .button { flex: 1; }
  .coverage-legend { gap: 9px 14px; }
  .legend-note { width: 100%; margin-left: 0; }
  .coverage-day-head { grid-template-columns: 1fr auto; gap: 8px 12px; padding: 11px 12px; }
  .day-title { padding-right: 0; border-right: 0; }
  .day-status-line { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; }
  .area-identity { width: 100%; flex-wrap: wrap; }
  .area-kicker { width: 100%; }
  .department-roster { grid-template-columns: 1fr; padding: 9px 11px; }
  .department-roster > strong { padding-top: 0; }
  .roster-list { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 3px; }
  .roster-person { flex: 0 0 auto; }
  .coverage-table { min-width: 0; }
  .coverage-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .coverage-table, .coverage-table tbody, .coverage-table tr, .coverage-table td { display: block; width: 100%; }
  .coverage-table tr { display: grid; grid-template-columns: minmax(0, 1fr) 100px; padding: 10px 11px; border-bottom: 1px solid var(--line); }
  .coverage-table tr:last-child { border-bottom: 0; }
  .coverage-table td { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: start; gap: 8px; padding: 5px 0 !important; border: 0; background: transparent !important; text-align: left; box-shadow: none !important; }
  .coverage-table td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 700; }
  .coverage-table td:nth-child(1), .coverage-table td:nth-child(5), .coverage-table td:nth-child(6) { grid-column: 1 / -1; }
  .coverage-table td:nth-child(2) { grid-column: 1; }
  .coverage-table td:nth-child(3), .coverage-table td:nth-child(4) { grid-column: 2; grid-template-columns: 48px 1fr; }
  .number-column b, .number-column strong { display: inline; font-size: 15px; }
  .number-column small { display: inline; margin-left: 4px; }
  .available-staff-strip { grid-template-columns: 1fr; padding: 10px 11px; }
  .available-staff-title > small { max-width: 330px; }
  .available-person { flex-basis: 190px; }
}
