/* ==========================================================================
   KALKULATOR IPAL / WWTP — dwik.web.id
   Standar baku mutu: Permen LH/BPLH No. 11 Tahun 2025 (Lampiran I & II)
   Design system: Portoijo 2.0 industrial fintech · dark-mode compliant
   ========================================================================== */

.container-tool-page {
    max-width: 1220px !important;
    margin: 0 auto;
    padding: 0 1.25rem;
    width: 100%;
    box-sizing: border-box;
}

.tool-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto;
    padding: 8px 0 32px;
    box-sizing: border-box;
}

/* Local Design Variables (Inheriting Portoijo & Theme-Aware) */
.tool-container {
    --psg-primary: #1a3c34;
    --psg-primary-dark: #112923;
    --psg-accent: #167c5e;
    --psg-accent-hover: #116249;
    --psg-accent-light: #e6f4ef;
    --psg-accent-border: #b6dfd0;
    --psg-gold: #c8953e;
    --psg-gold-light: #fef9ee;
    --psg-gold-border: #f3deb8;
    --psg-blue: #0284c7;
    --psg-blue-light: #e0f2fe;
    --psg-amber: #d97706;
    --psg-amber-light: #fef3c7;
    --psg-purple: #7c3aed;
    --psg-purple-light: #ede9fe;
    --psg-danger: #dc2626;

    /* Warna state blok hasil — dipilih agar teks putih tetap ≥4,5:1 */
    --psg-state-pass: #167c5e;
    --psg-state-fail: #b3261e;
    --psg-state-warn: #9a5b00;
    --psg-state-idle: #46556b;

    --psg-card: var(--tool-bg-card, #ffffff);
    --psg-card-alt: var(--tool-bg-alt, #f9fafb);
    --psg-surface: var(--tool-surface, #f1f0eb);
    --psg-heading: var(--tool-text, #0f1f1a);
    --psg-text: var(--tool-text, #263530);
    --psg-text-muted: var(--tool-text-muted, #5b6e67);
    --psg-border: var(--tool-border, #e2e5e2);
    --psg-border-strong: var(--tool-border-strong, #cbd2ce);

    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

[data-theme="dark"] .tool-container {
    --psg-primary: #14332b;
    --psg-primary-dark: #0a1b17;
    --psg-accent: #28b58b;
    --psg-accent-hover: #34cba0;
    --psg-accent-light: rgba(40, 181, 139, 0.14);
    --psg-accent-border: rgba(40, 181, 139, 0.32);
    --psg-gold: #e0ac53;
    --psg-gold-light: rgba(224, 172, 83, 0.12);
    --psg-gold-border: rgba(224, 172, 83, 0.3);
    --psg-blue: #38bdf8;
    --psg-blue-light: rgba(56, 189, 248, 0.12);
    --psg-amber: #fbbf24;
    --psg-amber-light: rgba(251, 191, 36, 0.12);
    --psg-purple: #a78bfa;
    --psg-purple-light: rgba(167, 139, 250, 0.12);
    --psg-danger: #f87171;

    --psg-state-pass: #0f6b52;
    --psg-state-fail: #8f1d17;
    --psg-state-warn: #7a4600;
    --psg-state-idle: #33405a;

    --psg-card: #172521;
    --psg-card-alt: #1c2c27;
    --psg-surface: #131f1c;
    --psg-heading: #f0f6f4;
    --psg-text: #d1dfda;
    --psg-text-muted: #8ea59d;
    --psg-border: #253832;
    --psg-border-strong: #334d45;
}

/* ── 1. Hero: judul, watermark, badge ── */
.ipal-hero {
    position: relative;
    text-align: center;
    padding: 1.35rem 0 1.1rem;
    border-bottom: 1px solid var(--psg-border);
    margin-bottom: 1.35rem;
    overflow: hidden;
}
.ipal-watermark {
    position: absolute;
    top: -18px;
    right: -14px;
    width: 190px;
    height: 190px;
    opacity: 0.06;
    pointer-events: none;
    color: var(--psg-accent);
}
[data-theme="dark"] .ipal-watermark { opacity: 0.09; }
.ipal-hero h1 {
    font-size: clamp(1.45rem, 1.05rem + 1.4vw, 2.05rem);
    line-height: 1.22;
    font-weight: 800;
    color: var(--psg-heading);
    margin: 0.35rem auto 0.55rem;
    max-width: 24ch;
    overflow-wrap: anywhere;
}
.ipal-hero p {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--psg-text-muted);
    max-width: 74ch;
    margin: 0 auto;
}
.ipal-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 0.85rem;
}
.ipal-chip {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--psg-accent-light);
    color: var(--psg-accent-hover);
    border: 1px solid var(--psg-accent-border);
}
[data-theme="dark"] .ipal-chip { color: #7fe3c2; }

/* Direct answer capsule + formula box */
.ipal-answer {
    background: var(--psg-card);
    border: 1px solid var(--psg-border);
    border-left: 4px solid var(--psg-accent);
    border-radius: 12px;
    padding: 0.95rem 1.1rem;
    margin-bottom: 1rem;
    font-size: 0.86rem;
    line-height: 1.7;
    color: var(--psg-text);
}
.ipal-answer strong { color: var(--psg-heading); }
.ipal-formula {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    align-items: center;
    justify-content: space-between;
    background: var(--psg-surface);
    border: 1px solid var(--psg-border);
    border-radius: 10px;
    padding: 0.7rem 0.95rem;
    margin-bottom: 1.1rem;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    color: var(--psg-text);
}
.ipal-formula span.k { color: var(--psg-accent-hover); font-weight: 700; }
[data-theme="dark"] .ipal-formula span.k { color: #7fe3c2; }

/* ── 2. Dua kolom: 58% input / 42% hasil sticky ── */
.ipal-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.35rem;
    align-items: start;
}
@media (min-width: 1024px) {
    .ipal-workspace {
        grid-template-columns: minmax(0, 1.45fr) minmax(0, 1.05fr);
        gap: 1.6rem;
    }
}
.ipal-panel {
    background: var(--psg-card);
    border: 1px solid var(--psg-border);
    border-radius: 16px;
    padding: 1.15rem 1.2rem 1.25rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    min-width: 0;
}
.ipal-result-sticky { min-width: 0; }
@media (min-width: 1024px) {
    .ipal-result-sticky {
        position: sticky;
        top: 76px;
    }
}

/* Preset pills */
.ipal-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0.35rem 0 1.1rem;
}
.ipal-preset {
    font-size: 0.73rem;
    font-weight: 700;
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid var(--psg-accent-border);
    background: var(--psg-accent-light);
    color: var(--psg-accent-hover);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
[data-theme="dark"] .ipal-preset { color: #7fe3c2; }
.ipal-preset:hover {
    background: var(--psg-accent);
    color: #fff;
    transform: translateY(-1px);
}

/* Section & field */
.ipal-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--psg-heading);
    margin: 1.15rem 0 0.65rem;
}
.ipal-section-title .n {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--psg-accent-light);
    color: var(--psg-accent-hover);
    font-size: 0.72rem;
    font-weight: 800;
}
[data-theme="dark"] .ipal-section-title .n { color: #7fe3c2; }
.ipal-section-hint {
    font-size: 0.76rem;
    color: var(--psg-text-muted);
    margin: -0.35rem 0 0.7rem;
    line-height: 1.55;
}
.ipal-grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem;
}
@media (max-width: 640px) {
    .ipal-grid-2 { grid-template-columns: minmax(0, 1fr); }
}
.ipal-field label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--psg-text);
    margin-bottom: 4px;
}
.ipal-field input,
.ipal-field select {
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem 0.65rem;
    font-size: 0.86rem;
    font-family: inherit;
    color: var(--psg-heading);
    background: var(--psg-card-alt);
    border: 1px solid var(--psg-border-strong);
    border-radius: 8px;
    min-width: 0;
}
.ipal-field input:focus,
.ipal-field select:focus {
    outline: none;
    border-color: var(--psg-accent);
    box-shadow: 0 0 0 3px var(--psg-accent-light);
}
.ipal-field .unit {
    font-size: 0.72rem;
    color: var(--psg-text-muted);
    font-weight: 600;
}

/* ── 3. Tabel parameter (input multi-baris) ── */
.ipal-param-wrap {
    border: 1px solid var(--psg-border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.ipal-param {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.ipal-param th,
.ipal-param td {
    padding: 0.4rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--psg-border);
    vertical-align: middle;
    min-width: 0;
}
.ipal-param thead th {
    background: var(--psg-surface);
    color: var(--psg-text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 800;
}
.ipal-param tbody tr:last-child td { border-bottom: none; }
.ipal-param .p-name {
    font-weight: 700;
    color: var(--psg-heading);
    font-size: 0.8rem;
}
.ipal-param .p-name small {
    display: block;
    font-weight: 600;
    color: var(--psg-text-muted);
    font-size: 0.68rem;
}
.ipal-param input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 0.35rem 0.45rem;
    font-size: 0.82rem;
    font-family: inherit;
    color: var(--psg-heading);
    background: var(--psg-card-alt);
    border: 1px solid var(--psg-border-strong);
    border-radius: 6px;
}
.ipal-param input:focus {
    outline: none;
    border-color: var(--psg-accent);
}
.ipal-param col.c-name { width: 38%; }
.ipal-param col.c-in { width: 31%; }
.ipal-param col.c-out { width: 31%; }
@media (max-width: 520px) {
    .ipal-param thead { display: none; }
    .ipal-param, .ipal-param tbody, .ipal-param tr, .ipal-param td { display: block; width: 100%; }
    .ipal-param tr {
        border-bottom: 1px solid var(--psg-border);
        padding: 0.5rem 0;
    }
    .ipal-param td {
        border: none;
        padding: 0.2rem 0.6rem;
        display: grid;
        grid-template-columns: 46% minmax(0, 1fr);
        align-items: center;
        gap: 0.5rem;
    }
    .ipal-param td::before {
        content: attr(data-label);
        font-size: 0.7rem;
        font-weight: 700;
        color: var(--psg-text-muted);
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }
    .ipal-param td.p-cell::before { content: ''; }
    .ipal-param td.p-cell {
        display: block;
        padding-bottom: 0.15rem;
    }
    .ipal-param .p-name { font-size: 0.85rem; }
    .ipal-param col { width: auto; }
}

/* Batas baku mutu kustom */
.ipal-custom-limits {
    display: none;
    border: 1px dashed var(--psg-accent-border);
    border-radius: 10px;
    padding: 0.75rem;
    background: var(--psg-accent-light);
    margin-bottom: 0.75rem;
}
.ipal-custom-limits.show { display: block; }
.ipal-custom-limits h4 {
    margin: 0 0 0.55rem;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--psg-heading);
}
.ipal-custom-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 0.5rem;
}
.ipal-custom-grid input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 0.35rem 0.45rem;
    font-size: 0.8rem;
    color: var(--psg-heading);
    background: var(--psg-card);
    border: 1px solid var(--psg-border-strong);
    border-radius: 6px;
}
.ipal-custom-grid label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--psg-text-muted);
    display: block;
    margin-bottom: 2px;
}

/* ── 4. Panel hasil ── */
.ipal-hero-result {
    border-radius: 12px;
    padding: 0.95rem 1.1rem;
    color: #fff;
    background: var(--psg-state-pass);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}
.ipal-hero-result.is-fail { background: var(--psg-state-fail); }
.ipal-hero-result.is-warn { background: var(--psg-state-warn); }
.ipal-hero-result.is-idle { background: var(--psg-state-idle); }
.ipal-hero-result .lbl {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.92;
    font-weight: 700;
}
.ipal-hero-result .big {
    font-family: var(--font-mono);
    font-size: clamp(1.5rem, 1.2rem + 1.1vw, 1.95rem);
    font-weight: 800;
    line-height: 1.15;
}
.ipal-hero-result .sub {
    font-size: 0.76rem;
    font-weight: 600;
    opacity: 0.95;
}
.ipal-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 9px;
    border-radius: 999px;
    background: #fff;
    color: #14532d;
}
.ipal-hero-result.is-fail .ipal-pill { color: #b91c1c; }
.ipal-hero-result.is-warn .ipal-pill { color: #b45309; }
.ipal-hero-result.is-idle .ipal-pill { color: #334155; }

.ipal-kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
    margin-bottom: 0.85rem;
}
.ipal-kpi {
    background: var(--psg-card-alt);
    border: 1px solid var(--psg-border);
    border-left: 3px solid var(--psg-accent);
    border-radius: 9px;
    padding: 0.55rem 0.65rem;
    min-width: 0;
}
.ipal-kpi.b-blue { border-left-color: var(--psg-blue); }
.ipal-kpi.b-amber { border-left-color: var(--psg-amber); }
.ipal-kpi.b-purple { border-left-color: var(--psg-purple); }
.ipal-kpi .k {
    font-size: 0.64rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--psg-text-muted);
}
.ipal-kpi .v {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 800;
    color: var(--psg-heading);
    margin-top: 2px;
    overflow-wrap: anywhere;
}
.ipal-kpi .s {
    font-size: 0.66rem;
    color: var(--psg-text-muted);
    margin-top: 1px;
}

/* Tabel hasil per parameter */
.ipal-results-wrap {
    border: 1px solid var(--psg-border);
    border-radius: 10px;
    overflow-x: auto;
    margin-bottom: 0.75rem;
}
.ipal-results {
    width: 100%;
    min-width: 380px;
    border-collapse: collapse;
    font-size: 0.74rem;
}
.ipal-results th,
.ipal-results td {
    padding: 0.36rem 0.45rem;
    border-bottom: 1px solid var(--psg-border);
    text-align: right;
    white-space: nowrap;
}
.ipal-results th:first-child,
.ipal-results td:first-child { text-align: left; }
.ipal-results thead th {
    background: var(--psg-surface);
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--psg-text-muted);
    font-weight: 800;
}
.ipal-results tbody tr:last-child td { border-bottom: none; }
.ipal-results td.num { font-family: var(--font-mono); }
.ipal-results .bad { color: var(--psg-danger); font-weight: 800; }
.ipal-results .good { color: var(--psg-accent-hover); font-weight: 700; }
[data-theme="dark"] .ipal-results .good { color: #34d399; }
.ipal-results .na { color: var(--psg-text-muted); font-weight: 600; }

/* Di ponsel tabel hasil jadi kartu bertumpuk — kolom Status tidak tersembunyi di balik scroll */
@media (max-width: 520px) {
    .ipal-results-wrap { overflow-x: visible; border: none; }
    .ipal-results { min-width: 0; display: block; }
    .ipal-results thead { display: none; }
    .ipal-results tbody { display: block; }
    .ipal-results tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.3rem 0.6rem;
        border: 1px solid var(--psg-border);
        border-radius: 9px;
        padding: 0.55rem 0.65rem;
        margin-bottom: 0.5rem;
        background: var(--psg-card-alt);
    }
    .ipal-results td {
        display: flex;
        justify-content: space-between;
        gap: 0.4rem;
        border: none;
        padding: 0;
        text-align: right;
        white-space: normal;
    }
    .ipal-results td::before {
        content: attr(data-label);
        font-size: 0.64rem;
        font-weight: 700;
        color: var(--psg-text-muted);
        text-transform: uppercase;
        letter-spacing: 0.03em;
        text-align: left;
    }
    .ipal-results td:first-child {
        grid-column: 1 / -1;
        font-weight: 800;
        color: var(--psg-heading);
        text-align: left;
    }
    .ipal-results td:first-child::before { content: ''; }
}

.ipal-notes {
    list-style: none;
    margin: 0 0 0.85rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.ipal-notes li {
    font-size: 0.76rem;
    line-height: 1.55;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    background: var(--psg-amber-light);
    border: 1px solid var(--psg-gold-border);
    color: var(--psg-text);
}
.ipal-notes li.ok {
    background: var(--psg-accent-light);
    border-color: var(--psg-accent-border);
}

/* Canvas komparasi */
.ipal-chart-card {
    border: 1px solid var(--psg-border);
    border-radius: 10px;
    padding: 0.7rem;
    margin-bottom: 0.9rem;
    background: var(--psg-card-alt);
}
.ipal-chart-card h4 {
    margin: 0 0 0.45rem;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--psg-text-muted);
}
.ipal-chart-card canvas {
    display: block;
    width: 100%;
    height: auto;
}

/* ── 5. Bar aksi 7-in-1 ── */
.ipal-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
}
.ipal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.6rem 0.9rem;
    border-radius: 9px;
    border: 1px solid var(--psg-border-strong);
    background: var(--psg-card-alt);
    color: var(--psg-heading);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    min-width: 0;
}
.ipal-btn:hover {
    border-color: var(--psg-accent);
    color: var(--psg-accent-hover);
}
.ipal-btn.primary {
    background: var(--psg-accent);
    border-color: var(--psg-accent);
    color: #fff;
}
.ipal-btn.primary:hover { background: var(--psg-accent-hover); color: #fff; }
.ipal-actions-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}
@media (max-width: 420px) {
    .ipal-actions-2 { grid-template-columns: minmax(0, 1fr); }
}

/* ── 6. Modal, A4 & toast ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 22, 18, 0.68);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal-dialog {
    background: var(--psg-card);
    border: 1px solid var(--psg-border-strong);
    border-radius: 16px;
    max-width: 760px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
    overflow: hidden;
}
.modal-head {
    padding: 1rem 1.25rem;
    background: var(--psg-surface);
    border-bottom: 1px solid var(--psg-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}
.modal-foot {
    padding: 0.85rem 1.25rem;
    background: var(--psg-surface);
    border-top: 1px solid var(--psg-border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
}
.modal-close {
    border: 1px solid var(--psg-border-strong);
    background: var(--psg-card);
    color: var(--psg-heading);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.9rem;
    cursor: pointer;
}
.modal-label {
    display: block;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--psg-text);
    margin-bottom: 3px;
}
.modal-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem 0.65rem;
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--psg-heading);
    background: var(--psg-card-alt);
    border: 1px solid var(--psg-border-strong);
    border-radius: 8px;
}

.a4-paper {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 2rem;
    font-family: inherit;
    font-size: 0.82rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.a4-paper h2 {
    font-size: 1.02rem;
    margin: 0;
    color: #0f172a;
    letter-spacing: 0.01em;
}
.a4-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 2.5px solid #1a3c34;
    padding-bottom: 0.7rem;
    margin-bottom: 1rem;
}
.a4-head .meta {
    font-size: 0.72rem;
    color: #475569;
    text-align: right;
    line-height: 1.5;
}
.a4-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.76rem;
    margin-bottom: 1rem;
}
.a4-table th,
.a4-table td {
    border: 1px solid #cbd5e1;
    padding: 0.4rem 0.55rem;
    text-align: left;
}
.a4-table th {
    background: #f1f5f9;
    font-weight: 700;
    color: #0f172a;
}
.a4-table td.num {
    text-align: right;
    font-family: var(--font-mono);
}
.a4-verdict {
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    font-weight: 800;
    font-size: 0.82rem;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    margin-bottom: 1rem;
}
.a4-sign {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    margin-top: 2rem;
    font-size: 0.76rem;
    color: #334155;
}
.a4-sign .col { flex: 1; }
.a4-sign .space { height: 3.1rem; }
.a4-foot {
    margin-top: 1.25rem;
    padding-top: 0.5rem;
    border-top: 1px dashed #cbd5e1;
    font-size: 0.64rem;
    color: #64748b;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: min(92vw, 360px);
}
.toast-msg {
    background: var(--psg-primary);
    color: #ffffff;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideUp 0.2s ease;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media print {
    body * { visibility: hidden; }
    #a4PrintArea, #a4PrintArea * { visibility: visible; }
    #a4PrintArea {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        border: none;
        box-shadow: none;
        padding: 0;
    }
}

/* ── 7. FAQ akordeon (dark-mode compliant) ── */
.tool-faq { margin-top: 0.5rem; }
.tool-faq h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--psg-heading);
    margin: 0.25rem 0 1rem;
}
.tool-faq-item {
    border: 1px solid var(--psg-border);
    border-radius: 10px;
    margin-bottom: 0.65rem;
    overflow: hidden;
    background: var(--psg-card-alt);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.tool-faq-item.open {
    border-color: var(--psg-accent);
    background: var(--psg-card);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}
.tool-faq-q {
    width: 100%;
    padding: 0.95rem 1.15rem;
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--psg-heading);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-family: inherit;
}
.tool-faq-q:hover { color: var(--psg-accent); }
.tool-faq-q::after {
    content: '+';
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--psg-accent);
    line-height: 1;
}
.tool-faq-item.open .tool-faq-q::after { content: '−'; }
.tool-faq-a {
    display: none;
    padding: 0.85rem 1.15rem 1.15rem;
    font-size: 0.86rem;
    line-height: 1.68;
    color: var(--psg-text);
    border-top: 1px solid var(--psg-border);
}
.tool-faq-item.open .tool-faq-a { display: block; }
.tool-faq-a code {
    background: var(--psg-surface);
    color: var(--psg-accent-hover);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}
[data-theme="dark"] .tool-faq-a code { color: #34d399; }

/* ── 8. Tabel rujukan & blok informasi bawah ── */
.ipal-ref-wrap {
    overflow-x: auto;
    border: 1px solid var(--psg-border);
    border-radius: 10px;
    margin-bottom: 1.1rem;
}
.ipal-ref {
    width: 100%;
    min-width: 460px;
    border-collapse: collapse;
    font-size: 0.78rem;
}
.ipal-ref th,
.ipal-ref td {
    border-bottom: 1px solid var(--psg-border);
    padding: 0.45rem 0.6rem;
    text-align: left;
}
.ipal-ref thead th {
    background: var(--psg-surface);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 800;
    color: var(--psg-text-muted);
}
.ipal-ref td.num {
    text-align: right;
    font-family: var(--font-mono);
}
.ipal-ref tbody tr:last-child td { border-bottom: none; }
.ipal-ref caption {
    caption-side: top;
    text-align: left;
    padding: 0.55rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--psg-heading);
    background: var(--psg-card-alt);
}

.ipal-blend {
    border: 1px solid var(--psg-border);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    margin: 1.2rem 0;
    background: var(--psg-card);
}
.ipal-blend h3 {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--psg-heading);
}
.ipal-blend p.hint {
    margin: 0 0 0.75rem;
    font-size: 0.78rem;
    color: var(--psg-text-muted);
    line-height: 1.6;
}
.ipal-blend-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
}
@media (min-width: 760px) {
    .ipal-blend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.ipal-blend-card {
    border: 1px solid var(--psg-border);
    border-radius: 10px;
    padding: 0.7rem 0.8rem;
    background: var(--psg-card-alt);
    min-width: 0;
}
.ipal-blend-card h4 {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--psg-heading);
}
.ipal-blend-rows {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
}
.ipal-blend-rows label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--psg-text-muted);
    display: block;
    margin-bottom: 2px;
}
.ipal-blend-rows input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 0.35rem 0.45rem;
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--psg-heading);
    background: var(--psg-card);
    border: 1px solid var(--psg-border-strong);
    border-radius: 6px;
}
.ipal-blend-out {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--psg-text);
    line-height: 1.6;
}
.ipal-blend-out .cmax {
    font-family: var(--font-mono);
    font-weight: 800;
    color: var(--psg-accent-hover);
}
[data-theme="dark"] .ipal-blend-out .cmax { color: #34d399; }

.ipal-cross-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.7rem;
    margin-top: 0.75rem;
}
.ipal-cross {
    display: block;
    text-decoration: none;
    border: 1px solid var(--psg-border);
    border-radius: 10px;
    padding: 0.7rem 0.8rem;
    background: var(--psg-card-alt);
    color: var(--psg-text);
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.ipal-cross:hover { border-color: var(--psg-accent); transform: translateY(-1px); }
.ipal-cross strong {
    display: block;
    font-size: 0.82rem;
    color: var(--psg-heading);
    margin-bottom: 2px;
}
.ipal-cross span { font-size: 0.72rem; color: var(--psg-text-muted); }

.ipal-legal {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.ipal-legal li {
    font-size: 0.82rem;
    line-height: 1.65;
    color: var(--psg-text);
    background: var(--psg-card-alt);
    border: 1px solid var(--psg-border);
    border-left: 3px solid var(--psg-gold);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
}
.ipal-legal strong { color: var(--psg-heading); }
