:root {
    --bg: #F6F1E6;
    --navy: #1F2A54;
    --navy-2: #28356B;
    --accent: #C1440E;
    --ink: #241C15;
    --muted: #9A8F78;
    --muted-navy: #B9BFDB;
    --border: #E4DCC8;
    --card: #ffffff;
    --success: #1B7A4A;
    --success-bg: #EAF4EC;
    --info: #2554C7;
    --info-bg: #E7EDFC;
    --danger: #B8382C;
    --danger-bg: #FBEAE7;
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Public Sans', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
    --texture: repeating-linear-gradient(45deg, rgba(243,239,227,.05) 0 1px, transparent 1px 16px), repeating-linear-gradient(-45deg, rgba(243,239,227,.05) 0 1px, transparent 1px 16px);
}

* { box-sizing: border-box; }

body {
    font-family: var(--font-body), system-ui, sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display), Georgia, serif; margin: 0 0 0.4rem; }

a { color: var(--accent); }

/* ---------- App shell: sidebar (desktop) + bottom nav (mobile) ---------- */
.app-shell { min-height: 100vh; }
.app-main { padding: 0 0 84px; min-height: 100vh; }

.sidebar { display: none; }
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: 64px; display: flex; background: #fff; border-top: 1px solid var(--border);
}
.bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; color: var(--muted); text-decoration: none; font-size: 10px; font-weight: 600;
}
.bottom-nav a.active { color: var(--accent); font-weight: 700; }
.bottom-nav svg { width: 20px; height: 20px; }

@media (min-width: 880px) {
    .app-shell { display: flex; }
    .bottom-nav { display: none; }
    .sidebar {
        display: flex; flex-direction: column; width: 220px; height: 100vh; flex: 0 0 auto;
        position: sticky; top: 0; overflow-y: auto;
        background: var(--navy); background-image: var(--texture); color: #F3EFE3; padding: 20px 14px;
    }
    .app-main { flex: 1 1 auto; padding: 0; }
    .sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 20px; }
    .sidebar-mark {
        width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff;
        display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 14px; flex: 0 0 auto;
    }
    .sidebar-brand strong { font-family: var(--font-display); font-size: 15px; font-weight: 600; line-height: 1.2; }
    .sidebar-brand-sub { font-size: 10.5px; color: var(--muted-navy); }
    .sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }
    .sidebar-nav a {
        display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
        color: var(--muted-navy); text-decoration: none; font-size: 13.5px; font-weight: 600;
    }
    .sidebar-nav a svg { width: 17px; height: 17px; flex: 0 0 auto; }
    .sidebar-nav a.active { background: rgba(243,239,227,.12); color: #fff; }
    .sidebar-nav a:hover { color: #fff; }
    .sidebar-foot { border-top: 1px solid rgba(243,239,227,.16); padding-top: 12px; margin-top: 8px; }
    .sidebar-foot a { color: var(--muted-navy); text-decoration: none; font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; padding: 6px 10px; }
    .sidebar-foot a:hover { color: #fff; }
    .sidebar-whoami { padding: 6px 10px 14px !important; margin-bottom: 6px; border-bottom: 1px solid rgba(243,239,227,.16); }
    .sidebar-whoami-avatar {
        width: 30px; height: 30px; border-radius: 999px; background: var(--accent); color: #fff;
        display: flex; align-items: center; justify-content: center;
        font-family: var(--font-display); font-weight: 700; font-size: 12px; flex: 0 0 auto;
    }
    .sidebar-whoami-info { overflow: hidden; display: flex; flex-direction: column; }
    .sidebar-whoami-nama { color: #fff; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .sidebar-whoami-email { font-size: 10.5px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ---------- Page masthead (mobile navy header) ---------- */
.page-head {
    background: var(--navy); background-image: var(--texture); color: #F3EFE3;
    border-radius: 0 0 22px 22px; padding: 16px 18px 20px;
}
.page-head-row { display: flex; align-items: center; gap: 10px; }
.page-head .back-btn {
    width: 32px; height: 32px; border-radius: 99px; border: 1px solid rgba(243,239,227,.25);
    display: flex; align-items: center; justify-content: center; flex: 0 0 auto; color: #F3EFE3; text-decoration: none; background: transparent;
}
.page-head-titles { flex: 1 1 auto; min-width: 0; }
.page-head-titles h1, .page-head-titles h2 { font-size: 16px; font-weight: 600; color: #fff; line-height: 1.15; margin: 0; }
.page-head-sub { font-size: 11px; color: var(--muted-navy); margin-top: 2px; }
@media (min-width: 880px) { .page-head { display: none; } }

.content { max-width: 900px; margin: 0 auto; padding: 18px 18px 24px; }
@media (min-width: 880px) { .content { padding: 28px 32px 32px; } }
.content-wide { max-width: none; }

.page-container { max-width: 480px; margin: 4rem auto; background: #fff; padding: 2rem; border-radius: 12px; border: 1px solid var(--border); }

/* ---------- Login ---------- */
.login-screen {
    position: fixed; inset: 0; z-index: 60; overflow-y: auto;
    background: var(--navy); background-image: var(--texture);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 40px 24px; color: #F3EFE3;
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-mark {
    width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center; margin: 0 auto 14px;
    font-family: var(--font-display); font-weight: 700; font-size: 20px;
}
.login-brand h1 { color: #fff; font-size: 26px; font-weight: 600; }
.login-brand p { margin: 4px 0 0; font-size: 13px; color: var(--muted-navy); }
.login-card {
    background: var(--bg); color: var(--ink); border-radius: 20px; padding: 26px 24px;
    width: 100%; max-width: 360px; box-shadow: 0 24px 50px rgba(0,0,0,0.28);
}
.login-card h2 { font-size: 19px; }
.login-sub { color: var(--muted); font-size: 12.5px; margin: 0 0 18px; }
.login-label { display: block; font-size: 0.78rem; color: var(--muted); font-weight: 600; margin-bottom: 0.25rem; }
.login-card button { margin-top: 0.4rem; height: 44px; }

input, button, select { font-family: var(--font-body), sans-serif; }

input, button, select {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
}

button {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    font-weight: 700;
}
button:hover { filter: brightness(0.95); }
button:disabled { opacity: 0.6; cursor: default; }

.error-message {
    color: var(--danger);
    background: var(--danger-bg);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.88rem;
}

.upload-box {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    max-width: 560px;
}

.upload-box input[type="file"] {
    width: auto;
}

.import-summary {
    margin-top: 0.75rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
}

table.iuran-detail {
    background: #fdfbf5;
}

.dash-toolbar {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.dash-toolbar select {
    margin-left: 0.4rem;
    padding: 0.4rem;
}
.dash-toolbar input[type="text"] {
    width: auto;
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

/* ---------- Hero stat (dashboard) ---------- */
.stat-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.stat {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem;
}
.stat-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    font-weight: 600;
}
.stat-value {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.1rem;
    margin-top: 0.15rem;
    overflow-wrap: break-word;
}
.stat-ok .stat-value { color: var(--success); }
.stat-warn .stat-value { color: var(--danger); }
.stat-money .stat-value { color: var(--accent); }

.hint {
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.matrix-wrap {
    overflow: auto;
    max-height: 72vh;
    margin-bottom: 1rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding-right: 0.5rem;
}
.matrix-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
    box-shadow: 0 1px 0 var(--border);
}
table.matrix {
    font-size: 0.85rem;
    width: 100%;
}
table.matrix th, table.matrix td {
    white-space: nowrap;
    text-align: center;
    padding: 0.5rem 0.6rem;
}
th.sortable {
    cursor: pointer;
    user-select: none;
}
th.sortable:hover {
    color: var(--accent);
}
.sort-arrow {
    font-size: 0.7em;
    opacity: 0.6;
    margin-left: 2px;
}
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
    flex: 0 0 auto;
}
.icon-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.icon-btn.danger:hover {
    border-color: var(--danger);
    color: var(--danger);
}
.icon-btn-group {
    display: inline-flex;
    gap: 6px;
}
.nowrap-table th, .nowrap-table td {
    white-space: nowrap;
}
.nowrap-table th.wrap, .nowrap-table td.wrap {
    white-space: normal;
}
.kb-badge {
    display: inline-block;
    background: #FDF3D9;
    color: #7A5200;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.76rem;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    white-space: nowrap;
    cursor: pointer;
}
.kb-badge:hover {
    filter: brightness(0.96);
}
.kb-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 1px dashed var(--muted);
    color: var(--muted);
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
}
.kb-add:hover {
    border-color: var(--accent);
    color: var(--accent);
}
table.matrix th:last-child, table.matrix td:last-child {
    padding-right: 1rem;
}
.mode-toggle {
    display: inline-flex;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px;
    gap: 4px;
}
.mode-toggle button {
    padding: 8px 18px;
    border-radius: 999px;
    border: none;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    background: transparent;
    color: var(--ink);
}
.mode-toggle button.active {
    background: var(--accent);
    color: #fff;
}
.laporan-panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.4rem 1.6rem;
}
.rincian-row {
    margin-bottom: 0.75rem;
}
.rincian-row-head {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
}
.rincian-bar {
    height: 7px;
    border-radius: 5px;
    overflow: hidden;
}
.rincian-bar-fill {
    height: 100%;
    border-radius: 5px;
}
.rincian-subtotal {
    display: flex;
    justify-content: space-between;
    padding-top: 0.4rem;
    border-top: 1px solid var(--border);
    font-weight: 700;
    font-size: 0.82rem;
}
table.matrix th.who, table.matrix td.blok, table.matrix td.nama {
    text-align: left;
}
table.matrix td.nama { font-weight: 600; }
table.matrix td.blok { color: var(--muted); font-size: 0.8rem; font-family: var(--font-mono); }

.cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 7px;
    font-family: var(--font-mono);
}
.cell-paid { background: var(--success-bg); color: var(--success); }
.cell-unpaid { background: var(--danger-bg); color: var(--danger); }
.cell-empty { background: #F1EFE6; color: #C7BEA8; }
.cell-clickable { cursor: pointer; }
.cell-clickable:hover { filter: brightness(0.93); }

.lunas-flag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
}
.lunas-flag.penuh { background: var(--success-bg); color: var(--success); }
.lunas-flag.tepat { background: var(--info-bg); color: var(--info); }
.lunas-flag.belum { background: var(--danger-bg); color: var(--danger); }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(31, 42, 84, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}
.modal-box {
    background: #fff;
    border-radius: 14px;
    padding: 1.5rem;
    width: 90%;
    max-width: 360px;
    box-shadow: 0 20px 45px rgba(36,28,21,0.25);
}
.modal-box h4 {
    margin: 0 0 0.15rem;
}
.modal-sub {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0 0 1rem;
}
table.modal-detail {
    width: 100%;
    margin-bottom: 1rem;
}
table.modal-detail td {
    padding: 0.35rem 0;
    border-bottom: none;
}
table.modal-detail td:first-child {
    color: var(--muted);
    width: 40%;
}
table.modal-detail td:last-child {
    font-weight: 600;
    font-family: var(--font-mono);
}
.modal-box button {
    margin-bottom: 0;
}

.modal-box-wide {
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
}
.modal-box-wide input[type="text"] {
    margin-bottom: 0.5rem;
}
.modal-box-wide hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1rem 0;
}
.modal-box-wide button {
    margin-top: 0.5rem;
}

table.jenis-table {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}
.row-inactive {
    color: #B3A88E;
}
.row-inactive a {
    color: inherit;
    opacity: 0.8;
}
.jenis-actions a {
    font-size: 0.8rem;
    margin-right: 0.75rem;
    text-decoration: none;
    font-weight: 600;
}
.jenis-actions .danger-link {
    color: var(--danger);
}

.legend {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--muted);
}
.legend .cell {
    width: 1.1rem;
    height: 1.1rem;
    font-size: 0.7rem;
    margin-right: 0.3rem;
}

.role-card {
    background: #fff;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}
.role-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}
.role-head strong { font-size: 1.05rem; font-family: var(--font-display); }
.badge {
    font-size: 0.68rem;
    font-weight: 700;
    background: var(--info-bg);
    color: var(--info);
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
}
.link-btn {
    width: auto;
    display: inline-block;
    margin: 0 0 0 auto;
    background: none;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 0.6rem 0.9rem;
    font-size: 0.88rem;
    font-weight: 700;
}
.link-btn.danger {
    color: var(--danger);
    border-color: var(--danger);
    margin-left: 0.5rem;
}
.perm-group {
    margin-bottom: 0.5rem;
}
.perm-kategori {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: 0.03em;
    margin-bottom: 0.25rem;
    font-weight: 600;
}
.perm-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    width: auto;
    margin: 0 1rem 0.4rem 0;
    font-size: 0.88rem;
}
.perm-item input[type="checkbox"] {
    width: auto;
    margin: 0;
}

#blazor-error-ui {
    display: none;
    background: #fdf3d9;
    padding: 0.6rem 1rem;
    position: fixed;
    bottom: 0;
    width: 100%;
}

.periode-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.periode-card {
    flex: 1 1 220px;
    background: #fff;
    border: 1px solid var(--border);
    border-left: 4px solid var(--muted);
    border-radius: 12px;
    padding: 0.75rem;
    cursor: pointer;
}
.periode-card.periode-aktif { border-left-color: var(--accent); }
.periode-card.periode-dipilih { outline: 2px solid var(--accent); }
.periode-nama { font-weight: 700; font-family: var(--font-display); }
.periode-tag {
    font-size: 0.68rem;
    font-weight: 600;
    background: #F1EFE6;
    color: #6B6152;
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    margin-left: 0.4rem;
}
.periode-aktif .periode-tag { background: var(--success-bg); color: var(--success); }
.periode-tgl, .periode-jml { color: var(--muted); font-size: 0.82rem; margin-top: 0.15rem; }
.periode-aksi { margin-top: 0.5rem; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.periode-chip {
    font-size: 0.75rem;
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    white-space: nowrap;
}
.chip-baru { background: var(--info-bg); color: var(--info); }
.chip-lama { background: #F1EFE6; color: #6B6152; }
.chip-masuk { background: var(--success-bg); color: var(--success); }
.chip-keluar { background: var(--danger-bg); color: var(--danger); }
.pengurus-list {
    list-style: none;
    margin: 0.4rem 0 0;
    padding: 0;
    font-size: 0.82rem;
    color: #4a3f30;
}
.pengurus-list li { margin: 0.1rem 0; }

/* ---------- Data Warga (card list) ---------- */
.warga-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 1rem; }
.warga-card { background: #fff; border: 1px solid var(--border); border-radius: 13px; padding: 12px 16px; }
.warga-card.inactive { opacity: 0.62; }
.warga-card-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; row-gap: 8px; }
.warga-avatar {
    width: 40px; height: 40px; border-radius: 10px; background: #F1EFE6; color: #6B6152;
    display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
    font-family: var(--font-mono); font-size: 11px; font-weight: 600;
}
.warga-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; row-gap: 4px; }
.warga-row-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.warga-blok { font-family: var(--font-mono); font-size: 12px; color: var(--muted); font-weight: 600; }
.warga-nama { font-weight: 600; font-size: 14.5px; }
.status-pill {
    font-size: 9.5px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
    border-radius: 999px; padding: 2px 8px;
}
.status-pill.on { background: var(--success-bg); color: var(--success); }
.status-pill.off { background: #F1EFE6; color: #6B6152; }
.warga-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.warga-card-actions .link-btn { margin: 0; }
.warga-card-actions button:not(.link-btn) { width: auto; margin: 0; padding: 0.6rem 0.9rem; font-size: 0.88rem; }
.warga-detail { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.warga-edit { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.warga-edit input[type="text"] { width: auto; margin-bottom: 0; }

/* --- Catat pembayaran (Dashboard) --- */
.catat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; margin-bottom: 0.75rem; }
.catat-grid label, .modal-box label { font-size: 0.78rem; color: var(--muted); font-weight: 600; display: flex; flex-direction: column; gap: 0.2rem; }
.catat-grid select, .modal-box select, .modal-box input[type="number"] { width: 100%; }
.catat-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; margin: 0.25rem 0 0.6rem; }
.catat-seg button { width: auto; margin: 0; border: 0; border-radius: 0; background: #fff; color: #6B6152; padding: 0.4rem 0.8rem; font-size: 0.85rem; font-weight: 600; }
.catat-seg button.on { background: var(--accent); color: #fff; font-weight: 700; }
.catat-prev { background: #F1EFE6; border-radius: 9px; padding: 0.6rem 0.75rem; font-size: 0.85rem; margin: 0.6rem 0; }
.catat-notice { background: #fdf3d9; color: #7a5200; border-radius: 9px; padding: 0.6rem 0.75rem; font-size: 0.82rem; margin: 0.6rem 0; }
.catat-check { flex-direction: row !important; align-items: flex-start; gap: 0.5rem !important; margin-top: 0.4rem; color: var(--ink) !important; font-weight: 500 !important; }
.catat-check input { width: auto; margin-top: 0.15rem; }
.catat-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
.catat-actions > button:first-child { width: auto; }
.catat-stamp { color: var(--muted); font-size: 0.78rem; border-top: 1px solid var(--border); padding-top: 0.6rem; margin-top: 0.75rem; }
.riwayat-list { margin: 0 0 0.75rem; padding-left: 1.1rem; font-size: 0.8rem; color: #4a3f30; display: flex; flex-direction: column; gap: 0.2rem; }

/* Cetak (mis. laporan Kas): sembunyikan navigasi, tombol, dan form; sisakan tabel dan ringkasan. */
.print-only { display: none !important; }
/* @page {margin:0} is what actually suppresses Chrome's own header/footer (date, page title, URL) - the browser
   only draws those into page-margin space, so with no margin there's nowhere for them to go. The real page margin
   moves to .content's print padding below so content doesn't print flush against the paper edge. */
@page {
    margin: 0;
}
@media print {
    .no-print, .upload-box, .dash-toolbar, .modal-overlay, .link-btn, .bottom-nav, .sidebar, .page-head, hr { display: none !important; }
    body { background: #fff; }
    .page-container, .content {
        max-width: none !important;
        box-shadow: none;
        padding: 14mm 12mm;
        margin: 0;
        /* Without this, padding-top only renders on the element's first page-fragment, so page 2+ starts flush
           against the paper edge ("top 0") instead of repeating the same margin every page. */
        -webkit-box-decoration-break: clone;
        box-decoration-break: clone;
    }
    table { font-size: 0.8rem; }
    tr { page-break-inside: avoid; }
    .print-only { display: block !important; }
}
.laporan-letterhead {
    display: flex;
    gap: 14px;
    align-items: center;
    border-bottom: 3px double var(--navy);
    padding-bottom: 14px;
    margin-bottom: 18px;
}
.laporan-letterhead-mark {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    background: var(--navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    flex: 0 0 auto;
}
.laporan-letterhead-title { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; }
.laporan-letterhead-sub { font-weight: 700; }
.laporan-letterhead-meta { color: var(--muted); font-size: 0.85rem; }
.laporan-ttd { margin-top: 2.5rem; }
.laporan-ttd-tgl { text-align: right; color: var(--muted); font-size: 0.85rem; margin-bottom: 1rem; }
.laporan-ttd-row { display: flex; justify-content: space-between; max-width: 420px; margin-left: auto; text-align: center; gap: 2rem; }
.laporan-ttd-kolom { flex: 1; }
.laporan-ttd-garis { border-top: 1px solid var(--ink); margin-top: 4rem; }

/* Di HP, form/popup naik dari bawah supaya matrix tidak tertutup penuh. */
@media (max-width: 640px) {
    .modal-overlay { align-items: flex-end; }
    .modal-box { width: 100%; max-width: none; border-radius: 16px 16px 0 0; max-height: 88vh; overflow-y: auto; padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px)); }
}
