/* ── RESET ──────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --tk-primary: #273165;
    --tk-primary-light: rgba(39, 49, 101, 0.12);
    --tk-accent: #F4991C;
    --tk-accent-hover: #e08810;
    --tk-error: #e74c3c;
    --tk-error-bg: #fef2f2;
    --tk-banner-expired: #fef3c7;
    --tk-banner-info: #dbeafe;
    --tk-text: #1a202c;
    --tk-text-muted: #aab0c0;
    --tk-text-footer: #94a3b8;
    --tk-border: #e2e8f0;
    --tk-bg-input: #f8fafc;
    --tk-bg-card: #ffffff;
    --tk-shadow-card: 0 24px 64px rgba(0, 0, 0, 0.40);
    --tk-overlay: rgba(10, 18, 42, 0.55);
    --tk-radius: 14px;
    --tk-radius-sm: 8px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
    font-family: 'Roboto', sans-serif;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    height: 100%;
}

body {
    background: #0f1929;
    color: var(--tk-text);
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ── VIDEO DE FONDO ─────────────────────────────────── */
.tk-video-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.tk-video-bg__overlay {
    position: absolute;
    inset: 0;
    background: var(--tk-overlay);
    z-index: 1;
}

.tk-video-bg__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

/* ── WRAP CENTRADO ──────────────────────────────────── */
.tk-login-wrap {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    padding-top: calc(20px + var(--safe-top));
    padding-bottom: calc(20px + var(--safe-bottom));
}

/* ── CARD ───────────────────────────────────────────── */
.tk-card {
    background: var(--tk-bg-card);
    border-radius: var(--tk-radius);
    box-shadow: var(--tk-shadow-card);
    width: 100%;
    max-width: 392px;
    padding: 36px 32px 28px;
}

/* ── LOGO TK ────────────────────────────────────────── */
.tk-brand-logo {
    display: block;
    height: 34px;
    margin: 0 auto 18px;
    object-fit: contain;
}

/* ── LOGO EMPRESA ───────────────────────────────────── */
.tk-company-logo {
    text-align: center;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--tk-border);
}

.tk-company-logo img {
    max-height: 52px;
    max-width: 100%;
    object-fit: contain;
}

/* ── ERROR ──────────────────────────────────────────── */
.tk-error {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--tk-error-bg);
    color: var(--tk-error);
    border: 1px solid #fecaca;
    border-radius: var(--tk-radius-sm);
    padding: 10px 12px;
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.4;
    animation: tkFadeIn 0.25s ease-out;
}

.tk-error__text {
    flex: 1;
}

.tk-error__close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--tk-error);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.tk-error__close:hover {
    opacity: 1;
}

/* ── BANNER (reason) ────────────────────────────────── */
.tk-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: var(--tk-radius-sm);
    padding: 10px 12px;
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.4;
    animation: tkFadeIn 0.25s ease-out;
}

.tk-banner--expired {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.tk-banner--conflict,
.tk-banner--deactivated {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.tk-banner__icon::before {
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 14px;
}

.tk-banner--expired .tk-banner__icon::before {
    content: '\f017';
}

.tk-banner--conflict .tk-banner__icon::before,
.tk-banner--deactivated .tk-banner__icon::before {
    content: '\f05a';
}

.tk-banner__text {
    flex: 1;
}

.tk-banner__close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.tk-banner__close:hover {
    opacity: 1;
}

/* ── INPUT FIELDS ───────────────────────────────────── */
.tk-field {
    position: relative;
    margin-bottom: 12px;
}

.tk-field__icon {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: var(--tk-text-muted);
    font-size: 14px;
    pointer-events: none;
    z-index: 1;
    transition: color 0.18s;
}

.tk-field__input {
    display: block;
    width: 100%;
    padding: 11px 14px 11px 36px;
    font-size: 14.5px;
    border: 1.5px solid var(--tk-border);
    border-radius: var(--tk-radius-sm);
    background: var(--tk-bg-input);
    color: var(--tk-text);
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
    outline: none;
    -webkit-appearance: none;
    line-height: 1.4;
}

.tk-field__input::placeholder {
    color: var(--tk-text-muted);
}

.tk-field__input:focus {
    border-color: var(--tk-primary);
    background: #fff;
    box-shadow: 0 0 0 3px var(--tk-primary-light);
}

.tk-field__input:focus ~ .tk-field__icon,
.tk-field:focus-within .tk-field__icon {
    color: var(--tk-primary);
}

/* ── PASSWORD TOGGLE ────────────────────────────────── */
.tk-field__toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--tk-text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    line-height: 1;
    z-index: 1;
    transition: color 0.15s;
    -webkit-appearance: none;
}

.tk-field__toggle:hover {
    color: var(--tk-primary);
}

/* ── AUTOCOMPLETE OVERRIDE ──────────────────────────── */
.tk-field__input:-webkit-autofill,
.tk-field__input:-webkit-autofill:hover,
.tk-field__input:-webkit-autofill:focus {
    transition: background-color 5000s ease-in-out 0s !important;
    -webkit-text-fill-color: var(--tk-text) !important;
    box-shadow: 0 0 0 30px #f8fafc inset !important;
}

/* ── CHECKBOX RECORDARME ────────────────────────────── */
.tk-remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #4a5568;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    margin-bottom: 0;
}

.tk-remember input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.tk-remember__checkmark {
    width: 16px;
    height: 16px;
    border: 1.5px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, background 0.15s;
}

.tk-remember__checkmark::after {
    content: '';
    display: none;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -1px;
}

.tk-remember input:checked + .tk-remember__checkmark {
    background: var(--tk-primary);
    border-color: var(--tk-primary);
}

.tk-remember input:checked + .tk-remember__checkmark::after {
    display: block;
}

.tk-remember input:focus-visible + .tk-remember__checkmark {
    box-shadow: 0 0 0 2px var(--tk-primary-light);
}

/* ── ACTIONS ROW ────────────────────────────────────── */
.tk-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    min-height: 20px;
}

.tk-forgot {
    font-size: 12.5px;
    color: var(--tk-primary);
    text-decoration: none;
    opacity: 0.85;
    transition: opacity 0.15s, color 0.15s;
}

.tk-forgot:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ── BUTTON ─────────────────────────────────────────── */
.tk-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px;
    background: var(--tk-accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--tk-radius-sm);
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: background 0.18s, transform 0.1s, box-shadow 0.18s, opacity 0.18s;
    box-shadow: 0 4px 16px rgba(244, 153, 28, 0.30);
    -webkit-appearance: none;
    position: relative;
    overflow: hidden;
}

.tk-btn:hover {
    background: var(--tk-accent-hover);
    box-shadow: 0 6px 20px rgba(244, 153, 28, 0.40);
}

.tk-btn:active {
    transform: scale(0.98);
}

.tk-btn:focus-visible {
    outline: 2px solid var(--tk-accent);
    outline-offset: 2px;
}

/* ── BUTTON LOADING ─────────────────────────────────── */
.tk-btn__spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tkSpin 0.6s linear infinite;
}

.tk-btn--loading .tk-btn__text {
    opacity: 0.7;
}

.tk-btn--loading .tk-btn__spinner {
    display: inline-block;
}

.tk-btn--loading {
    cursor: not-allowed;
    pointer-events: none;
}

/* ── FOOTER ─────────────────────────────────────────── */
.tk-card-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 11px;
    color: var(--tk-text-footer);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* ── ANIMATIONS ─────────────────────────────────────── */
@keyframes tkFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes tkSpin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .tk-card {
        max-width: 380px;
        padding: 32px 28px 24px;
    }

    .tk-brand-logo {
        height: 30px;
        margin-bottom: 14px;
    }

    .tk-company-logo {
        padding-bottom: 14px;
        margin-bottom: 14px;
    }

    .tk-company-logo img {
        max-height: 44px;
    }
}

@media (max-width: 480px) {
    .tk-login-wrap {
        padding: 16px 12px;
        padding-top: calc(16px + var(--safe-top));
        padding-bottom: calc(16px + var(--safe-bottom));
    }

    .tk-card {
        max-width: 100%;
        padding: 28px 20px 22px;
        border-radius: 12px;
    }

    .tk-brand-logo {
        height: 26px;
        margin-bottom: 12px;
    }

    .tk-company-logo img {
        max-height: 40px;
    }

    .tk-field {
        margin-bottom: 10px;
    }

    .tk-field__input {
        font-size: 16px;
        padding: 12px 14px 12px 36px;
    }

    .tk-remember {
        font-size: 12.5px;
    }

    .tk-forgot {
        font-size: 12px;
    }

    .tk-btn {
        padding: 14px;
        font-size: 16px;
    }
}

@media (max-width: 360px) {
    .tk-card {
        padding: 24px 16px 20px;
        border-radius: 10px;
    }

    .tk-brand-logo {
        height: 22px;
    }

    .tk-company-logo img {
        max-height: 34px;
    }

    .tk-field__input {
        font-size: 16px;
        padding: 12px 14px 12px 34px;
    }

    .tk-field__icon {
        left: 10px;
        font-size: 13px;
    }
}

@media (min-width: 1024px) {
    .tk-card {
        max-width: 412px;
        padding: 42px 38px 34px;
    }

    .tk-brand-logo {
        height: 38px;
    }

    .tk-company-logo img {
        max-height: 60px;
    }

    .tk-field__input {
        font-size: 15px;
        padding: 12px 14px 12px 38px;
    }
}
