:root {
  /* identidade EvoIndoor — invariantes de marca */
  --brand-red: #FF3B2E;
  --brand-orange: #FF7A1A;
  --brand-gradient: linear-gradient(135deg, var(--brand-red) 0%, var(--brand-orange) 100%);
  --surface-strong: #14171C;

  /* tema claro (padrão do navegador; o app abre sempre em escuro via script) */
  --bg: #F2F3F5;
  --surface: #FFFFFF;
  --surface-elevated: #FFFFFF;
  --border: #E4E7EC;
  --text: #14171C;
  --text-2: #5B6472;
  --success: #16A34A;
  --success-bg: #E7F7ED;
  --warning: #C2740A;
  --warning-bg: #FBF0DC;
  --danger: var(--brand-red);
  --danger-bg: #FDEAE8;
  --shadow: 0 8px 24px rgba(20, 23, 28, .08);
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #0B0D10;
  --surface: #12151A;
  --surface-elevated: #181C22;
  --border: #252B33;
  --text: #F5F7FA;
  --text-2: #AAB2BD;
  --success: #34D399;
  --success-bg: rgba(52, 211, 153, .14);
  --warning: #F5A623;
  --warning-bg: rgba(245, 166, 35, .14);
  --danger: var(--brand-red);
  --danger-bg: rgba(255, 59, 46, .16);
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background .2s ease, color .2s ease;
}

/* ---------- cabeçalho ---------- */
.topbar {
  background: var(--surface-strong);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 28px;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15px; flex-shrink: 0; }
.topbar .brand img { width: 30px; height: 30px; border-radius: 8px; display: block; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  color: #AEB6C2;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 7px;
}
.topbar nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.topbar nav a.active { background: var(--brand-gradient); color: #fff; }
.topbar .side { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.topbar .sys-status { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #AEB6C2; font-weight: 600; }
.topbar .sys-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(52, 211, 153, .18); }
.theme-toggle {
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); color: #fff;
  width: 30px; height: 30px; border-radius: 7px; cursor: pointer; font-size: 13.5px;
  display: flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { background: rgba(255, 255, 255, .14); }
.topbar .logout { color: #AEB6C2; text-decoration: none; font-size: 13px; font-weight: 600; }
.topbar .logout:hover { color: #fff; }

.container { max-width: 1080px; margin: 0 auto; padding: 28px 24px 60px; }
.container:has(.login-shell) { max-width: none; padding: 0; margin: 0; }

h1 { font-size: 22px; margin: 0 0 18px; color: var(--text); }
h2 { font-size: 13px; margin: 26px 0 12px; color: var(--brand-orange); text-transform: uppercase; letter-spacing: .5px; font-weight: 800; }

.flash { margin-bottom: 18px; }
.flash-msg {
  background: var(--success-bg); color: var(--success); border-radius: 8px;
  padding: 10px 14px; font-size: 13.5px; font-weight: 700; margin-bottom: 6px;
}

.card {
  background: var(--surface-elevated); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow);
}

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--text-2); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; font-weight: 700; }

.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; font-size: 10.5px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.status.online { background: var(--success-bg); color: var(--success); }
.status.online::before { background: var(--success); }
.status.offline { background: var(--danger-bg); color: var(--danger); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; font-size: 10.5px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-neutro { background: var(--bg); color: var(--text-2); border: 1px solid var(--border); }
.badge-neutro::before { background: var(--text-2); }
.badge-info { background: rgba(110,138,168,.16); color: #6E8AA8; }
.badge-info::before { background: #6E8AA8; }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-warning::before { background: var(--warning); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-success::before { background: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-danger::before { background: var(--danger); }

.stat-mini-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 700px) { .stat-mini-row { grid-template-columns: 1fr; } }

.timeline-log { list-style: none; margin: 0; padding: 0; }
.timeline-log li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.timeline-log li:last-child { border-bottom: none; }
.timeline-log .quem { font-weight: 700; }
.timeline-log .quando { color: var(--text-2); font-size: 11.5px; float: right; }
.timeline-log .motivo { color: var(--text-2); font-size: 12.5px; margin-top: 3px; }

.wizard-step { border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 16px; background: var(--surface-elevated); }
.wizard-step h3 { margin: 0 0 14px; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--brand-orange); }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.radio-row label { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.status.offline::before { background: var(--danger); }

form.inline { display: inline; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-2); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 7px; font-size: 13.5px;
  background: var(--surface); color: var(--text);
}
input[type=text]:focus, input[type=password]:focus, input[type=number]:focus, select:focus {
  outline: none; border-color: var(--brand-orange);
}
input[type=file] { font-size: 13px; color: var(--text); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; background: var(--surface-strong); color: #fff; border: 1px solid transparent; border-radius: 7px;
  padding: 9px 16px; font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: none;
  transition: opacity .15s;
}
.btn:hover { opacity: .88; }
.btn.small { padding: 5px 11px; font-size: 12px; }
.btn.danger { background: var(--brand-gradient); }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--border); }
button.btn { font-family: inherit; }

.grid-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 20px; }
.grid-form .form-row { flex: 1; min-width: 160px; margin-bottom: 0; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
@media (max-width: 720px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat { position: relative; overflow: hidden; background: var(--surface-elevated); border: 1px solid var(--border); border-radius: 12px; padding: 16px 16px 14px; box-shadow: var(--shadow); }
.stat::before { content: ""; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--brand-gradient); }
.stat .n { font-size: 27px; font-weight: 800; background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .l { font-size: 11px; color: var(--text-2); text-transform: uppercase; font-weight: 700; margin-top: 4px; letter-spacing: .3px; }

.playlist-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.playlist-item .ordem {
  font-weight: 800; width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: var(--brand-gradient); color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center;
}
.token-box { font-family: monospace; font-size: 11.5px; background: var(--bg); border: 1px solid var(--border); padding: 3px 6px; border-radius: 4px; word-break: break-all; color: var(--text-2); }

/* ---------- login ---------- */
.login-shell {
  min-height: 100vh;
  display: grid; grid-template-columns: 1.1fr 1fr;
}
@media (max-width: 820px) { .login-shell { grid-template-columns: 1fr; } }
.login-brand-side {
  position: relative; overflow: hidden;
  background: var(--surface-strong);
  display: flex; flex-direction: column; justify-content: center; gap: 20px;
  padding: 60px;
}
.login-brand-side::before {
  content: ""; position: absolute; top: -20%; left: -10%; width: 65%; height: 140%;
  background: radial-gradient(circle, rgba(255, 59, 46, .20), transparent 60%); pointer-events: none;
}
.login-brand-side::after {
  content: ""; position: absolute; bottom: -30%; right: -10%; width: 55%; height: 140%;
  background: radial-gradient(circle, rgba(255, 122, 26, .16), transparent 60%); pointer-events: none;
}
.login-brand-side img { position: relative; z-index: 1; width: 280px; max-width: 70%; }
.login-brand-side .pillars { position: relative; z-index: 1; display: flex; gap: 10px; flex-wrap: wrap; }
.login-brand-side .pillars span {
  font-size: 11px; font-weight: 700; letter-spacing: .5px; color: #cfd4dc;
  border: 1px solid #2A303B; padding: 6px 12px; border-radius: 999px;
}
.login-brand-side .tagline { position: relative; z-index: 1; color: #AAB2BD; font-size: 13.5px; max-width: 380px; line-height: 1.5; }
.login-form-side {
  background: var(--bg); display: flex; flex-direction: column; justify-content: center; padding: 60px;
}
.login-form-side .login-box { max-width: 340px; width: 100%; margin: 0; background: transparent; border: none; padding: 0; box-shadow: none; }
.login-form-side .login-box h1 { text-align: left; font-size: 22px; margin-bottom: 4px; }
.login-form-side .login-sub { color: var(--text-2); font-size: 13px; margin-bottom: 26px; }
.login-box .btn { width: 100%; justify-content: center; background: var(--brand-gradient); padding: 12px; font-size: 13.5px; }

/* ---------- rodapé institucional ---------- */
.institutional-note { text-align: center; font-size: 11.5px; color: var(--text-2); padding: 18px 24px 30px; opacity: .8; }
