/* ==========================================================================
   TRAVA WEB — Design System
   Paleta: azul marinho (escuro)  ->  azul bebê (claro)
   ========================================================================== */

:root {
  /* --- Escala de azul --------------------------------------------------- */
  --navy-950: #030B1F;
  --navy-900: #06152F;
  --navy-850: #081D40;
  --navy-800: #0B2450;
  --navy-700: #123064;
  --navy-600: #17407F;

  --blue-700: #14539E;
  --blue-600: #1668C8;
  --blue-500: #2A86E8;
  --blue-400: #54A4F2;

  --sky-300: #8FC9F8;
  --sky-200: #BCE0FB;
  --sky-100: #DDEEFD;
  --sky-50: #EEF6FE;
  --ice: #F4F8FE;

  /* --- Texto ------------------------------------------------------------ */
  --ink: #0A1B38;
  --ink-2: #3E587F;
  --ink-3: #7C90B2;
  --ink-inv: #EAF3FF;

  /* --- Estados ---------------------------------------------------------- */
  --ok: #12A46B;
  --ok-soft: #E3F7EE;
  --warn: #D98A0B;
  --warn-soft: #FDF3E0;
  --danger: #DC3B4B;
  --danger-soft: #FDEBEC;
  --idle: #7C90B2;
  --idle-soft: #EEF2F8;

  /* --- Superfícies ------------------------------------------------------ */
  --surface: #FFFFFF;
  --surface-2: #FAFCFF;
  --line: #E3ECF8;
  --line-strong: #CFDDF0;

  /* --- Sombras ---------------------------------------------------------- */
  --sh-xs: 0 1px 2px rgba(10, 27, 56, .06);
  --sh-sm: 0 1px 2px rgba(10, 27, 56, .06), 0 4px 12px -6px rgba(10, 27, 56, .14);
  --sh-md: 0 2px 4px rgba(10, 27, 56, .05), 0 12px 28px -14px rgba(10, 27, 56, .22);
  --sh-lg: 0 4px 8px rgba(10, 27, 56, .06), 0 28px 60px -24px rgba(10, 27, 56, .32);
  --sh-blue: 0 8px 22px -10px rgba(22, 104, 200, .65);
  --sh-inset: inset 0 1px 0 rgba(255, 255, 255, .6);

  /* --- Raios ------------------------------------------------------------ */
  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* --- Layout ----------------------------------------------------------- */
  --sidebar-w: 264px;
  --topbar-h: 68px;

  --ease: cubic-bezier(.22, 1, .36, 1);
}

/* ==========================================================================
   Reset
   ========================================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--ice);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

::selection { background: var(--sky-200); color: var(--navy-900); }

:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); background-clip: content-box; }

/* ==========================================================================
   Tipografia utilitária
   ========================================================================== */
.h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.h2 { font-size: 19px; font-weight: 700; letter-spacing: -.015em; }
.h3 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.mono {
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  font-variant-ligatures: none;
}
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ==========================================================================
   Marca
   ========================================================================== */
.brand { display: flex; align-items: center; gap: 11px; }

.brand-mark {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(150deg, var(--blue-400), var(--blue-600) 55%, var(--navy-700));
  box-shadow: var(--sh-blue), inset 0 1px 0 rgba(255, 255, 255, .35);
  color: #fff;
}
.brand-mark svg { width: 20px; height: 20px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -.02em;
}
.brand-sub {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ==========================================================================
   Botões
   ========================================================================== */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-bd: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--sh-xs);
  transition: transform .16s var(--ease), box-shadow .16s var(--ease),
    background .16s var(--ease), border-color .16s var(--ease), opacity .16s;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--sh-sm); }
.btn:active { transform: translateY(0); box-shadow: var(--sh-xs); }
.btn:disabled { opacity: .5; pointer-events: none; }

.btn-primary {
  --btn-bd: transparent;
  --btn-fg: #fff;
  background: linear-gradient(180deg, var(--blue-500), var(--blue-600));
  box-shadow: var(--sh-blue), var(--sh-inset);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #3690ee, var(--blue-600));
  box-shadow: 0 12px 26px -10px rgba(22, 104, 200, .8), var(--sh-inset);
}

.btn-dark {
  --btn-bd: transparent;
  --btn-fg: #fff;
  background: linear-gradient(180deg, var(--navy-700), var(--navy-850));
  box-shadow: 0 10px 22px -12px rgba(6, 21, 47, .8), var(--sh-inset);
}

.btn-soft {
  --btn-bg: var(--sky-50);
  --btn-fg: var(--blue-700);
  --btn-bd: var(--sky-200);
  box-shadow: none;
}
.btn-soft:hover { --btn-bg: var(--sky-100); }

.btn-ghost {
  --btn-bg: transparent;
  --btn-bd: transparent;
  --btn-fg: var(--ink-2);
  box-shadow: none;
}
.btn-ghost:hover { --btn-bg: var(--sky-50); --btn-fg: var(--blue-700); box-shadow: none; }

.btn-danger { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-bd: #F6CFD3; box-shadow: none; }
.btn-danger:hover { --btn-bg: #FBDDE0; box-shadow: none; }

.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 14.5px; border-radius: var(--r-md); }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--r-xs); }
.btn-icon svg { width: 17px; height: 17px; }

/* ==========================================================================
   Campos de formulário
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label,
.label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.label .req { color: var(--danger); font-weight: 700; }
.hint { font-size: 11.5px; color: var(--ink-3); }

.input,
.select,
.textarea {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  box-shadow: var(--sh-xs);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.textarea { height: auto; min-height: 88px; padding: 11px 13px; resize: vertical; line-height: 1.55; }

.input::placeholder, .textarea::placeholder { color: #A9BAD4; }

.input:hover, .select:hover, .textarea:hover { border-color: var(--sky-300); }

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 4px rgba(42, 134, 232, .14);
  background: #fff;
}

.select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237C90B2' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 15px;
  cursor: pointer;
}

.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-left: 40px; }
.input-group > svg,
.input-group .ig-icon {
  position: absolute;
  left: 13px;
  width: 17px;
  height: 17px;
  color: var(--ink-3);
  pointer-events: none;
}
.input-group .ig-action {
  position: absolute;
  right: 6px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--ink-3);
}
.input-group .ig-action:hover { background: var(--sky-50); color: var(--blue-600); }
.input-group .ig-action svg { width: 17px; height: 17px; }
.input-group:has(.ig-action) .input { padding-right: 42px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .col-2 { grid-column: span 2; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

.fieldset { display: flex; flex-direction: column; gap: 16px; }
.fieldset + .fieldset { margin-top: 26px; }
.fieldset-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line-strong);
}
.fieldset-head .step {
  width: 24px;
  height: 24px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--sky-100);
  color: var(--blue-700);
  font-size: 11.5px;
  font-weight: 700;
}

/* Checkbox / switch */
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check .box {
  width: 18px; height: 18px; flex: none;
  border: 1.6px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  display: grid; place-items: center;
  transition: all .15s var(--ease);
}
.check .box svg { width: 12px; height: 12px; color: #fff; opacity: 0; transform: scale(.6); transition: all .15s var(--ease); }
.check input:checked + .box { background: var(--blue-500); border-color: var(--blue-500); }
.check input:checked + .box svg { opacity: 1; transform: scale(1); }
.check input:focus-visible + .box { box-shadow: 0 0 0 4px rgba(42, 134, 232, .18); }
.check span.txt { font-size: 13px; color: var(--ink-2); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 40px; height: 23px; flex: none;
  border-radius: 99px;
  background: var(--line-strong);
  position: relative;
  transition: background .2s var(--ease);
}
.switch .track::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(10, 27, 56, .3);
  transition: transform .22s var(--ease);
}
.switch input:checked + .track { background: linear-gradient(180deg, var(--blue-500), var(--blue-600)); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch .txt { font-size: 13px; color: var(--ink-2); font-weight: 500; }

/* Chips selecionáveis */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-opt { position: relative; }
.chip-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip-opt .chip-face {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: #fff;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  cursor: pointer;
  transition: all .15s var(--ease);
}
.chip-opt .chip-face:hover { border-color: var(--sky-300); background: var(--sky-50); }
.chip-opt input:checked + .chip-face {
  background: var(--sky-100);
  border-color: var(--blue-400);
  color: var(--blue-700);
  box-shadow: 0 0 0 3px rgba(42, 134, 232, .1);
}
.chip-opt input:focus-visible + .chip-face { box-shadow: 0 0 0 4px rgba(42, 134, 232, .2); }

/* ==========================================================================
   Cartões
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.card-head .t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-body { padding: 20px; }
.card-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ==========================================================================
   Badges / pills
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .01em;
  white-space: nowrap;
  background: var(--idle-soft);
  color: var(--ink-2);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge-ok { background: var(--ok-soft); color: #0B7D51; }
.badge-warn { background: var(--warn-soft); color: #9E6405; }
.badge-danger { background: var(--danger-soft); color: #B32A39; }
.badge-info { background: var(--sky-100); color: var(--blue-700); }
.badge-navy { background: #E7EDF9; color: var(--navy-700); }

.badge-live .dot { animation: pulse 1.8s infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(18, 164, 107, .45); }
  50% { box-shadow: 0 0 0 5px rgba(18, 164, 107, 0); }
}

/* ==========================================================================
   Tabela
   ========================================================================== */
.table-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
table.tbl th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
table.tbl td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 13.5px;
}
table.tbl tbody tr { transition: background .12s; }
table.tbl tbody tr:hover { background: var(--sky-50); }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl .num { font-variant-numeric: tabular-nums; }
table.tbl .actions { text-align: right; white-space: nowrap; }
table.tbl .actions .btn + .btn { margin-left: 6px; }

.cell-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.cell-main .txt { display: flex; flex-direction: column; min-width: 0; }
.cell-main .txt b { font-weight: 650; font-size: 13.5px; }
.cell-main .txt span { font-size: 12px; color: var(--ink-3); }

.avatar {
  width: 34px; height: 34px; flex: none;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700;
  color: #fff;
  background: linear-gradient(150deg, var(--blue-400), var(--blue-700));
  box-shadow: var(--sh-xs);
}
.avatar.sq-sm { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.avatar.tone-1 { background: linear-gradient(150deg, #6FB7F5, #14539E); }
.avatar.tone-2 { background: linear-gradient(150deg, #4EA3F2, #0B2450); }
.avatar.tone-3 { background: linear-gradient(150deg, #8FC9F8, #1668C8); }
.avatar.tone-4 { background: linear-gradient(150deg, #A5D4F9, #17407F); }

.icon-tile {
  width: 34px; height: 34px; flex: none;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--sky-100);
  color: var(--blue-700);
}
.icon-tile svg { width: 17px; height: 17px; }

/* ==========================================================================
   Estado vazio
   ========================================================================== */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 54px 20px;
  text-align: center;
}
.empty .glyph {
  width: 58px; height: 58px;
  display: grid; place-items: center;
  border-radius: var(--r-lg);
  background: var(--sky-50);
  border: 1px dashed var(--sky-300);
  color: var(--blue-400);
  margin-bottom: 4px;
}
.empty .glyph svg { width: 24px; height: 24px; }
.empty h4 { font-size: 15px; font-weight: 650; }
.empty p { font-size: 13px; color: var(--ink-3); max-width: 340px; }

/* ==========================================================================
   Toast
   ========================================================================== */
.toast-wrap {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 270px;
  max-width: 380px;
  padding: 13px 16px;
  border-radius: var(--r-md);
  background: var(--navy-850);
  color: var(--ink-inv);
  box-shadow: var(--sh-lg);
  font-size: 13px;
  animation: toastIn .32s var(--ease);
}
.toast .ico {
  width: 26px; height: 26px; flex: none;
  border-radius: 8px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .12);
}
.toast .ico svg { width: 15px; height: 15px; }
.toast.ok .ico { background: rgba(18, 164, 107, .25); color: #7BE8BB; }
.toast.err .ico { background: rgba(220, 59, 75, .25); color: #FFAAB2; }
.toast.out { animation: toastOut .25s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ==========================================================================
   Modal
   ========================================================================== */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-root.open { display: flex; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 16, 42, .5);
  backdrop-filter: blur(4px);
  animation: fade .2s var(--ease);
}
@keyframes fade { from { opacity: 0; } }

.modal {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  overflow: hidden;
  animation: modalIn .32s var(--ease);
}
.modal.wide { width: min(900px, 100%); }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-head .t { display: flex; gap: 13px; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.modal-foot .spacer { margin-right: auto; }

/* ==========================================================================
   LOGIN
   ========================================================================== */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: var(--surface);
}

.login-aside {
  position: relative;
  overflow: hidden;
  padding: 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--ink-inv);
  background:
    radial-gradient(1000px 600px at 12% 8%, rgba(84, 164, 242, .30), transparent 58%),
    radial-gradient(760px 520px at 88% 92%, rgba(143, 201, 248, .22), transparent 60%),
    linear-gradient(155deg, var(--navy-850) 0%, var(--navy-900) 45%, var(--navy-950) 100%);
}
.login-aside::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(143, 201, 248, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(143, 201, 248, .07) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 30% 40%, #000 10%, transparent 72%);
  pointer-events: none;
}
.login-aside .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .55;
  pointer-events: none;
  animation: float 18s ease-in-out infinite;
}
.login-aside .blob.b1 { width: 320px; height: 320px; background: #2A86E8; top: -70px; right: -60px; }
.login-aside .blob.b2 { width: 260px; height: 260px; background: #8FC9F8; bottom: 6%; left: -70px; animation-delay: -7s; }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(22px, -26px) scale(1.08); }
}

.login-aside .brand-name { color: #fff; }
.login-aside .brand-sub { color: var(--sky-300); }

.aside-inner { position: relative; z-index: 1; max-width: 460px; }
.aside-inner h1 {
  font-size: 38px;
  line-height: 1.14;
  font-weight: 750;
  letter-spacing: -.03em;
  margin-bottom: 14px;
}
.aside-inner h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--sky-300), #fff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.aside-inner > p {
  font-size: 14.5px;
  line-height: 1.65;
  color: rgba(221, 238, 253, .72);
  margin-bottom: 30px;
}

.aside-features { display: flex; flex-direction: column; gap: 14px; }
.aside-feature { display: flex; gap: 13px; align-items: flex-start; }
.aside-feature .ico {
  width: 36px; height: 36px; flex: none;
  border-radius: 11px;
  display: grid; place-items: center;
  background: rgba(143, 201, 248, .13);
  border: 1px solid rgba(143, 201, 248, .22);
  color: var(--sky-300);
  backdrop-filter: blur(6px);
}
.aside-feature .ico svg { width: 17px; height: 17px; }
.aside-feature b { display: block; font-size: 13.5px; font-weight: 650; color: #fff; }
.aside-feature span { font-size: 12.5px; color: rgba(221, 238, 253, .6); }

.aside-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 11.5px;
  color: rgba(221, 238, 253, .45);
}
.aside-stat { display: flex; flex-direction: column; }
.aside-stat b { font-size: 19px; font-weight: 700; color: #fff; letter-spacing: -.02em; }
.aside-sep { width: 1px; height: 28px; background: rgba(143, 201, 248, .2); }

.login-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 44px 32px;
  background:
    radial-gradient(600px 400px at 100% 0%, var(--sky-50), transparent 70%),
    var(--surface);
}
.login-box { width: 100%; max-width: 396px; animation: riseIn .5s var(--ease); }
@keyframes riseIn { from { opacity: 0; transform: translateY(16px); } }

.login-box > .eyebrow { margin-bottom: 8px; }
.login-box h2 { font-size: 27px; font-weight: 750; letter-spacing: -.03em; margin-bottom: 6px; }
.login-box .sub { font-size: 13.5px; color: var(--ink-2); margin-bottom: 20px; }

.role-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  background: var(--sky-50);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 18px;
}
.role-switch button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  border-radius: var(--r-xs);
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-2);
  transition: all .18s var(--ease);
}
.role-switch button svg { width: 15px; height: 15px; }
.role-switch button:hover { color: var(--blue-700); }
.role-switch button.on {
  background: #fff;
  color: var(--navy-800);
  box-shadow: var(--sh-sm);
}

.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-row { display: flex; align-items: center; justify-content: space-between; }
.link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--blue-600);
  transition: color .15s;
}
.link:hover { color: var(--blue-700); text-decoration: underline; }

.form-error {
  display: none;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  background: var(--danger-soft);
  border: 1px solid #F6CFD3;
  color: #B32A39;
  font-size: 12.5px;
  font-weight: 550;
}
.form-error.show { display: flex; animation: shake .4s var(--ease); }
.form-error svg { width: 16px; height: 16px; flex: none; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.demo-card {
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px dashed var(--sky-300);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--sky-50), #fff);
}
.demo-card .demo-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--blue-700);
  margin-bottom: 11px;
}
.demo-card .demo-title svg { width: 14px; height: 14px; }
.demo-list { display: flex; flex-direction: column; gap: 7px; }
.demo-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  cursor: pointer;
  transition: all .15s var(--ease);
}
.demo-item:hover { border-color: var(--blue-400); box-shadow: var(--sh-sm); transform: translateY(-1px); }
.demo-item .who { font-size: 12px; font-weight: 650; color: var(--ink); }
.demo-item .cred { font-size: 11.5px; color: var(--ink-3); }
.demo-item .use { font-size: 11px; font-weight: 650; color: var(--blue-600); }

.login-legal { margin-top: 18px; font-size: 11.5px; color: var(--ink-3); text-align: center; line-height: 1.6; }

@media (max-width: 940px) {
  .login-page { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .login-main { padding: 28px 20px; }
}

/* ==========================================================================
   APP SHELL
   ========================================================================== */
.app { min-height: 100vh; display: flex; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink-inv);
  background:
    radial-gradient(600px 380px at 20% 0%, rgba(42, 134, 232, .28), transparent 62%),
    linear-gradient(180deg, var(--navy-850), var(--navy-900) 55%, var(--navy-950));
  box-shadow: 3px 0 24px -14px rgba(4, 16, 42, .8);
  z-index: 60;
}
.sidebar::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(143, 201, 248, .22), transparent);
}

.sb-head { padding: 20px 18px; display: flex; align-items: center; justify-content: space-between; }
.sb-head .brand-name { color: #fff; }
.sb-head .brand-sub { color: var(--sky-300); opacity: .75; }

.sb-scope {
  margin: 0 14px 6px;
  padding: 12px 13px;
  border-radius: var(--r-md);
  background: rgba(143, 201, 248, .08);
  border: 1px solid rgba(143, 201, 248, .14);
}
.sb-scope .lbl {
  font-size: 9.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--sky-300); opacity: .8; margin-bottom: 4px;
}
.sb-scope .val { font-size: 13px; font-weight: 650; color: #fff; }
.sb-scope .meta { font-size: 11px; color: rgba(221, 238, 253, .5); margin-top: 2px; }

.sb-nav { flex: 1; overflow-y: auto; padding: 14px 12px 20px; display: flex; flex-direction: column; gap: 3px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(143, 201, 248, .2); background-clip: content-box; }

.sb-group {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(143, 201, 248, .5);
  padding: 16px 12px 7px;
}

.sb-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 550;
  color: rgba(221, 238, 253, .68);
  transition: all .16s var(--ease);
}
.sb-link svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.sb-link .count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(143, 201, 248, .14);
  color: var(--sky-300);
}
.sb-link:hover { background: rgba(143, 201, 248, .09); color: #fff; }
.sb-link.on {
  background: linear-gradient(90deg, rgba(42, 134, 232, .28), rgba(42, 134, 232, .06));
  color: #fff;
  font-weight: 650;
  box-shadow: inset 0 0 0 1px rgba(143, 201, 248, .16);
}
.sb-link.on::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--sky-300), var(--blue-500));
  box-shadow: 0 0 12px rgba(143, 201, 248, .8);
}
.sb-link.on svg { opacity: 1; color: var(--sky-300); }

.sb-foot { padding: 12px; border-top: 1px solid rgba(143, 201, 248, .12); }
.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border-radius: var(--r-sm);
  transition: background .16s;
}
.sb-user:hover { background: rgba(143, 201, 248, .09); }
.sb-user .txt { flex: 1; min-width: 0; }
.sb-user .txt b { display: block; font-size: 12.5px; font-weight: 650; color: #fff; }
.sb-user .txt span {
  font-size: 10.5px;
  color: var(--sky-300);
  opacity: .8;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}
.sb-user .out {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: rgba(221, 238, 253, .55);
  transition: all .15s;
}
.sb-user .out:hover { background: rgba(220, 59, 75, .18); color: #FFAAB2; }
.sb-user .out svg { width: 16px; height: 16px; }

/* ---- Main ---- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 26px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .burger { display: none; }

.crumbs { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-3); }
.crumbs b { color: var(--ink); font-weight: 650; }
.crumbs svg { width: 13px; height: 13px; opacity: .6; }

.topbar-search { margin-left: auto; width: min(320px, 34vw); }
.topbar-search .input { height: 38px; background: var(--surface-2); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  position: relative;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: var(--r-xs);
  color: var(--ink-2);
  border: 1px solid transparent;
  transition: all .15s var(--ease);
}
.icon-btn:hover { background: var(--sky-50); color: var(--blue-700); border-color: var(--line); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .ping {
  position: absolute; top: 8px; right: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger);
  border: 2px solid #fff;
}

.content { flex: 1; padding: 26px; max-width: 1420px; width: 100%; }

.page { display: none; animation: pageIn .35s var(--ease); }
.page.on { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head .t { display: flex; flex-direction: column; gap: 4px; }
.page-head .t p { font-size: 13.5px; color: var(--ink-2); max-width: 620px; }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* ---- Hero / faixa de destaque ---- */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-xl);
  padding: 26px 28px;
  margin-bottom: 22px;
  color: var(--ink-inv);
  background:
    radial-gradient(700px 300px at 88% -20%, rgba(143, 201, 248, .3), transparent 62%),
    linear-gradient(120deg, var(--navy-850), var(--navy-900) 62%, var(--navy-950));
  box-shadow: var(--sh-md);
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(143, 201, 248, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(143, 201, 248, .06) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at 82% 30%, #000, transparent 68%);
}
.hero-inner { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 22px; flex-wrap: wrap; }
.hero h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 5px; }
.hero p { font-size: 13.5px; color: rgba(221, 238, 253, .68); max-width: 520px; }
.hero-pills { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 14px; }
.hero-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 12px;
  border-radius: var(--r-pill);
  background: rgba(143, 201, 248, .12);
  border: 1px solid rgba(143, 201, 248, .2);
  font-size: 11.5px; font-weight: 600; color: var(--sky-200);
}
.hero-pill svg { width: 13px; height: 13px; }

/* ---- KPIs ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.kpi {
  position: relative;
  overflow: hidden;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.kpi::after {
  content: "";
  position: absolute;
  right: -30px; top: -30px;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--sky-50), transparent 70%);
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.kpi-top .icon-tile { position: relative; z-index: 1; }
.kpi .val {
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--navy-850);
}
.kpi .lbl { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; font-weight: 550; }
.kpi .trend {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 650;
  padding: 3px 8px; border-radius: 99px;
}
.kpi .trend.up { background: var(--ok-soft); color: #0B7D51; }
.kpi .trend.flat { background: var(--idle-soft); color: var(--ink-2); }
.kpi .trend svg { width: 12px; height: 12px; }

/* ---- Grades de layout ---- */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-2b { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid-form { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* grades nunca podem empurrar a página para os lados */
.grid-2 > *, .grid-2b > *, .grid-form > *, .stack > * { min-width: 0; }

/* ---- Barras (mini gráfico) ---- */
.bars { display: flex; flex-direction: column; gap: 15px; }
.bar-row { display: grid; grid-template-columns: 108px 1fr 46px; align-items: center; gap: 12px; }
.bar-row .name { font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
.bar-track { height: 9px; border-radius: 99px; background: var(--sky-50); overflow: hidden; }
.bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--sky-300), var(--blue-500));
  box-shadow: 0 1px 4px rgba(42, 134, 232, .4);
  animation: growBar 1s var(--ease);
  transform-origin: left;
}
@keyframes growBar { from { transform: scaleX(0); } }
.bar-row .qty { font-size: 12.5px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

.spark { display: flex; align-items: flex-end; gap: 5px; height: 92px; }
.spark i {
  flex: 1;
  border-radius: 5px 5px 3px 3px;
  background: linear-gradient(180deg, var(--sky-300), var(--blue-500));
  opacity: .85;
  transition: opacity .15s, transform .15s var(--ease);
  transform-origin: bottom;
  animation: growCol .7s var(--ease);
}
.spark i:hover { opacity: 1; transform: scaleY(1.04); }
.spark i.hi { background: linear-gradient(180deg, var(--blue-400), var(--navy-700)); opacity: 1; }
@keyframes growCol { from { transform: scaleY(0); } }
.spark-x { display: flex; gap: 5px; margin-top: 8px; }
.spark-x span { flex: 1; text-align: center; font-size: 10.5px; color: var(--ink-3); }

/* ---- Timeline ---- */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 13px; padding: 12px 0; }
.tl-item + .tl-item { border-top: 1px dashed var(--line); }
.tl-rail { display: flex; flex-direction: column; align-items: center; flex: none; }
.tl-dot {
  width: 28px; height: 28px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--sky-100);
  color: var(--blue-700);
}
.tl-dot svg { width: 14px; height: 14px; }
.tl-dot.ok { background: var(--ok-soft); color: #0B7D51; }
.tl-dot.warn { background: var(--warn-soft); color: #9E6405; }
.tl-dot.err { background: var(--danger-soft); color: #B32A39; }
.tl-body { flex: 1; min-width: 0; }
.tl-body .l1 { font-size: 13px; }
.tl-body .l1 b { font-weight: 650; }
.tl-body .l2 { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- Barra de filtros ---- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.toolbar .grow { flex: 1; min-width: 190px; }
.toolbar .select, .toolbar .input { height: 38px; }
.toolbar .seg { display: flex; gap: 4px; padding: 4px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); }
.toolbar .seg button {
  height: 30px; padding: 0 12px;
  border-radius: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  transition: all .15s;
}
.toolbar .seg button:hover { color: var(--blue-700); }
.toolbar .seg button.on { background: var(--sky-100); color: var(--blue-700); box-shadow: var(--sh-xs); }

/* ---- Preview de payload (padrão de equipamento) ---- */
.code-card {
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--navy-700);
  box-shadow: var(--sh-md);
  background: var(--navy-900);
}
.code-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 15px;
  border-bottom: 1px solid rgba(143, 201, 248, .14);
  background: linear-gradient(180deg, var(--navy-800), var(--navy-850));
}
.code-head .dots { display: flex; gap: 5px; }
.code-head .dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(143, 201, 248, .25); }
.code-head .ttl { font-size: 11.5px; font-weight: 650; color: var(--sky-200); letter-spacing: .03em; }
.code-head .btn { margin-left: auto; }
.code-head .btn-copy {
  height: 28px; padding: 0 10px;
  border-radius: 7px;
  border: 1px solid rgba(143, 201, 248, .2);
  background: rgba(143, 201, 248, .1);
  color: var(--sky-200);
  font-size: 11.5px; font-weight: 650;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s;
}
.code-head .btn-copy:hover { background: rgba(143, 201, 248, .2); color: #fff; }
.code-head .btn-copy svg { width: 13px; height: 13px; }

.code-body {
  padding: 15px;
  max-height: 460px;
  overflow: auto;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.72;
  color: #C9DDF5;
  white-space: pre;
  tab-size: 2;
}
.code-body::-webkit-scrollbar-thumb { background: rgba(143, 201, 248, .22); background-clip: content-box; }
.tk-key { color: var(--sky-300); }
.tk-str { color: #9EE6C4; }
.tk-num { color: #FFC98A; }
.tk-bool { color: #F5A3C7; }
.tk-null { color: #8FA2C2; }
.tk-pun { color: #63799C; }

/* ==========================================================================
   Página pública de cadastro (link enviado para a pessoa)
   ========================================================================== */
.publico { min-height: 100vh; display: flex; flex-direction: column; background: var(--ice); }

.pub-topo {
  padding: 18px 24px;
  background:
    radial-gradient(500px 260px at 12% 0%, rgba(42, 134, 232, .28), transparent 62%),
    linear-gradient(120deg, var(--navy-850), var(--navy-900));
  box-shadow: var(--sh-md);
}
.pub-topo .brand-name { color: #fff; }
.pub-topo .brand-sub { color: var(--sky-300); }

.pub-corpo {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 20px 40px;
}
.pub-card { width: 100%; max-width: 620px; animation: riseIn .45s var(--ease); }
.pub-card .card-body { padding: 26px; }

.pub-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.pub-head .icon-tile svg { width: 22px; height: 22px; }

.pub-rodape {
  margin-top: 22px;
  font-size: 11.5px;
  color: var(--ink-3);
  text-align: center;
  line-height: 1.6;
}

/* Caixa de link copiável */
.link-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.link-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12.5px;
  color: var(--ink-2);
}
.link-box input:focus { outline: none; }

/* ==========================================================================
   Grupo recolhível (travas por cliente)
   ========================================================================== */
.grupo { overflow: hidden; }

.grupo-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px 18px;
  text-align: left;
  transition: background .16s var(--ease);
}
.grupo-head:hover { background: var(--sky-50); }
.grupo.aberto .grupo-head { border-bottom: 1px solid var(--line); }

.grupo-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.grupo-txt b { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.grupo-txt span { font-size: 12px; color: var(--ink-3); }

.grupo-tags { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }

.grupo-seta {
  flex: none;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: var(--r-xs);
  color: var(--ink-3);
  background: var(--sky-50);
  transition: transform .25s var(--ease), background .16s, color .16s;
}
.grupo-seta svg { width: 18px; height: 18px; }
.grupo-head:hover .grupo-seta { background: var(--sky-100); color: var(--blue-700); }
.grupo.aberto .grupo-seta { transform: rotate(180deg); background: var(--sky-100); color: var(--blue-700); }

.grupo-corpo { display: none; }
.grupo.aberto .grupo-corpo { display: block; animation: pageIn .28s var(--ease); }
.grupo-corpo .card-foot { justify-content: flex-end; }

@media (max-width: 760px) {
  .grupo-head { flex-wrap: wrap; }
  .grupo-tags { width: 100%; justify-content: flex-start; }
}

/* ==========================================================================
   Assistente de cadastro (passo a passo)
   ========================================================================== */
.wizard { max-width: 620px; margin: 0 auto; }

.wz-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  margin-bottom: 26px;
}
.wz-dots i {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--line-strong);
  transition: all .25s var(--ease);
}
.wz-dots i.on { background: var(--blue-500); box-shadow: 0 0 0 4px rgba(42, 134, 232, .15); }
.wz-dots i.done { background: var(--sky-300); }
.wz-dots span {
  width: 22px; height: 2px;
  background: var(--line-strong);
  border-radius: 2px;
}
.wz-dots span.done { background: var(--sky-300); }

.wz-head { text-align: left; margin-bottom: 22px; }
.wz-head .passo {
  font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--blue-600);
  margin-bottom: 7px;
}
.wz-head h2 { font-size: 22px; font-weight: 750; letter-spacing: -.02em; margin-bottom: 5px; }
.wz-head p { font-size: 13.5px; color: var(--ink-2); }

.wz-body { display: flex; flex-direction: column; gap: 16px; }

.wz-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.wz-foot .btn-voltar { margin-right: auto; }

/* Cartões de escolha */
.opt-list { display: flex; flex-direction: column; gap: 11px; }
.opt {
  position: relative;
  display: block;
  cursor: pointer;
}
.opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.opt .face {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 17px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: all .17s var(--ease);
}
.opt .face:hover { border-color: var(--sky-300); background: var(--sky-50); }
.opt input:checked + .face {
  border-color: var(--blue-500);
  background: var(--sky-50);
  box-shadow: 0 0 0 3px rgba(42, 134, 232, .12);
}
.opt input:focus-visible + .face { box-shadow: 0 0 0 4px rgba(42, 134, 232, .22); }
.opt .glyph {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--sky-100);
  color: var(--blue-700);
  transition: all .17s var(--ease);
}
.opt .glyph svg { width: 21px; height: 21px; }
.opt input:checked + .face .glyph {
  background: linear-gradient(150deg, var(--blue-400), var(--blue-600));
  color: #fff;
  box-shadow: var(--sh-blue);
}
.opt .txt { flex: 1; min-width: 0; }
.opt .txt b { display: block; font-size: 14.5px; font-weight: 650; }
.opt .txt span { font-size: 12.5px; color: var(--ink-2); }
.opt .seta { color: var(--ink-3); flex: none; }
.opt .seta svg { width: 17px; height: 17px; }
.opt input:checked + .face .seta { color: var(--blue-600); }

/* Rádio em lista (validação) */
.opt.radio .face { align-items: flex-start; }
.opt.radio .mark {
  width: 19px; height: 19px; flex: none;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  margin-top: 2px;
  display: grid; place-items: center;
  transition: all .17s var(--ease);
}
.opt.radio .mark::after {
  content: "";
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--blue-500);
  transform: scale(0);
  transition: transform .17s var(--ease);
}
.opt.radio input:checked + .face .mark { border-color: var(--blue-500); }
.opt.radio input:checked + .face .mark::after { transform: scale(1); }

/* Campo de código de pareamento */
.codigo-box { display: flex; flex-direction: column; gap: 10px; }
.input-codigo {
  width: 100%;
  height: 58px;
  padding: 0 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: .1em;
  text-align: center;
  text-transform: uppercase;
  color: var(--navy-850);
  transition: all .16s var(--ease);
}
.input-codigo::placeholder { color: #B9C9E0; letter-spacing: .1em; }
.input-codigo:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 4px rgba(42, 134, 232, .14);
}
.input-codigo.ok { border-color: var(--ok); background: var(--ok-soft); }
.input-codigo.erro { border-color: var(--danger); background: var(--danger-soft); }

.tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.tabs button {
  position: relative;
  padding: 0 0 11px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-3);
  transition: color .16s;
}
.tabs button:hover { color: var(--blue-600); }
.tabs button.on { color: var(--navy-850); }
.tabs button.on::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--blue-500);
}

.retorno {
  display: none;
  align-items: center;
  gap: 11px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 550;
  animation: riseIn .28s var(--ease);
}
.retorno.show { display: flex; }
.retorno.ok { background: var(--ok-soft); border: 1px solid #BCE9D5; color: #0B7D51; }
.retorno.erro { background: var(--danger-soft); border: 1px solid #F6CFD3; color: #B32A39; }
.retorno svg { width: 19px; height: 19px; flex: none; }

/* Resumo */
.resumo { display: flex; flex-direction: column; gap: 10px; }
.resumo-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.resumo-item .icon-tile { background: var(--sky-100); }
.resumo-item .t b { display: block; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.resumo-item .t span { font-size: 14px; font-weight: 600; color: var(--ink); }

/* Tela final */
.sucesso { text-align: center; padding: 12px 0 4px; }
.sucesso .marca {
  width: 76px; height: 76px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(150deg, #24C98A, var(--ok));
  color: #fff;
  box-shadow: 0 14px 30px -12px rgba(18, 164, 107, .8);
  animation: popIn .45s var(--ease);
}
.sucesso .marca svg { width: 38px; height: 38px; stroke-width: 2.6; }
@keyframes popIn { from { opacity: 0; transform: scale(.5); } }
.sucesso h2 { font-size: 22px; font-weight: 750; letter-spacing: -.02em; margin-bottom: 7px; }
.sucesso p { font-size: 13.5px; color: var(--ink-2); margin-bottom: 24px; }

.id-box {
  padding: 16px;
  border: 1px dashed var(--sky-300);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--sky-50), #fff);
  margin-bottom: 24px;
}
.id-box .lbl {
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px;
}
.id-box .val {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 17px; font-weight: 700; letter-spacing: .04em;
  color: var(--navy-850);
}
.id-box .val button {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: var(--ink-3);
  transition: all .15s;
}
.id-box .val button:hover { background: var(--sky-100); color: var(--blue-700); }
.id-box .val button svg { width: 16px; height: 16px; }

/* ---- Controles deslizantes da configuração ---- */
.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: var(--sky-100);
  outline: none;
  margin: 6px 0 2px;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--blue-500), var(--blue-600));
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(22, 104, 200, .5);
  cursor: pointer;
  transition: transform .14s var(--ease);
}
.range::-webkit-slider-thumb:hover { transform: scale(1.12); }
.range::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--blue-600);
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(22, 104, 200, .5);
  cursor: pointer;
}
.range:focus-visible { box-shadow: 0 0 0 4px rgba(42, 134, 232, .2); }

.faixa-val {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--blue-700);
  background: var(--sky-100);
  padding: 2px 9px;
  border-radius: 99px;
}
.faixa-pes {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.previa {
  margin-top: 6px;
  padding: 8px 11px;
  border-radius: var(--r-xs);
  background: var(--sky-50);
  border: 1px dashed var(--sky-300);
  font-size: 12.5px;
  color: var(--blue-700);
  min-height: 33px;
}
.previa::before {
  content: "prévia: ";
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

code {
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: .92em;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--sky-100);
  color: var(--blue-700);
}

/* ---- Gravar ESP: um botão só ---- */
.gravador { max-width: 560px; margin: 0 auto; }

.fw-linha {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 15px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.fw-txt { flex: 1; min-width: 0; }
.fw-txt b { display: block; font-size: 14px; font-weight: 650; }
.fw-txt span { font-size: 12px; color: var(--ink-3); }

.btn-gravar {
  width: 100%;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-radius: var(--r-lg);
  border: 0;
  background: linear-gradient(180deg, var(--blue-500), var(--blue-600));
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.01em;
  box-shadow: 0 14px 30px -12px rgba(22, 104, 200, .85), var(--sh-inset);
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), filter .16s;
}
.btn-gravar .raio {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, .18);
}
.btn-gravar .raio svg { width: 22px; height: 22px; stroke-width: 2.2; }
.btn-gravar:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 20px 38px -14px rgba(22, 104, 200, .95), var(--sh-inset);
}
.btn-gravar:active:not(:disabled) { transform: translateY(0); }
.btn-gravar:disabled {
  background: var(--line-strong);
  color: var(--ink-3);
  box-shadow: none;
  cursor: not-allowed;
}

.grav-ok {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 20px;
  padding: 15px;
  border: 1px solid #BCE9D5;
  border-radius: var(--r-md);
  background: var(--ok-soft);
  animation: riseIn .35s var(--ease);
}
.grav-ok .marca {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(150deg, #24C98A, var(--ok));
  color: #fff;
}
.grav-ok .marca svg { width: 20px; height: 20px; stroke-width: 2.6; }
.grav-ok b { display: block; font-size: 14px; color: #0B7D51; }
.grav-ok span { font-size: 12px; color: #14875C; }

/* ---- Gravador ESP32 ---- */
.progress {
  height: 10px;
  border-radius: 99px;
  background: var(--sky-50);
  border: 1px solid var(--line);
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--sky-300), var(--blue-500));
  box-shadow: 0 1px 6px rgba(42, 134, 232, .5);
  transition: width .3s var(--ease);
}
.progress.err > i { background: linear-gradient(90deg, #F09AA4, var(--danger)); }
.progress.ok > i { background: linear-gradient(90deg, #7BE8BB, var(--ok)); }

.serial-log {
  height: 268px;
  overflow: auto;
  padding: 14px 15px;
  border-radius: var(--r-md);
  background: var(--navy-900);
  border: 1px solid var(--navy-700);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11.8px;
  line-height: 1.7;
  color: #A9C1DE;
  white-space: pre-wrap;
  word-break: break-word;
}
.serial-log::-webkit-scrollbar-thumb { background: rgba(143, 201, 248, .22); background-clip: content-box; }
.serial-log .l-ok { color: #7BE8BB; }
.serial-log .l-err { color: #FFAAB2; }
.serial-log .l-warn { color: #FFD79A; }
.serial-log .l-info { color: var(--sky-300); }
.serial-log .l-dim { color: #63799C; }
.serial-log .l-t { color: #5A6E8C; }

.dev-state { display: flex; flex-direction: column; gap: 0; }
.dev-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
}
.dev-row:last-child { border-bottom: 0; }
.dev-row .k { color: var(--ink-3); }
.dev-row .v { font-weight: 650; text-align: right; word-break: break-all; }

.steps { counter-reset: st; display: flex; flex-direction: column; gap: 13px; }
.steps li {
  counter-increment: st;
  display: flex;
  gap: 11px;
  font-size: 12.8px;
  line-height: 1.55;
  color: var(--ink-2);
}
.steps li::before {
  content: counter(st);
  flex: none;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--sky-100);
  color: var(--blue-700);
  font-size: 11px;
  font-weight: 700;
}
.steps li b { color: var(--ink); }

.drop {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px;
  border: 1.5px dashed var(--sky-300);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--sky-50), #fff);
  cursor: pointer;
  transition: all .16s var(--ease);
}
.drop:hover { border-color: var(--blue-500); background: var(--sky-50); }
.drop.on { border-color: var(--ok); background: var(--ok-soft); }
.drop .ico { color: var(--blue-600); flex: none; }
.drop .ico svg { width: 22px; height: 22px; }
.drop.on .ico { color: var(--ok); }
.drop .t b { display: block; font-size: 13px; }
.drop .t span { font-size: 11.5px; color: var(--ink-3); }

/* ---- Nota / callout ---- */
.note {
  display: flex;
  gap: 11px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  background: var(--sky-50);
  border: 1px solid var(--sky-200);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.6;
}
.note .ico { color: var(--blue-600); flex: none; }
.note .ico svg { width: 17px; height: 17px; }
.note b { color: var(--navy-800); }
.note.warn { background: var(--warn-soft); border-color: #F5DFB4; }
.note.warn .ico { color: var(--warn); }
/* Vermelho é para o que já parou ou vai parar hoje — porta sem placa, bateria
   no fim, trava sem contato. O amarelo acima é para o que merece olhar. Dois
   níveis e não três: quem lê a tela na correria só distingue "corre" de
   "depois". */
.note.danger { background: var(--danger-soft); border-color: #F3C9C9; }
.note.danger .ico { color: var(--danger); }

/* Ícone dos selos da tela de saúde.
   O `ico()` devolve um <svg> sem width nem height, contando com o CSS para
   dimensioná-lo. As regras existentes só alcançam svg dentro de .btn, .icon-tile
   e afins — fora delas o desenho ia para a página e não aparecia. */
.selo-ico { width: 18px; height: 18px; flex: none; }
/* O raio de "carregando" fica junto do número, então acompanha o texto e não
   o tamanho do ícone do selo. */
.selo-ico-mini { width: 13px; height: 13px; flex: none; }
.selo-saude { background: var(--surface, #fff); }

/* ---- Lista de definições ---- */
.dl { display: grid; grid-template-columns: 1fr; gap: 0; }
.dl-row {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}
.dl-row:last-child { border-bottom: 0; }
.dl-row dt { color: var(--ink-3); font-weight: 550; }
.dl-row dd { font-weight: 550; word-break: break-word; }

/* ---- Barra de força de senha ---- */
.pw-meter { display: flex; gap: 4px; margin-top: 4px; }
.pw-meter i { flex: 1; height: 4px; border-radius: 99px; background: var(--line); transition: background .2s; }
.pw-meter.l1 i:nth-child(1) { background: var(--danger); }
.pw-meter.l2 i:nth-child(-n+2) { background: var(--warn); }
.pw-meter.l3 i:nth-child(-n+3) { background: var(--blue-500); }
.pw-meter.l4 i { background: var(--ok); }

/* ---- Utilitários ---- */
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-12 { margin-bottom: 12px; }
.mb-18 { margin-bottom: 18px; }
.hidden { display: none !important; }
.sticky-side { position: sticky; top: calc(var(--topbar-h) + 20px); }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ==========================================================================
   Responsivo
   ========================================================================== */
@media (max-width: 1240px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-form { grid-template-columns: minmax(0, 1fr); }
  .sticky-side { position: static; }
}

@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform .3s var(--ease);
  }
  .sidebar.open { transform: translateX(0); }
  .topbar .burger { display: grid; }
  .content { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
  .sb-overlay {
    position: fixed; inset: 0; z-index: 55;
    background: rgba(4, 16, 42, .45);
    backdrop-filter: blur(3px);
    display: none;
  }
  .sb-overlay.on { display: block; }
}

@media (max-width: 760px) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-2b { grid-template-columns: minmax(0, 1fr); }
  .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid .col-2 { grid-column: span 1; }
  .topbar-search { display: none; }
  .page-head { align-items: flex-start; }
  .dl-row { grid-template-columns: 1fr; gap: 2px; }
  .modal-root { padding: 0; align-items: flex-end; }
  .modal { max-height: 92vh; border-radius: var(--r-xl) var(--r-xl) 0 0; }
}

/* O ícone dentro do chip de trava cresce sem limite se ninguém o segurar.

   O `.chip-face` tem altura fixa (34px), mas um `<svg>` sem width/height
   próprios se estica até o tamanho do bloco pai — e o resultado foi uma porta
   gigante cobrindo o texto da opção. */
.chip-opt .chip-face svg {
  width: 15px;
  height: 15px;
  flex: none;
  margin-right: 7px;
}

/* Foto de pessoa no lugar das iniciais. Mesmo tamanho e mesmo recorte do
   `.avatar`, para a lista não pular quando a imagem chega. */
img.avatar { object-fit: cover; }
