/* VISEAN Intranet - estilos compartilhados (login, index e telas abertas nas abas) */
@font-face {
    font-family: 'PCAP Terminal';
    src: local('PCAP Terminal'), local('PCAPTerminal'), local('PCap Terminal'),
         url('../WebFonts/PCAPTerminal.woff2') format('woff2'),
         url('../WebFonts/PCAPTerminal.woff') format('woff'),
         url('../WebFonts/PCAPTerminal.ttf') format('truetype');
    font-display: swap;
}

:root {
    --navy: #151C4B;
    --navy-2: #1F2766;
    --navy-deep: #0E1335;
    --teal: #59cacc;
    --teal-dk: #2E9FA1;
    --tab-bg: #59cacc;
    --tab-fg: #ffffff;
    --bg: #F3F5F9;
    --line: #DDE2EC;
    --ink: #1B2140;
    --muted: #6B7394;
    --ok: #1F9D6B;
    --bad: #D64545;
    --warn: #D9941A;
    --side-w: 260px;
    --hdr-h: 56px;
    --ftr-h: 36px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: 'Manrope', system-ui, sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
.font-display { font-family: 'Bricolage Grotesque', 'Manrope', sans-serif; }
.mono { font-family: 'JetBrains Mono', Consolas, monospace; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Marca "V I S E A N" ---------- */
.brand-word {
    font-family: 'PCAP Terminal', 'VT323', 'JetBrains Mono', monospace;
    font-size: 3em; line-height: 1; color: #ffffff; text-align: center;
    white-space: nowrap; font-weight: normal; letter-spacing: .02em;
}

/* ---------- Campos ---------- */
.fld label { display: block; font-size: 12px; font-weight: 700; color: var(--navy); margin-bottom: 5px; }
.fld .hint { font-size: 11.5px; color: var(--warn); margin: 5px 0 0; font-weight: 600; }
.inp {
    width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px;
    font: inherit; font-size: 14px; background: #fff; color: var(--ink); transition: border-color .12s, box-shadow .12s; min-width: 0;
}
.inp:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(89, 202, 204, .25); }
.addon { display: flex; }
.addon > span { display: inline-flex; align-items: center; justify-content: center; width: 42px; flex: none; background: var(--navy); color: #fff; font-size: 13px; border-radius: 8px 0 0 8px; }
.addon > .inp { border-radius: 0 8px 8px 0; }
.addon > .inp.mid { border-radius: 0; }
.addon > button { display: inline-flex; align-items: center; justify-content: center; width: 44px; flex: none; border: 1px solid var(--line); border-left: 0; background: #fff; border-radius: 0 8px 8px 0; color: var(--navy); }
.addon > button:hover { background: var(--teal); color: var(--navy-deep); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 8px; font-weight: 700; font-size: 13.5px; transition: background .12s; white-space: nowrap; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn:disabled { opacity: .55; pointer-events: none; }

/* ---------- SweetAlert na paleta ---------- */
.swal2-popup { font-family: 'Manrope', sans-serif !important; border-radius: 14px !important; }
.swal2-title { font-family: 'Bricolage Grotesque', sans-serif !important; color: var(--navy) !important; }
.swal2-styled.swal2-confirm { background: var(--navy) !important; }
.swal2-styled.swal2-deny { background: var(--bad) !important; }
.swal2-input { font-family: 'Manrope', sans-serif !important; }

/* ==========================================================
   LOGIN
   ========================================================== */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.login-pitch { display: none; }
.login-wrap { display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: 0 18px 50px -20px rgba(21, 28, 75, .35); }
.login-card .brand { background: var(--navy); padding: 30px 16px 26px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.login-card .brand small { color: #9EA6CF; font-size: 11px; font-weight: 700; letter-spacing: .28em; text-transform: uppercase; }
.login-card .body { padding: 28px 26px 26px; }
.login-card h2 { font-family: 'Bricolage Grotesque', sans-serif; font-size: 28px; margin: 0; color: var(--navy); }
.login-card .sub { font-size: 13.5px; color: var(--muted); margin: 6px 0 24px; }
.login-card .fld + .fld { margin-top: 14px; }
.forgot-row { display: flex; justify-content: flex-end; margin-top: 10px; }
.forgot { font-size: 12px; font-weight: 800; letter-spacing: .06em; color: var(--teal-dk); }
.forgot:hover { color: var(--navy); text-decoration: underline; }
.login-card .btn { width: 100%; height: 44px; margin-top: 20px; font-size: 14px; }
.login-card .note { font-size: 12px; color: var(--muted); margin: 22px 0 0; }

@media (min-width: 1024px) {
    .login { grid-template-columns: 1.1fr 1fr; }
    .login-pitch {
        display: flex; flex-direction: column; justify-content: space-between; padding: 48px; color: #fff;
        /* degradê à esquerda mantém o texto legível sobre a imagem */
        background:
            linear-gradient(90deg, rgba(14, 19, 53, .85) 0%, rgba(14, 19, 53, .5) 50%, rgba(14, 19, 53, 0) 75%),
            url('../images/visean_background.jpg') 72% bottom / cover no-repeat,
            var(--navy);
    }
    .login-pitch .tag { font-size: 11px; font-weight: 700; letter-spacing: .28em; color: #7F87B3; text-transform: uppercase; }
    .login-pitch h1 { font-family: 'Bricolage Grotesque', sans-serif; font-size: 44px; line-height: 1.05; margin: 0; max-width: 32rem; }
    .login-pitch p { margin: 20px 0 0; color: #C9CEE6; font-size: 15px; line-height: 1.6; max-width: 28rem; }
    .login-pitch .rack { margin-top: 40px; max-width: 26rem; }
    .login-pitch .host { font-size: 12px; color: #7F87B3; }
    .login-wrap { padding: 48px; background: var(--bg); }
}
.rack-line { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.rack-line .mono { color: #AEB5D9; font-size: 12.5px; }
.rack-line .up { margin-left: auto; color: #7F87B3; font-size: 11.5px; }

/* status "sinal vital" */
.vital { display: inline-flex; align-items: center; }
.vital .dot { position: relative; width: 10px; height: 10px; border-radius: 50%; background: #A7AEC4; flex: none; }
.vital.run .dot { background: var(--ok); }
.vital.run .dot::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ok); animation: pulse 1.8s ease-out infinite; }
.vital.pend .dot { background: var(--warn); animation: blink 1s steps(2) infinite; }
@keyframes pulse { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes blink { 50% { opacity: .25; } }

/* ==========================================================
   APLICAÇÃO (index)
   ========================================================== */
.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }

.app-header { flex: none; height: var(--hdr-h); display: flex; align-items: center; gap: 12px; padding: 0 12px; background: var(--navy); color: #fff; position: relative; z-index: 60; }
.hbtn { width: 38px; height: 38px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; flex: none; }
.hbtn:hover { background: rgba(255,255,255,.1); }
.app-header .brand-word { font-size: 1.7em; }
.app-header .hsub { font-size: 11px; font-weight: 700; letter-spacing: .24em; color: #9EA6CF; text-transform: uppercase; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.15); }
.hright { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px; border-radius: 8px; }
.user-btn:hover { background: rgba(255,255,255,.1); }
.user-ini { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; background: var(--teal); color: var(--navy-deep); }
.user-txt { text-align: left; line-height: 1.2; }
.user-txt b { display: block; font-size: 13px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-txt span { display: block; font-size: 11px; color: #9EA6CF; }
.user-btn .fa-chevron-down { font-size: 10px; color: #9EA6CF; }
.user-menu { position: absolute; right: 0; top: 46px; width: 210px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 6px 0; box-shadow: 0 16px 40px -12px rgba(0,0,0,.35); display: none; }
.user-menu a { display: flex; align-items: center; gap: 12px; padding: 9px 16px; font-size: 13px; }
.user-menu a:hover { background: #FBE3E3; }
.user-menu a.sair { color: var(--bad); }

.app-body { flex: 1; display: flex; min-height: 0; position: relative; }

/* sidebar à esquerda */
.side { flex: none; width: var(--side-w); background: var(--navy-deep); overflow: hidden; transition: width .5s ease, transform .5s ease; }
.side-inner { width: var(--side-w); height: 100%; overflow-y: auto; padding: 12px; }
body.side-closed .side { width: 0; }
.side .grp { font-size: 11px; color: #7F87B3; font-weight: 700; padding: 8px 14px 8px; letter-spacing: .08em; text-transform: uppercase; }
.mhead { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 8px; color: #C9CEE6; font-weight: 700; font-size: 13.5px; transition: background .12s, color .12s; user-select: none; }
.mhead > i:first-child { width: 18px; text-align: center; color: var(--teal); }
.mhead .car { margin-left: auto; font-size: 10px; color: #7F87B3; transition: transform .3s ease; }
.mhead:hover { background: rgba(255,255,255,.07); color: #fff; }
.mgrp.open > .mhead { color: #fff; }
.mgrp.open > .mhead .car { transform: rotate(180deg); color: var(--teal); }
.msub { display: none; padding: 2px 0 6px 22px; }
/* item direto, sem subMenu (ex.: Visão geral) */
.mhead.mtop { margin-bottom: 4px; }
.mhead.mtop.on { background: rgba(89, 202, 204, .18); color: #fff; }
.msub a.mi { display: block; position: relative; padding: 8px 12px 8px 20px; border-radius: 7px; font-size: 13px; font-weight: 600; color: #AEB5D9; transition: background .12s, color .12s; }
.msub a.mi::before { content: ''; position: absolute; left: 6px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: #4A5388; }
.msub a.mi:hover { background: rgba(255,255,255,.06); color: #fff; }
.msub a.mi.on { background: rgba(89, 202, 204, .14); color: #fff; }
.msub a.mi.on::before { background: var(--teal); }
.side-note { margin: 22px 8px 8px; padding: 12px; border-radius: 8px; font-size: 11.5px; line-height: 1.55; color: #9EA6CF; background: rgba(255,255,255,.04); }

.backdrop { display: none; }

/* conteúdo com abas */
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 12px 12px 0; }
.tabbar { flex: none; display: flex; gap: 1px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tab {
    display: inline-flex; align-items: center; gap: 8px; height: 33px; padding: 0 14px; flex: none; max-width: 240px;
    border: 0; border-radius: 9px 9px 0 0; background-color: var(--tab-bg); color: var(--tab-fg);
    font-weight: 700; font-size: 12.5px; letter-spacing: .02em; cursor: pointer; opacity: .6; transition: opacity .2s;
}
.tab.closable { padding-right: 8px; }
.tab .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab:hover { opacity: .85; }
.tab.active { opacity: 1; }
.tab .x { width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: var(--tab-fg); flex: none; }
.tab .x:hover { background: var(--bad); color: #fff; }
.tabpanels { flex: 1; min-height: 0; position: relative; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--tab-bg); border-radius: 0 12px 0 0; overflow: hidden; }
.tabpanel { position: absolute; inset: 0; display: none; }
.tabpanel iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }

.app-footer { flex: none; height: var(--ftr-h); display: flex; align-items: center; gap: 16px; padding: 0 16px; font-size: 12px; font-weight: 700; background: var(--teal); color: var(--navy-deep); }
.app-footer .ver { opacity: .7; }
.app-footer .clock { margin-left: auto; opacity: .85; }

/* tablets e smartphones: sidebar sobreposta */
@media (max-width: 1023.98px) {
    .side { position: absolute; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.35); }
    body.side-closed .side { width: var(--side-w); }
    body.side-open .side { transform: translateX(0); }
    body.side-open .backdrop { display: block; position: absolute; inset: 0; z-index: 40; background: rgba(14, 19, 53, .45); }
}
@media (max-width: 640px) {
    .app-header .hsub, .user-txt, .app-footer .ver { display: none; }
    .app-header .brand-word { font-size: 1.45em; }
    .app-main { padding: 8px 6px 0; }
    .tab { max-width: 170px; padding: 0 10px; }
    .tabpanels { border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .vital.run .dot::after, .vital.pend .dot { animation: none; }
}

/* ---------- Página em desenvolvimento ---------- */
.dev-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px 16px; text-align: center; background: #fff; }
.dev-page i { font-size: 54px; color: var(--teal); }
.dev-page h1 { font-family: 'Bricolage Grotesque', sans-serif; font-size: clamp(28px, 6vw, 64px); line-height: 1.05; color: var(--navy); margin: 0; }
.dev-page p { color: var(--muted); font-size: 15px; margin: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #C5CBDB; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
.side ::-webkit-scrollbar-thumb { background: #2A3263; }
