/* MediCore HMS — application theme (Bootstrap 5 based) */
:root {
  --mc-primary: #0b6e6e;
  --mc-primary-600: #095c5c;
  --mc-primary-50: #e7f3f2;
  --mc-ink: #0f1f2e;
  --mc-ink-2: #44546a;
  --mc-line: #e3e8ee;
  --mc-bg: #f4f6f9;
  --mc-side: #0d2231;
  --mc-side-2: #12303f;
  --mc-side-text: #aebccb;
  --mc-accent: #f4a340;
  --mc-radius: 12px;
  --bs-primary: #0b6e6e;
  --bs-primary-rgb: 11, 110, 110;
  --bs-link-color: #0b6e6e;
  --bs-link-color-rgb: 11, 110, 110;
  --bs-link-hover-color: #074848;
  --bs-body-font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --bs-body-color: #1d2b3a;
  --bs-border-color: #e3e8ee;
}
body.app { background: var(--mc-bg); font-size: .925rem; }
.btn-primary { --bs-btn-bg: var(--mc-primary); --bs-btn-border-color: var(--mc-primary); --bs-btn-hover-bg: var(--mc-primary-600); --bs-btn-hover-border-color: var(--mc-primary-600); --bs-btn-active-bg: #074848; --bs-btn-disabled-bg: var(--mc-primary); --bs-btn-disabled-border-color: var(--mc-primary); }
.btn-outline-primary { --bs-btn-color: var(--mc-primary); --bs-btn-border-color: var(--mc-primary); --bs-btn-hover-bg: var(--mc-primary); --bs-btn-hover-border-color: var(--mc-primary); --bs-btn-active-bg: var(--mc-primary); }
.text-primary { color: var(--mc-primary) !important; }
.bg-primary, .text-bg-primary { background-color: var(--mc-primary) !important; }
.form-control:focus, .form-select:focus { border-color: #5fb3ad; box-shadow: 0 0 0 .2rem rgba(11,110,110,.15); }
.form-check-input:checked { background-color: var(--mc-primary); border-color: var(--mc-primary); }
.page-link { color: var(--mc-primary); } .active > .page-link { background: var(--mc-primary); border-color: var(--mc-primary); }
.form-label { font-size: .8rem; font-weight: 600; color: var(--mc-ink-2); margin-bottom: .3rem; }

/* ---------- sidebar ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 252px; background: linear-gradient(180deg, var(--mc-side) 0%, #0a1b27 100%); color: var(--mc-side-text); display: flex; flex-direction: column; z-index: 1040; transition: transform .2s ease; }
.brand { display: flex; align-items: center; gap: .65rem; padding: 1.1rem 1.25rem; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #14a39a, #0b6e6e); display: inline-grid; place-items: center; color: #fff; font-size: 1.1rem; box-shadow: 0 4px 12px rgba(20,163,154,.35); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; } .brand-text strong { font-size: 1.05rem; letter-spacing: .2px; } .brand-text small { font-size: .65rem; letter-spacing: 3px; color: #7fd1c9; }
.nav-scroll { overflow-y: auto; flex: 1; padding: .5rem 0 1rem; scrollbar-width: thin; scrollbar-color: #24465a transparent; }
.nav-group { padding: .35rem .75rem; }
.nav-group-title { font-size: .66rem; text-transform: uppercase; letter-spacing: 1.2px; color: #6f8597; padding: .6rem .6rem .3rem; font-weight: 600; }
.sidebar .nav-link { display: flex; align-items: center; gap: .7rem; color: var(--mc-side-text); padding: .48rem .7rem; border-radius: 8px; font-size: .86rem; text-decoration: none; }
.sidebar .nav-link i { font-size: 1rem; width: 1.1rem; text-align: center; opacity: .85; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link.active { background: linear-gradient(90deg, rgba(20,163,154,.28), rgba(20,163,154,.08)); color: #fff; box-shadow: inset 3px 0 0 #2dd4bf; }
.sidebar-foot { font-size: .7rem; color: #5e7486; padding: .75rem 1.25rem; border-top: 1px solid rgba(255,255,255,.06); }
.main { margin-left: 252px; min-height: 100vh; display: flex; flex-direction: column; }
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1035; }
  .main { margin-left: 0; }
}

/* ---------- topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 1030; height: 60px; background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(8px); border-bottom: 1px solid var(--mc-line); display: flex; align-items: center; gap: .9rem; padding: 0 1.25rem; }
.topbar-hospital { align-items: center; max-width: 340px; }
.topbar-hospital .form-select { min-width: 150px; }
.btn-icon { width: 38px; height: 38px; border-radius: 10px; display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--mc-ink-2); font-size: 1.15rem; }
.btn-icon:hover { background: var(--mc-primary-50); color: var(--mc-primary); }
.notif-dot { position: absolute; top: 3px; right: 2px; background: #e5484d; color: #fff; font-size: .6rem; font-weight: 700; border-radius: 10px; padding: 1px 5px; border: 2px solid #fff; }
.notif-menu { width: 360px; max-height: 480px; overflow-y: auto; padding: 0; }
.notif-item { display: flex; gap: .6rem; white-space: normal; padding: .6rem .9rem; border-bottom: 1px solid #f1f3f5; }
.notif-item.unread { background: #f3faf9; }
.notif-level { width: 6px; border-radius: 3px; flex-shrink: 0; }
.global-search { flex: 1; max-width: 520px; }
.global-search > i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: #8a99a8; }
.global-search input { padding-left: 2.2rem; border-radius: 10px; background: #f3f5f8; border-color: transparent; }
.global-search input:focus { background: #fff; }
.gs-results, .pp-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 1050; max-height: 360px; overflow-y: auto; display: none; }
.gs-results.show, .pp-results.show { display: block; }
.user-chip { display: flex; align-items: center; gap: .55rem; border-radius: 12px; padding: .25rem .5rem; border: 1px solid transparent; }
.user-chip:hover { background: #f3f5f8; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #0b6e6e, #14a39a); color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: .78rem; }

/* ---------- content ---------- */
.content { padding: 1.4rem 1.5rem 3rem; flex: 1; }
@media (max-width: 575.98px) { .content { padding: 1rem .8rem 3rem; } }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.page-title { font-size: 1.4rem; font-weight: 700; color: var(--mc-ink); margin: 0; letter-spacing: -.2px; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.breadcrumb { font-size: .78rem; } .breadcrumb a { text-decoration: none; }
.card { border: 1px solid var(--mc-line); border-radius: var(--mc-radius); box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--mc-line); padding: .85rem 1.1rem; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: .5rem; border-radius: var(--mc-radius) var(--mc-radius) 0 0 !important; }
.card-header .card-title { margin: 0; font-size: .95rem; font-weight: 650; }
.card-body { padding: 1.1rem; }
.table { --bs-table-hover-bg: #f6faf9; margin-bottom: 0; }
.table > thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: #64748b; font-weight: 600; background: #f8fafb; border-bottom: 1px solid var(--mc-line); white-space: nowrap; }
.table td { vertical-align: middle; }
.table-card { overflow: hidden; }
.table-card .table > :not(caption) > * > * { padding: .6rem .9rem; }
.badge-status { font-weight: 600; font-size: .7rem; letter-spacing: .2px; padding: .35em .7em; }
.text-bg-orange, .triage-orange { background: #f97316 !important; color: #fff !important; }
.triage-danger { background: #dc2626; color: #fff; } .triage-warning { background: #facc15; color: #3b2f00; } .triage-success { background: #16a34a; color: #fff; } .triage-info { background: #0ea5e9; color: #fff; }
.filter-bar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filter-bar .form-control, .filter-bar .form-select { min-width: 150px; }
.empty { text-align: center; padding: 2.5rem 1rem; color: #8392a5; }
.empty i { font-size: 2rem; display: block; margin-bottom: .5rem; opacity: .6; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: .88rem; }
.kv dt { color: #64748b; font-weight: 500; } .kv dd { margin: 0; }
.section-title { font-size: .75rem; text-transform: uppercase; letter-spacing: 1px; color: #64748b; font-weight: 700; margin: 1.2rem 0 .6rem; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }

/* ---------- KPI tiles ---------- */
.kpi { border-radius: var(--mc-radius); background: #fff; border: 1px solid var(--mc-line); padding: 1rem 1.1rem; display: flex; gap: .9rem; align-items: center; height: 100%; text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s; }
a.kpi:hover { box-shadow: 0 6px 16px rgba(16,24,40,.08); transform: translateY(-1px); color: inherit; }
.kpi-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0; }
.kpi-value { font-size: 1.45rem; font-weight: 700; line-height: 1.1; color: var(--mc-ink); font-variant-numeric: tabular-nums; }
.kpi-label { font-size: .78rem; color: #64748b; }
.tone-teal { background: #e3f4f2; color: #0b6e6e; } .tone-blue { background: #e6f0fd; color: #1d63d8; } .tone-amber { background: #fff4e0; color: #c07208; }
.tone-rose { background: #fde8ea; color: #d23545; } .tone-violet { background: #efeafd; color: #6941c6; } .tone-slate { background: #edf1f5; color: #475569; } .tone-green { background: #e5f6ea; color: #15803d; }

/* ---------- patient banner ---------- */
.patient-banner { display: flex; gap: 1rem; align-items: center; background: #fff; border: 1px solid var(--mc-line); border-left: 4px solid var(--mc-primary); border-radius: var(--mc-radius); padding: .8rem 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.pb-avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 1.4rem; background: #e6f0fd; color: #1d63d8; }
.pb-avatar.f { background: #fde8f1; color: #c2185b; }
.pb-main { flex: 1; min-width: 220px; }
.pb-name { font-size: 1.1rem; font-weight: 700; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; } .pb-name a { color: var(--mc-ink); text-decoration: none; }
.pb-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .82rem; color: #5b6b7d; }
.allergy-chip { background: #fde8ea; color: #b42332; border: 1px solid #f8c7cd; padding: .35rem .7rem; border-radius: 8px; font-size: .8rem; font-weight: 600; }

/* ---------- bed board ---------- */
.ward-block { margin-bottom: 1.25rem; }
.bed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .65rem; }
.bed { border-radius: 10px; border: 1px solid var(--mc-line); background: #fff; padding: .6rem .7rem; font-size: .8rem; position: relative; min-height: 92px; display: flex; flex-direction: column; }
.bed .bed-no { font-weight: 700; font-size: .9rem; display: flex; justify-content: space-between; align-items: center; }
.bed.available { border-left: 4px solid #16a34a; } .bed.occupied { border-left: 4px solid #dc2626; background: #fffafa; }
.bed.cleaning { border-left: 4px solid #f59e0b; background: #fffbf0; } .bed.maintenance, .bed.blocked { border-left: 4px solid #64748b; background: #f6f7f9; }
.bed.reserved { border-left: 4px solid #0ea5e9; background: #f3fbff; }
.bed a.stretched-link { z-index: 1; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; margin-right: 1rem; font-size: .8rem; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- queue ---------- */
.token { font-size: 1.2rem; font-weight: 800; color: var(--mc-primary); min-width: 54px; display: inline-block; }
.queue-display { background: #0d2231; color: #fff; border-radius: var(--mc-radius); padding: 1.5rem; }
.queue-display .now { font-size: 3rem; font-weight: 800; color: #2dd4bf; }

/* ---------- timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 4px; bottom: 4px; width: 2px; background: var(--mc-line); }
.timeline li { position: relative; padding: 0 0 1rem 44px; }
.timeline .tl-icon { position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: .9rem; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--mc-line); }
.timeline .tl-time { font-size: .74rem; color: #8392a5; }

/* ---------- clinical workspace ---------- */
.note-box textarea { min-height: 90px; }
.signed-note { background: #f8fafb; border: 1px solid var(--mc-line); border-radius: 10px; padding: .75rem .9rem; margin-bottom: .6rem; white-space: pre-wrap; font-size: .88rem; }
.signed-note.amended { opacity: .6; text-decoration: line-through; }
.vitals-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: .5rem; }
.vital { background: #f8fafb; border: 1px solid var(--mc-line); border-radius: 10px; padding: .5rem .65rem; }
.vital .v { font-weight: 700; font-size: 1.05rem; } .vital .l { font-size: .7rem; color: #64748b; text-transform: uppercase; letter-spacing: .4px; }
.rx-row td { padding: .35rem !important; } .rx-row .form-control, .rx-row .form-select { font-size: .84rem; padding: .3rem .5rem; }
.flag-H, .flag-HH { color: #c81e1e; font-weight: 700; } .flag-L, .flag-LL { color: #1d4ed8; font-weight: 700; } .flag-A { color: #b45309; font-weight: 700; }
.crit { background: #fde8ea !important; }
.nav-tabs .nav-link { color: #5b6b7d; font-weight: 500; font-size: .88rem; } .nav-tabs .nav-link.active { color: var(--mc-primary); font-weight: 600; }
.checklist .form-check { padding: .35rem .5rem .35rem 2rem; border-radius: 8px; } .checklist .form-check:hover { background: #f6faf9; }

/* ---------- auth ---------- */
.auth-body { background: #f4f6f9; min-height: 100vh; }
.auth-wrap { display: flex; min-height: 100vh; }
.auth-side { flex: 1.1; background: radial-gradient(1000px 600px at 10% 10%, #13505a 0%, #0d2231 55%, #0a1720 100%); color: #e6f0f2; padding: 3rem 3.5rem; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; border: 60px solid rgba(45,212,191,.07); }
.brand-lg { display: flex; align-items: center; gap: .7rem; font-size: 1.35rem; font-weight: 700; color: #fff; }
.auth-side h2 { font-weight: 700; font-size: 2rem; max-width: 460px; }
.auth-points { list-style: none; padding: 0; } .auth-points li { margin: .7rem 0; display: flex; gap: .7rem; align-items: center; opacity: .9; } .auth-points i { color: #2dd4bf; font-size: 1.1rem; }
.auth-main { flex: 1; display: grid; place-items: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 410px; background: #fff; border: 1px solid var(--mc-line); border-radius: 16px; padding: 2rem; box-shadow: 0 20px 40px rgba(16,24,40,.06); }
.auth-card h1 { font-size: 1.35rem; font-weight: 700; }
.otp-input { letter-spacing: .6rem; font-size: 1.4rem; text-align: center; font-weight: 700; }
#qrBox canvas, #qrBox img { width: 180px; height: 180px; }

/* ---------- misc ---------- */
.error-code { font-size: 5rem; font-weight: 800; color: #cbd5e1; line-height: 1; }
.session-warning { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: #0d2231; color: #fff; padding: .6rem 1rem; border-radius: 10px; z-index: 2000; font-size: .85rem; }
.session-warning a { color: #2dd4bf; }
.stat-mini { font-size: .75rem; color: #64748b; }
.chart-box { position: relative; height: 260px; }
.list-compact .list-group-item { padding: .55rem .9rem; font-size: .86rem; }
.sticky-actions { position: sticky; bottom: 0; background: rgba(255,255,255,.95); border-top: 1px solid var(--mc-line); padding: .75rem 1rem; margin: 1rem -1.1rem -1.1rem; border-radius: 0 0 var(--mc-radius) var(--mc-radius); display: flex; gap: .5rem; justify-content: flex-end; }
.perm-matrix th, .perm-matrix td { font-size: .78rem; text-align: center; } .perm-matrix td:first-child, .perm-matrix th:first-child { text-align: left; white-space: nowrap; }
.perm-matrix thead th { writing-mode: vertical-rl; transform: rotate(180deg); height: 130px; vertical-align: bottom; text-transform: none; letter-spacing: 0; }
.barcode { max-width: 100%; height: auto; }
@media print { .sidebar, .topbar, .page-actions, .no-print { display: none !important; } .main { margin: 0; } }

.app a:not(.btn):not(.nav-link):not(.dropdown-item):not(.list-group-item):not(.page-link):not(.kpi):not(.brand) { text-decoration: none; }
.app a:not(.btn):not(.nav-link):not(.dropdown-item):not(.list-group-item):not(.page-link):not(.kpi):not(.brand):hover { text-decoration: underline; }
.progress-bar { background-color: var(--mc-primary); }
.progress-bar.bg-danger { background-color: #dc2626 !important; } .progress-bar.bg-warning { background-color: #f59e0b !important; }
