:root {
  color-scheme: dark;
  --brand: #5b8def;
  --brand-ink: #0d1b26;
  --brand-soft: rgba(91, 141, 239, 0.14);
  --bg: #0d1b26;
  --bg-deep: #091520;
  --surface: #132532;
  --surface-2: #19303f;
  --line: #26394a;
  --text: #e8eff4;
  --muted: #8fa6b6;
  --ok: #4cc38a;
  --warn: #f0b84b;
  --crit: #f0605d;
  --ok-soft: rgba(76, 195, 138, 0.14);
  --warn-soft: rgba(240, 184, 75, 0.14);
  --crit-soft: rgba(240, 96, 93, 0.16);
  --menu-bg: #091520;
  --menu-text: #e8eff4;
  --login-bg: #091520;
  --login-ink: #e8eff4;
  --login-muted: #8fa6b6;
  --radius: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- botões e campos ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--text); }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--brand); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--text); border-color: var(--line); }
.btn-danger { color: var(--crit); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 14px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; font-weight: 600; font-size: 15px; }
.field small { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea { min-height: 44px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-deep); font-weight: 400; width: 100%; }
.field input[type="color"] { padding: 4px; width: 72px; }
.field input:focus, .field select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.check { display: flex; gap: 10px; align-items: center; font-weight: 400; margin-bottom: 8px; }
.check input { width: 18px; height: 18px; min-height: 0; }
.error { background: var(--crit-soft); border: 1px solid var(--crit); color: #ffd7d6; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 15px; }
.note { background: var(--brand-soft); border: 1px solid var(--brand); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 15px; }
.note-ok { background: var(--ok-soft); border-color: var(--ok); }
.tag { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-crit { background: var(--crit-soft); color: var(--crit); }
.tag-brand { background: var(--brand-soft); color: var(--brand); }

/* ---- entrada ---- */
.gate { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 5fr) 6fr; }
.gate-brand { background: var(--login-bg); color: var(--login-ink); border-right: 1px solid var(--line); padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.gate-brand::after { content: ""; position: absolute; inset: auto -120px -160px auto; width: 460px; height: 460px; border-radius: 50%; border: 1px solid var(--line); box-shadow: 0 0 0 60px rgba(91,141,239,.04), 0 0 0 120px rgba(91,141,239,.03); pointer-events: none; }
.logo { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 20px; letter-spacing: -0.01em; }
.logo img { width: 38px; height: 38px; object-fit: contain; }
.gate-brand h1 { font-size: clamp(30px, 3.4vw, 46px); line-height: 1.1; letter-spacing: -0.02em; font-weight: 800; max-width: 12ch; }
.gate-brand p { margin-top: 16px; color: var(--login-muted); max-width: 34ch; }
/* imagem da tela de entrada */
.gate-brand > * { position: relative; z-index: 1; }
.gate-img { position: absolute !important; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0 !important; }
.gate-brand.has-img::after { inset: 0; width: auto; height: auto; border: 0; border-radius: 0; box-shadow: none; z-index: 0; background: linear-gradient(to top, color-mix(in srgb, var(--login-bg) 94%, transparent) 8%, color-mix(in srgb, var(--login-bg) 72%, transparent) 55%, color-mix(in srgb, var(--login-bg) 55%, transparent)); }
.gate-form { display: grid; place-items: center; padding: 32px; }
.card { width: 100%; max-width: 420px; }
.card h2 { font-size: 26px; letter-spacing: -0.01em; margin-bottom: 6px; }
.card > p { margin-bottom: 24px; color: var(--muted); }
.card .btn { width: 100%; }
.card .alt { margin-top: 14px; text-align: center; }
.code-input { font-size: 28px !important; letter-spacing: 0.35em; text-align: center; font-variant-numeric: tabular-nums; }
.steps { padding-left: 20px; margin: 0 0 18px; color: var(--muted); display: grid; gap: 6px; }
.steps b { color: var(--text); }
.qr { display: block; background: #fff; border-radius: 10px; padding: 8px; width: 200px; height: 200px; margin: 6px auto 12px; }
.secret { display: block; text-align: center; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; letter-spacing: 0.08em; background: var(--bg-deep); border: 1px dashed var(--line); border-radius: 8px; padding: 10px; margin-bottom: 18px; word-break: break-all; user-select: all; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.codes li { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--bg-deep); border: 1px solid var(--line); border-radius: 8px; padding: 8px; text-align: center; user-select: all; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.row .btn { flex: 1; width: auto; }
.row .tag { align-self: center; flex: 0 0 auto; }

/* ---- painel ---- */
.top { display: flex; align-items: center; gap: 16px; padding: 16px 32px; border-bottom: 1px solid var(--line); background: var(--menu-bg); color: var(--menu-text); position: sticky; top: 0; z-index: 5; }
.top .logo { margin-right: auto; font-size: 18px; }
.top .who { text-align: right; line-height: 1.25; }
.top .who small { display: block; opacity: .7; }
.top .btn-quiet { color: var(--menu-text); opacity: .75; }
.top .btn-quiet:hover { opacity: 1; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 40px 32px 80px; }
.banner { display: block; width: 100%; height: clamp(120px, 22vw, 220px); object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 28px; }
.hello { margin-bottom: 32px; }
.hello h1 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.02em; font-weight: 800; }
.hello p { color: var(--muted); margin-top: 6px; }
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.app { --c: var(--brand); position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 16px; align-items: center; padding: 22px 22px 22px 26px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--text); overflow: hidden; transition: border-color .15s, transform .15s, background .15s; }
.app::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.app:hover { border-color: var(--c); background: var(--surface-2); transform: translateY(-2px); }
.app .badge { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; font-weight: 800; color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); }
.app .badge img { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; }
.app .badge.has-img { background: transparent; }
.app h3 { font-size: 19px; line-height: 1.2; }
.app p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.app .host { color: var(--muted); font-size: 13px; margin-top: 8px; opacity: 0.8; word-break: break-all; }
.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--muted); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; }
.panel h2 { font-size: 20px; margin-bottom: 16px; }
.tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: none; border-bottom: 3px solid transparent; padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 700; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--brand); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 14px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
td .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-right: 8px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.temp { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 18px; user-select: all; background: var(--bg-deep); border-radius: 8px; padding: 8px 12px; display: inline-block; margin: 6px 0; }
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgba(5, 12, 18, 0.7); }
dialog h2 { margin-bottom: 16px; font-size: 20px; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* aparência */
.img-field { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.img-field:last-of-type { border-bottom: 0; }
.img-prev { width: 96px; height: 72px; border-radius: 8px; border: 1px dashed var(--line); background: var(--bg-deep); display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: 12px; text-align: center; }
.img-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.img-field b { display: block; }
.img-field small { display: block; color: var(--muted); margin: 2px 0 8px; }
.img-field .row { margin: 0; gap: 8px; }
.img-field .row .btn { flex: 0 0 auto; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 20px; }
.color-grid .field input[type="color"] { width: 100%; }
.panel h3 { font-size: 17px; margin: 4px 0 12px; }
.panel .sep { height: 1px; background: var(--line); margin: 22px 0; border: 0; }
.dlg-icon { margin-bottom: 16px; }
.thumb { width: 28px; height: 28px; border-radius: 7px; object-fit: contain; vertical-align: middle; margin-right: 8px; }

@media (max-width: 820px) {
  .gate { grid-template-columns: 1fr; }
  .gate-brand { padding: 28px 24px; gap: 28px; border-right: none; border-bottom: 1px solid var(--line); }
  .gate-brand h1 { font-size: 28px; max-width: none; }
  .gate-brand::after { display: none; }
  .top { padding: 12px 16px; }
  .wrap { padding: 28px 16px 64px; }
}
@media (prefers-reduced-motion: reduce) { .app { transition: none; } .app:hover { transform: none; } }
