/* ==========================================================
   Login Panel Admin — DPKD Kepahiang
   Mandiri (tidak butuh rebuild Vite/Tailwind)
   ========================================================== */
:root {
    --ink-950: #021410;
    --ink-900: #04201a;
    --ink-800: #07392c;
    --emerald-300: #6ee7b7;
    --emerald-200: #a7f3d0;
    --emerald-500: #10b981;
    --emerald-600: #059669;
    --emerald-700: #047857;
    --emerald-800: #065f46;
    --gold-300: #f7d58b;
    --gold-400: #f5b83d;
    --gold-600: #b97a0c;
    --paper: #fbfaf5;
    --field: #e9f3ee;
    --field-border: #cfe3d9;
    --text: #0d2a22;
    --muted: #4c6a60;
    --danger: #b42318;
    --danger-bg: #fef3f2;
    --s: min(640px, calc(100vh - 270px), 46vw);
}

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

html, body { height: 100%; margin: 0; }

body {
    font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--text);
    background:
        radial-gradient(ellipse 70% 60% at 30% 55%, #0b4a38 0%, transparent 70%),
        radial-gradient(ellipse 50% 50% at 90% 0%, #0a3b2e 0%, transparent 60%),
        var(--ink-950);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.stars { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.stars i {
    position: absolute; width: 2px; height: 2px; border-radius: 50%;
    background: #d9fff0; opacity: .5;
    animation: twinkle var(--d, 4s) ease-in-out infinite;
    animation-delay: var(--dl, 0s);
}
@keyframes twinkle { 0%, 100% { opacity: .15; transform: scale(.8); } 50% { opacity: .85; transform: scale(1.4); } }

.page {
    position: relative; z-index: 1;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(380px, 580px);
    gap: clamp(16px, 3vw, 48px);
    align-items: center;
    padding: 20px clamp(16px, 2.4vw, 36px) 20px 0;
}

/* ================= Sisi kiri ================= */
.showcase {
    display: flex; flex-direction: column; align-items: center;
    text-align: center; color: #fff; min-width: 0;
}
.showcase h1 {
    margin: 0; font-size: clamp(1.7rem, 2.9vw, 2.6rem); line-height: 1.08;
    font-weight: 800; letter-spacing: -.005em; text-wrap: balance; text-transform: uppercase;
    max-width: 20ch;
}
.showcase .lead {
    margin: .8rem auto 0; max-width: 46ch; color: var(--emerald-200);
    font-size: clamp(.85rem, 1.1vw, 1rem); line-height: 1.5; text-wrap: balance;
}

.stage {
    position: relative; width: var(--s); height: var(--s);
    margin-top: clamp(4px, 1.5vh, 20px);
    flex: none;
}
.stage::before { /* cahaya di balik logo */
    content: ""; position: absolute; left: 50%; top: 50%;
    width: calc(var(--s) * .5); height: calc(var(--s) * .5);
    transform: translate(-50%, -50%); border-radius: 50%;
    background: radial-gradient(circle, rgba(52, 211, 153, .28), rgba(245, 184, 61, .06) 55%, transparent 72%);
    animation: breathe 6s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { opacity: .6; transform: translate(-50%, -50%) scale(.92); } 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } }

.ring {
    position: absolute; left: 50%; top: 50%; border-radius: 50%;
    border: 1px solid rgba(167, 243, 208, .16);
    transform: translate(-50%, -50%);
}
.ring.outer { width: calc(var(--s) * .84); height: calc(var(--s) * .84); }
.ring.inner { width: calc(var(--s) * .52); height: calc(var(--s) * .52); border-color: rgba(245, 184, 61, .2); }

.spin { position: absolute; inset: 0; border-radius: 50%; animation: spin var(--t, 120s) linear infinite; }
.spin.rev { animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spin-rev { to { transform: rotate(-360deg); } }

.node {
    position: absolute; left: 50%; top: 50%;
    width: calc(var(--s) * .152); height: calc(var(--s) * .152);
    margin: calc(var(--s) * -.076) 0 0 calc(var(--s) * -.076);
    transform: rotate(var(--a)) translateX(var(--r)) rotate(calc(var(--a) * -1));
}
.outer .node { --r: calc(var(--s) * .42); }
.inner .node { --r: calc(var(--s) * .26); }

.node b {
    position: absolute; inset: 0; display: grid; place-items: center;
    padding: 4px; border-radius: 50%; text-align: center;
    font-size: clamp(.58rem, calc(var(--s) * .0185), .8rem); font-weight: 700; line-height: 1.1; color: #f1fff9;
    background: radial-gradient(circle at 34% 28%, #20a97c 0%, #0c6048 62%, #07402f 100%);
    border: 1px solid rgba(167, 243, 208, .45);
    box-shadow: 0 0 26px rgba(16, 185, 129, .4), inset 0 0 16px rgba(255, 255, 255, .1);
    animation: spin-rev var(--t, 120s) linear infinite;
}
.inner .node b {
    color: #fff8e6;
    background: radial-gradient(circle at 34% 28%, #d99a1e 0%, #8a5806 62%, #573503 100%);
    border-color: rgba(247, 213, 139, .5);
    box-shadow: 0 0 24px rgba(245, 184, 61, .34), inset 0 0 14px rgba(255, 255, 255, .12);
}
.inner .node b { animation-direction: reverse; } /* cincin dalam berputar berlawanan, label tetap tegak */

.sat { /* titik cahaya yang berjalan di cincin */
    position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px;
    border-radius: 50%; background: #fff; box-shadow: 0 0 14px 3px rgba(255, 255, 255, .55);
    transform: rotate(var(--a)) translateX(var(--r));
}
.outer .sat { --r: calc(var(--s) * .42); }
.inner .sat { --r: calc(var(--s) * .26); background: var(--gold-300); box-shadow: 0 0 14px 3px rgba(247, 213, 139, .6); }

#logoCanvas, .logo-fallback {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: calc(var(--s) * .2 * 2.2); /* kanvas 2.2x ukuran logo agar kepingan bisa tersebar */
    height: auto; aspect-ratio: 250 / 320 ; pointer-events: none;
}
#logoCanvas { aspect-ratio: auto; height: calc(var(--s) * .2 * 2.2 * 320 / 250); }
.logo-fallback { width: calc(var(--s) * .2); display: none; filter: drop-shadow(0 8px 22px rgba(0, 0, 0, .5)); }
.no-canvas .logo-fallback { display: block; }
.no-canvas #logoCanvas { display: none; }

/* ================= Kartu login ================= */
.card {
    width: 100%; background: var(--paper); border-radius: 26px; overflow: hidden;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .9), 0 0 0 5px rgba(110, 231, 183, .16), 0 30px 80px rgba(0, 0, 0, .55);
}
.card-head {
    display: flex; align-items: center; gap: 14px; padding: 14px 24px;
    color: #fff; background: linear-gradient(100deg, var(--emerald-800), var(--emerald-600) 70%, #0e8f67);
}
.card-head .badge {
    width: 40px; height: 40px; flex: none; border-radius: 12px; background: #fff;
    display: grid; place-items: center; padding: 4px;
}
.card-head .badge img { width: 100%; height: 100%; object-fit: contain; }
.card-head h2 { margin: 0; font-size: 1.28rem; font-weight: 800; letter-spacing: .01em; line-height: 1.15; }
.card-head p { margin: 2px 0 0; font-size: .8rem; font-weight: 500; opacity: .92; }

.card-body { padding: 24px 30px 16px; }
.hello { text-align: center; margin-bottom: 14px; }
.hello h3 { margin: 0; font-size: 1.55rem; font-weight: 800; color: #0a2a21; }
.hello h3 span.g { color: var(--emerald-600); }
.hello .wave { display: inline-block; transform-origin: 70% 70%; animation: wave 1.8s ease-in-out 1 .6s; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(16deg); } 20%, 40% { transform: rotate(-10deg); } 50% { transform: rotate(8deg); } }
.hello p { margin: 6px 0 0; font-size: .88rem; color: var(--muted); }

.alert {
    margin: 0 0 16px; padding: 10px 14px; border-radius: 12px; font-size: .85rem; font-weight: 600;
    color: var(--danger); background: var(--danger-bg); border: 1px solid #fecdca;
}

.field { margin-bottom: 11px; }
.field label { display: block; margin-bottom: 6px; font-size: .85rem; font-weight: 700; color: var(--text); }
.control {
    position: relative; display: flex; align-items: center;
    background: var(--field); border: 1px solid var(--field-border); border-radius: 12px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.control:focus-within { border-color: var(--emerald-600); background: #fff; box-shadow: 0 0 0 3px rgba(5, 150, 105, .18); }
.control > svg { width: 18px; height: 18px; flex: none; margin-left: 14px; color: #1d4d3f; }
.control input, .control select {
    flex: 1; min-width: 0; width: 100%; height: 42px; padding: 0 14px 0 10px;
    border: 0; outline: 0; background: transparent; color: var(--text);
    font: inherit; font-size: .95rem; appearance: none; -webkit-appearance: none;
}
.control select { font-weight: 700; cursor: pointer; }
.control input::placeholder { color: #6f8c82; }
.control .chev { margin: 0 14px 0 0; width: 16px; height: 16px; pointer-events: none; }
.eye {
    width: 42px; height: 42px; flex: none; border: 0; background: transparent; cursor: pointer;
    color: #1d4d3f; display: grid; place-items: center; border-radius: 0 12px 12px 0;
}
.eye svg { width: 19px; height: 19px; }
.eye:focus-visible, .icon-btn:focus-visible, .submit:focus-visible, .link:focus-visible, .cbox input:focus-visible {
    outline: 3px solid rgba(5, 150, 105, .5); outline-offset: 2px;
}

.captcha { margin-top: 4px; border-top: 1px solid #e3ebe6; padding-top: 12px; text-align: center; }
.captcha .note { margin: 0 0 8px; font-size: .78rem; line-height: 1.4; color: var(--text); }
.captcha-img {
    display: block; margin: 0 auto; width: 188px; height: 50px; border-radius: 8px;
    background: #eaf4ef; border: 1px solid var(--field-border);
}
.cboxes { display: flex; justify-content: center; gap: 8px; margin: 10px 0 8px; }
.cbox input {
    width: 38px; height: 42px; text-align: center; font: inherit; font-size: 1.1rem; font-weight: 800;
    color: var(--text); background: var(--field); border: 1px solid var(--field-border); border-radius: 10px; outline: 0;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.cbox input:focus { border-color: var(--emerald-600); background: #fff; box-shadow: 0 0 0 3px rgba(5, 150, 105, .18); }
.cboxes.bad .cbox input { border-color: #f04438; background: var(--danger-bg); }
.captcha-tools { display: flex; justify-content: center; gap: 8px; }
.icon-btn {
    width: 36px; height: 34px; display: grid; place-items: center; cursor: pointer;
    background: #fff; border: 1px solid var(--field-border); border-radius: 9px; color: #1d4d3f;
    transition: background .15s, transform .15s;
}
.icon-btn:hover { background: var(--field); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn.spinning svg { animation: spin-once .6s ease; }
@keyframes spin-once { to { transform: rotate(360deg); } }
.captcha .err { margin: 8px 0 0; font-size: .8rem; font-weight: 600; color: var(--danger); }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 12px; font-size: .85rem; }
.remember { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; }
.remember input { width: 16px; height: 16px; accent-color: var(--emerald-600); }
.link { color: #0b6b4c; font-weight: 700; text-decoration: none; }
.link:hover { text-decoration: underline; }

.submit {
    width: 100%; height: 48px; border: 0; border-radius: 12px; cursor: pointer;
    font: inherit; font-weight: 800; letter-spacing: .06em; font-size: .92rem; color: #fff;
    background: linear-gradient(100deg, var(--emerald-700), var(--emerald-600));
    box-shadow: 0 8px 20px rgba(5, 150, 105, .32);
    transition: transform .15s, box-shadow .15s, background .2s, color .2s;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(5, 150, 105, .4); }
.submit:disabled { cursor: not-allowed; color: #7fa294; background: #dcebe4; box-shadow: none; }
.submit .dot { display: none; width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
.submit.loading .dot { display: inline-block; }

.browser {
    display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 8px 13px;
    font-size: .8rem; color: var(--muted); background: #fff; border: 1px solid #dfe9e4; border-radius: 10px;
}
.browser::before { content: ""; width: 9px; height: 9px; flex: none; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, .18); }
.browser.warn::before { background: #d97706; box-shadow: 0 0 0 3px rgba(217, 119, 6, .2); }

.foot { margin-top: 10px; text-align: center; font-size: .76rem; color: var(--muted); }
.foot a { color: inherit; text-decoration: none; }
.foot a:hover { color: var(--emerald-700); text-decoration: underline; }
.foot p { margin: 0 0 4px; }

/* ================= Responsif ================= */
@media (max-width: 1023px) {
    :root { --s: min(300px, 78vw); }
    .page { grid-template-columns: 1fr; padding: 20px 16px 28px; gap: 20px; align-content: start; justify-items: center; }
    .showcase { order: 1; }
    .showcase h1 { font-size: 1.55rem; }
    :root { --logo-w: calc(var(--s) * .4); }
    .stage { height: calc(var(--logo-w) * 1.28 + 28px); margin-top: 6px; overflow: visible; }
    .stage .ring, .stage .sat { display: none; }
    .stage::before { width: calc(var(--s) * .8); height: calc(var(--s) * .8); }
    #logoCanvas { width: calc(var(--logo-w) * 2.2); height: calc(var(--logo-w) * 2.2 * 320 / 250); }
    .logo-fallback { width: var(--logo-w); }
    .card { max-width: 580px; order: 2; }
    .card-body { padding: 24px 20px 18px; }
}
@media (max-width: 420px) {
    .cboxes { gap: 6px; }
    .cbox input { width: 34px; height: 40px; }
    .hello h3 { font-size: 1.35rem; }
}

@media (prefers-reduced-motion: reduce) {
    .stars i, .spin, .node b, .stage::before, .hello .wave { animation: none !important; }
}

#logoCanvas { filter: drop-shadow(0 10px 22px rgba(0, 0, 0, .5)); }
[hidden] { display: none !important; }

/* Layar pendek (laptop / zoom browser): rapatkan kartu agar sejajar & muat tanpa scroll */
@media (min-width: 1024px) and (max-height: 820px) {
    .card-head { padding: 11px 22px; }
    .card-body { padding: 16px 28px 12px; }
    .hello { margin-bottom: 10px; }
    .hello h3 { font-size: 1.35rem; }
    .hello p { font-size: .82rem; margin-top: 3px; }
    .field { margin-bottom: 8px; }
    .field label { margin-bottom: 4px; font-size: .8rem; }
    .control input, .control select, .eye { height: 38px; }
    .captcha { padding-top: 8px; }
    .captcha .note { font-size: .72rem; margin-bottom: 6px; }
    .captcha-img { height: 44px; width: 166px; }
    .cboxes { margin: 8px 0 6px; }
    .cbox input { height: 36px; width: 34px; }
    .icon-btn { height: 30px; }
    .row { margin: 6px 0 9px; }
    .submit { height: 42px; }
    .browser { margin-top: 9px; padding: 6px 12px; }
    .foot { margin-top: 7px; font-size: .72rem; }
    .foot p { margin-bottom: 2px; }
}
