/* ==========================================================================
   PORTAL MARIALVA — identidade visual (azul / preto / branco / prata)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700&family=Barlow:wght@400;500;600;700&display=swap');

:root {
    --azul: #0066B1;
    --azul-escuro: #00205B;
    --azul-vivo: #0284C7;
    --marinho: #001233;
    --marinho-2: #1a1657;
    --preto: #000000;
    --branco: #ffffff;
    --prata: #c9ced6;
    --prata-2: #eef0f3;
    --cinza-texto: #5a6472;
    --cinza-borda: #dde1e6;
    --vermelho-m: #dc2430;
    --violeta-m: #d9a521;
    --radius: 6px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Barlow', 'Segoe UI', sans-serif;
    background: var(--branco);
    color: var(--marinho);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand-word, .tag-stripe {
    font-family: 'Barlow Condensed', 'Barlow', sans-serif;
    letter-spacing: 0.02em;
}

a { color: inherit; text-decoration: none; }

/* -------------------------------------------------------------------- */
/* Tarja tricolor — assinatura de performance, usada com moderação      */
/* -------------------------------------------------------------------- */
.tricolor-stripe {
    display: flex;
    height: 3px;
    width: 46px;
}
.tricolor-stripe span { flex: 1; }
.tricolor-stripe span:nth-child(1) { background: var(--azul); }
.tricolor-stripe span:nth-child(2) { background: var(--violeta-m); }
.tricolor-stripe span:nth-child(3) { background: var(--vermelho-m); }

/* ========================================================================
   SPLASH
   ======================================================================== */
#splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--marinho);
    background-image:
        linear-gradient(var(--marinho-2) 1px, transparent 1px),
        linear-gradient(90deg, var(--marinho-2) 1px, transparent 1px);
    background-size: 42px 42px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}
#splash.hide { opacity: 0; visibility: hidden; pointer-events: none; }

.badge-portal {
    width: 76px;
    height: 76px;
    position: relative;
}
.badge-portal svg { width: 100%; height: 100%; }
.badge-portal circle.ring {
    fill: none;
    stroke: var(--azul);
    stroke-width: 2.5;
    stroke-dasharray: 226;
    stroke-dashoffset: 226;
    animation: draw-ring 1.1s cubic-bezier(.4,0,.2,1) forwards 0.15s;
}
.badge-portal path.mark {
    fill: var(--branco);
    opacity: 0;
    animation: fade-in 0.4s ease forwards 0.9s;
}
@keyframes draw-ring { to { stroke-dashoffset: 0; } }
@keyframes fade-in { to { opacity: 1; } }

.splash-word {
    text-align: center;
    opacity: 0;
    animation: fade-in 0.5s ease forwards 0.75s;
}
.splash-word .brand-word {
    color: var(--branco);
    font-size: 1.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.22em;
}
.splash-word .brand-sub {
    display: block;
    margin-top: 4px;
    color: var(--prata);
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    font-family: 'Barlow', sans-serif;
}

.splash-bar {
    width: 180px;
    height: 2px;
    background: rgba(255,255,255,0.12);
    overflow: hidden;
    border-radius: 2px;
}
.splash-bar i {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--azul);
    animation: load-bar 1.6s cubic-bezier(.4,0,.2,1) forwards 0.2s;
}
@keyframes load-bar { to { width: 100%; } }

/* ========================================================================
   LOGIN — split screen
   ======================================================================== */
.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    opacity: 0;
}
.login-shell.show {
    opacity: 1;
    transition: opacity 0.5s ease 0.1s;
}

/* Painel esquerdo — institucional */
.panel-brand {
    position: relative;
    background: var(--marinho);
    color: var(--branco);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3.2rem 3.6rem;
    overflow: hidden;
}
.panel-brand::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 340px;
    height: 340px;
    background: radial-gradient(circle at top right, var(--azul-escuro) 0%, transparent 70%);
    opacity: 0.55;
}
.panel-brand::after {
    content: '';
    position: absolute;
    left: -60px;
    bottom: -120px;
    width: 420px;
    height: 420px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 50%;
}

.brand-top { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; }
.brand-top .badge-mini { width: 34px; height: 34px; flex-shrink: 0; }
.brand-top .brand-word { font-size: 1.05rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; }

.brand-mid { position: relative; z-index: 2; max-width: 480px; }
.brand-mid .eyebrow {
    display: inline-block;
    font-size: 0.7rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--prata);
    margin-bottom: 14px;
}
.brand-mid h1 {
    font-size: 2.5rem;
    line-height: 1.12;
    font-weight: 600;
    margin-bottom: 18px;
}
.brand-mid h1 em {
    font-style: normal;
    color: var(--azul-vivo);
}
.brand-mid p {
    color: var(--prata);
    font-family: 'Barlow', sans-serif;
    font-size: 0.95rem;
    line-height: 1.55;
    max-width: 400px;
}

.brand-bottom { position: relative; z-index: 2; }
.module-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.module-chips span {
    font-family: 'Barlow', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 999px;
    color: var(--prata-2);
}
.module-chips span i { color: var(--azul-vivo); margin-right: 6px; }

/* Painel direito — formulário */
.panel-form {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--branco);
    padding: 2rem;
}
.form-box { width: 100%; max-width: 360px; }
.form-box h2 {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.form-box .subtitle {
    font-family: 'Barlow', sans-serif;
    color: var(--cinza-texto);
    font-size: 0.88rem;
    margin-bottom: 28px;
}

.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-family: 'Barlow', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--cinza-texto);
    margin-bottom: 6px;
}
.field input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--cinza-borda);
    border-radius: var(--radius);
    font-family: 'Barlow', sans-serif;
    font-size: 0.95rem;
    color: var(--marinho);
    background: var(--prata-2);
    outline: none;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.field input:focus {
    border-color: var(--azul);
    background: var(--branco);
    box-shadow: 0 0 0 3px rgba(61,110,163,0.12);
}

.btn-primary {
    width: 100%;
    padding: 13px 16px;
    background: var(--marinho);
    color: var(--branco);
    border: none;
    border-radius: var(--radius);
    font-family: 'Barlow', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.15s;
    margin-top: 6px;
}
.btn-primary:hover { background: var(--azul-escuro); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-primary svg { width: 16px; height: 16px; }

.alert-error {
    background: #fdeceb;
    border: 1px solid #f3c6c2;
    color: #9c2b23;
    font-family: 'Barlow', sans-serif;
    font-size: 0.85rem;
    padding: 10px 12px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.form-footer {
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid var(--cinza-borda);
    font-family: 'Barlow', sans-serif;
    font-size: 0.75rem;
    color: var(--cinza-texto);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

@media (max-width: 880px) {
    .login-shell { grid-template-columns: 1fr; }
    .panel-brand { padding: 2.2rem 1.8rem 2.6rem; }
    .brand-mid h1 { font-size: 1.9rem; }
    .panel-form { padding: 2.4rem 1.6rem 3rem; }
}

/* ========================================================================
   HUB — painel de módulos
   ======================================================================== */
body.hub-body { background: var(--prata-2); min-height: 100vh; }

.hub-topbar {
    background: var(--marinho);
    color: var(--branco);
    padding: 0.9rem 2.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 2px solid var(--azul);
}
.hub-brand { display: flex; align-items: center; gap: 10px; }
.hub-brand .badge-mini { width: 28px; height: 28px; }
.hub-brand .brand-word { font-size: 0.92rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; }

.hub-user { display: flex; align-items: center; gap: 16px; }
.hub-user .who { text-align: right; font-family: 'Barlow', sans-serif; }
.hub-user .who strong { display: block; font-size: 0.82rem; font-weight: 600; }
.hub-user .who span { font-size: 0.68rem; color: var(--prata); letter-spacing: 0.04em; text-transform: uppercase; }

.btn-logout {
    font-family: 'Barlow', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--prata-2);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 7px 13px;
    border-radius: var(--radius);
    transition: border-color 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-logout:hover { border-color: var(--azul-vivo); color: var(--branco); }

.hub-main { max-width: 1140px; margin: 0 auto; padding: 2.6rem 2.2rem 4rem; }
.hub-header { margin-bottom: 2.2rem; }
.hub-header .eyebrow {
    display: block;
    font-family: 'Barlow', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--azul-escuro);
    margin-bottom: 8px;
}
.hub-header h1 { font-size: 1.9rem; font-weight: 600; }
.hub-header p {
    font-family: 'Barlow', sans-serif;
    color: var(--cinza-texto);
    font-size: 0.92rem;
    margin-top: 4px;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.1rem;
}

/* Tile / botão de módulo — modelo "launcher de apps" */
.module-card {
    background: var(--branco);
    border: 1px solid var(--cinza-borda);
    border-radius: var(--radius);
    padding: 1.9rem 1.4rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.9rem;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.module-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--azul);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}
.module-card:hover {
    border-color: var(--azul);
    transform: translateY(-3px);
    box-shadow: 0 12px 24px -12px rgba(10,18,32,0.18);
}
.module-card:hover::before { transform: scaleX(1); }

.module-card .icon-box {
    width: 58px;
    height: 58px;
    border-radius: var(--radius);
    background: var(--marinho);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s;
}
.module-card .icon-box svg { width: 26px; height: 26px; stroke: var(--branco); }
.module-card:hover .icon-box { background: var(--azul); }

.module-card h3 { font-size: 1rem; font-weight: 600; }

.module-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.module-footer .acessar {
    font-family: 'Barlow', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--azul-escuro);
    display: flex;
    align-items: center;
    gap: 5px;
}
.module-footer .acessar svg { width: 12px; height: 12px; transition: transform 0.15s; }
.module-card:hover .acessar svg { transform: translateX(3px); }

.status-tag {
    font-family: 'Barlow', sans-serif;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 999px;
    background: #eef1f6;
    color: var(--azul-escuro);
}

/* Módulo não liberado para este tenant */
.module-card.locked {
    cursor: not-allowed;
    background: var(--prata-2);
}
.module-card.locked .icon-box { background: var(--prata); }
.module-card.locked .icon-box svg { stroke: #8a92a0; }
.module-card.locked h3 { color: #8a92a0; }
.module-card.locked:hover {
    border-color: var(--cinza-borda);
    transform: none;
    box-shadow: none;
}
.module-card.locked:hover::before { transform: scaleX(0); }
.module-card.locked .status-tag {
    background: #e4e6ea;
    color: #6b7280;
}
.module-card.locked .acessar { color: #8a92a0; }

.hub-footer {
    max-width: 1140px;
    margin: 2rem auto 0;
    padding: 1.4rem 2.2rem 0;
    border-top: 1px solid var(--cinza-borda);
    font-family: 'Barlow', sans-serif;
    font-size: 0.75rem;
    color: var(--cinza-texto);
    display: flex;
    justify-content: space-between;
}
