/* Architechain — sign-in page (login.php). Layout only; every check stays on the server.
   ≥1024px: brand panel + form (55/45) · 768–1023px: compact brand band over a centred form · <768px: form only. */
:root {
    --lg-bg: #f5f7fb;
    --lg-text: #334155;
    --lg-heading: #0f172a;
    --lg-muted: #64748b;
    --lg-card: #ffffff;
    --lg-card-border: #e2e8f0;
    --lg-card-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px -12px rgba(15, 23, 42, .14);
    --lg-input: #ffffff;
    --lg-input-text: #0f172a;
    --lg-border: #cbd5e1;
    --lg-soft: #f1f5f9;
    --lg-primary: #185adb;
    --lg-primary-hover: #1249b8;
    --lg-on-primary: #ffffff;
    --lg-error: #b42318;
    --lg-error-bg: #fef3f2;
    --lg-error-border: #fecdca;
    --lg-focus: rgba(24, 90, 219, .35);
    --lg-hero-1: #050b1a;
    --lg-hero-2: #0c1730;
    --lg-hero-3: #12409e;
    --lg-ctl: 48px;
    --lg-radius: 12px;
    color-scheme: light;
}
[data-theme="dark"] {
    --lg-bg: #0b1120;
    --lg-text: #cbd5e1;
    --lg-heading: #f1f5f9;
    --lg-muted: #94a3b8;
    --lg-card: #111a2e;
    --lg-card-border: #24314a;
    --lg-card-shadow: 0 16px 40px -16px rgba(0, 0, 0, .6);
    --lg-input: #0f172a;
    --lg-input-text: #f1f5f9;
    --lg-border: #334155;
    --lg-soft: #1a2540;
    --lg-primary: #3b7bf6;
    --lg-primary-hover: #5a90f8;
    --lg-on-primary: #ffffff;
    --lg-error: #fda29b;
    --lg-error-bg: #2a1215;
    --lg-error-border: #5c2127;
    --lg-focus: rgba(96, 150, 250, .45);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.lg-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--lg-bg);
    color: var(--lg-text);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    overflow-x: hidden;
}
html[lang="km"] body.lg-body { font-family: 'Battambang', 'Inter', system-ui, sans-serif; line-height: 1.65; }
.lg-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}
.lg-shell a { color: var(--lg-primary); }
.lg-shell :focus-visible { outline: 3px solid var(--lg-focus); outline-offset: 2px; border-radius: 8px; }
.lg-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Brand panel ---------- */
.lg-hero {
    display: none;
    position: relative;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(150deg, var(--lg-hero-1) 0%, var(--lg-hero-2) 48%, var(--lg-hero-3) 100%);
}
.lg-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(60% 50% at 85% 10%, rgba(56, 189, 248, .16), transparent 70%),
                radial-gradient(50% 45% at 10% 95%, rgba(37, 99, 235, .28), transparent 70%);
}
.lg-hero-inner { position: relative; z-index: 1; display: flex; flex-direction: column; min-width: 0; }
.lg-hero-logo { display: block; height: 44px; width: auto; aspect-ratio: 1167 / 267; max-width: 100%; }
.lg-hero h1 {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.2;
    margin: 0;
    color: #fff;
}
html[lang="km"] .lg-hero h1 { font-family: 'Battambang', sans-serif; letter-spacing: 0; line-height: 1.5; }
.lg-hero-sub { color: #cbd5e1; margin: 0; max-width: 34em; }
.lg-modules {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
    gap: 10px;
}
.lg-modules li {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 11px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .12);
    font-size: 13.5px;
    font-weight: 500;
    color: #f1f5f9;
    line-height: 1.35;
}
.lg-modules i {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(56, 189, 248, .14);
    color: #7dd3fc;
    font-size: 15px;
}
.lg-hero-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 16px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, .14);
    color: #94a3b8;
    font-size: 12.5px;
}
.lg-hero-foot nav { display: flex; gap: 16px; }
.lg-hero-foot a { color: #cbd5e1; text-decoration: none; }
.lg-hero-foot a:hover { color: #fff; text-decoration: underline; }

/* ---------- Form side ---------- */
.lg-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.lg-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.lg-top-logo-wrap { flex: 1 1 auto; min-width: 0; display: flex; }
.lg-top-logo { display: block; height: 32px; width: auto; max-width: 100%; aspect-ratio: 1167 / 267; object-fit: contain; object-position: left center; }
.lg-logo-dark { display: none; }
[data-theme="dark"] .lg-logo-dark { display: block; }
[data-theme="dark"] .lg-logo-light { display: none; }
.lg-controls { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.lg-lang {
    display: inline-flex;
    align-items: center;
    padding: 3px;
    border-radius: 11px;
    background: var(--lg-card);
    border: 1px solid var(--lg-card-border);
}
.lg-lang a {
    display: inline-grid;
    place-items: center;
    min-width: 44px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    color: var(--lg-muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}
.lg-lang a[aria-current="true"] { background: var(--lg-primary); color: var(--lg-on-primary); }
.lg-lang a:not([aria-current="true"]):hover { color: var(--lg-heading); }
.lg-theme {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 11px;
    border: 1px solid var(--lg-card-border);
    background: var(--lg-card);
    color: var(--lg-muted);
    font-size: 17px;
    cursor: pointer;
}
.lg-theme:hover { color: var(--lg-primary); border-color: var(--lg-primary); }
.lg-theme .bi-sun-fill { display: none; color: #f59e0b; }
[data-theme="dark"] .lg-theme .bi-sun-fill { display: inline; }
[data-theme="dark"] .lg-theme .bi-moon-stars { display: none; }

.lg-center { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; padding: 20px 0; }
.lg-card { width: 100%; max-width: 460px; min-width: 0; }
.lg-card h2 {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: clamp(1.45rem, 1.2rem + 1vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--lg-heading);
    margin: 0 0 4px;
    line-height: 1.25;
}
html[lang="km"] .lg-card h2 { font-family: 'Battambang', sans-serif; letter-spacing: 0; line-height: 1.5; }
.lg-lead { color: var(--lg-muted); margin: 0 0 22px; font-size: 14.5px; }

.lg-alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 11px 14px;
    margin-bottom: 18px;
    border-radius: 10px;
    background: var(--lg-error-bg);
    border: 1px solid var(--lg-error-border);
    color: var(--lg-error);
    font-size: 14px;
}
.lg-alert i { flex: none; margin-top: 2px; }

.lg-field { margin-bottom: 16px; }
.lg-label { display: block; font-size: 13.5px; font-weight: 600; color: var(--lg-heading); margin-bottom: 6px; }
.lg-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.lg-input {
    display: block;
    width: 100%;
    min-height: var(--lg-ctl);
    padding: 11px 14px;
    font: inherit;
    font-size: 16px; /* no iOS zoom on focus */
    color: var(--lg-input-text);
    background: var(--lg-input);
    border: 1px solid var(--lg-border);
    border-radius: var(--lg-radius);
    transition: border-color .15s ease, box-shadow .15s ease;
    appearance: none;
}
.lg-input::placeholder { color: var(--lg-muted); opacity: .8; }
.lg-input:focus { outline: none; border-color: var(--lg-primary); box-shadow: 0 0 0 4px var(--lg-focus); }
.lg-input[aria-invalid="true"] { border-color: var(--lg-error); }
.lg-pw { position: relative; }
.lg-pw .lg-input { padding-right: 54px; }
.lg-pw-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    bottom: 2px;
    width: 46px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 0 10px 10px 0;
    background: transparent;
    color: var(--lg-muted);
    font-size: 18px;
    cursor: pointer;
}
.lg-pw-btn:hover { color: var(--lg-heading); }
.lg-field-err { display: block; margin-top: 6px; font-size: 13px; color: var(--lg-error); }
.lg-field-err:empty { display: none; }

.lg-check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; color: var(--lg-text); font-size: 14px; }
.lg-check input { width: 20px; height: 20px; margin: 0; accent-color: var(--lg-primary); cursor: pointer; }
.lg-forgot {
    background: none;
    border: 0;
    padding: 0 2px;
    min-height: 44px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--lg-primary);
    cursor: pointer;
}
.lg-forgot:hover { text-decoration: underline; }
.lg-help {
    margin: 4px 0 14px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--lg-soft);
    border: 1px solid var(--lg-card-border);
    font-size: 13.5px;
    color: var(--lg-text);
}
.lg-help p { margin: 0; }
.lg-help p + p { margin-top: 6px; }
.lg-captcha { margin: 6px 0 4px; max-width: 100%; overflow: hidden; }
.lg-captcha .g-recaptcha { margin: 8px 0 !important; }
.lg-captcha > div { max-width: 100%; }
/* The reCAPTCHA v2 box is a fixed 304px: shrink it on the narrowest phones instead of overflowing. */
@media (max-width: 359px) {
    .lg-captcha .g-recaptcha { transform: scale(.92); transform-origin: 0 0; height: 72px; }
}

.lg-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: var(--lg-ctl);
    padding: 10px 16px;
    border-radius: var(--lg-radius);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.lg-btn-primary { margin-top: 14px; border: 1px solid var(--lg-primary); background: var(--lg-primary); color: var(--lg-on-primary); font-weight: 700; }
.lg-btn-primary:hover { background: var(--lg-primary-hover); border-color: var(--lg-primary-hover); }
.lg-btn-primary[aria-busy="true"] { opacity: .75; cursor: progress; }
.lg-shell .lg-btn-soc { border: 1px solid var(--lg-border); background: var(--lg-card); color: var(--lg-heading); }
.lg-shell .lg-btn-soc:hover { background: var(--lg-soft); color: var(--lg-heading); }
.lg-btn-soc svg { flex: none; }
.lg-soc { display: grid; gap: 10px; }
.lg-or { display: flex; align-items: center; gap: 12px; margin: 22px 0 16px; color: var(--lg-muted); font-size: 13px; }
.lg-or::before, .lg-or::after { content: ''; flex: 1; border-top: 1px solid var(--lg-card-border); }
.lg-new { margin: 22px 0 0; text-align: center; color: var(--lg-muted); font-size: 14px; }
.lg-new a { font-weight: 700; text-decoration: none; }
.lg-new a:hover { text-decoration: underline; }
.lg-legal { margin: 12px 0 0; text-align: center; font-size: 13px; }
.lg-legal a { color: var(--lg-muted); text-decoration: none; display: inline-block; padding: 6px 4px; }
.lg-legal a:hover { color: var(--lg-heading); text-decoration: underline; }
.lg-foot { text-align: center; color: var(--lg-muted); font-size: 12.5px; padding-top: 8px; }

/* The local-tester reCAPTCHA notice uses Bootstrap utilities; keep it readable in dark mode. */
[data-theme="dark"] .lg-captcha .bg-light { background: var(--lg-soft) !important; color: var(--lg-text) !important; border-color: var(--lg-border) !important; }

/* ---------- Tablet: compact brand band + centred card ---------- */
@media (min-width: 768px) {
    .lg-shell { grid-template-rows: auto 1fr; }
    .lg-hero { display: block; }
    .lg-hero-inner { padding: 28px 40px; gap: 10px; max-width: 760px; margin: 0 auto; }
    .lg-hero h1 { font-size: 1.45rem; }
    .lg-hero-sub { font-size: 14px; }
    .lg-hero-logo { height: 36px; margin-bottom: 4px; }
    .lg-hero .lg-modules, .lg-hero .lg-hero-foot { display: none; }
    .lg-top-logo-wrap { display: none; }
    .lg-main { padding: 20px 32px 24px; }
    .lg-card {
        padding: 36px 36px 30px;
        background: var(--lg-card);
        border: 1px solid var(--lg-card-border);
        border-radius: 18px;
        box-shadow: var(--lg-card-shadow);
    }
}

/* ---------- Desktop: two columns ---------- */
@media (min-width: 1024px) {
    .lg-shell { grid-template-columns: minmax(0, 55fr) minmax(0, 45fr); grid-template-rows: none; }
    .lg-hero {
        background-image: url('../images/login-hero.svg'), linear-gradient(150deg, var(--lg-hero-1) 0%, var(--lg-hero-2) 48%, var(--lg-hero-3) 100%);
        background-repeat: no-repeat, no-repeat;
        background-position: right -40px bottom -10px, 0 0;
        background-size: min(78%, 760px) auto, cover;
    }
    .lg-hero { display: flex; }
    .lg-hero-inner {
        flex: 1 1 auto;
        width: 100%;
        max-width: 760px;
        margin: 0;
        padding: clamp(32px, 5vh, 64px) clamp(32px, 4.5vw, 72px);
        gap: clamp(16px, 2.6vh, 26px);
        justify-content: space-between;
    }
    .lg-hero-copy { display: flex; flex-direction: column; gap: clamp(14px, 2.2vh, 22px); }
    .lg-hero h1 { font-size: clamp(1.75rem, 1rem + 1.6vw, 2.6rem); max-width: 18em; }
    .lg-hero-sub { font-size: clamp(14.5px, .8rem + .3vw, 17px); }
    .lg-hero-logo { height: 44px; margin-bottom: 6px; }
    .lg-hero .lg-modules { display: grid; }
    .lg-hero .lg-hero-foot { display: flex; }
    .lg-main { padding: 22px clamp(24px, 3vw, 48px) 20px; }
    .lg-card { max-width: 460px; }
    .lg-foot { display: none; }
}
/* Shorter laptop screens: tighter vertical rhythm so the form fits without scrolling where it can. */
@media (min-width: 1024px) and (max-height: 920px) {
    .lg-main { padding-top: 16px; padding-bottom: 12px; }
    .lg-center { padding: 8px 0; }
    .lg-card { padding: 28px 32px 22px; }
    .lg-lead { margin-bottom: 16px; }
    .lg-field { margin-bottom: 12px; }
    .lg-or { margin: 16px 0 12px; }
    .lg-soc { gap: 8px; }
    .lg-new { margin-top: 16px; }
    .lg-legal { margin-top: 6px; }
}
@media (min-width: 1024px) and (max-height: 760px) {
    .lg-modules li { padding: 8px 12px; }
    .lg-modules i { width: 26px; height: 26px; font-size: 14px; }
}
/* Very wide screens: keep the brand copy at a readable width. */
@media (min-width: 1800px) {
    .lg-hero-inner { margin-left: auto; margin-right: 6vw; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
