/* =========================================================
   VIGIA ADV - sistema de design (tema escuro / ambar)
   ========================================================= */
:root {
  --bg: #090d14;
  --bg-soft: #0b1019;
  --surface: #0f1523;
  --surface-2: #111a2b;
  --line: #1e293b;
  --line-soft: rgba(148, 163, 184, .12);
  --txt: #e2e8f0;
  --txt-2: #cbd5e1;
  --mut: #94a3b8;
  --dim: #64748b;
  --amber: #f59e0b;
  --amber-2: #fbbf24;
  --amber-dim: rgba(245, 158, 11, .12);
  --amber-line: rgba(245, 158, 11, .28);
  --green: #34d399;
  --red: #f87171;
  --blue: #60a5fa;
  --violet: #a78bfa;
  --r: 14px;
  --r-lg: 18px;
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, .8);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
.hidden { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

svg.i {
  width: 18px; height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* brilhos de fundo */
.glow { position: fixed; border-radius: 50%; filter: blur(120px); pointer-events: none; z-index: 0; }
.glow-a { width: 520px; height: 520px; top: -180px; right: -120px; background: rgba(245, 158, 11, .10); }
.glow-b { width: 460px; height: 460px; bottom: -200px; left: -140px; background: rgba(56, 189, 248, .07); }

/* =========================================================
   login
   ========================================================= */
#login {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 32px 20px;
}
.login-card {
  width: 100%; max-width: 420px;
  background: linear-gradient(160deg, var(--surface), #080c13 75%);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 34px 32px 26px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-login { margin-bottom: 26px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--amber), #d97706);
  color: #1a1204;
  box-shadow: 0 8px 22px -8px rgba(245, 158, 11, .75);
}
.brand-mark svg.i { width: 22px; height: 22px; stroke-width: 2; }
.brand-name {
  font-size: 17px; font-weight: 800; letter-spacing: .14em;
  color: #f1f5f9;
}
.brand-name .tag {
  font-size: 10px; font-weight: 800; letter-spacing: .1em;
  color: var(--amber);
  border: 1px solid var(--amber-line);
  background: var(--amber-dim);
  border-radius: 5px;
  padding: 2px 5px;
  vertical-align: 3px;
  margin-left: 4px;
}
.brand-sub {
  margin: 2px 0 0;
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--dim);
}
.login-card h1 {
  font-size: 26px; line-height: 1.22; font-weight: 700;
  margin: 0 0 10px; letter-spacing: -.02em;
}
.login-card h1 em { font-style: normal; color: var(--amber-2); }
.sh { color: var(--mut); font-size: 13px; margin: 0 0 24px; }
.login-foot {
  display: flex; align-items: center; gap: 7px;
  margin: 18px 0 0; padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--dim); font-size: 11.5px;
}
.login-foot svg.i { width: 14px; height: 14px; }

/* =========================================================
   campos e botoes
   ========================================================= */
.field { margin-bottom: 14px; }
.field > label {
  display: block; margin-bottom: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--mut);
}
input, select, textarea {
  width: 100%;
  background: #0a0f1a;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--txt);
  font-family: inherit;
  font-size: 13.5px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #52627a; }
input:focus, select:focus, textarea:focus {
  border-color: var(--amber-line);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .10);
}
select { appearance: none; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
textarea { resize: vertical; min-height: 80px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line);
  background: #131b2b;
  color: var(--txt-2);
  border-radius: 10px;
  padding: 10px 15px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #2b3a52; background: #182234; color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg.i { width: 15px; height: 15px; }
.btn.primary {
  background: linear-gradient(135deg, var(--amber), #d97706);
  border-color: transparent;
  color: #1a1204;
  font-weight: 700;
  box-shadow: 0 10px 24px -12px rgba(245, 158, 11, .9);
}
.btn.primary:hover { filter: brightness(1.07); color: #1a1204; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: #131b2b; }
.btn.danger { color: #fca5a5; border-color: rgba(248, 113, 113, .28); background: rgba(248, 113, 113, .07); }
.btn.danger:hover { background: rgba(248, 113, 113, .14); color: #fecaca; }
.btn.sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; padding: 12px; font-size: 14px; }
.btn.link { background: none; border: 0; color: var(--amber); padding: 0; font-size: 12px; font-weight: 600; }
.btn.link:hover { color: var(--amber-2); background: none; }

.erro { color: #fca5a5; font-size: 12.5px; min-height: 18px; margin-top: 10px; }

/* =========================================================
   shell
   ========================================================= */
#app {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  min-height: 100vh;
}

#side {
  background: linear-gradient(180deg, #0b1019, #080c13);
  border-right: 1px solid var(--line);
  padding: 20px 14px 16px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
#side .brand { padding: 0 8px 18px; border-bottom: 1px solid var(--line-soft); margin-bottom: 14px; }

.nav-label {
  margin: 4px 10px 8px;
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: #45566d; font-weight: 700;
}
#nav { display: flex; flex-direction: column; gap: 3px; }
#nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px;
  color: var(--mut); font-size: 13px; font-weight: 500;
  border: 1px solid transparent;
  transition: .15s;
}
#nav a .i-wrap {
  width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center;
  background: #0f1725; border: 1px solid #1b2637;
  color: #7f8ea6;
}
#nav a .i-wrap svg.i { width: 15px; height: 15px; }
#nav a:hover { background: #111a29; color: var(--txt); }
#nav a:hover .i-wrap { color: var(--amber); }
#nav a.on {
  background: linear-gradient(90deg, rgba(245, 158, 11, .14), rgba(245, 158, 11, .02));
  border-color: rgba(245, 158, 11, .24);
  color: #fde68a; font-weight: 600;
}
#nav a.on .i-wrap {
  background: rgba(245, 158, 11, .16);
  border-color: rgba(245, 158, 11, .35);
  color: var(--amber);
}
.badge {
  margin-left: auto;
  background: rgba(245, 158, 11, .16);
  color: var(--amber-2);
  border: 1px solid rgba(245, 158, 11, .25);
  font-size: 10.5px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px;
}
.badge.red { background: rgba(248, 113, 113, .14); color: #fca5a5; border-color: rgba(248, 113, 113, .3); }

.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.account {
  background: linear-gradient(160deg, #101827, #0b111c);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
}
.acc-head { display: flex; align-items: center; gap: 7px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px rgba(52, 211, 153, .9); flex: none; }
.acc-name { font-size: 12.5px; font-weight: 600; color: var(--txt-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.acc-plan { font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.acc-days { font-size: 10.5px; color: var(--amber-2); font-weight: 600; }
.bar { height: 4px; border-radius: 99px; background: #1b2637; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--amber), #fbbf24); }
.logout {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; padding: 8px 10px; border-radius: 9px;
  color: var(--dim); font-size: 12px;
}
.logout svg.i { width: 14px; height: 14px; }
.logout:hover { color: #fca5a5; background: rgba(248, 113, 113, .07); }

/* =========================================================
   topo
   ========================================================= */
main { min-width: 0; padding: 22px 26px 40px; }
header.top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 22px;
}
.top-title h2 {
  margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em;
  display: inline-block; vertical-align: middle;
}
.pill {
  display: inline-block; vertical-align: 2px;
  margin-left: 9px; padding: 2px 8px;
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--amber-2);
  background: var(--amber-dim);
  border: 1px solid var(--amber-line);
  border-radius: 6px;
}
.sub { color: var(--dim); font-size: 12.5px; margin-top: 4px; }
.tools { display: flex; align-items: center; gap: 10px; }
.search {
  position: relative; display: flex; align-items: center;
}
.search svg.i { position: absolute; left: 11px; width: 15px; height: 15px; color: var(--dim); pointer-events: none; }
.search input { padding-left: 33px; min-width: 240px; background: #0b1220; border-radius: 10px; }
.menu-btn { display: none; }

/* =========================================================
   painel - KPI
   ========================================================= */
.kpis {
  display: grid; gap: 12px; margin-bottom: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.kpi {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--surface), #0a0e17 80%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 15px 16px 13px;
}
.kpi::after {
  content: ""; position: absolute; inset: 0 auto auto 0;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, rgba(245, 158, 11, .55), transparent 70%);
  opacity: .6;
}
.kpi.warn::after { background: linear-gradient(90deg, rgba(96, 165, 250, .6), transparent 70%); }
.kpi.bad::after { background: linear-gradient(90deg, rgba(248, 113, 113, .7), transparent 70%); }
.kpi.good::after { background: linear-gradient(90deg, rgba(52, 211, 153, .7), transparent 70%); }
.kpi-k {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--mut);
}
.kpi-k svg.i { width: 14px; height: 14px; color: var(--amber); }
.kpi.warn .kpi-k svg.i { color: var(--blue); }
.kpi.bad .kpi-k svg.i { color: var(--red); }
.kpi.good .kpi-k svg.i { color: var(--green); }
.kpi-v { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; line-height: 1.1; }
.kpi-s { font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.kpi.bad .kpi-v { color: #fca5a5; }
.kpi.warn .kpi-v { color: #93c5fd; }
.kpi.good .kpi-v { color: #6ee7b7; }

/* =========================================================
   grade principal
   ========================================================= */
.cols { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; align-items: start; }

.panel {
  background: linear-gradient(160deg, var(--surface), #0a0e17 85%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-head h3 {
  margin: 0; font-size: 14px; font-weight: 650; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 8px;
}
.panel-head h3 svg.i { width: 16px; height: 16px; color: var(--amber); }
.panel-head .link { font-size: 12px; color: var(--amber); font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.panel-head .link svg.i { width: 13px; height: 13px; }
.panel-body { padding: 14px 16px 16px; }
.panel-body.flush { padding: 0; }

/* publicacao em card */
.pub-list { display: flex; flex-direction: column; }
.pub {
  display: block; cursor: pointer;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .15s;
}
.pub:last-child { border-bottom: 0; }
.pub:hover { background: #111a29; }
.pub-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pub-proc { font-size: 13.5px; font-weight: 650; color: #f1f5f9; letter-spacing: -.01em; }
.pub-date { margin-left: auto; font-size: 11.5px; color: var(--dim); white-space: nowrap; }
.pub-org { margin-top: 4px; font-size: 12px; color: var(--mut); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-foot { display: flex; align-items: center; gap: 6px; margin-top: 7px; }

/* chips */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  border: 1px solid #263449; background: #141d2e; color: var(--mut);
  white-space: nowrap;
}
.chip.acc { color: var(--amber-2); background: var(--amber-dim); border-color: var(--amber-line); }
.chip.blue { color: #93c5fd; background: rgba(96, 165, 250, .12); border-color: rgba(96, 165, 250, .28); }
.chip.green { color: #6ee7b7; background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .28); }
.chip.amber { color: var(--amber-2); background: var(--amber-dim); border-color: var(--amber-line); }
.chip.red { color: #fca5a5; background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .28); }
.chip.violet { color: #c4b5fd; background: rgba(167, 139, 250, .12); border-color: rgba(167, 139, 250, .28); }
.chip.solid { background: #1c2637; color: var(--txt-2); }

/* prazos no painel */
.tabs { display: flex; gap: 4px; padding: 3px; background: #0a1017; border: 1px solid var(--line-soft); border-radius: 9px; }
.tabs button {
  border: 0; background: none; color: var(--dim);
  font-size: 11.5px; font-weight: 600; padding: 5px 9px; border-radius: 7px; cursor: pointer;
}
.tabs button.on { background: #1b2637; color: var(--txt); }
.prazo-item { padding: 11px 16px; border-bottom: 1px solid var(--line-soft); }
.prazo-item:last-child { border-bottom: 0; }
.pr-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pr-proc { font-size: 12.8px; font-weight: 600; color: var(--txt); }
.pr-desc { font-size: 11.5px; color: var(--dim); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-days { font-size: 12px; font-weight: 700; color: var(--mut); white-space: nowrap; }

/* caixa do assistente */
.assist {
  margin-top: 16px;
  border: 1px solid rgba(245, 158, 11, .22);
  background: linear-gradient(150deg, rgba(245, 158, 11, .09), rgba(15, 21, 35, .6) 60%);
  border-radius: var(--r-lg);
  padding: 15px 16px;
}
.assist h4 {
  margin: 0 0 8px; font-size: 12.5px; font-weight: 700;
  display: flex; align-items: center; gap: 7px; color: var(--amber-2);
  letter-spacing: .02em;
}
.assist h4 svg.i { width: 15px; height: 15px; }
.assist p { margin: 0 0 6px; font-size: 12.5px; color: var(--txt-2); line-height: 1.55; }
.assist p:last-child { margin-bottom: 0; }
.assist b { color: #fde68a; font-weight: 650; }

/* =========================================================
   tabelas
   ========================================================= */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; padding: 9px 12px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: #5b6b83; background: #0b111c;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td {
  padding: 11px 12px; font-size: 12.8px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: #111a29; }
.mut { color: var(--mut); }
.dim { color: var(--dim); }
.small { font-size: 11.5px; }

/* toolbar */
.toolbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar input { width: auto; flex: 1; min-width: 220px; }
.toolbar select { width: auto; min-width: 150px; }
.toolbar .spacer { margin-left: auto; }

.empty {
  padding: 34px 18px; text-align: center;
  color: var(--dim); font-size: 12.8px;
}

/* paginacao */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }

/* monitoramentos */
.mon-form {
  display: grid; gap: 9px;
  grid-template-columns: 150px minmax(0, 1fr) 80px auto;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: #0b111c;
}
.mon-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft);
}
.mon-item:last-child { border-bottom: 0; }
.mon-ico {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: #141d2e; border: 1px solid #24314a; color: var(--amber);
}
.mon-ico svg.i { width: 16px; height: 16px; }
.mon-main { flex: 1; min-width: 0; }
.mon-t { font-size: 13px; font-weight: 600; }
.mon-s { font-size: 11.5px; color: var(--dim); }

/* switch */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; cursor: pointer;
  background: #1e293b; border-radius: 999px; transition: .2s;
}
.switch span::before {
  content: ""; position: absolute; height: 14px; width: 14px; left: 3px; top: 3px;
  background: #94a3b8; border-radius: 50%; transition: .2s;
}
.switch input:checked + span { background: rgba(245, 158, 11, .35); }
.switch input:checked + span::before { transform: translateX(16px); background: var(--amber); }

/* =========================================================
   modal / drawer
   ========================================================= */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4, 7, 12, .72);
  backdrop-filter: blur(3px);
  display: flex; justify-content: flex-end;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal .box {
  width: min(680px, 100%);
  height: 100%;
  background: linear-gradient(180deg, #0d1320, #080c13);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  animation: slide .22s cubic-bezier(.2, .8, .3, 1);
  box-shadow: -30px 0 60px -30px #000;
}
@keyframes slide { from { transform: translateX(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.modal .head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal .head h3 { margin: 0; font-size: 15px; font-weight: 650; }
.modal .head .x {
  background: #141d2e; border: 1px solid var(--line); color: var(--mut);
  width: 28px; height: 28px; border-radius: 8px; cursor: pointer;
  display: grid; place-items: center; font-size: 16px; line-height: 1;
}
.modal .head .x:hover { color: #fff; border-color: #2b3a52; }
.modal .content { flex: 1; overflow: auto; padding: 18px 20px; }
.modal .foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 13px 20px; border-top: 1px solid var(--line); background: #0a0f18;
}
.kv { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 8px 14px; margin-bottom: 16px; }
.kv > .k { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--dim); padding-top: 2px; }
.kv > div { font-size: 12.8px; color: var(--txt-2); }
.ptext {
  background: #0a0f18; border: 1px solid var(--line-soft);
  border-radius: 12px; padding: 14px;
  font-size: 12.8px; line-height: 1.7; color: var(--txt-2);
  white-space: pre-wrap; word-break: break-word;
  max-height: 42vh; overflow: auto;
}
.section-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: #5b6b83; margin: 18px 0 8px;
}
.row2 { display: flex; gap: 10px; }
.row2 > .field { flex: 1; margin-bottom: 0; }

/* =========================================================
   toast
   ========================================================= */
.toast {
  position: fixed; top: 18px; right: 18px; z-index: 90;
  max-width: 360px;
  background: #101a2a;
  border: 1px solid rgba(245, 158, 11, .3);
  border-left: 3px solid var(--amber);
  color: var(--txt);
  padding: 11px 14px; border-radius: 10px;
  font-size: 12.5px; line-height: 1.45;
  box-shadow: 0 18px 40px -18px #000;
  animation: toastIn .18s ease;
}
.toast.err { border-color: rgba(248, 113, 113, .35); border-left-color: var(--red); }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* =========================================================
   responsivo
   ========================================================= */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  #app { grid-template-columns: minmax(0, 1fr); }
  #side {
    position: fixed; z-index: 50; top: 0; left: 0;
    width: 258px; transform: translateX(-102%);
    transition: transform .22s ease;
  }
  #side.open { transform: none; box-shadow: 30px 0 60px -30px #000; }
  .menu-btn { display: inline-flex; }
  main { padding: 16px 14px 36px; }
  .top-title h2 { font-size: 19px; }
  .search input { min-width: 0; width: 100%; }
  .search { flex: 1; }
  .tools { width: 100%; }
  .tools .btn.primary span { display: none; }
  .tools .btn.primary { padding: 10px; }
  .mon-form { grid-template-columns: minmax(0, 1fr) 70px; }
  .mon-form .btn { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .toolbar input { min-width: 0; }
  .modal .box { width: 100%; }
}


/* ==================================================== agente / whatsapp */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; }
.chat-wrap { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .chat-wrap { grid-template-columns: 1fr; } }

.proc-pick { padding: 9px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.proc-pick:last-child { border-bottom: 0; }
.proc-pick:hover { background: #121b2c; }
.proc-pick.on { background: rgba(245, 158, 11, .08); box-shadow: inset 2px 0 0 var(--amber); }
.proc-pick .num { font-size: 12.6px; font-weight: 600; color: var(--txt); }
.proc-pick .sub { font-size: 11.3px; color: var(--dim); margin-top: 2px; }

.chat { display: flex; flex-direction: column; height: min(72vh, 660px); background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 15px; border-bottom: 1px solid var(--line-soft); background: linear-gradient(180deg, #131c2c, #0f1523); }
.chat-head .who { font-size: 13px; font-weight: 650; color: var(--txt); }
.chat-head .sub { font-size: 11.3px; color: var(--dim); margin-top: 2px; }
.chat-body { flex: 1; overflow-y: auto; padding: 16px 15px; scroll-behavior: smooth; }
.chat-body::-webkit-scrollbar { width: 8px; }
.chat-body::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 8px; }

.msg-row { display: flex; gap: 9px; margin-bottom: 13px; align-items: flex-start; }
.msg-row.user { flex-direction: row-reverse; }
.avatar { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto; background: #1a2438; color: var(--amber); }
.avatar svg.i { width: 14px; height: 14px; }
.msg-row.user .avatar { color: var(--blue); }
.msg { max-width: 84%; padding: 10px 13px; border-radius: 12px; font-size: 13px; line-height: 1.6; color: var(--txt-2); white-space: pre-wrap; word-break: break-word; }
.msg.bot { background: #0d1421; border: 1px solid var(--line-soft); border-top-left-radius: 4px; }
.msg.user { background: #1a2438; border: 1px solid #26334a; border-top-right-radius: 4px; color: #dbe4f0; }
.msg strong, .msg b { color: var(--amber-2); font-weight: 650; }
.msg .meta { display: block; margin-top: 6px; font-size: 10.5px; color: var(--dim); }
.msg.digitando { color: var(--dim); font-style: italic; }
.chat-input { display: flex; gap: 8px; padding: 11px 12px; border-top: 1px solid var(--line-soft); background: #0c1320; }
.chat-input textarea { flex: 1; min-height: 42px; max-height: 120px; resize: none; font-size: 13px; padding: 11px 12px; }
.dicas { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 11px; background: #0c1320; }
.dicas button { font-size: 11.3px; padding: 5px 10px; border-radius: 20px; border: 1px solid var(--line); background: #111a2b; color: var(--mut); cursor: pointer; }
.dicas button:hover { border-color: var(--amber-line); color: var(--amber-2); }

.qrbox { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.qrbox img { width: 190px; height: 190px; background: #fff; padding: 8px; border-radius: 12px; }
.stat-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--mut); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: 0 0 auto; }
.dot.ok { background: var(--green); box-shadow: 0 0 0 3px rgba(52, 211, 153, .13); }
.dot.wait { background: var(--amber); box-shadow: 0 0 0 3px rgba(245, 158, 11, .13); }
.dot.bad { background: var(--red); }

.ia-resumo { font-size: 12.8px; line-height: 1.62; color: var(--txt-2); white-space: pre-wrap; max-height: 260px; overflow-y: auto; }
.ia-resumo strong { color: var(--amber-2); }
.upload { border: 1px dashed var(--line); border-radius: 11px; padding: 14px; text-align: center; color: var(--dim); font-size: 12.3px; cursor: pointer; }
.upload:hover { border-color: var(--amber-line); color: var(--mut); }
