/* Paleta e componentes do H2NODE Auth/Backup (slate + brand), no tema escuro. */
:root {
  color-scheme: dark;
  --s950: #020617; --s900: #0f172a; --s800: #1e293b; --s700: #334155; --s500: #64748b; --s400: #94a3b8; --s300: #cbd5e1; --s100: #f1f5f9;
  --b300: #86b9ff; --b400: #4f92ff; --b500: #2b6cf6; --rose: #fb7185;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--s700) transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--s950); color: var(--s100); font: 14px/1.45 ui-sans-serif, system-ui, sans-serif, "Segoe UI Emoji"; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul, menu { margin: 0; padding: 0; }
ul { list-style: none; }
h1 { font-size: 20px; font-weight: 700; text-align: center; }
h2 { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
h3 { font-size: 14px; font-weight: 600; }
.card { border: 1px solid var(--s800); background: var(--s900); border-radius: 12px; }
button, input, select { font: inherit; color: inherit; }
button { border: 1px solid var(--s700); background: var(--s800); color: #e2e8f0; border-radius: 8px; padding: 7px 14px; font-weight: 500; cursor: pointer; transition: background .15s; }
button:hover { background: var(--s700); }
.primary { background: #1a4fd8; border-color: #1a4fd8; color: #fff; }
.primary:hover { background: var(--b500); }
.danger { background: #be123c; border-color: #be123c; color: #fff; }
.danger:hover { background: #e11d48; }
:focus-visible { outline: 2px solid var(--b400); outline-offset: 1px; }
input:not([type=checkbox]), select { width: 100%; border: 1px solid var(--s700); background: var(--s800); border-radius: 8px; padding: 8px 12px; }
input::placeholder { color: var(--s400); }
input[type=checkbox] { accent-color: var(--b500); margin: 0; }
:disabled { opacity: .5; }
.label { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .025em; color: var(--s400); }
.error { color: var(--rose); font-size: 13px; min-height: 1.4em; }
.hint { color: var(--s400); font-size: 12px; }

#login { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; overflow: hidden; }
#login form { position: relative; width: 100%; max-width: 384px; padding: 24px; display: grid; gap: 12px; }
#login img { justify-self: center; }
.wave { position: absolute; bottom: 0; left: 0; width: 200%; height: 224px; fill: var(--b400); opacity: .12; animation: drift 26s linear infinite; }
.w2 { height: 160px; fill: var(--b300); opacity: .08; animation: drift 38s linear infinite reverse; }
@keyframes drift { to { transform: translateX(-50%); } }

#app { display: grid; grid-template-columns: 56px 264px 1fr; height: 100%; }
#rail { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; background: var(--s900); border-right: 1px solid var(--s800); }
#rail img { margin-bottom: 8px; }
#rail button { width: 40px; height: 40px; padding: 10px; background: none; border: 0; color: var(--s400); }
#rail button:hover { background: var(--s800); color: #fff; }
#rail .on { background: #2b6cf626; color: var(--b300); }
#rail svg { width: 20px; height: 20px; display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

#side, #ipamside { background: var(--s900); border-right: 1px solid var(--s800); overflow-y: auto; padding: 14px 16px; min-height: 0; }
.brand { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.brand b { font-size: 16px; letter-spacing: -.02em; }
.brand small, #summary { color: var(--s400); font-size: 12px; }
#add { width: 100%; margin-top: 12px; }
details { border-top: 1px solid var(--s800); margin-top: 14px; padding-top: 12px; }
summary { cursor: pointer; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--s400); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::before { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform .15s; }
details[open] > summary::before { transform: rotate(45deg); }
.count { margin-left: auto; background: var(--s800); border: 1px solid var(--s700); border-radius: 99px; padding: 0 8px; font-size: 11px; color: var(--s300); }
#list, #vlans { max-height: 250px; overflow-y: auto; display: grid; gap: 2px; }
#list button, #vlans button { width: 100%; text-align: left; display: grid; grid-template-columns: 12px 1fr; column-gap: 10px; align-items: center; background: none; border-color: transparent; padding: 5px 10px; font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
#list button:hover, #vlans button:hover { background: var(--s800); }
#list [aria-pressed=true], #vlans [aria-pressed=true] { background: #2b6cf626; border-color: var(--b500); }
#list small, #vlans small { grid-column: 2; color: var(--s400); font-weight: 400; font-size: 12px; }
.sw { width: 10px; height: 10px; border-radius: 3px; }
#list .bad { color: var(--rose); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--s950); border: 1px solid var(--s800); border-radius: 8px; padding: 3px; margin-bottom: 8px; }
.seg button { border: 0; background: none; color: var(--s400); padding: 5px; border-radius: 6px; font-size: 13px; }
.seg [aria-pressed=true] { background: var(--s800); color: #fff; }
.checks { display: flex; gap: 16px; margin-top: 8px; }
.checks label, .check { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.two button { padding: 6px; font-size: 13px; }
.wide { grid-column: 1 / -1; }
#legend li { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--s300); padding: 3px 0; }
#legend .sw { flex: none; }

main { position: relative; overflow: hidden; min-width: 0; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; user-select: none;
  background: radial-gradient(circle, #1e293b 1px, transparent 1.2px) 0 0 / 24px 24px, var(--s950); }
#map:active { cursor: grabbing; }
.flow { animation: flow var(--dur) linear infinite; }
@keyframes flow { from { stroke-dashoffset: var(--from); } to { stroke-dashoffset: var(--to); } }
.pulse { animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { from { stroke: #22d3ee; } to { stroke: #1e293b; } }
#search { position: absolute; left: 16px; top: 16px; width: min(320px, calc(100% - 32px)) !important; background: var(--s900) !important; }
#cam { position: absolute; right: 16px; bottom: 16px; display: grid; border: 1px solid var(--s700); border-radius: 8px; overflow: hidden; }
#cam button { border: 0; border-radius: 0; width: 34px; height: 34px; padding: 0; background: var(--s900); }
#cam button:hover { background: var(--s800); }
#empty { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; color: var(--s400); }
#empty h2 { color: var(--s100); margin-bottom: 4px; }
#tip { position: fixed; z-index: 5; pointer-events: none; background: var(--s800); border: 1px solid var(--s700); border-radius: 8px; padding: 6px 10px; font-size: 12px; max-width: 320px; white-space: pre-line; }

#panel { position: absolute; right: 16px; top: 16px; bottom: 16px; width: min(420px, calc(100% - 32px)); padding: 18px; overflow: auto; box-shadow: 0 20px 40px #0008; }
#panel .top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
#panel .top button { padding: 2px 9px; background: none; border: 0; color: var(--s400); }
#panel .acts { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
#panel p { color: var(--s400); font-size: 13px; overflow-wrap: anywhere; }
#panel p.bad, .bad { color: var(--rose) !important; }
.good { color: #34d399; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--s800); margin: 14px 0 10px; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--s400); padding: 7px 10px; }
.tabs [aria-selected=true] { border-color: var(--b400); color: var(--b300); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .025em; color: var(--s400); }
td, th { padding: 6px 10px 6px 0; vertical-align: top; border-bottom: 1px solid var(--s800); }
td:first-child { font-family: var(--mono); font-size: 12px; }
td small { display: block; color: var(--s400); }

dialog { background: var(--s900); color: var(--s100); border: 1px solid var(--s800); border-radius: 12px; width: min(560px, 94vw); padding: 24px; }
dialog::backdrop { background: #0f172ab3; backdrop-filter: blur(4px); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 8px; }
menu { display: flex; justify-content: end; gap: 8px; margin-top: 8px; }
.sr { position: absolute; width: 1px; height: 1px !important; overflow: hidden; clip-path: inset(50%); padding: 0 !important; border: 0 !important; }
.av { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: #18306e; color: var(--b300); font-weight: 700; font-size: 13px; flex: none; }
.av img { width: 100%; height: 100%; object-fit: cover; }
#avatar { margin-top: auto; }
#rail #logout { margin-top: 0; }
#rail #avatar img { margin: 0; }
#app.users > #side, #app.users > main, #app.ipam > #side, #app.ipam > main { display: none; }
#userspage { grid-column: 2 / -1; grid-row: 1 / -1; }
.page { overflow: auto; padding: 24px 28px; }
.page header { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.page h1 { text-align: left; }
.page header p { color: var(--s400); }
.page th, .page td { padding: 12px 16px; vertical-align: middle; white-space: nowrap; }
.page tr:last-child td { border: 0; }
#userspage td:first-child { font: inherit; font-size: 14px; }
#userspage .off td:not(:last-child) { opacity: .5; }
#ipamside { grid-column: 2; grid-row: 1 / -1; }
#ipampage { grid-column: 3; grid-row: 1 / -1; }
.bare .access { display: none !important; }
#ipamsearch { max-width: 320px; margin: 8px 0 4px; }
#ipampage td small { white-space: normal; }
#ipampage .tag { margin-left: 8px; font-family: ui-sans-serif, system-ui, sans-serif; }
.bar { display: block; width: 120px; height: 6px; border-radius: 3px; background: var(--s800); overflow: hidden; margin: 4px 0; }
.bar i { display: block; height: 100%; background: var(--b400); }
#ipammenu { display: grid; gap: 2px; margin-top: 16px; }
#ipammenu button { text-align: left; background: none; border-color: transparent; padding: 7px 10px; font-size: 13px; font-weight: 600; }
#ipammenu button:hover { background: var(--s800); }
#ipammenu [aria-current=page] { background: #2b6cf626; border-color: var(--b500); color: var(--b300); }
#ipammenu .sub { padding-left: 24px; }
#ipammenu .group { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--s400); padding: 10px 10px 2px; }
.person { display: flex; align-items: center; gap: 12px; }
.person small { display: block; color: var(--s400); }
.tag { border-radius: 99px; padding: 2px 10px; font-size: 12px; font-weight: 600; background: var(--s800); color: var(--s300); }
.tag.ok { background: #064e3b; color: #6ee7b7; } .tag.warn { background: #78350f; color: #fcd34d; } .tag.no { background: #881337; color: #fecdd3; }
.row { display: flex; gap: 6px; justify-content: end; }
.row button { padding: 4px 10px; font-size: 13px; }
.photo { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.photo .av { width: 72px; height: 72px; font-size: 24px; }
.btn { display: inline-block; border: 1px solid var(--s700); background: var(--s800); border-radius: 8px; padding: 7px 14px; font-weight: 500; cursor: pointer; position: relative; }
.btn:hover { background: var(--s700); }
.btn:focus-within { outline: 2px solid var(--b400); outline-offset: 1px; }
#mfasetup { display: grid; gap: 10px; text-align: center; }
#mfasetup img { border-radius: 8px; background: #fff; }
#mfakey { font-family: var(--mono); color: var(--s100); overflow-wrap: anywhere; }
#mfaform [name=code] { text-align: center; font: 18px var(--mono); letter-spacing: .3em; }

@media (max-width: 760px) {
  #app { grid-template-columns: 48px 1fr; grid-template-rows: 36% 1fr; }
  #rail { grid-row: 1 / 3; } #rail img { width: 30px; }
  #side, #ipamside { border-bottom: 1px solid var(--s800); }
  #ipamside { grid-row: 1; } #ipampage { grid-column: 2; grid-row: 2; }
  .grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
