:root {
  --bg-top: #666d73;
  --bg-bottom: #4c5258;
  --panel: #1f2524;
  --panel-soft: #272d2c;
  --panel-strong: #181d1d;
  --row-line: rgba(255, 255, 255, 0.08);
  --text: #f4f5f1;
  --muted: #a7aea9;
  --teal: #02685a;
  --teal-2: #0c7d6d;
  --red: #ff4a3d;
  --orange: #f8a117;
  --green: #59c454;
  --blue: #3297ee;
  --white: #f3f3f3;
  --gold: #f3cf45;
  --total: #b8b5b2;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Titillium Web", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top center, rgba(255, 255, 255, 0.08), transparent 18rem),
    linear-gradient(180deg, var(--bg-top) 0%, #5d6469 16%, var(--bg-bottom) 100%);
}

.page-shell {
  width: min(1500px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

.app-header,
.notice,
.dashboard {
  width: min(100%, 1460px);
  margin: 0 auto 18px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
}

.eyebrow,
.board-kicker,
.subtitle,
.project-note,
.meta-label,
.updated-at,
.hospital-address {
  color: var(--muted);
}

.eyebrow,
.board-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
}

.project-note {
  margin: 0;
  text-align: right;
  max-width: 46ch;
  font-size: 0.92rem;
}

.notice {
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(34, 39, 39, 0.82);
  border: 1px solid rgba(255, 214, 102, 0.35);
  color: #ffe286;
  box-shadow: var(--shadow);
}

.notice.info {
  border-color: rgba(115, 208, 255, 0.3);
  color: #d8f2ff;
}

.notice.error {
  border-color: rgba(255, 108, 108, 0.35);
  color: #ffd2d2;
}

.board {
  background: linear-gradient(180deg, rgba(31, 37, 36, 0.98) 0%, rgba(28, 34, 33, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.board-top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 28px 18px;
}

.board-title {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.title-mark {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ffffff 0%, #e4ebe8 100%);
  color: #1d2423;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  flex-shrink: 0;
}

h1 {
  margin: 4px 0 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.98;
}

h1 span {
  color: var(--gold);
}

.subtitle {
  margin: 10px 0 0;
  max-width: 54ch;
  font-size: 1rem;
}

.board-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.tag-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(243, 207, 69, 0.38);
  background: rgba(243, 207, 69, 0.12);
  color: #ffe58d;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.tag-link:hover {
  transform: translateY(-1px);
  border-color: rgba(243, 207, 69, 0.58);
  background: rgba(243, 207, 69, 0.2);
}

.tag-link:focus-visible {
  outline: none;
  border-color: rgba(243, 207, 69, 0.7);
}

.btn {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(41, 47, 46, 0.98);
  color: var(--text);
  font: inherit;
}

.btn:focus-visible {
  border-color: rgba(243, 207, 69, 0.55);
  outline: none;
}

.btn {
  min-width: 128px;
  min-height: 66px;
  padding: 0 20px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(243, 207, 69, 0.45);
}

.btn:disabled {
  cursor: progress;
  opacity: 0.7;
}

.table-shell {
  border-top: 1px solid var(--row-line);
}

.table-head,
.hospital-row {
  display: grid;
  grid-template-columns: minmax(290px, 2.8fr) repeat(5, minmax(90px, 0.82fr)) minmax(138px, 1fr);
  gap: 16px;
  align-items: center;
}

.table-head {
  padding: 18px 28px;
  border-bottom: 1px solid var(--row-line);
  color: #eef1ed;
  font-size: 0.9rem;
  font-weight: 700;
}

.head-cell {
  text-align: center;
}

.head-presidio,
.hospital-cell {
  text-align: left;
}

.head-total {
  text-align: right;
}

.hospital-list {
  display: grid;
}

.hospital-group-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 18px 28px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: #f1f4ef;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hospital-group-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.03));
}

.hospital-group-divider.group-0 {
  color: #c5f6bf;
}

.hospital-group-divider.group-1 {
  color: #ffe89f;
}

.hospital-group-divider.group-2 {
  color: #d9dfdb;
}

.hospital-row {
  padding: 18px 28px;
  border-top: 1px solid var(--row-line);
}

.hospital-row:first-child {
  border-top: 0;
}

.hospital-row.is-unavailable {
  opacity: 0.86;
}

.hospital-cell {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.hospital-chip {
  width: fit-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-2) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.hospital-row.is-unavailable .hospital-chip {
  background: linear-gradient(135deg, #3f4a49 0%, #4b5756 100%);
}

.hospital-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.96);
  color: #1e2423;
  font-size: 1rem;
  font-weight: 800;
  flex-shrink: 0;
}

.hospital-copy {
  min-width: 0;
}

.hospital-name {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hospital-address {
  margin: 6px 0 0;
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hospital-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  min-height: 1.25rem;
}

.data-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-status.live {
  border-color: rgba(89, 196, 84, 0.28);
  background: rgba(89, 196, 84, 0.14);
  color: #b8efb6;
}

.data-status.stale {
  border-color: rgba(243, 207, 69, 0.34);
  background: rgba(243, 207, 69, 0.12);
  color: #ffe58d;
}

.data-status.catalog {
  border-color: rgba(167, 174, 169, 0.22);
  background: rgba(167, 174, 169, 0.12);
  color: #d9dfdb;
}

.updated-at,
.snapshot-at {
  font-size: 0.82rem;
}

.updated-at {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  font-weight: 700;
  color: #eff4f0;
}

.updated-at.is-live {
  border-color: rgba(89, 196, 84, 0.26);
  background: rgba(89, 196, 84, 0.12);
  color: #d9f7d4;
}

.updated-at.is-stale,
.snapshot-at {
  color: #d6dbd8;
}

.updated-at.is-stale {
  border-color: rgba(243, 207, 69, 0.3);
  background: rgba(243, 207, 69, 0.12);
  color: #fff0b3;
}

.snapshot-at {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.snapshot-at[hidden] {
  display: none;
}

.snapshot-at.is-old {
  border-color: rgba(255, 74, 61, 0.42);
  background: rgba(255, 74, 61, 0.16);
  color: #ffd6d2;
}

.metric-cell {
  display: flex;
  justify-content: center;
}

.metric-pill,
.total-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  min-height: 62px;
}

.metric-pill {
  border-radius: 999px;
  padding: 0 18px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}

.metric-pill strong {
  font-size: 1.4rem;
  line-height: 1;
}

.metric-pill.red {
  background: var(--red);
  color: #fff;
}

.metric-pill.orange {
  background: var(--orange);
  color: #171717;
}

.metric-pill.green {
  background: var(--green);
  color: #fff;
}

.metric-pill.blue {
  background: var(--blue);
  color: #fff;
}

.metric-pill.white {
  background: var(--white);
  color: #111;
}

.hospital-row.is-unavailable .metric-pill {
  background: #485150;
  color: #d7dbd8;
}

.total-cell {
  justify-content: flex-end;
}

.total-pill {
  gap: 8px;
  border-radius: 999px;
  padding: 0 16px;
  background: var(--total);
  color: #424242;
  min-width: 140px;
  justify-content: space-between;
}

.hospital-total-value {
  font-size: 1.5rem;
  line-height: 1;
}

.hospital-total-label {
  font-size: 0.82rem;
  text-transform: lowercase;
  white-space: nowrap;
}

.hospital-row.is-unavailable .total-pill {
  background: #5c6463;
  color: #ecefed;
}

.empty-state {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1220px) {
  .meta-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .board-top {
    flex-direction: column;
  }

  .board-actions {
    justify-content: stretch;
    min-width: 0;
  }

  .search-field {
    min-width: 0;
    flex: 1 1 320px;
  }

  .tag-link {
    align-self: flex-start;
  }
}

@media (max-width: 860px) {
  .page-shell {
    width: min(100vw - 18px, 100%);
    padding-top: 14px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .project-note {
    text-align: left;
  }

  .meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-head {
    display: none;
  }

  .hospital-list {
    gap: 12px;
    padding: 12px;
  }

  .hospital-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    background: rgba(39, 45, 44, 0.96);
  }

  .hospital-cell,
  .total-cell {
    grid-column: 1 / -1;
  }

  .metric-cell,
  .total-cell {
    justify-content: flex-start;
  }

  .metric-cell::before,
  .total-cell::before {
    content: attr(data-label);
    display: block;
    min-width: 128px;
    color: var(--muted);
    font-size: 0.82rem;
  }

  .metric-cell,
  .total-cell {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .metric-pill,
  .total-pill {
    min-width: 56px;
    min-height: 56px;
  }

  .total-pill {
    min-width: 150px;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: calc(100vw - 12px);
  }

  .notice,
  .dashboard,
  .app-header {
    margin-bottom: 12px;
  }

  .board-top,
  .meta-grid,
  .toolbar {
    padding-inline: 16px;
  }

  .board-top {
    padding-top: 18px;
  }

  .meta-grid {
    grid-template-columns: 1fr;
  }

  .board-actions {
    width: 100%;
  }

  .tag-link,
  .search-field,
  .btn {
    width: 100%;
  }

  .tag-link {
    min-height: 44px;
  }

  .btn {
    min-height: 56px;
  }

  input[type="search"] {
    min-height: 56px;
  }

  .hospital-row {
    grid-template-columns: 1fr;
  }

  .metric-cell,
  .total-cell {
    flex-wrap: wrap;
  }

  .metric-cell::before,
  .total-cell::before {
    min-width: 0;
    width: 100%;
  }
}
