:root {
  --brand: #0b6e4f;
  --brand-2: #0f8a62;
  --brand-dark: #073d2c;
  --brand-soft: #e7f5ef;
  --accent: #c45c26;
  --ink: #14212b;
  --muted: #61707f;
  --line: #d7e0e7;
  --bg: #eef2f0;
  --panel: #ffffff;
  --danger: #c62828;
  --warning: #b45309;
  --ok: #0f7a45;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 40, 30, .08);
  --sidebar-w: 268px;
  --topbar-h: 68px;
  --dock-h: 68px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Libre Baskerville", Georgia, serif;
  --ease: cubic-bezier(.22,1,.36,1);
  --ui-font-scale: 0.65;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* Rem font-scale on app shell only — keeps auth pages at normal size */
html.app-scaled {
  font-size: calc(16px * var(--ui-font-scale));
}
body.app-body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 400px at 0% 0%, rgba(11,110,79,.11), transparent 55%),
    linear-gradient(180deg, #eaf3ee, var(--bg));
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

.app-wrap { display: flex; min-height: 100vh; }
.app-sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0f4332 0%, #08261c 100%);
  color: #e8f6ef;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto; z-index: 1040;
  flex-shrink: 0;
  box-shadow: 8px 0 30px rgba(0,0,0,.12);
}
.sidebar-brand {
  display: flex; gap: .75rem; align-items: center;
  padding: 1.1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 800;
  color: #fff;
  background: #fff;
  box-shadow: 0 8px 18px rgba(0,0,0,.25);
  flex-shrink: 0;
  object-fit: contain;
  padding: 2px;
}
img.brand-mark { display: block; }
.sidebar-brand strong { display: block; font-size: .98rem; }
.sidebar-brand small { color: rgba(255,255,255,.55); font-size: .72rem; }
.sidebar-user {
  display: flex; gap: .7rem; align-items: center;
  margin: .9rem .85rem; padding: .75rem;
  border-radius: 12px; background: rgba(255,255,255,.07);
}
.sidebar-user .avatar,
.user-menu-btn .avatar,
.user-menu-head .avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(145deg, var(--brand-2), var(--brand-dark));
  color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .8rem;
  flex-shrink: 0;
  border: 2px solid rgba(125, 222, 168, .45);
}
.sidebar-user .meta strong { display: block; font-size: .86rem; }
.badge-role {
  display: inline-block; margin-top: .15rem;
  background: rgba(125,222,168,.18); color: #9aecc0;
  border-radius: 999px; padding: .1rem .5rem; font-size: .68rem; font-weight: 700;
}
.sidebar-nav { padding: .4rem .7rem 1.5rem; display: flex; flex-direction: column; gap: .15rem; }
.nav-section {
  margin: .85rem .55rem .35rem;
  font-size: .68rem; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(255,255,255,.42);
}
.sidebar-nav a {
  display: flex; align-items: center; gap: .7rem;
  color: #d5ebe0; padding: .72rem .8rem; border-radius: 11px;
  transition: .2s var(--ease);
}
.sidebar-nav a i { font-size: 1.05rem; opacity: .9; }
.sidebar-nav a:hover { background: rgba(255,255,255,.08); color: #fff; transform: translateX(2px); }
.sidebar-nav a.active {
  background: rgba(255,255,255,.14); color: #fff; font-weight: 700;
  box-shadow: inset 3px 0 0 #7ddea8;
}

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  position: sticky; top: 0; z-index: 1020;
  min-height: var(--topbar-h);
  display: flex; align-items: center; gap: .8rem;
  padding: .7rem 1rem;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(215,224,231,.9);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 {
  margin: 0; font-family: var(--display);
  font-size: clamp(1.05rem, 2.5vw, 1.35rem);
  letter-spacing: -.01em;
}
.breadcrumb { font-size: .78rem; }
.topbar-actions { display: flex; align-items: center; gap: .45rem; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.facility-pill, .status-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  border-radius: 999px; padding: .35rem .7rem;
  font-size: .78rem; font-weight: 600;
  background: var(--brand-soft); color: var(--brand-dark);
  max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
button.facility-pill {
  border: 0;
  cursor: pointer;
  font: inherit;
}
.status-pill.online { background: #e7f8ee; color: var(--ok); }
.status-pill.offline { background: #fdeceb; color: var(--danger); }
.btn-icon { width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 12px; }

/* Screen size (zoom) toolbar */
.ui-font-scale-toolbar .btn {
  font-weight: 600;
  min-width: 2.1rem;
  border-color: rgba(11, 110, 79, .18);
  color: var(--brand-dark);
  background: #fff;
}
.ui-font-scale-toolbar .btn:hover {
  background: var(--brand-soft);
  border-color: rgba(11, 110, 79, .35);
  color: var(--brand);
}
.ui-font-scale-toolbar #uiFontScaleLabel {
  font-variant-numeric: tabular-nums;
  min-width: 2.4rem;
  display: inline-block;
}

/* Account dropdown */
.user-menu { position: relative; }
.user-menu-btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .2rem .45rem .2rem .2rem;
  border-radius: 999px;
  border: 1px solid rgba(11, 110, 79, .14);
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.user-menu-btn:hover,
.user-menu.open .user-menu-btn {
  border-color: rgba(11, 110, 79, .4);
  box-shadow: 0 4px 14px rgba(11, 110, 79, .1);
}
.user-menu-meta {
  flex-direction: column; align-items: flex-start; min-width: 0; max-width: 140px;
}
.user-menu-meta strong {
  display: block; font-size: .8rem; line-height: 1.15;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px;
  color: var(--ink); font-weight: 700;
}
.user-menu-meta small {
  color: var(--muted); font-size: .68rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px;
}
.user-menu-btn .caret {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
  margin-right: .15rem;
  transition: transform .2s var(--ease);
}
.user-menu.open .user-menu-btn .caret { transform: rotate(180deg); }
.user-menu-drop {
  position: absolute; right: 0; top: calc(100% + .45rem);
  min-width: 15rem;
  background: #fff;
  border: 1px solid rgba(11, 110, 79, .1);
  border-radius: 1rem;
  box-shadow: 0 16px 40px rgba(20, 33, 43, .14);
  padding: .4rem;
  opacity: 0; visibility: hidden;
  transform: translateY(-8px) scale(.98);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
  z-index: 1050;
}
.user-menu.open .user-menu-drop {
  opacity: 1; visibility: visible;
  transform: translateY(0) scale(1);
}
.user-menu-head {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem .7rem .35rem;
}
.user-menu-head strong { display: block; font-size: .88rem; color: var(--ink); }
.user-menu-head small { color: var(--muted); font-size: .72rem; }
.user-menu-drop a,
.user-menu-drop button {
  display: flex; align-items: center; gap: .55rem; width: 100%;
  padding: .65rem .8rem; border: 0; background: transparent; border-radius: .75rem;
  text-decoration: none; color: var(--ink); font-size: .88rem; font-weight: 600;
  text-align: left; cursor: pointer;
  transition: background .15s, color .15s;
}
.user-menu-drop a i,
.user-menu-drop button i { font-size: 1rem; opacity: .85; }
.user-menu-drop a:hover,
.user-menu-drop button:hover {
  background: rgba(11, 110, 79, .07);
  color: var(--brand);
}
.user-menu-drop .danger { color: #a33; }
.user-menu-drop .danger:hover { background: rgba(170, 50, 50, .08); color: #8a2222; }
.user-menu-drop .sep {
  height: 1px; background: rgba(11, 110, 79, .08); margin: .3rem .4rem;
}

/* Logout confirm modal */
.logout-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(7, 40, 30, .45);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; transition: opacity .25s ease;
}
.logout-modal-backdrop.show { display: flex; opacity: 1; }
.logout-modal {
  width: min(100%, 380px);
  background: #fff;
  border-radius: 1.25rem;
  padding: 1.5rem 1.35rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .18);
  text-align: center;
  transform: translateY(16px) scale(.96); opacity: 0;
  transition: transform .28s var(--ease), opacity .28s ease;
}
.logout-modal-backdrop.show .logout-modal {
  transform: translateY(0) scale(1); opacity: 1;
}
.logout-modal .ico {
  width: 64px; height: 64px; border-radius: 50%;
  margin: 0 auto 1rem;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #fff0eb, #fde0d6);
  color: #a33; font-size: 1.5rem;
}
.logout-modal h2 {
  font-family: var(--display);
  font-size: 1.25rem;
  margin: 0 0 .4rem;
  color: var(--ink);
}
.logout-modal p {
  color: var(--muted);
  font-size: .9rem;
  margin: 0 0 1.15rem;
}
.logout-actions {
  display: flex; gap: .55rem; justify-content: center; flex-wrap: wrap;
}

.app-content {
  padding: 1.1rem 1.1rem calc(var(--dock-h) + 1.2rem);
  max-width: 1240px; width: 100%;
  animation: pageIn .45s var(--ease);
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.page-hero {
  display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start;
  margin-bottom: 1rem; flex-wrap: wrap;
}
.page-hero h2 {
  margin: 0; font-family: var(--display);
  font-size: clamp(1.25rem, 3vw, 1.7rem);
}
.page-hero p { margin: .35rem 0 0; color: var(--muted); }

.kpi-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr));
  gap: .8rem; margin-bottom: 1rem;
}
@media (min-width: 992px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }
.kpi-card {
  background: var(--panel); border: 1px solid rgba(215,224,231,.8);
  border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
  transition: transform .22s var(--ease), box-shadow .22s;
  animation: rise .5s var(--ease) both;
}
.kpi-card:nth-child(2) { animation-delay: .05s; }
.kpi-card:nth-child(3) { animation-delay: .1s; }
.kpi-card:nth-child(4) { animation-delay: .15s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(15,40,30,.12); }
.kpi-card::after {
  content: ""; position: absolute; right: -20px; top: -20px;
  width: 80px; height: 80px; border-radius: 50%; background: var(--brand-soft);
}
.kpi-card .label { color: var(--muted); font-size: .8rem; position: relative; z-index: 1; }
.kpi-card .value {
  font-family: var(--display); font-size: clamp(1.35rem, 3vw, 1.7rem);
  margin-top: .2rem; position: relative; z-index: 1;
}
.kpi-card.warn .value { color: var(--warning); }
.kpi-card.danger .value { color: var(--danger); }
.kpi-card.ok .value { color: var(--ok); }

.ent-card {
  background: var(--panel); border: 1px solid rgba(215,224,231,.85);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 1rem; overflow: hidden;
  animation: rise .45s var(--ease) both;
}
.ent-card.allow-overflow,
.ent-card:has(.search-drop) {
  overflow: visible;
}
.ent-card .card-head {
  display: flex; justify-content: space-between; align-items: center; gap: .75rem;
  padding: .9rem 1rem; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #f7faf8);
  border-radius: var(--radius) var(--radius) 0 0;
}
.ent-card .card-head h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.ent-card .card-body { padding: 1rem; }

.action-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .75rem;
}
@media (min-width: 768px) { .action-grid { grid-template-columns: repeat(4, 1fr); } }
.action-tile {
  display: flex; flex-direction: column; gap: .4rem;
  padding: 1rem .9rem; min-height: 108px;
  border-radius: 12px; border: 1px solid rgba(11,110,79,.12);
  background: linear-gradient(165deg, #fff, var(--brand-soft));
  color: var(--ink); transition: .22s var(--ease);
}
.action-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); color: var(--ink); }
.action-tile .ico {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; background: var(--brand); color: #fff;
}
.action-tile strong { font-size: .92rem; }
.action-tile span { color: var(--muted); font-size: .75rem; }

.btn-brand {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark);
  --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
  font-weight: 700; border-radius: 11px;
  box-shadow: 0 8px 16px rgba(11,110,79,.2);
}
.btn-soft {
  background: var(--brand-soft); color: var(--brand-dark);
  border: 0; font-weight: 700; border-radius: 11px;
}
.btn-soft:hover { background: #d6eee3; color: var(--brand-dark); }

.search-drop {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 2500;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 40px rgba(7, 61, 44, .16); max-height: 320px; overflow: auto;
}
.search-field {
  position: relative;
  z-index: 30;
}
/* Keep patient autocomplete above the Items card / batch selects */
.ent-card.dispense-patient {
  position: relative;
  z-index: 40;
  overflow: visible;
}
.ent-card.dispense-items,
.ent-card.dispense-pay {
  position: relative;
  z-index: 1;
}
.dispense-steps {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}
.dispense-step {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .75rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
}
.dispense-step .n {
  width: 1.35rem; height: 1.35rem; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: .72rem;
}
.dispense-step.is-on {
  border-color: rgba(11,110,79,.35);
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.dispense-pay-grid .form-control {
  font-variant-numeric: tabular-nums;
}
.totals-box.dispense-totals {
  background: linear-gradient(165deg, #f3faf6, #fff);
  border: 1px solid rgba(11,110,79,.12);
  border-radius: 14px;
  padding: 1rem;
}
.facility-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.facility-switcher .facility-pill {
  cursor: pointer;
  border: 0;
  background: transparent;
  padding: 0;
}
.facility-switcher-drop {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 260px;
  max-height: 320px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 2100;
  padding: .4rem;
}
.facility-switcher.open .facility-switcher-drop { display: block; }
.facility-switcher-drop button {
  display: flex;
  width: 100%;
  text-align: left;
  gap: .55rem;
  align-items: flex-start;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: .55rem .65rem;
  cursor: pointer;
}
.facility-switcher-drop button:hover { background: var(--brand-soft); }
.facility-switcher-drop button.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 700;
}
.facility-switcher-drop small { display: block; color: var(--muted); font-weight: 500; }
.report-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}
.report-kpi-strip .kpi-mini {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .85rem 1rem;
  box-shadow: 0 8px 20px rgba(7, 61, 44, .04);
}
.report-kpi-strip .kpi-mini span {
  display: block;
  font-size: .75rem;
  color: var(--muted);
  margin-bottom: .2rem;
}
.report-kpi-strip .kpi-mini strong {
  font-size: 1.15rem;
  color: var(--ink);
}
.report-kpi-strip .kpi-mini.ok strong { color: var(--brand); }

.search-drop .item {
  display: flex; justify-content: space-between; gap: .75rem;
  padding: .75rem .85rem; border-bottom: 1px solid #eef2f4;
  cursor: pointer; transition: background .15s;
}
.search-drop .item:hover { background: var(--brand-soft); }
.search-drop .item:last-child { border-bottom: 0; }

.patient-chip {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .85rem 1rem; border-radius: 12px;
  background: linear-gradient(120deg, #e9f7f0, #fff);
  border: 1px solid rgba(11,110,79,.15);
}

/* Patients register */
.facility-tag {
  display: inline-flex; align-items: center; gap: .35rem;
  max-width: 220px; padding: .28rem .55rem;
  border-radius: 999px; font-size: .72rem; font-weight: 600;
  background: #eef2f5; color: #3d4f5f;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.facility-tag.mine {
  background: var(--brand-soft); color: var(--brand-dark);
}
.facility-tag i { font-size: .75rem; opacity: .8; }
.file-pill {
  background: #f4f7f5; border: 1px solid var(--line);
  border-radius: .45rem; padding: .15rem .4rem; font-size: .78rem;
  color: var(--brand-dark);
}
.patient-filters .form-label { font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: .25rem; }
.patient-detail .detail-hero {
  display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem;
}
.patient-detail .avatar {
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700;
  background: linear-gradient(145deg, var(--brand-2), var(--brand-dark)); color: #fff;
}
.patient-detail .detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: .65rem;
}
.patient-detail .detail-grid .full { grid-column: 1 / -1; }
.patient-detail .detail-grid > div {
  background: #f7faf8; border-radius: .75rem; padding: .55rem .7rem;
}
.patient-detail .detail-grid span {
  display: block; font-size: .68rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); font-weight: 700;
}
.patient-detail .detail-grid strong { font-size: .9rem; font-weight: 600; }
#pager .page-link {
  color: var(--brand-dark); border-color: var(--line);
}
#pager .page-item.active .page-link {
  background: var(--brand); border-color: var(--brand); color: #fff;
}

.ins-chip {
  display: inline-flex; align-items: center;
  padding: .18rem .5rem; border-radius: 999px;
  font-size: .68rem; font-weight: 700;
  background: #e8f3ff; color: #1a5f9e;
  margin: .1rem .15rem .1rem 0; white-space: nowrap;
}
.ins-chip.general { background: #eef2f5; color: #4a5b6a; }
.restock-totals {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem; padding: .85rem 1rem;
  background: linear-gradient(120deg, #e9f7f0, #fff);
  border: 1px solid rgba(11,110,79,.15); border-radius: 12px;
}
@media (min-width: 768px) {
  .restock-totals { grid-template-columns: repeat(4, 1fr); }
}
.restock-totals > div {
  display: flex; flex-direction: column; gap: .15rem;
}
.restock-totals span { font-size: .72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.restock-totals strong { font-size: 1.05rem; color: var(--brand-dark); }
.restock-totals .grand strong { color: var(--brand); font-size: 1.15rem; }

.table-ent { margin: 0; }
.table-ent th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); background: #f5f8f6;
}
.table-ent td { vertical-align: middle; }
.qty-input { width: 84px; }

.totals-box {
  background: #f4f8f6; border-radius: 12px; padding: .9rem 1rem;
  border: 1px solid rgba(11,110,79,.1);
}
.totals-box .row-line {
  display: flex; justify-content: space-between; padding: .25rem 0; font-size: .92rem;
}
.totals-box .grand { font-size: 1.15rem; font-weight: 800; color: var(--brand-dark); }

.modal-header.brand {
  background: linear-gradient(120deg, var(--brand), var(--brand-dark));
  color: #fff;
}
.modal-header.brand .btn-close { filter: invert(1); }

.loading-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(8,30,22,.55); backdrop-filter: blur(2px);
  display: grid; place-items: center; color: #fff; gap: .75rem;
}
.loading-overlay[hidden] { display: none !important; }

.mobile-dock {
  position: fixed; left: .5rem; right: .5rem; bottom: .45rem;
  z-index: 1030;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255,255,255,.95);
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 14px 34px rgba(0,0,0,.14);
  padding: .3rem;
}
.mobile-dock.dock-3 { grid-template-columns: repeat(3, 1fr); }
.mobile-dock a {
  display: flex; flex-direction: column; align-items: center; gap: .1rem;
  color: var(--muted); font-size: .62rem; font-weight: 600;
  padding: .4rem .1rem; border-radius: 12px;
}
.mobile-dock a i { font-size: 1.1rem; }
.mobile-dock a.active { background: var(--brand-soft); color: var(--brand-dark); }

.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1035;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-105%);
    transition: transform .28s var(--ease);
  }
  .app-sidebar.open { transform: none; }
  .sidebar-backdrop.show { display: block; }
  .facility-pill span { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
}
@media (min-width: 992px) {
  .mobile-dock { display: none; }
  .app-content { padding: 1.25rem 1.35rem 1.75rem; }
}

.list-row {
  display: flex; justify-content: space-between; gap: .75rem; align-items: center;
  padding: .85rem 0; border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: 0; }

.status-badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .2rem .55rem; border-radius: 999px;
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
}
.status-badge.pending { background: #fff7e6; color: #9a6700; }
.status-badge.approved, .status-badge.received, .status-badge.active, .status-badge.completed {
  background: #e8f7ef; color: #0f7a45;
}
.status-badge.rejected, .status-badge.danger, .status-badge.inactive { background: #fdecea; color: #c62828; }

/* Insurance category cards */
.ins-stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
}
.ins-stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .85rem 1rem;
  box-shadow: 0 8px 20px rgba(7, 61, 44, .04);
}
.ins-stat-label {
  display: block;
  font-size: .75rem;
  color: var(--muted);
  margin-bottom: .15rem;
}
.ins-stat strong { font-size: 1.25rem; color: var(--ink); }
.ins-stat.ok strong { color: var(--brand); }
.ins-stat.muted strong { color: #6b7c8a; }

.ins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.ins-card {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: 1.05rem 1.1rem;
  background:
    linear-gradient(165deg, rgba(11, 110, 79, .06), transparent 42%),
    #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(7, 61, 44, .04);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.ins-card:hover {
  transform: translateY(-2px);
  border-color: rgba(11, 110, 79, .28);
  box-shadow: 0 14px 28px rgba(7, 61, 44, .08);
}
.ins-card.is-inactive {
  opacity: .78;
  background: #fafbfc;
}
.ins-card-top {
  display: flex;
  gap: .9rem;
  align-items: flex-start;
}
.ins-cover {
  position: relative;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
}
.ins-cover svg {
  width: 64px;
  height: 64px;
  transform: rotate(-90deg);
}
.ins-cover-bg {
  fill: none;
  stroke: #e7eee9;
  stroke-width: 3.2;
}
.ins-cover-fg {
  fill: none;
  stroke: var(--brand);
  stroke-width: 3.2;
  stroke-linecap: round;
  transition: stroke-dasharray .35s ease;
}
.ins-cover span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: .78rem;
  font-weight: 700;
  color: var(--brand);
}
.ins-card-head { flex: 1; min-width: 0; }
.ins-card-head h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.25;
}
.ins-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem .9rem;
  margin-top: .45rem;
  font-size: .82rem;
  color: var(--muted);
}
.ins-meta i { margin-right: .2rem; }
.ins-desc {
  margin: 0;
  font-size: .88rem;
  color: #3d4f45;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em;
}
.ins-desc.muted { color: var(--muted); font-style: italic; }
.ins-card-actions {
  display: flex;
  gap: .5rem;
  margin-top: auto;
  padding-top: .25rem;
}
@media (max-width: 576px) {
  .ins-stat-row { grid-template-columns: 1fr; }
}

/* Facility cards with default / custom logos */
.facility-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.facility-card {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(7, 61, 44, .04);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.facility-card:hover {
  transform: translateY(-2px);
  border-color: rgba(11, 110, 79, .28);
  box-shadow: 0 14px 28px rgba(7, 61, 44, .08);
}
.facility-card-logo {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(145deg, var(--brand-soft), #fff);
  border: 1px solid rgba(11, 110, 79, .12);
}
.facility-card-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  display: block;
  padding: 4px;
}
.facility-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.facility-card-body h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 750;
  color: var(--brand-dark);
  line-height: 1.25;
}
.facility-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .75rem;
  color: var(--muted);
  font-size: .82rem;
}
.facility-meta span {
  display: inline-flex;
  align-items: center;
  gap: .28rem;
}
.facility-meta i { color: var(--brand); opacity: .85; }
.facility-contact { line-height: 1.45; }
.facility-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .25rem;
}
.facility-hero-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(11, 110, 79, .15);
  background: #fff;
  flex-shrink: 0;
}
.facility-hero-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  display: block;
  padding: 3px;
}
.facility-modal-preview {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  object-fit: contain;
  background: #fff;
  padding: 6px;
  border: 1px solid rgba(11, 110, 79, .15);
  box-shadow: 0 8px 20px rgba(7, 61, 44, .1);
}
@media (max-width: 576px) {
  .facility-card { padding: .9rem; }
  .facility-card-logo { flex-basis: 60px; width: 60px; height: 60px; border-radius: 14px; }
}

.select2-container--bootstrap-5 .select2-selection {
  min-height: 38px; border-color: var(--line); border-radius: .5rem;
}
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
  border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(11,110,79,.15);
}
.modal .select2-container { z-index: 1060; width: 100% !important; }

.line-items-table input.form-control { min-width: 90px; }

.report-presets .btn {
  border-radius: .45rem !important;
  font-weight: 600;
}
.report-presets .btn-check:checked + .btn {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.report-tabs {
  padding-bottom: .25rem;
}
.report-tabs .nav-link {
  white-space: nowrap;
  border-radius: 999px;
  color: var(--ink-soft, #5a6a64);
  background: #f3f6f5;
  font-weight: 600;
  font-size: .85rem;
  padding: .45rem .9rem;
}
.report-tabs .nav-link.active {
  background: var(--brand);
  color: #fff;
}

.ent-card.animate-in { animation: rise .45s var(--ease); }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.auth-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 1.25rem;
  background: linear-gradient(140deg, rgba(11,110,79,.93), rgba(7,61,44,.95));
  position: relative; overflow: hidden;
}
.auth-shell::before, .auth-shell::after {
  content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.08);
  animation: float 8s ease-in-out infinite;
}
.auth-shell::before { width: 240px; height: 240px; top: 8%; left: -50px; }
.auth-shell::after { width: 180px; height: 180px; bottom: 8%; right: -40px; animation-delay: -2s; }
@keyframes float { 50% { transform: translateY(-10px); } }
.auth-panel {
  width: min(430px, 100%); background: #fff; border-radius: 22px;
  padding: 1.5rem; box-shadow: 0 30px 70px rgba(0,0,0,.28); position: relative; z-index: 1;
  animation: rise .5s var(--ease);
}

/* —— Auth pages (login / change password) —— */
.auth-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background: #e8f0eb;
  position: relative;
  overflow-x: hidden;
}
.auth-orbs {
  display: none;
  pointer-events: none;
}
.auth-layout {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  position: relative;
  z-index: 1;
}
.auth-hero {
  position: relative;
  overflow: hidden;
  color: #eef7f2;
  background:
    linear-gradient(155deg, rgba(8, 48, 35, .55), rgba(11, 110, 79, .35)),
    linear-gradient(160deg, #073d2c 0%, #0b6e4f 48%, #0a5a42 100%);
  padding: clamp(1.5rem, 4vw, 3rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.auth-hero-glow {
  position: absolute; inset: auto -20% -30% auto;
  width: 70%; height: 70%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.16), transparent 68%);
  animation: float 10s ease-in-out infinite;
  pointer-events: none;
}
.auth-hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.55), transparent 85%);
  pointer-events: none;
}
.auth-hero-inner { position: relative; z-index: 1; max-width: 34rem; padding-top: 1rem; }

.auth-logo-wrap {
  border-radius: 50%;
  overflow: hidden;
  background: #000;
  box-shadow:
    0 14px 36px rgba(0, 0, 0, .28),
    0 0 0 3px rgba(255, 255, 255, .22);
  flex-shrink: 0;
}
.auth-logo-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.auth-logo-hero {
  width: 112px;
  height: 112px;
  margin-bottom: 1.25rem;
  animation: authLogoIn .8s var(--ease) both, authLogoFloat 5.5s ease-in-out 1s infinite;
}
.auth-logo-inline {
  width: 48px;
  height: 48px;
  display: grid;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, .18),
    0 0 0 2px rgba(11, 110, 79, .18);
}
.auth-only-mobile { display: none; }
.auth-only-desktop { display: grid; }
.auth-logo-sm {
  width: 76px;
  height: 76px;
  margin: 0 auto .55rem;
  animation: authLogoIn .7s var(--ease) both, authLogoFloat 5s ease-in-out .8s infinite;
  box-shadow:
    0 12px 28px rgba(0, 0, 0, .22),
    0 0 0 3px rgba(255, 255, 255, .55),
    0 0 0 6px rgba(11, 110, 79, .12);
}

.auth-eyebrow {
  text-transform: uppercase; letter-spacing: .12em;
  font-size: .72rem; font-weight: 700; opacity: .8; margin: 0 0 .65rem;
  animation: rise .65s var(--ease) .05s both;
}
.auth-brand {
  font-family: var(--display);
  font-size: clamp(1.85rem, 3.4vw, 2.65rem);
  line-height: 1.15; margin: 0 0 .85rem;
  animation: rise .7s var(--ease) .1s both;
}
.auth-lead {
  font-size: 1.05rem; line-height: 1.55; opacity: .9;
  margin: 0 0 1.5rem; max-width: 28rem;
  animation: rise .7s var(--ease) .15s both;
}
.auth-points {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: .65rem;
  animation: rise .7s var(--ease) .2s both;
}
.auth-points li {
  display: flex; align-items: center; gap: .65rem;
  font-weight: 600; font-size: .95rem;
}
.auth-points i {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.12); font-size: 1rem;
}
.auth-hero-foot {
  position: relative; z-index: 1;
  margin: 2rem 0 0; font-size: .8rem; opacity: .65; font-weight: 600;
}
.auth-main {
  display: grid; place-items: center;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  background:
    radial-gradient(600px 280px at 100% 0%, rgba(11,110,79,.1), transparent 60%),
    linear-gradient(180deg, #f4f8f6, #e8f0eb);
}
.auth-card {
  width: min(440px, 100%);
  background: #fff;
  border: 1px solid rgba(215,224,231,.9);
  border-radius: 22px;
  padding: clamp(1.35rem, 3vw, 1.85rem);
  box-shadow: 0 24px 60px rgba(15, 40, 30, .12);
  animation: authCardIn .65s var(--ease) both;
}
.auth-card-brand {
  text-align: center;
  margin: -.15rem 0 1rem;
}
.auth-card-org {
  margin: 0;
  font-weight: 800;
  letter-spacing: .1em;
  font-size: .68rem;
  text-transform: uppercase;
  color: var(--brand);
}
.auth-card-app {
  margin: .2rem 0 0;
  font-family: var(--display);
  font-size: 1.05rem;
  color: #12352a;
  font-weight: 700;
}
.auth-card-top {
  display: flex; align-items: flex-start; gap: .9rem;
  margin-bottom: 1.25rem;
}
.auth-card-top h2 {
  font-family: var(--display);
  font-size: 1.45rem; margin: 0 0 .25rem; color: #12352a;
}
.auth-card-top p {
  margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.4;
}
.auth-alert {
  display: flex; gap: .65rem; align-items: flex-start;
  padding: .75rem .9rem; border-radius: 12px;
  font-size: .9rem; font-weight: 600; margin-bottom: 1rem;
  animation: rise .45s var(--ease) both;
}
.auth-alert i { font-size: 1.1rem; margin-top: .1rem; }
.auth-alert.danger { background: #fdecea; color: #8f1f1f; border: 1px solid #f5c6c2; }
.auth-alert.success { background: #e8f6ef; color: #0f5a3a; border: 1px solid #bfe3cf; }
.auth-alert.warn { background: #fff6e8; color: #8a4b08; border: 1px solid #f0d2a8; }
.auth-form { display: grid; gap: 1rem; }
.auth-field,
.auth-submit {
  animation: authFieldIn .55s var(--ease) both;
  animation-delay: calc(var(--i, 1) * .07s + .18s);
}
.auth-field label {
  display: block; font-weight: 700; font-size: .84rem;
  margin-bottom: .4rem; color: #1f332b;
}
.auth-input {
  display: flex; align-items: center; gap: .55rem;
  border: 1px solid var(--line); border-radius: 12px;
  background: #fbfcfb; padding: 0 .75rem;
  transition: border-color .2s, box-shadow .2s, background .2s, transform .2s;
}
.auth-input:focus-within {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 .2rem rgba(11,110,79,.14);
  transform: translateY(-1px);
}
.auth-input > i { color: #6b7c76; font-size: 1.05rem; }
.auth-input input {
  flex: 1; border: 0; background: transparent; outline: none;
  padding: .9rem 0; font-size: 1rem; color: var(--ink); min-width: 0;
}
.auth-eye {
  border: 0; background: transparent; color: #6b7c76;
  padding: .45rem; border-radius: 8px; line-height: 1;
  min-width: 40px; min-height: 40px;
  display: grid; place-items: center;
  transition: color .15s, background .15s, transform .15s;
}
.auth-eye:hover, .auth-eye:active {
  color: var(--brand); background: var(--brand-soft);
}
.auth-eye:active { transform: scale(.94); }
.auth-submit {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  width: 100%; min-height: 52px; font-weight: 700; font-size: 1rem;
  border-radius: 12px; margin-top: .25rem;
  transition: transform .2s var(--ease), box-shadow .2s;
  box-shadow: 0 10px 24px rgba(11, 110, 79, .22);
}
.auth-submit:hover { transform: translateY(-1px); }
.auth-submit:active { transform: translateY(0) scale(.985); }
.auth-submit .spinner-border { width: 1rem; height: 1rem; border-width: .15em; }
.auth-note {
  margin: 1.1rem 0 0; text-align: center;
  color: var(--muted); font-size: .82rem; font-weight: 600;
}
.auth-note a { font-weight: 700; }
.auth-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .35rem;
}
.auth-label-row label { margin: 0; }
.auth-link-btn {
  border: 0;
  background: transparent;
  color: var(--brand, #0b6e4f);
  font-size: .8rem;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}
.auth-link-btn:hover { text-decoration: underline; }
.auth-hint {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  margin: 0 0 1rem;
  padding: .75rem .9rem;
  border-radius: 12px;
  background: rgba(11, 110, 79, .08);
  color: #145c45;
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.4;
}
.auth-hint i { margin-top: .1rem; flex-shrink: 0; }
.auth-hint.success {
  background: rgba(15, 138, 98, .1);
  color: #0b6e4f;
}
.auth-field-hint {
  margin: .4rem 0 0;
  font-size: .75rem;
  color: var(--muted);
  font-weight: 600;
}
.auth-panel[hidden] { display: none !important; }
.auth-footer-note { margin-top: 1.25rem; opacity: .85; }
.pwd-meter {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem;
  margin-top: .55rem;
}
.pwd-meter span {
  height: 5px; border-radius: 99px; background: #dce5e0;
  transition: background .25s, transform .25s;
}
.pwd-meter span.on { transform: scaleY(1.15); }
.pwd-meter[data-score="1"] span:nth-child(1).on { background: #c62828; }
.pwd-meter[data-score="2"] span.on { background: #b45309; }
.pwd-meter[data-score="3"] span.on { background: #0f8a62; }
.pwd-meter[data-score="4"] span.on { background: #0b6e4f; }
.pwd-meter-label {
  margin: .35rem 0 0; font-size: .75rem; color: var(--muted); font-weight: 600;
}
.pwd-match {
  margin: .4rem 0 0; font-size: .78rem; font-weight: 700;
}
.pwd-match.ok { color: #0f7a45; }
.pwd-match.bad { color: #c62828; }

@keyframes authLogoIn {
  from { opacity: 0; transform: scale(.72) rotate(-8deg); }
  to { opacity: 1; transform: none; }
}
@keyframes authLogoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
@keyframes authCardIn {
  from { opacity: 0; transform: translateY(28px) scale(.98); }
  to { opacity: 1; transform: none; }
}
@keyframes authFieldIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes authOrbDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(18px, -22px) scale(1.08); }
}
@keyframes authOrbDrift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-24px, 16px) scale(1.12); }
}

/* —— Mobile / tablet —— */
@media (max-width: 991.98px) {
  .auth-only-mobile { display: block; }
  .auth-only-desktop { display: none !important; }

  .auth-orbs {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
  }
  .auth-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
    opacity: .55;
  }
  .auth-orb-a {
    width: 220px; height: 220px;
    top: -60px; right: -50px;
    background: radial-gradient(circle, rgba(255,255,255,.35), transparent 70%);
    animation: authOrbDrift 9s ease-in-out infinite;
  }
  .auth-orb-b {
    width: 180px; height: 180px;
    bottom: 12%; left: -70px;
    background: radial-gradient(circle, rgba(15,138,98,.45), transparent 70%);
    animation: authOrbDrift2 11s ease-in-out infinite;
  }
  .auth-orb-c {
    width: 120px; height: 120px;
    top: 42%; right: 8%;
    background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%);
    animation: authOrbDrift 7s ease-in-out infinite reverse;
  }

  .auth-body {
    background: linear-gradient(165deg, #073d2c 0%, #0b6e4f 42%, #0a5a42 100%);
  }
  .auth-layout {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100dvh;
    padding:
      max(1rem, env(safe-area-inset-top))
      max(1rem, env(safe-area-inset-right))
      max(1.15rem, env(safe-area-inset-bottom))
      max(1rem, env(safe-area-inset-left));
    gap: 0;
  }
  .auth-hero {
    display: none;
  }
  .auth-main {
    flex: 0 1 auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    min-height: 0;
  }
  .auth-card {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    border: 0;
    border-radius: 24px;
    padding: 1.35rem 1.15rem 1.35rem;
    box-shadow:
      0 28px 60px rgba(0, 0, 0, .28),
      0 1px 0 rgba(255, 255, 255, .7) inset;
    animation: authCardIn .75s var(--ease) both;
  }
  .auth-card-brand {
    margin: 0 0 1.1rem;
  }
  .auth-card-top {
    text-align: center;
    flex-direction: column;
    align-items: center;
    gap: .2rem;
    margin-bottom: 1.05rem;
  }
  .auth-card-top h2 {
    font-size: 1.32rem;
  }
  .auth-card-top p {
    font-size: .88rem;
  }
  .auth-form { gap: .95rem; }
  .auth-input {
    min-height: 50px;
    border-radius: 14px;
  }
  .auth-input input {
    font-size: 16px; /* avoid iOS zoom */
    padding: .95rem 0;
  }
  .auth-submit {
    min-height: 52px;
    border-radius: 14px;
    margin-top: .15rem;
  }
  .auth-note {
    margin-top: 1rem;
    font-size: .78rem;
    color: #6a7a73;
  }
}

@media (max-width: 380px) {
  .auth-logo-sm { width: 68px; height: 68px; }
  .auth-card { padding: 1.15rem .95rem 1.2rem; border-radius: 20px; }
  .auth-card-app { font-size: .95rem; }
}

@media (max-width: 991.98px) and (max-height: 680px) {
  .auth-card-app { display: none; }
  .auth-logo-sm { width: 58px; height: 58px; margin-bottom: .3rem; }
  .auth-card-brand { margin-bottom: .7rem; }
  .auth-card-top { margin-bottom: .7rem; }
  .auth-card-top h2 { font-size: 1.15rem; }
  .auth-form { gap: .7rem; }
  .auth-layout {
    padding-top: max(.65rem, env(safe-area-inset-top));
    padding-bottom: max(.75rem, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-logo-hero,
  .auth-logo-sm,
  .auth-brand,
  .auth-lead,
  .auth-points,
  .auth-eyebrow,
  .auth-card,
  .auth-field,
  .auth-submit,
  .auth-hero-glow,
  .auth-orb {
    animation: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* —— Formal printable reports —— */
.report-toolbar {
  display: flex; justify-content: space-between; align-items: center; gap: .75rem;
  flex-wrap: wrap; margin-bottom: .85rem;
  padding: .65rem .9rem; background: #f4f7f6; border: 1px solid var(--line); border-radius: .75rem;
}
.report-toolbar-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.toolbar-hint { color: #5a6a64; font-size: .85rem; font-weight: 600; }

.print-document, .formal-report {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.35rem 1.5rem 1.75rem;
  box-shadow: 0 10px 30px rgba(15, 40, 30, .06);
}
.print-letterhead {
  display: grid; gap: .85rem;
  border-bottom: 2px solid var(--brand);
  padding-bottom: 1rem; margin-bottom: 1.1rem;
}
.print-crest { display: flex; align-items: center; gap: .85rem; }
.crest-mark {
  width: 52px; height: 52px; border-radius: 14px;
  background: #fff;
  color: #fff; display: block;
  object-fit: contain;
  border: 1px solid #d9e6df;
  padding: 2px;
}
.org-name {
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.15rem; font-weight: 700; color: #12352a; line-height: 1.25;
}
.app-name { color: #5a6a64; font-size: .85rem; font-weight: 600; }
.print-doc-title h1 {
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.45rem; margin: 0 0 .35rem; color: #0b2e22;
}
.facility-line, .period-line, .meta-line { margin: 0; color: #4a5c56; font-size: .92rem; }
.facility-line .sep { opacity: .5; margin: 0 .35rem; }
.meta-line { font-size: .8rem; margin-top: .25rem; }

.print-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: .65rem; margin-bottom: 1.1rem;
}
.print-kpis > div {
  background: linear-gradient(180deg, #f7faf9, #eef5f2);
  border: 1px solid #d7e5df; border-radius: .7rem; padding: .65rem .75rem;
}
.print-kpis span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: #5a6a64; font-weight: 700; }
.print-kpis strong { font-size: 1.05rem; color: #12352a; }
.print-kpis .text-warn { color: #b45309; }

.print-section-title {
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.05rem; margin: 1.15rem 0 .55rem; color: #0b2e22;
  border-left: 3px solid var(--brand); padding-left: .55rem;
}
.table-print {
  width: 100%; border-collapse: collapse; font-size: .88rem;
}
.table-print th, .table-print td {
  border: 1px solid #d5e0db; padding: .45rem .55rem; vertical-align: top;
}
.table-print thead th {
  background: #0b6e4f; color: #fff; font-weight: 600; white-space: nowrap;
}
.table-print tfoot td { background: #f0f5f3; font-weight: 600; }
.table-print .muted { color: #6b7c76; font-size: .8rem; }
.table-print .nowrap { white-space: nowrap; }
.table-print-sm { font-size: .8rem; }
.table-print tr.row-attention td { background: #fff8ef; }
.print-footnote { font-size: .78rem; color: #6b7c76; margin-top: .75rem; }

.print-signatures { margin-top: 2rem; page-break-inside: avoid; }
.sig-note { font-size: .82rem; color: #4a5c56; margin-bottom: 1.1rem; font-style: italic; }
.sig-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem;
}
.sig-box { min-height: 110px; }
.sig-line {
  border-bottom: 1.5px solid #1f2d28; height: 42px; margin-bottom: .4rem;
}
.sig-label { font-weight: 700; font-size: .85rem; color: #12352a; }
.sig-name, .sig-date { font-size: .78rem; color: #5a6a64; }

.report-quick-links {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .65rem; margin-bottom: 1rem;
}
.report-quick-links a {
  display: flex; align-items: center; gap: .55rem;
  padding: .8rem 1rem; border-radius: .8rem;
  background: #fff; border: 1px solid var(--line);
  color: #12352a; text-decoration: none; font-weight: 600;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.report-quick-links a:hover {
  border-color: var(--brand); box-shadow: 0 8px 20px rgba(11,110,79,.1); transform: translateY(-1px);
}
.print-filter-note {
  display: none;
  font-size: .78rem;
  color: #5a6a64;
  margin: 0 0 .75rem;
}
@media print {
  .print-filter-note { display: block !important; }
}

@media (max-width: 768px) {
  .sig-grid { grid-template-columns: 1fr; }
}

@media print {
  @page { size: A4 portrait; margin: 12mm 10mm 14mm; }

  body.printing-report .app-sidebar,
  body.printing-report .app-topbar,
  body.printing-report .mobile-dock,
  body.printing-report .sidebar-backdrop,
  body.printing-report .loading-overlay,
  body.printing-report .logout-modal-backdrop,
  body.printing-report .no-print,
  body.printing-report .report-toolbar,
  body.printing-report .page-hero,
  body.printing-report .report-tabs,
  body.printing-report .report-presets,
  body.printing-report .report-quick-links,
  body.printing-report .alert,
  .no-print { display: none !important; }

  /* Hide DataTables chrome — print all rows, no pagination */
  body.printing-report .dataTables_length,
  body.printing-report .dataTables_filter,
  body.printing-report .dataTables_info,
  body.printing-report .dataTables_paginate,
  body.printing-report .dataTables_wrapper > .row:first-child,
  body.printing-report .dataTables_wrapper > .row:last-child {
    display: none !important;
  }
  body.printing-report .dataTables_wrapper .dataTables_scrollBody {
    overflow: visible !important; height: auto !important; max-height: none !important;
  }
  body.printing-report table.dataTable tbody tr { display: table-row !important; }
  body.printing-report .table-responsive {
    overflow: visible !important; max-height: none !important;
  }

  body.printing-report .app-body,
  body.printing-report .app-shell {
    background: #fff !important;
  }
  body.printing-report .app-main,
  body.printing-report .app-content {
    margin: 0 !important; padding: 0 !important; width: 100% !important; max-width: none !important;
  }
  body.printing-report .print-document,
  body.printing-report .formal-report,
  .print-document.is-print-focus {
    border: none !important; box-shadow: none !important; border-radius: 0 !important;
    padding: 0 !important; width: 100% !important; max-width: 190mm;
    margin: 0 auto !important;
  }

  body.printing-report .ent-card {
    border: none !important; box-shadow: none !important; margin-bottom: .6rem !important;
    break-inside: avoid;
  }
  body.printing-report .card-head {
    border: none !important; padding: .2rem 0 .35rem !important;
  }
  body.printing-report .card-head h3 {
    font-size: 11.5pt !important; margin: 0 !important;
  }
  body.printing-report .card-body { padding: 0 !important; }

  body.printing-report .kpi-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 4mm !important;
    margin-bottom: 5mm !important;
  }
  body.printing-report .kpi-card {
    border: 1px solid #c5d5ce !important;
    border-radius: 2mm !important;
    padding: 2.5mm !important;
    box-shadow: none !important;
    background: #f4f8f6 !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  body.printing-report .kpi-card .label { font-size: 7.5pt !important; }
  body.printing-report .kpi-card .value { font-size: 11pt !important; }

  body.printing-report table.table-ent,
  body.printing-report table.table-print,
  body.printing-report table.dataTable {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 8.5pt !important;
  }
  body.printing-report table.table-ent th,
  body.printing-report table.table-ent td,
  body.printing-report table.table-print th,
  body.printing-report table.table-print td,
  body.printing-report table.dataTable th,
  body.printing-report table.dataTable td {
    border: 0.4pt solid #9bb5ab !important;
    padding: 1.6mm 1.8mm !important;
    vertical-align: top !important;
  }
  body.printing-report table thead th {
    background: #0b6e4f !important;
    color: #fff !important;
    font-weight: 600 !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  body.printing-report table tbody tr:nth-child(even) td {
    background: #f7faf9 !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }

  body.printing-report canvas {
    max-width: 100% !important;
    max-height: 70mm !important;
  }
  body.printing-report .list-row {
    border-bottom: 0.3pt solid #d5e0db !important;
    padding: 1.2mm 0 !important;
    font-size: 8.5pt !important;
  }

  .print-letterhead { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-kpis > div,
  .crest-mark {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .print-signatures { page-break-inside: avoid; margin-top: 8mm !important; }
  .page-break-before { page-break-before: always; }
  a[href]::after { content: none !important; }
}

/* —— System Center —— */
.sys-tabs { padding: 0; overflow: hidden; }
.sys-tab-nav {
  display: flex; flex-wrap: wrap; gap: .25rem;
  padding: .55rem .65rem;
  background: linear-gradient(180deg, #f4f8f6, #eaf3ee);
  border-bottom: 1px solid var(--line);
}
.sys-tab {
  border: 0; background: transparent; color: var(--muted);
  font-weight: 700; font-size: .9rem;
  padding: .65rem .95rem; border-radius: 10px;
  display: inline-flex; align-items: center; gap: .45rem;
  transition: .2s var(--ease);
}
.sys-tab:hover { color: var(--brand-dark); background: rgba(255,255,255,.7); }
.sys-tab.active {
  background: #fff; color: var(--brand-dark);
  box-shadow: 0 6px 16px rgba(15,40,30,.08);
}
.sys-panel { display: none; animation: rise .4s var(--ease); }
.sys-panel.active { display: block; }
.sys-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .7rem; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: .78rem; font-weight: 700;
}
.sys-pill.ok { background: #e8f6ef; color: #0f7a45; }
.sys-pill.bad { background: #fdecea; color: #8f1f1f; }
.sys-kpi {
  background: #fff; border: 1px solid rgba(215,224,231,.9);
  border-radius: 16px; padding: 1rem 1.05rem;
  box-shadow: var(--shadow); min-height: 110px;
}
.sys-kpi .label { font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.sys-kpi .value { font-family: var(--display); font-size: 1.45rem; margin: .35rem 0 .15rem; color: #12352a; }
.sys-kpi .sub { font-size: .78rem; color: var(--muted); font-weight: 600; }
.sys-health { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.sys-health li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .55rem .65rem; border-radius: 10px; background: #f7faf8;
  font-size: .9rem;
}
.sys-health span { color: var(--muted); font-weight: 600; }
.sys-log {
  margin: 0; padding: 1rem;
  max-height: 360px; overflow: auto;
  background: #0d1f18; color: #b7e0c8;
  font-size: .75rem; line-height: 1.45;
  border-radius: 0 0 14px 14px;
  white-space: pre-wrap; word-break: break-word;
}
.sys-log.short {
  max-height: 140px; border-radius: 12px; margin-bottom: .85rem;
}
.sys-count {
  background: #f7faf8; border: 1px solid var(--line);
  border-radius: 12px; padding: .75rem .85rem;
}
.sys-count .label { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: capitalize; }
.sys-count .value { font-size: 1.35rem; font-weight: 800; color: var(--brand-dark); }

.purge-table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .65rem;
}
.purge-table-card {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  margin: 0;
  padding: .75rem .8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.purge-table-card:hover {
  border-color: rgba(11, 110, 79, .35);
  box-shadow: 0 8px 18px rgba(7, 61, 44, .06);
}
.purge-table-card:has(.purge-table-cb:checked) {
  border-color: rgba(180, 35, 24, .45);
  background: #fff7f6;
}
.purge-table-card.is-empty { opacity: .72; }
.purge-table-card .purge-table-cb { margin-top: .2rem; flex: 0 0 auto; }
.purge-table-body { min-width: 0; flex: 1; }
.purge-table-body strong { display: block; font-size: .9rem; line-height: 1.25; }
.purge-table-body small { font-size: .72rem; line-height: 1.3; }
.purge-table-count {
  display: inline-block;
  margin-top: .35rem;
  font-size: .78rem;
  font-weight: 700;
  color: var(--brand-dark);
}

@media (max-width: 767px) {
  .sys-tab { flex: 1 1 calc(50% - .25rem); justify-content: center; font-size: .82rem; padding: .55rem .5rem; }
  .sys-kpi .value { font-size: 1.2rem; }
}


