:root {
  --green: #2f6b3a;
  --green-d: #1f4d28;
  --green-l: #e7f0e4;
  --bg: #f4f7f1;
  --card: #ffffff;
  --text: #1d2a1f;
  --muted: #5f6f61;
  --border: #d9e3d5;
  --danger: #b3261e;
  --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--green); }
button, input, select, textarea { font: inherit; }

.topbar { background: var(--green); color: #fff; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 10; }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.topbar .brand span small { display: block; font-weight: 400; opacity: .85; font-size: 12px; }
.topbar .user { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.logo { width: 38px; height: 38px; border-radius: 50%; background: #fff; color: var(--green); display: grid; place-items: center; font-weight: 800; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { color: var(--green-d); margin: 0 0 4px; font-size: 26px; }
.sub { color: var(--muted); margin: 0 0 24px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: 0 2px 8px rgba(0,0,0,.04); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 10px; padding: 10px 16px; cursor: pointer; font-weight: 600; background: var(--green); color: #fff; text-decoration: none; }
.btn:hover { background: var(--green-d); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.outline { background: transparent; color: var(--green); border-color: var(--green); }
.btn.outline:hover { background: var(--green-l); }
.btn.light { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.4); }
.btn.block { width: 100%; }

label { display: block; font-size: 14px; font-weight: 600; margin: 0 0 4px; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: 0; border-color: var(--green); }
.field { margin-bottom: 14px; }
.alert { padding: 10px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }
.alert.err { background: #fdecea; color: var(--danger); }
.alert.info { background: #fff6d6; color: #6b5300; }

/* Login */
.login-wrap { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 24px; align-items: start; }
.login-head { text-align: center; margin-bottom: 18px; }
.login-head .logo { width: 56px; height: 56px; margin: 0 auto 10px; background: var(--green-l); font-size: 22px; }
.steps { padding-left: 20px; margin: 0; }
.steps li { margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { background: var(--green-l); color: var(--green-d); border-radius: 999px; padding: 4px 12px; font-size: 13px; }

/* Halaman login: pas satu layar, tanpa scroll atas-bawah.
   Ukuran & jarak memakai clamp() berbasis tinggi layar (vh) agar tetap muat. */
.login-page { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
.login-page .topbar { position: static; flex: none; padding-top: clamp(6px, 1.4vh, 12px); padding-bottom: clamp(6px, 1.4vh, 12px); }
.login-page main.container { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; justify-content: center; padding: clamp(8px, 2.2vh, 24px) 16px; overflow-y: auto; scrollbar-width: none; }
.login-page main.container::-webkit-scrollbar { display: none; }
.login-page h1 { font-size: clamp(19px, 3.2vh, 26px); }
.login-page .sub { margin-bottom: clamp(8px, 2vh, 20px); }
.login-page .login-wrap { align-items: stretch; }
.login-page .card { padding: clamp(12px, 2.4vh, 22px) 22px; }
.login-page .login-head { margin-bottom: clamp(8px, 1.6vh, 16px); }
.login-page .login-head .logo { width: clamp(36px, 6vh, 56px); height: clamp(36px, 6vh, 56px); margin-bottom: clamp(4px, 1vh, 10px); }
.login-page .login-head h2 { font-size: clamp(18px, 2.8vh, 22px); }
.login-page .tabs { margin-bottom: clamp(8px, 1.6vh, 16px); }
.login-page .field { margin-bottom: clamp(8px, 1.5vh, 14px); }
.login-page input { padding-top: clamp(7px, 1.2vh, 10px); padding-bottom: clamp(7px, 1.2vh, 10px); }
.login-page .btn { padding-top: clamp(8px, 1.3vh, 10px); padding-bottom: clamp(8px, 1.3vh, 10px); }
.login-page .rfid-panel { padding: clamp(10px, 2.4vh, 26px) 16px; margin-bottom: clamp(8px, 1.4vh, 14px); }
.login-page .rfid-icon { width: clamp(60px, 10vh, 92px); height: clamp(60px, 10vh, 92px); margin-bottom: 2px; }
.login-page .rfid-icon svg { width: 66%; height: 66%; }
.login-page .divider { margin: clamp(8px, 1.6vh, 18px) 0 clamp(6px, 1.2vh, 12px); }
.login-page .alert { margin-bottom: clamp(8px, 1.4vh, 14px); padding-top: 8px; padding-bottom: 8px; }
.login-page .steps li { margin-bottom: clamp(2px, .6vh, 6px); }
.login-page .info-card h3 { margin-bottom: clamp(6px, 1.2vh, 12px); }
.login-note { font-size: 13px; color: var(--muted); margin: clamp(6px, 1.2vh, 12px) 0 0; }
.login-page .side-foot { display: none; }
.login-page .chip { font-size: 12px; padding: 3px 10px; }
.login-page .chips { gap: 6px; }

/* Lebar >= 700px: bilah hijau menjadi sidebar di kiri sehingga tinggi layar
   sepenuhnya untuk kartu login & Alur Layanan. */
@media (min-width: 700px) {
  .login-page { flex-direction: row; }
  .login-page .topbar { flex-direction: column; align-items: stretch; justify-content: space-between; width: clamp(170px, 18vw, 240px); height: 100%; padding: 28px 18px 20px; }
  .login-page .topbar .brand { flex-direction: column; align-items: flex-start; gap: 14px; font-size: 18px; line-height: 1.3; }
  .login-page .topbar .brand span small { font-size: 13px; margin-top: 4px; }
  .login-page .topbar .logo { width: 64px; height: 64px; }
  .login-page .topbar .logo img { width: 50px !important; height: 50px !important; }
  .login-page .side-foot { display: flex; flex-direction: column; gap: 4px; font-size: 12px; line-height: 1.4; opacity: .85; word-break: break-word; }
  .login-page .side-foot span:first-child { font-weight: 600; opacity: 1; }
}

/* Jumlah kolom mengikuti lebar area konten (bukan lebar layar). */
.login-page main.container { container-type: inline-size; }
.login-page .info-card { display: none; }
.login-page .login-wrap { grid-template-columns: minmax(0, 440px); justify-content: center; }
.login-page h1, .login-page .sub { text-align: center; }
@container (min-width: 590px) {
  .login-page .info-card { display: block; }
  .login-page .login-wrap { grid-template-columns: minmax(0, 330px) minmax(0, 1fr); justify-content: stretch; }
  .login-page h1, .login-page .sub { text-align: left; }
  .login-page .surat-list { display: none; } /* kolom info masih sempit: tampilkan alur saja */
}
@container (min-width: 900px) {
  .login-page .login-wrap { grid-template-columns: minmax(0, 400px) minmax(0, 1fr); }
  .login-page .surat-list { display: block; }
}
@media (max-height: 680px) {
  .login-page .surat-list { display: none !important; }
}
@media (max-height: 520px) {
  .login-page .info-card { display: none !important; }
}
@media (max-height: 800px) {
  .login-page h1, .login-page .sub { display: none; }
  .login-page .login-head small { display: none; }
}
@media (max-height: 640px) {
  .login-page .login-head .logo, .login-page .login-note { display: none; }
}

/* Tab login & RFID */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--green-l); padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.tab { border: 0; background: transparent; padding: 9px 8px; border-radius: 9px; font-weight: 600; color: var(--green-d); cursor: pointer; }
.tab.active { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.rfid-panel { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 26px 16px; border: 2px dashed var(--border); border-radius: var(--radius); margin-bottom: 14px; outline: none; cursor: pointer; }
.rfid-panel:focus { border-color: var(--green); background: #fafdf8; }
.rfid-panel small { color: var(--muted); }
.rfid-icon { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; background: var(--green-l); color: var(--green); margin-bottom: 6px; position: relative; }
.rfid-panel:focus .rfid-icon::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 3px solid var(--green); opacity: 0; animation: pulse 1.6s ease-out infinite; }
.rfid-panel[data-state="busy"] .rfid-icon { background: #fff6d6; color: #8a6d00; }
.rfid-panel[data-state="ok"] .rfid-icon { background: var(--green); color: #fff; }
@keyframes pulse { 0% { transform: scale(.85); opacity: .7; } 100% { transform: scale(1.25); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .rfid-panel:focus .rfid-icon::after { animation: none; } }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 18px 0 12px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(20,30,20,.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal .card { width: 100%; max-width: 420px; }
.modal h3 { margin-top: 0; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* Kelompok surat */
.group { margin-bottom: 28px; }
.group h2 { font-size: 18px; color: var(--green-d); display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.group h2 .count { background: var(--green-l); border-radius: 999px; padding: 0 10px; font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.surat-card { text-align: left; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: .15s; color: var(--text); }
.surat-card:hover { border-color: var(--green); box-shadow: 0 4px 14px rgba(47,107,58,.12); transform: translateY(-1px); }
.surat-card .ic { font-size: 24px; }
.surat-card b { display: block; margin: 6px 0 2px; }
.surat-card small { color: var(--muted); }
.profile-box { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 18px; font-size: 14px; }
.profile-box div span { color: var(--muted); display: block; font-size: 12px; }
.search { max-width: 360px; margin-bottom: 20px; }

/* ===== Halaman Pilih Jenis Surat: pas satu layar ===== */
body.list-mode { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body.list-mode .topbar { position: static; flex: none; }
body.list-mode #viewList { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; gap: clamp(8px, 1.8vh, 16px); padding-top: clamp(10px, 2.4vh, 24px); padding-bottom: clamp(10px, 2.4vh, 24px); }
.list-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; flex: none; }
.list-head h1 { font-size: clamp(20px, 3vh, 26px); }
.list-head .sub { margin: 0; }
.list-head .search { margin: 0; width: min(320px, 100%); }
.pemohon-strip { flex: none; display: flex; align-items: center; gap: 10px 28px; flex-wrap: wrap; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(8px, 1.4vh, 12px) 18px; font-size: 14px; }
.pemohon-strip .p-ic { width: 34px; height: 34px; border-radius: 50%; background: var(--green-l); display: grid; place-items: center; flex: none; }
.pemohon-strip div { display: flex; flex-direction: column; min-width: 0; }
.pemohon-strip div span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pemohon-strip div b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pemohon-strip i { color: var(--muted); font-weight: 400; }
.crumb { flex: none; }
.crumb .btn { padding: 6px 12px; font-size: 14px; }
.groups-area { flex: 1; min-height: 0; display: grid; gap: clamp(10px, 1.6vh, 16px); overflow: auto; scrollbar-width: none; }
.groups-area::-webkit-scrollbar { display: none; }

/* Kartu kelompok */
.group-grid { grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); grid-auto-rows: 1fr; }
/* Kartu kelompok: isi di tengah, ikon besar mengikuti tinggi kartu (container query) */
.group-card { container-type: size; position: relative; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 0; cursor: pointer; color: var(--text); transition: .15s; min-height: 0; overflow: hidden; }
.group-card:hover, .group-card:focus-visible { border-color: var(--green); box-shadow: 0 6px 18px rgba(47,107,58,.14); transform: translateY(-2px); outline: none; }
.group-card .g-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: clamp(2px, 2cqh, 10px); padding: 6cqh 8%; }
.group-card .g-ic { width: clamp(52px, 36cqh, 170px); height: clamp(52px, 36cqh, 170px); max-width: 70cqw; max-height: 70cqw; border-radius: 22%; background: var(--green-l); display: grid; place-items: center; font-size: clamp(28px, 21cqh, 96px); line-height: 1; margin-bottom: 2cqh; flex: none; }
.group-card:hover .g-ic { background: #d9e9d4; }
.group-card b { font-size: clamp(15px, 6.5cqh, 22px); color: var(--green-d); line-height: 1.25; }
.group-card .g-count { font-size: clamp(12px, 4cqh, 15px); color: var(--muted); }
.group-card ul { display: none; list-style: none; margin: 1cqh 0 0; padding: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.group-card .g-go { margin-top: 2cqh; font-size: clamp(12px, 4cqh, 14px); font-weight: 600; color: var(--green); background: var(--green-l); border-radius: 999px; padding: 4px 14px; }
.group-card:hover .g-go { background: var(--green); color: #fff; }
@container (min-height: 470px) {
  .group-card .g-ic { width: clamp(52px, 30cqh, 170px); height: clamp(52px, 30cqh, 170px); font-size: clamp(28px, 17cqh, 96px); }
  .group-card ul { display: block; }
}
@container (max-height: 170px) {
  .group-card .g-count { display: none; }
}

/* Kartu jenis surat dalam kelompok / hasil cari */
.surat-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); align-content: start; }
.surat-grid .surat-card { display: flex; align-items: center; gap: 14px; padding: clamp(10px, 1.8vh, 16px); }
.surat-grid .surat-card .ic { font-size: 26px; width: 48px; height: 48px; border-radius: 12px; background: var(--green-l); display: grid; place-items: center; flex: none; }
.surat-grid .surat-card .txt { min-width: 0; }
.surat-grid .surat-card b { margin: 0 0 2px; }
.surat-grid .surat-card small { display: block; }

@media (max-width: 1000px) { .group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .list-head .sub { display: none; }
  .pemohon-strip div:nth-of-type(n+3) { display: none; } /* HP: nama & NIK saja */
  .group-card .g-count { font-size: 12px; }
  .surat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .surat-grid .surat-card { flex-direction: column; justify-content: center; text-align: center; gap: 6px; padding: 8px 6px; }
  .surat-grid .surat-card .ic { width: 34px; height: 34px; font-size: 19px; border-radius: 10px; }
  body.list-mode .topbar { padding: 8px 12px; }
  body.list-mode .topbar .brand { font-size: 14px; gap: 8px; }
  body.list-mode .topbar .brand span small { font-size: 11px; }
  .topbar .user .lbl { display: none; }
  body.list-mode #viewList { gap: 8px; padding-top: 10px; padding-bottom: 10px; }
  .list-head { gap: 8px; }
  .list-head h1 { font-size: 18px; }
  .list-head .search { width: 100%; padding: 8px 12px; }
  .pemohon-strip { flex-wrap: nowrap; gap: 16px; padding: 8px 12px; font-size: 13px; }
  .pemohon-strip .p-ic { display: none; }
  .crumb .btn { padding: 4px 10px; font-size: 13px; }
  .surat-grid .surat-card b { font-size: 13px; line-height: 1.3; }
  .surat-grid .surat-card small { display: none; }
  .topbar .user .btn { padding: 8px 10px; font-size: 13px; }
}
@media (max-height: 620px) { .list-head .sub { display: none; } .surat-grid .surat-card small { display: none; } }

/* ===== Tab mode: Buat Surat / Surat Saya ===== */
.mode-tabs { flex: none; display: flex; gap: 6px; padding-top: clamp(8px, 1.6vh, 14px) !important; padding-bottom: 0 !important; width: 100%; }
.mode-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; text-decoration: none; font-weight: 600; color: var(--green-d); background: #fff; border: 1px solid var(--border); }
.mode-tabs a:hover { border-color: var(--green); }
.mode-tabs a.active { background: var(--green); color: #fff; border-color: var(--green); }
.mode-tabs .count { background: #e8a33d; color: #fff; border-radius: 999px; font-size: 12px; min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; }
body.list-mode #viewList { padding-top: clamp(8px, 1.6vh, 16px); }

/* ===== Surat Saya ===== */
body.list-mode #viewMine, body.list-mode #viewPdf { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; gap: clamp(8px, 1.6vh, 14px); padding-top: clamp(8px, 1.6vh, 16px); padding-bottom: clamp(10px, 2.4vh, 24px); }
body.list-mode #viewMine.hidden, body.list-mode #viewPdf.hidden { display: none; }
.mine-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mine-actions .btn { padding: 8px 14px; font-size: 14px; }
.mine-list { flex: 1; min-height: 0; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 10px; align-content: start; }
.mine-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 14px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; color: var(--text); text-decoration: none; }
.mine-card.ready { cursor: pointer; transition: .15s; }
.mine-card.ready:hover { border-color: var(--green); box-shadow: 0 4px 14px rgba(47,107,58,.12); }
.mine-card:not(.ready) { opacity: .8; }
.mine-card .m-ic { grid-row: span 2; width: 46px; height: 46px; border-radius: 12px; background: var(--green-l); display: grid; place-items: center; font-size: 22px; }
.mine-card .m-txt { min-width: 0; }
.mine-card .m-txt b { display: block; }
.mine-card .m-txt small { color: var(--muted); }
.mine-card .m-badge { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.mine-card .m-go { grid-column: 2 / -1; font-size: 13px; font-weight: 600; color: var(--green); display: flex; justify-content: space-between; gap: 10px; }
.mine-card .m-go.muted { color: var(--muted); font-weight: 400; }
.mine-card .m-pdf { font-weight: 500; color: var(--muted); }
.mine-card .m-pdf:hover { color: var(--green-d); }
.mine-card.ready:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.b-success { background: #dcf3e2; color: #1d6b34; } .b-warning { background: #fff1cc; color: #7a5a00; }
.b-danger { background: #fde2e0; color: #a3261e; } .b-info, .b-primary { background: #dfeefe; color: #1c4f8a; }
.b-secondary { background: #eceeec; color: #555; }
.mine-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 40px 16px; background: #fff; border: 1px dashed var(--border); border-radius: var(--radius); }
.mine-empty span { font-size: 40px; } .mine-empty small { color: var(--muted); max-width: 440px; }

.pdf-bar { flex: none; margin: 0; align-items: center; flex-wrap: nowrap; }
.pdf-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pdf-title b, .pdf-title small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdf-title small { color: var(--muted); }
.pdf-frame-wrap { flex: 1; min-height: 0; position: relative; background: #cfd8cc; border-radius: var(--radius); overflow: hidden; }
.pdf-pages { position: absolute; inset: 0; overflow: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px; }
.pdf-pages .pdf-iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.pdf-pages canvas { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.18); max-width: 100%; height: auto; }
#pdfPrint { display: none; }
.pdf-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); background: #eef2ec; }
@media (max-width: 600px) {
  .mode-tabs a { padding: 6px 12px; font-size: 14px; flex: 1; justify-content: center; }
  .mine-actions .btn { padding: 6px 10px; font-size: 13px; }
  .pdf-bar { flex-wrap: wrap; }
  .pdf-title { order: -1; flex-basis: 100%; }
  .pdf-bar .btn { padding: 6px 10px; font-size: 13px; }
}

/* Editor + preview */
.editor { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
.editor .form-col { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.preview-wrap { background: #cfd8cc; border-radius: var(--radius); padding: 20px; overflow: auto; }
.hidden { display: none !important; }

/* Lembar surat (A4) */
.paper { background: #fff; width: 210mm; min-height: 297mm; margin: 0 auto; padding: 18mm 20mm; color: #000; font-family: "Times New Roman", Times, serif; font-size: 12pt; line-height: 1.5; box-shadow: 0 4px 18px rgba(0,0,0,.18); }
/* Kop surat resmi Desa Rowoyoso: lambang kiri, teks tengah, garis tebal + tipis */
.kop { display: flex; align-items: center; gap: 12px; padding-bottom: 6px; margin-bottom: 16px; border-bottom: 3px solid #000; position: relative; }
.kop::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; border-bottom: 1px solid #000; }
.kop .lambang { width: 80px; height: 92px; flex: none; object-fit: contain; }
.kop .t { flex: 1; text-align: center; line-height: 1.2; }
.kop .t .l1 { font-size: 14pt; font-weight: bold; }
.kop .t .l2 { font-size: 18pt; font-weight: bold; }
.kop .t .l3 { font-size: 11.5pt; font-style: italic; margin-top: 2px; }
.judul { text-align: center; margin: 8px 0 14px; }
.judul u { font-weight: bold; font-size: 13pt; text-transform: uppercase; }
.paper p { margin: 0 0 8px; text-align: justify; }
.paper table.data { border-collapse: collapse; margin: 4px 0 10px 24px; }
.paper table.data td { padding: 1px 6px; vertical-align: top; }
.paper table.data td:first-child { width: 190px; }
.paper table.data td:nth-child(2) { width: 10px; }
.ttd { display: flex; justify-content: space-between; margin-top: 28px; }
.ttd .box { width: 45%; text-align: center; }
.ttd .space { height: 72px; }
.kosong { color: #b3261e; }

@media (max-width: 900px) {
  .login-wrap, .editor { grid-template-columns: minmax(0, 1fr); }
  .editor .form-col { position: static; max-height: none; }
  .paper { transform-origin: top left; }
  .topbar .user .nama { display: none; }
}

@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  body * { visibility: hidden; }
  #paper, #paper * { visibility: visible; }
  #paper { position: absolute; left: 0; top: 0; box-shadow: none; margin: 0; zoom: 1 !important; }
  .kosong { color: #000; }
  /* Cetak PDF surat resmi (Surat Saya): hanya gambar halaman PDF */
  body.print-pdf { height: auto !important; overflow: visible !important; display: block !important; }
  body.print-pdf > *:not(#pdfPrint) { display: none !important; }
  body.print-pdf #pdfPrint, body.print-pdf #pdfPrint * { visibility: visible; }
  body.print-pdf #pdfPrint { display: block; position: static; }
  body.print-pdf #pdfPrint img { display: block; width: 210mm; height: auto; page-break-after: always; break-after: page; }
  body.print-pdf #pdfPrint img:last-child { page-break-after: auto; break-after: auto; }
}
