/* Hospitally — interactive demo app */
html, body { height: 100%; }
body.app { overflow: hidden; }
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.sidebar { border-right: 1px solid var(--line); background: #0b0a09; display: flex; flex-direction: column; padding: 18px 12px; gap: 4px; overflow-y: auto; }
.sidebar .brand { padding: 4px 10px 18px; font-size: 19px; }
.prop { margin: 0 6px 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 12.5px; color: var(--muted); }
.prop b { display: block; color: var(--ink); font-weight: 500; font-size: 13.5px; }
.navi { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--ink-2); font-size: 14px; background: none; border: 0; text-align: left; width: 100%; }
.navi svg { width: 17px; height: 17px; flex: none; }
.navi:hover { background: rgba(255,255,255,0.04); color: var(--ink); }
.navi.on { background: rgba(220,170,94,0.12); color: var(--brass-2); }
.navi .count { margin-left: auto; font-size: 11px; font-family: var(--mono); padding: 1px 7px; border-radius: 999px; background: rgba(227,106,60,0.18); color: #f39a73; }
.side-foot { margin-top: auto; padding: 12px 6px 0; display: grid; gap: 8px; font-size: 12px; color: var(--muted); }
.side-foot button { background: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px; color: var(--ink-2); font-size: 12.5px; }
.side-foot a { color: var(--brass); }

.main { overflow-y: auto; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 16px 28px; background: rgba(14,13,11,0.85); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -0.02em; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.search { margin-left: auto; display: flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; height: 38px; width: 260px; }
.search input { background: none; border: 0; outline: 0; color: var(--ink); font: inherit; font-size: 14px; width: 100%; }
.clockpill { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; white-space: nowrap; }
.view { padding: 24px 28px 60px; display: grid; gap: 16px; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g12 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; padding: 18px; min-width: 0; }
.card h3 { margin: 0 0 14px; font-size: 13px; font-weight: 500; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 10px; letter-spacing: 0; }
.card h3 .acts { display: flex; gap: 6px; }
.metric b { display: block; font-size: 32px; letter-spacing: -0.035em; font-weight: 500; line-height: 1.1; }
.metric span { color: var(--muted); font-size: 13px; }
.metric em { font-style: normal; font-size: 12px; color: var(--sage); display: block; margin-top: 4px; }
.metric em.bad { color: #f39a73; }
.pill { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,0.06); color: var(--ink-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.pill.brass { background: rgba(220,170,94,0.15); color: var(--brass-2); }
.pill.clay { background: rgba(227,106,60,0.16); color: #f39a73; }
.pill.sage { background: rgba(130,185,138,0.16); color: #a9d8b0; }
.pill.sky { background: rgba(116,163,220,0.16); color: #a9c8ef; }
.pill.plum { background: rgba(180,138,214,0.16); color: #d2b6ea; }
.sbtn { height: 32px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-2); background: rgba(255,255,255,0.03); font-size: 13px; color: var(--ink); white-space: nowrap; }
.sbtn:hover { border-color: var(--ink-2); }
.sbtn.primary { background: var(--brass); color: #1a140a; border-color: var(--brass); font-weight: 500; }
.sbtn.sage { background: rgba(130,185,138,0.16); border-color: rgba(130,185,138,0.4); color: #a9d8b0; }
.sbtn.danger { color: #f39a73; border-color: rgba(227,106,60,0.4); }
.sbtn:disabled { opacity: .4; cursor: default; }
.rowlist { display: grid; gap: 8px; }
.r { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,0.025); border: 1px solid transparent; min-width: 0; }
.r:hover { border-color: var(--line); }
.r .av { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 11.5px; font-weight: 600; color: #15130f; }
.r .t { flex: 1; min-width: 0; }
.r .t b { display: block; font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r .t span { color: var(--muted); font-size: 12.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r .x { display: flex; gap: 6px; align-items: center; flex: none; }
.empty { color: var(--muted); font-size: 14px; padding: 18px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }

.floors { display: grid; gap: 6px; }
.floor { display: grid; grid-template-columns: 30px repeat(20, minmax(0, 1fr)); gap: 5px; align-items: center; }
.floor .fl { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.room { border: 0; aspect-ratio: 1.25; padding: 0; min-width: 0; border-radius: 9px; font-family: var(--mono); font-size: 10.5px; font-weight: 600; color: rgba(0,0,0,0.7); display: grid; place-items: center; position: relative; transition: transform .15s, background .4s; }
.room:hover { transform: translateY(-2px); }
.room.sel { outline: 2px solid var(--ink); outline-offset: 2px; }
.room .dot { position: absolute; top: 4px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: rgba(0,0,0,0.55); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters button { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.filters button.on { border-color: var(--brass); color: var(--brass-2); }
.filters i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

.fc { display: flex; align-items: flex-end; gap: 6px; height: 170px; }
.fc .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); height: 100%; justify-content: flex-end; }
.fc .col i { width: 100%; border-radius: 6px 6px 3px 3px; background: rgba(220,170,94,0.35); display: block; position: relative; }
.fc .col i.full { background: var(--clay); }
.fc .col i.high { background: var(--brass); }
.fc .col b { font-weight: 500; color: var(--ink-2); font-size: 11px; }

.inv-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr) auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.inv-row:last-child { border-bottom: 0; }
.inv-row b { font-weight: 500; font-size: 14px; display: block; }
.inv-row span { color: var(--muted); font-size: 12px; }
.inv-row .bar { height: 8px; }
.qty { display: flex; gap: 6px; align-items: center; }
.qty button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line-2); background: none; }
.qty b { font-family: var(--mono); font-size: 13px; min-width: 52px; text-align: center; }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: #13110e; border-left: 1px solid var(--line-2); z-index: 60; transform: translateX(100%); transition: transform .35s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; box-shadow: -30px 0 60px rgba(0,0,0,0.5); }
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -0.02em; }
.drawer-body { padding: 20px 22px; overflow-y: auto; display: grid; gap: 16px; align-content: start; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 14px; }
.kv span { color: var(--muted); }
.x-btn { background: none; border: 1px solid var(--line); width: 34px; height: 34px; border-radius: 10px; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .3s; }
.scrim.open { opacity: 1; pointer-events: auto; }

.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea { background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; color: var(--ink); font: inherit; font-size: 14px; padding: 9px 11px; outline: 0; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brass); }

/* chat */
.chatwrap { display: grid; grid-template-columns: 280px minmax(0, 1fr) 340px; gap: 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; height: calc(100dvh - 150px); min-height: 520px; background: var(--bg-2); }
.threads { border-right: 1px solid var(--line); overflow-y: auto; }
.thread { padding: 14px 16px; border-bottom: 1px solid var(--line); cursor: pointer; display: grid; gap: 3px; }
.thread:hover { background: rgba(255,255,255,0.02); }
.thread.on { background: rgba(220,170,94,0.08); }
.thread b { font-weight: 500; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.thread span { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo { display: flex; flex-direction: column; min-width: 0; }
.convo-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.convo-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.convo-msgs .msg { font-size: 14px; max-width: 75%; }
.convo-msgs .msg.sys { font-size: 11px; }
.compose { border-top: 1px solid var(--line); padding: 12px; display: grid; gap: 8px; }
.compose .quick { display: flex; gap: 6px; flex-wrap: wrap; }
.compose .quick button { font-size: 12px; border: 1px dashed var(--line-2); background: none; border-radius: 999px; padding: 4px 10px; color: var(--ink-2); }
.compose form { display: flex; gap: 8px; }
.compose input { flex: 1; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; color: var(--ink); font: inherit; font-size: 14px; padding: 9px 11px; outline: 0; min-width: 0; }
.actionpane { border-left: 1px solid var(--line); padding: 16px; overflow-y: auto; display: grid; gap: 14px; align-content: start; }
.apilog { font-family: var(--mono); font-size: 11.5px; line-height: 1.6; background: #0a0908; border: 1px solid var(--line); border-radius: 12px; padding: 12px; max-height: 260px; overflow-y: auto; color: var(--ink-2); }
.apilog div { white-space: pre-wrap; word-break: break-word; }
.apilog .ts { color: var(--dim); }
.suggest { border: 1px solid rgba(220,170,94,0.4); background: rgba(220,170,94,0.06); border-radius: 14px; padding: 14px; display: grid; gap: 8px; }
.suggest .row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--ink-2); }
.suggest .row span:last-child { color: var(--ink); text-align: right; }

.toasts { position: fixed; bottom: 20px; right: 20px; display: grid; gap: 8px; z-index: 80; }
.tst { background: #1e1b16; border: 1px solid var(--line-2); border-radius: 12px; padding: 11px 14px; font-size: 13.5px; box-shadow: 0 20px 40px rgba(0,0,0,0.5); animation: toastIn .4s ease both; max-width: 340px; }
.tst b { color: var(--brass-2); font-weight: 500; }

.tabbar-m { display: none; }
.demo-note { font-size: 12px; color: var(--muted); }

@media (max-width: 1200px) {
  .chatwrap { grid-template-columns: 230px minmax(0, 1fr); }
  .actionpane { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .chatwrap { height: auto; }
  .convo { min-height: 480px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding-bottom: 72px; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .search { order: 3; width: 100%; margin-left: 0; }
  .view { padding: 16px 16px 40px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g2, .g21, .g12 { grid-template-columns: 1fr; }
  .floor { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .floor .fl { grid-column: 1 / -1; margin-top: 6px; }
  .chatwrap { grid-template-columns: 1fr; }
  .threads { max-height: 200px; border-right: 0; border-bottom: 1px solid var(--line); }
  .inv-row { grid-template-columns: 1fr; gap: 8px; }
  .tabbar-m { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(11,10,9,0.94); backdrop-filter: blur(14px); border-top: 1px solid var(--line); overflow-x: auto; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar-m button { flex: 1 0 auto; background: none; border: 0; display: grid; justify-items: center; gap: 3px; font-size: 10.5px; color: var(--muted); padding: 6px 10px; }
  .tabbar-m button svg { width: 19px; height: 19px; }
  .tabbar-m button.on { color: var(--brass); }
  .clockpill { display: none; }
}
@media (max-width: 1100px) and (min-width: 901px) {
  .g21, .g12 { grid-template-columns: 1fr; }
  .search { width: 200px; }
}
