/* ==========================================================================
   PORTAL PERUBAHAN PKS PLKK - BPJS KETENAGAKERJAAN
   Gaya aplikasi (form) + dokumen hukum 1:1 (Arial 11pt, tebal 12pt) + cetak.
   Semua selector mengikuti class yang dipakai index.html, app.js, dan js/*.js.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. VARIABEL & RESET
   -------------------------------------------------------------------------- */
:root {
  --bpjs-green: #00875a;
  --bpjs-green-hover: #006644;
  --bpjs-blue: #004b87;
  --bpjs-blue-hover: #003666;
  --bpjs-blue-light: #e6f0fa;
  --bg-app: #f4f6f9;
  --bg-card: #ffffff;
  --bg-subtle: #fafbfc;
  --text-primary: #172b4d;
  --text-secondary: #5e6c84;
  --border-color: #dfe1e6;
  --border-card: #c1c7d0;
  --danger: #de350b;
  --green-soft: #e3fcef;
  --font-legal: Arial, Helvetica, sans-serif;
  --header-height: 65px;
  --sidebar-width: 300px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-legal);
  font-size: 14px;
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
}

code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92em;
  background: #ebecf0;
  padding: 1px 5px;
  border-radius: 3px;
}

.hidden {
  display: none !important;
}

:focus-visible {
  outline: 3px solid rgba(0, 75, 135, 0.45);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   2. HEADER
   -------------------------------------------------------------------------- */
.app-header {
  background-color: #ffffff;
  height: var(--header-height);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border-bottom: 2px solid var(--bpjs-green);
  display: flex;
  align-items: center;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.nav-logo-box {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.nav-logo-img {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.logo-group .divider {
  color: var(--border-card);
  font-size: 24px;
  line-height: 1;
}

.title-block {
  min-width: 0;
}

.app-title-main {
  font-size: 15px;
  font-weight: bold;
  color: var(--text-primary);
  line-height: 1.2;
}

.app-subtitle-branch {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: #ebecf0;
  padding: 5px 6px 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: #344563;
}

.user-avatar-icon {
  font-size: 14px;
  line-height: 1;
}

.user-email-text {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout-pill {
  background: #ffffff;
  border: 1px solid #ffbdad;
  color: var(--danger);
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
}

.btn-logout-pill:hover {
  background: #ffebe6;
}

.btn-switch-pill {
  background: #ffffff;
  border: 1px solid var(--border-card);
  color: var(--bpjs-blue);
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.btn-switch-pill:hover {
  background: var(--bpjs-blue-light);
}

.user-avatar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  overflow: hidden;
  background: #dfe1e6;
  font-weight: bold;
  color: var(--bpjs-blue);
}

.user-avatar-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --------------------------------------------------------------------------
   HALAMAN LOGIN (js/auth.js): aplikasi disembunyikan sampai login berhasil
   -------------------------------------------------------------------------- */
body.auth-locked .app-header,
body.auth-locked .main-layout,
body.auth-locked .modal-overlay {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    linear-gradient(160deg, rgba(0, 135, 90, 0.10), rgba(0, 75, 135, 0.12)),
    var(--bg-app);
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-top: 4px solid var(--bpjs-green);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(9, 30, 66, 0.12);
  padding: 32px 28px 28px;
  text-align: center;
}

.login-logo {
  height: 48px;
  width: auto;
  margin-bottom: 18px;
}

.login-title {
  font-size: 21px;
  line-height: 1.3;
  color: var(--bpjs-blue);
  margin-bottom: 10px;
}

.login-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 22px;
}

.login-google-btn {
  display: flex;
  justify-content: center;
  min-height: 44px;
  margin-bottom: 16px;
}

.login-error {
  background: #ffebe6;
  border: 1px solid #ffbdad;
  color: #bf2600;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 14px;
  text-align: left;
}

.login-help {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.login-notice {
  margin-top: 18px;
  background: #fffae6;
  border: 1px solid #ffe380;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
}

.login-dev {
  margin-top: 14px;
  text-align: left;
}

.login-dev label {
  display: block;
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 6px;
}

.login-dev-row {
  display: flex;
  gap: 8px;
}

.login-dev-row .form-control {
  min-width: 0;
}

.login-dev-row .btn {
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   3. TOMBOL
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: bold;
  line-height: 1.2;
  border-radius: 6px;
  border: 1px solid transparent;
  background: #ffffff;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-primary {
  background-color: var(--bpjs-blue);
  border-color: var(--bpjs-blue);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--bpjs-blue-hover);
  border-color: var(--bpjs-blue-hover);
}

.btn-success,
.btn-new-draft {
  background-color: var(--bpjs-green);
  border-color: var(--bpjs-green);
  color: #ffffff;
}

.btn-success:hover,
.btn-new-draft:hover {
  background-color: var(--bpjs-green-hover);
  border-color: var(--bpjs-green-hover);
}

.btn-outline,
.btn-history {
  background-color: #ffffff;
  border-color: var(--border-card);
  color: var(--text-primary);
}

.btn-outline:hover,
.btn-history:hover {
  background-color: #f4f5f7;
}

.btn-outline-primary {
  background-color: #ffffff;
  border-color: var(--bpjs-blue);
  color: var(--bpjs-blue);
}

.btn-outline-primary:hover {
  background-color: var(--bpjs-blue-light);
}

/* --------------------------------------------------------------------------
   4. LAYOUT UTAMA: SIDEBAR STATIS + KONTEN SCROLL MANDIRI
   -------------------------------------------------------------------------- */
.main-layout {
  display: flex;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
  width: 100%;
}

.sidebar-nav {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background-color: #ffffff;
  border-right: 1px solid var(--border-color);
  height: 100%;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-header-box {
  padding: 18px 20px 6px;
}

.nav-title {
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.nav-title-separator {
  width: 36px;
  height: 3px;
  background: var(--bpjs-green);
  border-radius: 2px;
  margin-top: 8px;
}

.nav-tabs {
  list-style: none;
  padding: 12px 16px;
  overflow-y: auto;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tab-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background-color: #ffffff;
  border: 1.5px solid var(--border-card);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 2px rgba(9, 30, 66, 0.04);
}

.tab-item:hover {
  border-color: var(--bpjs-blue);
  background-color: #f7f9fc;
}

.tab-item.active {
  background-color: var(--bpjs-blue-light);
  border-color: var(--bpjs-blue);
  box-shadow: 0 0 0 1px var(--bpjs-blue), 0 2px 6px rgba(0, 75, 135, 0.12);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  background-color: #ebecf0;
  color: #42526e;
  font-weight: bold;
  font-size: 12px;
}

.tab-item.active .step-num {
  background-color: var(--bpjs-blue);
  color: #ffffff;
}

.tab-label {
  font-size: 13.5px;
  font-weight: bold;
  color: var(--text-primary);
  line-height: 1.25;
}

.tab-item.active .tab-label {
  color: var(--bpjs-blue);
}

/* Judul kelompok di sidebar: Draf PKS / Lampiran Draf PKS / Dokumen */
.nav-group-label {
  font-size: 10.5px;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 8px 2px 0;
}

.nav-group-label:first-child {
  padding-top: 0;
}

/* Item lampiran lebih ringkas supaya 8 lampiran muat di sidebar */
.tab-item.tab-lamp {
  padding: 8px 12px;
}

.tab-item.tab-lamp .tab-label {
  font-size: 12.5px;
}

.step-num.step-roman {
  width: auto;
  min-width: 34px;
  padding: 0 6px;
  border-radius: 13px;
  font-size: 11px;
}

.quick-actions {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-subtle);
  display: grid;
  gap: 8px;
}

.content-area {
  flex-grow: 1;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  padding: 24px 32px 60px;
  background-color: var(--bg-app);
}

.tab-pane {
  display: none;
  max-width: 1100px;
  margin: 0 auto;
}

.tab-pane.active {
  display: block;
  animation: fadeInPane 0.2s ease-in-out;
}

@keyframes fadeInPane {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .tab-pane.active { animation: none; }
  * { transition: none !important; }
}

/* --------------------------------------------------------------------------
   5. KARTU, GRID FORM, FIELD
   -------------------------------------------------------------------------- */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 24px;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
  font-size: 18px;
  font-weight: bold;
  color: var(--bpjs-blue);
  line-height: 1.3;
}

.card-header p {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

.card-header.flex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.search-filter-box {
  width: 280px;
  max-width: 100%;
}

.card-body {
  padding: 22px 24px;
}

/* Grid 12 kolom: .col-12 / .col-6 / .col-4; .col-m-12 = satu kolom di layar sedang/kecil */
.form-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px 20px;
}

.col-12 { grid-column: span 12; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-label,
.form-group > label {
  font-size: 13px;
  font-weight: bold;
  color: var(--text-primary);
}

.form-label strong {
  font-size: inherit;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-card);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background-color: #ffffff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--bpjs-blue);
  box-shadow: 0 0 0 3px rgba(0, 75, 135, 0.18);
}

.form-control::placeholder {
  color: #7a869a;
  font-style: italic;
}

.form-control[readonly] {
  background-color: #f4f5f7;
  color: var(--text-secondary);
}

.form-control-sm {
  padding: 7px 10px;
  font-size: 13px;
}

.helper-text {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.input-addon {
  display: flex;
}

.input-addon .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  min-width: 0;
}

.input-addon > span {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  background: #f4f5f7;
  border: 1px solid var(--border-card);
  border-left: none;
  border-radius: 0 6px 6px 0;
  font-weight: bold;
  color: var(--text-secondary);
}

.form-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.form-divider span {
  font-size: 11.5px;
  font-weight: bold;
  letter-spacing: 0.06em;
  color: var(--bpjs-green-hover);
}

.form-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border-color);
}

.sub-card {
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sub-card h4 {
  font-size: 14px;
  color: var(--bpjs-blue);
}

/* --------------------------------------------------------------------------
   6. LOGO COVER (TAB IDENTITAS)
   -------------------------------------------------------------------------- */
.logo-manager-box {
  gap: 10px;
}

.logo-side-by-side-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.logo-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-subtle);
}

.logo-card-title {
  font-size: 12.5px;
  font-weight: bold;
}

.logo-box-slot {
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #b3d4ff;
  background: #f8fbff;
  border-radius: 6px;
  padding: 8px;
  text-align: center;
}

.logo-box-slot img {
  max-height: 76px;
  max-width: 100%;
  object-fit: contain;
}

.prompt-text {
  font-size: 12px;
  color: var(--text-secondary);
}

.static-logo-badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: bold;
  color: var(--bpjs-green-hover);
  background: var(--green-soft);
  padding: 3px 8px;
  border-radius: 10px;
}

input[type="file"] {
  font-family: inherit;
  font-size: 12.5px;
  max-width: 100%;
}

/* --------------------------------------------------------------------------
   7. HALAMAN LAMPIRAN I - VIII (TEKS DRAF)
   Isi .lamp-doc dihasilkan tools/build-lampiran.ps1: .dp = paragraf, .dl/.dn/.dt =
   paragraf bernomor (label + teks), .tb = tab, .dtbl = tabel draf. Gaya yang sering
   berulang di draf ada di LAMPIRAN_DRAFT_CSS ([data-s]).
   -------------------------------------------------------------------------- */
.lamp-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.lamp-eyebrow {
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bpjs-green-hover);
}

.lamp-header h2 {
  font-size: 20px;
  color: var(--bpjs-blue);
  line-height: 1.3;
}

.lamp-source {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.lamp-header .lamp-source {
  margin-bottom: 0;
}

.lamp-note {
  background: var(--bpjs-blue-light);
  border-left: 4px solid var(--bpjs-blue);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 14px;
}

.lamp-doc {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: 32px 40px;
  margin-bottom: 24px;
  font-family: var(--font-legal);
  font-size: 11pt;
  line-height: 1.4;
  color: #000000;
  overflow-wrap: break-word;
}

.lamp-doc .dp {
  margin: 0;
  min-height: 1.4em;
}

.lamp-doc .dl {
  display: flex;
  align-items: baseline;
}

.lamp-doc .dn {
  flex: 0 0 auto;
  padding-right: 4pt;
}

.lamp-doc .dt {
  flex: 1 1 auto;
  min-width: 0;
}

.lamp-doc .tb {
  display: inline-block;
  width: 2.2em;
}

.lamp-doc .lamp-pb {
  display: block;
  border-top: 1px dashed var(--border-card);
  margin: 20px 0;
}

.lamp-doc a {
  color: var(--bpjs-blue);
}

.lamp-doc img {
  max-width: 100%;
  height: auto;
}

.lamp-doc .dtbl-wrap {
  overflow-x: auto;
  margin: 2pt 0;
}

.lamp-doc table.dtbl {
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 520px;
}

.lamp-doc table.dtbl td {
  padding: 2pt 5pt;
  vertical-align: top;
}

.lamp-doc .row-homecare td {
  background-color: #fffbea;
}

/* --------------------------------------------------------------------------
   8. UNDUH TEMPLAT & UNGGAH LAMPIRAN (kartu di atas teks tiap lampiran)
   -------------------------------------------------------------------------- */
.lamp-upload-card {
  padding: 16px;
  margin-bottom: 14px;
}

.lamp-upload-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.lamp-upload-step {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.lamp-upload-step + .lamp-upload-step {
  border-left: 1px solid var(--border-color);
  padding-left: 16px;
}

.lamp-upload-title {
  font-size: 14px;
  font-weight: bold;
  color: var(--bpjs-blue);
}

.lamp-upload-step p {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.lamp-upload-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: auto;
}

.lamp-upload-actions input[type="file"] {
  font-size: 12.5px;
  max-width: 100%;
}

.lamp-upload-status {
  font-size: 12px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.lamp-upload-card.has-upload .lamp-upload-status {
  background: var(--green-soft);
  color: var(--bpjs-green-hover);
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 4px;
}

@media (max-width: 700px) {
  .lamp-upload-steps {
    grid-template-columns: minmax(0, 1fr);
  }

  .lamp-upload-step + .lamp-upload-step {
    border-left: none;
    border-top: 1px solid var(--border-color);
    padding-left: 0;
    padding-top: 14px;
  }
}

/* --------------------------------------------------------------------------
   9. PEMBACA PASAL (TAB 2) & TEKS PASAL
   -------------------------------------------------------------------------- */
.pasal-reader-scrollbox {
  max-height: 68vh;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 20px 24px;
  background: #ffffff;
  font-size: 11pt;
  line-height: 1.5;
}

.pasal-reader-scrollbox .pasal-block {
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border-color);
}

.pasal-reader-scrollbox .pasal-block:last-child {
  border-bottom: none;
}

.pasal-block {
  margin-bottom: 18px;
}

.pasal-heading,
.pasal-title {
  text-align: center;
  font-weight: bold;
  break-after: avoid;
  page-break-after: avoid;
}

.pasal-heading {
  font-size: 12pt;
}

.pasal-title {
  font-size: 12pt;
  margin-bottom: 8px;
}


/* Pembukaan dan Pasal 1-30: teks draf (.dp/.dl dari tools/build-lampiran.ps1) tanpa bingkai kartu lampiran */
.lamp-doc.pasal-draft,
.lamp-doc.cover-draft {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin: 0 0 8px;
  font-family: inherit;
  font-size: inherit;
}

.lamp-doc.pasal-draft .dp {
  margin-bottom: 4px;
}
/* Tabel komparisi cover: kolom label "I." / "II." sangat sempit di draf, jadi padding sel kecil
   dan label tidak boleh dipotong per huruf */
.lamp-doc.cover-draft table.dtbl td {
  padding-left: 1pt;
  padding-right: 1pt;
  overflow-wrap: normal;
}

/* Cover: logo RS yang diunggah di kiri, logo BPJS Ketenagakerjaan dari draf di kanan */
.lamp-doc .cover-logo-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

/* --------------------------------------------------------------------------
   10. PRATINJAU DOKUMEN: TOOLBAR + KERTAS A4
   -------------------------------------------------------------------------- */
.preview-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(9, 30, 66, 0.08);
}

.toolbar-title {
  font-size: 15px;
  font-weight: bold;
  color: var(--bpjs-blue);
}

.toolbar-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.paper-container {
  overflow-x: auto;
  padding: 4px 0 40px;
}

.page-sheet {
  background-color: #ffffff;
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto 24px;
  padding: 20mm 20mm 20mm 25mm;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  font-family: var(--font-legal);
  font-size: 11pt;
  line-height: 1.35;
  color: #000000;
}

/* Standar dokumen: teks 11pt, huruf tebal & judul 12pt */
.page-sheet strong,
.page-sheet b,
.page-sheet h3,
.page-sheet h4,
.page-sheet th {
  font-size: 12pt;
  font-weight: bold;
}

/* Hilangkan semua warna stabilo dan label warna draf di pratinjau dan cetak */
#tab-preview .lamp-doc [data-s="15"],
.lamp-print [data-s="15"],
#tab-preview [data-s="15"] {
  background: transparent !important;
}

#tab-preview .lamp-doc [data-s="19"],
.lamp-print [data-s="19"],
#tab-preview [data-s="19"] {
  color: inherit !important;
}

#tab-preview [style*="background:#ffff00"],
#tab-preview [style*="background: #ffff00"],
#tab-preview [style*="background:#ff9900"],
#tab-preview [style*="background: #ff9900"],
#tab-preview [style*="background:#00ff00"],
#tab-preview [style*="background: #00ff00"],
#tab-preview [style*="color:#0000ff"],
#tab-preview [style*="color: #0000ff"],
.lamp-print [style*="background:#ffff00"],
.lamp-print [style*="background: #ffff00"],
.lamp-print [style*="background:#ff9900"],
.lamp-print [style*="background: #ff9900"],
.lamp-print [style*="background:#00ff00"],
.lamp-print [style*="background: #00ff00"],
.lamp-print [style*="color:#0000ff"],
.lamp-print [style*="color: #0000ff"] {
  background: transparent !important;
  color: inherit !important;
}

/* Lampiran draf di pratinjau cetak: tanpa bingkai kartu, isian tanpa tanda aplikasi */
.page-sheet .lamp-doc.lamp-print {
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

.lamp-print .row-homecare td {
  background-color: transparent;
}

.lamp-print .dtbl-wrap {
  overflow: visible;
}

.annex-editor {
  margin-top: 16px;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}
.annex-editor summary { cursor: pointer; font-weight: 600; }
.annex-editor-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(140px, 1fr);
  gap: 6px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}
.annex-editor-label { grid-column: 1 / -1; font-weight: 600; overflow-wrap: anywhere; }
.annex-editor-row label { align-self: center; }
.lamp-doc .lamp-ttd { break-inside: avoid; margin-top: 18pt; }
.lamp-doc [data-annex-field] { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .annex-editor-row { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   11. MODAL RIWAYAT & ARSIP
   -------------------------------------------------------------------------- */
.modal-overlay {
  display: flex;
  position: fixed;
  inset: 0;
  background-color: rgba(9, 30, 66, 0.54);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}

.modal-card {
  background-color: #ffffff;
  border-radius: 10px;
  width: 100%;
  max-width: 960px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 32px rgba(9, 30, 66, 0.25);
  overflow: hidden;
}

.modal-header {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-subtle);
}

.modal-title-with-icon {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-title-icon {
  font-size: 20px;
}

.modal-header h3 {
  font-size: 16px;
  color: var(--bpjs-blue);
}

.modal-close {
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 2px 10px;
  border-radius: 6px;
}

.modal-close:hover {
  background: #ebecf0;
  color: var(--text-primary);
}

.modal-body {
  padding: 18px 24px 22px;
  overflow-y: auto;
  flex-grow: 1;
}

.history-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.history-search-wrapper {
  position: relative;
  flex: 1 1 220px;
  min-width: 0;
}

.history-search-wrapper .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  pointer-events: none;
}

.history-search-input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border-card);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13.5px;
}

.history-search-input:focus {
  outline: none;
  border-color: var(--bpjs-blue);
  box-shadow: 0 0 0 3px rgba(0, 75, 135, 0.18);
}

.history-btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-cloud-sync,
.btn-history-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  background: #ffffff;
  border: 1px solid var(--border-card);
  color: var(--text-primary);
}

.btn-cloud-sync {
  border-color: var(--bpjs-blue);
  color: var(--bpjs-blue);
}

.btn-cloud-sync:hover {
  background: var(--bpjs-blue-light);
}

.btn-history-tool:hover {
  background: #f4f5f7;
}

.history-table-responsive {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.history-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 13px;
}

.history-table th {
  background: #f4f5f7;
  text-align: left;
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 2px solid var(--border-card);
}

.history-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.history-table tbody tr:hover {
  background: #fafbfc;
}

.faskes-name-bold {
  font-weight: bold;
}

.branch-name-sub,
.datetime-time {
  font-size: 12px;
  color: var(--text-secondary);
}

.status-badge-green {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: bold;
  background: var(--green-soft);
  color: var(--bpjs-green-hover);
}

.action-btn-group {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.btn-action-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}

.btn-action-icon:hover {
  background: #ebecf0;
}

.btn-word {
  color: var(--bpjs-blue);
}

.btn-delete {
  border-color: #ffbdad;
}

.btn-delete:hover {
  background: #ffebe6;
}

.history-empty {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   12. RESPONSIF
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .app-subtitle-branch { max-width: 260px; }
  .user-email-text { max-width: 140px; }
}

@media (max-width: 900px) {
  .app-header {
    position: static;
    height: auto;
    padding: 10px 14px;
  }

  .header-container {
    flex-wrap: wrap;
    gap: 10px;
  }

  .header-right {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Halaman scroll biasa; sidebar jadi strip tab horizontal di atas konten */
  .main-layout {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .sidebar-nav {
    width: 100%;
    min-width: 0;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    overflow: visible;
  }

  .sidebar-header-box { padding: 12px 14px 0; }

  .nav-tabs {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 14px;
    gap: 8px;
  }

  .tab-item {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .nav-group-label {
    flex: 0 0 auto;
    align-self: center;
    padding: 0 2px 0 8px;
    border-left: 1px solid var(--border-color);
  }

  .nav-group-label:first-child {
    border-left: none;
    padding-left: 0;
  }

  .lamp-doc {
    padding: 18px 14px;
  }

  .quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px 14px 14px;
  }

  .content-area {
    height: auto;
    overflow: visible;
    padding: 16px 14px 40px;
  }

  .col-6,
  .col-4,
  .col-m-12 {
    grid-column: span 12;
  }

  .logo-side-by-side-preview {
    grid-template-columns: 1fr;
  }

  .card-header,
  .card-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .preview-toolbar {
    position: static;
  }
}

@media (max-width: 560px) {
  .user-email-text,
  .logo-group .divider {
    display: none;
  }

  .nav-logo-img { height: 32px; }

  .quick-actions { grid-template-columns: 1fr; }

  .modal-header,
  .modal-body {
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* --------------------------------------------------------------------------
   13. CETAK (PDF 1:1)
   -------------------------------------------------------------------------- */
@media print {
  @page {
    size: A4 portrait;
    margin: 20mm 20mm 20mm 25mm;
  }

  html,
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  .app-header,
  .sidebar-nav,
  .modal-overlay,
  .preview-toolbar,
  .quick-actions,
  .no-print {
    display: none !important;
  }

  .main-layout {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }

  .content-area {
    padding: 0 !important;
    height: auto !important;
    overflow: visible !important;
    background: transparent !important;
  }

  .tab-pane {
    display: none !important;
  }

  .tab-pane#tab-preview {
    display: block !important;
    max-width: none !important;
    margin: 0 !important;
    animation: none !important;
  }

  .paper-container {
    overflow: visible !important;
    padding: 0 !important;
  }

  .page-sheet {
    width: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
  }

  .page-sheet.page-break {
    break-before: page;
    page-break-before: always;
  }

  /* Warna latar draf (header tabel abu-abu, stabilo placeholder) ikut tercetak */
  .lamp-print td,
  .lamp-print span {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .lamp-print tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .lamp-print thead {
    display: table-header-group;
  }

  .lamp-print .lamp-pb {
    border: none;
    margin: 0;
    break-after: page;
    page-break-after: always;
  }

}

/* Input terkunci & badge readonly */
.input-locked {
  background-color: #f1f3f5 !important;
  color: #495057 !important;
  cursor: not-allowed !important;
  border-color: #ced4da !important;
}

.badge-locked {
  font-size: 8pt;
  font-weight: 600;
  color: #6c757d;
  background: #e9ecef;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  display: inline-block;
  vertical-align: middle;
}

/* Lampiran VIII Administrasi Surat Menyurat Table */
#lampiranDoc_VIII table.dtbl {
  width: 100% !important;
}

#lampiranDoc_VIII table.dtbl td {
  word-break: break-word;
  overflow-wrap: break-word;
  padding: 6pt 8pt !important;
  vertical-align: top;
}

#lampiranDoc_VIII .dp[data-s="32"] {
  margin-left: 0 !important;
  text-indent: 0 !important;
}
