:root {
  --navy: #0b1f4d;
  --navy-2: #102a63;
  --blue: #0b5bd3;
  --blue-2: #2376e5;
  --blue-soft: #eaf3ff;
  --green: #0d9f6e;
  --green-soft: #e7f8f1;
  --violet: #6d43d8;
  --violet-soft: #f0ebff;
  --teal: #0b8f9f;
  --teal-soft: #e6f8fa;
  --amber: #c47a09;
  --amber-soft: #fff6df;
  --red: #c43e4d;
  --red-soft: #fff0f2;
  --slate: #52627b;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #17233d;
  --muted: #6e7b91;
  --border: #dfe6f0;
  --shadow: 0 8px 18px rgba(19, 47, 91, 0.07);
  --sidebar-width: 236px;
  --radius: 4px;
  --radius-small: 4px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.45; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img { max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.25rem, 2.1vw, 1.85rem); margin-bottom: 0; }
h2 { font-size: 1.16rem; margin-bottom: 0; }
h3 { font-size: 1rem; margin-bottom: 0; }
.muted { color: var(--muted); margin-bottom: 0; }
.eyebrow { margin: 0 0 5px; color: var(--blue); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.mobile-only { display: none !important; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; display: flex; flex-direction: column; width: var(--sidebar-width); padding: 22px 18px; color: #fff; background: linear-gradient(180deg, var(--navy) 0%, #071737 100%); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 6px 22px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand > div:nth-child(2) { min-width: 0; }
.brand strong { display: block; overflow: hidden; font-size: .98rem; text-overflow: ellipsis; white-space: nowrap; }
.brand span { display: block; margin-top: 3px; color: #a8bcdf; font-size: .72rem; }
.brand-mark { display: grid; flex: 0 0 auto; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: #fff; background: linear-gradient(135deg, #1c7af4, #08b3c7); font-size: 1.65rem; font-weight: 700; box-shadow: 0 7px 18px rgba(24, 119, 230, .3); }
.brand-mark-large { width: 52px; height: 52px; font-size: 2rem; }
.sidebar-nav { display: grid; gap: 6px; margin-top: 22px; }
.nav-link { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 9px; color: #bdd0ec; font-size: .9rem; font-weight: 650; transition: .2s ease; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-link.active { color: #fff; background: linear-gradient(90deg, rgba(31,122,244,.95), rgba(25,156,207,.9)); box-shadow: 0 8px 18px rgba(0, 65, 161, .25); }
.nav-icon { display: grid; place-items: center; width: 22px; height: 22px; font-size: 1.05rem; }
.nav-alert-dot { display: none; width: 9px; height: 9px; margin-left: auto; border: 2px solid rgba(255,255,255,.82); border-radius: 50%; background: #ff4d5f; box-shadow: 0 0 0 4px rgba(255,77,95,.14); }
.nav-link.has-nav-alert .nav-alert-dot { display: block; animation: navAlertBlink 1.05s ease-in-out infinite; }
@keyframes navAlertBlink {
  0%, 100% { opacity: .4; transform: scale(.82); }
  50% { opacity: 1; transform: scale(1.18); }
}
.sidebar-footer { margin-top: auto; padding-top: 22px; }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 11px; border-radius: 10px; background: rgba(255,255,255,.07); }
.user-chip strong, .user-chip span { display: block; }
.user-chip strong { max-width: 145px; overflow: hidden; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.user-chip span { margin-top: 2px; color: #a8bcdf; font-size: .7rem; text-transform: capitalize; }
.avatar { display: grid; flex: 0 0 auto; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: #fff; background: linear-gradient(135deg, var(--blue), var(--teal)); font-weight: 800; }
.avatar-large { width: 52px; height: 52px; font-size: 1.25rem; }

.app-main { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; min-height: 78px; padding: 13px 30px; border-bottom: 1px solid rgba(223, 230, 240, .9); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.topbar-title .eyebrow { margin-bottom: 3px; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user-copy strong, .topbar-user-copy span { display: block; text-align: right; }
.topbar-user-copy strong { font-size: .8rem; }
.topbar-user-copy span { margin-top: 2px; color: var(--muted); font-size: .68rem; text-transform: capitalize; }
.page-content { width: min(100%, 1600px); margin: 0 auto; padding: 26px 30px 42px; }
body.is-embedded .app-main { margin-left: 0; }
body.is-embedded .sidebar,
body.is-embedded .sidebar-backdrop,
body.is-embedded .mobile-nav { display: none !important; }
body.is-embedded .page-content { width: 100%; max-width: none; padding: 22px 26px 34px; }
.page-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.action-group { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.compact-actions { gap: 6px; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 9px 15px; border: 1px solid transparent; border-radius: 8px; font-size: .82rem; font-weight: 750; line-height: 1; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: linear-gradient(135deg, var(--blue), var(--blue-2)); box-shadow: 0 7px 15px rgba(11,91,211,.18); }
.button-primary:hover { box-shadow: 0 9px 18px rgba(11,91,211,.25); }
.button-secondary { color: var(--navy); border-color: var(--border); background: #fff; }
.button-secondary:hover { border-color: #b8c7dc; background: #f9fbfe; }
.button-ghost { color: var(--muted); border-color: transparent; background: transparent; }
.button-danger-ghost { color: var(--red); border-color: #f0cbd0; background: #fff; }
.button-full { width: 100%; }
.button-small { min-height: 34px; padding: 7px 11px; font-size: .74rem; }
.button-large { min-height: 48px; font-size: .9rem; }
.button.disabled { pointer-events: none; opacity: .45; }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--border); border-radius: 8px; color: var(--text); background: #fff; font-size: 1.2rem; }
.text-link { color: var(--blue); font-size: .78rem; font-weight: 750; }

.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stats-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card { position: relative; min-height: 126px; padding: 18px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.stat-card::after { position: absolute; right: -24px; bottom: -32px; width: 85px; height: 85px; border-radius: 50%; background: currentColor; content: ""; opacity: .07; }
.stat-card strong { display: block; margin: 11px 0 7px; color: var(--text); font-size: clamp(1.35rem, 2vw, 1.9rem); line-height: 1; }
.stat-card small { color: var(--muted); font-size: .7rem; }
.stat-label { font-size: .73rem; font-weight: 780; }
.stat-blue { color: var(--blue); background: linear-gradient(145deg, #fff, var(--blue-soft)); }
.stat-green { color: var(--green); background: linear-gradient(145deg, #fff, var(--green-soft)); }
.stat-violet { color: var(--violet); background: linear-gradient(145deg, #fff, var(--violet-soft)); }
.stat-teal { color: var(--teal); background: linear-gradient(145deg, #fff, var(--teal-soft)); }
.stat-amber { color: var(--amber); background: linear-gradient(145deg, #fff, var(--amber-soft)); }
.stat-slate { color: var(--slate); background: linear-gradient(145deg, #fff, #edf1f7); }

.content-grid { display: grid; gap: 20px; margin-bottom: 20px; }
.content-grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.content-grid-1-2 { grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); }
.content-grid-1-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { min-width: 0; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 0; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.count-badge, .role-badge { display: inline-flex; align-items: center; min-height: 27px; padding: 5px 9px; border-radius: 999px; color: var(--blue); background: var(--blue-soft); font-size: .68rem; font-weight: 800; text-transform: capitalize; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 700px; }
th { padding: 10px 12px; color: var(--muted); background: var(--surface-2); font-size: .68rem; font-weight: 800; letter-spacing: .045em; text-align: left; text-transform: uppercase; }
td { padding: 13px 12px; border-bottom: 1px solid #edf1f6; font-size: .79rem; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfe; }
.table-primary, .table-secondary { display: block; }
.table-primary { color: var(--text); font-weight: 760; }
a.table-primary:hover { color: var(--blue); }
.table-secondary { margin-top: 4px; color: var(--muted); font-size: .68rem; }
.table-actions { text-align: right; }

.status { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; font-size: .64rem; font-weight: 850; letter-spacing: .02em; text-transform: capitalize; white-space: nowrap; }
.status-waiting, .status-pending { color: #9b6206; background: #fff1cf; }
.status-in_consultation { color: #0c5eb9; background: #e7f2ff; }
.status-treatment_complete, .status-billing_pending, .status-partial { color: #6540b4; background: #f0eaff; }
.status-paid, .status-closed { color: #087653; background: #dff5ec; }
.status-cancelled { color: #ad3341; background: #ffe8eb; }
.queue-number { display: grid; flex: 0 0 auto; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: #fff; background: linear-gradient(135deg, var(--blue), var(--teal)); font-size: 1rem; font-weight: 850; box-shadow: 0 6px 14px rgba(11,91,211,.18); }
.queue-number-large { width: 52px; height: 52px; font-size: 1.2rem; }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 240px; padding: 28px; text-align: center; }
.empty-state.compact { min-height: 100px; padding: 16px; }
.empty-state p { max-width: 460px; margin: 8px auto 0; color: var(--muted); }
.empty-icon { display: grid; place-items: center; min-width: 52px; height: 52px; margin-bottom: 13px; padding: 0 10px; border-radius: 14px; color: var(--blue); background: var(--blue-soft); font-weight: 850; }
.full-page-state { min-height: 60vh; }

.form-stack { display: grid; gap: 15px; }
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; min-width: 0; gap: 7px; }
.field > span { color: var(--text); font-size: .73rem; font-weight: 750; }
.field small { color: var(--muted); font-size: .65rem; }
.field input, .field textarea, .field select, .search-form select, .inline-form select, .date-filter input { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid #cfd9e7; border-radius: 8px; outline: none; color: var(--text); background: #fff; font-size: .82rem; transition: .18s ease; }
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus, .search-form select:focus, .inline-form select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(11,91,211,.1); }
.field input:disabled, .field textarea:disabled { color: #546276; background: #f3f6fa; }
.field-span-2 { grid-column: span 2; }
.field-span-3 { grid-column: span 3; }
.form-panel { padding: 22px; }
.form-footer { display: flex; justify-content: flex-end; gap: 10px; margin: 24px -22px -22px; padding: 16px 22px; border-top: 1px solid var(--border); background: #fbfcfe; border-radius: 0 0 var(--radius) var(--radius); }
.form-footer.no-border { margin: 0; padding: 4px 0 0; border: 0; background: transparent; }
.sticky-form-footer { position: sticky; bottom: 0; z-index: 5; }
.section-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.section-heading-spaced { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: .75rem; }
.section-number { display: grid; flex: 0 0 auto; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: #fff; background: var(--blue); font-size: .75rem; font-weight: 850; }
.search-form { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 9px; max-width: 760px; }
.search-box { display: flex; flex: 1; align-items: center; min-width: 260px; min-height: 42px; padding: 0 12px; border: 1px solid #cfd9e7; border-radius: 8px; background: #fff; }
.search-box span { color: var(--muted); }
.search-box input { width: 100%; border: 0; outline: 0; padding: 10px; background: transparent; }
.date-filter { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.compact-field { min-width: 160px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 15px; padding-top: 18px; }
.pagination span { color: var(--muted); font-size: .75rem; }

.patient-heading { display: flex; align-items: center; gap: 13px; }
.patient-heading h2 { font-size: 1.35rem; }
.alert-banner, .mini-alert { padding: 12px 14px; border: 1px solid #f1c7cd; border-radius: 9px; color: #8c2835; background: var(--red-soft); font-size: .8rem; }
.alert-banner { margin-bottom: 20px; }
.mini-alert { margin-top: 10px; padding: 9px 11px; font-size: .73rem; }
.details-list { display: grid; gap: 0; margin: 0; }
.details-list div { padding: 12px 0; border-bottom: 1px solid #edf1f6; }
.details-list div:last-child { border-bottom: 0; }
.details-list dt { color: var(--muted); font-size: .68rem; }
.details-list dd { margin: 4px 0 0; font-size: .8rem; font-weight: 650; line-height: 1.45; }
.timeline { position: relative; display: grid; gap: 16px; padding-left: 22px; }
.timeline::before { position: absolute; top: 4px; bottom: 4px; left: 6px; width: 2px; background: #dbe5f3; content: ""; }
.timeline-item { position: relative; }
.timeline-dot { position: absolute; top: 15px; left: -21px; width: 12px; height: 12px; border: 3px solid #fff; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 2px var(--blue-soft); }
.timeline-card { padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.timeline-header { display: flex; justify-content: space-between; gap: 12px; }
.timeline-header strong, .timeline-header span { display: block; }
.timeline-header > div > span { margin-top: 3px; color: var(--muted); font-size: .68rem; }
.visit-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 15px; }
.visit-summary-grid div { padding: 10px; border-radius: 8px; background: var(--surface-2); }
.visit-summary-grid span, .visit-summary-grid strong { display: block; }
.visit-summary-grid span { color: var(--muted); font-size: .65rem; }
.visit-summary-grid strong { margin-top: 4px; font-size: .75rem; line-height: 1.4; }
.invoice-strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding: 9px 11px; border-radius: 8px; color: #274064; background: var(--blue-soft); font-size: .7rem; }
.invoice-strip a { color: var(--blue); font-weight: 800; }

.segmented-control { display: inline-flex; padding: 4px; border: 1px solid var(--border); border-radius: 9px; background: #fff; }
.segmented-control a { padding: 8px 13px; border-radius: 6px; color: var(--muted); font-size: .75rem; font-weight: 750; }
.segmented-control a.active { color: #fff; background: var(--blue); }
.queue-board { display: grid; gap: 13px; }
.queue-card { display: flex; gap: 15px; padding: 17px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.queue-card-main { flex: 1; min-width: 0; }
.queue-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.queue-card-header h2 { font-size: 1.03rem; }
.queue-card-header h2 a:hover { color: var(--blue); }
.queue-meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 14px; }
.queue-meta-grid div { padding: 9px 10px; border-radius: 8px; background: var(--surface-2); }
.queue-meta-grid span, .queue-meta-grid strong { display: block; }
.queue-meta-grid span { color: var(--muted); font-size: .63rem; }
.queue-meta-grid strong { margin-top: 4px; font-size: .75rem; }
.clinical-preview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 13px; padding: 12px; border-left: 3px solid var(--green); border-radius: 0 8px 8px 0; background: var(--green-soft); }
.clinical-preview span { color: var(--green); font-size: .65rem; font-weight: 800; text-transform: uppercase; }
.clinical-preview p { margin: 4px 0 0; font-size: .75rem; line-height: 1.45; }
.queue-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 7px; }
.inline-form select { min-width: 170px; min-height: 34px; padding: 7px 9px; }

.doctor-queue-list { display: grid; gap: 12px; }
.doctor-patient-card { display: flex; gap: 13px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.doctor-patient-card.current { border-color: #9fc3f7; background: #f8fbff; box-shadow: 0 0 0 3px var(--blue-soft); }
.doctor-patient-main { flex: 1; min-width: 0; }
.doctor-patient-header { display: flex; justify-content: space-between; gap: 12px; }
.complaint { margin: 12px 0 0; font-size: .78rem; line-height: 1.5; }
.analytics-list { display: grid; }
.analytics-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid #edf1f6; }
.analytics-list > div:last-child { border-bottom: 0; }
.analytics-list span { color: var(--muted); font-size: .75rem; }
.analytics-list strong { font-size: .88rem; }
.history-panel { align-self: start; position: sticky; top: 100px; max-height: calc(100vh - 125px); overflow: auto; }
.history-list { display: grid; gap: 12px; }
.history-card { padding: 13px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.history-card-header { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.history-card dl { display: grid; gap: 8px; margin: 0; }
.history-card dl div { display: grid; gap: 2px; }
.history-card dt { color: var(--muted); font-size: .62rem; }
.history-card dd { margin: 0; font-size: .72rem; line-height: 1.4; white-space: pre-line; }

.ready-billing-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ready-billing-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; padding: 14px; border: 1px solid #cddff7; border-radius: 10px; background: #f8fbff; }
.ready-billing-card p { margin-bottom: 5px; font-size: .72rem; }
.invoice-clinical-preview { margin: 0 0 20px; }
.invoice-items { display: grid; gap: 10px; margin-bottom: 11px; }
.invoice-item-row { display: grid; grid-template-columns: minmax(220px, 2.5fr) minmax(75px, .6fr) minmax(120px, 1fr) minmax(110px, 1fr) 38px; align-items: end; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.invoice-line-total { min-height: 42px; justify-content: center; }
.invoice-line-total strong { font-size: .83rem; }
.invoice-remove { margin-bottom: 1px; color: var(--red); }
.invoice-summary { width: min(100%, 470px); margin: 24px 0 0 auto; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.invoice-summary > div, .invoice-totals-view > div, .print-totals > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: .78rem; }
.invoice-grand-total, .invoice-totals-view .grand, .print-totals .grand { margin-top: 6px; padding-top: 12px !important; border-top: 1px solid var(--border); font-size: .95rem !important; }
.invoice-balance, .invoice-totals-view .balance, .print-totals .balance { color: var(--red); font-size: .92rem !important; }
.invoice-view-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.invoice-view-meta div { padding: 11px; border-radius: 8px; background: var(--surface-2); }
.invoice-view-meta span, .invoice-view-meta strong, .invoice-view-meta small { display: block; }
.invoice-view-meta span { color: var(--muted); font-size: .65rem; }
.invoice-view-meta strong { margin-top: 4px; font-size: .78rem; }
.invoice-view-meta small { margin-top: 3px; color: var(--muted); font-size: .65rem; }
.invoice-totals-view { width: min(100%, 360px); margin: 18px 0 0 auto; }
.note-box { margin-top: 16px; padding: 12px; border-radius: 8px; background: var(--surface-2); font-size: .75rem; }
.note-box p { margin: 5px 0 0; color: var(--muted); }
.payment-form { display: grid; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.paid-banner { display: flex; flex-direction: column; align-items: center; padding: 24px; border-radius: 10px; color: var(--green); background: var(--green-soft); text-align: center; }
.paid-banner div { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 8px; border-radius: 50%; color: #fff; background: var(--green); font-weight: 900; }
.paid-banner span { margin-top: 4px; font-size: .7rem; }
.payment-history { margin-top: 18px; }
.payment-history h3 { margin-bottom: 10px; }
.payment-item { display: flex; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid #edf1f6; }
.payment-item strong, .payment-item span { display: block; }
.payment-item span, .payment-item small { margin-top: 3px; color: var(--muted); font-size: .65rem; }
.payment-item small { text-align: right; line-height: 1.4; }

.billing-toolbar { align-items: flex-start; }
.billing-search-form { max-width: 920px; }
.billing-stat-link { color: inherit; }
.billing-stat-link.active { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft), var(--shadow); }
.billing-ready-card { border-left: 4px solid var(--blue); }
.billing-register-panel { margin-top: 20px; }
.billing-register-list { display: grid; gap: 12px; }
.invoice-register-card { display: grid; grid-template-columns: minmax(210px, 1.1fr) minmax(180px, .9fr) minmax(300px, 1.35fr) auto; align-items: center; gap: 14px; padding: 15px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.invoice-register-card.has-balance { border-left: 4px solid var(--amber); background: linear-gradient(90deg, var(--amber-soft), #fff 22%); }
.invoice-register-card.is-paid { border-left: 4px solid var(--green); }
.invoice-register-main, .invoice-register-patient { display: grid; gap: 4px; min-width: 0; }
.invoice-register-main { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.invoice-register-patient strong, .invoice-register-patient span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invoice-register-patient span { color: var(--muted); font-size: .7rem; }
.invoice-register-money { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.invoice-register-money div { padding: 9px 10px; border-radius: 8px; background: var(--surface-2); }
.invoice-register-money span, .invoice-register-money strong { display: block; }
.invoice-register-money span { color: var(--muted); font-size: .62rem; }
.invoice-register-money strong { margin-top: 3px; font-size: .8rem; }
.invoice-register-money .balance-due-cell { color: var(--red); background: var(--red-soft); }
.invoice-register-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }

.billing-compose-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(330px, .75fr); gap: 20px; align-items: start; }
.billing-compose-main { min-width: 0; }
.billing-summary-panel { position: sticky; top: 98px; }
.billing-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 14px; }
.billing-section-title p { margin: 5px 0 0; color: var(--muted); font-size: .72rem; }
.billing-adjustments { margin-top: 18px; }
.carry-forward-card, .balance-clean-card { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.carry-forward-card { position: relative; cursor: pointer; }
.carry-forward-card input { position: absolute; opacity: 0; pointer-events: none; }
.carry-forward-card input:checked + .checkbox-tick-custom { color: #fff; border-color: var(--blue); background: var(--blue); }
.carry-forward-card strong, .carry-forward-card small, .balance-clean-card strong, .balance-clean-card span { display: block; }
.carry-forward-card small, .balance-clean-card span { margin-top: 3px; color: var(--muted); font-size: .68rem; line-height: 1.35; }
.balance-clean-card { color: var(--green); border-color: #b9e5d6; background: var(--green-soft); }
.billing-total-stack { display: grid; gap: 0; margin-bottom: 16px; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.billing-total-stack > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid #edf1f6; font-size: .78rem; }
.billing-total-stack > div:last-child { border-bottom: 0; }
.billing-total-stack span { color: var(--muted); }
.billing-total-stack strong { color: var(--text); }
.billing-total-stack .billing-total-grand { color: var(--blue); background: var(--blue-soft); font-size: .92rem; font-weight: 850; }
.billing-total-grand span, .billing-total-grand strong { color: inherit; }
.payment-amount-field input { min-height: 50px; font-size: 1.05rem; font-weight: 800; }
.payment-preset-row { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 14px; }
.payment-preset-row .button.active { color: #fff; border-color: var(--blue); background: var(--blue); box-shadow: 0 7px 15px rgba(11,91,211,.16); }
.payment-result-card { display: grid; gap: 5px; margin: 14px 0; padding: 15px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.payment-result-card span { color: var(--muted); font-size: .7rem; font-weight: 800; text-transform: uppercase; }
.payment-result-card strong { font-size: clamp(1.45rem, 2.6vw, 2rem); line-height: 1; }
.payment-result-card small { color: var(--muted); font-size: .68rem; line-height: 1.35; }
.payment-result-card[data-payment-state="paid"], .payment-result-card[data-collect-state="paid"] { color: var(--green); border-color: #b9e5d6; background: var(--green-soft); }
.payment-result-card[data-payment-state="partial"], .payment-result-card[data-collect-state="partial"] { color: var(--amber); border-color: #f2d393; background: var(--amber-soft); }
.payment-result-card[data-payment-state="pending"] { color: var(--red); border-color: #f1c7cd; background: var(--red-soft); }
.payment-result-card span, .payment-result-card strong { color: inherit; }
.payment-meta-grid { gap: 10px; }
.billing-submit-row { justify-content: stretch; margin-top: 16px; }
.billing-submit-row .button { flex: 1; }

.invoice-status-hero { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(180px, .7fr) minmax(330px, 1fr); align-items: center; gap: 20px; margin-bottom: 20px; }
.invoice-status-hero h2 { margin-bottom: 7px; }
.invoice-status-hero > div:first-child > strong { display: block; font-size: clamp(2rem, 4vw, 3rem); line-height: 1; }
.invoice-status-hero.has-balance { border-left: 5px solid var(--amber); }
.invoice-status-hero.has-balance > div:first-child > strong { color: var(--red); }
.invoice-status-hero.is-paid { border-left: 5px solid var(--green); }
.invoice-status-hero.is-paid > div:first-child > strong { color: var(--green); }
.invoice-status-meter { display: grid; gap: 8px; }
.invoice-status-meter span { color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.invoice-status-meter i { display: block; height: 12px; overflow: hidden; border-radius: 999px; background: var(--blue-soft); }
.invoice-status-meter b { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--teal)); }
.invoice-status-split { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.invoice-status-split div { padding: 11px; border-radius: 8px; background: var(--surface-2); }
.invoice-status-split span, .invoice-status-split strong { display: block; }
.invoice-status-split span { color: var(--muted); font-size: .64rem; }
.invoice-status-split strong { margin-top: 4px; font-size: .82rem; text-transform: capitalize; }
.billing-detail-layout { align-items: start; }
.payment-collection-panel { align-self: start; position: sticky; top: 98px; }
.billing-totals-card { padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.collection-due-card { display: grid; gap: 5px; margin-bottom: 12px; padding: 14px; border-radius: 10px; color: var(--red); background: var(--red-soft); }
.collection-due-card span { font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.collection-due-card strong { font-size: 1.65rem; line-height: 1; }
.created-invoice-balance { display: grid; gap: 12px; }
.created-invoice-balance .muted { font-size: .74rem; line-height: 1.5; }
.invoice-created-actions { align-items: stretch; }
.invoice-created-actions .button { flex: 1; }
.payment-timeline-item { position: relative; padding-left: 16px; }
.payment-timeline-item::before { position: absolute; top: 17px; bottom: -12px; left: 3px; width: 2px; background: #dbe5f3; content: ""; }
.payment-timeline-item::after { position: absolute; top: 18px; left: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); content: ""; }
.payment-timeline-item:last-child::before { display: none; }

.mini-chart { display: flex; align-items: end; justify-content: space-around; min-height: 230px; gap: 8px; padding-top: 12px; }
.chart-column { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: end; min-width: 34px; height: 200px; }
.chart-value { margin-bottom: 6px; color: var(--muted); font-size: .58rem; }
.chart-bar { display: flex; align-items: end; width: min(28px, 75%); height: 140px; overflow: hidden; border-radius: 6px 6px 2px 2px; background: var(--blue-soft); }
.chart-bar i { display: block; width: 100%; min-height: 4px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--blue-2), var(--teal)); }
.chart-column small { margin-top: 7px; color: var(--muted); font-size: .6rem; }
.activity-list { display: grid; }
.activity-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid #edf1f6; }
.activity-item:last-child { border-bottom: 0; }
.activity-icon { display: grid; flex: 0 0 auto; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--green); background: var(--green-soft); font-weight: 900; }
.activity-copy { flex: 1; min-width: 0; }
.activity-copy strong, .activity-copy span, .activity-amount strong, .activity-amount span { display: block; }
.activity-copy strong { font-size: .78rem; }
.activity-copy span, .activity-amount span { margin-top: 3px; color: var(--muted); font-size: .64rem; }
.activity-amount { text-align: right; }
.activity-amount strong { font-size: .78rem; }
.report-bars { display: grid; gap: 12px; }
.report-bar-row { display: grid; grid-template-columns: 65px minmax(100px, 1fr) 95px 65px; align-items: center; gap: 10px; }
.report-bar-row > span, .report-bar-row > small { color: var(--muted); font-size: .65rem; }
.report-bar-row > strong { text-align: right; font-size: .7rem; }
.report-bar-track { height: 10px; overflow: hidden; border-radius: 999px; background: var(--blue-soft); }
.report-bar-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--teal)); }

.flash-stack { display: grid; gap: 9px; margin-bottom: 18px; }
.flash { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border: 1px solid; border-radius: 9px; font-size: .78rem; }
.flash button { border: 0; color: inherit; background: transparent; font-size: 1.1rem; }
.flash-success { color: #076c4d; border-color: #b9e5d6; background: var(--green-soft); }
.flash-error { color: #97313d; border-color: #efc5cb; background: var(--red-soft); }
.flash-info { color: #0a5aa9; border-color: #c6dcf6; background: var(--blue-soft); }

.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(7, 19, 43, .62); backdrop-filter: blur(3px); }
.modal-card { position: relative; z-index: 1; width: min(100%, 560px); max-height: calc(100vh - 40px); overflow: auto; padding: 20px; border-radius: 12px; background: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.25); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }

.login-page { background: #eef4fb; }
.login-shell { display: grid; grid-template-columns: 1.15fr .85fr; min-height: 100vh; }
.login-brand-panel { position: relative; display: flex; align-items: center; overflow: hidden; padding: 7vw; color: #fff; background: radial-gradient(circle at 80% 15%, rgba(34,187,201,.35), transparent 28%), linear-gradient(145deg, #07193c, #0c3f8d); }
.login-brand-panel::after { position: absolute; right: -140px; bottom: -160px; width: 460px; height: 460px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; content: ""; box-shadow: 0 0 0 60px rgba(255,255,255,.03), 0 0 0 120px rgba(255,255,255,.02); }
.login-brand-content { position: relative; z-index: 1; max-width: 640px; }
.login-brand-content .eyebrow { margin-top: 24px; color: #62d4df; }
.login-brand-content h1 { max-width: 610px; margin-bottom: 18px; font-size: clamp(2rem, 4.2vw, 4rem); line-height: 1.05; }
.login-brand-content > p:last-of-type { max-width: 590px; color: #c6d7ed; font-size: 1rem; line-height: 1.7; }
.login-feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 28px; }
.login-feature-grid span { padding: 12px 14px; border: 1px solid rgba(255,255,255,.13); border-radius: 9px; background: rgba(255,255,255,.07); font-size: .78rem; font-weight: 700; }
.login-form-panel { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-card { width: min(100%, 430px); padding: 32px; border: 1px solid var(--border); border-radius: 14px; background: #fff; box-shadow: 0 20px 50px rgba(19,47,91,.12); }
.login-card h2 { margin-bottom: 8px; font-size: 1.7rem; }
.login-card > .muted { margin-bottom: 23px; }
.login-flash { margin-top: 16px; }

.mobile-nav { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 1280px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ready-billing-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1050px) {
  :root { --sidebar-width: 230px; }
  .page-content { padding: 22px; }
  .topbar { padding-inline: 22px; }
  .content-grid-2-1, .content-grid-1-2 { grid-template-columns: 1fr; }
  .history-panel { position: static; max-height: none; }
  .billing-compose-grid, .invoice-status-hero, .invoice-register-card { grid-template-columns: 1fr; }
  .billing-summary-panel, .payment-collection-panel { position: static; }
  .invoice-register-actions { justify-content: flex-start; }
  .stats-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invoice-item-row { grid-template-columns: minmax(200px, 2fr) 80px minmax(110px, 1fr) minmax(100px, 1fr) 38px; }
}

@media (max-width: 820px) {
  html, body { overflow-x: hidden; }
  .mobile-only { display: inline-grid !important; }
  .desktop-only { display: none !important; }
  .sidebar { transform: translateX(-105%); width: min(88vw, 300px); transition: transform .25s ease; }
  .app-shell.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(4,15,35,.55); }
  .app-shell.sidebar-open .sidebar-backdrop { display: block; }
  .sidebar-close { margin-left: auto; color: #fff; border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.08); }
  .app-main { margin-left: 0; }
  .topbar { min-height: 70px; padding: 10px 16px; }
  .topbar { justify-content: flex-start; gap: 12px; }
  .topbar-user { margin-left: auto; }
  .page-content { padding: 18px 14px calc(118px + env(safe-area-inset-bottom)); }
  .mobile-nav { position: fixed; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); left: 10px; z-index: 45; display: flex; gap: 5px; align-items: stretch; padding: 5px; overflow-x: auto; overflow-y: hidden; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.96); box-shadow: 0 12px 34px rgba(16,35,72,.18); backdrop-filter: blur(12px); -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; scrollbar-width: none; }
  .mobile-nav::-webkit-scrollbar { display: none; }
  .mobile-nav a { display: flex; flex: 1 1 auto; flex-direction: column; align-items: center; gap: 3px; min-width: 74px; padding: 6px 3px; border-radius: 8px; color: var(--muted); font-size: .58rem; font-weight: 750; scroll-snap-align: center; white-space: nowrap; }
  .mobile-nav a span { font-size: 1rem; }
  .mobile-nav a.active { color: #fff; background: var(--blue); }
  .sticky-form-footer { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .segmented-control { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .segmented-control::-webkit-scrollbar { display: none; }
  .segmented-control a { flex: 0 0 auto; white-space: nowrap; }
  .page-actions { align-items: stretch; flex-direction: column; }
  .page-actions .action-group { justify-content: flex-start; }
  .page-actions > .button { align-self: flex-start; }
  .search-form { width: 100%; max-width: none; }
  .search-box { min-width: 200px; }
  .stats-grid, .stats-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid-1-1 { grid-template-columns: 1fr; }
  .queue-meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ready-billing-card { grid-template-columns: auto 1fr; }
  .ready-billing-card > .button { grid-column: 1 / -1; }
  .invoice-register-money, .invoice-status-split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-span-3 { grid-column: span 2; }
  .invoice-item-row { grid-template-columns: minmax(0, 1fr) 80px 38px; align-items: end; }
  .invoice-description { grid-column: 1 / -1; }
  .invoice-line-total { grid-column: 1 / 3; align-items: flex-start; }
  .invoice-remove { grid-column: 3; grid-row: 2; }
  .invoice-view-meta { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand-panel { min-height: 42vh; padding: 48px 28px; }
  .login-brand-content h1 { font-size: 2.4rem; }
  .login-form-panel { padding: 24px 16px; }
}

@media (max-width: 560px) {
  .topbar-title .eyebrow { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar h1 { font-size: 1.12rem; }
  .stats-grid, .stats-grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { min-height: 112px; padding: 14px; }
  .stat-card strong { font-size: 1.35rem; }
  .panel { padding: 15px; }
  .page-actions .button, .action-group .button { flex: 1; }
  .patient-heading { align-items: flex-start; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .field-span-2, .field-span-3 { grid-column: span 1; }
  .form-panel { padding: 15px; }
  .form-footer { margin: 22px -15px -15px; padding: 14px 15px; }
  .form-footer .button { flex: 1; }
  .visit-summary-grid { grid-template-columns: 1fr; }
  .queue-card { gap: 10px; padding: 13px; }
  .queue-card-number { position: absolute; }
  .queue-card-header { padding-left: 49px; }
  .queue-meta-grid { grid-template-columns: 1fr 1fr; }
  .clinical-preview { grid-template-columns: 1fr; }
  .inline-form { width: 100%; }
  .inline-form select { flex: 1; min-width: 120px; }
  .doctor-patient-card { padding: 12px; }
  .doctor-patient-header { flex-direction: column; }
  .invoice-item-row { grid-template-columns: 1fr 72px 36px; padding: 10px; }
  .invoice-summary { width: 100%; }
  .invoice-register-money, .invoice-status-split, .payment-meta-grid { grid-template-columns: 1fr; }
  .billing-section-title { align-items: stretch; flex-direction: column; }
  .invoice-register-main { grid-template-columns: 1fr; }
  .payment-preset-row .button { flex: 1; }
  .report-bar-row { grid-template-columns: 55px 1fr 75px; }
  .report-bar-row small { display: none; }
  .login-feature-grid { grid-template-columns: 1fr; }
  .login-brand-panel { min-height: 36vh; padding: 35px 22px; }
  .login-brand-content h1 { font-size: 2rem; }
  .login-brand-content > p:last-of-type, .login-feature-grid { display: none; }
  .login-card { padding: 24px 18px; }
}

@media print {
  .sidebar, .topbar, .mobile-nav, .page-actions, .flash-stack, .button, .modal { display: none !important; }
  .app-main { margin: 0; }
  .page-content { width: 100%; padding: 0; }
  .panel, .stat-card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

/* Brand themes */
body.theme-emerald { --navy: #073b32; --navy-2: #0b5545; --blue: #087f5b; --blue-2: #12a878; --blue-soft: #e6f7f0; --teal: #0f8f7b; }
body.theme-royal { --navy: #27114f; --navy-2: #3b1f70; --blue: #6d28d9; --blue-2: #8b5cf6; --blue-soft: #f1eafe; --teal: #7c3aed; }
body.theme-graphite { --navy: #172033; --navy-2: #263348; --blue: #475569; --blue-2: #64748b; --blue-soft: #eef2f6; --teal: #334155; }
body.theme-rose { --navy: #4a102d; --navy-2: #701a45; --blue: #be185d; --blue-2: #db2777; --blue-soft: #fce7f3; --teal: #a21caf; }
body.theme-cobalt { --navy: #102a43; --navy-2: #173c78; --blue: #2563eb; --blue-2: #3b82f6; --blue-soft: #eff6ff; --teal: #0284c7; }
body.theme-aqua { --navy: #073b4c; --navy-2: #075e68; --blue: #0891b2; --blue-2: #06b6d4; --blue-soft: #ecfeff; --teal: #14b8a6; }
body.theme-indigo { --navy: #1e1b4b; --navy-2: #312e81; --blue: #4f46e5; --blue-2: #6366f1; --blue-soft: #eef2ff; --teal: #7c3aed; }
body.theme-amber { --navy: #3f2e04; --navy-2: #704f02; --blue: #b7791f; --blue-2: #d97706; --blue-soft: #fffbeb; --teal: #0f766e; }
body.theme-crimson { --navy: #3f111d; --navy-2: #701a2e; --blue: #be123c; --blue-2: #e11d48; --blue-soft: #fff1f2; --teal: #9f1239; }
body.theme-mint { --navy: #07342f; --navy-2: #0f5149; --blue: #0f766e; --blue-2: #14b8a6; --blue-soft: #ecfdf5; --teal: #22c55e; }
body.theme-slate { --navy: #111827; --navy-2: #1f2937; --blue: #334155; --blue-2: #475569; --blue-soft: #f1f5f9; --teal: #64748b; }
body.theme-clinical { --navy: #062f36; --navy-2: #0b4f5c; --blue: #0f766e; --blue-2: #0e9f8b; --blue-soft: #ecfeff; --teal: #0284c7; }
body.theme-executive { --navy: #0f172a; --navy-2: #1e3a5f; --blue: #1d4ed8; --blue-2: #2563eb; --blue-soft: #eff6ff; --teal: #0f766e; }
body.theme-steel { --navy: #18212f; --navy-2: #29384d; --blue: #3b5b7a; --blue-2: #527293; --blue-soft: #eef4f8; --teal: #0e7490; }
body.theme-forest { --navy: #10291f; --navy-2: #16402f; --blue: #166534; --blue-2: #15803d; --blue-soft: #f0fdf4; --teal: #047857; }
body.theme-burgundy { --navy: #31111d; --navy-2: #4c1d2e; --blue: #9f1239; --blue-2: #be123c; --blue-soft: #fff1f2; --teal: #7f1d1d; }
body.theme-harbor { --navy: #082f49; --navy-2: #0c4a6e; --blue: #0369a1; --blue-2: #0284c7; --blue-soft: #f0f9ff; --teal: #0f766e; }
body.theme-sapphire { --navy: #111d3f; --navy-2: #1e3a8a; --blue: #1e40af; --blue-2: #2563eb; --blue-soft: #eff6ff; --teal: #0891b2; }
body.theme-monochrome { --navy: #171717; --navy-2: #262626; --blue: #404040; --blue-2: #525252; --blue-soft: #f5f5f5; --teal: #737373; }
body.theme-sky { --navy: #0c4a6e; --navy-2: #075985; --blue: #0284c7; --blue-2: #0ea5e9; --blue-soft: #f0f9ff; --teal: #06b6d4; }
body.theme-azure { --navy: #0b2f4f; --navy-2: #164e63; --blue: #0369a1; --blue-2: #38bdf8; --blue-soft: #effaff; --teal: #0e7490; }
body.theme-arctic { --navy: #123447; --navy-2: #24546e; --blue: #0e7490; --blue-2: #0891b2; --blue-soft: #ecfeff; --teal: #38bdf8; }
body.theme-glacier { --navy: #17324d; --navy-2: #244f70; --blue: #256f9f; --blue-2: #0ea5e9; --blue-soft: #f0f9ff; --teal: #67e8f9; }
body.theme-powder { --navy: #1f3a5f; --navy-2: #2b557c; --blue: #2f80b7; --blue-2: #60a5fa; --blue-soft: #f5fbff; --teal: #22d3ee; }
body.theme-lagoon { --navy: #073b4c; --navy-2: #075e68; --blue: #0e7490; --blue-2: #06b6d4; --blue-soft: #ecfeff; --teal: #14b8a6; }
body.theme-cyan { --navy: #083344; --navy-2: #155e75; --blue: #0891b2; --blue-2: #22d3ee; --blue-soft: #ecfeff; --teal: #06b6d4; }
body.theme-frost { --navy: #1e3a5f; --navy-2: #31577c; --blue: #2b6f9f; --blue-2: #7dd3fc; --blue-soft: #f8fcff; --teal: #38bdf8; }
.brand-logo-image { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 9px; object-fit: contain; background: #fff; padding: 4px; }
.button-danger { color: #fff; background: var(--red); }

/* OPD template manager */
.inline-create-form, .upload-inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.inline-create-form input, .upload-inline-form input[type="file"] { min-height: 40px; padding: 8px 11px; border: 1px solid #cfd9e7; border-radius: 8px; background: #fff; }
.template-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.template-card { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; padding: 16px; }
.template-card-default { border-color: color-mix(in srgb, var(--blue) 45%, var(--border)); }
.template-preview-mini { position: relative; align-self: start; width: 110px; aspect-ratio: 210 / 297; overflow: hidden; border: 1px solid var(--border); border-radius: 7px; background: linear-gradient(145deg, #fff, #eef3f8); box-shadow: 0 7px 16px rgba(30,50,80,.1); }
.template-preview-mini.landscape { width: 120px; aspect-ratio: 297 / 210; }
.template-preview-mini img { width: 100%; height: 100%; object-fit: fill; }
.template-preview-mini span { position: absolute; inset: 42% 10%; display: grid; place-items: center; color: var(--blue); border: 1px dashed var(--blue); font-size: .7rem; font-weight: 800; }
.template-card-body { min-width: 0; }
.template-card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.template-card-title h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.template-card-body > .muted { margin: 10px 0 14px; font-size: .74rem; }
.template-actions { gap: 6px; }

.builder-page-actions { position: sticky; top: 78px; z-index: 35; padding: 10px 0; background: var(--bg); }
.builder-upload-strip { display: grid; grid-template-columns: minmax(260px, 1fr) auto auto; align-items: center; gap: 18px; margin-bottom: 20px; }
.builder-upload-strip h2 { margin-bottom: 5px; }
.builder-upload-strip .muted { max-width: 720px; font-size: .74rem; }
.opd-builder-shell { display: grid; grid-template-columns: 270px minmax(620px, 1fr) 280px; gap: 16px; align-items: start; }
.builder-sidebar, .builder-inspector { position: sticky; top: 148px; max-height: calc(100vh - 170px); overflow-y: auto; padding: 16px; }
.builder-sidebar-header { margin-bottom: 14px; }
.builder-section-gap { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.switch-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; cursor: pointer; }
.switch-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--blue); }
.switch-row strong, .switch-row small { display: block; }
.switch-row strong { font-size: .76rem; }
.switch-row small { margin-top: 3px; color: var(--muted); font-size: .65rem; line-height: 1.35; }
.field-palette { display: grid; gap: 8px; }
.palette-group { display: grid; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid color-mix(in srgb, var(--border) 75%, transparent); }
.palette-group:last-child { border-bottom: 0; padding-bottom: 0; }
.palette-group-title { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: .61rem; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.palette-group-items { display: grid; gap: 5px; }
.palette-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; color: var(--text); background: #fff; font-size: .72rem; font-weight: 680; text-align: left; }
.palette-item:hover { border-color: var(--blue); background: var(--blue-soft); }
.palette-item span { color: var(--muted); letter-spacing: -2px; }
.builder-custom-field-box { display: grid; gap: 8px; margin-top: 12px; padding: 10px; border: 1px solid var(--border); border-radius: 4px; background: #fbfdff; }
.builder-custom-field-box strong { display: block; color: var(--text); font-size: .74rem; }
.builder-custom-field-box .field { gap: 4px; margin: 0; }
.builder-custom-field-box .field input { min-height: 31px; padding: 6px 8px; font-size: .72rem; }
.builder-custom-field-box .muted { font-size: .62rem; line-height: 1.35; }
.builder-add-special { display: grid; gap: 7px; margin-top: 14px; }
.builder-workspace { min-width: 0; padding: 0; overflow: hidden; }
.builder-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: #fbfcfe; }
.builder-toolbar .muted { font-size: .66rem; }
.zoom-label { min-width: 48px; color: var(--muted); font-size: .72rem; font-weight: 750; text-align: center; }
.builder-canvas-scroll { min-height: 760px; padding: 28px; overflow: auto; background: #dfe5ec; }
.builder-canvas-stage { position: relative; width: 596px; height: 843px; flex: 0 0 auto; }
.opd-builder-canvas { position: relative; width: 794px; height: 1123px; overflow: hidden; background: #fff; box-shadow: 0 12px 34px rgba(15,23,42,.2); transform-origin: top left; }
.builder-canvas-stage > .opd-builder-canvas { position: absolute; inset: 0 auto auto 0; }
.opd-builder-canvas.landscape { width: 1123px; height: 794px; }
.opd-builder-canvas[data-page-size="A5"].portrait { width: 559px; height: 794px; }
.opd-builder-canvas[data-page-size="A5"].landscape { width: 794px; height: 559px; }
.opd-builder-canvas[data-page-size="LETTER"].portrait { width: 816px; height: 1054px; }
.opd-builder-canvas[data-page-size="LETTER"].landscape { width: 1054px; height: 816px; }
.builder-background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; user-select: none; }
.builder-grid-overlay { position: absolute; z-index: 1; inset: 0; display: none; pointer-events: none; background-image: linear-gradient(rgba(11,91,211,.09) 1px, transparent 1px), linear-gradient(90deg, rgba(11,91,211,.09) 1px, transparent 1px); background-size: 5% 5%; }
.builder-grid-overlay.visible { display: block; }
.builder-element { position: absolute; z-index: 3; min-width: 15px; min-height: 10px; padding: 0; overflow: hidden; border-style: solid; border-color: #334155; outline: 1px dashed rgba(11,91,211,.55); color: #111827; background: rgba(255,255,255,.18); line-height: 1.25; cursor: move; user-select: none; touch-action: none; }
.builder-element.singleline { display: flex; flex-direction: row; align-items: center; white-space: nowrap; }
.builder-element.multiline, .builder-element.kind-text { white-space: pre-wrap; word-break: break-word; }
.builder-element:hover, .builder-element.selected { z-index: 5; outline: 2px solid var(--blue); background: rgba(234,243,255,.5); }
.builder-element.kind-line { min-height: 0; height: 1px !important; padding: 0; border-width: 0 0 1px !important; outline-offset: 4px; }
.builder-element.kind-box { background: rgba(255,255,255,.05); }
.builder-element .opd-field-label { display: inline-block; vertical-align: top; margin-right: 4px; color: #4b5563; font-size: .88em; font-weight: 600; }
.builder-element .opd-field-label::after { content: ":"; }
.builder-element .opd-field-value, .builder-element .opd-static-text { display: inline-block; vertical-align: top; word-break: break-word; }
.builder-resize-handle { position: absolute; right: 0; bottom: 0; display: none; width: 12px; height: 12px; padding: 0; border: 0; background: var(--blue); cursor: nwse-resize; }
.builder-element.selected .builder-resize-handle { display: block; }
.builder-inspector .form-grid { gap: 10px; }
.builder-inspector .field { gap: 5px; margin-bottom: 10px; }
.builder-inspector .field input, .builder-inspector .field select, .builder-inspector .field textarea { min-height: 36px; padding: 7px 9px; font-size: .73rem; }
.empty-inspector { display: grid; place-items: center; min-height: 170px; padding: 20px; border: 1px dashed var(--border); border-radius: 8px; color: var(--muted); font-size: .75rem; text-align: center; }
.builder-layer-actions { display: grid; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }

/* OPD payment blocks */
.opd-fee-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.opd-fee-strip span, .opd-fee-strip strong { display: block; }
.opd-fee-strip span { color: var(--muted); font-size: .65rem; text-transform: uppercase; }
.opd-fee-strip strong { margin-top: 4px; font-size: .78rem; }
.opd-fee-actions { display: flex; flex-wrap: wrap; align-items: end; justify-content: flex-end; gap: 6px; }
.auto-doctor-card { padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--blue-soft); }
.auto-doctor-card strong, .auto-doctor-card span { display: block; }
.auto-doctor-card span { margin-top: 3px; color: var(--muted); font-size: .7rem; }

@media (max-width: 1300px) {
  .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .opd-builder-shell { grid-template-columns: 240px minmax(540px, 1fr); }
  .builder-inspector { position: static; grid-column: 1 / -1; max-height: none; }
  .inspector-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .builder-layer-actions { align-content: end; }
}
@media (max-width: 900px) {
  .template-grid { grid-template-columns: 1fr; }
  .template-card { grid-template-columns: 90px minmax(0, 1fr); }
  .template-preview-mini { width: 82px; }
  .builder-upload-strip { grid-template-columns: 1fr; }
  .opd-builder-shell { grid-template-columns: 1fr; }
  .builder-sidebar, .builder-inspector { position: static; max-height: none; }
  .field-palette { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .builder-canvas-scroll { min-height: 540px; padding: 12px; }
  .inspector-fields { grid-template-columns: 1fr; }
  .opd-fee-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.settings-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; background: linear-gradient(135deg, var(--surface), var(--blue-soft)); }
.settings-hero .muted { margin-top: 7px; max-width: 740px; }
.settings-stack { display: grid; gap: 20px; }
.compact-settings-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.compact-settings-panel .muted { margin-top: 5px; font-size: .72rem; }
.brand-upload-row { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 16px; align-items: center; margin-bottom: 20px; }
.brand-preview-large { display: grid; place-items: center; width: 82px; height: 82px; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.brand-preview-large img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.brand-preview-large span { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, var(--blue), var(--teal)); font-size: 2rem; font-weight: 800; }
.theme-picker { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.theme-option-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; margin-top: 12px; }
.theme-option { position: relative; display: grid; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; }
.theme-option:has(input:checked) { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-soft); }
.theme-option input { position: absolute; top: 8px; right: 8px; accent-color: var(--blue); }
.theme-option strong { font-size: .68rem; }
.theme-swatch { display: flex; height: 30px; overflow: hidden; border-radius: 6px; }
.theme-swatch i { flex: 1; }
.theme-swatch-ocean .theme-swatch i:nth-child(1) { background: #0b1f4d; } .theme-swatch-ocean .theme-swatch i:nth-child(2) { background: #0b5bd3; } .theme-swatch-ocean .theme-swatch i:nth-child(3) { background: #08b3c7; }
.theme-swatch-emerald .theme-swatch i:nth-child(1) { background: #073b32; } .theme-swatch-emerald .theme-swatch i:nth-child(2) { background: #087f5b; } .theme-swatch-emerald .theme-swatch i:nth-child(3) { background: #12a878; }
.theme-swatch-royal .theme-swatch i:nth-child(1) { background: #27114f; } .theme-swatch-royal .theme-swatch i:nth-child(2) { background: #6d28d9; } .theme-swatch-royal .theme-swatch i:nth-child(3) { background: #8b5cf6; }
.theme-swatch-graphite .theme-swatch i:nth-child(1) { background: #172033; } .theme-swatch-graphite .theme-swatch i:nth-child(2) { background: #475569; } .theme-swatch-graphite .theme-swatch i:nth-child(3) { background: #94a3b8; }
.theme-swatch-rose .theme-swatch i:nth-child(1) { background: #4a102d; } .theme-swatch-rose .theme-swatch i:nth-child(2) { background: #be185d; } .theme-swatch-rose .theme-swatch i:nth-child(3) { background: #db2777; }
.theme-swatch-cobalt .theme-swatch i:nth-child(1) { background: #102a43; } .theme-swatch-cobalt .theme-swatch i:nth-child(2) { background: #2563eb; } .theme-swatch-cobalt .theme-swatch i:nth-child(3) { background: #0284c7; }
.theme-swatch-aqua .theme-swatch i:nth-child(1) { background: #073b4c; } .theme-swatch-aqua .theme-swatch i:nth-child(2) { background: #0891b2; } .theme-swatch-aqua .theme-swatch i:nth-child(3) { background: #14b8a6; }
.theme-swatch-indigo .theme-swatch i:nth-child(1) { background: #1e1b4b; } .theme-swatch-indigo .theme-swatch i:nth-child(2) { background: #4f46e5; } .theme-swatch-indigo .theme-swatch i:nth-child(3) { background: #7c3aed; }
.theme-swatch-amber .theme-swatch i:nth-child(1) { background: #3f2e04; } .theme-swatch-amber .theme-swatch i:nth-child(2) { background: #b7791f; } .theme-swatch-amber .theme-swatch i:nth-child(3) { background: #0f766e; }
.theme-swatch-crimson .theme-swatch i:nth-child(1) { background: #3f111d; } .theme-swatch-crimson .theme-swatch i:nth-child(2) { background: #be123c; } .theme-swatch-crimson .theme-swatch i:nth-child(3) { background: #e11d48; }
.theme-swatch-mint .theme-swatch i:nth-child(1) { background: #07342f; } .theme-swatch-mint .theme-swatch i:nth-child(2) { background: #0f766e; } .theme-swatch-mint .theme-swatch i:nth-child(3) { background: #22c55e; }
.theme-swatch-slate .theme-swatch i:nth-child(1) { background: #111827; } .theme-swatch-slate .theme-swatch i:nth-child(2) { background: #334155; } .theme-swatch-slate .theme-swatch i:nth-child(3) { background: #64748b; }
.theme-swatch-clinical .theme-swatch i:nth-child(1) { background: #062f36; } .theme-swatch-clinical .theme-swatch i:nth-child(2) { background: #0f766e; } .theme-swatch-clinical .theme-swatch i:nth-child(3) { background: #0284c7; }
.theme-swatch-executive .theme-swatch i:nth-child(1) { background: #0f172a; } .theme-swatch-executive .theme-swatch i:nth-child(2) { background: #1d4ed8; } .theme-swatch-executive .theme-swatch i:nth-child(3) { background: #0f766e; }
.theme-swatch-steel .theme-swatch i:nth-child(1) { background: #18212f; } .theme-swatch-steel .theme-swatch i:nth-child(2) { background: #3b5b7a; } .theme-swatch-steel .theme-swatch i:nth-child(3) { background: #0e7490; }
.theme-swatch-forest .theme-swatch i:nth-child(1) { background: #10291f; } .theme-swatch-forest .theme-swatch i:nth-child(2) { background: #166534; } .theme-swatch-forest .theme-swatch i:nth-child(3) { background: #047857; }
.theme-swatch-burgundy .theme-swatch i:nth-child(1) { background: #31111d; } .theme-swatch-burgundy .theme-swatch i:nth-child(2) { background: #9f1239; } .theme-swatch-burgundy .theme-swatch i:nth-child(3) { background: #7f1d1d; }
.theme-swatch-harbor .theme-swatch i:nth-child(1) { background: #082f49; } .theme-swatch-harbor .theme-swatch i:nth-child(2) { background: #0369a1; } .theme-swatch-harbor .theme-swatch i:nth-child(3) { background: #0f766e; }
.theme-swatch-sapphire .theme-swatch i:nth-child(1) { background: #111d3f; } .theme-swatch-sapphire .theme-swatch i:nth-child(2) { background: #1e40af; } .theme-swatch-sapphire .theme-swatch i:nth-child(3) { background: #0891b2; }
.theme-swatch-monochrome .theme-swatch i:nth-child(1) { background: #171717; } .theme-swatch-monochrome .theme-swatch i:nth-child(2) { background: #404040; } .theme-swatch-monochrome .theme-swatch i:nth-child(3) { background: #737373; }
.theme-swatch-sky .theme-swatch i:nth-child(1) { background: #0c4a6e; } .theme-swatch-sky .theme-swatch i:nth-child(2) { background: #0284c7; } .theme-swatch-sky .theme-swatch i:nth-child(3) { background: #0ea5e9; }
.theme-swatch-azure .theme-swatch i:nth-child(1) { background: #0b2f4f; } .theme-swatch-azure .theme-swatch i:nth-child(2) { background: #0369a1; } .theme-swatch-azure .theme-swatch i:nth-child(3) { background: #38bdf8; }
.theme-swatch-arctic .theme-swatch i:nth-child(1) { background: #123447; } .theme-swatch-arctic .theme-swatch i:nth-child(2) { background: #0e7490; } .theme-swatch-arctic .theme-swatch i:nth-child(3) { background: #38bdf8; }
.theme-swatch-glacier .theme-swatch i:nth-child(1) { background: #17324d; } .theme-swatch-glacier .theme-swatch i:nth-child(2) { background: #256f9f; } .theme-swatch-glacier .theme-swatch i:nth-child(3) { background: #67e8f9; }
.theme-swatch-powder .theme-swatch i:nth-child(1) { background: #1f3a5f; } .theme-swatch-powder .theme-swatch i:nth-child(2) { background: #2f80b7; } .theme-swatch-powder .theme-swatch i:nth-child(3) { background: #60a5fa; }
.theme-swatch-lagoon .theme-swatch i:nth-child(1) { background: #073b4c; } .theme-swatch-lagoon .theme-swatch i:nth-child(2) { background: #0e7490; } .theme-swatch-lagoon .theme-swatch i:nth-child(3) { background: #14b8a6; }
.theme-swatch-cyan .theme-swatch i:nth-child(1) { background: #083344; } .theme-swatch-cyan .theme-swatch i:nth-child(2) { background: #0891b2; } .theme-swatch-cyan .theme-swatch i:nth-child(3) { background: #22d3ee; }
.theme-swatch-frost .theme-swatch i:nth-child(1) { background: #1e3a5f; } .theme-swatch-frost .theme-swatch i:nth-child(2) { background: #2b6f9f; } .theme-swatch-frost .theme-swatch i:nth-child(3) { background: #7dd3fc; }
.login-logo-image { width: 72px; height: 72px; margin-bottom: 20px; border-radius: 14px; object-fit: contain; padding: 6px; background: #fff; }
.opd-fee-live-summary { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.opd-fee-live-summary span { color: var(--muted); font-size: .7rem; }
.opd-fee-live-summary strong { margin-right: 16px; color: var(--blue); font-size: 1rem; }
.modal-card-wide { width: min(760px, calc(100vw - 28px)); }
.dashboard-frame-card {
  width: min(1180px, calc(100vw - 28px));
  height: min(860px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
}
.dashboard-frame-card iframe {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
@media (max-width: 900px) {
  .settings-hero, .compact-settings-panel { align-items: flex-start; flex-direction: column; }
  .theme-option-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Patient details checkable medical tag styling */
.medical-alerts-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.medical-alerts-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.medical-alert-tag {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 1rem;
  background-color: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 2rem;
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text, #334155);
  transition: all 0.2s ease;
  user-select: none;
}
.medical-alert-tag input[type="checkbox"] {
  display: none;
}
.medical-alert-tag:hover {
  background-color: var(--surface-hover, #f1f5f9);
}
.medical-alert-tag.checked {
  background-color: var(--blue-soft, #e0f2fe);
  border-color: var(--blue, #0b5bd3);
  color: var(--blue, #0b5bd3);
}

/* Mobile search suggestions overlay */
.mobile-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
  max-height: 280px;
  overflow-y: auto;
  padding: 8px;
  margin-top: 4px;
}
.search-results-heading {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted, #64748b);
  padding: 4px 8px 8px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  margin-bottom: 4px;
  letter-spacing: 0.05em;
}
.search-result-item {
  padding: 8px;
  border-bottom: 1px solid var(--border, #f1f5f9);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.search-result-item:last-child {
  border-bottom: none;
}
.search-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.search-result-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-bold, #0f172a);
}
.search-result-code {
  font-size: 0.72rem;
  color: var(--blue, #0b5bd3);
  background: var(--blue-soft, #e0f2fe);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}
.search-result-meta {
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  line-height: 1.4;
}
.search-result-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.search-result-btn {
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border, #cbd5e1);
  background: var(--surface, #ffffff);
  cursor: pointer;
  font-weight: 600;
  color: var(--text, #334155);
}
.search-result-btn:hover {
  background: var(--surface-hover, #f1f5f9);
}
.search-result-btn-primary {
  background: var(--blue, #0b5bd3);
  color: #ffffff;
  border-color: var(--blue, #0b5bd3);
}
.search-result-btn-primary:hover {
  background: #094eb5;
}

/* Tick checkbox collection container */
.checkbox-tick-container {
  display: flex;
  align-items: center;
  height: 38px;
}
.checkbox-tick-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
  font-size: 0.88rem;
}
.checkbox-tick-label input[type="checkbox"] {
  display: none;
}
.checkbox-tick-custom {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border, #cbd5e1);
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: transparent;
  background: var(--surface, #ffffff);
  transition: all 0.15s ease;
  font-size: 0.8rem;
}
.checkbox-tick-label input[type="checkbox"]:checked + .checkbox-tick-custom {
  background: var(--blue, #0b5bd3);
  border-color: var(--blue, #0b5bd3);
  color: #ffffff;
}
.checkbox-tick-text {
  color: var(--text, #334155);
}

/* Readonly fields styling */
.readonly-field {
  background-color: var(--surface-hover, #f8fafc) !important;
  color: var(--muted, #64748b) !important;
  cursor: not-allowed;
  border-style: dashed;
}
.revisit-search-panel {
  margin-bottom: 20px;
}

/* Info banner alerts */
.info-banner-alert {
  box-shadow: var(--shadow-sm);
  animation: slideDown 0.3s ease-out;
}
@keyframes slideDown {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Styling for advanced patient matching suggestion cards */
.search-result-grid-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  font-size: 0.76rem;
  color: var(--muted, #64748b);
  border-top: 1px solid var(--border, #e2e8f0);
  border-bottom: 1px solid var(--border, #e2e8f0);
  padding: 8px 0;
  margin: 6px 0;
  text-align: left;
}
.search-result-grid-details div {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-grid-details strong {
  color: var(--text, #0f172a);
}
.balance-alert-badge {
  color: #ef4444 !important;
  font-weight: 700;
  background-color: #fee2e2;
  padding: 1px 4px;
  border-radius: 4px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Doctor Module Redesign layout styles */
.doctor-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  box-shadow: var(--shadow);
}
.doctor-filter-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 260px;
  min-width: 220px;
}
.doctor-filter-icon {
  position: absolute;
  left: 10px;
  color: var(--muted);
  font-size: .82rem;
  pointer-events: none;
}
.doctor-filter-search input {
  width: 100%;
  min-height: 32px;
  padding: 5px 9px 5px 29px;
  border: 1px solid #d6deea;
  border-radius: 4px;
  outline: none;
  color: var(--text);
  background: #fbfdff;
  font-size: .72rem;
}
.doctor-filter-search input:focus {
  border-color: #87aef0;
  box-shadow: 0 0 0 2px rgba(11, 91, 211, .08);
}
.doctor-filter-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}
.doctor-filter-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 3px 6px 3px 8px;
  border: 1px solid #d6deea;
  border-radius: 4px;
  background: #fbfdff;
}
.doctor-filter-control span {
  color: #66748a;
  font-size: .57rem;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.doctor-filter-control select {
  min-width: 92px;
  height: 24px;
  padding: 0 20px 0 0;
  border: 0;
  outline: none;
  color: var(--text);
  background: transparent;
  font-size: .7rem;
  font-weight: 700;
}
.doctor-filter-control select:focus {
  color: var(--blue);
}
.doctor-filter-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding-inline: 10px;
}
.locked-card {
  opacity: 0.7;
  border-left: 4px solid var(--border, #cbd5e1) !important;
  background: var(--bg-surface-hover, #f8fafc);
}
.locked-card .queue-card-actions button,
.locked-card .queue-card-actions a {
  pointer-events: none;
  opacity: 0.5;
}
.status-locked {
  background-color: #fee2e2;
  color: #ef4444;
}
.status-in-consultation {
  background-color: #dcfce7;
  color: #15803d;
}

/* Tabs Panel visibility toggles */
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}
.tab-btn {
  color: var(--text-muted, #64748b);
  border: 0;
  padding: 8px 16px;
  background: none;
  font-size: 0.88rem;
  transition: all 0.2s ease;
}
.tab-btn.active {
  color: #fff !important;
  background-color: var(--color-primary, #0b5bd3) !important;
}

/* Dialog styling fallback */
.modal-dialog-custom::backdrop {
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
}

/* Selected Service details row */
.selected-service-row {
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}
.selected-service-row:hover {
  box-shadow: var(--shadow);
}

/* Professional compact density */
h1 { font-size: clamp(1.1rem, 1.7vw, 1.55rem); }
h2 { font-size: 1rem; }
h3 { font-size: .9rem; }
.eyebrow { margin-bottom: 4px; font-size: .64rem; letter-spacing: .08em; }

.sidebar { padding: 16px 14px; }
.brand { gap: 9px; min-height: 44px; padding: 0 4px 16px; }
.brand strong { font-size: .86rem; }
.brand span { font-size: .65rem; }
.brand-mark, .brand-logo-image { width: 32px; height: 32px; border-radius: 4px !important; font-size: 1.2rem; }
.brand-logo-image { padding: 3px; }
.brand-mark-large { width: 42px; height: 42px; font-size: 1.55rem; }
.sidebar-nav { gap: 4px; margin-top: 16px; }
.nav-link { gap: 9px; padding: 8px 10px; border-radius: 4px !important; font-size: .78rem; }
.nav-icon { width: 18px; height: 18px; font-size: .9rem; }
.sidebar-footer { padding-top: 16px; }
.user-chip { gap: 8px; margin-bottom: 10px; padding: 8px; border-radius: 4px !important; }
.user-chip strong { max-width: 128px; font-size: .74rem; }
.user-chip span { font-size: .63rem; }
.avatar { width: 30px; height: 30px; font-size: .78rem; }
.avatar-large { width: 42px; height: 42px; font-size: 1rem; }

.topbar { min-height: 62px; padding: 9px 22px; }
.topbar-user-copy strong { font-size: .74rem; }
.topbar-user-copy span { font-size: .62rem; }
.page-content { padding: 18px 22px 32px; }
body.is-embedded .page-content { padding: 16px 18px 28px; }
.page-actions { gap: 12px; margin-bottom: 16px; }
.action-group { gap: 7px; }

.button { min-height: 34px; padding: 7px 12px; border-radius: 4px !important; font-size: .76rem; }
.button-small { min-height: 30px; padding: 5px 9px; font-size: .68rem; }
.button-large { min-height: 40px; font-size: .8rem; }
.icon-button { width: 32px; height: 32px; border-radius: 4px !important; font-size: 1rem; }
.text-link { font-size: .72rem; }

.stats-grid, .stats-grid-4, .stats-grid-5 { gap: 12px; margin-bottom: 16px; }
.stat-card { min-height: 104px; padding: 14px; border-radius: 4px !important; }
.stat-card::after { width: 68px; height: 68px; }
.stat-card strong { margin: 8px 0 5px; font-size: clamp(1.15rem, 1.45vw, 1.55rem); }
.stat-card small { font-size: .64rem; }
.stat-label { font-size: .67rem; }

.content-grid { gap: 16px; margin-bottom: 16px; }
.panel { padding: 16px; border-radius: 4px !important; }
.panel-header { gap: 10px; margin-bottom: 14px; }
.count-badge, .role-badge { min-height: 22px; padding: 3px 7px; border-radius: 4px !important; font-size: .62rem; }

th { padding: 8px 10px; font-size: .62rem; }
td { padding: 9px 10px; font-size: .73rem; }
.table-secondary { font-size: .63rem; }
.status { padding: 3px 6px !important; border-radius: 4px !important; font-size: .59rem !important; }
.queue-number { width: 30px !important; height: 30px !important; border-radius: 4px !important; font-size: .8rem !important; }
.queue-number-large { min-width: 40px !important; width: 40px !important; height: 40px !important; font-size: 1rem !important; }

.empty-state { min-height: 190px; padding: 22px; }
.empty-state.compact { min-height: 76px; padding: 12px; }
.empty-icon { min-width: 40px; height: 40px; margin-bottom: 10px; border-radius: 4px !important; }

.form-stack { gap: 12px; }
.form-grid { gap: 12px; }
.field { gap: 5px; }
.field > span { font-size: .68rem; }
.field small { font-size: .61rem; }
.field input,
.field textarea,
.field select,
.search-form select,
.inline-form select,
.date-filter input,
.inline-create-form input,
.upload-inline-form input[type="file"] {
  min-height: 36px;
  padding: 7px 9px;
  border-radius: 4px !important;
  font-size: .76rem;
}
.form-panel { padding: 18px; }
.form-footer { gap: 8px; margin: 20px -18px -18px; padding: 12px 18px; border-radius: 0 0 4px 4px !important; }
.section-heading { gap: 10px; margin-bottom: 14px; }
.section-heading-spaced { margin-top: 22px; padding-top: 18px; }
.section-heading p { font-size: .68rem; }
.section-number { width: 24px; height: 24px; border-radius: 4px !important; font-size: .66rem; }
.search-form { gap: 7px; }
.search-box { min-height: 36px; padding: 0 9px; border-radius: 4px !important; }
.search-box input { padding: 7px; }
.pagination { gap: 10px; padding-top: 14px; }

.patient-heading { gap: 10px; }
.patient-heading h2 { font-size: 1.08rem; }
.alert-banner, .mini-alert, .flash { border-radius: 4px !important; }
.alert-banner { padding: 10px 12px; margin-bottom: 16px; }
.mini-alert { padding: 7px 9px; }
.details-list div { padding: 9px 0; }
.timeline { gap: 12px; }
.timeline-card,
.visit-summary-grid div,
.invoice-strip,
.segmented-control,
.segmented-control a,
.queue-card,
.queue-meta-grid div,
.clinical-preview,
.doctor-patient-card,
.history-card,
.ready-billing-card,
.invoice-item-row,
.invoice-summary,
.invoice-view-meta div,
.note-box,
.paid-banner,
.invoice-register-card,
.invoice-register-money div,
.carry-forward-card,
.balance-clean-card,
.billing-total-stack,
.payment-result-card,
.billing-totals-card,
.collection-due-card,
.activity-icon,
.login-feature-grid span,
.login-card,
.template-preview-mini,
.palette-item,
.empty-inspector,
.opd-fee-strip,
.auto-doctor-card,
.brand-preview-large,
.brand-preview-large span,
.theme-option,
.theme-swatch,
.login-logo-image,
.opd-fee-live-summary,
.dashboard-frame-card iframe,
.medical-alert-tag,
.mobile-search-results,
.search-result-btn,
.search-result-code,
.balance-alert-badge,
.checkbox-tick-custom,
.tab-btn {
  border-radius: 4px !important;
}

.queue-board, .doctor-queue-list, .billing-register-list, .history-list { gap: 10px; }
.queue-card { gap: 12px; padding: 13px; }
.queue-card-header h2 { font-size: .9rem; }
.queue-meta-grid { gap: 8px; margin-top: 10px; }
.queue-meta-grid div { padding: 7px 8px; }
.clinical-preview { gap: 9px; margin-top: 10px; padding: 10px; }
.complaint { margin-top: 9px; font-size: .72rem; }
.doctor-patient-card { gap: 10px; padding: 12px; }
.history-card { padding: 10px; }
.ready-billing-card { gap: 10px; padding: 12px; }

.invoice-item-row { gap: 8px; padding: 10px; }
.invoice-line-total { min-height: 36px; }
.invoice-summary { padding: 12px; }
.billing-compose-grid { gap: 16px; }
.billing-section-title { margin: 6px 0 12px; }
.carry-forward-card, .balance-clean-card { margin-bottom: 10px; padding: 10px; }
.billing-total-stack > div { padding: 8px 10px; font-size: .72rem; }
.payment-amount-field input { min-height: 42px; font-size: .9rem; }
.payment-result-card { margin: 10px 0; padding: 12px; }
.payment-result-card strong { font-size: clamp(1.2rem, 2vw, 1.6rem); }
.invoice-status-hero { gap: 16px; margin-bottom: 16px; }
.invoice-status-hero > div:first-child > strong { font-size: clamp(1.55rem, 3vw, 2.2rem); }
.invoice-status-split div { padding: 9px; }
.collection-due-card { padding: 12px; }
.collection-due-card strong { font-size: 1.35rem; }

.mini-chart { min-height: 190px; }
.chart-column { height: 170px; }
.chart-bar, .chart-bar i, .report-bar-track, .report-bar-track i, .invoice-status-meter i, .invoice-status-meter b { border-radius: 4px !important; }
.activity-item { gap: 10px; padding: 9px 4px; }
.activity-icon { width: 30px; height: 30px; }
.flash { padding: 9px 11px; font-size: .72rem; }
.modal { padding: 14px; }
.modal-card { padding: 16px; border-radius: 4px !important; }
.modal-header { gap: 10px; margin-bottom: 14px; }
.modal-dialog-custom { border-radius: 4px !important; padding: 16px !important; }

.login-card { width: min(100%, 400px); padding: 24px; }
.login-card h2 { font-size: 1.35rem; }
.login-logo-image { width: 56px; height: 56px; margin-bottom: 16px; }
.login-feature-grid span { padding: 9px 11px; }

.builder-page-actions { top: 62px; }
.builder-sidebar,
.builder-inspector { top: 128px; padding: 14px; }
.builder-toolbar { padding: 10px 12px; }
.palette-item { min-height: 32px; padding: 7px 9px; font-size: .68rem; }
.opd-fee-strip { padding: 10px; }
.brand-preview-large { width: 68px; height: 68px; }
.brand-preview-large span { width: 46px; height: 46px; font-size: 1.5rem; }
.theme-option { padding: 8px; }
.theme-swatch { height: 26px; }
.theme-option-grid { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.theme-option strong { font-size: .62rem; }

.medical-alert-tag { padding: .35rem .7rem; font-size: .75rem; }
#medical-alerts-other-input { padding: 7px 9px !important; border-radius: 4px !important; font-size: .76rem; }
.search-result-name { font-size: .8rem; }
.search-result-item { padding: 7px; }
.search-result-btn { padding: 4px 8px; border-radius: 4px !important; }
.checkbox-tick-container { height: 34px; }
.checkbox-tick-label { gap: 7px; font-size: .78rem; }
.checkbox-tick-custom { width: 18px; height: 18px; border-radius: 4px !important; font-size: .68rem; }
.tab-btn { padding: 7px 12px; font-size: .78rem; }

@media (max-width: 1050px) {
  :root { --sidebar-width: 220px; }
  .page-content { padding: 16px 18px 28px; }
}

@media (max-width: 820px) {
  .sidebar { width: min(86vw, 280px); }
  .topbar { min-height: 58px; padding: 8px 12px; gap: 10px; }
  .page-content { padding: 14px 12px calc(94px + env(safe-area-inset-bottom)); }
  .mobile-nav { right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); left: 8px; padding: 4px; border-radius: 4px !important; }
  .mobile-nav a { flex: 1 1 auto; min-width: 64px; padding: 5px 2px; border-radius: 4px !important; font-size: .52rem; }
  .mobile-nav a span { font-size: .86rem; }
  .sticky-form-footer { bottom: calc(72px + env(safe-area-inset-bottom)); }
}

@media (max-width: 560px) {
  .topbar h1 { font-size: 1rem; }
  .stat-card { min-height: 92px; padding: 12px; }
  .stat-card strong { font-size: 1.2rem; }
  .panel, .form-panel { padding: 13px; }
  .form-footer { margin: 18px -13px -13px; padding: 11px 13px; }
  .button { min-height: 32px; padding-inline: 9px; }
  .field input, .field textarea, .field select { min-height: 34px; }
  .queue-card, .doctor-patient-card { padding: 11px; }
  .login-card { padding: 20px 16px; }
}

/* Enterprise density refinement */
:root {
  --bg: #f6f8fb;
  --border: #d8e0ea;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --sidebar-width: 228px;
}

body { font-size: 13px; color: #18243a; }
.topbar { min-height: 56px; padding: 8px 20px; background: rgba(255,255,255,.98); box-shadow: none; }
.page-content { width: min(100%, 1480px); padding: 15px 20px 28px; }
body.is-embedded .page-content { padding: 14px 16px 24px; }
.page-actions { margin-bottom: 14px; }
.page-actions .muted { font-size: .78rem; }

.sidebar { padding: 14px 12px; }
.brand { min-height: 40px; padding-bottom: 14px; }
.brand-mark, .brand-logo-image { width: 30px; height: 30px; box-shadow: none; }
.nav-link { min-height: 34px; padding: 7px 9px; font-size: .74rem; }
.nav-link.active { background: rgba(35, 118, 229, .95); box-shadow: none; }
.user-chip { padding: 7px; }
.avatar { width: 28px; height: 28px; }

.panel,
.stat-card,
.queue-card,
.doctor-patient-card,
.invoice-register-card,
.timeline-card,
.history-card,
.login-card,
.modal-card {
  box-shadow: var(--shadow) !important;
}

.stat-card { min-height: 86px; padding: 11px 12px; background: #fff !important; border-left: 3px solid currentColor; }
.stat-card::after { display: none; }
.stat-card strong { margin: 6px 0 3px; font-size: clamp(1rem, 1.15vw, 1.35rem); }
.stat-card small { font-size: .6rem; }
.stat-label { font-size: .62rem; text-transform: uppercase; letter-spacing: .03em; }
.stats-grid, .stats-grid-4, .stats-grid-5 { gap: 10px; margin-bottom: 14px; }

.panel { padding: 14px; }
.panel-header { margin-bottom: 11px; }
.content-grid { gap: 14px; margin-bottom: 14px; }
.button { min-height: 31px; padding: 6px 10px; font-size: .72rem; box-shadow: none !important; }
.button-primary { background: var(--blue); }
.button-primary:hover { background: var(--blue-2); }
.button-secondary { background: #fff; }
.button-small { min-height: 27px; padding: 4px 8px; font-size: .65rem; }
.icon-button { width: 29px; height: 29px; font-size: .92rem; }

th { padding: 7px 9px; font-size: .59rem; }
td { padding: 8px 9px; font-size: .7rem; }
table { min-width: 640px; }
.table-secondary { font-size: .6rem; }
.queue-number { width: 27px !important; height: 27px !important; font-size: .72rem !important; box-shadow: none; }
.queue-number-large { min-width: 36px !important; width: 36px !important; height: 36px !important; font-size: .9rem !important; }
.status { padding: 2px 6px !important; font-size: .56rem !important; }

.form-panel { padding: 14px; }
.form-grid { gap: 9px 10px; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(170px, 1fr)); }
.form-stack { gap: 9px; }
.field { gap: 4px; }
.field > span {
  color: #56657a;
  font-size: .59rem;
  font-weight: 800;
  letter-spacing: .035em;
  text-transform: uppercase;
}
.field small { font-size: .58rem; }
.field input,
.field textarea,
.field select,
.search-form select,
.inline-form select,
.date-filter input,
.inline-create-form input,
.upload-inline-form input[type="file"] {
  min-height: 32px;
  padding: 5px 8px;
  border-color: #d6deea;
  font-size: .71rem;
}
.field textarea { min-height: 74px; line-height: 1.35; }
.field input:focus,
.field textarea:focus,
.field select:focus,
.search-form select:focus,
.inline-form select:focus {
  border-color: #87aef0;
  box-shadow: 0 0 0 2px rgba(11, 91, 211, .08);
}
.form-footer { margin: 16px -14px -14px; padding: 10px 14px; background: #f8fafc; }
.section-heading {
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5ebf3;
}
.section-heading-spaced { margin-top: 18px; padding-top: 14px; }
.section-number { display: none; }
.section-heading h2 { font-size: .82rem; }
.section-heading p { margin-top: 2px; font-size: .61rem; }
.search-box { min-height: 32px; padding-inline: 8px; }
.search-box input { padding: 5px 7px; font-size: .71rem; }

.medical-alerts-tags { gap: 6px; }
.medical-alert-tag { padding: .3rem .55rem; font-size: .68rem; }
.checkbox-tick-container { height: 30px; }
.checkbox-tick-label { font-size: .72rem; }
.checkbox-tick-custom { width: 16px; height: 16px; border-width: 1px; }

.modal-card { padding: 14px; }
.modal-header { margin-bottom: 11px; }
.modal-card-wide { width: min(690px, calc(100vw - 28px)); }
.dashboard-frame-card { width: min(1080px, calc(100vw - 28px)); height: min(800px, calc(100vh - 36px)); }

.billing-compose-grid { grid-template-columns: minmax(0, 1.65fr) minmax(290px, .7fr); gap: 14px; }
.invoice-item-row { grid-template-columns: minmax(180px, 2.4fr) minmax(62px, .55fr) minmax(96px, .9fr) minmax(90px, .85fr) 30px; gap: 7px; padding: 8px; }
.invoice-line-total { min-height: 32px; }
.payment-amount-field input { min-height: 36px; font-size: .78rem; }
.billing-total-stack > div { padding: 7px 9px; font-size: .68rem; }
.payment-result-card { padding: 10px; }
.collection-due-card strong { font-size: 1.15rem; }

.queue-card,
.doctor-patient-card,
.ready-billing-card,
.invoice-register-card { padding: 10px; }
.queue-meta-grid div,
.invoice-register-money div,
.invoice-view-meta div,
.invoice-status-split div { padding: 7px; }
.clinical-preview { padding: 8px 9px; }
.activity-icon { width: 27px; height: 27px; }

@media (max-width: 1050px) {
  :root { --sidebar-width: 214px; }
  .page-content { padding: 14px 16px 26px; }
}

@media (max-width: 820px) {
  .topbar { min-height: 52px; }
  .page-content { padding: 12px 10px calc(88px + env(safe-area-inset-bottom)); }
  .form-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  body { font-size: 12.5px; }
  .panel, .form-panel { padding: 11px; }
  .form-footer { margin: 14px -11px -11px; padding: 9px 11px; }
  .field input, .field textarea, .field select { min-height: 31px; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .stat-card { min-height: 78px; padding: 10px; }
}

/* Doctor queue compact filters */
.doctor-filter-bar {
  min-height: 44px;
}
.doctor-filter-search input {
  min-height: 30px;
}
.doctor-filter-control {
  min-height: 30px;
}
.doctor-filter-control select {
  min-width: 78px;
}
.doctor-filter-control:nth-child(2) select {
  min-width: 74px;
}
.doctor-filter-reset {
  min-height: 30px;
}

@media (max-width: 940px) {
  .doctor-filter-bar {
    align-items: stretch;
    flex-direction: column;
  }
  .doctor-filter-search {
    flex-basis: auto;
    min-width: 0;
  }
  .doctor-filter-controls {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .doctor-filter-bar {
    gap: 7px;
    margin: -3px -2px 10px;
    padding: 7px 0;
    border-width: 0 0 1px;
    border-radius: 0 !important;
    background: rgba(246, 249, 253, .96);
    box-shadow: none;
    backdrop-filter: blur(10px);
  }
  .doctor-filter-search {
    padding: 0 2px;
  }
  .doctor-filter-search input {
    min-height: 34px;
    padding-left: 30px;
    background: #fff;
    font-size: .74rem;
  }
  .doctor-filter-controls {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 2px 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .doctor-filter-controls::-webkit-scrollbar {
    display: none;
  }
  .doctor-filter-control {
    flex: 0 0 auto;
    justify-content: flex-start;
    width: auto;
    min-width: 108px;
    max-width: 136px;
    min-height: 30px;
    padding: 3px 7px;
    background: #fff;
  }
  .doctor-filter-control span {
    flex: 0 0 auto;
    font-size: .52rem;
  }
  .doctor-filter-control select {
    min-width: 0;
    width: auto;
    max-width: 78px;
    padding-right: 16px;
    font-size: .68rem;
    text-align: left;
  }
  .doctor-filter-reset {
    flex: 0 0 auto;
    width: 34px;
    min-width: 34px;
    min-height: 30px;
    padding: 0;
    background: #fff;
  }
  .doctor-filter-reset-text {
    display: none;
  }
  .doctor-filter-reset-icon {
    font-size: .86rem;
    line-height: 1;
  }
}

/* OPD builder stability */
.opd-builder-shell {
  grid-template-columns: 220px minmax(500px, 1fr) 240px;
  gap: 12px;
}
.builder-workspace { overflow: hidden; }
.builder-sidebar,
.builder-inspector {
  top: 118px;
  max-height: calc(100vh - 135px);
  padding: 12px;
}
.builder-canvas-scroll {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - 190px);
  padding: 16px;
}
.builder-canvas-stage {
  margin: 0 auto;
}
.builder-toolbar {
  gap: 8px;
  padding: 8px 10px;
}
.builder-toolbar .muted {
  font-size: .6rem;
}
.field-palette {
  max-height: 42vh;
  overflow: auto;
  padding-right: 2px;
}
.palette-item {
  min-height: 29px;
  padding: 5px 7px;
  border-radius: 4px;
}
.palette-group {
  gap: 5px;
  padding-bottom: 7px;
}
.palette-group-title {
  font-size: .57rem;
  letter-spacing: .1em;
}
.palette-group-items {
  gap: 4px;
}
.builder-custom-field-box {
  gap: 7px;
  padding: 9px;
  border-radius: 4px;
}
.builder-inspector .form-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.builder-inspector .field input,
.builder-inspector .field select,
.builder-inspector .field textarea {
  min-height: 30px;
  padding: 5px 7px;
}
.builder-resize-handle {
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
}
.builder-element.selected {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

@media (max-width: 1250px) {
  .opd-builder-shell {
    grid-template-columns: 200px minmax(460px, 1fr) 220px;
  }
}

@media (max-width: 1020px) {
  .opd-builder-shell {
    grid-template-columns: 1fr;
  }
  .builder-sidebar,
  .builder-inspector {
    position: static;
    max-height: none;
  }
  .field-palette {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 280px;
  }
}

/* Mobile Hamburger Menu Icon Spans styling */
@media (max-width: 820px) {
  .icon-button[data-sidebar-open] {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
  }
  .icon-button[data-sidebar-open] span {
    display: block;
    width: 18px;
    height: 2px;
    background-color: var(--text, #17233d) !important;
    border-radius: 1px;
  }
}
