:root {
  --bg: #f3f5fa;
  --sidebar: #08111f;
  --sidebar-2: #0d1a2e;
  --text: #1b2433;
  --muted: #6b778c;
  --gold: #e8a317;
  --white: #fff;
  --line: #e6ebf3;
  --blue: #2f6bff;
  --green: #1aa05a;
  --red: #e23b3b;
  --purple: #6b5cff;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: #d7deea;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 8px 24px;
}
.logo {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f6c34a, #d98a00);
  color: #3b2500;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.brand strong { display: block; font-size: 13px; letter-spacing: .08em; color: #fff; }
.brand span { font-size: 11px; color: #93a0b5; }

.nav-label {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .12em;
  color: #7d8ba3;
  padding: 0 12px;
}

.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: #c5d0e0;
  text-align: left;
  padding: 11px 12px;
  border-radius: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  font: inherit;
}
.nav-item:hover { background: rgba(255,255,255,.05); }
.nav-item.active {
  background: rgba(232,163,23,.14);
  color: #fff;
}
.nav-item .icon { width: 18px; color: var(--gold); }

.sidebar-footer { margin-top: auto; }
.router-pill {
  display: flex;
  gap: 10px;
  align-items: center;
  background: #102038;
  border-radius: 12px;
  padding: 12px;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #2ee59a;
  box-shadow: 0 0 0 4px rgba(46,229,154,.15);
}
.router-pill strong { display: block; font-size: 13px; color: #fff; }
.router-pill small { color: #8ea0b8; }
.app-version { display: block; margin: 9px 12px 0; color: #71819a; font-size: 10px; letter-spacing: .04em; }

main { padding: 22px 28px 40px; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}
.topbar h1 { margin: 0; font-size: 26px; font-weight: 700; }
.subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  min-width: 280px;
  color: var(--muted);
}
.search input {
  border: 0; outline: 0; width: 100%; font: inherit; background: transparent;
}
.search.compact { min-width: 220px; padding: 6px 12px; }
.panel-head-devices { flex-wrap: wrap; row-gap: 10px; }
.panel-head-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; cursor: pointer;
}
.admin { display: flex; align-items: center; gap: 10px; }
.admin strong, .admin small { display: block; text-align: right; }
.admin small { color: var(--muted); font-size: 12px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: #1b2433; color: #fff; display: grid; place-items: center; font-weight: 700;
}

.hidden { display: none !important; }
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
.card {
  background: #fff;
  border-radius: 18px;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  box-shadow: 0 8px 24px rgba(16, 30, 54, .04);
}
.card p { margin: 0; color: var(--muted); font-size: 13px; }
.card h2 { margin: 8px 0 6px; font-size: 32px; }
.card h2 em { font-style: normal; font-size: 16px; color: var(--muted); font-weight: 600; }
.card small { color: var(--muted); }
.up { color: var(--green); }
.warn { color: #d98512; }
.ok { color: var(--green); }
.card-icon {
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center; font-size: 18px;
}
.card-icon.blue { background: #eaf0ff; }
.card-icon.green { background: #e9f8ef; }
.card-icon.red { background: #fdecec; }
.card-icon.purple { background: #efebff; }

.panel {
  background: #fff;
  border-radius: 18px;
  padding: 8px 8px 12px;
  box-shadow: 0 8px 24px rgba(16, 30, 54, .04);
}
.panel-head, .panel-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
}
.panel-head h3, .form h3 { margin: 0 0 4px; }
.panel-head p, .form p { margin: 0; color: var(--muted); font-size: 13px; }
.tabs { display: flex; background: #f3f5fa; padding: 4px; border-radius: 999px; }
.log-source { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: #fff; color: var(--text); font: inherit; font-size: 12px; }
.log-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.tab {
  border: 0; background: transparent; padding: 8px 14px;
  border-radius: 999px; cursor: pointer; font: inherit; color: var(--muted);
}
.tab.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,.06); }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 16px; font-size: 13px; }
th { color: #8a94a6; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; font-size: 11px; }
tr { border-top: 1px solid var(--line); }
.device {
  display: flex; gap: 12px; align-items: center;
}
.device .kind {
  width: 36px; height: 36px; border-radius: 10px;
  background: #f3f5fa; display: grid; place-items: center;
}
.device strong { display: block; }
.device small { color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px; font-weight: 600; font-size: 12px;
}
.badge.bypass { background: #e8f8ef; color: #178a4c; }
.badge.autenticado { background: #efeaff; color: #5b4ad6; }
.badge.bloqueado { background: #fdecec; color: #c62828; }
.badge.auth, .badge.sync { background: #eef3ff; color: #3557c8; }

.actions { display: flex; gap: 8px; }
.btn {
  border: 0; border-radius: 9px; padding: 8px 12px;
  cursor: pointer; font: inherit; font-weight: 600; font-size: 12px;
}
.btn.green { background: #e8f8ef; color: #178a4c; }
.btn.red { background: #fdecec; color: #c62828; }
.btn.ghost { background: #f3f5fa; color: #445066; }

.split {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
}
.form { padding: 20px; display: grid; gap: 12px; }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.form#mac-form { align-self: start; padding: 16px; gap: 8px; }
.form#mac-form label { gap: 4px; }
.form input {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit;
}
.form-actions { display: flex; gap: 8px; }
.lists { padding: 8px 16px 16px; display: grid; gap: 10px; }
.list-item {
  display: flex; justify-content: space-between; align-items: center;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}

.toast {
  position: fixed; right: 24px; bottom: 24px;
  background: #122033; color: #fff; padding: 12px 16px;
  border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.login-page {
  display: grid; place-items: center; min-height: 100vh; min-width: 0;
  background-color: #08111f;
  background-image: linear-gradient(rgba(6,14,26,.55), rgba(6,14,26,.55)), var(--login-background, url('/static/img/login-bg.jpg'));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
main.login-shell { display: grid; place-items: center; width: 100%; min-width: 0; padding: 32px 20px; }
.login-card { width: min(460px, 100%); min-width: 0; margin: 0 auto; background: rgba(255,255,255,.98); border: 1px solid rgba(255,255,255,.5); border-radius: 24px; padding: clamp(24px, 5vw, 40px); box-shadow: 0 24px 70px rgba(0,0,0,.25); overflow: hidden; }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 42px; }
.login-brand strong { display: block; font-size: 13px; letter-spacing: .08em; color: var(--text); }
.login-brand span { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.login-heading { margin-bottom: 26px; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px #e8f8ef; }
.login-heading h1 { margin: 12px 0 7px; font-size: 29px; letter-spacing: -.03em; }
.login-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.login-card form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; width: 100%; }
.login-card label { margin-top: 8px; color: var(--text); font-size: 12px; font-weight: 700; }
.login-input { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 11px; padding: 0 11px; background: #fff; transition: border-color .2s, box-shadow .2s; }
.login-input:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(47,107,255,.12); }
.field-icon { color: #9aa6b8; font-size: 12px; }
.login-input input { display: block; width: 100%; min-width: 0; flex: 1 1 auto; border: 0; outline: 0; padding: 12px 0; font: inherit; background: transparent; }
.password-toggle { border: 0; background: transparent; color: var(--blue); cursor: pointer; font: inherit; font-size: 11px; font-weight: 700; padding: 6px 0; }
.login-submit { width: 100%; margin-top: 16px; padding: 12px 16px; color: #fff; background: linear-gradient(135deg, #2f6bff, #214fc4); box-shadow: 0 8px 18px rgba(47,107,255,.25); }
.login-submit:hover { filter: brightness(1.06); }
.login-submit:disabled { cursor: wait; opacity: .8; }
.button-spinner { display: none; width: 15px; height: 15px; margin: 0 auto; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.is-loading .button-label { display: none; }
.is-loading .button-spinner { display: block; }
.login-error { min-height: 20px; margin-top: 8px; color: var(--red); font-size: 12px; }
.login-link { display: block; width: fit-content; margin: 8px auto 0; padding: 4px 8px; border: 0; background: transparent; color: var(--blue); font: inherit; font-size: 12px; cursor: pointer; text-align: center; text-decoration: none; }
.login-link:hover { text-decoration: underline; }
.login-link:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 4px; }
.login-success { margin: 12px 0 0; color: #18794e; font-size: 13px; line-height: 1.5; text-align: center; }
.login-footer { margin: 28px 0 0; color: #8a94a6; font-size: 11px; text-align: center; }
.login-version { margin: 8px 0 0; text-align: center; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 560px) { .login-shell { padding: 12px; } .login-card { padding: 28px 22px; border-radius: 20px; } .login-brand { margin-bottom: 34px; } }
.loading { padding: 12px 16px; color: var(--muted); font-size: 13px; }
.mac-mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; }

@media (max-width: 1100px) {
  body { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .cards, .split { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .panel-head-controls { width: 100%; }
  .search.compact { min-width: 0; width: 100%; }
  .panel-head-devices .tabs { width: 100%; justify-content: space-between; }
}
