/* =========================================================================
   TrueMed Clinic EMR — admin.css  (PACKAGE B3)
   User admin + PhilHealth masterlist  ·  eKAS / ePresS / Exam-summary slips
   Slip-specific @media print lives at the bottom of this file.
   ========================================================================= */

/* ============================ ADMIN · shared ============================ */
.adm-users th, .adm-master th { white-space: nowrap; }
.adm-users td, .adm-master td { white-space: nowrap; }
.adm-users table, .adm-master { min-width: 1080px; }
.adm-users .btn.icon-only { width: 32px; height: 32px; }
.adm-users .btn.icon-only .i { width: 15px; height: 15px; }

/* ---- split dropdown button ---- */
.dd { position: relative; display: inline-flex; align-items: stretch; }
.dd .split-l { border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: 13px; }
.dd .split-r {
  border-top-left-radius: 0; border-bottom-left-radius: 0;
  padding: 10px 12px; margin-left: 1px;
  box-shadow: var(--shadow-coral), inset 0 1px 0 rgba(255, 255, 255, .34), inset 1px 0 0 rgba(255, 255, 255, .3);
}
.dd .split-r .i { margin: 0; transition: transform .22s cubic-bezier(.22, 1, .36, 1); }
.dd.open .split-r .i { transform: rotate(180deg); }
.dd .btn:hover { transform: none; }

.dd-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; min-width: 274px;
  display: flex; flex-direction: column; gap: 2px; padding: 8px;
  background: var(--glass-tint-strong); border: 1px solid var(--glass-border); border-radius: var(--r);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-lg), var(--glass-hi);
  animation: ddIn .22s cubic-bezier(.22, 1, .36, 1);
}
.dd-menu[hidden] { display: none; }
@keyframes ddIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
.dd-t {
  font-size: 10px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); padding: 5px 10px 7px;
}
.dd-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; cursor: pointer;
  padding: 9px 10px; border: 1px solid transparent; border-radius: 11px; background: transparent;
  font-family: var(--font-sans); font-size: 13.5px; font-weight: 800; color: var(--ink);
  transition: background .15s, border-color .15s, transform .12s;
}
.dd-item:hover { background: rgba(255, 255, 255, .9); border-color: var(--line); transform: translateX(2px); }
.dd-item .i { width: 17px; height: 17px; flex: none; color: var(--teal-700); }
.dd-item > span { display: flex; flex-direction: column; min-width: 0; }
.dd-item .dd-s { font-size: 11.5px; font-weight: 700; color: var(--ink-3); margin-top: 1px; }

/* ---- active Y/N toggle pill ---- */
.tgl {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; padding: 3px 10px 3px 4px;
  border-radius: var(--pill); border: 1px solid var(--line); background: var(--neutral-100);
  font-family: var(--font-sans); font-size: 11.5px; font-weight: 900; color: var(--ink-3);
  transition: background .18s, border-color .18s, color .18s;
}
.tgl .knob {
  width: 15px; height: 15px; border-radius: 50%; background: var(--neutral-400);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 1px 2px rgba(23, 28, 38, .2);
  transition: background .18s, transform .22s cubic-bezier(.22, 1, .36, 1);
}
.tgl.on { background: var(--success-light); border-color: rgba(34, 197, 94, .45); color: var(--success-dark); }
.tgl.on .knob { background: var(--success); }
.tgl:hover { border-color: var(--neutral-300); }
.tgl.on:hover { border-color: var(--success); }
.tgl:focus-visible { outline: 2px solid var(--teal-500); outline-offset: 2px; }

/* ---- inline field error ---- */
.ferr {
  margin-top: 5px; font-size: 11.5px; font-weight: 800; color: var(--coral-600);
  display: flex; align-items: center; gap: 5px;
}
.ferr::before { content: "!"; display: grid; place-items: center; flex: none;
  width: 13px; height: 13px; border-radius: 50%; background: var(--coral-500); color: #fff; font-size: 9px; font-weight: 900; }
.ferr[hidden] { display: none; }

/* ---- user form modal header ---- */
.uf-head { display: flex; align-items: center; gap: 13px; flex-wrap: wrap;
  padding: 13px 15px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line-2); }
.uf-head .spacer { flex: 1; }
.uf-ic { width: 40px; height: 40px; flex: none; border-radius: 13px; display: grid; place-items: center; color: #fff; }
.uf-ic .i { width: 19px; height: 19px; }
.uf-ic.teal { background: linear-gradient(135deg, var(--teal-500), var(--teal-700)); box-shadow: 0 3px 8px rgba(58, 156, 147, .3); }
.uf-ic.coral { background: linear-gradient(135deg, #EE7250, var(--coral-600)); box-shadow: 0 3px 8px rgba(229, 96, 59, .3); }
.uf-t { font-size: 14.5px; font-weight: 900; line-height: 1.2; }
.uf-s { font-size: 11.5px; font-weight: 700; color: var(--ink-3); margin-top: 2px; }

/* ============================ PHILHEALTH ============================ */
.ml-bar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
  padding: 15px 18px; border-bottom: 1px solid var(--line-2); background: var(--surface-2);
  border-radius: 0; }
.ml-bar .field { margin-bottom: 0; min-width: 152px; }
.ml-bar .field.grow { flex: 1; min-width: 210px; }
.ml-bar .field label { white-space: nowrap; }

.ml-sync { display: flex; align-items: flex-start; gap: 11px; padding: 13px 18px;
  border-bottom: 1px solid var(--line-2); font-size: 13px; font-weight: 700; color: var(--ink-2);
  background: linear-gradient(180deg, var(--teal-50), rgba(255, 255, 255, 0)); }
.ml-sync .i { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--philhealth-green); }
.ml-sync.ok { background: linear-gradient(180deg, var(--philhealth-green-light), rgba(255, 255, 255, 0)); color: var(--ink); }
.ml-sync .mono { font-size: 12px; }

.hint-card { position: relative; overflow: hidden; }
.hint-card .hint-ic { width: 34px; height: 34px; flex: none; border-radius: 11px; display: grid; place-items: center;
  background: var(--line-2); color: var(--ink-2); border: 1px solid var(--line); }
.hint-card .hint-ic .i { width: 17px; height: 17px; }
.hint-foot { margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--line);
  font-size: 11.5px; font-weight: 700; color: var(--ink-3); display: flex; align-items: flex-start; gap: 6px; }
.hint-foot .i { width: 13px; height: 13px; flex: none; margin-top: 2px; }

/* =========================================================================
   SLIPS — paper on the muted app background
   ========================================================================= */
.slip-stage { display: flex; justify-content: center; padding: 2px 0 30px; }

.slip {
  position: relative; width: 100%; max-width: 880px;
  background: #fff; color: #14181f;
  border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: 0 24px 60px rgba(23, 28, 38, .16), 0 3px 10px rgba(23, 28, 38, .07);
  overflow: hidden;
  font-size: 13px; font-weight: 600; line-height: 1.45;
}

/* ---- eKAS PhilHealth-green band ---- */
.slip-band {
  display: flex; align-items: center; gap: 14px; padding: 15px 22px;
  background: linear-gradient(135deg, var(--philhealth-green), var(--philhealth-green-dark) 72%, #005527);
  color: #fff;
}
.phic-mark { width: 42px; height: 42px; flex: none; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .25)); }
.slip-band .band-txt { flex: 1; min-width: 0; }
.slip-band .band-t { font-size: 16.5px; font-weight: 900; letter-spacing: -.01em; line-height: 1.15; }
.slip-band .band-s { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  color: rgba(255, 255, 255, .82); margin-top: 3px; }
.slip-band .band-no { flex: none; text-align: right; display: grid; gap: 0; }
.slip-band .band-no span { font-size: 8.5px; font-weight: 900; letter-spacing: .13em;
  color: rgba(255, 255, 255, .72); line-height: 1.5; }
.slip-band .band-no b { font-size: 12.5px; font-weight: 800; line-height: 1.25; }

.slip-sub {
  padding: 8px 22px; font-size: 11.5px; font-weight: 800; color: var(--philhealth-green-dark);
  background: var(--philhealth-green-light); border-bottom: 1px solid rgba(0, 132, 61, .22);
}
.slip-sub i { font-weight: 700; color: #4b6a58; }

.slip-body { padding: 18px 22px 22px; }

/* ---- form field grid (looks like a filled-out paper form) ---- */
.sgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 18px; margin-bottom: 18px; }
.sgrid .w2 { grid-column: span 2; }
.sgrid .w3 { grid-column: 1 / -1; }
.sf { min-width: 0; }
.sf .sfk { display: block; font-size: 8.8px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase;
  color: #7b8493; margin-bottom: 2px; }
.sf .sfv { display: block; font-size: 13px; font-weight: 700; color: #14181f;
  border-bottom: 1px solid #c6ccd6; padding: 2px 1px 4px; min-height: 22px; overflow-wrap: anywhere; }
.sf .sfv b { font-weight: 900; }

.sbox { display: inline-grid; place-items: center; width: 14px; height: 14px; margin-right: 5px;
  border: 1.4px solid #6b7482; border-radius: 3px; font-size: 10px; font-weight: 900; color: var(--philhealth-green-dark);
  vertical-align: -2px; }
.sbox.on { border-color: var(--philhealth-green); background: var(--philhealth-green-light); }
.sboxl { font-size: 11.5px; font-weight: 800; margin-right: 14px; letter-spacing: .02em; }

/* ---- slip tables ---- */
.stbl-h {
  font-size: 11px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; color: #14181f;
  padding: 6px 0 6px; margin: 16px 0 8px; border-bottom: 2px solid #14181f;
}
.stbl-h span { font-weight: 700; text-transform: none; letter-spacing: 0; color: #6b7482; font-size: 11px; }

.slip table.stbl { width: 100%; min-width: 0; border-collapse: collapse; }
.slip .stbl th {
  font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: #4c5563;
  background: #f1f3f6; border: 1px solid #ccd2db; padding: 6px 9px; text-align: left; white-space: normal;
}
.slip .stbl td {
  font-size: 12px; font-weight: 700; color: #14181f; border: 1px solid #d7dce3;
  padding: 7px 9px; vertical-align: top; white-space: normal;
}
.slip .stbl td .sub { font-size: 10.5px; font-weight: 700; color: #6b7482; margin-top: 2px; }
.slip .stbl .c { text-align: center; }
.slip .tick { color: var(--philhealth-green); font-weight: 900; }
.slip .untick { color: #9aa2ae; }
.slip .abn { color: var(--coral-700); }

.slip-fine { margin-top: 14px; font-size: 11px; font-weight: 700; color: #4c5563; line-height: 1.5; }
.slip-fine i { color: #6b7482; }

/* ---- signatures ---- */
.sig-row { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 26px; }
.sig-row.one { grid-template-columns: 1fr 1fr; }
.sig-row.one .sig:last-child { visibility: hidden; }
.sig { min-width: 0; }
/* captured member signature, sitting on the printed-name line */
.sig .sig-img { display: block; max-height: 48px; max-width: 100%; margin: 0 auto -2px; object-fit: contain; }
.sig .sig-v { font-size: 12.5px; font-weight: 900; letter-spacing: .02em; text-align: center;
  padding-bottom: 3px; min-height: 20px; }
.sig .sig-line { height: 1px; background: #14181f; }
.sig .sig-k { font-size: 9.5px; font-weight: 800; color: #6b7482; text-align: center; margin-top: 4px; line-height: 1.35; }

.slip-foot {
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-top: 22px; padding-top: 10px; border-top: 1px solid #dfe3ea;
  font-size: 9.5px; font-weight: 700; color: #7b8493;
}

/* ---- ePresS ---- */
.rx-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap;
  padding: 20px 22px 16px; border-bottom: 2px solid #14181f; }
.rx-clinic { flex: 1; min-width: 220px; }
.rx-name { font-size: 20px; font-weight: 900; letter-spacing: -.02em; line-height: 1.1; }
.rx-spec { font-size: 12px; font-weight: 800; color: var(--teal-700); text-transform: uppercase; letter-spacing: .08em; margin-top: 3px; }
.rx-lic { font-size: 11px; font-weight: 700; color: #4c5563; margin-top: 5px; }
.rx-fac { flex: none; max-width: 320px; text-align: right; font-size: 10.5px; font-weight: 700; color: #4c5563; line-height: 1.5; }
.rx-fac .b { font-size: 12.5px; color: #14181f; }

.rx-strip { padding: 6px 22px; background: var(--teal-50); border-bottom: 1px solid rgba(91, 191, 181, .4);
  font-size: 10px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--teal-700); }
.rx-strip .mono { letter-spacing: 0; }

.rx-pt { grid-template-columns: repeat(3, 1fr); }

.rx-zone { display: flex; gap: 16px; align-items: flex-start; margin-top: 6px;
  padding: 14px 0 4px; border-top: 1px solid #dfe3ea; }
.rx-glyph { flex: none; font-size: 62px; font-weight: 900; line-height: .85; color: #14181f;
  font-family: 'Times New Roman', Georgia, serif; padding: 0 6px; }
.rx-list { flex: 1; min-width: 0; }
.rx-tbl { margin-top: 2px; }
.rx-none { font-size: 12px; font-weight: 700; color: #7b8493; font-style: italic;
  border: 1px dashed #ccd2db; border-radius: 8px; padding: 12px 14px; }

.slip-note { display: flex; gap: 9px; align-items: flex-start; margin-top: 14px;
  padding: 11px 13px; border-radius: 9px; border: 1px solid rgba(0, 132, 61, .3);
  background: var(--philhealth-green-light); font-size: 11.5px; font-weight: 700; color: #17422c; line-height: 1.5; }
.slip-note .i { width: 15px; height: 15px; flex: none; margin-top: 1px; color: var(--philhealth-green); }

/* ---- Exam summary ---- */
.ex-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap;
  padding: 18px 22px 14px; border-bottom: 2px solid #14181f; }
.ex-t { font-size: 15.5px; font-weight: 900; letter-spacing: .02em; }
.ex-s { font-size: 10.5px; font-weight: 700; color: #4c5563; margin-top: 3px; }
.ex-meta { margin-left: auto; text-align: right; display: grid; gap: 2px;
  font-size: 10px; font-weight: 800; color: #6b7482; letter-spacing: .06em; text-transform: uppercase; }
.ex-meta .mono { font-size: 12px; color: #14181f; letter-spacing: 0; }

.ex-vitals { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.exv { border: 1px solid #d7dce3; border-radius: 8px; padding: 7px 9px; background: #fafbfc; }
.exv .k { display: block; font-size: 8.5px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: #7b8493; }
.exv .v { display: block; font-size: 14px; font-weight: 900; margin-top: 2px; color: #14181f; }
.exv .v i { font-size: 9.5px; font-weight: 800; font-style: normal; color: #7b8493; margin-left: 3px; }
.exv.empty-v .v { color: #b6bcc6; }

.ex-p { font-size: 12.5px; font-weight: 650; line-height: 1.6; color: #22272f; white-space: pre-wrap; }
.ex-p.tight { margin-top: 8px; }
.ex-p i.untick { font-weight: 700; }
.ex-probs { margin: 0; padding-left: 20px; font-size: 12.5px; font-weight: 700; line-height: 1.7; }
.ex-probs .icdc { display: inline-block; min-width: 52px; font-weight: 800; color: var(--teal-700); }
.ex-flags { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 9px; }

.ex-plan { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.exp { border: 1px solid #d7dce3; border-radius: 9px; padding: 9px 11px; background: #fafbfc; min-width: 0; }
.exp .k { display: block; font-size: 8.8px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: #7b8493; }
.exp .v { display: block; font-size: 16px; font-weight: 900; line-height: 1.15; margin-top: 1px; }
.exp .s { display: block; font-size: 10.5px; font-weight: 700; color: #6b7482; margin-top: 2px;
  overflow-wrap: anywhere; }

/* ---- DRAFT watermark (print only) ---- */
.slip.draft::after {
  content: attr(data-draft); display: none; position: absolute; inset: 0;
  align-items: center; justify-content: center; pointer-events: none;
  font-size: 120px; font-weight: 900; letter-spacing: .1em; color: rgba(229, 96, 59, .16);
  transform: rotate(-24deg);
}

/* slip tab labels shorten on narrow screens */
#slipSeg .lbl-sm { display: none; }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 880px) {
  .sgrid, .rx-pt { grid-template-columns: repeat(2, 1fr); }
  .ex-vitals { grid-template-columns: repeat(3, 1fr); }
  .slip-band { flex-wrap: wrap; }
  .slip-band .band-no { text-align: left; }
  .rx-fac { text-align: left; max-width: none; }
  .dd-menu { right: auto; left: 0; }
}
@media (max-width: 560px) {
  .sgrid, .rx-pt, .ex-plan { grid-template-columns: 1fr; }
  .sgrid .w2, .sgrid .w3 { grid-column: 1 / -1; }
  .ex-vitals { grid-template-columns: repeat(2, 1fr); }
  .sig-row { grid-template-columns: 1fr; gap: 22px; }
  .sig-row.one .sig:last-child { display: none; }
  .slip-body { padding: 14px 14px 18px; }
  .slip-band, .rx-head, .ex-head { padding-left: 14px; padding-right: 14px; }
  .rx-zone { gap: 8px; }
  .rx-glyph { font-size: 42px; }
  #slipSeg .lbl-lg { display: none; }
  #slipSeg .lbl-sm { display: inline; }
  .slip-band .band-t { font-size: 13px; }
  .slip-band .band-s { font-size: 9px; }
  .phic-mark { width: 32px; height: 32px; }
  .slip-band .band-no { width: 100%; display: flex; gap: 4px 12px; flex-wrap: wrap; align-items: baseline; }
  .slip-band .band-no b { font-size: 11px; }
  .slip { border-radius: var(--r-sm); }
  .ml-bar .field { min-width: 100%; }
}

/* =========================================================================
   PRINT — only the active slip, on white, without any app chrome
   ========================================================================= */
@media print {
  /* the slips view marks its own chrome .no-print; base theme hides .btn/.seg.
     These extra hides only apply on a page that actually shows a slip. */
  body:has(.slip-stage) .topbar,
  body:has(.slip-stage) .note,
  body:has(.slip-stage) .dd { display: none !important; }

  .slip-stage { display: block !important; padding: 0 !important; }
  .slip {
    max-width: none !important; width: auto !important;
    border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
    background: #fff !important; color: #000 !important;
    font-size: 10.5pt; overflow: visible !important;
  }
  .slip-body { padding: 10pt 0 0 !important; }
  .slip-band { padding: 8pt 10pt !important; border-radius: 0; }
  .slip-band .band-t { font-size: 13pt; }
  .slip-band .band-s { font-size: 7pt; }
  .slip-sub { padding: 5pt 10pt !important; font-size: 8pt; }
  .rx-head, .ex-head { padding: 0 0 8pt !important; }
  .rx-strip { padding: 4pt 0 !important; background: #fff !important; border-bottom: 1px solid #000; }

  .slip .stbl th { background: #eee !important; color: #000 !important; font-size: 7.5pt; padding: 4pt 5pt; }
  .slip .stbl td { font-size: 9pt; padding: 4pt 5pt; color: #000 !important; }
  .slip .stbl, .slip .sig-row, .exv, .exp { break-inside: avoid; page-break-inside: avoid; }
  .stbl-h { margin: 10pt 0 5pt; font-size: 8.5pt; }
  .sf .sfv { font-size: 9.5pt; color: #000 !important; }
  .sf .sfk { font-size: 6.8pt; }
  .ex-p { font-size: 9.5pt; color: #000 !important; }
  .exv, .exp { background: #fff !important; }
  .sig-row { margin-top: 20pt; }
  .sig .sig-img { max-height: 36pt; }
  .slip-foot { font-size: 7pt; }
  .rx-glyph { font-size: 46pt; }

  /* draft encounters print with a watermark */
  .slip.draft::after { display: flex !important; }
}
