/* ============================================================
   Corella — přihlašovací okno „Uživatel Corelly × Klientský HUB" (V8H3, varianta A).
   Samostatně použitelné: landing (layout.php, za core-landing.css) i /portal (portal.php).
   Vše pod .cl-login-* (tokeny --cl-* definované na .cl-login-overlay), žádné globální resety.
   Pravidla .cl-login-* přesunuta z core-landing.css (V8H3).
   ============================================================ */

/* ---- Fonty (self-host, stejné cesty jako core-landing.css; použité řezy:
        Space Grotesk 700 = nadpis, Hanken Grotesk 400 text / 600 popisky / 700 tlačítka) ---- */
@font-face {
    font-family: "Space Grotesk";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/fonts/space-grotesk-latin-700-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Space Grotesk";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/fonts/space-grotesk-latin-ext-700-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Hanken Grotesk";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/hanken-grotesk-latin-400-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Hanken Grotesk";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/hanken-grotesk-latin-ext-400-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Hanken Grotesk";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("/fonts/hanken-grotesk-latin-600-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Hanken Grotesk";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("/fonts/hanken-grotesk-latin-ext-600-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Hanken Grotesk";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/fonts/hanken-grotesk-latin-700-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Hanken Grotesk";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/fonts/hanken-grotesk-latin-ext-700-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ============================================================
   TOKENY — kopie hodnot z :root core-landing.css, scoped na overlay,
   aby okno fungovalo i bez core-landing.css (např. /portal).
   Landing nemá tmavý motiv (grep prefers-color-scheme v core-landing.css = 0) → jen světlý.
   ============================================================ */
.cl-login-overlay {
    --cl-soft: #F2F5FB;
    --cl-card: #FFFFFF;
    --cl-ink: #2A2D34;
    --cl-body: #3C424C;
    --cl-muted: #646A75;
    --cl-blue: #5B8DD9;
    --cl-blue-soft: #BBD3F2;
    --cl-blue-bg: #E7F0FC;
    --cl-blue-ink: #2F5C9E;
    --cl-sagec: #4F9E7E;
    --cl-sage-bg: #E6F2EC;
    --cl-sage-ink: #2F6B53;
    --cl-lav: #8B72C9;
    --cl-lav-soft: #D8CDF2;
    --cl-lav-bg: #EFEAFA;
    --cl-lav-ink: #5E47A0;
    --cl-hairline: #E7E4DD;
    --cl-hairline-cool: #DEE5F0;
    --cl-error: #D14B57;
    --cl-s1: 4px; --cl-s2: 8px; --cl-s3: 12px; --cl-s4: 16px; --cl-s6: 24px; --cl-s8: 32px;
    --cl-r-btn: 12px;
    --cl-r-card: 22px;
    --cl-r-input: 10px;
    --cl-shadow-1: 0 1px 2px rgba(43, 45, 52, .04), 0 4px 12px rgba(91, 141, 217, .06);
    --cl-shadow-2: 0 2px 6px rgba(43, 45, 52, .05), 0 12px 28px rgba(91, 141, 217, .10), 0 24px 48px rgba(139, 114, 201, .06);
    --cl-shadow-3: 0 8px 20px rgba(43, 45, 52, .06), 0 24px 56px rgba(91, 141, 217, .14), 0 40px 80px rgba(139, 114, 201, .08);
    --cl-glow: 0 6px 22px rgba(91, 141, 217, .32);
    --cl-font-display: "Space Grotesk", "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    --cl-font-body: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    --cl-ease: cubic-bezier(.22, .61, .36, 1);
}

/* ============================================================
   PŘIHLAŠOVACÍ OKNO (přesunuto z core-landing.css, V8H3 varianta A)
   Komponenta: public/site/components/login-modal.php
   JS:         public/js/core-login.js (+ protokol HUBu public/js/portal-login.js)
   ============================================================ */

html.cl-login-open { overflow: hidden; }

.cl-login-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--cl-s6);
    font-family: var(--cl-font-body);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--cl-body);
    text-align: left;
    background: rgba(27, 29, 34, .42);
    -webkit-backdrop-filter: blur(8px) saturate(120%);
    backdrop-filter: blur(8px) saturate(120%);
    animation: cl-login-fade .22s var(--cl-ease);
}
.cl-login-overlay[hidden] { display: none; }

/* Lokální reset — jen uvnitř okna, nic globálního. */
.cl-login-overlay *,
.cl-login-overlay *::before,
.cl-login-overlay *::after { box-sizing: border-box; }
.cl-login-overlay :where(h2, h3, p, form, section, label, input, button) { margin: 0; }
.cl-login-overlay :where(button, input) { font: inherit; }
.cl-login-overlay [hidden] { display: none !important; }

@keyframes cl-login-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.cl-login-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    max-height: calc(100dvh - 2 * var(--cl-s6));
    overflow-y: auto;
    padding: 22px 34px 28px;
    background: var(--cl-card);
    border: 1px solid var(--cl-hairline);
    border-radius: var(--cl-r-card);
    box-shadow: var(--cl-shadow-3);
    animation: cl-login-pop .26s var(--cl-ease);
}

@keyframes cl-login-pop {
    from { opacity: 0; transform: translateY(14px) scale(.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- Horní lišta: Zpět vlevo, Zavřít vpravo ---- */
.cl-login-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--cl-s2);
    min-height: 34px;
    margin: 0 -14px 2px;
}
.cl-login-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--cl-blue-ink);
    font-size: .875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.cl-login-back i { font-size: .75rem; }
.cl-login-back:hover { background: var(--cl-soft); }
.cl-login-back:focus-visible { outline: 2px solid var(--cl-blue); outline-offset: 2px; }

.cl-login-close {
    margin-left: auto;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--cl-hairline);
    border-radius: 50%;
    background: var(--cl-card);
    color: var(--cl-muted);
    font-size: .9375rem;
    cursor: pointer;
    transition: background .2s var(--cl-ease), color .2s var(--cl-ease), transform .16s var(--cl-ease);
}
.cl-login-close:hover { background: var(--cl-soft); color: var(--cl-ink); transform: rotate(90deg); }
.cl-login-close:focus-visible { outline: 2px solid var(--cl-blue); outline-offset: 2px; }

/* ---- Hlavička kroku ---- */
.cl-login-head { text-align: center; margin-bottom: 20px; }
/* hlavička uvnitř flex formuláře: 6px + gap 14px = 20px jako u sekcí */
.cl-login-form > .cl-login-head { margin-bottom: 6px; }
.cl-login-brand { display: flex; justify-content: center; }
.cl-login-brand img { margin: 0 auto; }

.cl-login-badge {
    width: 52px;
    height: 52px;
    margin: 6px auto 0;
    display: grid;
    place-items: center;
    font-size: 1.375rem;
    color: var(--cl-blue-ink);
    background: var(--cl-blue-bg);
    border-radius: 16px;
}
.cl-login-badge--ok { color: var(--cl-sage-ink); background: var(--cl-sage-bg); }
.cl-login-badge--lav { color: var(--cl-lav-ink); background: var(--cl-lav-bg); }

.cl-login-title {
    margin-top: 10px;
    font-family: var(--cl-font-display);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--cl-ink);
    text-wrap: balance;
}
.cl-login-sub {
    max-width: 38ch;
    margin: 6px auto 0;
    font-size: .95rem;
    line-height: 1.45;
    color: var(--cl-muted);
}

/* ---- Kroky + formuláře ---- */
.cl-login-step[hidden],
.cl-login-form[hidden],
.cl-login-field[hidden] { display: none; }
.cl-login-form { display: flex; flex-direction: column; gap: 14px; }

.cl-login-field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.cl-login-field label {
    font-family: var(--cl-font-body);
    font-size: .9rem;
    font-weight: 600;
    color: var(--cl-ink);
}
.cl-login-field input {
    width: 100%;
    min-width: 0;
    padding: 12px 14px;
    font-family: var(--cl-font-body);
    font-size: 1rem;
    color: var(--cl-ink);
    background: var(--cl-card);
    border: 1.5px solid var(--cl-hairline);
    border-radius: var(--cl-r-input);
    transition: border-color .18s var(--cl-ease), box-shadow .18s var(--cl-ease);
}
.cl-login-field input::placeholder { color: var(--cl-muted); opacity: .7; }
.cl-login-field input:focus {
    outline: none;
    border-color: var(--cl-blue);
    box-shadow: 0 0 0 4px var(--cl-blue-bg);
}
.cl-login-code,
.cl-login-2fa-code {
    letter-spacing: .35em;
    text-align: center;
    font-size: 1.25rem !important;
    font-variant-numeric: tabular-nums;
}

/* Vizuálně skryté (pole username pro správce hesel) */
.cl-login-sr {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Heslo + oko */
.cl-login-pass-wrap { position: relative; }
.cl-login-pass-wrap input { padding-right: 48px; }
.cl-login-pass-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--cl-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: color .18s var(--cl-ease), background .18s var(--cl-ease);
}
.cl-login-pass-toggle:hover { color: var(--cl-ink); background: var(--cl-soft); }
.cl-login-pass-toggle:focus-visible { outline: 2px solid var(--cl-blue); outline-offset: 1px; }

/* Captcha */
.cl-login-captcha-wrap { display: flex; gap: var(--cl-s2); }
.cl-login-captcha-wrap input { flex: 1; }
.cl-login-captcha-refresh {
    flex: 0 0 auto;
    width: 50px;
    border: 1.5px solid var(--cl-hairline);
    border-radius: var(--cl-r-input);
    background: var(--cl-card);
    color: var(--cl-muted);
    cursor: pointer;
    transition: color .18s var(--cl-ease), border-color .18s var(--cl-ease);
}
.cl-login-captcha-refresh:hover { color: var(--cl-blue-ink); border-color: var(--cl-blue-soft); }
.cl-login-captcha-refresh:focus-visible { outline: 2px solid var(--cl-blue); outline-offset: 2px; }

/* ---- Tlačítka (kopie .cl-btn* z core-landing.css, jen uvnitř okna) ---- */
.cl-login-overlay .cl-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--cl-s2);
    padding: 13px 18px;
    border-radius: var(--cl-r-btn);
    font-family: var(--cl-font-body);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    border: 1.5px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform .16s var(--cl-ease), background .2s var(--cl-ease),
                box-shadow .22s var(--cl-ease), border-color .2s var(--cl-ease);
}
.cl-login-overlay .cl-btn:active { transform: scale(0.97); }
.cl-login-overlay .cl-btn:focus-visible { outline: 2px solid var(--cl-blue); outline-offset: 2px; }
.cl-login-overlay .cl-btn:disabled { cursor: default; opacity: .75; transform: none; }
.cl-login-overlay .cl-btn-primary {
    background: linear-gradient(135deg, var(--cl-blue) 0%, var(--cl-lav) 100%);
    color: #fff;
    box-shadow: var(--cl-shadow-1);
}
.cl-login-overlay .cl-btn-primary:hover { transform: translateY(-2px); box-shadow: var(--cl-glow), var(--cl-shadow-2); }
.cl-login-overlay .cl-btn-secondary {
    background: var(--cl-card);
    color: var(--cl-ink);
    border-color: var(--cl-hairline);
    box-shadow: var(--cl-shadow-1);
}
.cl-login-overlay .cl-btn-secondary:hover { border-color: var(--cl-blue-soft); transform: translateY(-2px); box-shadow: var(--cl-shadow-2); }
.cl-login-submit,
.cl-login-overlay .cl-login-wide { width: 100%; }

/* ---- Odkazová tlačítka (Zapomněli jste heslo?, Změnit, Poslat kód znovu) ---- */
.cl-login-row { display: flex; justify-content: flex-end; margin-top: -6px; }
.cl-login-forgot,
.cl-login-link {
    padding: 2px 0;
    border: 0;
    background: none;
    font-family: var(--cl-font-body);
    font-size: .9rem;
    font-weight: 600;
    color: var(--cl-blue-ink);
    text-decoration: underline;
    text-decoration-color: var(--cl-blue-soft);
    text-underline-offset: 3px;
    cursor: pointer;
}
.cl-login-forgot:hover,
.cl-login-link:hover { text-decoration-color: currentColor; }
.cl-login-forgot:focus-visible,
.cl-login-link:focus-visible { outline: 2px solid var(--cl-blue); outline-offset: 2px; border-radius: 2px; }
.cl-login-link:disabled { opacity: .6; cursor: default; }

/* ---- Řádek s e-mailem + Změnit ---- */
.cl-login-mailrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    padding: 9px 12px;
    border-radius: var(--cl-r-input);
    background: var(--cl-soft);
    font-size: .92rem;
    color: var(--cl-ink);
}
.cl-login-mailrow > span { min-width: 0; overflow-wrap: anywhere; }

/* ---- „nebo" + poznámka ---- */
.cl-login-nebo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .8rem;
    color: var(--cl-muted);
}
.cl-login-nebo::before,
.cl-login-nebo::after { content: ""; flex: 1; height: 1px; background: var(--cl-hairline); }
.cl-login-pozn { text-align: center; font-size: .85rem; color: var(--cl-muted); }

/* ---- Chyba / info ---- */
.cl-login-error {
    padding: 11px 13px;
    font-size: .92rem;
    color: #C23B48;
    background: #FCEDEE;
    border: 1px solid #F3C9CD;
    border-radius: var(--cl-r-input);
    text-align: left;
}
.cl-login-error[hidden] { display: none; }
.cl-login-info {
    padding: 10px 13px;
    font-size: .88rem;
    color: var(--cl-blue-ink);
    background: var(--cl-blue-bg);
    border: 1px solid var(--cl-blue-soft);
    border-radius: var(--cl-r-input);
    text-align: left;
}
.cl-login-info[hidden] { display: none; }

/* ---- Dlaždice volby (pick / firmy a role) ---- */
.cl-login-tiles { display: grid; gap: 10px; }
.cl-login-tile {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    width: 100%;
    padding: 14px;
    text-align: left;
    font-family: var(--cl-font-body);
    color: var(--cl-muted);
    background: var(--cl-card);
    border: 1.5px solid var(--cl-hairline);
    border-radius: 14px;
    cursor: pointer;
    transition: border-color .18s var(--cl-ease), background .18s var(--cl-ease);
}
.cl-login-tile:hover { border-color: var(--cl-blue-soft); background: var(--cl-soft); }
.cl-login-tile:focus-visible { outline: none; border-color: var(--cl-blue); box-shadow: 0 0 0 4px var(--cl-blue-bg); }
.cl-login-tile:disabled { cursor: progress; opacity: .7; }
.cl-login-tile__ico {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    color: var(--cl-blue-ink);
    background: var(--cl-blue-bg);
    border-radius: 12px;
}
.cl-login-tile__ico--lav { color: var(--cl-lav-ink); background: var(--cl-lav-bg); }
.cl-login-tile__txt { min-width: 0; }
.cl-login-tile__title { display: block; font-size: 1.02rem; font-weight: 700; color: var(--cl-ink); overflow-wrap: anywhere; }
.cl-login-tile__sub { display: block; font-size: .86rem; line-height: 1.35; }
.cl-login-tile__go { font-size: .8125rem; color: var(--cl-muted); }
.cl-login-role {
    padding: 2px 7px;
    border-radius: 6px;
    font-size: .8rem;
    font-weight: 700;
    color: var(--cl-lav-ink);
    background: var(--cl-lav-bg);
    white-space: nowrap;
}

/* ---- 2FA metody ---- */
.cl-login-2fa-methods { display: flex; gap: 6px; flex-wrap: wrap; }
.cl-login-2fa-method {
    flex: 1 1 90px;
    padding: 9px 10px;
    font-family: var(--cl-font-body);
    font-size: .9rem;
    font-weight: 600;
    color: var(--cl-ink);
    background: var(--cl-card);
    border: 1.5px solid var(--cl-hairline);
    border-radius: var(--cl-r-btn);
    cursor: pointer;
    transition: border-color .18s var(--cl-ease), background .18s var(--cl-ease);
}
.cl-login-2fa-method[hidden] { display: none; }
.cl-login-2fa-method:hover { border-color: var(--cl-blue-soft); }
.cl-login-2fa-method.is-active {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--cl-blue) 0%, var(--cl-lav) 100%);
    box-shadow: var(--cl-shadow-1);
}
.cl-login-2fa-method:focus-visible { outline: 2px solid var(--cl-blue); outline-offset: 2px; }

/* ---- Nízká okna (1366×768 a menší výšky) ---- */
@media (max-height: 820px) and (min-width: 561px) {
    .cl-login-overlay { padding: var(--cl-s4); }
    .cl-login-card { max-height: calc(100dvh - 2 * var(--cl-s4)); padding-top: 16px; padding-bottom: 22px; }
    .cl-login-head { margin-bottom: 16px; }
    .cl-login-form > .cl-login-head { margin-bottom: 2px; }
}

/* ---- Telefon (390) ---- */
@media (max-width: 560px) {
    .cl-login-overlay { padding: 10px; align-items: flex-start; }
    .cl-login-card { max-height: calc(100dvh - 20px); padding: 16px 18px 22px; }
    .cl-login-top { margin-inline: -6px; }
    .cl-login-title { font-size: 1.375rem; }
    .cl-login-tile { padding: 12px; gap: 10px; }
}

/* ---- Respekt reduced-motion ---- */
@media (prefers-reduced-motion: reduce) {
    .cl-login-overlay, .cl-login-card { animation: none; }
    .cl-login-close:hover,
    .cl-login-overlay .cl-btn:hover,
    .cl-login-overlay .cl-btn:active { transform: none; }
}
