/* Hospital status board (hs-*), global search palette (qs-*). Dark-mode copies are derived by js/theme.js; hand-tuned
   dark fixes are at the bottom. */

/* ---------- status chips ---------- */
.hs-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 10px; letter-spacing: .3px; text-transform: uppercase; white-space: nowrap; background: #dcefe3; color: #1e7a45; }
.hs-chip.hs-warn { background: #fff1d6; color: #8a5a00; }
.hs-chip.hs-bad { background: #fde2df; color: #b03a2e; }

/* ---------- full board ---------- */
.hs-page .page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hs-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .6px; color: var(--blue); margin-bottom: 4px; }
.hs-subtitle { color: var(--text-2); font-size: 14px; max-width: 720px; }
.hs-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hs-updated { color: var(--muted); font-size: 12px; }
.hs-filter.on { background: #fff1d6; border-color: #e8c66b; }
.hs-back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; text-decoration: none; font-weight: 600; font-size: 14px; }
.hs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin: 16px 0 28px; }
.hs-card { border: 1px solid var(--line); border-left: 5px solid var(--green-2); border-radius: 6px; background: #fff; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.hs-card.hs-l-warn { border-left-color: #e0a100; }
.hs-card.hs-l-bad { border-left-color: var(--red); background: #fffafa; }
.hs-card.focus { box-shadow: 0 0 0 3px rgba(11, 152, 222, .35); }
.hs-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px 10px; flex-wrap: wrap; }
.hs-card-top > div { flex: 1 1 150px; min-width: 0; }
.hs-name { font-weight: 700; color: var(--navy); font-size: 15px; line-height: 1.25; }
.hs-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.hs-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hs-facts > div { display: flex; flex-direction: column; }
.hs-k { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; }
.hs-v { font-size: 15px; font-weight: 600; }
.hs-note { background: var(--bg-soft); border-radius: 4px; padding: 8px 10px; font-size: 13px; white-space: pre-wrap; }
.hs-by { color: var(--text-2); font-size: 12px; }
.hs-edit { align-self: flex-start; }
.hs-allopen { display: flex; align-items: center; gap: 8px; color: var(--green-dark); font-weight: 600; padding: 20px 0; grid-column: 1 / -1; }
.hs-hist-wrap { margin-bottom: 30px; }
.hs-hist-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.hs-hist-head h2 { margin: 0; font-size: 18px; }
.hs-hist-sel { max-width: 260px; }
.hs-hist { overflow-x: auto; }
.hs-hist-table td { font-size: 13px; }
.hs-hist-table tr.auto td { color: var(--text-2); }

/* edit dialog */
.hs-form { display: flex; flex-direction: column; gap: 6px; }
.hs-form .field-label { margin-top: 8px; }
.hs-status-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.hs-opt { border: 1px solid var(--line-2); background: #fff; border-radius: 4px; padding: 8px 10px; text-align: left; cursor: pointer; font-weight: 600; font-size: 13px; }
.hs-opt:hover { background: var(--bg-soft); }
.hs-opt.on.hs-ok { background: #dcefe3; border-color: var(--green-2); color: #1e7a45; }
.hs-opt.on.hs-warn { background: #fff1d6; border-color: #e0a100; color: #8a5a00; }
.hs-opt.on.hs-bad { background: #fde2df; border-color: var(--red); color: #b03a2e; }
.hs-exp:empty { display: none; }
.hs-exp { display: flex; flex-direction: column; gap: 6px; }

/* ---------- dashboard card ---------- */
.dash-hosp .card-body { display: flex; flex-direction: column; gap: 6px; }
.hs-mini-sum { font-weight: 700; font-size: 13px; }
.hs-mini-sum > span { display: inline-flex; align-items: center; gap: 6px; }
.hs-mini-alert { color: #b03a2e; } .hs-mini-ok { color: var(--green-dark); }
.hs-mini { display: flex; flex-direction: column; }
.hs-mini-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; font-size: 13px; }
.hs-mini-row:hover { background: var(--bg-soft); }
.hs-mini-name { font-weight: 700; color: var(--navy); min-width: 44px; }
.hs-mini-row .hs-chip { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.hs-mini-full { min-width: 40px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.hs-mini-more { color: var(--muted); font-size: 12px; }

/* ---------- destination panel (incident tab) ---------- */
.hs-dest { width: 100%; margin: 4px 0 24px; }
.hs-dest:empty { display: none; }
.hs-dest-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; font-size: 13px; }
.hs-needs { color: var(--text-2); }
.hs-dest-board { margin-left: auto; font-size: 13px; }
.hs-dest-list { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.hs-dest-row { display: grid; grid-template-columns: 1fr auto auto 64px; align-items: center; gap: 10px; width: 100%; padding: 7px 12px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; font-size: 13px; }
.hs-dest-row:last-child { border-bottom: 0; }
button.hs-dest-row { cursor: pointer; }
button.hs-dest-row:hover { background: #f5fafd; }
.hs-dest-row.on { background: #e9f6fd; box-shadow: inset 3px 0 0 var(--blue); }
.hs-dest-row.conflict .hs-dest-name { color: #b03a2e; }
.hs-dest-name { font-weight: 600; }
.hs-beds { color: var(--text-2); font-size: 12px; }
.hs-dist { color: var(--text-2); font-variant-numeric: tabular-nums; text-align: right; }
.hs-alert { display: flex; gap: 10px; align-items: flex-start; background: #fdecea; border: 1px solid #f3b8b0; color: #8f2a1f; border-radius: 4px; padding: 10px 12px; margin-bottom: 10px; font-weight: 600; font-size: 14px; }
.hs-alert .ico { color: var(--red); margin-top: 1px; }
.hs-alert-sub { font-weight: 400; font-size: 12px; margin-top: 2px; }
.oc-hosp-board { align-self: flex-start; }

@media (max-width: 600px) {
  .hs-dest-row { grid-template-columns: 1fr auto; }
  .hs-beds, .hs-dist { display: none; }
  .hs-status-pick { grid-template-columns: 1fr; }
}

/* ---------- global search palette ---------- */
.qs-backdrop { position: fixed; inset: 0; background: rgba(20, 30, 45, .45); z-index: 3000; display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.qs-panel { width: 100%; max-width: 640px; background: #fff; border-radius: 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; max-height: 72vh; overflow: hidden; }
.qs-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--text-2); }
.qs-bar .ico { width: 22px; height: 22px; }
.qs-input { flex: 1; border: 0; outline: 0; font-size: 17px; background: transparent; color: var(--text); padding: 4px 0; min-width: 0; }
.qs-input::-webkit-search-cancel-button { display: none; }
.qs-kbd, .qs-foot kbd { font-family: inherit; font-size: 11px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; color: var(--text-2); background: var(--bg-soft); }
.qs-results { overflow-y: auto; padding: 6px 0; flex: 1; min-height: 60px; }
.qs-group { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); padding: 10px 16px 4px; }
.qs-item { display: flex; align-items: center; gap: 12px; padding: 8px 16px; cursor: pointer; }
.qs-item.active { background: #e9f6fd; box-shadow: inset 3px 0 0 var(--blue); }
.qs-item.nolink { cursor: default; }
.qs-ico { color: var(--text-2); display: inline-flex; }
.qs-ico .ico { width: 20px; height: 20px; }
.qs-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.qs-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-sub { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; padding: 2px 8px; border-radius: 10px; background: #e0e6eb; color: var(--text-2); white-space: nowrap; }
.qs-b-draft { background: #fff3cd; color: #8a6d00; } .qs-b-locked { background: #dcefe3; color: #1e7a45; }
.qs-b-training { background: #ede4f7; color: #6a3d9a; }
.qs-b-bad, .qs-b-urgent { background: #fde2df; color: #b03a2e; } .qs-b-warn, .qs-b-important { background: #fff1d6; color: #8a5a00; }
.qs-b-ok { background: #dcefe3; color: #1e7a45; }
.qs-empty { padding: 22px 16px; color: var(--muted); text-align: center; }
.qs-foot { display: flex; gap: 14px; align-items: center; padding: 8px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.qs-foot .qs-status { margin-left: auto; }
@media (max-width: 600px) {
  .qs-backdrop { padding: 8px; }
  .qs-panel { max-height: 86vh; }
  .qs-foot > span:not(.qs-status) { display: none; }
}

/* ---------- dark mode fixes ---------- */
@media screen {
  :root[data-theme="dark"] .hs-card, :root[data-theme="dark"] .hs-dest-row, :root[data-theme="dark"] .hs-opt, :root[data-theme="dark"] .qs-panel { background: var(--dk-surface); }
  :root[data-theme="dark"] .hs-card.hs-l-bad { background: #2a1d1f; }
  :root[data-theme="dark"] .hs-name, :root[data-theme="dark"] .hs-mini-name { color: var(--dk-heading); }
  :root[data-theme="dark"] .qs-item.active, :root[data-theme="dark"] .hs-dest-row.on, :root[data-theme="dark"] button.hs-dest-row:hover { background: var(--dk-surface-2); }
  :root[data-theme="dark"] .hs-alert { background: #3a2022; border-color: #6b2f2a; color: #f4b7ae; }
}
