:root{
  --bg:#f6fbff;
  --bg2:#eef6ff;
  --card:#ffffff;
  --card2:#f2f7ff;
  --text:#0b1220;
  --muted:#5a6a82;
  --border:rgba(11,18,32,.12);
  --shadow:0 10px 30px rgba(11,18,32,.08);
  --shadow2:0 6px 18px rgba(11,18,32,.10);
  --accent:#2b6de8;
  --accent2:#7fb0ff;
  --danger:#d64545;
  --good:#1f8f5f;
  --warn:#d08a00;
  --radius:22px;
  --radius-sm:16px;
  --maxw:1100px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background:
    radial-gradient(1200px 800px at 20% -10%, rgba(127,176,255,.35), transparent 60%),
    radial-gradient(900px 600px at 100% 10%, rgba(43,109,232,.20), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg2));
  color:var(--text);
}

a{color:inherit}

/* Topbar */
.topbar{
  position:sticky;
  top:0;
  z-index:20;
  padding:14px 14px 10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:nowrap;
  background:rgba(246,251,255,.78);
  backdrop-filter:saturate(140%) blur(10px);
  border-bottom:1px solid var(--border);
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}
.logo{
  width:42px;
  height:42px;
  border-radius:16px;
  display:grid;
  place-items:center;
  font-weight:800;
  color:#0b1220;
  background:linear-gradient(180deg, rgba(127,176,255,.9), rgba(43,109,232,.85));
  box-shadow:0 10px 20px rgba(43,109,232,.18);
}
.brand-title{font-weight:800; letter-spacing:.2px; line-height:1.1}
.brand-sub{color:var(--muted); font-size:12px; line-height:1.1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:48vw;}

.resources{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:nowrap;
}
.chip{
  display:flex;
  align-items:center;
  gap:10px;
  padding:9px 12px;
  border-radius:999px;
  background:rgba(255,255,255,.75);
  border:1px solid var(--border);
  box-shadow:0 10px 20px rgba(11,18,32,.06);
  min-width:86px;
  justify-content:space-between;
}
.chip .k{color:var(--muted); font-weight:700}
.chip .v{font-weight:800}

/* Layout */
.app{
  max-width:var(--maxw);
  margin:0 auto;
  padding:14px 14px 92px; /* leave room for bottom tabs */
}

.grid{display:grid; gap:14px}
.grid-auto{grid-template-columns:repeat(2, minmax(0,1fr))}
.col-span-2{grid-column:span 2}

.card{
  background:rgba(255,255,255,.78);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  overflow:hidden;
}
.card-h{
  padding:16px 16px 10px;
  font-weight:800;
}
.card-b{padding:0 16px 16px}

/* New internal card head/body used in services */
.card-head{padding:16px; display:flex; align-items:center; justify-content:space-between; gap:12px}
.card-title{font-weight:800}
.card-sub{color:var(--muted); font-size:12px; margin-top:2px}
.card-body{padding:0 16px 16px}

.hero .card-b{padding-top:8px}
.hero-top{display:flex; align-items:flex-start; justify-content:space-between; gap:12px}
.label{color:var(--muted); font-size:12px; font-weight:700; text-transform:none}
.big{font-size:22px; font-weight:900; letter-spacing:.2px}
.num{font-size:26px; font-weight:900}
.small{font-size:12px}
.muted{color:var(--muted)}

.pill{
  padding:8px 12px;
  border-radius:999px;
  background:rgba(43,109,232,.10);
  border:1px solid rgba(43,109,232,.18);
  font-weight:800;
  font-size:12px;
  white-space:nowrap;
}
.pill.good{background:rgba(31,143,95,.12); border-color:rgba(31,143,95,.20)}
.pill.warn{background:rgba(208,138,0,.13); border-color:rgba(208,138,0,.22)}
.pill.muted{background:rgba(11,18,32,.06); border-color:rgba(11,18,32,.10); color:var(--muted)}

.bar{height:10px; border-radius:999px; background:rgba(11,18,32,.08); overflow:hidden; border:1px solid rgba(11,18,32,.08)}
.bar-fill{height:100%; width:0%; background:linear-gradient(90deg, rgba(127,176,255,1), rgba(43,109,232,1));}

.kpis{display:grid; gap:12px; margin-top:12px}
.kpis-compact{grid-template-columns:repeat(2, minmax(0,1fr))}
.kpi{padding:12px; border-radius:18px; background:rgba(255,255,255,.7); border:1px solid rgba(11,18,32,.10)}

.actions{display:flex; gap:10px; align-items:center; margin-top:12px; flex-wrap:wrap}
.row{display:flex; gap:10px; align-items:center}
.between{justify-content:space-between}

.btn{
  border:1px solid rgba(11,18,32,.14);
  background:rgba(255,255,255,.9);
  color:var(--text);
  padding:10px 14px;
  border-radius:16px;
  font-weight:800;
  cursor:pointer;
  box-shadow:0 10px 20px rgba(11,18,32,.06);
}
.btn:hover{transform:translateY(-1px)}
.btn:active{transform:translateY(0px)}
.btn[disabled]{opacity:.45; cursor:not-allowed; transform:none}

.btn.primary{background:linear-gradient(180deg, rgba(127,176,255,.95), rgba(43,109,232,.92)); border-color:rgba(43,109,232,.35); color:#061021}
.btn.ghost{background:rgba(255,255,255,.60)}
.btn.danger{border-color:rgba(214,69,69,.35)}

.icon-only{padding:10px 12px}

.list{display:flex; flex-direction:column; gap:10px; margin-top:10px}
.item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px;
  border-radius:18px;
  background:rgba(255,255,255,.70);
  border:1px solid rgba(11,18,32,.10);
}
.title{font-weight:800}

.select{
  border:1px solid rgba(11,18,32,.16);
  background:rgba(255,255,255,.85);
  border-radius:14px;
  padding:8px 10px;
  font-weight:700;
}

/* Queue */
.queue{display:flex; flex-direction:column; gap:10px; margin-top:12px}
.q{
  padding:12px;
  border-radius:18px;
  background:rgba(255,255,255,.70);
  border:1px solid rgba(11,18,32,.10);
}
.qname{font-weight:900}
.qsub{color:var(--muted); font-size:12px; margin-top:4px}

/* Patients board */
.pboard{display:flex; flex-direction:column; gap:10px; margin-top:10px}
.pgrp{padding:12px; border-radius:18px; background:rgba(43,109,232,.06); border:1px solid rgba(43,109,232,.12)}
.pgrp-h{display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:8px}
.pgrp-h .h{font-weight:900}
.prow{display:flex; justify-content:space-between; gap:10px; padding:10px 10px; border-radius:14px; background:rgba(255,255,255,.75); border:1px solid rgba(11,18,32,.08)}
.pmeta{color:var(--muted); font-size:12px; margin-top:2px}
.ptime{font-weight:900; white-space:nowrap}

/* Tabs */
.tabs{
  position:fixed;
  left:0;
  right:0;
  bottom:0;
  z-index:30;
  display:flex;
  justify-content:space-around;
  gap:6px;
  padding:10px 10px calc(10px + env(safe-area-inset-bottom));
  background:rgba(246,251,255,.86);
  backdrop-filter:saturate(140%) blur(10px);
  border-top:1px solid var(--border);
}
.tab{
  flex:1;
  max-width:120px;
  border:1px solid transparent;
  background:transparent;
  border-radius:18px;
  padding:8px 8px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:4px;
  cursor:pointer;
}
.tab-ico{font-size:18px}
.tab-lbl{font-size:11px; font-weight:800; color:var(--muted)}
.tab.is-active{
  background:rgba(127,176,255,.28);
  border-color:rgba(43,109,232,.18);
  box-shadow:0 12px 22px rgba(43,109,232,.10);
}
.tab.is-active .tab-lbl{color:var(--text)}

/* Panels */
.panel{animation:fade .12s ease}
@keyframes fade{from{opacity:.0; transform:translateY(4px)} to{opacity:1; transform:none}}

/* Footer */
.footer{
  position:fixed;
  left:0;
  right:0;
  bottom:64px;
  padding:8px 14px;
  color:var(--muted);
  text-align:center;
  font-size:12px;
  pointer-events:none;
}

/* Dialog */
.dialog{
  border:none;
  border-radius:24px;
  width:min(540px, 92vw);
  padding:0;
  box-shadow:0 30px 80px rgba(11,18,32,.18);
  background:rgba(255,255,255,.95);
}
.dialog::backdrop{background:rgba(11,18,32,.35)}
.dialog-h{display:flex; justify-content:space-between; align-items:center; padding:16px; border-bottom:1px solid rgba(11,18,32,.10)}
.dialog-title{font-weight:900}
.dialog-b{padding:16px; white-space:pre-wrap}
.dialog-f{padding:0 16px 16px}
.icon{border:none; background:rgba(11,18,32,.06); border:1px solid rgba(11,18,32,.10); padding:8px 10px; border-radius:14px; cursor:pointer}

/* Manage sheet (submenu) */
.sheet{
  position:fixed;
  left:0;
  right:0;
  bottom:0;
  z-index:40;
  background:rgba(255,255,255,.92);
  backdrop-filter:saturate(140%) blur(10px);
  border-top:1px solid var(--border);
  border-radius:24px 24px 0 0;
  box-shadow:0 -18px 40px rgba(11,18,32,.14);
  padding:14px 14px calc(14px + env(safe-area-inset-bottom));
}
.sheet-h{display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:10px}
.sheet-title{font-weight:900}
.sheet-actions{display:flex; gap:10px}

/* Responsive */
@media (max-width: 820px){
  .grid-auto{grid-template-columns:1fr}
  .col-span-2{grid-column:span 1}
}

@media (max-width: 520px){
  .brand-sub{display:none}
  .chip{min-width:72px; padding:8px 10px}
  .chip .k{font-size:12px}
  .chip .v{font-size:14px}
  .app{padding-bottom:96px}
  .footer{bottom:70px}
}

/* Patients board */
.patients-board .board{background:var(--card); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow2); padding:14px;}
.board-head{display:flex; justify-content:space-between; align-items:flex-end; gap:12px; margin-bottom:10px}
.board-title{font-weight:900; font-size:16px}
.board-sub{color:var(--muted); font-size:12px}
.board-list{display:flex; flex-direction:column; gap:10px}
.board-row{display:flex; justify-content:space-between; align-items:center; gap:12px; padding:12px; border-radius:18px; background:linear-gradient(180deg, rgba(43,109,232,.06), rgba(43,109,232,.03)); border:1px solid rgba(43,109,232,.12)}
.br-name{font-weight:800}
.br-meta{color:var(--muted); font-size:12px; margin-top:2px}
.pill{display:inline-flex; align-items:center; justify-content:center; padding:8px 10px; border-radius:999px; font-weight:800; font-size:12px; white-space:nowrap; border:1px solid rgba(11,18,32,.12); background:rgba(255,255,255,.7)}
.pill.good{border-color:rgba(31,143,95,.25)}
.pill.muted{border-color:rgba(11,18,32,.12)}

