/* =====================================================================
   style.css — Dashboard Admin Laporan PG
   ---------------------------------------------------------------------
   CSS ditulis sendiri (tanpa CDN/framework) supaya dashboard tetap
   tampil normal walaupun XAMPP dijalankan tanpa koneksi internet,
   dan supaya hasil CETAK bisa diatur presisi.

   Daftar isi:
     1. Variabel & reset
     2. Tipografi & utilitas
     3. Halaman login
     4. Kerangka layout (sidebar, topbar, konten)
     5. Kartu & statistik
     6. Tabel
     7. Form
     8. Tombol & badge
     9. Modal, toast, loader
    10. Grafik batang
    11. Halaman cetak
    12. Responsif
   =====================================================================*/

/* ---------------------------------------------------------------------
   1. VARIABEL & RESET
   ---------------------------------------------------------------------*/
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;

    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;

    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --info: #0891b2;
    --info-light: #cffafe;

    --bg: #f1f5f9;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;

    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-lg: 0 10px 25px rgba(15, 23, 42, .12);

    --sidebar-width: 250px;
    --topbar-height: 62px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------------
   2. TIPOGRAFI & UTILITAS
   ---------------------------------------------------------------------*/
h1, h2, h3, h4 {
    margin: 0;
    font-weight: 600;
    line-height: 1.3;
}

h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover { text-decoration: underline; }

.text-muted  { color: var(--muted); }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-sm     { font-size: 13px; }
.text-xs     { font-size: 12px; }
.fw-600      { font-weight: 600; }
.mt-0  { margin-top: 0; }
.mt-1  { margin-top: 8px; }
.mt-2  { margin-top: 16px; }
.mt-3  { margin-top: 24px; }
.mb-1  { margin-bottom: 8px; }
.mb-2  { margin-bottom: 16px; }
.mb-3  { margin-bottom: 24px; }
.hidden { display: none !important; }

.row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.row-between {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.grid {
    display: grid;
    gap: 16px;
}

/* Bawaan grid item adalah min-width:auto sehingga kolom ikut melebar
   mengikuti isi terlebar (mis. grafik) dan membuat halaman menggulir
   ke samping. min-width:0 membuat isinya yang menyesuaikan diri. */
.grid > * {
    min-width: 0;
}

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

/* ---------------------------------------------------------------------
   3. HALAMAN LOGIN
   ---------------------------------------------------------------------*/
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #1e293b 0%, #2563eb 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 32px 28px;
}

.login-logo {
    display: block;
    max-width: 110px;
    max-height: 80px;
    margin: 0 auto 14px;
    object-fit: contain;
}

.login-logo-fallback {
    width: 62px;
    height: 62px;
    margin: 0 auto 14px;
    border-radius: 16px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 700;
}

.login-title {
    text-align: center;
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 4px;
}

.login-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 24px;
}

.login-hint {
    margin-top: 20px;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: #f8fafc;
    border: 1px dashed var(--border);
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

/* ---------------------------------------------------------------------
   4. KERANGKA LAYOUT
   ---------------------------------------------------------------------*/
.layout {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: transform .25s ease;
}

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    flex-shrink: 0;
}

.sidebar-brand img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: contain;
    background: #fff;
    padding: 3px;
}

.sidebar-brand .brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: 14px 10px;
    overflow-y: auto;
}

.nav-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #475569;
    padding: 12px 10px 6px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 14px;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
    text-decoration: none;
}

.nav-item.active {
    background: var(--primary);
    color: var(--sidebar-active);
    font-weight: 500;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    font-size: 11px;
    color: #475569;
}

.topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: var(--topbar-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 16px;
    z-index: 30;
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.topbar-user-info {
    line-height: 1.25;
}

.topbar-user-info .name {
    font-weight: 600;
    font-size: 13px;
}

.topbar-user-info .role {
    font-size: 11px;
    color: var(--muted);
    text-transform: capitalize;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text);
}

.main {
    margin-left: var(--sidebar-width);
    padding-top: var(--topbar-height);
    min-height: 100vh;
}

.content {
    padding: 24px;
    max-width: 1400px;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.page-head p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    z-index: 35;
}

/* ---------------------------------------------------------------------
   5. KARTU & STATISTIK
   ---------------------------------------------------------------------*/
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-head {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.card-body { padding: 18px; }
.card-body.p-0 { padding: 0; }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 22px;
    height: 22px;
}

.stat-icon.blue   { background: var(--primary-light); color: var(--primary-dark); }
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.amber  { background: var(--warning-light); color: var(--warning); }
.stat-icon.cyan   { background: var(--info-light);    color: var(--info); }

.stat-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
}

.stat-label {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

/* ---------------------------------------------------------------------
   6. TABEL
   ---------------------------------------------------------------------*/
.table-wrap {
    overflow-x: auto;
}

table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

table.table th {
    text-align: left;
    padding: 11px 16px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .03em;
    white-space: nowrap;
}

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

table.table tbody tr:last-child td {
    border-bottom: none;
}

table.table tbody tr:hover {
    background: #f8fafc;
}

.table-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.empty-state {
    padding: 48px 20px;
    text-align: center;
    color: var(--muted);
}

.empty-state svg {
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
    opacity: .4;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.pagination-list {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 9px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}

.page-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* ---------------------------------------------------------------------
   7. FORM
   ---------------------------------------------------------------------*/
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-label .req {
    color: var(--danger);
}

.input,
.select,
.textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
    background: #f8fafc;
    color: var(--muted);
    cursor: not-allowed;
}

.textarea {
    min-height: 84px;
    resize: vertical;
}

.form-hint {
    font-size: 12px;
    color: var(--muted);
    margin-top: 5px;
}

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 5px;
    display: none;
}

.form-group.has-error .input,
.form-group.has-error .select {
    border-color: var(--danger);
}

.form-group.has-error .form-error {
    display: block;
}

.alert {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.alert.show { display: block; }
.alert-danger  { background: var(--danger-light);  color: #991b1b; }
.alert-success { background: var(--success-light); color: #166534; }
.alert-info    { background: var(--info-light);    color: #155e75; }
.alert-warning { background: var(--warning-light); color: #92400e; }

.logo-preview {
    width: 130px;
    height: 130px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    overflow: hidden;
    flex-shrink: 0;
}

.logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.logo-preview span {
    color: var(--muted);
    font-size: 12px;
    text-align: center;
    padding: 8px;
}

/* ---------------------------------------------------------------------
   8. TOMBOL & BADGE
   ---------------------------------------------------------------------*/
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
    text-decoration: none;
}

.btn:hover { text-decoration: none; }

.btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-outline {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover:not(:disabled) { background: #15803d; }

.btn-block {
    width: 100%;
}

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

.btn-icon {
    padding: 6px;
    width: 30px;
    height: 30px;
}

.btn-icon svg {
    width: 15px;
    height: 15px;
}

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-admin    { background: var(--danger-light);  color: #991b1b; }
.badge-operator { background: var(--warning-light); color: #92400e; }
.badge-user     { background: var(--primary-light); color: var(--primary-dark); }

/* ---------------------------------------------------------------------
   9. MODAL, TOAST, LOADER
   ---------------------------------------------------------------------*/
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 60;
}

.modal {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    animation: modal-in .18s ease-out;
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-foot {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    padding: 4px;
    line-height: 0;
}

.modal-close:hover { color: var(--text); }

.toast-wrap {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 260px;
    max-width: 360px;
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    font-size: 13.5px;
    animation: toast-in .2s ease-out;
}

.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.info    { border-left-color: var(--info); }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    display: inline-block;
}

.spinner.dark {
    border-color: var(--border);
    border-top-color: var(--primary);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-row {
    padding: 40px;
    text-align: center;
    color: var(--muted);
}

/* ---------------------------------------------------------------------
   10. GRAFIK BATANG (dibuat murni dengan CSS)
   ---------------------------------------------------------------------*/
.chart {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 200px;
    padding-top: 22px;
    /* Di layar sempit grafik menggulir di dalam kartu, bukan melebarkan halaman. */
    overflow-x: auto;
    overflow-y: hidden;
}

.chart-col {
    /* grow 1, shrink 0, lebar minimum 54px -> melebar di desktop,
       tetap terbaca (dan menggulir) di layar kecil */
    flex: 1 0 54px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.chart-bar {
    width: 100%;
    max-width: 46px;
    background: linear-gradient(180deg, #3b82f6, #2563eb);
    border-radius: 5px 5px 0 0;
    position: relative;
    min-height: 3px;
    transition: opacity .15s;
}

.chart-bar:hover { opacity: .85; }

.chart-bar .val {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text);
}

.chart-label {
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    white-space: nowrap;
}

.level-bar {
    height: 8px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
    margin-top: 6px;
}

.level-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--primary);
}

/* ---------------------------------------------------------------------
   11. HALAMAN CETAK
   ---------------------------------------------------------------------*/
.print-toolbar {
    position: sticky;
    top: 0;
    background: var(--sidebar-bg);
    color: #fff;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    z-index: 10;
}

.print-toolbar .title {
    font-weight: 600;
    font-size: 14px;
}

/* Kertas A4 */
.paper {
    background: #fff;
    width: 210mm;
    min-height: 297mm;
    margin: 22px auto;
    padding: 15mm 15mm 18mm;
    box-shadow: var(--shadow-lg);
    color: #000;
    font-size: 12px;
}

.paper.landscape {
    width: 297mm;
    min-height: 210mm;
}

/* Kop surat */
.kop {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 10px;
}

.kop img {
    width: 74px;
    height: 74px;
    object-fit: contain;
    flex-shrink: 0;
}

.kop-text {
    flex: 1;
    text-align: center;
}

.kop-text .nama {
    font-size: 19px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
    line-height: 1.2;
}

.kop-text .detail {
    font-size: 11px;
    margin-top: 3px;
    line-height: 1.45;
}

.kop-spacer {
    width: 74px;
    flex-shrink: 0;
}

.kop-line {
    border: none;
    border-top: 3px solid #000;
    margin: 0 0 2px;
}

.kop-line-thin {
    border: none;
    border-top: 1px solid #000;
    margin: 0 0 16px;
}

.print-title {
    text-align: center;
    margin-bottom: 4px;
}

.print-title h2 {
    font-size: 15px;
    text-transform: uppercase;
    text-decoration: underline;
    letter-spacing: .03em;
}

.print-title p {
    margin: 3px 0 0;
    font-size: 11.5px;
}

.print-meta {
    margin: 14px 0 10px;
    font-size: 11.5px;
}

.print-meta table td {
    padding: 1px 0;
    vertical-align: top;
}

.print-meta table td:first-child { width: 110px; }
.print-meta table td:nth-child(2) { width: 12px; }

table.print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11.5px;
    margin-top: 8px;
}

table.print-table th,
table.print-table td {
    border: 1px solid #000;
    padding: 5px 7px;
    vertical-align: top;
}

table.print-table th {
    background: #e8e8e8;
    font-weight: 700;
    text-align: center;
}

table.print-table td.num {
    text-align: center;
    width: 34px;
}

table.print-table tfoot td {
    font-weight: 700;
    background: #f4f4f4;
}

.print-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 14px 0;
}

.print-summary .box {
    border: 1px solid #000;
    padding: 9px 10px;
    text-align: center;
}

.print-summary .box .v {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.1;
}

.print-summary .box .l {
    font-size: 10.5px;
    margin-top: 3px;
    text-transform: uppercase;
}

.ttd {
    margin-top: 34px;
    display: flex;
    justify-content: flex-end;
}

.ttd-box {
    width: 220px;
    text-align: center;
    font-size: 11.5px;
}

.ttd-space {
    height: 62px;
}

.ttd-name {
    font-weight: 700;
    text-decoration: underline;
}

.print-footer {
    margin-top: 20px;
    padding-top: 6px;
    border-top: 1px solid #999;
    font-size: 9.5px;
    color: #444;
    display: flex;
    justify-content: space-between;
}

/* ---- Aturan khusus saat benar-benar dicetak ---- */
@media print {
    @page {
        size: A4 portrait;
        margin: 12mm;
    }

    @page landscape-page {
        size: A4 landscape;
    }

    html, body {
        background: #fff !important;
        margin: 0;
        padding: 0;
    }

    /* Elemen layar yang tidak ikut tercetak */
    .no-print,
    .print-toolbar,
    .sidebar,
    .topbar,
    .sidebar-backdrop,
    .toast-wrap {
        display: none !important;
    }

    .paper {
        width: auto;
        min-height: 0;
        margin: 0;
        padding: 0;
        box-shadow: none;
        font-size: 11.5px;
    }

    /* Baris tabel tidak terpotong di tengah halaman */
    table.print-table { page-break-inside: auto; }
    table.print-table tr { page-break-inside: avoid; page-break-after: auto; }
    table.print-table thead { display: table-header-group; }
    table.print-table tfoot { display: table-footer-group; }

    .ttd { page-break-inside: avoid; }

    /* Pastikan warna latar tabel ikut tercetak */
    table.print-table th,
    .print-summary .box,
    table.print-table tfoot td {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    a { color: #000 !important; text-decoration: none !important; }
}

/* ---------------------------------------------------------------------
   12. RESPONSIF
   ---------------------------------------------------------------------*/
@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.open + .sidebar-backdrop {
        display: block;
    }

    .topbar {
        left: 0;
    }

    .main {
        margin-left: 0;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .content {
        padding: 16px;
    }

    .topbar-user-info {
        display: none;
    }
}

@media (max-width: 560px) {
    .grid-4 { grid-template-columns: 1fr; }

    .chart-label { font-size: 10px; }

    .paper {
        width: auto;
        padding: 12mm 8mm;
    }

    .print-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}
