:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1f2933;
  --muted: #7b8794;
  --line: #e3e8ee;
  /* CubixCode brand palette (extracted from the logo) */
  --brand: #38b6ff;          /* bright logo blue — accents, focus, highlights */
  --blue: #0b74c4;           /* deeper accessible blue — buttons & links */
  --blue-dark: #095a99;      /* hover */
  --header-from: #0f2438;    /* dark navy header */
  --header-to: #143a5c;
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 24px 20px 48px; flex: 1 0 auto; }

/* Nav — dark branded header carrying the white logo */
.nav {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(100deg, var(--header-from), var(--header-to));
  border-bottom: 3px solid var(--brand);
  padding: 11px 22px;
}
.brand { display: flex; align-items: center; gap: 11px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 26px; width: auto; display: block; }
.brand-product {
  color: #fff; font-weight: 600; font-size: 16px;
  padding-left: 11px; border-left: 1px solid rgba(255,255,255,.25);
}
.nav .search { margin-left: auto; display: flex; gap: 6px; }
.nav .search input { width: 280px; border-color: transparent; }
.nav .search button { background: var(--brand); color: #06243b; }
.nav .search button:hover { background: #5cc4ff; }
.nav .logout { color: rgba(255,255,255,.8); font-size: 14px; }
.nav .logout:hover { color: #fff; }

/* Footer credit */
.site-footer {
  flex-shrink: 0; text-align: center; padding: 16px; font-size: 13px;
  color: var(--muted); border-top: 1px solid var(--line); background: var(--card);
}
.site-footer .dot { margin: 0 6px; }

/* Headings */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 8px 0 16px; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }

.muted { color: var(--muted); }
.center { text-align: center; }
.error { color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; padding: 8px 12px; border-radius: 8px; }
.notes { background: #fffbeb; border: 1px solid #fde68a; padding: 8px 12px; border-radius: 8px; }
.link { font-size: 14px; }

/* Inputs & buttons */
input, textarea, button, select {
  font: inherit; color: inherit;
}
input[type=text], input[type=search], input[type=password], input[type=date],
input:not([type]), textarea, input[type=file] {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(56,182,255,.25);
}
button, .btn {
  display: inline-block; cursor: pointer; border: none;
  background: var(--blue); color: #fff; padding: 9px 16px;
  border-radius: 8px; font-weight: 600;
}
button:hover, .btn:hover { background: var(--blue-dark); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: #f1f5f9; }

/* Cards & forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 24px; }
.form label { display: block; margin-bottom: 12px; font-size: 14px; font-weight: 600; }
.form label input, .form label textarea { margin-top: 4px; font-weight: 400; }
.form.inline { display: grid; grid-template-columns: 2fr 1fr 2fr auto; gap: 12px; align-items: end; }
.form.inline label { margin-bottom: 0; }
.form.inline button { height: 38px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* Tables */
table.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); }
table.list th { background: #f8fafc; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
table.list tbody tr:last-child td { border-bottom: none; }
table.list tbody tr[onclick] { cursor: pointer; }
table.list tbody tr[onclick]:hover { background: #f8fafc; }
.tag { background: #eff6ff; color: var(--blue-dark); font-size: 12px; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; }
.cmp { display: flex; justify-content: center; }

/* Login */
.login-box { max-width: 380px; margin: 10vh auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; text-align: center; box-shadow: 0 12px 40px rgba(15,36,56,.08); border-top: 4px solid var(--brand); }
.login-logo { width: 190px; max-width: 70%; height: auto; margin: 4px auto 14px; display: block; }
.login-box h1 { font-size: 20px; margin: 0 0 4px; }
.login-box form { margin-top: 18px; text-align: left; }
.login-box label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 12px; }
.login-box button { width: 100%; }
.login-credit { margin-top: 18px; font-size: 12px; color: var(--muted); }

/* Compare */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pane { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.pane-head { display: flex; align-items: baseline; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.viewer { height: 78vh; }
.viewer iframe { width: 100%; height: 100%; border: none; }
.viewer.img { overflow: auto; background: #0b1220; display: flex; align-items: flex-start; justify-content: center; }
.viewer.img img { max-width: 100%; height: auto; }

/* Drag & drop */
.dropzone {
  border: 2px dashed #c4cdd8; border-radius: 12px; background: #fafbfc;
  padding: 26px; text-align: center; cursor: pointer; transition: all .15s;
}
.dropzone:hover, .dropzone:focus { border-color: var(--blue); background: #f5f9ff; outline: none; }
.dropzone.over { border-color: var(--blue); background: #eaf2ff; transform: scale(1.005); }
.dz-icon { font-size: 26px; }
.dz-inner p { margin: 6px 0; }

.dz-status { margin-top: 12px; padding: 9px 12px; border-radius: 8px; font-size: 14px; background: #f1f5f9; }
.dz-status.working { background: #eff6ff; color: var(--blue-dark); }
.dz-status.ok { background: #ecfdf5; color: #047857; }
.dz-status.error { background: #fef2f2; color: #b91c1c; }

/* Review panel */
.form.review { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 16px; }
.review-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; align-items: end; }
.review-grid label { margin-bottom: 0; }
.review-file { grid-column: 1 / -1; font-size: 13px; }
.form.review .actions { align-items: center; }
.form.review .actions #queueInfo { margin-right: auto; }

.name-check { padding: 9px 12px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.name-check.ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.name-check.warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.name-check.info { background: #eff6ff; color: var(--blue-dark); border: 1px solid #bfdbfe; }

/* Measurement capture (review panel) */
.measures { margin: 18px 0 6px; border-top: 1px solid var(--line); padding-top: 14px; }
.measures-head { margin-bottom: 10px; }
.measure-row { display: grid; grid-template-columns: 1.6fr 110px 70px 1fr auto; gap: 10px; align-items: center; padding: 5px 0; }
.measure-row .m-label { font-weight: 600; font-size: 14px; }
.measure-row .m-value { width: 100%; padding: 6px 8px; }
.measure-row .m-unit { color: var(--muted); font-size: 13px; }
.measure-row .m-flag { color: #92400e; background: #fffbeb; border: 1px solid #fde68a; font-size: 12px; padding: 1px 7px; border-radius: 999px; justify-self: start; }
.measure-row.implausible .m-value { border-color: #fbbf24; }
.measure-row .m-remove { background: none; color: var(--muted); border: none; cursor: pointer; font-size: 14px; padding: 2px 6px; }
.measure-row .m-remove:hover { color: #b91c1c; }
.detail-start { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 10px; padding: 8px 10px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; }
.detail-start label { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.detail-start input { width: 64px; padding: 5px 7px; }
.batch-progress { display: inline-block; font-size: 13px; font-weight: 600; color: var(--blue-dark); background: #eff6ff; border: 1px solid #bfdbfe; padding: 3px 11px; border-radius: 999px; margin-bottom: 10px; }
.add-measure { margin-top: 8px; }
.add-measure select { width: auto; min-width: 240px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* Out-of-range findings — review panel rows */
.findings-block { margin: 16px 0 6px; border-top: 1px solid var(--line); padding-top: 14px; }
.finding-row { display: grid; grid-template-columns: auto auto 1.6fr auto auto; gap: 10px; align-items: center; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; background: #fff; cursor: pointer; }
.finding-row.high { border-left: 3px solid #dc2626; }
.finding-row.low { border-left: 3px solid #d97706; }
.finding-row .f-dir { font-weight: 700; }
.finding-row.high .f-dir { color: #dc2626; }
.finding-row.low .f-dir { color: #d97706; }
.finding-row .f-name { font-weight: 600; font-size: 14px; }
.finding-row .f-unit { color: var(--muted); font-size: 13px; }
.finding-row .f-ref { font-size: 12px; }

/* Out-of-range findings — patient page alarm card */
.card.alarms { border-top: 3px solid #f59e0b; }
.findings-table .dir { font-size: 12px; padding: 1px 7px; border-radius: 999px; margin-left: 4px; white-space: nowrap; }
.dir.high { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.dir.low { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* Reference-range bar: shaded normal band + fixed dot at the reading */
.rbar { position: relative; display: inline-block; width: 120px; height: 8px; background: #eef2f7; border-radius: 999px; vertical-align: middle; }
.rbar-band { position: absolute; top: 0; bottom: 0; background: #d1fae5; border-radius: 999px; }
.rbar-dot { position: absolute; top: 50%; width: 11px; height: 11px; border-radius: 50%; transform: translate(-50%, -50%); background: #64748b; border: 2px solid #fff; box-shadow: 0 0 0 1px #cbd5e1; }
.rbar-dot.high { background: #dc2626; }
.rbar-dot.low { background: #d97706; }

/* Watched parameters (per-patient watch list) */
.card.watchlist { border-top: 3px solid #6366f1; }
.watch-items { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.watch-items li { border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; background: #fff; font-size: 14px; }
.wsrc { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; padding: 1px 6px; border-radius: 999px; margin-left: 4px; }
.wsrc.auto { background: #eef2ff; color: #4338ca; border: 1px solid #c7d2fe; }
.wsrc.manual { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.trend-tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; vertical-align: middle; }
.trend-tag.watch { background: #eef2ff; color: #4338ca; border: 1px solid #c7d2fe; }
.trend-tag.unverified { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.trend-card.watched { border-left: 3px solid #6366f1; }
.trend-legend { display: flex; align-items: center; gap: 4px; margin-top: -6px; }
.lg-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #0b74c4; vertical-align: middle; }
.lg-dot.solid { background: #0b74c4; }
.lg-dot.hollow { background: #fff; }
.watch-items li { display: inline-flex; align-items: center; gap: 6px; }
.watch-remove { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0 2px; line-height: 1; }
.watch-remove:hover { color: #b91c1c; }
.watch-add { margin-top: 14px; }
.watch-picker { margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.watch-picker[hidden] { display: none; }
.watch-picker select { min-width: 320px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* Verify page: editable rows beside the source document */
.verify-wrap { display: grid; grid-template-columns: minmax(380px, 460px) 1fr; gap: 16px; align-items: start; }
.verify-list { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.vrow { display: grid; grid-template-columns: auto 1.4fr 90px auto 130px; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; cursor: pointer; background: #fff; }
.vrow.active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.vrow .v-label { font-weight: 600; font-size: 14px; display: block; }
.vrow .v-value { width: 100%; padding: 5px 7px; }
.vrow .v-unit { font-size: 13px; }
.verify-actions { display: flex; align-items: center; gap: 14px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.verify-actions button { margin-left: auto; }
.verify-doc { position: sticky; top: 12px; height: 80vh; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.verify-doc iframe { width: 100%; height: 100%; border: 0; }
@media (max-width: 860px) { .verify-wrap { grid-template-columns: 1fr; } .verify-doc { height: 60vh; position: static; } }

/* Trends */
.trends-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; margin-top: 8px; }
.trend-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.trend-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.trend-latest { text-align: right; }
.latest-val { font-size: 22px; font-weight: 700; }
.delta { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.trend-canvas { height: 200px; position: relative; }
.small { font-size: 12px; }

@media (max-width: 760px) {
  .compare { grid-template-columns: 1fr; }
  .form.inline { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: 1fr; }
  .measure-row { grid-template-columns: 1fr 90px auto auto; }
  .measure-row .m-flag { grid-column: 1 / -1; }
  .trends-grid { grid-template-columns: 1fr; }
  .nav .search input { width: 160px; }
}

/* --- RBAC: nav identity, role badges, admin table --- */
.nav-user { color: rgba(255,255,255,.85); font-size: 13px; white-space: nowrap; }
.nav-user .nav-role { text-transform: capitalize; color: #06243b; background: var(--brand); border-radius: 999px; padding: 1px 8px; font-size: 11.5px; font-weight: 700; margin-left: 4px; }
.nav-label { margin-left: auto; color: rgba(255,255,255,.85); font-size: 14px; font-weight: 600; }
.role-badge { display: inline-block; font-size: 11px; font-weight: 700; text-transform: capitalize; padding: 2px 9px; border-radius: 999px; background: #eef2f7; color: #475260; }
.role-badge.admin { background: #fef2f2; color: #b91c1c; }
.role-badge.doctor { background: #ecfdf5; color: #047857; }
.role-badge.operator { background: #eff6ff; color: #0b74c4; }
.inline-form { display: inline; margin: 0; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn.small, button.small { padding: 3px 10px; font-size: 12.5px; }
.ok-dot { color: #047857; font-weight: 600; font-size: 13px; }
.ok-msg { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; border-radius: 8px; padding: 8px 12px; }
.row-inactive { opacity: .5; }
.review-grid .check { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-weight: 400; }

/* Red/green toggle switch (a styled submit button inside a tiny form). */
.switch { width: 46px; height: 25px; padding: 0; border: none; border-radius: 999px; position: relative;
  background: #e2554e; cursor: pointer; transition: background .15s ease; vertical-align: middle; }
.switch:hover { background: #d4453e; }
.switch.on { background: #16a34a; }
.switch.on:hover { background: #138a3e; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.35); transition: left .15s ease; }
.switch.on .knob { left: 24px; }

/* Modal (used by the Add/Edit user dialog). */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 60;
  display: none; align-items: flex-start; justify-content: center; padding: 48px 16px; overflow: auto; }
.modal-overlay.open { display: flex; }
.modal { background: var(--card); border-radius: 12px; width: 100%; max-width: 520px;
  padding: 20px 24px 24px; box-shadow: 0 24px 60px rgba(15,23,42,.3); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h2 { margin: 0; }
.modal-close { background: none; color: var(--muted); border: none; font-size: 24px; line-height: 1;
  padding: 0 4px; cursor: pointer; }
.modal-close:hover { background: none; color: var(--ink); }
.modal .review-grid input:disabled, .modal .review-grid select:disabled { background: #f1f5f9; color: #64748b; cursor: not-allowed; }
.modal-danger { grid-column: 1 / -1; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 14px; }

/* CMS — patient registry form groups + ABHA/consent (F1) */
.form-group { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 4px; margin: 0 0 16px; }
.form-group legend { font-size: 13px; font-weight: 700; color: var(--muted); padding: 0 6px; text-transform: uppercase; letter-spacing: .03em; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 16px; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-grid select, .form-grid input[type=email], .form-grid input[type=tel] { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.abha-line code { background: var(--bg, #f3f6f9); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.consent-badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.consent-badge.on { background: #e6f6ec; color: #1a7f37; }
.consent-badge.off { background: #fdeaea; color: #b42318; }
.consent-card .consent-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.consent-card form.inline { display: inline; margin: 0; }

/* CMS — scheduling (F2) */
.nav-link { color: #fff; text-decoration: none; font-size: 14px; font-weight: 600; padding: 6px 12px; border-radius: 8px; background: rgba(255,255,255,.12); white-space: nowrap; }
.nav-link:hover { background: rgba(255,255,255,.22); }
.walkin-note { background: #eef7ff; border: 1px solid #cfe8ff; color: #0b4a72; padding: 10px 14px; border-radius: 10px; font-size: 14px; margin: -4px 0 18px; }
.date-nav { display: flex; gap: 8px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.date-nav .inline-date { margin: 0; }
.date-nav .inline-date input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.appt-time { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.status-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.status-form select { padding: 4px 6px; border: 1px solid var(--line); border-radius: 7px; background: #fff; font-size: 12px; }
.status-chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.status-chip.s-booked { background: #eef2f7; color: #475467; }
.status-chip.s-arrived { background: #e6f0ff; color: #1d4ed8; }
.status-chip.s-done { background: #e6f6ec; color: #1a7f37; }
.status-chip.s-cancelled { background: #fdeaea; color: #b42318; }
.status-chip.s-no_show { background: #fff4e5; color: #b54708; }
tr.appt.s-cancelled td, tr.appt.s-no_show td { opacity: .6; }

/* CMS — encounters / visits (F3) */
.vitals-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 24px; }
.hidden-submit { position: absolute; left: -9999px; width: 0; height: 0; padding: 0; border: 0; overflow: hidden; }
.vitals-grid label { display: block; margin-bottom: 12px; font-size: 14px; font-weight: 600; }
/* number inputs aren't full-width by default — force label-above-field like the notes panel */
.vitals-grid input { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 400; }
.vitals-grid label.missing input { border-color: #d92d20; box-shadow: 0 0 0 3px rgba(217,45,32,.15); }
.vitals-grid .readonly-field input { background: #f3f6f9; color: var(--muted); }
.bp-pair { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.bp-pair input { width: 100%; }
.bp-slash { font-weight: 700; color: var(--muted); }
.inline-doctor { font-size: 13px; font-weight: 600; }
.inline-doctor select { margin-left: 6px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.enc-actions { justify-content: flex-end; }
.vitals-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.vchip { background: #f3f6f9; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 14px; }
.vchip .vk { color: var(--muted); font-weight: 600; font-size: 12px; }
.clin-field { margin-bottom: 14px; }
.clin-field h3 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.clin-text { margin: 0; white-space: pre-wrap; }
.enc-reports { margin: 0; padding-left: 18px; }
.enc-reports li { margin-bottom: 4px; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
@media (max-width: 720px) { .vitals-grid { grid-template-columns: 1fr 1fr; } }

/* CMS — pharmacy (F4) */
.pharmacy-search { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.pharmacy-search input { max-width: 360px; }
.low-badge { display: inline-block; background: #fff4e5; color: #b54708; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-left: 6px; }
.stock-cell { font-variant-numeric: tabular-nums; }
tr.inactive-row td { opacity: .55; }
.linkbtn { background: none; border: none; padding: 0; color: var(--brand-link, #0B74C4); font: inherit; cursor: pointer; text-decoration: underline; }

/* CMS — prescriptions (F5) */
.rx-table th, .rx-table td { padding: 9px 12px; }
.rx-add { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.rx-add-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr .6fr 1.4fr; gap: 10px; align-items: end; }
.rx-add-grid label { display: block; font-size: 13px; font-weight: 600; margin: 0; }
.rx-add-grid input, .rx-add-grid select { margin-top: 4px; font-weight: 400; width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
@media (max-width: 860px) { .rx-add-grid { grid-template-columns: 1fr 1fr; } .rx-add-grid .rx-med, .rx-add-grid .rx-instr { grid-column: 1 / -1; } }

/* CMS — dispensing & counter sales (F6) */
.subnav { display: flex; gap: 6px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.subnav a { padding: 8px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; }
.subnav a.on { color: var(--brand-link, #0B74C4); border-bottom-color: var(--brand, #38B6FF); }
.sale-table select { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.sale-table input { width: 100%; }
.sale-patient { display: block; max-width: 460px; margin-bottom: 14px; font-weight: 600; font-size: 14px; }
.sale-patient select { margin-top: 4px; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 400; }
#addRowBtn { margin: 4px 0 16px; }
table.list tfoot td { padding: 11px 14px; border-top: 2px solid var(--line); }

/* CMS — billing (F7) */
.status-chip.s-unpaid { background: #fdeaea; color: #b42318; }
.status-chip.s-partial { background: #fff4e5; color: #b54708; }
.status-chip.s-paid { background: #e6f6ec; color: #1a7f37; }
.inv-table input { width: 100%; }
.pay-form { margin-top: 16px; }
#addInvRow { margin: 4px 0 4px; }

/* Patient search autocomplete */
.nav .search { position: relative; }
.search-suggest { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); overflow: hidden; z-index: 50; }
.search-suggest .ss-item { display: flex; flex-direction: column; gap: 1px; padding: 8px 12px; text-decoration: none; color: var(--text, #1a2230); border-bottom: 1px solid var(--line); }
.search-suggest .ss-item:last-child { border-bottom: 0; }
.search-suggest .ss-item:hover, .search-suggest .ss-item.on { background: #eef7ff; }
.search-suggest .ss-name { font-weight: 600; font-size: 14px; }
.search-suggest .ss-meta { font-size: 12px; color: var(--muted); }
