/*
 * Public entry of the admin: landing (/) and the entry screen (/login) with its steps.
 * Standalone on purpose: the Bootstrap of the admin is not loaded on these two pages.
 * One theme only (declared in docs/specs/001-entrada-admin/spec.md); every colour is a token.
 */
:root {
    --brand: #000064;
    --brand-deep: #00003c;
    --accent: #d8ae64;
    --accent-ink: #1c1400;
    --on-brand: #ffffff;
    --on-brand-soft: #d6d8ee;
    --surface: #ffffff;
    --ink: #1b1d2a;
    --ink-soft: #55586b;
    --line: #c5c8d6;
    --field: #f3f4f9;
    --ok: #17693a;
    --error: #b3261e;
    --focus: #1a56db;
    color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
    font-family: "Open Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--surface);
}

a { color: inherit; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---- landing ---------------------------------------------------------------- */

.landing {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding: 48px 56px 32px;
    color: var(--on-brand);
    background: linear-gradient(160deg, var(--brand) 0%, var(--brand-deep) 100%);
}

.landing-brand img { display: block; width: 240px; max-width: 70%; height: auto; }

.landing-hero { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 720px; }

.landing-hero h1 { margin: 0 0 16px; font-size: 40px; line-height: 1.15; font-weight: 600; }

.landing-hero p { margin: 0 0 32px; font-size: 18px; color: var(--on-brand-soft); }

.landing-footer { font-size: 13px; color: var(--on-brand-soft); }

.landing-footer a { text-decoration: underline; text-underline-offset: 3px; }

.landing-footer span { margin: 0 8px; }

/* ---- buttons ---------------------------------------------------------------- */

.btn-entry {
    display: inline-block;
    min-height: 48px;
    padding: 12px 28px;
    border: 0;
    border-radius: 6px;
    font: inherit;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    color: var(--accent-ink);
    background: var(--accent);
    cursor: pointer;
}

.btn-entry:hover { filter: brightness(1.06); }

.btn-entry[disabled] { opacity: .5; cursor: not-allowed; filter: none; }

.btn-entry.block { display: block; width: 100%; }

.link-btn {
    padding: 0; border: 0; background: none; font: inherit; color: var(--ink-soft);
    text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

/* ---- entry screen: two panels of 50% ------------------------------------------ */

.entry { min-height: 100%; display: flex; }

/* the form comes first in the document and shows on the right */
.entry-form { order: 2; flex: 0 0 50%; display: flex; align-items: center; justify-content: center; padding: 48px 32px; }

.entry-side {
    order: 1;
    flex: 0 0 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 56px;
    color: var(--on-brand);
    background: linear-gradient(160deg, var(--brand) 0%, var(--brand-deep) 100%);
}

.entry-side img { display: block; width: 220px; height: auto; margin-bottom: 40px; }

.entry-side h2 { margin: 0 0 16px; font-size: 30px; line-height: 1.2; font-weight: 600; }

.entry-side p { margin: 0 0 28px; color: var(--on-brand-soft); max-width: 460px; }

.entry-side ul { margin: 0; padding: 0; list-style: none; }

.entry-side li { position: relative; margin-bottom: 14px; padding-left: 34px; }

.entry-side li:before {
    content: "\2713";
    position: absolute; left: 0; top: 1px;
    width: 22px; height: 22px; border-radius: 50%;
    font-size: 13px; line-height: 22px; text-align: center; font-weight: 700;
    color: var(--accent-ink); background: var(--accent);
}

.entry-box { width: 100%; max-width: 420px; }

.entry-brand-small { display: none; margin-bottom: 28px; padding: 14px 18px; border-radius: 6px; background: var(--brand); }

.entry-brand-small img { display: block; width: 150px; height: auto; }

.entry-box h1 { margin: 0 0 6px; font-size: 26px; line-height: 1.2; }

.entry-box .lead { margin: 0 0 28px; color: var(--ink-soft); }

.entry-foot { margin-top: 28px; font-size: 14px; color: var(--ink-soft); text-align: center; }

.entry-foot a { text-decoration: underline; text-underline-offset: 3px; }

/* below 768px the institutional panel leaves; the brand stays */
@media (max-width: 767px) {
    .entry-side { display: none; }
    .entry-form { flex-basis: 100%; align-items: flex-start; padding: 32px 20px; }
    .entry-brand-small { display: inline-block; }
    .landing { padding: 32px 24px 24px; }
    .landing-hero h1 { font-size: 30px; }
}

/* ---- fields ------------------------------------------------------------------- */

.field { margin-bottom: 18px; }

.field label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }

.field-row { display: flex; align-items: center; gap: 6px; }

.field-box { position: relative; flex: 1; min-width: 0; }

.field-box input {
    display: block; width: 100%; min-height: 48px; padding: 10px 44px 10px 14px;
    border: 1px solid var(--line); border-radius: 6px;
    font: inherit; color: var(--ink); background: var(--field);
}

.field-box input:focus { border-color: var(--focus); outline: 3px solid var(--focus); outline-offset: 0; }

/* the "x": inside the box, on the right, only when there is something to clear */
.field-clear {
    position: absolute; top: 4px; right: 2px; width: 40px; height: 40px;
    border: 0; border-radius: 50%; background: none; color: var(--ink-soft);
    font-size: 20px; line-height: 1; cursor: pointer;
}

.field-clear[hidden] { display: none; }

/* the eye: outside the box, never over what was typed */
.field-eye {
    flex: 0 0 44px; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 6px;
    background: var(--surface); color: var(--ink-soft); cursor: pointer;
}

.field-eye svg { display: block; margin: 0 auto; }

.field-hint { margin-top: 6px; font-size: 13px; }

.field-hint.error { color: var(--error); }

.field-under { margin: -8px 0 18px; text-align: right; font-size: 14px; }

/* ---- messages ------------------------------------------------------------------ */

.notice { margin-bottom: 18px; padding: 10px 14px; border-radius: 6px; font-size: 14px; border: 1px solid; }

.notice[hidden] { display: none; }

.notice.error { color: var(--error); border-color: var(--error); background: #fdf1f0; }

.notice.ok { color: var(--ok); border-color: var(--ok); background: #eef8f1; }

.notice.info { color: var(--ink); border-color: var(--line); background: var(--field); }

/* ---- one-time code: six squares ------------------------------------------------- */

.otp { display: flex; gap: 8px; }

.otp input {
    flex: 1; min-width: 0; height: 54px; padding: 0; text-align: center;
    border: 1px solid var(--line); border-radius: 6px;
    font: inherit; font-size: 22px; font-weight: 600; color: var(--ink); background: var(--field);
}

.otp input:focus { border-color: var(--focus); outline: 3px solid var(--focus); outline-offset: 0; }

/* ---- password rules: three states, never colour alone ---------------------------- */

.rules { margin: 0 0 18px; padding: 0; list-style: none; font-size: 14px; }

.rules li { position: relative; margin-bottom: 4px; padding-left: 26px; color: var(--ink-soft); }

.rules li:before { content: "\25CB"; position: absolute; left: 2px; top: 0; font-weight: 700; }

.rules li[data-state="ok"] { color: var(--ok); }

.rules li[data-state="ok"]:before { content: "\2713"; }

.rules li[data-state="missing"] { color: var(--error); font-weight: 600; }

.rules li[data-state="missing"]:before { content: "\2717"; }

.step[hidden] { display: none; }
