* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    background-color: #f1f5f9;
    color: #1e293b;
}

.hidden {
    display: none !important;
}

/* =========================================================
   HALAMAN LOGIN e-KP4 SMKN 1 WAKATOBI (SPLIT-CARD UI)
   ========================================================= */
.login-page-bg {
    min-height: 100vh;
    width: 100%;
    background: linear-gradient(135deg, #e8f2fe 0%, #f8fbff 50%, #e3effd 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    position: relative;
    overflow: hidden;
}

.bg-wave-top-right {
    position: absolute;
    top: -120px;
    right: -120px;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #2563eb 0%, #0284c7 65%, transparent 72%);
    opacity: 0.85;
    pointer-events: none;
}

.bg-wave-bottom-left {
    position: absolute;
    bottom: -150px;
    left: -130px;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    background: radial-gradient(circle at 60% 40%, #1d4ed8 0%, #0369a1 60%, transparent 72%);
    opacity: 0.85;
    pointer-events: none;
}

.bg-dots-top-left {
    position: absolute;
    top: 18px;
    left: 18px;
    width: 140px;
    height: 90px;
    background-image: radial-gradient(#93c5fd 2px, transparent 2px);
    background-size: 16px 16px;
    pointer-events: none;
}

.bg-dots-bottom-right {
    position: absolute;
    bottom: 18px;
    right: 18px;
    width: 160px;
    height: 100px;
    background-image: radial-gradient(#93c5fd 2px, transparent 2px);
    background-size: 16px 16px;
    pointer-events: none;
}

.login-card-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 980px;
    min-height: 560px;
    background: #ffffff;
    border-radius: 26px;
    box-shadow: 0 22px 50px rgba(15, 42, 92, 0.16);
    border: 2px solid rgba(255, 255, 255, 0.9);
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    overflow: hidden;
}

/* PANEL KIRI: HERO */
.login-hero-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background:
        linear-gradient(180deg, rgba(14, 116, 214, 0.55) 0%, rgba(12, 74, 158, 0.45) 52%, rgba(8, 47, 115, 0.94) 100%),
        url("https://nbwpnhshhpfqtmbwewgk.supabase.co/storage/v1/object/public/media-sekolah/gedung_sekolah.jpeg") center/cover no-repeat,
        linear-gradient(160deg, #0ea5e9 0%, #1d4ed8 55%, #0f296b 100%);
    color: #ffffff;
    overflow: hidden;
}

.hero-top-ribbon {
    position: absolute;
    top: -55px;
    left: -40px;
    width: 290px;
    height: 130px;
    background: linear-gradient(135deg, #0b3b91 0%, #1d4ed8 75%);
    border-bottom: 10px solid #facc15;
    border-radius: 0 0 100% 0;
    transform: rotate(-14deg);
    z-index: 2;
}

.hero-center-content {
    position: relative;
    z-index: 3;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 46px 24px 16px;
}

.hero-logo-box {
    width: 196px;
    height: 196px;
    background: #ffffff;
    border-radius: 36px;
    padding: 12px;
    box-shadow: 0 14px 32px rgba(8, 35, 92, 0.35), 0 0 0 4px rgba(255, 255, 255, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-logo-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 26px;
}

.hero-bottom-banner {
    position: relative;
    z-index: 3;
    text-align: center;
    padding: 26px 24px 36px;
    background: linear-gradient(180deg, rgba(11, 55, 138, 0.85) 0%, #092b73 100%);
    border-top-left-radius: 40% 24px;
    border-top-right-radius: 40% 24px;
    border-bottom: 10px solid #facc15;
}

.hero-bottom-banner h2 {
    margin: 0;
    font-size: 1.65rem;
    font-weight: 800;
    font-style: italic;
    letter-spacing: 0.6px;
    color: #ffffff;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.hero-gold-line {
    height: 3px;
    width: 86%;
    max-width: 340px;
    margin: 10px auto 12px;
    background: linear-gradient(90deg, transparent, #facc15, transparent);
    border-radius: 2px;
}

.hero-bottom-banner p {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 700;
    font-style: italic;
    line-height: 1.4;
    color: #f8fafc;
}

/* PANEL KANAN: FORM LOGIN */
.login-form-panel {
    background: #fcfdff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 36px 40px;
}

.login-form-inner {
    width: 100%;
    max-width: 360px;
    text-align: center;
}

.login-tutwuri-logo {
    width: 82px;
    height: 82px;
    object-fit: contain;
    margin: 0 auto 12px;
    display: block;
}

.login-form-inner h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 800;
    color: #0b3578;
}

.login-subtitle {
    margin: 8px 0 22px;
    font-size: 0.92rem;
    line-height: 1.45;
    color: #1e3a6e;
    font-weight: 500;
}

.login-alert {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 0.84rem;
    font-weight: 600;
    margin-bottom: 14px;
    text-align: left;
}

.login-input-group {
    position: relative;
    margin-bottom: 14px;
}

.login-input-group input {
    width: 100%;
    height: 48px;
    padding: 0 42px 0 44px;
    border: 1.5px solid #cbd5e1;
    border-radius: 11px;
    font-size: 0.96rem;
    color: #0f172a;
    background: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input-group input::placeholder {
    color: #94a3b8;
}

.login-input-group input:focus {
    outline: none;
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14);
}

.input-icon-left {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #0b3578;
    display: flex;
    align-items: center;
}

.btn-toggle-pass {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #334155;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
}

.login-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 4px 2px 20px;
    font-size: 0.85rem;
}

.remember-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #0b3578;
    font-weight: 600;
    cursor: pointer;
}

.remember-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #0b3578;
    cursor: pointer;
}

.forgot-link {
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 600;
}

.forgot-link:hover {
    text-decoration: underline;
}

.btn-login-submit {
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 11px;
    background: linear-gradient(180deg, #1d63dc 0%, #093d9c 100%);
    color: #ffffff;
    font-size: 1.02rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    box-shadow: 0 8px 18px rgba(13, 68, 168, 0.28);
    transition: transform 0.15s, opacity 0.2s;
}

.btn-login-submit:hover {
    opacity: 0.95;
}

.btn-login-submit:active {
    transform: scale(0.99);
}

.btn-login-submit:disabled {
    opacity: 0.7;
    cursor: wait;
}

.login-footer-school {
    margin-top: 26px;
}

.school-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #0b3578;
    font-size: 0.85rem;
    font-weight: 700;
}

.school-divider::before,
.school-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #cbd5e1;
}

.school-motto {
    margin: 6px 0 0;
    font-size: 0.82rem;
    font-style: italic;
    font-weight: 600;
    color: #1d4ed8;
}

/* RESPONSIF HALAMAN LOGIN DI HP */
@media (max-width: 820px) {
    .login-card-container {
        grid-template-columns: 1fr;
        max-width: 440px;
        min-height: auto;
    }

    .hero-center-content {
        padding: 32px 20px 14px;
    }

    .hero-logo-box {
        width: 136px;
        height: 136px;
        border-radius: 26px;
    }

    .hero-bottom-banner {
        padding: 18px 16px 22px;
    }

    .hero-bottom-banner h2 {
        font-size: 1.25rem;
    }

    .hero-bottom-banner p {
        font-size: 0.82rem;
    }

    .login-form-panel {
        padding: 26px 22px 30px;
    }

    .login-tutwuri-logo {
        width: 66px;
        height: 66px;
    }

    .login-form-inner h1 {
        font-size: 1.45rem;
    }
}

/* =========================================================
   APLIKASI UTAMA FORMULIR KP4
   ========================================================= */
.app-header {
    background: #0f172a;
    color: #fff;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
    padding: 2px;
}

.app-header h1 {
    margin: 0;
    font-size: 1.05rem;
}

.app-header p {
    margin: 2px 0 0;
    font-size: 0.78rem;
    color: #cbd5e1;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn {
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn:active {
    opacity: 0.85;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-success {
    background: #16a34a;
    color: #fff;
}

.btn-warning {
    background: #d97706;
    color: #fff;
}

.btn-secondary {
    background: #334155;
    color: #fff;
}

.btn-logout {
    background: #dc2626;
    color: #fff;
    padding: 8px 12px;
    font-size: 0.82rem;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
    padding: 5px 10px;
    font-size: 0.78rem;
}

.btn-sm {
    padding: 7px 12px;
    font-size: 0.82rem;
}

.notif {
    max-width: 780px;
    margin: 12px auto 0;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
}

.notif.hidden {
    display: none;
}

.notif.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.notif.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.single-column-main {
    max-width: 780px;
    margin: 0 auto;
    padding: 16px 14px 90px;
}

.card {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.card h3 {
    margin: 0 0 14px;
    font-size: 0.98rem;
    color: #0f172a;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 0.83rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: #334155;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px;
    background: #fff;
    color: #0f172a;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.input-locked {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
    font-weight: 600;
    cursor: not-allowed;
}

.hint {
    display: block;
    margin-top: 4px;
    font-size: 0.76rem;
    color: #64748b;
}

.masa-kerja-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.masa-kerja-box input {
    width: 72px;
    text-align: center;
}

.masa-kerja-box span {
    font-size: 0.88rem;
    font-weight: 600;
}

.keluarga-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.keluarga-cards-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.keluarga-item-card {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px;
    background: #f8fafc;
}

.keluarga-item-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed #cbd5e1;
}

.badge-peran {
    font-size: 0.8rem;
    font-weight: 700;
    color: #1e3a8a;
    background: #dbeafe;
    padding: 3px 8px;
    border-radius: 5px;
}

.keluarga-item-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.keluarga-item-grid .full-span {
    grid-column: 1 / -1;
}

.keluarga-item-grid label {
    display: block;
    font-size: 0.76rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 3px;
}

.keluarga-item-grid input,
.keluarga-item-grid select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 15px;
    background: #fff;
}

.mobile-bottom-bar {
    display: none;
}

.print-only {
    display: none;
}

/* RESPONSIF KHUSUS HP (<= 768px) */
@media (max-width: 768px) {
    .desktop-only {
        display: none;
    }

    .form-grid-2,
    .keluarga-item-grid {
        grid-template-columns: 1fr;
    }

    .notif {
        margin: 12px 14px 0;
    }

    .mobile-bottom-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #ffffff;
        border-top: 1px solid #cbd5e1;
        padding: 10px 12px;
        gap: 8px;
        z-index: 60;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    }

    .mobile-bottom-bar .btn {
        flex: 1;
        padding: 12px 8px;
        font-size: 0.88rem;
    }
}

/* FORMAT CETAK DOKUMEN KP4 RESMI (F4 1 HALAMAN) */
@media print {
    @page {
        size: 215mm 330mm;
        margin: 8mm 12mm;
    }

    body {
        background: #fff;
    }

    .no-print {
        display: none !important;
    }

    .print-only {
        display: block !important;
    }

    .surat-kp4 {
        width: 100%;
        min-height: auto;
        padding: 0;
        box-shadow: none;
        font-family: "Times New Roman", Times, serif;
        font-size: 10.5pt;
        line-height: 1.28;
        color: #000;
    }

    .kop-surat img {
        width: 100%;
        height: auto;
        display: block;
        margin-bottom: 6px;
    }

    .judul-surat {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
        font-weight: bold;
        font-size: 11pt;
        margin: 6px 0 8px;
        padding-bottom: 5px;
        line-height: 1.3;
        border-bottom: 3px double #000;
        overflow-wrap: break-word;
    }

    .pembuka-surat {
        margin: 0 0 4px;
    }

    .tabel-identitas {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 4px;
    }

    .tabel-identitas td {
        vertical-align: top;
        padding: 1.5px 2px;
    }

    .col-no {
        width: 22px;
    }

    .col-label {
        width: 215px;
    }

    .col-sep {
        width: 12px;
        text-align: center;
    }

    .poin-13 {
        margin-top: 2px;
    }

    .tabel-sub13 {
        width: 100%;
        border-collapse: collapse;
        margin-left: 16px;
    }

    .tabel-sub13 td {
        vertical-align: top;
        padding: 1.5px 2px;
    }

    .sub-huruf {
        width: 20px;
    }

    .sub-teks {
        width: 340px;
    }

    .tabel-keluarga-cetak {
        width: calc(100% - 34px);
        margin-left: 34px;
        margin-top: 4px;
        margin-bottom: 6px;
        border-collapse: collapse;
        font-size: 9.8pt;
    }

    .tabel-keluarga-cetak th,
    .tabel-keluarga-cetak td {
        border: 1px solid #000;
        padding: 3px 5px;
        vertical-align: middle;
    }

    .tabel-keluarga-cetak th {
        text-align: center;
        font-weight: bold;
    }

    .text-center {
        text-align: center;
    }

    .poin-13e {
        margin-left: 18px;
        margin-bottom: 6px;
    }

    .sub-huruf-inline {
        display: inline-block;
        width: 16px;
    }

    .penutup-surat {
        text-align: justify;
        margin: 6px 0 10px;
    }

    .tabel-ttd {
        width: 100%;
        table-layout: fixed;
        box-sizing: border-box;
        border-collapse: collapse;
        margin-top: 6px;
    }

    .tabel-ttd td {
        vertical-align: top;
        box-sizing: border-box;
    }

    .tabel-ttd td:first-child {
        width: 50%;
        padding-left: 38px;
        padding-right: 12px;
    }

    .tabel-ttd td:last-child {
        width: 50%;
        padding-left: 82px;
    }

    .ruang-ttd {
        height: 52px;
        min-height: 52px;
    }
}
