/* ==========================================================================
   GMP MONITOR — DESIGN SYSTEM
   --------------------------------------------------------------------------
   Um único vocabulário para os dois produtos: o console da plataforma
   (superadmin) e o painel da empresa (cliente). Nada de valor solto: cor,
   espaço, raio, sombra e tipografia saem sempre de um token.

   Tema: claro por padrão, escuro quando o sistema pede ou quando o usuário
   escolhe. Só os tokens mudam entre os dois — nenhum componente sabe em qual
   tema está.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TOKENS
   -------------------------------------------------------------------------- */
:root {
  /* Marca — azul corporativo, sóbrio, legível sobre claro e escuro */
  --brand-50:  #eef4ff;
  --brand-100: #d9e6ff;
  --brand-200: #b8d0ff;
  --brand-300: #8ab2ff;
  --brand-400: #5a8dfa;
  --brand-500: #356ae6;
  --brand-600: #2251c4;
  --brand-700: #1a409c;
  --brand-800: #17357c;
  --brand-900: #142c63;

  /* Neutros */
  --n-0:   #ffffff;
  --n-25:  #fcfcfd;
  --n-50:  #f7f8fa;
  --n-100: #eef0f4;
  --n-200: #e1e5ec;
  --n-300: #cbd2dd;
  --n-400: #9aa4b5;
  --n-500: #6b7688;
  --n-600: #4e5867;
  --n-700: #39424f;
  --n-800: #262d38;
  --n-850: #1c222b;
  --n-900: #141920;
  --n-950: #0d1116;

  /* Semânticas */
  --green-500: #11875a;
  --green-400: #17a06c;
  --green-300: #34c98d;
  --amber-500: #b26a00;
  --amber-400: #d98500;
  --amber-300: #f0a83c;
  --red-500:   #c62f38;
  --red-400:   #e04651;
  --red-300:   #f2717a;

  /* --- Papéis (tema claro) --- */
  --bg:            var(--n-50);
  --bg-pattern:    radial-gradient(1200px 700px at 78% -12%, #e8eeff 0%, transparent 60%);
  --surface:       var(--n-0);
  --surface-2:     var(--n-50);
  --surface-3:     var(--n-100);
  --surface-inset: var(--n-50);
  --sidebar-bg:    var(--n-0);
  --border:        var(--n-200);
  --border-strong: var(--n-300);

  --text:        var(--n-800);
  --text-strong: var(--n-900);
  --text-muted:  var(--n-500);
  --text-subtle: var(--n-400);

  --primary:       var(--brand-600);
  --primary-hover: var(--brand-700);
  --primary-soft:  var(--brand-50);
  --primary-line:  var(--brand-200);
  --on-primary:    #ffffff;

  --success:      var(--green-500);
  --success-soft: #e6f6ef;
  --success-line: #b7e4cf;
  --warning:      var(--amber-500);
  --warning-soft: #fdf3e2;
  --warning-line: #f3ddb4;
  --danger:       var(--red-500);
  --danger-soft:  #fdecec;
  --danger-line:  #f6c9cb;

  --shadow-sm: 0 1px 2px rgba(18, 24, 33, .06), 0 1px 1px rgba(18, 24, 33, .04);
  --shadow-md: 0 4px 12px rgba(18, 24, 33, .08), 0 1px 3px rgba(18, 24, 33, .05);
  --shadow-lg: 0 18px 44px rgba(18, 24, 33, .14), 0 4px 12px rgba(18, 24, 33, .07);
  --ring: 0 0 0 3px var(--primary-line);

  /* Escala fixa — raio, espaço, tipo, tempo */
  --r-xs: 5px;  --r-sm: 7px;  --r-md: 10px; --r-lg: 14px; --r-xl: 18px; --r-full: 999px;
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;

  --t-fast: .12s cubic-bezier(.4, 0, .2, 1);
  --t:      .2s  cubic-bezier(.4, 0, .2, 1);

  --sidebar-w: 248px;
  --appbar-h: 60px;

  color-scheme: light;
}

/* --- Papéis (tema escuro) --- */
:root[data-theme="dark"] {
  --bg:            var(--n-950);
  --bg-pattern:    radial-gradient(1200px 700px at 78% -12%, #17233a 0%, transparent 60%);
  --surface:       var(--n-900);
  --surface-2:     var(--n-850);
  --surface-3:     var(--n-800);
  --surface-inset: var(--n-950);
  --sidebar-bg:    #10151c;
  --border:        #232b36;
  --border-strong: #313b49;

  --text:        #dfe5ee;
  --text-strong: #f2f5f9;
  --text-muted:  #939eaf;
  --text-subtle: #6d7887;

  --primary:       var(--brand-400);
  --primary-hover: var(--brand-300);
  --primary-soft:  rgba(90, 141, 250, .12);
  --primary-line:  rgba(90, 141, 250, .32);
  --on-primary:    #0b1220;

  --success:      var(--green-300);
  --success-soft: rgba(52, 201, 141, .12);
  --success-line: rgba(52, 201, 141, .3);
  --warning:      var(--amber-300);
  --warning-soft: rgba(240, 168, 60, .12);
  --warning-line: rgba(240, 168, 60, .3);
  --danger:       var(--red-300);
  --danger-soft:  rgba(242, 113, 122, .12);
  --danger-line:  rgba(242, 113, 122, .3);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .45);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .6), 0 4px 14px rgba(0, 0, 0, .4);

  color-scheme: dark;
}

/* Sem escolha explícita, segue o sistema. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            var(--n-950);
    --bg-pattern:    radial-gradient(1200px 700px at 78% -12%, #17233a 0%, transparent 60%);
    --surface:       var(--n-900);
    --surface-2:     var(--n-850);
    --surface-3:     var(--n-800);
    --surface-inset: var(--n-950);
    --sidebar-bg:    #10151c;
    --border:        #232b36;
    --border-strong: #313b49;

    --text:        #dfe5ee;
    --text-strong: #f2f5f9;
    --text-muted:  #939eaf;
    --text-subtle: #6d7887;

    --primary:       var(--brand-400);
    --primary-hover: var(--brand-300);
    --primary-soft:  rgba(90, 141, 250, .12);
    --primary-line:  rgba(90, 141, 250, .32);
    --on-primary:    #0b1220;

    --success:      var(--green-300);
    --success-soft: rgba(52, 201, 141, .12);
    --success-line: rgba(52, 201, 141, .3);
    --warning:      var(--amber-300);
    --warning-soft: rgba(240, 168, 60, .12);
    --warning-line: rgba(240, 168, 60, .3);
    --danger:       var(--red-300);
    --danger-soft:  rgba(242, 113, 122, .12);
    --danger-line:  rgba(242, 113, 122, .3);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, .45);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .6), 0 4px 14px rgba(0, 0, 0, .4);

    color-scheme: dark;
  }
}

/* --------------------------------------------------------------------------
   2. BASE
   -------------------------------------------------------------------------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg-pattern), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 400 14px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { color: var(--text-strong); font-weight: 600; letter-spacing: -.011em; margin: 0; }
h1 { font-size: 22px; letter-spacing: -.02em; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
code, pre, .mono { font-family: var(--font-mono); }

/* Números de métrica sempre alinhados — coluna não "dança" ao atualizar. */
.tnum, .s-val, .m-val, .stat-val { font-variant-numeric: tabular-nums; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); background-clip: content-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --------------------------------------------------------------------------
   3. MARCA
   -------------------------------------------------------------------------- */
.logo-mark {
  width: 30px; height: 30px; flex: none; border-radius: 9px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, var(--brand-400), var(--brand-700));
  box-shadow: 0 2px 8px rgba(34, 81, 196, .3), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.logo-mark svg { width: 17px; height: 17px; }
.logo-mark.sm { width: 24px; height: 24px; border-radius: 7px; }
.logo-mark.sm svg { width: 14px; height: 14px; }

.wordmark { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wordmark-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.wordmark-name { font-weight: 650; font-size: 14.5px; letter-spacing: -.015em; color: var(--text-strong); }
.wordmark-sub {
  font-size: 10px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-subtle);
}

/* --------------------------------------------------------------------------
   4. PRIMITIVOS
   -------------------------------------------------------------------------- */
/* Botões */
.btn, .primary, .ghost, .danger-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 550; white-space: nowrap;
  border: 1px solid transparent; transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.btn svg, .primary svg, .ghost svg { width: 15px; height: 15px; flex: none; }

.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); box-shadow: var(--shadow-sm); }
.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.primary:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.ghost { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-sm); }
.ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.ghost.danger { color: var(--danger); border-color: var(--danger-line); background: var(--surface); }
.ghost.danger:hover { background: var(--danger-soft); }

.danger-btn { background: var(--danger); color: #fff; border-color: var(--danger); box-shadow: var(--shadow-sm); }
.danger-btn:hover { filter: brightness(1.06); }

.btn.sm, .primary.sm, .ghost.sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn.icon, .ghost.icon { width: 36px; padding: 0; }
.ghost.icon.sm { width: 30px; }

.btn-link {
  background: none; border: 0; padding: 0; color: var(--text-muted);
  font-size: 12.5px; transition: color var(--t-fast);
}
.btn-link:hover { color: var(--text); }
.btn-link.danger { color: var(--danger); }

/* Campos */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, label > span.lbl { font-size: 12.5px; font-weight: 550; color: var(--text); }
input[type="text"], input[type="password"], input[type="email"], input[type="number"],
input[type="search"], input[type="date"], select, textarea {
  width: 100%; height: 38px; padding: 0 11px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  outline: none; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
textarea { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.5; }
select { appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 17px) 16px, calc(100% - 12px) 16px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--text-subtle); }
input[readonly] { background: var(--surface-inset); color: var(--text-muted); font-family: var(--font-mono); font-size: 12.5px; }
input:disabled, select:disabled { opacity: .55; cursor: not-allowed; }
input[type="color"] { padding: 3px; height: 38px; cursor: pointer; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.hint { font-size: 11.5px; color: var(--text-subtle); font-weight: 400; line-height: 1.45; }
.opt { font-size: 11px; color: var(--text-subtle); font-weight: 400; }
.error { color: var(--danger); font-size: 12.5px; margin: 0; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }

/* Busca com ícone */
.search { position: relative; display: flex; align-items: center; }
.search-ico { position: absolute; left: 11px; width: 15px; height: 15px; color: var(--text-subtle); pointer-events: none; }
.search input { padding-left: 34px; width: 260px; }

/* Selo / badge */
.badge, .chip, .co-status, .user-tag, .role-tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 21px; padding: 0 9px; border-radius: var(--r-full);
  font-size: 11px; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
  border: 1px solid transparent;
}
.chip.neutral, .role-tag.viewer, .user-tag.off {
  background: var(--surface-3); color: var(--text-muted); border-color: var(--border);
}
.chip.success, .co-status.on, .user-tag.on { background: var(--success-soft); color: var(--success); border-color: var(--success-line); }
.chip.warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-line); }
.chip.danger, .co-status.off { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.chip.info, .role-tag.admin { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-line); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-subtle); flex: none; transition: background var(--t); }
.dot.on { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.dot.off { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.dot.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* Cartão */
.card, .panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}

/* Avatar / identidade */
.avatar {
  width: 38px; height: 38px; flex: none; border-radius: var(--r-md);
  display: grid; place-items: center; color: #fff;
  font-size: 13px; font-weight: 650; letter-spacing: .01em;
  background: linear-gradient(145deg, var(--co, var(--brand-400)), color-mix(in srgb, var(--co, var(--brand-600)) 62%, #000));
}
.avatar.sm { width: 26px; height: 26px; border-radius: var(--r-sm); font-size: 10.5px; }

/* --------------------------------------------------------------------------
   5. SHELL (barra lateral + topo + conteúdo)
   -------------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-3);
  background: var(--sidebar-bg); border-right: 1px solid var(--border);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: var(--sp-2) var(--sp-2) var(--sp-4); }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 10px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-subtle); padding: var(--sp-4) var(--sp-2) var(--sp-2);
}
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: var(--r-sm); border: 0; background: none;
  color: var(--text-muted); font-size: 13.5px; font-weight: 500; text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-item svg { width: 16px; height: 16px; flex: none; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item .count {
  margin-left: auto; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--surface-3); color: var(--text-muted);
  padding: 1px 7px; border-radius: var(--r-full); min-width: 22px; text-align: center;
}
.nav-item.active .count { background: var(--primary); color: var(--on-primary); }
.sidebar-foot { margin-top: auto; padding-top: var(--sp-3); border-top: 1px solid var(--border); }

.user-card {
  display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: var(--r-sm);
  width: 100%; border: 0; background: none; text-align: left; transition: background var(--t-fast);
}
.user-card:hover { background: var(--surface-3); }
.user-meta { min-width: 0; flex: 1; }
.user-meta .u-name { font-size: 13px; font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta .u-role { font-size: 11px; color: var(--text-subtle); }

.main-col { display: flex; flex-direction: column; min-width: 0; }

.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--sp-4);
  height: var(--appbar-h); padding: 0 var(--sp-6);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.appbar-title { display: flex; flex-direction: column; min-width: 0; }
.appbar-title h1 { font-size: 16px; letter-spacing: -.012em; }
.appbar-title .crumb { font-size: 11.5px; color: var(--text-subtle); }
.appbar-tools { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
.appbar-sep { width: 1px; height: 22px; background: var(--border); }

.conn { display: flex; align-items: center; gap: 7px; color: var(--text-muted); font-size: 12.5px; }

.content { padding: var(--sp-6); max-width: 1560px; width: 100%; }
.section-head { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.section-head h2 { font-size: 15px; }
.section-head .sub { font-size: 12.5px; color: var(--text-muted); }
.section-tools { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   6. LOGIN
   -------------------------------------------------------------------------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-aside {
  position: relative; overflow: hidden; padding: var(--sp-10);
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(155deg, var(--brand-700), var(--brand-900) 55%, #0d1b3d);
  color: #fff;
}
.login-aside::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(600px 300px at 85% 10%, rgba(120, 170, 255, .2), transparent 70%),
    linear-gradient(transparent 96%, rgba(255,255,255,.05) 96%) 0 0 / 100% 26px,
    linear-gradient(90deg, transparent 96%, rgba(255,255,255,.05) 96%) 0 0 / 26px 100%;
  pointer-events: none;
}
.login-aside .wordmark-name, .login-aside .wordmark-sub { color: #fff; }
.login-aside .wordmark-sub { color: rgba(255, 255, 255, .6); }
.login-pitch { position: relative; z-index: 1; max-width: 420px; }
.login-pitch h2 { color: #fff; font-size: 27px; line-height: 1.25; letter-spacing: -.022em; margin-bottom: var(--sp-3); }
.login-pitch p { color: rgba(255, 255, 255, .72); font-size: 14.5px; line-height: 1.6; }
.login-points { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 11px; margin-top: var(--sp-6); }
.login-point { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: rgba(255, 255, 255, .84); }
.login-point svg { width: 16px; height: 16px; flex: none; color: var(--brand-300); }
.login-legal { position: relative; z-index: 1; font-size: 11.5px; color: rgba(255, 255, 255, .45); line-height: 1.6; max-width: 440px; }

.login-main { display: grid; place-items: center; padding: var(--sp-6); }
.login-card { width: 100%; max-width: 368px; }
.login-card h1 { font-size: 21px; margin-bottom: 6px; }
.login-card .sub { color: var(--text-muted); font-size: 13.5px; margin-bottom: var(--sp-6); }
.login-card form { display: flex; flex-direction: column; gap: var(--sp-4); }
.login-card .primary { height: 40px; margin-top: var(--sp-1); }
.login-mobile-brand { display: none; }
.foot-note { margin-top: var(--sp-6); font-size: 11.5px; color: var(--text-subtle); text-align: center; }

/* --------------------------------------------------------------------------
   7. MÉTRICAS (stat tiles)
   -------------------------------------------------------------------------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(198px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-8); }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 2px;
}
.stat-top { display: flex; align-items: center; gap: 8px; color: var(--text-muted); }
.stat-top svg { width: 15px; height: 15px; }
.s-label { font-size: 11.5px; font-weight: 600; letter-spacing: .02em; color: var(--text-muted); }
.s-val { font-size: 27px; font-weight: 650; letter-spacing: -.025em; color: var(--text-strong); line-height: 1.2; margin-top: 2px; }
.s-sub { font-size: 12px; color: var(--text-subtle); }
.stat.accent { border-color: var(--primary-line); background: linear-gradient(180deg, var(--primary-soft), transparent 70%), var(--surface); }
.stat.accent .s-val { color: var(--primary); }
.stat.accent .stat-top { color: var(--primary); }

/* --------------------------------------------------------------------------
   8. CARDS DE EMPRESA (console)
   -------------------------------------------------------------------------- */
.co-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fill, minmax(348px, 1fr)); }
.co-card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: var(--sp-5);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.co-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.co-card.suspended { background: var(--surface-2); }
.co-card.suspended .co-titles h3 { color: var(--text-muted); }
.co-stripe { position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--co); }
.co-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); }
.co-ident { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.co-avatar {
  width: 40px; height: 40px; flex: none; border-radius: var(--r-md);
  display: grid; place-items: center; color: #fff; font-size: 13.5px; font-weight: 650;
  background: linear-gradient(145deg, var(--co), color-mix(in srgb, var(--co) 60%, #000));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
}
.co-titles { min-width: 0; }
.co-titles h3 { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-slug { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-subtle); }

.co-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: var(--sp-5) 0 var(--sp-4);
  background: var(--border); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.co-metric { background: var(--surface); padding: 9px 4px; text-align: center; }
.co-card.suspended .co-metric { background: var(--surface-2); }
.m-val { display: block; font-size: 17px; font-weight: 650; color: var(--text-strong); letter-spacing: -.02em; }
.m-val.live { color: var(--success); }
.m-label { display: block; font-size: 10px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-subtle); margin-top: 1px; }

.co-plan { margin-bottom: var(--sp-4); }
.plan-bar { height: 4px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; margin-bottom: 6px; }
.plan-bar span { display: block; height: 100%; background: var(--co); border-radius: var(--r-full); transition: width .4s var(--t); }
.plan-bar span.full { background: var(--warning); }
.plan-txt { font-size: 11.5px; color: var(--text-muted); }

.co-actions { display: flex; flex-direction: column; gap: 7px; padding-top: var(--sp-4); border-top: 1px solid var(--border); }
.act-row { display: flex; gap: 6px; }
.act-row > button { flex: 1; }
.act-row.muted-row > button { background: none; border-color: transparent; box-shadow: none; color: var(--text-muted); font-weight: 500; }
.act-row.muted-row > button:hover { background: var(--surface-3); color: var(--text); }
.act-row.muted-row > button.danger { color: var(--danger); }
.act-row.muted-row > button.danger:hover { background: var(--danger-soft); }

/* --------------------------------------------------------------------------
   9. CARDS DE MÁQUINA (painel)
   -------------------------------------------------------------------------- */
.grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
  transition: border-color var(--t), transform var(--t), box-shadow var(--t);
}
.card.online:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card .thumb {
  aspect-ratio: 16 / 9; background: #0b0e13 center/cover no-repeat;
  display: grid; place-items: center; position: relative; overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.card.online .thumb { cursor: pointer; }
.card.offline .thumb { filter: grayscale(1) brightness(.4); }
.thumb-empty { color: var(--n-500); font-size: 11.5px; letter-spacing: .02em; }
.card .badge {
  position: absolute; top: 9px; left: 9px; height: 22px;
  background: rgba(10, 13, 18, .78); backdrop-filter: blur(6px); color: #fff;
  border: 1px solid rgba(255, 255, 255, .12);
}
.card .badge.on .bdot { background: var(--green-300); box-shadow: 0 0 0 3px rgba(52, 201, 141, .25); }
.card .badge.busy .bdot { background: var(--amber-300); box-shadow: 0 0 0 3px rgba(240, 168, 60, .25); }
.card .badge.off .bdot { background: var(--n-400); }
.bdot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.card .play {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
  background: linear-gradient(180deg, rgba(10, 13, 18, .3), rgba(10, 13, 18, .68));
  color: #fff; font-size: 12.5px; font-weight: 550; opacity: 0; transition: opacity var(--t);
}
.card.online .thumb:hover .play { opacity: 1; }
.play-ico {
  width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 255, 255, .16);
  border: 1.5px solid rgba(255, 255, 255, .5); backdrop-filter: blur(3px);
  display: grid; place-items: center;
}
.play-ico::after { content: ""; border-style: solid; border-width: 7px 0 7px 12px; border-color: transparent transparent transparent #fff; margin-left: 3px; }

.card .meta { padding: var(--sp-3) var(--sp-4); display: flex; flex-wrap: wrap; align-items: center; gap: 7px var(--sp-3); }
.card .meta > div:first-child { flex: 1 1 100%; min-width: 0; }
.card .name { font-weight: 600; font-size: 13.5px; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .os { color: var(--text-subtle); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .seen { color: var(--text-subtle); font-size: 11.5px; white-space: nowrap; margin-right: auto; }
.card .card-act {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface);
  font-size: 12.5px; color: var(--text); transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.card .card-act svg { width: 14px; height: 14px; }
.card .card-act:hover { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.card .card-remove {
  width: 28px; height: 28px; display: grid; place-items: center; flex: none;
  border: 1px solid transparent; border-radius: var(--r-sm); background: none; color: var(--text-subtle);
  opacity: 0; transition: opacity var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.card:hover .card-remove { opacity: 1; }
.card .card-remove svg { width: 15px; height: 15px; }
.card .card-remove:hover { background: var(--danger-soft); color: var(--danger); }
@media (hover: none) { .card .card-remove { opacity: 1; } }

/* --------------------------------------------------------------------------
   10. ESTADO VAZIO
   -------------------------------------------------------------------------- */
.empty { text-align: center; color: var(--text-muted); margin: 88px auto; max-width: 380px; }
.empty h3 { margin: var(--sp-4) 0 6px; }
.empty p { font-size: 13.5px; line-height: 1.6; }
.empty-ico {
  width: 52px; height: 52px; margin: 0 auto; border-radius: var(--r-lg);
  display: grid; place-items: center; color: var(--text-subtle);
  background: var(--surface-3); border: 1px solid var(--border);
}
.empty-ico svg { width: 24px; height: 24px; }

/* --------------------------------------------------------------------------
   11. MODAIS
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60; padding: var(--sp-6);
  background: rgba(12, 17, 24, .5); backdrop-filter: blur(3px);
  display: grid; place-items: center; animation: fade .15s var(--t);
}
:root[data-theme="dark"] .modal-overlay { background: rgba(4, 7, 11, .68); }
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(940px, 96vw); max-height: 90vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); overflow: hidden; animation: rise .2s var(--t);
}
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.modal.narrow { width: min(560px, 96vw); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 15.5px; }
.modal-body { display: grid; grid-template-columns: 1.05fr .95fr; overflow: hidden; min-height: 0; }
.modal-body .users-col { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; background: var(--surface-2); }
.col-title { padding: var(--sp-4) var(--sp-5) var(--sp-2); font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--text-subtle); }
.users-list { overflow-y: auto; padding: 0 var(--sp-3) var(--sp-4); }
.users-list .muted { padding: var(--sp-3); font-size: 13px; line-height: 1.6; }

.form-body { display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-5); overflow-y: auto; }
.form-body label, .user-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 550; color: var(--text); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.form-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); padding-top: var(--sp-2); }
.user-form { padding: var(--sp-5); overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-4); min-height: 0; }
.user-form h3 { font-size: 14px; }
.user-form label.chk { flex-direction: row; align-items: center; gap: 9px; }

/* Linha de usuário */
.user-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md);
  margin-top: var(--sp-2); background: var(--surface);
}
.user-row.inactive { opacity: .6; }
.user-main { display: flex; align-items: center; gap: 7px; min-width: 0; flex-wrap: wrap; }
.user-name { font-weight: 600; font-size: 13px; color: var(--text-strong); }
.user-count { font-size: 11.5px; color: var(--text-muted); }
.user-ops { display: flex; gap: 5px; flex: none; }

/* Atribuição de máquinas */
.assign-head { font-size: 12.5px; font-weight: 550; margin-bottom: 6px; }
.assign-list {
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 5px;
  max-height: 190px; overflow-y: auto; background: var(--surface-2);
  display: flex; flex-direction: column; gap: 1px;
}
.user-form label.assign-item, .assign-item {
  display: flex; flex-direction: row; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: var(--r-xs); cursor: pointer; font-weight: 400;
  transition: background var(--t-fast);
}
.assign-item:hover { background: var(--surface-3); }
.assign-item input[type="checkbox"] { flex: none; margin: 0; }
.assign-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.assign-item small { color: var(--text-subtle); font-size: 11px; }

/* Blocos de destaque */
.copy-row { display: flex; gap: var(--sp-2); }
.copy-row input { flex: 1; min-width: 0; }
.snippet-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 550; color: var(--text-muted); }
.snippet {
  margin: 0; padding: var(--sp-3) var(--sp-4); overflow-x: auto; white-space: pre;
  background: var(--surface-inset); border: 1px solid var(--border); border-radius: var(--r-md);
  font: 12.5px/1.65 var(--font-mono); color: var(--text);
}
:root[data-theme="dark"] .snippet { color: #a8c7fa; }
.form-body code { background: var(--surface-3); padding: 1px 5px; border-radius: var(--r-xs); font-size: 11.5px; }
.danger-zone {
  display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--danger-line); border-radius: var(--r-md); background: var(--danger-soft);
}
.danger-zone strong { font-size: 13px; color: var(--text-strong); }
.danger-zone button { margin-left: auto; flex: none; }
.warn-box {
  padding: var(--sp-3) var(--sp-4); border: 1px solid var(--warning-line); border-radius: var(--r-md);
  background: var(--warning-soft); font-size: 13px; line-height: 1.6; color: var(--text);
}

/* Auditoria */
#aud-modal .modal-body { display: block; }
.aud-list { overflow-y: auto; padding: var(--sp-2) var(--sp-5) var(--sp-5); max-height: 70vh; }
.aud-row {
  display: grid; grid-template-columns: 104px 126px 152px 128px 1fr; gap: var(--sp-3); align-items: center;
  padding: 9px 10px; border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.aud-row:hover { background: var(--surface-2); }
.aud-ts { color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.aud-actor { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aud-act {
  justify-self: start; padding: 2px 9px; border-radius: var(--r-full); font-size: 11px; font-weight: 600;
  background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--border);
}
.aud-act.danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.aud-act.good { background: var(--success-soft); color: var(--success); border-color: var(--success-line); }
.aud-act.warn { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-line); }
.aud-co { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.aud-detail { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------------------------------------------------
   12. VÍDEO AO VIVO
   -------------------------------------------------------------------------- */
.live-overlay {
  position: fixed; inset: 0; z-index: 70; padding: var(--sp-6);
  background: rgba(6, 9, 13, .88); backdrop-filter: blur(8px);
  display: grid; place-items: center; animation: fade .15s var(--t);
}
.live-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  max-width: 96vw; max-height: 94vh; display: flex; flex-direction: column;
  overflow: hidden; box-shadow: var(--shadow-lg);
}
.live-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
.live-rec { width: 8px; height: 8px; border-radius: 50%; background: var(--red-400); animation: pulse 1.4s infinite; flex: none; }
.live-head #live-title { font-weight: 600; font-size: 14px; color: var(--text-strong); }
.live-state {
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: var(--r-full);
  background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--border);
}
.live-state.on { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); letter-spacing: .04em; }
.live-stats { color: var(--text-subtle); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.live-screens { display: flex; gap: 5px; }
.screen-btn {
  height: 28px; padding: 0 11px; border-radius: var(--r-sm); font-size: 12.5px;
  background: var(--surface); color: var(--text-muted); border: 1px solid var(--border);
  transition: all var(--t-fast);
}
.screen-btn:hover { color: var(--text); border-color: var(--border-strong); }
.screen-btn.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.live-actions { margin-left: auto; display: flex; gap: var(--sp-2); }
.live-stage { position: relative; background: #05070a; display: grid; place-items: center; }
#live-video { max-width: 92vw; max-height: 78vh; display: block; }
.live-loader { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: var(--sp-3); color: #8b96a6; font-size: 13px; }
.spinner { width: 30px; height: 30px; border: 2.5px solid rgba(255,255,255,.14); border-top-color: var(--brand-300); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   13. DESEMPENHO / ATIVIDADE
   -------------------------------------------------------------------------- */
.act-head-tools { display: flex; align-items: center; gap: var(--sp-3); }
#act-date { width: auto; height: 32px; }
.act-body { display: block; overflow-y: auto; padding: var(--sp-5); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.kpi, .kpi-geo { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); }
.k-label { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-subtle); }
.k-val { font-size: 17px; font-weight: 650; color: var(--text-strong); margin-top: 3px; letter-spacing: -.015em; }
.k-val.ok { color: var(--success); }
.k-val.warn { color: var(--warning); }
.k-geo { font-size: 13.5px; font-weight: 600; margin-top: 3px; color: var(--text-strong); }
.k-map { font-size: 12px; }

.act-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.act-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-4); }
.act-card h3 { font-size: 12.5px; color: var(--text-muted); font-weight: 650; margin-bottom: var(--sp-3); text-transform: uppercase; letter-spacing: .04em; }
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 124px 1fr auto; align-items: center; gap: var(--sp-3); }
.bar-label { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 7px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-500), var(--brand-400)); border-radius: var(--r-full); }
.bar-val { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.timeline { display: flex; flex-direction: column; gap: 2px; max-height: 264px; overflow-y: auto; }
.tl-row { display: flex; gap: var(--sp-3); padding: 6px 9px; border-radius: var(--r-xs); }
.tl-row:hover { background: var(--surface-3); }
.tl-time { color: var(--text-subtle); font-size: 12.5px; font-variant-numeric: tabular-nums; min-width: 44px; }
.tl-ev { font-size: 13px; }

/* --------------------------------------------------------------------------
   14. FAIXA DE SUPORTE + IDENTIDADE DA EMPRESA
   -------------------------------------------------------------------------- */
.company-chip {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px 0 5px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-full);
  font-size: 13px; font-weight: 550; max-width: 240px;
}
.company-chip .co-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-bar {
  display: flex; align-items: center; gap: var(--sp-3); padding: 9px var(--sp-6); font-size: 12.5px;
  background: var(--warning-soft); border-bottom: 1px solid var(--warning-line); color: var(--text);
}
.imp-bar svg { width: 15px; height: 15px; color: var(--warning); flex: none; }
.imp-bar strong { color: var(--text-strong); }
.imp-bar button { margin-left: auto; flex: none; }
.imp-text { min-width: 0; }

/* --------------------------------------------------------------------------
   15. TOASTS
   -------------------------------------------------------------------------- */
.toasts { position: fixed; right: var(--sp-5); bottom: var(--sp-5); z-index: 90; display: flex; flex-direction: column; gap: var(--sp-2); }
.toast {
  display: flex; align-items: center; gap: 9px; max-width: 330px;
  padding: 11px 14px; border-radius: var(--r-md); font-size: 13px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-left: 3px solid var(--primary);
  box-shadow: var(--shadow-lg); animation: slideIn .22s var(--t);
}
.toast.on { border-left-color: var(--success); }
.toast.off { border-left-color: var(--text-subtle); }
.toast.err { border-left-color: var(--danger); }
@keyframes slideIn { from { transform: translateX(16px); opacity: 0; } }

/* --------------------------------------------------------------------------
   16. RESPONSIVO
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .login-mobile-brand { display: flex; justify-content: center; margin-bottom: var(--sp-6); }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 50;
    transform: translateX(-100%); transition: transform var(--t); box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 45; background: rgba(12, 17, 24, .5); }
  .nav-toggle { display: inline-flex !important; }
  .content { padding: var(--sp-4); }
  .appbar { padding: 0 var(--sp-4); gap: var(--sp-3); }
  .search input, .search input:focus { width: 100%; }
  .appbar .search { flex: 1; }
}

@media (max-width: 720px) {
  .co-grid, .grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .modal-body { grid-template-columns: 1fr; overflow-y: auto; }
  .modal-body .users-col { border-right: 0; border-bottom: 1px solid var(--border); }
  .aud-row { grid-template-columns: 1fr 1fr; gap: 4px; }
  .act-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 92px 1fr auto; }
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
  .s-val { font-size: 22px; }
  /* Espaço curto: o título sai e a busca fica com a largura. */
  .appbar-title { display: none; }
  .appbar .search { flex: 1; }
  .appbar .search input, .appbar .search input:focus { width: 100%; }
  .appbar-sep { display: none; }
  .live-overlay { padding: 0; }
  .live-box { width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; border-radius: 0; }
  .live-head { flex-wrap: wrap; gap: var(--sp-2); }
  .live-stats { flex: 1 1 100%; order: 5; }
  .live-stage { flex: 1; min-height: 0; }
  #live-video { max-width: 100vw; max-height: calc(100dvh - 62px); width: 100%; }
  /* Tela estreita: a faixa de suporte vira uma linha só. */
  .imp-bar { padding: 8px var(--sp-4); }
  .imp-detail { display: none; }
  .imp-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .toasts { left: var(--sp-3); right: var(--sp-3); bottom: var(--sp-3); }
  .toast { max-width: none; }
}

.nav-toggle { display: none; }

/* --------------------------------------------------------------------------
   17. INSTALADOR DO AGENTE
   -------------------------------------------------------------------------- */
.dl-card {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4); border: 1px solid var(--primary-line); border-radius: var(--r-md);
  background: var(--primary-soft);
}
.dl-ico {
  width: 42px; height: 42px; flex: none; border-radius: var(--r-md);
  display: grid; place-items: center; color: var(--on-primary); background: var(--primary);
}
.dl-ico svg { width: 21px; height: 21px; }
.dl-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.dl-info strong {
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; color: var(--text-strong);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dl-card button { flex: none; }

.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; font-size: 13px; line-height: 1.55; }
.steps li { padding-left: 3px; }
.steps li::marker { color: var(--text-subtle); font-weight: 600; }

.code-box {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4); border: 1px dashed var(--border-strong);
  border-radius: var(--r-md); background: var(--surface-2);
}
.code-box .hint { flex: 1; }
.code-value {
  font-family: var(--font-mono); font-size: 17px; font-weight: 500; letter-spacing: .08em;
  color: var(--text-strong); white-space: nowrap;
}

.advanced { border-top: 1px solid var(--border); padding-top: var(--sp-3); }
.advanced summary {
  cursor: pointer; font-size: 12.5px; font-weight: 550; color: var(--text-muted);
  list-style: none; display: flex; align-items: center; gap: 6px;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: "▸"; color: var(--text-subtle); transition: transform var(--t-fast); }
.advanced[open] summary::before { transform: rotate(90deg); }
.advanced summary:hover { color: var(--text); }
.advanced > *:not(summary) { margin-top: var(--sp-3); }

/* Publicação do instalador base (console da plataforma) */
.upload-drop {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  padding: var(--sp-8) var(--sp-5); text-align: center;
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg);
  background: var(--surface-2); color: var(--text-muted);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.upload-drop.over { border-color: var(--primary); background: var(--primary-soft); }
.upload-drop svg { width: 26px; height: 26px; color: var(--text-subtle); }
.upload-drop strong { color: var(--text-strong); font-size: 14px; }
.upload-bar { height: 5px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; }
.upload-bar span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }

.installer-current {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2);
}
.installer-current .dl-ico { background: var(--success); }

/* --------------------------------------------------------------------------
   18. MÁQUINA: cor, setor e edição
   -------------------------------------------------------------------------- */
/* Faixa de cor da máquina no topo do card (some quando não há cor definida). */
.card { position: relative; }
.card[style*="--machine"]::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; z-index: 1;
  background: var(--machine);
}
.name-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--machine, var(--primary)); margin-right: 7px; vertical-align: middle;
}
.machine-sector {
  display: inline-block; padding: 1px 8px; border-radius: var(--r-full);
  background: var(--machine, var(--primary-soft)); color: #fff; font-size: 10.5px;
  font-weight: 600; letter-spacing: .02em;
}
/* Quando a cor da máquina é usada de fundo no chip, garante contraste do texto. */
.card:not([style*="--machine"]) .machine-sector { background: var(--primary-soft); color: var(--primary); }

.card .card-edit {
  width: 28px; height: 28px; display: grid; place-items: center; flex: none;
  border: 1px solid transparent; border-radius: var(--r-sm); background: none; color: var(--text-subtle);
  opacity: 0; transition: opacity var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.card:hover .card-edit { opacity: 1; }
.card .card-edit svg { width: 15px; height: 15px; }
.card .card-edit:hover { background: var(--surface-3); color: var(--text); }
@media (hover: none) { .card .card-edit { opacity: 1; } }

/* Paleta de cores no modal de edição */
.palette { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; }
.swatch {
  width: 26px; height: 26px; border-radius: var(--r-sm); border: 2px solid transparent;
  cursor: pointer; transition: transform var(--t-fast), border-color var(--t-fast);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.1);
}
.swatch:hover { transform: scale(1.1); }
.swatch.active { border-color: var(--text-strong); }

/* --------------------------------------------------------------------------
   19. DASHBOARD EXECUTIVO
   -------------------------------------------------------------------------- */
.dash-hello { margin-bottom: var(--sp-5); }
.dash-hello h1 { font-size: 24px; letter-spacing: -.02em; }
.dash-hello .sub { color: var(--text-muted); font-size: 14px; margin-top: 3px; }

.s-of { font-size: 15px; font-weight: 500; color: var(--text-subtle); }
.kpi-delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }
.kpi-delta.muted { color: var(--text-subtle); font-weight: 400; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); margin-top: var(--sp-4); }
.dash-card { padding: var(--sp-5); }
.dash-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-4); }
.dash-card-head h2 { font-size: 14px; }

.attention-list { display: flex; flex-direction: column; }
.attention-row { display: flex; align-items: center; gap: var(--sp-3); padding: 9px 2px; border-bottom: 1px solid var(--border); }
.attention-row:last-child { border-bottom: 0; }
.att-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.att-name { font-weight: 550; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-sector { font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: var(--r-full); background: var(--surface-3); color: var(--text-muted); }
.att-seen { font-size: 12px; color: var(--text-subtle); white-space: nowrap; }

.rank-list { display: flex; flex-direction: column; gap: 9px; }
.rank-row { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: var(--sp-3); }
.rank-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-val { font-size: 12px; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.skeleton-row { height: 96px; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.3s infinite; grid-column: 1 / -1; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
  .rank-row { grid-template-columns: 100px 1fr auto; }
}

/* --------------------------------------------------------------------------
   20. CENTRAL DE ALERTAS
   -------------------------------------------------------------------------- */
.nav-item .count.alert { background: var(--danger); color: #fff; }
.nav-item.active .count.alert { background: var(--danger); color: #fff; }

.alerts-list { display: flex; flex-direction: column; gap: var(--sp-3); max-width: 820px; }
.alert-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4); background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.alert-row.sev-high { border-left-color: var(--danger); }
.alert-row.sev-medium { border-left-color: var(--warning); }
.alert-ico { width: 38px; height: 38px; flex: none; border-radius: var(--r-md); display: grid; place-items: center; }
.sev-high .alert-ico { background: var(--danger-soft); color: var(--danger); }
.sev-medium .alert-ico { background: var(--warning-soft); color: var(--warning); }
.alert-ico svg { width: 19px; height: 19px; }
.alert-main { flex: 1; min-width: 0; }
.alert-title { font-weight: 600; font-size: 14px; color: var(--text-strong); display: flex; align-items: center; gap: 8px; }
.alert-desc { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.alert-sev { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 9px; border-radius: var(--r-full); flex: none; }
.alert-sev.sev-high { background: var(--danger-soft); color: var(--danger); }
.alert-sev.sev-medium { background: var(--warning-soft); color: var(--warning); }

/* --------------------------------------------------------------------------
   21. HONITOR INSIGHTS
   -------------------------------------------------------------------------- */
.insights-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-5); gap: var(--sp-4); }
.insights-head h2 { font-size: 18px; }
.insights-head .sub { color: var(--text-muted); font-size: 13.5px; margin-top: 2px; }
.engine-tag {
  font-size: 11px; font-weight: 600; color: var(--primary); background: var(--primary-soft);
  border: 1px solid var(--primary-line); padding: 4px 10px; border-radius: var(--r-full); white-space: nowrap;
}

.insights-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--sp-4); }
.insight-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--sp-5); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: var(--sp-2);
  border-top: 3px solid var(--border-strong);
}
.insight-card.sev-warning { border-top-color: var(--warning); }
.insight-card.sev-good { border-top-color: var(--success); }
.insight-card.sev-info { border-top-color: var(--primary); }
.insight-top { display: flex; align-items: center; justify-content: space-between; }
.insight-ico { width: 34px; height: 34px; border-radius: var(--r-md); display: grid; place-items: center; }
.sev-warning .insight-ico { background: var(--warning-soft); color: var(--warning); }
.sev-good .insight-ico { background: var(--success-soft); color: var(--success); }
.sev-info .insight-ico { background: var(--primary-soft); color: var(--primary); }
.insight-ico svg { width: 18px; height: 18px; }
.insight-sev { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 9px; border-radius: var(--r-full); }
.insight-sev.sev-warning { background: var(--warning-soft); color: var(--warning); }
.insight-sev.sev-good { background: var(--success-soft); color: var(--success); }
.insight-sev.sev-info { background: var(--primary-soft); color: var(--primary); }
.insight-title { font-size: 15px; margin-top: 2px; }
.insight-desc { font-size: 13.5px; color: var(--text); line-height: 1.55; }
.insight-meta { display: flex; align-items: center; gap: var(--sp-3); font-size: 11.5px; color: var(--text-subtle); margin-top: 2px; }
.insight-meta svg { width: 13px; height: 13px; vertical-align: -2px; }
.insight-impact { text-transform: capitalize; }
.insight-rec { font-size: 12.5px; color: var(--text-muted); background: var(--surface-2); border-radius: var(--r-md); padding: 9px 11px; line-height: 1.5; }
.insight-rec strong { color: var(--text); }
.insight-detail { align-self: flex-start; margin-top: 2px; color: var(--primary); }

@media (max-width: 720px) { .insights-grid { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   22. COMMAND PALETTE (Ctrl+K)
   -------------------------------------------------------------------------- */
.cmdk-trigger {
  display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 10px 0 11px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--text-subtle); font-size: 13px; transition: border-color var(--t-fast), color var(--t-fast);
}
.cmdk-trigger:hover { border-color: var(--border-strong); color: var(--text-muted); }
.cmdk-trigger svg { width: 14px; height: 14px; }
.cmdk-trigger kbd {
  font: 600 10.5px var(--font-sans); background: var(--surface-3); color: var(--text-subtle);
  padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border);
}
@media (max-width: 900px) { .cmdk-trigger { display: none; } }

.cmdk-overlay {
  position: fixed; inset: 0; z-index: 80; padding: 12vh var(--sp-4) var(--sp-4);
  background: rgba(12, 17, 24, .5); backdrop-filter: blur(3px);
  display: flex; justify-content: center; align-items: flex-start; animation: fade .12s var(--t);
}
:root[data-theme="dark"] .cmdk-overlay { background: rgba(4, 7, 11, .6); }
.cmdk {
  width: min(560px, 96vw); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: rise .15s var(--t);
}
.cmdk-input { display: flex; align-items: center; gap: 10px; padding: 14px var(--sp-4); border-bottom: 1px solid var(--border); }
.cmdk-input svg { width: 17px; height: 17px; color: var(--text-subtle); flex: none; }
.cmdk-input input { border: 0; background: none; padding: 0; height: auto; font-size: 15px; box-shadow: none; }
.cmdk-input input:focus { box-shadow: none; }
.cmdk-input kbd { font: 600 10.5px var(--font-sans); background: var(--surface-3); color: var(--text-subtle); padding: 3px 7px; border-radius: 5px; }
.cmdk-results { max-height: 52vh; overflow-y: auto; padding: 6px; }
.cmdk-group { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-subtle); padding: 10px 10px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: var(--r-sm); text-align: left; color: var(--text); }
.cmdk-item.active { background: var(--primary-soft); }
.cmdk-ico { width: 30px; height: 30px; flex: none; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-3); color: var(--text-muted); }
.cmdk-item.active .cmdk-ico { background: var(--primary); color: var(--on-primary); }
.cmdk-ico svg { width: 15px; height: 15px; }
.cmdk-label { display: flex; flex-direction: column; min-width: 0; font-size: 13.5px; font-weight: 500; }
.cmdk-sub { font-size: 11.5px; color: var(--text-subtle); font-weight: 400; }
.cmdk-empty { padding: 24px; text-align: center; color: var(--text-subtle); font-size: 13px; }

/* Marca oficial (SVG colorida) dentro do .logo-mark: sem a caixa de gradiente. */
.logo-mark[data-brand] { background: none; box-shadow: none; padding: 0; }
.logo-mark[data-brand] svg { width: 100%; height: 100%; display: block; }
