:root {
  --bg: #0b1020; --panel: rgba(18,25,45,.9); --line: rgba(255,255,255,.08);
  --text: #f5f7fb; --muted: #8f9bb3; --primary: #5b8cff; --primary-2:#7aa2ff;
  --green:#43d19e; --red:#ff6b7a; --gray:#7d8799; --shadow:0 18px 50px rgba(0,0,0,.22);
  --radius:18px;
}
*{box-sizing:border-box}
html{min-height:100%;background:var(--bg)}
body{margin:0;min-height:100vh;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:var(--text);background:radial-gradient(circle at 10% 0%,rgba(91,140,255,.14),transparent 30rem),radial-gradient(circle at 100% 0%,rgba(67,209,158,.08),transparent 26rem),var(--bg)}
button,input,select{font:inherit}button{cursor:pointer}
.shell{width:min(1500px,calc(100% - 36px));margin:0 auto;padding:34px 0 60px}
.topbar{display:flex;align-items:flex-start;justify-content:space-between;gap:24px;margin-bottom:28px}
.eyebrow{margin:0 0 7px;color:var(--primary-2);font-size:11px;font-weight:800;letter-spacing:.16em}
h1,h2,p{margin-top:0}h1{margin-bottom:8px;font-size:clamp(28px,4vw,44px);line-height:1;letter-spacing:-.04em}.subtitle{margin-bottom:0;color:var(--muted)}
.topbar-actions{display:flex;align-items:center;gap:10px}.countdown-box{min-width:125px;padding:10px 14px;border:1px solid var(--line);border-radius:14px;background:rgba(255,255,255,.03)}.countdown-box span{display:block;color:var(--muted);font-size:11px}.countdown-box strong{display:block;margin-top:2px;font-size:18px}
.btn{min-height:43px;border:1px solid transparent;border-radius:12px;padding:0 16px;color:var(--text);font-weight:750;transition:.16s ease}.btn:hover{transform:translateY(-1px)}.btn:disabled{opacity:.55;cursor:wait;transform:none}.btn-primary{background:linear-gradient(135deg,var(--primary),#6c6cff);box-shadow:0 8px 22px rgba(91,140,255,.22)}.btn-secondary{border-color:var(--line);background:rgba(255,255,255,.04)}
.summary-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px}.summary-card{min-height:102px;padding:19px;border:1px solid var(--line);border-radius:var(--radius);background:var(--panel);box-shadow:var(--shadow)}.summary-card span{display:block;margin-bottom:8px;color:var(--muted);font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.08em}.summary-card strong{font-size:34px;letter-spacing:-.05em}.online-card strong{color:var(--green)}.offline-card strong{color:var(--red)}
.toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:18px 0}.filter-group{display:flex;gap:10px;flex:1}.field{width:100%;min-height:43px;border:1px solid var(--line);border-radius:11px;padding:0 12px;outline:none;color:var(--text);background:rgba(255,255,255,.04)}.field:focus{border-color:rgba(91,140,255,.65);box-shadow:0 0 0 3px rgba(91,140,255,.1)}#searchInput{max-width:360px}#statusFilter{max-width:180px}.last-update{color:var(--muted);font-size:13px}.last-update strong{color:var(--text)}
.source-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.source-card{position:relative;min-width:0;overflow:hidden;border:1px solid var(--line);border-radius:var(--radius);background:linear-gradient(180deg,rgba(25,33,57,.95),rgba(15,22,40,.95));box-shadow:var(--shadow)}.source-card::before{content:"";position:absolute;inset:0 auto auto 0;width:100%;height:2px;background:var(--gray)}.source-card.status-online::before{background:var(--green)}.source-card.status-offline::before{background:var(--red)}
.card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:18px 18px 12px}.card-title-wrap{min-width:0}.card-title{margin:0 0 4px;overflow:hidden;font-size:18px;text-overflow:ellipsis;white-space:nowrap}.card-description{color:var(--muted);font-size:11px}
.status-pill{display:inline-flex;align-items:center;gap:7px;flex:0 0 auto;border:1px solid var(--line);border-radius:999px;padding:6px 9px;color:var(--muted);background:rgba(255,255,255,.035);font-size:10px;font-weight:850;letter-spacing:.08em;text-transform:uppercase}.status-dot{width:7px;height:7px;border-radius:50%;background:var(--gray);box-shadow:0 0 0 3px rgba(125,135,153,.12)}.status-online .status-dot{background:var(--green);box-shadow:0 0 0 3px rgba(67,209,158,.12)}.status-offline .status-dot{background:var(--red);box-shadow:0 0 0 3px rgba(255,107,122,.12)}
.connection-panel{display:grid;grid-template-columns:1.5fr 1fr;gap:10px;padding:4px 18px 10px}.connection-panel>div{padding:13px;border:1px solid var(--line);border-radius:13px;background:rgba(255,255,255,.025)}.label{display:block;margin-bottom:5px;color:var(--muted);font-size:11px}.connection-number{display:block;font-size:28px;letter-spacing:-.04em}.latency strong{font-size:18px}
.usage-bar{height:8px;margin:2px 18px 6px;overflow:hidden;border-radius:999px;background:rgba(255,255,255,.06)}.usage-fill{height:100%;border-radius:inherit;background:linear-gradient(90deg,var(--primary),var(--green));transition:width .3s ease}.usage-meta{display:flex;justify-content:space-between;gap:10px;padding:0 18px;color:var(--muted);font-size:10px}
.chart-wrap{padding:15px 18px 6px}.chart-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;color:var(--muted);font-size:11px}.sparkline{display:block;width:100%;height:94px;overflow:visible}.spark-grid{stroke:rgba(255,255,255,.05);stroke-width:1}.spark-area{fill:rgba(91,140,255,.07)}.spark-line{fill:none;stroke:#7aa2ff;stroke-width:2.2;vector-effect:non-scaling-stroke}.spark-empty{display:flex;align-items:center;height:94px;color:var(--muted);font-size:12px}
.card-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:11px 18px 16px}.source-url{min-width:0;overflow:hidden;color:var(--muted);font-size:10px;text-overflow:ellipsis;white-space:nowrap}.card-actions{display:flex;flex:0 0 auto;gap:7px}.mini-btn{border:1px solid var(--line);border-radius:9px;padding:6px 9px;color:var(--muted);background:rgba(255,255,255,.03);font-size:11px}.mini-btn:hover{color:var(--text);background:rgba(255,255,255,.06)}.error-line{margin:0 18px 10px;padding:9px 10px;border:1px solid rgba(255,107,122,.18);border-radius:10px;color:#ff9ca6;background:rgba(255,107,122,.07);font-size:11px}
.empty{padding:70px 20px;text-align:center;color:var(--muted)}.hidden{display:none!important}
.modal-backdrop{position:fixed;z-index:100;inset:0;display:grid;place-items:center;padding:20px;background:rgba(4,8,18,.76);backdrop-filter:blur(10px)}.modal{width:min(680px,100%);max-height:calc(100vh - 40px);overflow:auto;border:1px solid var(--line);border-radius:20px;padding:20px;background:#11182a;box-shadow:0 30px 90px rgba(0,0,0,.45)}.modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:16px}.modal-head h2{margin-bottom:0}.icon-btn{width:38px;height:38px;border:1px solid var(--line);border-radius:10px;color:var(--muted);background:rgba(255,255,255,.03);font-size:24px;line-height:1}
form label{display:block;margin-bottom:13px}form label>span{display:block;margin-bottom:7px;color:#dbe2f1;font-size:12px;font-weight:700}form small{display:block;margin-top:5px;color:var(--muted);font-size:10px}.toggle-row{display:flex;align-items:center;gap:9px;padding:6px 0}.toggle-row>span{margin:0}.form-error{margin:6px 0 0;color:#ff9aa5;font-size:12px}.modal-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:18px}
@media(max-width:1100px){.source-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.summary-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.topbar{flex-direction:column}.topbar-actions{width:100%;flex-wrap:wrap}}
@media(max-width:700px){.shell{width:min(100% - 22px,1500px);padding-top:20px}.source-grid{grid-template-columns:1fr}.summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.summary-card{min-height:88px}.toolbar,.filter-group{align-items:stretch;flex-direction:column}#searchInput,#statusFilter{max-width:none}.last-update{align-self:flex-start}.topbar-actions .btn{flex:1 1 auto}.connection-panel{grid-template-columns:1fr 1fr}}

/* Authentication + account UI */
.user-menu{display:flex;align-items:center;gap:9px;min-height:43px;padding:5px 6px 5px 8px;border:1px solid var(--line);border-radius:13px;background:rgba(255,255,255,.035)}
.user-avatar{display:grid;place-items:center;width:31px;height:31px;border-radius:9px;background:linear-gradient(135deg,var(--primary),#6c6cff);font-size:12px;font-weight:900;box-shadow:0 6px 16px rgba(91,140,255,.2)}
.user-copy{display:flex;flex-direction:column;min-width:76px;line-height:1.15}.user-copy span{color:var(--muted);font-size:9px;text-transform:uppercase;letter-spacing:.08em}.user-copy strong{margin-top:3px;max-width:110px;overflow:hidden;text-overflow:ellipsis;font-size:11px;white-space:nowrap}
.logout-btn{min-height:31px;border:1px solid var(--line);border-radius:9px;padding:0 10px;color:var(--muted);background:rgba(255,255,255,.03);font-size:10px;font-weight:750}.logout-btn:hover{color:#fff;background:rgba(255,255,255,.07)}

.auth-body{overflow-x:hidden;background:radial-gradient(circle at 14% 12%,rgba(91,140,255,.18),transparent 28rem),radial-gradient(circle at 88% 90%,rgba(67,209,158,.08),transparent 26rem),#080d1a}
.auth-page{width:min(1120px,calc(100% - 36px));min-height:100vh;margin:0 auto;display:grid;grid-template-columns:1.1fr .9fr;gap:80px;align-items:center;padding:56px 0}
.auth-brand{max-width:560px}.brand-mark{display:flex;align-items:flex-end;gap:5px;width:48px;height:48px;margin-bottom:28px;padding:10px;border:1px solid rgba(122,162,255,.2);border-radius:15px;background:rgba(91,140,255,.08);box-shadow:0 18px 60px rgba(20,45,100,.22)}.brand-mark span{display:block;width:7px;border-radius:999px;background:linear-gradient(180deg,#8bb0ff,#4f7df1)}.brand-mark span:nth-child(1){height:14px}.brand-mark span:nth-child(2){height:26px}.brand-mark span:nth-child(3){height:19px}
.auth-brand h1{max-width:520px;margin-bottom:20px;font-size:clamp(42px,6vw,72px);line-height:.94;letter-spacing:-.055em}.auth-brand-copy{max-width:500px;color:var(--muted);font-size:16px;line-height:1.7}
.security-list{display:grid;gap:10px;margin-top:32px}.security-list>div{display:flex;align-items:center;justify-content:space-between;gap:20px;max-width:470px;padding:12px 14px;border:1px solid rgba(255,255,255,.055);border-radius:12px;background:rgba(255,255,255,.025)}.security-list strong{font-size:12px}.security-list span{color:var(--muted);font-size:11px;text-align:right}
.auth-card{position:relative;width:100%;min-height:470px;padding:30px;border:1px solid rgba(255,255,255,.09);border-radius:24px;background:linear-gradient(180deg,rgba(20,28,49,.96),rgba(13,19,35,.98));box-shadow:0 34px 100px rgba(0,0,0,.34)}.auth-card::before{content:"";position:absolute;inset:0 24px auto;height:1px;background:linear-gradient(90deg,transparent,rgba(122,162,255,.45),transparent)}
.auth-card-head{margin-bottom:24px}.auth-card-head h2{margin-bottom:8px;font-size:27px;letter-spacing:-.035em}.auth-card-head p:last-child{margin-bottom:0;color:var(--muted);font-size:13px;line-height:1.6}
.auth-field{min-height:50px;border-radius:13px;background:rgba(255,255,255,.035)}.auth-submit{width:100%;min-height:50px;margin-top:9px;border-radius:13px}
.password-wrap{position:relative}.password-wrap .field{padding-right:78px}.password-toggle{position:absolute;top:50%;right:8px;transform:translateY(-50%);height:34px;border:0;border-radius:8px;padding:0 9px;color:var(--muted);background:transparent;font-size:10px;font-weight:750}.password-toggle:hover{color:#fff;background:rgba(255,255,255,.05)}
.code-field{text-transform:uppercase;letter-spacing:.14em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
.password-hint{height:5px;margin:2px 0 7px;overflow:hidden;border-radius:999px;background:rgba(255,255,255,.06)}.password-hint span{display:block;width:0;height:100%;border-radius:inherit;background:var(--red);transition:width .2s ease}.password-hint span[data-level="medium"]{background:#f2c94c}.password-hint span[data-level="high"]{background:var(--green)}.password-text{margin:0 0 12px;color:var(--muted);font-size:10px}
.auth-loading{min-height:410px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:14px;color:var(--muted);font-size:12px}.spinner{width:30px;height:30px;border:3px solid rgba(255,255,255,.08);border-top-color:var(--primary-2);border-radius:50%;animation:spin .8s linear infinite}.auth-fatal{color:#ff9aa5}@keyframes spin{to{transform:rotate(360deg)}}

@media(max-width:900px){.auth-page{grid-template-columns:1fr;gap:36px;padding:40px 0}.auth-brand{max-width:640px}.auth-brand h1{font-size:48px}.security-list{display:none}.auth-card{max-width:640px}.topbar-actions{align-items:stretch}.user-menu{flex:1 1 100%}}
@media(max-width:520px){.auth-page{width:min(100% - 22px,1120px);padding:24px 0}.auth-brand h1{font-size:39px}.auth-brand-copy{font-size:14px}.auth-card{min-height:440px;padding:22px;border-radius:19px}.brand-mark{margin-bottom:20px}.user-copy{min-width:0;flex:1}.user-copy strong{max-width:180px}}

/* Multi-user administration */
.modal-subtitle{margin:7px 0 0;color:var(--muted);font-size:11px;line-height:1.5}.user-admin-modal{width:min(980px,100%)}.admin-user-layout{display:grid;grid-template-columns:minmax(250px,.72fr) minmax(0,1.28fr);gap:14px}.create-user-panel,.users-list-panel{border:1px solid var(--line);border-radius:16px;padding:16px;background:rgba(255,255,255,.022)}.create-user-panel h3,.users-list-panel h3,.reset-password-panel h3{margin:0 0 14px;font-size:15px;letter-spacing:-.02em}.admin-full-btn{width:100%;margin-top:3px}.users-list-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:12px}.users-list-head h3{margin-bottom:3px}.users-list-head p{margin:0;color:var(--muted);font-size:10px}.users-list{display:grid;gap:8px;max-height:430px;overflow:auto;padding-right:2px}.user-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:center;padding:12px;border:1px solid rgba(255,255,255,.06);border-radius:12px;background:rgba(255,255,255,.025)}.user-row-main{display:flex;align-items:center;gap:10px;min-width:0}.user-row-avatar{display:grid;place-items:center;flex:0 0 auto;width:34px;height:34px;border-radius:10px;background:rgba(91,140,255,.11);color:var(--primary-2);font-size:11px;font-weight:900}.user-row-copy{min-width:0}.user-row-copy strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}.user-row-copy span{display:block;margin-top:3px;color:var(--muted);font-size:9px}.user-status{display:inline-flex;align-items:center;gap:5px;margin-left:7px;font-size:8px;font-weight:800;text-transform:uppercase;letter-spacing:.07em}.user-status::before{content:"";width:6px;height:6px;border-radius:50%;background:var(--green)}.user-status.disabled::before{background:var(--red)}.user-row-actions{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}.user-row-actions .mini-btn.danger-soft{color:#ff9aa5;border-color:rgba(255,107,122,.18);background:rgba(255,107,122,.05)}.user-row-actions .mini-btn.success-soft{color:#7ee2bd;border-color:rgba(67,209,158,.18);background:rgba(67,209,158,.05)}.user-admin-note{padding:10px 12px;border:1px dashed rgba(122,162,255,.2);border-radius:11px;color:var(--muted);font-size:10px;line-height:1.5}.reset-password-panel{margin-top:14px;border:1px solid rgba(122,162,255,.18);border-radius:15px;padding:16px;background:rgba(91,140,255,.045)}.reset-password-panel h3{margin-bottom:0}.reset-fields{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-top:12px}.reset-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:10px}.users-empty{padding:28px 12px;text-align:center;color:var(--muted);font-size:11px}
@media(max-width:820px){.admin-user-layout{grid-template-columns:1fr}.users-list{max-height:320px}.reset-fields{grid-template-columns:1fr}}@media(max-width:560px){.user-row{grid-template-columns:1fr}.user-row-actions{justify-content:flex-start}.user-admin-modal{padding:16px}}


/* Histórico completo de 48 horas */
.history-modal{width:min(1180px,100%);max-height:calc(100vh - 28px);padding:22px}.history-modal-head{position:sticky;z-index:5;top:-22px;margin:-22px -22px 18px;padding:22px;border-bottom:1px solid var(--line);background:rgba(17,24,42,.97);backdrop-filter:blur(12px)}.history-head-actions{display:flex;align-items:center;gap:10px}.history-range-label{display:flex;align-items:center;gap:8px;margin:0}.history-range-label>span{margin:0;color:var(--muted);font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.08em}.history-range{width:126px;min-height:38px}.history-loading{display:flex;min-height:310px;align-items:center;justify-content:center;flex-direction:column;gap:12px;color:var(--muted);font-size:12px}.history-kpis{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:9px;margin-bottom:12px}.history-kpis article{padding:13px;border:1px solid var(--line);border-radius:13px;background:rgba(255,255,255,.025)}.history-kpis span{display:block;margin-bottom:6px;color:var(--muted);font-size:9px;text-transform:uppercase;letter-spacing:.07em}.history-kpis strong{display:block;font-size:20px;letter-spacing:-.035em}.history-chart-card,.history-events-card{margin-top:10px;border:1px solid var(--line);border-radius:15px;padding:14px;background:rgba(255,255,255,.018)}.history-chart-title,.history-events-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:10px}.history-chart-title strong,.history-events-head strong{display:block;font-size:12px}.history-chart-title div>span,.history-events-head div>span{display:block;margin-top:4px;color:var(--muted);font-size:9px}.history-legend{display:flex!important;align-items:center;gap:7px!important;margin:0!important;color:var(--muted);font-size:9px!important;white-space:nowrap}.legend-dot{display:inline-block!important;width:7px;height:7px;margin:0!important;border-radius:50%;background:#7aa2ff}.legend-dot.latency-dot{background:#f2c94c}.legend-line{display:inline-block!important;width:18px;height:0;margin:0 0 0 8px!important;border-top:2px dashed rgba(67,209,158,.75)}.history-canvas-wrap{position:relative;width:100%;min-width:0;overflow:hidden;border-radius:10px;background:rgba(4,8,18,.24)}.history-canvas{display:block;width:100%;height:300px}.history-canvas-small{height:210px}.history-tooltip{position:absolute;z-index:4;width:178px;pointer-events:none;border:1px solid rgba(122,162,255,.22);border-radius:10px;padding:9px 10px;color:var(--text);background:rgba(7,12,24,.96);box-shadow:0 12px 30px rgba(0,0,0,.28);font-size:9px}.history-tooltip strong{display:block;margin-bottom:5px;font-size:10px}.history-tooltip span{display:block;margin-top:2px;color:var(--muted)}.status-history-card{padding-bottom:10px}.status-history-canvas{display:block;width:100%;height:58px;border-radius:9px;background:rgba(4,8,18,.18)}.history-coverage{color:var(--muted);font-size:9px;text-align:right}.history-events{display:grid;gap:6px;max-height:260px;overflow:auto}.history-event-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:9px;align-items:center;padding:9px 10px;border:1px solid rgba(255,255,255,.05);border-radius:10px;background:rgba(255,255,255,.018)}.history-event-dot{width:8px;height:8px;border-radius:50%;background:var(--gray)}.history-event-dot.online{background:var(--green)}.history-event-dot.offline{background:var(--red)}.history-event-row strong{display:block;font-size:10px}.history-event-row>div>span{display:block;margin-top:2px;color:var(--muted);font-size:8px}.history-event-values{display:flex;gap:14px!important;text-align:right}.history-event-values span{margin:0!important;white-space:nowrap}.history-events-empty{padding:24px;text-align:center;color:var(--muted);font-size:10px}
@media(max-width:980px){.history-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}.history-modal{width:min(100%,900px)}}@media(max-width:650px){.history-modal{padding:14px}.history-modal-head{top:-14px;margin:-14px -14px 14px;padding:14px}.history-modal-head{flex-direction:column}.history-head-actions{width:100%;justify-content:space-between}.history-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.history-chart-title,.history-events-head{flex-direction:column}.history-event-values{display:none}.history-canvas{height:260px}.history-range-label{flex:1}.history-range{width:100%}}
