/* ============================================================
   auth-error-branding.css — HKM Auth + Error Pages
   Phase 1 + Phase 2 Auth Patch — semua selector scoped ke .hkm-auth-page
   atau .hkm-error-page, tidak ada global selector agresif.
   ============================================================ */

/* ----------------------------------------------------------
   BASE PAGE WRAPPER
   Scoped — hanya aktif di dalam .hkm-auth-page / .hkm-error-page
   ---------------------------------------------------------- */
.hkm-auth-page,
.hkm-error-page {
    margin: 0;
    padding: 0;
    /* FIX: gunakan height bukan min-height agar tidak bisa scroll di desktop */
    height: 100dvh;
    overflow: hidden;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #172033;
    background: #f4f7fb;
}

/* ----------------------------------------------------------
   SHELL (grid 2-kolom di desktop)
   ---------------------------------------------------------- */
.hkm-auth-page .hkm-auth-shell,
.hkm-error-page .hkm-error-shell {
    /* FIX: height 100% agar tidak melebihi wrapper */
    height: 100%;
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(0, 76, 255, 0.08), transparent 34rem),
        linear-gradient(135deg, #f8fbff 0%, #edf3fb 100%);
}

/* ----------------------------------------------------------
   BRAND / LEFT PANEL
   ---------------------------------------------------------- */
.hkm-auth-page .hkm-auth-brand-panel,
.hkm-error-page .hkm-error-brand-panel {
    position: relative;
    overflow: hidden;
    height: 100%;
    color: #ffffff;
    /* FIX: gunakan panel kiri login PC.png sebagai background */
    background-image:
        linear-gradient(135deg, rgba(2, 16, 45, 0.82), rgba(0, 41, 112, 0.68)),
        url('/images/auth-construction-bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    isolation: isolate;
}

.hkm-auth-page .hkm-auth-brand-panel::after,
.hkm-error-page .hkm-error-brand-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(90deg, rgba(2, 16, 45, 0.48), rgba(2, 16, 45, 0.06)),
        radial-gradient(circle at 18% 20%, rgba(29, 98, 255, 0.36), transparent 28rem);
}

.hkm-auth-page .hkm-auth-brand-content,
.hkm-error-page .hkm-error-brand-content {
    position: relative;
    z-index: 1;
    display: flex;
    height: 100%;
    flex-direction: column;
    justify-content: center;
    gap: clamp(1rem, 2vh, 2rem);
    padding: clamp(2rem, 5vw, 5rem);
}

/* ----------------------------------------------------------
   LOGO
   ---------------------------------------------------------- */
.hkm-auth-page .hkm-brand-logo,
.hkm-error-page .hkm-brand-logo {
    display: block;
    width: min(200px, 54vw);
    height: auto;
    object-fit: contain;
}

.hkm-auth-page .hkm-brand-logo-invert,
.hkm-error-page .hkm-brand-logo-invert {
    max-width: 210px;
    padding: 0.65rem 0.9rem;
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 1.25rem 3rem rgba(0, 0, 0, 0.18);
}

/* ----------------------------------------------------------
   BRAND COPY (panel kiri)
   ---------------------------------------------------------- */
.hkm-auth-page .hkm-brand-copy,
.hkm-error-page .hkm-error-brand-content {
    max-width: 36rem;
}

.hkm-auth-page .hkm-brand-kicker,
.hkm-error-page .hkm-brand-kicker,
.hkm-auth-page .hkm-brand-eyebrow,
.hkm-error-page .hkm-brand-eyebrow {
    margin: 0;
    color: #0b35b9;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.hkm-auth-page .hkm-auth-brand-panel .hkm-brand-kicker,
.hkm-error-page .hkm-error-brand-panel .hkm-brand-kicker {
    color: rgba(255, 255, 255, 0.82);
}

.hkm-auth-page .hkm-brand-copy h1,
.hkm-error-page .hkm-error-brand-content h1 {
    max-width: 32rem;
    margin: 0.4rem 0 clamp(0.5rem, 1.5vh, 1.2rem);
    color: #ffffff;
    font-size: clamp(1.6rem, 3vw, 3.2rem);
    font-weight: 800;
    line-height: 1.06;
    letter-spacing: -0.04em;
}

.hkm-auth-page .hkm-brand-main,
.hkm-auth-page .hkm-brand-support,
.hkm-error-page .hkm-error-brand-content p:not(.hkm-brand-kicker) {
    max-width: 34rem;
    margin: 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: clamp(0.88rem, 1.3vw, 1.05rem);
    line-height: 1.68;
}

.hkm-auth-page .hkm-brand-support {
    margin-top: clamp(0.4rem, 1vh, 0.9rem);
    color: rgba(255, 255, 255, 0.72);
}

/* ----------------------------------------------------------
   FORM PANEL (kanan)
   ---------------------------------------------------------- */
.hkm-auth-page .hkm-auth-form-panel,
.hkm-error-page .hkm-error-notice-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    /* FIX: height 100% + overflow auto agar card bisa scroll jika konten panjang
       tapi panel sendiri tidak membesar melewati viewport */
    height: 100%;
    overflow-y: auto;
    padding: clamp(1rem, 3vw, 3rem);
}

/* ----------------------------------------------------------
   LOGIN CARD
   ---------------------------------------------------------- */
.hkm-auth-page .hkm-auth-card,
.hkm-error-page .hkm-error-card {
    width: min(100%, 500px);
    border: 1px solid rgba(135, 150, 175, 0.22);
    border-radius: 1.6rem;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 1.5rem 3.5rem rgba(15, 35, 75, 0.14);
    backdrop-filter: blur(16px);
}

.hkm-auth-page .hkm-auth-card {
    /* FIX: padding lebih kecil agar card tidak terlalu tinggi */
    padding: clamp(1.2rem, 3vh, 2rem) clamp(1.2rem, 3vw, 2rem);
}

.hkm-error-page .hkm-error-card {
    padding: clamp(1.5rem, 4vw, 2.5rem);
}

/* ----------------------------------------------------------
   CARD HEADER
   ---------------------------------------------------------- */
.hkm-auth-page .hkm-auth-card-header,
.hkm-error-page .hkm-error-card-header {
    text-align: center;
}

.hkm-auth-page .hkm-auth-card-header .hkm-brand-logo,
.hkm-error-page .hkm-error-card-header .hkm-brand-logo {
    /* FIX: margin bawah lebih kecil */
    margin: 0 auto clamp(0.5rem, 1.5vh, 0.9rem);
}

.hkm-auth-page .hkm-auth-card-header h2,
.hkm-error-page .hkm-error-card-header h2 {
    margin: 0.15rem 0 0.3rem;
    color: #1c2437;
    font-size: clamp(1.4rem, 2.8vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.hkm-auth-page .hkm-auth-card-header p:not(.hkm-brand-eyebrow),
.hkm-error-page .hkm-error-card-header p:not(.hkm-brand-eyebrow) {
    margin: 0;
    color: #667085;
    font-size: 0.93rem;
    line-height: 1.55;
}

/* ----------------------------------------------------------
   FORM
   ---------------------------------------------------------- */
.hkm-auth-page .hkm-form {
    display: grid;
    /* FIX: gap lebih kecil */
    gap: 0.8rem;
    margin-top: clamp(0.8rem, 2vh, 1.4rem);
}

.hkm-auth-page .hkm-form-group {
    display: grid;
    gap: 0.35rem;
}

.hkm-auth-page .hkm-form-label {
    margin: 0;
    color: #344054;
    font-size: 0.88rem;
    font-weight: 700;
}

.hkm-auth-page .hkm-form-control-wrap {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 3rem;
    border: 1px solid #d9e1ef;
    border-radius: 0.85rem;
    background: #ffffff;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.hkm-auth-page .hkm-form-control-wrap:focus-within {
    border-color: #0b35b9;
    box-shadow: 0 0 0 0.22rem rgba(11, 53, 185, 0.11);
}

.hkm-auth-page .hkm-form-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 2.75rem;
    color: #7a879d;
    font-size: 1rem;
}

.hkm-auth-page .hkm-form-input {
    width: 100%;
    min-width: 0;
    min-height: 2.95rem;
    border: 0;
    outline: 0;
    background: transparent;
    color: #1f2937;
    font-size: 0.95rem;
    font-weight: 500;
}

.hkm-auth-page .hkm-form-input::placeholder {
    color: #98a2b3;
    font-weight: 500;
}

.hkm-auth-page .hkm-form-input-invalid {
    color: #b42318;
}

.hkm-auth-page .hkm-form-group:has(.hkm-form-input-invalid) .hkm-form-control-wrap {
    border-color: #f04438;
    box-shadow: 0 0 0 0.2rem rgba(240, 68, 56, 0.09);
}

.hkm-auth-page .hkm-form-password-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 2.75rem;
    min-height: 2.75rem;
    border: 0;
    border-radius: 0.75rem;
    color: #667085;
    background: transparent;
    cursor: pointer;
}

.hkm-auth-page .hkm-form-password-toggle:focus-visible,
.hkm-auth-page .hkm-form-submit:focus-visible,
.hkm-error-page .hkm-error-primary-action:focus-visible {
    outline: 3px solid rgba(11, 53, 185, 0.22);
    outline-offset: 3px;
}

.hkm-auth-page .hkm-form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.1rem;
}

.hkm-auth-page .hkm-form-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    color: #4b5565;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

.hkm-auth-page .hkm-form-checkbox input {
    width: 1rem;
    height: 1rem;
    accent-color: #0b35b9;
    cursor: pointer;
}

.hkm-auth-page .hkm-form-link {
    color: #0b35b9;
    font-size: 0.88rem;
    font-weight: 800;
    text-decoration: none;
}

.hkm-auth-page .hkm-form-link:hover {
    color: #08298f;
    text-decoration: underline;
}

.hkm-auth-page .hkm-form-submit,
.hkm-error-page .hkm-error-primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 3rem;
    border: 0;
    border-radius: 0.9rem;
    color: #ffffff;
    background: linear-gradient(135deg, #0b35b9, #0227d5);
    box-shadow: 0 0.75rem 1.5rem rgba(3, 39, 213, 0.2);
    font-size: 0.98rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.hkm-auth-page .hkm-form-submit:hover,
.hkm-error-page .hkm-error-primary-action:hover {
    color: #ffffff;
    filter: brightness(1.04);
    transform: translateY(-1px);
    box-shadow: 0 1rem 2rem rgba(3, 39, 213, 0.26);
}

.hkm-auth-page .hkm-form-error {
    margin: 0;
    color: #b42318;
    font-size: 0.82rem;
    font-weight: 700;
}

/* ----------------------------------------------------------
   ALERT / NOTICE
   ---------------------------------------------------------- */
.hkm-auth-page .hkm-form-alert,
.hkm-error-page .hkm-error-alert {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    border-radius: 0.85rem;
    padding: 0.75rem 0.9rem;
    font-size: 0.88rem;
    line-height: 1.5;
}

.hkm-auth-page .hkm-form-alert i,
.hkm-error-page .hkm-error-alert i {
    flex: 0 0 auto;
    margin-top: 0.1rem;
    font-size: 1rem;
}

.hkm-auth-page .hkm-form-alert strong,
.hkm-auth-page .hkm-form-alert span,
.hkm-error-page .hkm-error-alert div {
    display: block;
}

.hkm-auth-page .hkm-form-alert small {
    display: block;
    margin-top: 0.2rem;
}

.hkm-auth-page .hkm-form-alert-success {
    border: 1px solid rgba(18, 183, 106, 0.24);
    color: #027a48;
    background: #ecfdf3;
}

.hkm-auth-page .hkm-form-alert-maintenance,
.hkm-error-page .hkm-error-alert {
    border: 1px solid rgba(240, 68, 56, 0.24);
    color: #b42318;
    background: #fff5f4;
}

.hkm-auth-page .hkm-form-alert-warning {
    border: 1px solid rgba(247, 144, 9, 0.26);
    color: #b54708;
    background: #fffaeb;
}

.hkm-auth-page .hkm-form-alert-danger {
    border: 1px solid rgba(240, 68, 56, 0.26);
    color: #b42318;
    background: #fef3f2;
}

/* ----------------------------------------------------------
   DEMO ACCOUNT
   FIX: collapsed harus compact / subtle, bukan box besar
   ---------------------------------------------------------- */
.hkm-auth-page .hkm-auth-demo {
    /* FIX: hilangkan padding/border box besar, ganti dengan tampilan minimal */
    margin-top: 0.6rem;
    border: none;
    padding: 0;
    background: transparent;
    font-size: 0.84rem;
}

.hkm-auth-page .hkm-auth-demo summary {
    /* FIX: tampil sebagai link kecil, bukan box */
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0;
    color: #667085;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    text-decoration: none;
    transition: color 120ms ease;
}

.hkm-auth-page .hkm-auth-demo summary::-webkit-details-marker {
    display: none;
}

.hkm-auth-page .hkm-auth-demo summary::before {
    content: '▸';
    font-size: 0.65rem;
    color: #98a2b3;
    transition: transform 160ms ease;
}

.hkm-auth-page .hkm-auth-demo[open] summary::before {
    transform: rotate(90deg);
}

.hkm-auth-page .hkm-auth-demo summary:hover {
    color: #344054;
}

.hkm-auth-page .hkm-auth-demo-body {
    /* FIX: max-height + internal scroll saat expanded */
    display: grid;
    gap: 0.35rem;
    max-height: 11rem;
    overflow-y: auto;
    margin-top: 0.5rem;
    border: 1px dashed #c9d6ea;
    border-radius: 0.75rem;
    padding: 0.7rem 0.85rem;
    color: #667085;
    background: #f8fbff;
}

.hkm-auth-page .hkm-auth-demo-body p {
    margin: 0 0 0.2rem;
    font-size: 0.8rem;
    color: #98a2b3;
}

.hkm-auth-page .hkm-auth-demo-body div {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.82rem;
}

/* ----------------------------------------------------------
   CARD FOOTER
   ---------------------------------------------------------- */
.hkm-auth-page .hkm-auth-card-footer,
.hkm-error-page .hkm-error-card-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin-top: 0.85rem;
    color: #667085;
    font-size: 0.85rem;
    font-weight: 700;
}

/* ----------------------------------------------------------
   ERROR 503 SPECIFIC ELEMENTS
   ---------------------------------------------------------- */
.hkm-error-page .hkm-error-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    margin: 0 auto 0.75rem;
    border: 1px solid rgba(240, 68, 56, 0.28);
    border-radius: 1.2rem;
    color: #ef3d32;
    background: #fff5f4;
    font-size: 1.9rem;
}

.hkm-error-page .hkm-error-user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.1rem;
    border: 1px solid #d9e1ef;
    border-radius: 0.95rem;
    padding: 0.9rem;
    background: #f8fbff;
}

.hkm-error-page .hkm-error-user-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    flex: 0 0 auto;
    border-radius: 0.8rem;
    color: #0b35b9;
    background: rgba(11, 53, 185, 0.1);
    font-size: 1.25rem;
}

.hkm-error-page .hkm-error-user-card span,
.hkm-error-page .hkm-error-user-card small {
    display: block;
    color: #667085;
    font-size: 0.82rem;
    font-weight: 700;
}

.hkm-error-page .hkm-error-user-card strong {
    display: block;
    margin: 0.12rem 0;
    color: #1c2437;
    font-size: 0.96rem;
}

.hkm-error-page .hkm-error-actions {
    margin-top: 1.1rem;
}

/* ----------------------------------------------------------
   DESKTOP >= 1024px
   FIX: height: 100% di semua panel, tidak ada min-height yang
   menyebabkan page overflow
   ---------------------------------------------------------- */
@media (min-width: 1024px) {
    .hkm-auth-page .hkm-auth-shell,
    .hkm-error-page .hkm-error-shell {
        display: grid;
        /* ~51% kiri, ~49% kanan — sesuai mockup */
        grid-template-columns: minmax(400px, 1.04fr) minmax(440px, 0.96fr);
        height: 100%;
        overflow: hidden;
    }

    .hkm-auth-page .hkm-auth-brand-panel,
    .hkm-error-page .hkm-error-brand-panel {
        /* FIX: height 100% bukan min-height */
        height: 100%;
        overflow: hidden;
    }

    .hkm-auth-page .hkm-auth-form-panel,
    .hkm-error-page .hkm-error-notice-panel {
        /* FIX: height 100% + overflow-y: auto untuk konten panjang */
        height: 100%;
        overflow-y: auto;
    }
}

/* ----------------------------------------------------------
   TABLET 768px–1023px
   ---------------------------------------------------------- */
@media (max-width: 1023px) {
    .hkm-auth-page .hkm-auth-shell,
    .hkm-error-page .hkm-error-shell {
        display: flex;
        height: 100%;
        overflow: hidden;
    }

    .hkm-auth-page .hkm-auth-brand-panel,
    .hkm-error-page .hkm-error-brand-panel {
        display: none;
    }

    .hkm-auth-page .hkm-auth-form-panel,
    .hkm-error-page .hkm-error-notice-panel {
        width: 100%;
        height: 100%;
        overflow-y: auto;
        padding: 1.75rem 1.25rem;
    }
}

/* ----------------------------------------------------------
   MOBILE < 768px
   Seamless mobile login composition:
   - page is the only visual canvas
   - bottom construction image overlaps upward behind the form
   - no solid band/gap between card and decorative background
   ---------------------------------------------------------- */
@media (max-width: 767px) {
    .hkm-auth-page,
    .hkm-error-page {
        position: relative;
        height: 100dvh;
        min-height: 100dvh;
        overflow: hidden;
        overflow-x: hidden;
        background:
            linear-gradient(
                180deg,
                #f8fbff 0%,
                #f5f8fc 38%,
                #edf3fa 68%,
                #dfe9f5 100%
            );
        isolation: isolate;
    }

    /* Background bawah mobile untuk login dan 503 — asset khusus mobile, bukan auth-construction-bg.png. */
    .hkm-auth-page::after,
    .hkm-error-page::after {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        bottom: -1px;
        width: 100%;
        height: clamp(260px, 38vh, 390px);
        background-image:
            linear-gradient(
                to bottom,
                rgba(248, 251, 255, 0) 0%,
                rgba(245, 248, 252, 0.04) 20%,
                rgba(237, 243, 250, 0.12) 52%,
                rgba(223, 233, 245, 0.30) 100%
            ),
            url('/images/auth-mobile-bottom-bg.png');
        background-size: 100% auto;
        background-position: center bottom;
        background-repeat: no-repeat;
        opacity: 0.98;
        pointer-events: none;
        z-index: 0;
        -webkit-mask-image: linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0) 0%,
            rgba(0, 0, 0, 0.16) 7%,
            rgba(0, 0, 0, 0.72) 25%,
            #000000 46%,
            #000000 100%
        );
        mask-image: linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0) 0%,
            rgba(0, 0, 0, 0.16) 7%,
            rgba(0, 0, 0, 0.72) 25%,
            #000000 46%,
            #000000 100%
        );
    }

    .hkm-auth-page .hkm-auth-shell,
    .hkm-error-page .hkm-error-shell {
        display: flex;
        position: relative;
        z-index: 1;
        height: 100%;
        min-height: 100dvh;
        overflow-y: auto;
        overflow-x: hidden;
        background: transparent !important;
    }

    .hkm-auth-page .hkm-auth-brand-panel,
    .hkm-error-page .hkm-error-brand-panel {
        display: none;
    }

    .hkm-auth-page .hkm-auth-form-panel {
        align-items: flex-start;
        width: 100%;
        height: auto;
        min-height: 100dvh;
        box-sizing: border-box;
        padding: clamp(0.85rem, 3.8vw, 1.25rem) clamp(0.875rem, 4vw, 1.25rem) max(0.55rem, env(safe-area-inset-bottom));
        overflow-y: visible;
        overflow-x: hidden;
        position: relative;
        z-index: 1;
        background: transparent !important;
    }

    .hkm-error-page .hkm-error-notice-panel {
        align-items: flex-start;
        width: 100%;
        min-height: 100dvh;
        height: auto;
        box-sizing: border-box;
        padding: clamp(0.85rem, 3.8vw, 1.25rem) clamp(0.875rem, 4vw, 1.25rem) max(0.55rem, env(safe-area-inset-bottom));
        overflow-y: visible;
        overflow-x: hidden;
        position: relative;
        z-index: 2;
        background: transparent !important;
    }

    .hkm-auth-page .hkm-auth-card {
        border-radius: 1.1rem;
        padding: 1rem 1.1rem;
        box-shadow: 0 1rem 2.2rem rgba(15, 35, 75, 0.11);
        position: relative;
        z-index: 2;
        margin: 0 auto clamp(0.25rem, 1vh, 0.65rem);
        background: rgba(255, 255, 255, 0.94);
        border-color: rgba(135, 150, 175, 0.18);
    }

    .hkm-error-page .hkm-error-card {
        border-radius: 1.1rem;
        padding: 1rem 1.1rem;
        box-shadow: 0 1rem 2.2rem rgba(15, 35, 75, 0.11);
        position: relative;
        z-index: 3;
        margin: 0 auto clamp(0.25rem, 1vh, 0.65rem);
        background: rgba(255, 255, 255, 0.95);
        border-color: rgba(135, 150, 175, 0.18);
    }

    .hkm-auth-page .hkm-brand-logo,
    .hkm-error-page .hkm-brand-logo {
        width: min(155px, 58vw);
    }

    .hkm-auth-page .hkm-auth-card-header .hkm-brand-logo {
        margin-bottom: 0.5rem;
    }

    .hkm-auth-page .hkm-auth-card-header h2,
    .hkm-error-page .hkm-error-card-header h2 {
        font-size: 1.35rem;
        margin: 0.1rem 0 0.25rem;
    }

    .hkm-auth-page .hkm-auth-card-header p {
        font-size: 0.88rem;
    }

    .hkm-auth-page .hkm-form {
        margin-top: 1rem;
        gap: 0.75rem;
    }

    .hkm-auth-page .hkm-form-control-wrap,
    .hkm-auth-page .hkm-form-input,
    .hkm-auth-page .hkm-form-submit,
    .hkm-error-page .hkm-error-primary-action {
        min-height: 2.9rem;
    }

    /* FIX: mobile remember me / forgot password inline tidak column */
    .hkm-auth-page .hkm-form-options {
        align-items: center;
        flex-direction: row;
        gap: 0.5rem;
    }

    /* FIX: demo account compact di mobile */
    .hkm-auth-page .hkm-auth-demo {
        margin-top: 0.5rem;
    }

    .hkm-auth-page .hkm-auth-demo summary {
        font-size: 0.78rem;
    }

    .hkm-auth-page .hkm-auth-demo-body {
        max-height: 9rem;
        padding: 0.6rem 0.75rem;
    }

    .hkm-auth-page .hkm-auth-demo-body div {
        flex-direction: column;
        gap: 0.1rem;
    }

    .hkm-auth-page .hkm-auth-card-footer {
        margin-top: 0.65rem;
        font-size: 0.8rem;
    }

    .hkm-error-page .hkm-error-icon {
        width: 3.4rem;
        height: 3.4rem;
        font-size: 1.55rem;
    }
}

@media (max-width: 380px) and (max-height: 760px) {
    .hkm-auth-page::after,
    .hkm-error-page::after {
        height: clamp(235px, 36vh, 300px);
    }

    .hkm-auth-page .hkm-auth-card,
    .hkm-error-page .hkm-error-card {
        padding: 0.9rem 1rem;
    }

    .hkm-auth-page .hkm-form {
        gap: 0.62rem;
        margin-top: 0.85rem;
    }

    .hkm-auth-page .hkm-form-control-wrap,
    .hkm-auth-page .hkm-form-input,
    .hkm-auth-page .hkm-form-submit {
        min-height: 2.75rem;
    }
}

/* ----------------------------------------------------------
   SHORT VIEWPORT — viewport pendek, spacing otomatis mengecil
   ---------------------------------------------------------- */
@media (max-height: 700px) and (min-width: 1024px) {
    .hkm-auth-page .hkm-auth-card {
        padding: clamp(0.9rem, 2vh, 1.4rem) clamp(1rem, 2.5vw, 1.75rem);
    }

    .hkm-auth-page .hkm-form {
        gap: 0.6rem;
        margin-top: 0.8rem;
    }

    .hkm-auth-page .hkm-auth-card-header .hkm-brand-logo {
        margin-bottom: 0.4rem;
    }

    .hkm-auth-page .hkm-auth-card-header h2 {
        font-size: 1.35rem;
        margin: 0.1rem 0 0.2rem;
    }

    .hkm-auth-page .hkm-form-control-wrap,
    .hkm-auth-page .hkm-form-input,
    .hkm-auth-page .hkm-form-submit {
        min-height: 2.75rem;
    }

    .hkm-auth-page .hkm-auth-card-footer {
        margin-top: 0.55rem;
    }
}

/* ----------------------------------------------------------
   PHASE 2 AUTH PAGES
   Scoped only to .hkm-auth-page. Keeps error pages untouched.
   ---------------------------------------------------------- */
.hkm-auth-page input[type="password"]::-ms-reveal,
.hkm-auth-page input[type="password"]::-ms-clear {
    display: none;
    width: 0;
    height: 0;
}

.hkm-auth-page .hkm-auth-card--short {
    width: min(100%, 500px);
}

.hkm-auth-page .hkm-auth-card--long {
    width: min(100%, 540px);
}

.hkm-auth-page .hkm-form-note {
    display: grid;
    gap: 0.35rem;
    margin-top: 0.95rem;
    border: 1px solid rgba(11, 53, 185, 0.14);
    border-radius: 0.95rem;
    padding: 0.8rem 0.9rem;
    color: #4b5565;
    background: rgba(248, 251, 255, 0.92);
    font-size: 0.88rem;
    line-height: 1.5;
}

.hkm-auth-page .hkm-form-note strong {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: #1c2437;
    font-size: 0.9rem;
    font-weight: 800;
}

.hkm-auth-page .hkm-form-note span,
.hkm-auth-page .hkm-form-note small {
    display: block;
    color: #667085;
}

.hkm-auth-page .hkm-form-note small {
    margin-top: 0.1rem;
    font-size: 0.82rem;
    font-weight: 700;
}

.hkm-auth-page .hkm-form-note small i {
    margin-right: 0.35rem;
}

.hkm-auth-page .hkm-form-alert-info {
    border: 1px solid rgba(11, 53, 185, 0.18);
    color: #0b35b9;
    background: #eef4ff;
}

.hkm-auth-page .hkm-form-alert-info div,
.hkm-auth-page .hkm-form-alert-info strong,
.hkm-auth-page .hkm-form-alert-info span {
    display: block;
}

.hkm-auth-page .hkm-form-helper {
    margin: 0.05rem 0 0;
    color: #667085;
    font-size: 0.8rem;
    line-height: 1.4;
}

.hkm-auth-page .hkm-form-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.hkm-auth-page .hkm-form-actions--links,
.hkm-auth-page .hkm-form-actions--between {
    justify-content: space-between;
}

.hkm-auth-page .hkm-form-actions--center {
    justify-content: center;
    flex-wrap: wrap;
    text-align: center;
}

.hkm-auth-page .hkm-form-actions--stacked {
    display: grid;
    gap: 0.75rem;
}

.hkm-auth-page .hkm-form-actions--stacked form {
    margin: 0;
}

.hkm-auth-page .hkm-form-link i {
    margin-right: 0.35rem;
}

.hkm-auth-page .hkm-form-submit--fit {
    width: auto;
    min-width: 12rem;
    padding-right: 1rem;
    padding-left: 1rem;
}

.hkm-auth-page .hkm-form-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    min-height: 3rem;
    border: 1px solid #d9e1ef;
    border-radius: 0.9rem;
    color: #344054;
    background: #ffffff;
    font-size: 0.96rem;
    font-weight: 800;
    cursor: pointer;
    transition: border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.hkm-auth-page .hkm-form-secondary:hover {
    border-color: #0b35b9;
    color: #0b35b9;
    box-shadow: 0 0.75rem 1.5rem rgba(15, 35, 75, 0.08);
    transform: translateY(-1px);
}

.hkm-auth-page .hkm-form-secondary:focus-visible {
    outline: 3px solid rgba(11, 53, 185, 0.22);
    outline-offset: 3px;
}

.hkm-auth-page .hkm-form-muted {
    color: #667085;
    font-size: 0.88rem;
    font-weight: 700;
}

@media (max-width: 767px) {
    .hkm-auth-page .hkm-auth-card--long,
    .hkm-auth-page .hkm-auth-card--short {
        width: min(100%, 500px);
    }

    .hkm-auth-page .hkm-form-note {
        margin-top: 0.75rem;
        padding: 0.7rem 0.78rem;
        font-size: 0.84rem;
    }

    .hkm-auth-page .hkm-form-actions,
    .hkm-auth-page .hkm-form-actions--links,
    .hkm-auth-page .hkm-form-actions--between {
        align-items: stretch;
        flex-direction: column;
        gap: 0.7rem;
    }

    .hkm-auth-page .hkm-form-actions--center {
        align-items: center;
    }

    .hkm-auth-page .hkm-form-submit--fit {
        width: 100%;
        min-width: 0;
    }

    .hkm-auth-page .hkm-form-link {
        display: inline-flex;
        justify-content: center;
        text-align: center;
    }
}

@media (max-height: 760px) and (min-width: 1024px) {
    .hkm-auth-page .hkm-auth-card--long {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .hkm-auth-page .hkm-form-note {
        margin-top: 0.7rem;
        padding: 0.65rem 0.8rem;
    }
}

/* ----------------------------------------------------------
   PHASE 3 ERROR PAGES
   Scoped only to .hkm-error-page. Keeps Auth pages untouched.
   ---------------------------------------------------------- */
.hkm-error-page .hkm-error-card--standard {
    box-sizing: border-box;
    width: min(100%, 520px);
}

.hkm-error-page .hkm-error-code-badge {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4.75rem;
    margin: 0 auto 0.65rem;
    border: 1px solid rgba(11, 53, 185, 0.16);
    border-radius: 999px;
    padding: 0.32rem 0.82rem;
    color: #0b35b9;
    background: #eef4ff;
    font-size: 0.88rem;
    font-weight: 900;
    letter-spacing: 0.12em;
}

.hkm-error-page .hkm-error-card-header .hkm-error-code-badge + .hkm-error-icon {
    margin-top: 0.1rem;
}

.hkm-error-page .hkm-error-icon--401,
.hkm-error-page .hkm-error-icon--404 {
    border-color: rgba(11, 53, 185, 0.20);
    color: #0b35b9;
    background: #eef4ff;
}

.hkm-error-page .hkm-error-icon--403,
.hkm-error-page .hkm-error-icon--419,
.hkm-error-page .hkm-error-icon--429 {
    border-color: rgba(247, 144, 9, 0.28);
    color: #b54708;
    background: #fffaeb;
}

.hkm-error-page .hkm-error-icon--500 {
    border-color: rgba(240, 68, 56, 0.28);
    color: #b42318;
    background: #fef3f2;
}

.hkm-error-page .hkm-error-alert--info {
    border-color: rgba(11, 53, 185, 0.18);
    color: #0b35b9;
    background: #eef4ff;
}

.hkm-error-page .hkm-error-alert--warning {
    border-color: rgba(247, 144, 9, 0.26);
    color: #b54708;
    background: #fffaeb;
}

.hkm-error-page .hkm-error-alert--danger {
    border-color: rgba(240, 68, 56, 0.26);
    color: #b42318;
    background: #fef3f2;
}

.hkm-error-page .hkm-error-actions--stacked {
    display: grid;
    gap: 0.7rem;
}

.hkm-error-page .hkm-error-primary-action,
.hkm-error-page .hkm-error-secondary-action {
    box-sizing: border-box;
}

.hkm-error-page .hkm-error-secondary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 3rem;
    border: 1px solid #d9e1ef;
    border-radius: 0.9rem;
    color: #344054;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 0.55rem 1.25rem rgba(15, 35, 75, 0.06);
    font-size: 0.96rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.hkm-error-page .hkm-error-secondary-action:hover {
    border-color: #0b35b9;
    color: #0b35b9;
    box-shadow: 0 0.75rem 1.5rem rgba(15, 35, 75, 0.09);
    transform: translateY(-1px);
}

.hkm-error-page .hkm-error-secondary-action:focus-visible {
    outline: 3px solid rgba(11, 53, 185, 0.22);
    outline-offset: 3px;
}

@media (max-width: 767px) {
    .hkm-error-page .hkm-error-card--standard {
        width: min(100%, 500px);
    }

    .hkm-error-page .hkm-error-code-badge {
        min-width: 4.25rem;
        margin-bottom: 0.55rem;
        padding: 0.28rem 0.72rem;
        font-size: 0.8rem;
    }

    .hkm-error-page .hkm-error-card-header p:not(.hkm-brand-eyebrow) {
        font-size: 0.88rem;
    }

    .hkm-error-page .hkm-error-alert {
        padding: 0.7rem 0.78rem;
        font-size: 0.84rem;
    }

    .hkm-error-page .hkm-error-secondary-action {
        min-height: 2.9rem;
        font-size: 0.94rem;
    }
}

@media (max-height: 760px) and (min-width: 1024px) {
    .hkm-error-page .hkm-error-card--standard {
        padding-top: 1.2rem;
        padding-bottom: 1.2rem;
    }

    .hkm-error-page .hkm-error-code-badge {
        margin-bottom: 0.45rem;
        padding-top: 0.24rem;
        padding-bottom: 0.24rem;
    }

    .hkm-error-page .hkm-error-icon {
        width: 3.3rem;
        height: 3.3rem;
        margin-bottom: 0.55rem;
        font-size: 1.55rem;
    }

    .hkm-error-page .hkm-error-actions {
        margin-top: 0.85rem;
    }

    .hkm-error-page .hkm-error-alert {
        margin-top: 0.65rem;
        padding-top: 0.65rem;
        padding-bottom: 0.65rem;
    }

    .hkm-error-page .hkm-error-card-footer {
        margin-top: 0.65rem;
    }
}

/* ROOM 3 LOGIN DEMO/PRODUCTION PATCH */
.hkm-auth-page .hkm-demo-login-notice {
    margin-top: 0.85rem;
}

.hkm-auth-page .hkm-demo-login-notice div {
    display: grid;
    gap: 0.15rem;
}

.hkm-auth-page .hkm-auth-demo {
    margin-top: 0.8rem;
    border: 1px solid rgba(11, 53, 185, 0.14);
    border-radius: 1rem;
    padding: 0.75rem;
    background: #f8fbff;
    font-size: 0.84rem;
}

.hkm-auth-page .hkm-auth-demo-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.hkm-auth-page .hkm-auth-demo-header div {
    display: grid;
    gap: 0.12rem;
}

.hkm-auth-page .hkm-auth-demo-header strong {
    color: #1c2437;
    font-size: 0.9rem;
}

.hkm-auth-page .hkm-auth-demo-header span {
    color: #667085;
    font-size: 0.78rem;
    line-height: 1.35;
}

.hkm-auth-page .hkm-auth-demo-password {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 0.28rem 0.55rem;
    background: #eef4ff;
    color: #0b35b9 !important;
    font-weight: 700;
    white-space: nowrap;
}

.hkm-auth-page .hkm-auth-demo code {
    color: inherit;
    font-size: 0.78rem;
    word-break: break-word;
}

.hkm-auth-page .hkm-auth-demo-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.hkm-auth-page .hkm-auth-demo-table {
    width: 100%;
    min-width: 430px;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 0.75rem;
    background: #ffffff;
}

.hkm-auth-page .hkm-auth-demo-table th,
.hkm-auth-page .hkm-auth-demo-table td {
    padding: 0.52rem 0.58rem;
    border-bottom: 1px solid #e4eaf4;
    text-align: left;
    vertical-align: top;
}

.hkm-auth-page .hkm-auth-demo-table th {
    color: #344054;
    background: #eef4ff;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.hkm-auth-page .hkm-auth-demo-table td {
    color: #475467;
    font-size: 0.8rem;
}

.hkm-auth-page .hkm-auth-demo-table tbody tr:last-child td {
    border-bottom: none;
}

@media (max-width: 576px) {
    .hkm-auth-page .hkm-auth-demo {
        padding: 0.65rem;
    }

    .hkm-auth-page .hkm-auth-demo-header {
        flex-direction: column;
        gap: 0.45rem;
    }

    .hkm-auth-page .hkm-auth-demo-password {
        width: 100%;
        text-align: center;
    }

    .hkm-auth-page .hkm-auth-demo-table {
        min-width: 0;
    }

    .hkm-auth-page .hkm-auth-demo-table thead {
        display: none;
    }

    .hkm-auth-page .hkm-auth-demo-table,
    .hkm-auth-page .hkm-auth-demo-table tbody,
    .hkm-auth-page .hkm-auth-demo-table tr,
    .hkm-auth-page .hkm-auth-demo-table td {
        display: block;
        width: 100%;
    }

    .hkm-auth-page .hkm-auth-demo-table tr {
        border-bottom: 1px solid #e4eaf4;
        padding: 0.5rem 0;
    }

    .hkm-auth-page .hkm-auth-demo-table tr:last-child {
        border-bottom: none;
    }

    .hkm-auth-page .hkm-auth-demo-table td {
        display: flex;
        justify-content: space-between;
        gap: 0.75rem;
        border-bottom: none;
        padding: 0.24rem 0.1rem;
        text-align: right;
    }

    .hkm-auth-page .hkm-auth-demo-table td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        color: #344054;
        font-weight: 800;
        text-align: left;
    }
}

/* ROOM 3 register refinements */
.hkm-auth-page .hkm-form-select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-right: 2.25rem;
    background-image: linear-gradient(45deg, transparent 50%, #667085 50%), linear-gradient(135deg, #667085 50%, transparent 50%);
    background-position: calc(100% - 1.05rem) 50%, calc(100% - 0.75rem) 50%;
    background-size: 0.32rem 0.32rem, 0.32rem 0.32rem;
    background-repeat: no-repeat;
}

.hkm-auth-page .hkm-demo-register-link {
    margin-top: 0.85rem;
}

/* ============================================================
   ROOM 9 RESPONSIVE PATCH — Auth pages only
   Scope: login demo accounts table, register, forgot password.
   Tidak mengubah desain global.
   ============================================================ */
.hkm-auth-page,
.hkm-auth-page * {
    box-sizing: border-box;
}

.hkm-auth-page .hkm-auth-card,
.hkm-auth-page .hkm-form,
.hkm-auth-page .hkm-form-alert,
.hkm-auth-page .hkm-form-note,
.hkm-auth-page .hkm-auth-demo,
.hkm-auth-page .hkm-auth-demo-table-wrap,
.hkm-auth-page .hkm-auth-card-footer {
    min-width: 0;
    max-width: 100%;
}

.hkm-auth-page .hkm-auth-card-header h2,
.hkm-auth-page .hkm-auth-card-header p,
.hkm-auth-page .hkm-form-note,
.hkm-auth-page .hkm-form-alert,
.hkm-auth-page .hkm-form-helper,
.hkm-auth-page .hkm-auth-card-footer,
.hkm-auth-page .hkm-auth-demo-header,
.hkm-auth-page .hkm-auth-demo-table td,
.hkm-auth-page .hkm-auth-demo-table th {
    overflow-wrap: anywhere;
}

.hkm-auth-page .hkm-auth-card--long {
    width: min(100%, 520px);
}

.hkm-auth-page .hkm-form-select {
    appearance: auto;
    min-width: 0;
}

.hkm-auth-page .hkm-auth-demo-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .65rem;
    margin-bottom: .5rem;
}

.hkm-auth-page .hkm-auth-demo-header strong,
.hkm-auth-page .hkm-auth-demo-header span:not(.hkm-auth-demo-password) {
    display: block;
}

.hkm-auth-page .hkm-auth-demo-header strong {
    color: #1c2437;
    font-weight: 800;
}

.hkm-auth-page .hkm-auth-demo-header span:not(.hkm-auth-demo-password) {
    color: #667085;
    font-size: .78rem;
    line-height: 1.35;
}

.hkm-auth-page .hkm-auth-demo-password {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    flex: 0 0 auto;
    max-width: 100%;
    border: 1px solid rgba(11, 53, 185, .12);
    border-radius: 999px;
    padding: .25rem .5rem;
    color: #344054;
    background: #f8fbff;
    font-size: .75rem;
    font-weight: 800;
    white-space: nowrap;
}

.hkm-auth-page .hkm-auth-demo-table-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.hkm-auth-page .hkm-auth-demo-table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    table-layout: fixed;
}

.hkm-auth-page .hkm-auth-demo-table th,
.hkm-auth-page .hkm-auth-demo-table td {
    border-bottom: 1px solid #e7edf7;
    padding: .42rem .35rem;
    text-align: left;
    vertical-align: top;
    color: #4b5565;
    font-size: .78rem;
    line-height: 1.35;
}

.hkm-auth-page .hkm-auth-demo-table th {
    color: #344054;
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.hkm-auth-page .hkm-auth-demo-table tr:last-child td {
    border-bottom: 0;
}

.hkm-auth-page .hkm-auth-demo-table code,
.hkm-auth-page .hkm-auth-demo-password code {
    display: inline-block;
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    color: #0b35b9;
    background: rgba(11, 53, 185, .06);
    border-radius: .35rem;
    padding: .05rem .22rem;
}

@media (max-width: 767px) {
    .hkm-auth-page .hkm-auth-card--long {
        width: min(100%, 500px);
    }

    .hkm-auth-page .hkm-auth-demo-header {
        display: grid;
        gap: .45rem;
    }

    .hkm-auth-page .hkm-auth-demo-password {
        justify-self: start;
        white-space: normal;
        border-radius: .7rem;
    }

    .hkm-auth-page .hkm-auth-demo-table {
        display: block;
    }

    .hkm-auth-page .hkm-auth-demo-table thead {
        display: none;
    }

    .hkm-auth-page .hkm-auth-demo-table tbody,
    .hkm-auth-page .hkm-auth-demo-table tr,
    .hkm-auth-page .hkm-auth-demo-table td {
        display: block;
        width: 100%;
    }

    .hkm-auth-page .hkm-auth-demo-table tr {
        border: 1px solid #e7edf7;
        border-radius: .8rem;
        padding: .45rem .55rem;
        background: rgba(248, 251, 255, .82);
    }

    .hkm-auth-page .hkm-auth-demo-table tr + tr {
        margin-top: .45rem;
    }

    .hkm-auth-page .hkm-auth-demo-table td {
        display: grid;
        grid-template-columns: 5rem minmax(0, 1fr);
        gap: .5rem;
        border-bottom: 0;
        padding: .18rem 0;
    }

    .hkm-auth-page .hkm-auth-demo-table td::before {
        content: attr(data-label);
        color: #667085;
        font-size: .72rem;
        font-weight: 800;
    }
}

@media (max-width: 430px) {
    .hkm-auth-page .hkm-form-options {
        flex-wrap: wrap;
    }

    .hkm-auth-page .hkm-form-control-wrap {
        min-width: 0;
    }

    .hkm-auth-page .hkm-form-icon,
    .hkm-auth-page .hkm-form-password-toggle {
        flex-basis: 2.45rem;
    }

    .hkm-auth-page .hkm-auth-card-footer {
        align-items: flex-start;
        text-align: center;
        line-height: 1.4;
    }
}

@media (max-width: 380px) {
    .hkm-auth-page .hkm-auth-card-header h2 {
        font-size: 1.18rem;
    }

    .hkm-auth-page .hkm-form-note,
    .hkm-auth-page .hkm-form-alert {
        padding: .62rem .68rem;
    }

    .hkm-auth-page .hkm-auth-demo-table td {
        grid-template-columns: 4.4rem minmax(0, 1fr);
        gap: .4rem;
    }
}
