:root {
    --primary: #1e293b;
    --secondary: #64748b;
    --accent: #3b82f6;
    --danger: #dc2626;
    --border: #000;
    --bg-light: #f1f5f9;
    --editable-bg: #fffdf5;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, sans-serif; font-size: 7pt; line-height: 1.15; color: #000; background: var(--bg-light); }
span { font-size: 12px;}

/* Navbar Modern */
.navbar {
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.18);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    font-size: 16px;
    font-weight: 900;
    box-shadow: 0 3px 8px rgba(59, 130, 246, 0.35);
}

.brand-text { font-size: 17px; }

.v-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #e2e8f0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
}

.nav-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-group { display: flex; align-items: center; gap: 8px; }

.nav-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.16);
}

.nav-actions button,
.nav-actions a.nav-btn {
    border: 1px solid transparent;
    padding: 9px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    color: white;
    line-height: 1;
    white-space: nowrap;
}

.nav-actions button:hover,
.nav-actions a.nav-btn:hover { transform: translateY(-1px); filter: none; }
.nav-actions button:active,
.nav-actions a.nav-btn:active { transform: translateY(0); }
.nav-actions button:focus-visible,
.nav-actions a.nav-btn:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

.btn-icon { font-size: 15px; line-height: 1; }
.btn-label { font-size: 13px; }

/* Buttons */
button { border: none; border-radius: 4px; padding: 6px 14px; cursor: pointer; font-weight: 600; color: white; transition: 0.2s; }
button:hover { filter: brightness(1.1); }
.btn-save { 
    background-color: #2563eb;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}
.btn-save:hover { background-color: #1d4ed8; }

.btn-open {
    background-color: #f59e0b;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
}
.btn-open:hover { background-color: #d97706; }

.btn-danger { background: var(--danger); }
.btn-ghost { background: #e7f0f2; color: #0f172a; padding: 2px 8px; font-size: 11px; }
.btn-print {
    background-color: #10b981;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
    padding: 9px 16px;
}
.btn-print:hover { background-color: #059669; }

/* Dropdown Cetak */
.print-dropdown { position: relative; display: inline-block; }
.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 190px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.22);
    padding: 6px;
    overflow: hidden;
    z-index: 3000;
}
.dropdown-menu.show { display: block; }
.dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: #1e293b;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.dropdown-menu button:hover {
    background: #f1f5f9;
    filter: none;
    transform: none;
    box-shadow: none;
}

/* Styling Tombol Template */
.btn-template {
    background-color: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 9px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: none;
}

.btn-template:hover {
    background-color: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.24);
}

/* Navbar: tombol ikon saja + tooltip */
.nav-actions .nav-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    gap: 0;
    flex: 0 0 auto;
    position: relative;
    text-decoration: none;
}

.nav-actions .nav-btn .btn-icon { font-size: 17px; }

.btn-signed {
    background-color: #8b5cf6;
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.35);
}
.btn-signed:hover { background-color: #7c3aed; }

/* Tooltip kustom tombol navbar */
.nav-btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translate(-50%, -4px);
    padding: 7px 11px;
    border-radius: 8px;
    background: #0f172a;
    color: #f8fafc;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.28);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
    z-index: 4000;
}

.nav-btn[data-tooltip]::before {
    content: "";
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translate(-50%, -4px);
    border: 6px solid transparent;
    border-bottom-color: #0f172a;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
    z-index: 4000;
}

.nav-btn[data-tooltip]:hover::after,
.nav-btn[data-tooltip]:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.nav-btn[data-tooltip]:hover::before,
.nav-btn[data-tooltip]:focus-visible::before {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

/* Tooltip pada tombol paling kanan supaya tidak keluar layar */
.nav-btn.tip-end[data-tooltip]::after {
    left: auto;
    right: 0;
    transform: translateY(-4px);
}
.nav-btn.tip-end[data-tooltip]::before {
    left: auto;
    right: 14px;
    transform: translateY(-4px);
}
.nav-btn.tip-end[data-tooltip]:hover::after,
.nav-btn.tip-end[data-tooltip]:focus-visible::after,
.nav-btn.tip-end[data-tooltip]:hover::before,
.nav-btn.tip-end[data-tooltip]:focus-visible::before {
    transform: translateY(0);
}

/* Sembunyikan tooltip cetak saat menu dropdown terbuka */
.print-dropdown:has(.dropdown-menu.show) .nav-btn[data-tooltip]::after,
.print-dropdown:has(.dropdown-menu.show) .nav-btn[data-tooltip]::before {
    opacity: 0;
    visibility: hidden;
}

/* Responsif Navbar */
@media (max-width: 860px) {
    .navbar { padding: 10px 16px; gap: 12px; }
    .nav-actions { gap: 8px; }
    .nav-divider { display: none; }
}

@media (max-width: 640px) {
    .navbar { flex-wrap: wrap; }
    .nav-actions { width: 100%; justify-content: flex-start; }
    .btn-label { display: none; }
    .nav-actions button { padding: 9px 11px; }
}

/* Container List di dalam Modal */
.selection-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.template-item {
    padding: 12px 15px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.template-item:hover {
    background-color: #f8fafc;
    border-color: #3b82f6; /* Hanya ubah warna, jangan ubah ketebalan */
    transform: translateY(-2px); /* Efek angkat sedikit (opsional) */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.template-item i { font-size: 20px; }

/* Document Page */
.page { 
    width: 210mm; min-height: 297mm; margin: 20px auto; padding: 10mm; 
    background: #fff; box-shadow: 0 0 15px rgba(0,0,0,0.1); position: relative;
}

/* Tabel SOP */
.tbl { width: 100%; border-collapse: collapse; margin-bottom: 2px; }
.tbl td { border: 0.5pt solid #000; vertical-align: top; padding: 1.4pt 2pt; white-space: normal !important; 
    word-break: normal; line-height: 1.15; }
.tbl th {
    background-color: #D1D1D1;
    color: #000;
    font-weight: 700;
    text-align: center;
    padding: 1.4pt 2pt;
    border: 0.5pt solid #000;
    vertical-align: middle; /* Sangat penting untuk rowspan 3 */
    white-space: normal !important; 
    word-break: normal; 
    hyphens: auto;
}
.center { text-align: center; }
.upper { text-transform: uppercase; }
.bold { font-weight: bold; }
.title-main {
    font-weight: 700;
    text-align: center;
    padding: 2pt;
    font-size: 9pt;
    /* Tambahkan baris di bawah ini */
    text-transform: uppercase; 
}

/* Identitas */
.inst-head { text-align: center; padding: 2px 0; }
.inst-logo { width: 2.5cm; height: auto; margin: 0.1cm 0; }
.inst-title { font-weight: 700; font-size: 11pt; }
.inst-subtitle { font-weight: 700; font-size: 10pt; }
.inst-addr, .inst-contact { font-size: 7pt; margin-top: 2px; }
.meta-table td { font-size: 8pt; }
.meta-table input { font-size: 8pt; }
#nomorSop { font-size: 7.5pt; }

/* Editables */
[contenteditable="true"], .editable-line { background: var(--editable-bg); }
[contenteditable="true"]:focus { outline: 2px solid var(--accent); background: #fff; }

/* Modals & Picker (Gunakan gaya dari kode sebelumnya) */
/* .modal { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: none; align-items: center; justify-content: center; z-index: 2000; } */
/* Container Utama Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5); /* Overlay gelap transparan */
    backdrop-filter: blur(4px); /* Efek blur di belakang modal */
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

/* Kotak Konten Modal */
.modal-content {
    background: #fff;
    width: 90%;
    max-width: 600px;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(0);
    animation: slideUp 0.3s ease-out;
    overflow-anchor: none;
    position: relative;
    padding-top: 40px;
}

/* Judul Modal */
.modal-content h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    color: #1e293b;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Textarea yang lebih lega */
.modal-content textarea {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s;
    background: #f8fafc;
}

.modal-content textarea:focus {
    outline: none;
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Subtitle/Instruksi di bawah judul modal */
.modal-subtitle {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 12px;
    background: #f8fafc;
    padding: 8px;
    border-left: 3px solid #3b82f6;
    border-radius: 4px;
}

/* Style Textarea agar lebih modern */
.modal-textarea {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical; /* Hanya bisa ditarik ke bawah */
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.modal-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Penyesuaian header modal agar seragam */
.modal-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.modal-header h3 {
    margin: 0;
    color: #1e293b;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Tombol Close di Pojok Kanan Atas */
.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    background: #f1f5f9; /* Abu-abu sangat muda */
    border: none;
    border-radius: 50%; /* Membuat lingkaran */
    color: #64748b;
    font-size: 20px;
    line-height: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.close-modal:hover {
    background-color: #fee2e2; /* Merah muda saat hover */
    color: #ef4444;           /* Tanda silang jadi merah */
    transform: rotate(90deg); /* Efek putar sedikit agar keren */
}

/* Container untuk tombol agar rapi ke kanan */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    margin-top: 20px;
}

/* Base style untuk semua tombol di modal */
.modal-footer button {
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tombol Terapkan/Simpan (Biru Modern) */
.btn-primary {
    background-color: #2563eb; /* Blue 600 */
    color: white;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background-color: #1d4ed8; /* Blue 700 */
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(37, 99, 235, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Tombol Batal (Merah Lembut/Greyish Red) */
.btn-secondary {
    background-color: #fff1f2; /* Rose 50 */
    color: #e11d48; /* Rose 600 */
    border: 1px solid #fecdd3 !important;
}

.btn-secondary:hover {
    background-color: #ffe4e6; /* Rose 100 */
    color: #be123c; /* Rose 700 */
    border-color: #fda4af !important;
}

/* Container Checklist di dalam Modal */
.checklist-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 15px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    margin-top: 10px;
}

.checklist-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    padding: 5px;
}

.checklist-item:hover {
    background: #f8fafc;
}

.checklist-item input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checklist-item span {
    font-size: 13px;
    color: #1e293b;
}

/* Container Daftar Pejabat di Modal */
.selection-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    background: #f1f5f9;
    border-radius: 8px;
}

.selection-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.selection-item:hover {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: translateX(5px);
}

.selection-item .pos-title {
    font-weight: bold;
    color: #1e293b;
    font-size: 13px;
    margin-bottom: 4px;
}

.selection-item .pos-meta {
    font-size: 11px;
    color: #64748b;
}

.order-list {
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px;
    min-height: 250px;
    border: 1px dashed #cbd5e1;
}
.order-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.btn-updown {
    padding: 4px 8px;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #2563eb;
}

/* Style khusus untuk area tanda tangan agar terlihat rapi */
.approval-cell {
    cursor: pointer;
    transition: background 0.2s;
}
.approval-cell:hover {
    background: #fffbeb;
}
/* Mengatur daftar agar lebih ke kiri */
ol.section-content {
    margin: 5px 0 0 0;   /* Reset margin luar */
    padding-left: 18px;  /* Mengurangi jarak nomor dari garis kiri */
}

/* Mengatur jarak antar poin agar tidak terlalu rapat */
ol.section-content li {
    margin-bottom: 4px;
    padding-left: 5px;   /* Jarak antara nomor dan teks */
}

/* Jika bagian non-list (seperti Peringatan) juga ingin digeser */
div.section-content {
    padding-left: 4px;
    padding-top: 4px;
}

/* Mengatur simbol list pada bagian Peringatan */
#peringatan, #pencatatan {
    list-style-type: disc; /* Mengganti bullet/nomor menjadi tanda hubung */
    margin: 5px 0 0 0;
    list-style-position: outside;
}

#peringatan li, #pencatatan li {
    margin-bottom: 3px;
    white-space: normal;
}

/* Container Kontrol Tabel */
.table-controls {
    display: flex;
    justify-content: space-between; /* Memisahkan grup kiri dan kanan */
    align-items: center;
    background: #f8fafc;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-bottom: none; /* Menyatu dengan tabel di bawahnya */
    border-radius: 8px 8px 0 0;
    margin-top: 20px;
}

.ctrl-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ctrl-label {
    font-size: 11px;
    font-weight: bold;
    color: #64748b;
    text-transform: uppercase;
    margin-right: 5px;
}

/* Styling Tombol agar lebih modern */
.btn-ctrl {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    font-size: 11px;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-add {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #10b981;
}

.btn-add:hover {
    background: #10b981;
    color: white;
}

.btn-del {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #ef4444;
}

.btn-del:hover {
    background: #ef4444;
    color: white;
}

#iconPicker {
    position: fixed;
    /* Posisikan di tengah layar */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Teknik agar benar-benar center */
    
    background: #fff;
    border: 1px solid #cbd5e1;
    padding: 15px;
    display: none;
    z-index: 3000;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    width: 400px; /* Ukuran yang ideal untuk grid 4 kolom */
    
    /* Tambahkan animasi muncul dari bawah */
    animation: popupScale 0.2s ease-out;
}

/* Header Picker */
.picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #f1f5f9;
}

.picker-header span {
    font-weight: bold;
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
}

/* Grid Ikon */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 kolom agar muat banyak */
    gap: 8px;
    max-height: 220px; /* Batasi tinggi agar tidak menutupi layar */
    overflow-y: auto; /* Scroll jika ikon sangat banyak */
    padding: 2px;
}

/* Item Ikon Individu */
.icon-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: scale(1.05);
}

.icon-btn img {
    width: 24px;  /* Ukuran ikon diperkecil */
    height: 24px;
    object-fit: contain;
    margin-bottom: 4px;
}

.icon-btn span {
    font-size: 9px; /* Teks label sangat kecil agar hemat ruang */
    color: #475569;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Tombol Hapus/Batal di bawah */
.picker-footer {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}

/* Mengunci ukuran ikon di dalam tabel aktivitas */
.pelaksana-cell img {
    width: 1.7cm;
    height: 1.7cm;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* Memastikan tinggi baris tabel tidak melompat saat ikon dimasukkan */
.pelaksana-cell {
    width: auto;
    min-width: 1.7cm;
    height: auto;
    vertical-align: middle !important;
    text-align: center;
    padding: 0.05cm !important;
}

#pelaksanaHeadRow th {
    font-size: 7pt;
    max-width: none;
    vertical-align: middle !important;
    text-align: center;
    padding: 1.4pt 2pt;
    height: auto;
    word-wrap: break-word;
    white-space: normal;
}

/* Lebar kolom tabel aktivitas mengikuti contoh_sop.docx */
.no-cell {
    width: 0.7cm;
    min-width: 0.7cm;
    max-width: 0.7cm;
    text-align: center;
}

/* Header "No" tidak terlipat jadi "N / o" (mengalahkan white-space di .tbl th/td) */
.tbl .no-cell {
    white-space: nowrap !important;
}

.aktivitas-cell {
    width: 4.95cm;
    min-width: 4.95cm;
    max-width: 4.95cm;
    white-space: normal !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding: 1.4pt 2pt !important;
    vertical-align: top;
    line-height: 1.15;
}

.mutu-syarat {
    width: 1.8cm;
    min-width: 1.8cm;
    max-width: 1.8cm;
}

.mutu-waktu {
    width: 1.2cm;
    min-width: 1.2cm;
    max-width: 1.2cm;
}

.mutu-output {
    width: 1.8cm;
    min-width: 1.8cm;
    max-width: 1.8cm;
}

.ket-cell {
    width: 1.7cm;
    min-width: 1.7cm;
    max-width: 1.7cm;
}

/* Pastikan tabel mematuhi instruksi width di atas */
#activityTable {
    table-layout: fixed; 
    width: 100%;
    border-collapse: collapse;
}

#activityTable thead th {
    background-color: #D1D1D1;
    color: #000;
    text-align: center;
    vertical-align: middle;
    border: 0.5pt solid #000;
}

#closePicker {
    transition: color 0.2s, transform 0.2s;
}

#closePicker:hover {
    color: #dc2626 !important; /* Berubah jadi merah saat hover */
    transform: scale(1.2);
}

.active-row td {
    background-color: #fffbeb !important; /* Warna kuning muda */
}

.zi-commitment {
    margin-top: 10px;
    padding: 1.4pt 2pt;
    border: 0.5pt solid #000;
    text-align: center;
    font-weight: bold;
    font-style: italic;
    line-height: 1.15;
    background-color: #fff;
    page-break-inside: avoid;
}

/* Animasi */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes popupScale {
    from { transform: translate(-50%, -45%) scale(0.95); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@media print {
    /* 1. Paksa ukuran kertas dan hilangkan margin bawaan browser */
    @page {
        size: A4 portrait;
        margin: 10mm; /* Margin 1 cm sesuai contoh_sop.docx */
    }

    /* 2. Sembunyikan semua elemen UI */
    .navbar, .table-controls, .btn-ghost, .modal, #iconPicker, 
    .nav-actions, .modal-footer, #clearIcon { 
        display: none !important; 
        height: 0 !important;
        overflow: hidden !important;
    }

    /* 3. Reset Body agar tidak ada scrollbar atau sisa background */
    body { 
        background: #fff !important; 
        margin: 0 !important; 
        padding: 0 !important;
        width: 100%;
    }

    /* 4. Atur kontainer utama SOP */
    .page { 
        margin: 0 !important; 
        box-shadow: none !important; 
        width: 100% !important; 
        max-width: none !important;
        padding: 0 !important;
        border: none !important;
        min-height: auto !important;
        page-break-after: avoid;
    }

    /* 5. Optimasi Tabel agar muat di satu halaman atau terbagi rapi */
    /* Sedikit lebih sempit dari area cetak: garis tepi kanan tabel (border-collapse
       digambar setengah di luar kotak tabel) tetap utuh, tidak terpotong area cetak. */
    .tbl {
        width: 99.9% !important;
        border-collapse: collapse !important;
        table-layout: fixed; /* Menjaga lebar kolom tetap stabil */
        page-break-after: avoid;
    }

    tr { 
        page-break-inside: avoid; /* Jangan potong baris di tengah */
    }

    thead { 
        display: table-header-group; /* Ulangi header di halaman baru */
    }

    /* 6. Hilangkan teks bantuan ikon */
    .pelaksana-cell.empty {
        color: transparent !important;
        font-size: 0 !important;
        border: 1px solid #000 !important; /* Pastikan garis kotak tetap ada */
    }

    /* 7. Pastikan teks bisa dibaca dengan baik (Hitam Pekat) */
    .title-main, .section-title, .tbl td {
        color: #000 !important;
    }

    #activityTable thead th {
        background-color: #D1D1D1 !important; /* Sesuai shading contoh_sop.docx */
        -webkit-print-color-adjust: exact;    /* Memaksa Chrome/Edge/Safari cetak warna */
        print-color-adjust: exact;            /* Standar Firefox */
        color: #000 !important;
        border: 0.5pt solid #000 !important;
    }

    .zi-commitment {
        background-color: transparent !important; /* Hemat tinta saat print */
        border: 2px solid #000 !important;      /* Pastikan border tetap muncul */
        /* -webkit-print-color-adjust: exact; */
        margin-top: 10px;
    }
}