/* Pelengkap Bootstrap 5.3 — tema, tata letak, dan komponen yang tidak tersedia sebagai kelas utilitas */
:root {
  --brand: #1565c0;
  --brand-tua: #0d47a1;
  --brand-muda: #e8f1fd;
  --latar: #f3f5f9;
  --garis: #e3e7ee;
  --teks-redup: #6b7280;
  --radius: .6rem;
  --bayang: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}
body { font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; color: #1f2937; background: var(--latar); }
.lh-sm { line-height: 1.25; }
.bg-latar { background: var(--latar); }
.card { border: 1px solid var(--garis); border-radius: var(--radius); box-shadow: var(--bayang); }
.card-header:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.btn { border-radius: .45rem; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-tua); border-color: var(--brand-tua); }
.text-brand { color: var(--brand) !important; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.btn:hover, .nav-link:hover, .dropdown-item:hover, .list-group-item:hover, .stat-card:hover, .chip:hover, .form-btn:hover, .nav-bagian a:hover { text-decoration: none; }
.form-control:focus, .form-select:focus { border-color: #7aa7e8; box-shadow: 0 0 0 .2rem rgba(21, 101, 192, .18); }
.bi { vertical-align: -.125em; }
[hidden] { display: none !important; } /* kalahkan kelas d-*-block bila elemen disembunyikan lewat atribut hidden */

/* Sidebar */
.sidebar { background: linear-gradient(180deg, var(--brand-tua), var(--brand)); }
@media (min-width: 768px) { .sidebar { width: 240px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; } }
.sidebar .logo { width: 40px; height: 40px; border-radius: .6rem; background: #fff; color: var(--brand-tua); display: flex; align-items: center; justify-content: center; font-weight: 800; }
.sidebar .border-light-50 { border-color: rgba(255, 255, 255, .2) !important; }
.sidebar .nav-link { border-radius: .5rem; padding: .55rem .8rem; }
.sidebar .nav-link .bi { width: 1.4rem; display: inline-block; }
.sidebar .nav-link.active { background: #fff; color: var(--brand-tua); font-weight: 600; }
.sidebar .nav-link.text-white:hover { background: rgba(255, 255, 255, .12); }
.topbar { position: sticky; top: 0; z-index: 1010; }

/* Menu awal */
.welcome { background: linear-gradient(120deg, var(--brand-tua), #42a5f5); border-radius: var(--radius); }
.stat-card { display: block; color: inherit; text-decoration: none; transition: transform .15s, box-shadow .15s; }
.stat-card:hover { text-decoration: none; color: inherit; transform: translateY(-2px); box-shadow: 0 .5rem 1rem rgba(16, 24, 40, .1); }
.stat-ikon { width: 42px; height: 42px; border-radius: .6rem; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; flex-shrink: 0; }
.langkah { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-muda); color: var(--brand); font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Daftar pasien */
.chip { text-decoration: none; display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--garis); background: #fff; color: #374151; font-size: .85rem; }
.chip:hover { text-decoration: none; border-color: #9fbbe3; color: var(--brand); }
.chip.aktif { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .jumlah { font-weight: 600; opacity: .85; }
.tabel-pasien td { vertical-align: middle; }
.tabel-pasien tbody tr { cursor: pointer; }
.tabel-pasien tbody tr:hover { background: var(--brand-muda); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.avatar-L { background: #e0ecff; color: #1d4ed8; }
.avatar-P { background: #fde7f1; color: #be185d; }
.form-btn { border-radius: .5rem; white-space: normal; }
.form-btn.terisi { border-color: #28a745; background: #f0fbf3; }
a.form-btn:hover, a.form-btn:focus { background: var(--brand-muda); border-color: var(--brand); color: inherit; }
a.form-btn.terisi:hover { background: #e3f6e9; }

/* Halaman formulir */
.appbar { position: sticky; top: 0; z-index: 1020; background: #fff; border-bottom: 1px solid var(--garis); box-shadow: var(--bayang); }
.appbar .judul-form { max-width: 42vw; }
.status-simpan { font-size: .8rem; padding: .25rem .6rem; border-radius: 999px; white-space: nowrap; }
.status-simpan.bersih { background: #e9f7ef; color: #1e7e34; }
.status-simpan.kotor { background: #fff4e5; color: #b45309; }
.status-simpan.baru { background: #eef2f7; color: #4b5563; }
.form-layout { display: block; }
@media (min-width: 1200px) {
  .form-layout { display: grid; grid-template-columns: 230px minmax(0, 960px); gap: 1.25rem; justify-content: center; align-items: start; padding: 0 1rem; }
}
.nav-bagian { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; }
.nav-bagian a { text-decoration: none; display: block; padding: .35rem .6rem; border-left: 3px solid transparent; color: #4b5563; font-size: .8rem; line-height: 1.3; border-radius: 0 .35rem .35rem 0; }
.nav-bagian a:hover { background: #fff; color: var(--brand); text-decoration: none; }
.nav-bagian a.aktif { border-left-color: var(--brand); background: #fff; color: var(--brand); font-weight: 600; }
.sheet { max-width: 960px; border-radius: var(--radius); }
.kop { border-bottom-width: 3px !important; border-bottom-style: double !important; }
.judul-form-kertas { background: #1f2937; color: #fff; border-radius: .35rem; letter-spacing: .02em; }
.identitas { background: #fafbfd; }
.label-identitas { width: 130px; flex-shrink: 0; }
.judul-bagian { background: var(--brand-muda); color: var(--brand-tua); border-left: 4px solid var(--brand); border-radius: .35rem; padding: .45rem .75rem; margin: 1.5rem 0 .75rem; font-size: .85rem; font-weight: 700; letter-spacing: .02em; scroll-margin-top: 80px; }
.form-isi legend, .form-erm legend { scroll-margin-top: 80px; }
/* BS5 membuat legend float & lebar penuh; kembalikan legend di garis bingkai fieldset */
fieldset.border > legend { float: none; width: auto; margin-bottom: 0; font-size: inherit; }
.form-erm .h6, .form-erm legend.h6 { font-size: .95rem; }
.select2-container--bootstrap-5 .select2-selection { min-height: calc(1.5em + .5rem + 2px); }
.form-erm .border-bottom.py-1 { border-color: #eef0f4 !important; }
.form-erm .form-check-label { cursor: pointer; }
.form-erm .form-check { padding-top: .1rem; padding-bottom: .1rem; }
.crit .col-no { width: 40px; }
.crit .col-kriteria { width: 230px; }
.yt td:nth-child(n+2), .yt th:nth-child(n+2) { width: 70px; }
.ttd-row .ttd { width: 320px; margin-left: 1.5rem; }
.ket-inline { width: 200px; }
.kode-icd { width: 180px; }
.mutasi td { min-width: 150px; }
.ttd-pad { border-style: dashed !important; }
.ttd-pad canvas { display: block; width: 100%; height: 110px; touch-action: none; cursor: crosshair; }
.ttd-pad .ttd-hapus { top: 0; right: 0; }
.ttd-pad.penanda { border-style: solid !important; }
.ttd-pad.penanda canvas { position: absolute; top: 0; left: 0; height: 100%; }
.penanda img { max-height: 340px; object-fit: contain; }
fieldset[disabled] .ttd-pad canvas { cursor: default; }
.grid-waktu .grid-param { min-width: 220px; }
.grid-waktu td { min-width: 120px; }
.grid-waktu thead th { position: sticky; top: 0; }
.grid-ews td.ews-1 { background: #cfe8fc; }
.grid-ews td.ews-2 { background: #ffd8a8; }
.grid-ews td.ews-3 { background: #ffb3b3; }
.grid-ews td[class*="ews-"] .form-control, .grid-ews td[class*="ews-"] .form-select { background-color: transparent; }
.ews-baris-1 { background: #cfe8fc; }
.ews-baris-2 { background: #ffd8a8; }
.ews-baris-3 { background: #ffb3b3; }
.akhir-form { border-top: 1px solid var(--garis); }
.ke-atas { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 1030; width: 44px; height: 44px; border-radius: 50%; display: none; box-shadow: 0 .25rem .75rem rgba(16, 24, 40, .2); }

@media (max-width: 767.98px) {
  .crit .col-kriteria { width: 140px; }
  .ttd-row .ttd { width: 100%; margin-left: 0; }
  .appbar .judul-form { max-width: 60vw; }
}

@page { size: A4; margin: 10mm; }
@media print {
  body { background: #fff !important; font-size: 11px; }
  .appbar, .nav-bagian, .ke-atas, .akhir-form { display: none !important; }
  .form-layout { display: block !important; padding: 0 !important; }
  .sheet { box-shadow: none !important; margin: 0 !important; max-width: none; padding: 0 !important; border: 0 !important; }
  .table-responsive { overflow: visible !important; }
  .grid-waktu td { min-width: 0; }
  .grid-waktu .grid-param { min-width: 140px; }
  .judul-bagian { background: #eee !important; color: #000 !important; border-left-color: #000 !important; }
  textarea.form-control { resize: none; overflow: hidden; }
  .alert-warning, .modal { display: none !important; }
  .form-control { border: 0; border-bottom: 1px dotted #000; border-radius: 0; }
  .select2-selection { border: 0 !important; }
  .select2-selection__arrow, .select2-selection__clear { display: none; }
  .crit, .yt, fieldset { break-inside: avoid; }
  .ttd-pad { border-style: solid !important; }
}
.font-weight-600 { font-weight: 600; }
