/* PharmaGest SaaS — interface mobile d'abord */
:root {
  --bg: #f3f6f5; --surface: #ffffff; --surface-2: #f7faf9; --border: #e1e8e6;
  --text: #15201d; --muted: #5f6f6a; --primary: #0b7a5c; --primary-2: #0a6a50; --primary-soft: #e3f3ee;
  --ok: #157f3b; --ok-bg: #e4f5ea; --warn: #9a6100; --warn-bg: #fdf1dc; --bad: #b42318; --bad-bg: #fde8e6;
  --info: #175cd3; --info-bg: #e5eefc; --mute-bg: #eef1f0;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --side: 248px; --top: 56px; --bottom: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1513; --surface: #16201d; --surface-2: #1b2723; --border: #27352f;
    --text: #e7efec; --muted: #9db0a9; --primary: #2bb48a; --primary-2: #239d77; --primary-soft: #143329;
    --ok: #5fd08a; --ok-bg: #12301f; --warn: #f0b44c; --warn-bg: #33270f; --bad: #ff7b6e; --bad-bg: #3a1714;
    --info: #7aa7ff; --info-bg: #142340; --mute-bg: #222e2a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
.i { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; } .hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }

/* ---------- Structure ---------- */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: .5rem; padding: 0 .75rem;
  padding-top: env(safe-area-inset-top); height: calc(var(--top) + env(safe-area-inset-top));
  background: var(--primary); color: #fff; }
.topbar a, .topbar button { color: #fff; }
.topbar .brand { font-weight: 700; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; display: flex; align-items: center; gap: .5rem; }
.topbar .brand img { width: 30px; height: 30px; border-radius: 8px; background: #fff; object-fit: contain; }
.iconbtn { background: transparent; border: 0; padding: .5rem; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; font: inherit; }
.iconbtn:hover { background: rgba(255,255,255,.14); }
.sidebar { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: var(--side); background: var(--surface); border-right: 1px solid var(--border);
  overflow-y: auto; transform: translateX(-100%); transition: transform .2s ease; padding: env(safe-area-inset-top) 0 1rem; }
.sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.25); }
.sidebar .head { padding: 1rem; border-bottom: 1px solid var(--border); }
.sidebar .head strong { display: block; }
.nav { list-style: none; margin: 0; padding: .5rem; }
.nav li a { display: flex; align-items: center; gap: .7rem; padding: .62rem .75rem; border-radius: 10px; color: var(--text); }
.nav li a:hover { background: var(--surface-2); }
.nav li a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav .sep { margin: .6rem .75rem .25rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.nav .count { margin-left: auto; background: var(--bad); color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 .45rem; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; display: none; }
.scrim.show { display: block; }
main { padding: 1rem .75rem calc(var(--bottom) + 1.25rem + env(safe-area-inset-bottom)); max-width: 1280px; margin: 0 auto; }
.bottombar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(var(--bottom) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(5, 1fr); }
.bottombar a, .bottombar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .7rem; color: var(--muted); background: none; border: 0; font-family: inherit; cursor: pointer; }
.bottombar a.active { color: var(--primary); font-weight: 600; }
.bottombar .pos, .bottombar a.pos.active { color: #fff; }
.bottombar .pos span.circle { background: var(--primary); width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; margin-top: -18px; box-shadow: 0 4px 12px rgba(11,122,92,.4); }

@media (min-width: 1024px) {
  .sidebar { transform: none; padding-top: 0; }
  .topbar { margin-left: var(--side); }
  .topbar .menu-btn { display: none; }
  main { margin-left: var(--side); padding: 1.5rem 2rem 2rem; }
  .bottombar { display: none; }
  .scrim { display: none !important; }
  body.wide main { max-width: none; }
}
@media (min-width: 1024px) { main { max-width: calc(1280px + var(--side)); } }

/* ---------- Composants ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem; }
.card > h2:first-child, .card > h3:first-child { margin-bottom: .75rem; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 1rem 1rem 0; }
.grid { display: grid; gap: .75rem; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.kpis { display: grid; gap: .75rem; grid-template-columns: repeat(2, 1fr); margin-bottom: 1rem; }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow); display: block; color: var(--text); }
.kpi .label { color: var(--muted); font-size: .8rem; display: flex; align-items: center; gap: .35rem; }
.kpi .value { font-size: 1.3rem; font-weight: 700; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .78rem; color: var(--muted); }
.kpi.ok .value { color: var(--ok); } .kpi.bad .value { color: var(--bad); } .kpi.warn .value { color: var(--warn); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .6rem 1rem; min-height: 42px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); }
.btn.danger { color: var(--bad); border-color: var(--bad-bg); background: var(--bad-bg); }
.btn.ok { color: #fff; background: var(--ok); border-color: var(--ok); }
.btn.sm { padding: .3rem .6rem; min-height: 32px; font-size: .85rem; }
.btn.block { width:100%; }
.btn.lg { min-height: 52px; font-size: 1.05rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.info { background: var(--info-bg); color: var(--info); }
.badge.mute { background: var(--mute-bg); color: var(--muted); }

.alert { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid transparent; }
.alert.success { background: var(--ok-bg); color: var(--ok); } .alert.error { background: var(--bad-bg); color: var(--bad); }
.alert.warning { background: var(--warn-bg); color: var(--warn); } .alert.info { background: var(--info-bg); color: var(--info); }

/* Formulaires */
form .row { display: grid; gap: .75rem; grid-template-columns: 1fr; margin-bottom: .75rem; }
@media (min-width: 640px) { form .row.c2 { grid-template-columns: 1fr 1fr; } form .row.c3 { grid-template-columns: 1fr 1fr 1fr; } form .row.c4 { grid-template-columns: repeat(4, 1fr); } }
label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .25rem; }
label .req { color: var(--bad); }
input, select, textarea { width: 100%; padding: .6rem .7rem; min-height: 42px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 16px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
input[type=checkbox] { width: auto; min-height: 0; }
.help { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin-bottom: 1rem; }
.filters > * { flex: 1 1 150px; }
.filters .btn { flex: 0 0 auto; }
.search { position: relative; }
.search .i { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 2.3rem; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
tfoot td { font-weight: 700; background: var(--surface-2); }
td.actions-cell { white-space: nowrap; text-align: right; }
td.actions-cell form { display: inline; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }
tr.row-bad td { background: color-mix(in srgb, var(--bad-bg) 60%, transparent); }
tr.row-warn td { background: color-mix(in srgb, var(--warn-bg) 60%, transparent); }

/* Listes mobiles (cartes) */
@media (max-width: 719px) {
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { border-bottom: 1px solid var(--border); padding: .5rem .25rem; }
  table.responsive td { border: 0; padding: .2rem .75rem; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; text-align: left; }
  table.responsive td.primary-cell { font-weight: 700; font-size: 1rem; text-align: left; }
  table.responsive td.primary-cell::before { display: none; }
  table.responsive td.actions-cell { justify-content: flex-end; padding-top: .4rem; }
  table.responsive td.actions-cell::before { display: none; }
  table.responsive tfoot { display: block; } table.responsive tfoot tr { display: flex; justify-content: space-between; }
}

/* Graphique barres */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: .5rem; }
.bars .bar { flex: 1; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; opacity: .85; }
.bars .bar:hover { opacity: 1; }
.bars-x { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); margin-top: .3rem; }

/* Caisse (POS) */
.pos { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .pos { grid-template-columns: 1.3fr 1fr; align-items: start; } .pos .ticket { position: sticky; top: calc(var(--top) + 1rem); } }
.results { list-style: none; margin: .5rem 0 0; padding: 0; max-height: 55vh; overflow-y: auto; }
.results li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem .5rem; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 8px; }
.results li:hover, .results li.kb { background: var(--primary-soft); }
.results li.out { opacity: .5; cursor: not-allowed; }
.results .name { font-weight: 600; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: .25rem .75rem; padding: .6rem 0; border-bottom: 1px dashed var(--border); }
.cart-line .qty { display: flex; align-items: center; gap: .25rem; }
.cart-line .qty input { width: 64px; text-align: center; min-height: 36px; padding: .3rem; }
.cart-line .qty button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; display: grid; place-items: center; }
.totals { margin-top: .75rem; }
.totals div { display: flex; justify-content: space-between; padding: .2rem 0; }
.totals .grand { font-size: 1.35rem; font-weight: 800; color: var(--primary); border-top: 2px solid var(--border); padding-top: .5rem; margin-top: .3rem; }
.seg { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg label { margin: 0; flex: 1 1 auto; }
.seg input { display: none; }
.seg span { display: block; text-align: center; padding: .55rem .6rem; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-weight: 600; font-size: .85rem; }
.seg input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Divers */
.tabs { display: flex; gap: .25rem; overflow-x: auto; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.tabs a { padding: .6rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 600; }
.tabs a.active { color: var(--primary); border-color: var(--primary); }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--border); }
.list-plain li:last-child { border-bottom: 0; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; font-weight: 600; }
dialog { border: 0; border-radius: 16px; padding: 0; width: min(520px, 94vw); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog .dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1rem .25rem; }
dialog .dlg-body { padding: .5rem 1rem 1rem; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bottom) + 1rem + env(safe-area-inset-bottom)); z-index: 60;
  background: #15201d; color: #fff; padding: .7rem 1rem; border-radius: 10px; box-shadow: var(--shadow); max-width: 92vw; }
@media (min-width: 1024px) { .toast { bottom: 1.5rem; } }
.install-banner { display: none; align-items: center; gap: .75rem; background: var(--primary-soft); border: 1px solid var(--primary); color: var(--text); border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; }
.install-banner.show { display: flex; }
.install-banner p { margin: 0; flex: 1; font-size: .9rem; }

/* Pages invité */
.guest { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; background: linear-gradient(160deg, var(--primary) 0 38%, var(--bg) 38%); }
.guest .box { width: min(440px, 100%); }
.guest .logo { text-align: center; color: #fff; margin-bottom: 1rem; }
.guest .logo img { width: 72px; height: 72px; border-radius: 18px; background: #fff; padding: 8px; }
.guest .logo h1 { margin: .5rem 0 0; font-size: 1.5rem; }

/* Landing */
.hero { background: var(--primary); color: #fff; padding: calc(2.5rem + env(safe-area-inset-top)) 1rem 3rem; text-align: center; }
.hero h1 { font-size: clamp(1.6rem, 5vw, 2.6rem); margin: .75rem auto; max-width: 760px; }
.hero p { max-width: 640px; margin: 0 auto 1.5rem; opacity: .92; font-size: 1.05rem; }
.hero .btn { border-color: #fff; }
.hero .btn.primary { background: #fff; color: var(--primary); }
.hero .btn:not(.primary) { background: transparent; color: #fff; }
.section { max-width: 1100px; margin: 0 auto; padding: 2.5rem 1rem; }
.section h2 { font-size: 1.4rem; text-align: center; margin-bottom: 1.5rem; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; }
.feature .i { width: 28px; height: 28px; color: var(--primary); }
.feature h3 { margin: .5rem 0 .3rem; }
.feature p { margin: 0; color: var(--muted); font-size: .92rem; }
.plan { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; display: flex; flex-direction: column; gap: .5rem; }
.plan .price { font-size: 1.8rem; font-weight: 800; color: var(--primary); }
.plan ul { padding-left: 1.1rem; margin: .25rem 0 1rem; color: var(--muted); flex: 1; }
footer.site { text-align: center; color: var(--muted); padding: 2rem 1rem calc(2rem + env(safe-area-inset-bottom)); font-size: .85rem; }

/* Impression (factures, bons) */
.doc { background: #fff; color: #111; max-width: 820px; margin: 0 auto; padding: 1.5rem; border-radius: var(--radius); border: 1px solid var(--border); }
.doc table th { background: #f1f1f1; color: #333; }
.doc table td, .doc table th { border-bottom: 1px solid #ddd; }
.doc .doc-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 2px solid #111; padding-bottom: .75rem; margin-bottom: 1rem; }
.doc .doc-head img { max-height: 64px; max-width: 160px; }
.doc h2 { color: #111; }
.doc .muted { color: #555; }
.doc.ticket { max-width: 80mm; padding: .75rem; font-size: 12px; }
@media print {
  @page { margin: 10mm; }
  body { background: #fff; }
  .topbar, .sidebar, .bottombar, .no-print, .page-head .actions, .install-banner, .scrim { display: none !important; }
  main { margin: 0 !important; padding: 0 !important; max-width: none !important; }
  .doc { border: 0; padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; }
}

/* v2 : sélecteur de point de vente, pastilles */
.branch-switch { width: auto; max-width: 46vw; min-height: 36px; padding: .3rem .5rem; border-radius: 9px; border: 1px solid rgba(255,255,255,.45); background: rgba(255,255,255,.14); color: #fff; font-size: .85rem; }
.branch-switch option { color: #15201d; }
.branch-chip { background: rgba(255,255,255,.18); border-radius: 999px; padding: .2rem .7rem; font-size: .8rem; white-space: nowrap; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .hide-sm { display: none !important; } }
.bottombar .dot { position: absolute; top: 6px; right: calc(50% - 22px); background: var(--bad); color: #fff; border-radius: 999px; font-size: .65rem; padding: 0 .35rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.6rem; }
.timeline li::before { content: ''; position: absolute; left: .35rem; top: .3rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--border); }
.timeline li::after { content: ''; position: absolute; left: .67rem; top: 1.1rem; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li.done::before { background: var(--primary); }
.timeline li.current::before { background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.timeline li.cancel::before { background: var(--bad); }
.timeline .when { font-size: .8rem; color: var(--muted); }
.pill-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.pill-tabs a { padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--border); color: var(--text); font-size: .85rem; font-weight: 600; background: var(--surface); }
.pill-tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pill-tabs a .n { opacity: .75; margin-left: .2rem; }
.amount-pos { color: var(--ok); } .amount-neg { color: var(--bad); }

/* v3 : stock chez les autres points de vente, messagerie */
#results li .elsewhere{flex-basis:100%;margin-top:.25rem;color:var(--muted)}
#results li .elsewhere a{font-weight:600}
#results li{flex-wrap:wrap}
.chat{display:flex;flex-direction:column;gap:.5rem;max-height:60vh;overflow-y:auto;padding:.75rem}
.chat .msg{max-width:80%;padding:.5rem .75rem;border-radius:12px;background:var(--surface-2);align-self:flex-start;white-space:pre-wrap;word-wrap:break-word}
.chat .msg.me{align-self:flex-end;background:var(--primary-soft)}
.chat .msg .meta{display:block;font-size:.75rem;color:var(--muted);margin-bottom:.15rem}
.peers{list-style:none;margin:0;padding:0}
.peers li a{display:flex;justify-content:space-between;align-items:center;padding:.6rem .75rem;border-bottom:1px solid var(--border);color:inherit;text-decoration:none}
.peers li a.active{background:var(--surface-2);font-weight:600}
.msg-layout{display:grid;gap:.75rem}
@media (min-width:900px){.msg-layout{grid-template-columns:280px 1fr}}
.msg-form{display:flex;gap:.5rem;padding:.75rem;border-top:1px solid var(--border);align-items:flex-end}
.msg-form textarea{flex:1;margin:0}

/* v4 : hôpital */
ul.plain{list-style:none;margin:0;padding:0}
ul.plain li{padding:.35rem 0;border-bottom:1px solid var(--border)}
form.inline{display:inline}
.bedgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:.5rem;margin-top:.75rem}
.bed{border:1px solid var(--border);border-radius:10px;padding:.55rem .6rem;display:flex;flex-direction:column;gap:.3rem;background:var(--surface)}
.bed.free{border-left:4px solid var(--ok)}.bed.occupied{border-left:4px solid var(--bad)}.bed.cleaning{border-left:4px solid var(--warn)}.bed.out_of_service{opacity:.6}
.bed select{padding:.25rem;font-size:.8rem}
.bed a{color:inherit}
.pt-head{display:flex;gap:1rem;align-items:flex-start;flex-wrap:wrap}
.pt-avatar{width:56px;height:56px;border-radius:50%;background:var(--primary-soft);color:var(--primary);display:flex;align-items:center;justify-content:center;font-weight:800;font-size:1.2rem;flex:none}
.pt-meta{display:flex;flex-wrap:wrap;gap:.35rem .9rem;color:var(--muted);font-size:.85rem}
.allergy{background:var(--bad-bg);color:var(--bad);border-radius:8px;padding:.35rem .6rem;font-weight:600;font-size:.85rem}
.timeline{list-style:none;margin:0;padding:0}
.timeline li{border-left:3px solid var(--border);padding:.5rem .75rem;margin-left:.4rem;position:relative}
.timeline li::before{content:"";position:absolute;left:-7px;top:.8rem;width:11px;height:11px;border-radius:50%;background:var(--primary)}
.timeline .when{font-size:.78rem;color:var(--muted)}
.vit{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:.5rem}
.vit div{background:var(--surface-2);border-radius:8px;padding:.4rem .55rem}
.vit b{display:block;font-size:1.05rem}
.vit span{font-size:.75rem;color:var(--muted)}
.flag-H,.flag-L,.flag-A{color:var(--bad);font-weight:700}
.queue-card{display:flex;justify-content:space-between;gap:.75rem;align-items:center}
.agenda{display:grid;gap:.4rem}
.slot{display:flex;gap:.6rem;align-items:center;border:1px solid var(--border);border-radius:10px;padding:.45rem .6rem;background:var(--surface)}
.slot time{font-weight:700;min-width:3.2rem}
.doc-sign{display:flex;justify-content:flex-end;margin-top:3rem}
@media print{.bed form{display:none}}
.pcard{width:86mm;min-height:54mm;border:1px solid #333;border-radius:3mm;padding:3mm 4mm;background:#fff;color:#111;font-size:9pt;display:flex;flex-direction:column;gap:1.5mm;margin:0 auto}
.pcard-head{display:flex;gap:2mm;align-items:center;border-bottom:1px solid #0b7a5c;padding-bottom:1.5mm;color:#0b7a5c}
.pcard-head img{height:8mm}
.pcard-name{font-size:12pt;font-weight:800}
.pcard-code{font-family:monospace;font-size:14pt;letter-spacing:2px;border:1px dashed #999;padding:1mm 2mm;align-self:flex-start;margin-top:1mm}
.pcard-foot{font-size:7pt;color:#555;margin-top:auto}
.picker{position:relative}
.picker .results{position:absolute;left:0;right:0;z-index:20;background:var(--surface);border:1px solid var(--border);border-radius:10px;box-shadow:var(--shadow);margin-top:.25rem}
.picker .chosen{display:flex;gap:.5rem;align-items:center;padding:.5rem .6rem;background:var(--primary-soft);border-radius:10px}
.picker .chosen.hidden{display:none}
.checks{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:.3rem .75rem;margin:.5rem 0}
.checks label{font-weight:400;display:flex;gap:.4rem;align-items:center;margin:0}
details>summary{list-style:none;display:inline-flex}
details>summary::-webkit-details-marker{display:none}
.rx-list li{margin-bottom:.75rem}
.hp-hero{background:linear-gradient(135deg,var(--primary),var(--primary-2));color:#fff;padding:2.5rem 0 2rem}
.hp-hero h1{color:#fff;margin:.3rem 0}
.hp-wrap{max-width:960px;margin:0 auto;padding:0 16px}
main.hp-wrap{padding-top:1rem;padding-bottom:2rem}
.hp-logo{height:56px;border-radius:10px;background:#fff;padding:4px}
.hp-actions{display:flex;flex-wrap:wrap;gap:.5rem;margin-top:1rem}
.hp-actions .btn:not(.primary){background:#fff;color:var(--primary)}
.hp-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:.5rem}
.hp-tile{border:1px solid var(--border);border-radius:10px;padding:.7rem;display:flex;gap:.5rem;align-items:center;background:var(--surface-2)}
