/* Praesum "Work order" theme (see PraesumHealthcareGP/praesum-ifix THEME.md), plain-CSS version */
@import url('/fonts/ibm-plex-sans/400.css');
@import url('/fonts/ibm-plex-sans/500.css');
@import url('/fonts/ibm-plex-sans/600.css');
@import url('/fonts/ibm-plex-sans/700.css');
@import url('/fonts/ibm-plex-mono/500.css');
@import url('/fonts/barlow-semi-condensed/500.css');
@import url('/fonts/barlow-semi-condensed/600.css');
@import url('/fonts/barlow-semi-condensed/700.css');

:root {
  --bg: #EEF1F5; --panel: #FFFFFF; --ink: #0F1A2B; --muted: #5B6779; --line: #D9DFE7;
  --primary: #1F4FD1; --rail: #0F1A2B; --amber: #E8A317; --bad: #D64545; --good: #1F9D63;
  --tint: #F4F6F9; --row-hover: #F6F8FB;
  --display: "Barlow Semi Condensed", "IBM Plex Sans", system-ui, sans-serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0A1220; --panel: #111C2E; --ink: #E6ECF4; --muted: #8C99AB; --line: #1E2C42;
    --primary: #4C7DFF; --rail: #070D18; --bad: #F07171; --good: #34C185;
    --tint: #0E1828; --row-hover: #15223A;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-weight: 500; }

/* Buttons and inputs: 8px radius, never pills */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font: 600 14px var(--sans); cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.wide { width: 100%; height: 44px; font-size: 15px; }
.btn.ghost { background: transparent; }
.btn.small { height: 30px; font-size: 13px; padding: 0 10px; }
.input {
  height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font: 14px var(--sans); min-width: 0;
}
.input:focus, .btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* Brand mark: amber tag, navy icon */
.brand-logo { width: 40px; height: 40px; border-radius: 10px; background: var(--amber); display: grid; place-items: center; flex: none; }
.brand-logo svg { width: 24px; height: 24px; fill: none; stroke: #0F1A2B; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.brand-logo.lg { width: 56px; height: 56px; border-radius: 12px; }
.brand-logo.lg svg { width: 32px; height: 32px; }

/* Sign-in */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 32px; }
.login-card h1 { font-size: 36px; line-height: 1; margin: 18px 0 8px; }
.login-card p { margin: 0 0 20px; }
.login-error { color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); border-radius: 8px; padding: 10px 12px; font-size: 14px; }

/* Shell */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100%; }
.rail { background: var(--rail); color: #fff; display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 6px 18px; }
.brand-name { font: 700 20px/1 var(--display); }
.brand-sub { color: #9FB0C8; font-size: 13px; margin-top: 3px; }
.rail-head { font: 600 15px var(--display); color: #9FB0C8; padding: 8px 8px 6px; }
.facility-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.fac {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  padding: 9px 10px; border-radius: 8px; border: 0; background: transparent; color: #D3DCE8;
  font: 500 14px var(--sans); text-align: left; cursor: pointer;
}
.fac:hover { background: #1A2840; color: #fff; }
.fac.active { background: #fff; color: var(--rail); font-weight: 600; }
.fac .count { font-family: var(--mono); font-size: 13px; color: inherit; opacity: .85; }
.fac .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-foot { border-top: 1px solid #22324D; padding: 14px 6px 0; margin-top: 10px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; color: #9FB0C8; }
.rail-foot .btn { color: #D3DCE8; border-color: #2B3C5A; align-self: flex-start; }
.asof { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #6B7A90; flex: none; }
.dot.ok { background: var(--good); } .dot.stale { background: var(--amber); } .dot.bad { background: var(--bad); }
.who { display: flex; align-items: center; gap: 8px; color: #D3DCE8; }
.initials { width: 28px; height: 28px; border-radius: 8px; background: #22324D; display: grid; place-items: center; font: 600 12px var(--sans); color: #fff; }

/* Main */
.main { padding: 26px 32px 32px; min-width: 0; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.eyebrow { color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.topbar h1 { font-size: 44px; line-height: 1; font-weight: 700; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#search { width: 300px; }

/* Stats: flat bordered panels, big Barlow numbers */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; border-left-width: 5px; border-left-color: var(--primary); }
.stat.amber { border-left-color: var(--amber); } .stat.red { border-left-color: var(--bad); } .stat.green { border-left-color: var(--good); }
.stat .label { color: var(--muted); font-size: 14px; font-weight: 500; }
.stat .value { font: 700 44px/1 var(--display); margin-top: 8px; }
.stat .sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
.stat.hero { background: var(--rail); border-color: var(--rail); border-left-color: var(--primary); color: #fff; }
.stat.hero .label, .stat.hero .sub { color: #9FB0C8; }

/* Tabs: selected = solid ink */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: 600 14px var(--sans); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.tab .n { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.tab.active { background: var(--ink); border-color: var(--ink); color: var(--panel); }
.tab.active .n { color: inherit; opacity: .8; }

/* Table: one bordered panel, colored left edge per row */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--tint); font: 600 13px var(--display); color: var(--muted); text-align: left;
  padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none;
}
thead th.sorted { color: var(--ink); }
thead th .arrow { font-size: 10px; margin-left: 4px; }
tbody td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--row-hover); }
tbody td:first-child { border-left: 4px solid transparent; }
tr.edge-red td:first-child { border-left-color: var(--bad); }
tr.edge-amber td:first-child { border-left-color: var(--amber); }
tr.edge-blue td:first-child { border-left-color: var(--primary); }
tr.edge-green td:first-child { border-left-color: var(--good); }
tr.edge-grey td:first-child { border-left-color: var(--line); }
.pname { font-weight: 600; }
.psub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tag.red { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.tag.amber { color: #9A6A00; border-color: color-mix(in srgb, var(--amber) 60%, transparent); }
.tag.green { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.tag.blue { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, transparent); }
@media (prefers-color-scheme: dark) { .tag.amber { color: var(--amber); } }

.empty { min-height: 280px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px; gap: 10px; }
.empty .icon { width: 56px; height: 56px; border-radius: 12px; background: var(--tint); display: grid; place-items: center; }
.empty .icon svg { width: 28px; height: 28px; stroke: var(--muted); fill: none; stroke-width: 2; }
.empty h3 { font-size: 22px; }
.foot-note { color: var(--muted); font-size: 12px; margin: 14px 2px 0; }

.mobile-only { display: none; }

@media (max-width: 1200px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; justify-content: space-between; padding: 10px 14px; }
  .rail .brand { padding: 0; }
  .rail-head, .facility-list, .rail-foot .asof, .rail-foot .who { display: none; }
  .rail-foot { border: 0; padding: 0; margin: 0; }
  .mobile-only { display: inline-flex; }
  .main { padding: 18px 14px; }
  .topbar h1 { font-size: 34px; }
  #search { width: 100%; }
  .tools { width: 100%; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat .value { font-size: 34px; }
  .hide-sm { display: none; }
  .panel { overflow-x: auto; }
}
