/* Sistema Atos — mesma identidade do Painel de Clientes (GestorCarlos) */
:root {
  --bg: #0E1316;
  --bg-grid: #0B0F12;
  --panel: #161F24;
  --panel-raised: #1B242A;
  --border: #2A353C;
  --border-soft: #212B31;
  --text: #E7EEF1;
  --text-dim: #8FA1AA;
  --text-faint: #5C6E77;
  --accent: #2F7DFF;
  --accent-hover: #4C8FFF;
  --accent-dim: #12294F;
  --green: #35D07F;
  --green-dim: #103322;
  --yellow: #F2C94C;
  --yellow-dim: #3A310F;
  --red: #FF5D5D;
  --red-dim: #3A1414;
  --focus: #7CB2FF;
  --glow: 0 6px 20px rgba(47,125,255,.28);
  --font-display: "Unbounded", "Segoe UI", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); -webkit-font-smoothing: antialiased; }
body {
  min-height: 100vh;
  background-image: linear-gradient(var(--bg-grid) 1px, transparent 1px), linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 28px 28px; background-position: -1px -1px;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; color: inherit; }
[hidden] { display: none !important; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; border: 2px solid var(--bg); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
svg { flex-shrink: 0; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card {
  width: 100%; max-width: 360px; padding: 28px 26px 26px; text-align: center;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.login-card img { width: 84px; height: 84px; border-radius: 20px; display: block; margin: 0 auto 14px; }
.login-card h1 { font-family: var(--font-display); font-size: 20px; margin: 0 0 6px; }
.login-card p { margin: 0 0 20px; font-size: 13.5px; color: var(--text-dim); }
.login-card .field { text-align: left; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; padding: 11px 15px; }
.erro { min-height: 18px; margin: 8px 0 0; font-size: 12.5px; font-weight: 600; color: var(--red); }

/* ---------- campos ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 7px; font-weight: 600; }
.input {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 11px 13px; font-size: 14px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

/* ---------- botões ---------- */
.btn {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  padding: 9px 15px; border-radius: 10px; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  transition: border-color .15s, background .15s, transform .12s, box-shadow .15s;
}
.btn:hover { border-color: var(--text-faint); background: var(--panel-raised); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(145deg, #4a8cff, #2f6bff); border-color: transparent; color: #fff; box-shadow: 0 2px 10px rgba(47,107,255,.35); }
.btn-primary:hover { background: linear-gradient(145deg, #5a97ff, #3b76ff); border-color: transparent; box-shadow: var(--glow); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); background: var(--panel); border-color: transparent; transform: none; }
.btn-danger { color: var(--red); }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn:focus-visible, .chip:focus-visible, .nav-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-dim), 0 0 0 4px var(--accent); }

/* ---------- estrutura ---------- */
.app-shell { display: flex; min-height: 100vh; align-items: stretch; }
.sidenav {
  width: 208px; flex-shrink: 0; display: flex; flex-direction: column; gap: 4px;
  padding: 20px 12px; background: var(--panel); border-right: 1px solid var(--border-soft);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand-logo { width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 18px; display: block; }
.nav-btn {
  position: relative; display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 12px; border-radius: 10px; background: transparent; border: 1px solid transparent;
  color: var(--text-dim); font-size: 14px; font-weight: 600; text-align: left;
  transition: background .15s, color .15s;
}
.nav-btn svg { width: 19px; height: 19px; }
.nav-btn:hover { background: var(--panel-raised); color: var(--text); }
.nav-btn.active { background: linear-gradient(145deg, var(--accent-dim), rgba(18,41,79,.55)); box-shadow: inset 0 0 0 1px rgba(47,125,255,.3); color: var(--accent-hover); }
.nav-btn.active::before { content: ''; position: absolute; left: -4px; top: 24%; bottom: 24%; width: 3px; border-radius: 3px; background: var(--accent); }
.nav-btn .ext { margin-left: auto; width: 13px; height: 13px; opacity: .55; }
.nav-sep { height: 1px; background: var(--border-soft); margin: 10px 4px; }
.nav-label { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); padding: 6px 12px 4px; }
.nav-bottom { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border-soft); display: flex; flex-direction: column; gap: 4px; }

.content { flex: 1; min-width: 0; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 28px 80px; }
.status-top { display: flex; justify-content: flex-end; margin-bottom: 6px; min-height: 16px; }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--text-dim); }
.conn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.conn.ok .dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-dim); }
.conn.off .dot { background: var(--red); }

header.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding-bottom: 20px; border-bottom: 1px solid var(--border-soft); margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, var(--accent-dim), var(--panel)); border: 1px solid rgba(47,125,255,.35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05); color: var(--accent-hover);
}
.brand-mark svg { width: 22px; height: 22px; }
h1 { font-family: var(--font-display); font-weight: 700; font-size: 24px; letter-spacing: -0.02em; margin: 0; line-height: 1.15; }
.brand p { margin: 3px 0 0; font-size: 13px; color: var(--text-dim); }
.counter {
  font-size: 12.5px; color: var(--text-dim); background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: 10px; padding: 8px 12px; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.counter b { color: var(--text); }
.counter .warn { color: var(--yellow); }

/* ---------- home ---------- */
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.tile {
  display: flex; flex-direction: column; gap: 14px; min-height: 196px; padding: 20px;
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: 14px; text-align: left;
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
.tile:hover { border-color: rgba(47,125,255,.45); transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0,0,0,.35); }
.tile .brand-mark { width: 46px; height: 46px; }
.tile h2 { font-family: var(--font-display); font-size: 17px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.tile p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-dim); }
.tile .go { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--accent-hover); }
.tile .go svg { width: 15px; height: 15px; transition: transform .15s; }
.tile:hover .go svg { transform: translateX(3px); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--border-soft); border-radius: 14px; padding: 14px 16px; }
.stat span { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); }
.stat b { display: block; margin-top: 6px; font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.stat b small { font-family: var(--font-body); font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin-left: 4px; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .left, .toolbar .right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filters { display: inline-flex; gap: 2px; background: var(--panel); border: 1px solid var(--border-soft); border-radius: 11px; padding: 4px; }
.chip { border: none; background: transparent; color: var(--text-dim); font-size: 13px; padding: 7px 13px; border-radius: 8px; font-weight: 600; transition: background .15s, color .15s; }
.chip:hover { color: var(--text); }
.chip.active { background: var(--accent-dim); color: #fff; box-shadow: inset 0 0 0 1px rgba(47,125,255,.45); }
.chip .n { margin-left: 5px; font-size: 11.5px; color: var(--text-faint); }
.chip.active .n { color: rgba(255,255,255,.7); }
.search { position: relative; min-width: 180px; width: 220px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-faint); }
.search .input { padding: 9px 12px 9px 34px; font-size: 13px; background: var(--panel); border-color: var(--border-soft); }
.periodo-txt { font-size: 12.5px; color: var(--text-dim); font-weight: 600; }

.banner { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 13px; font-weight: 500; background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(242,201,76,.25); }
.banner svg { width: 17px; height: 17px; }
.banner.info { background: var(--accent-dim); color: #cfe0ff; border-color: rgba(47,125,255,.3); }

/* ---------- lista de clientes ---------- */
.lista { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: grid; grid-template-columns: minmax(200px, 1.3fr) minmax(220px, 1.4fr) 130px auto; align-items: center; gap: 14px;
  padding: 12px 14px; background: var(--panel); border: 1px solid var(--border-soft); border-radius: 14px;
  transition: border-color .15s;
}
.row:hover { border-color: var(--border); }
.row.inativo { opacity: .62; }
.cli { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--panel-raised); border: 1px solid var(--border-soft); font-family: var(--font-display); font-weight: 600; font-size: 13.5px; color: var(--text-dim); }
.cli h3 { margin: 0; font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cli small { display: block; margin-top: 3px; font-size: 11.5px; font-weight: 600; color: var(--text-faint); font-family: var(--font-mono); }
.grupo-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; padding: 8px 11px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--border-soft); font-size: 13px; font-weight: 600; text-align: left; color: var(--text);
  transition: border-color .15s;
}
.grupo-btn:hover { border-color: var(--accent); }
.grupo-btn svg { width: 15px; height: 15px; color: var(--green); }
.grupo-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grupo-btn.vazio { color: var(--yellow); border-style: dashed; border-color: rgba(242,201,76,.35); }
.grupo-btn.vazio svg { color: var(--yellow); }
.sug { display: block; margin-top: 5px; font-size: 11.5px; color: var(--text-dim); }
.sug button { background: none; border: none; padding: 0; color: var(--accent-hover); font-weight: 700; font-size: 11.5px; }
.sug button:hover { text-decoration: underline; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; padding: 5px 9px; border-radius: 999px; white-space: nowrap; background: var(--panel-raised); color: var(--text-dim); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--green-dim); color: var(--green); }
.pill.warn { background: var(--yellow-dim); color: var(--yellow); }
.pill.err { background: var(--red-dim); color: var(--red); }
.pill.run { background: var(--accent-dim); color: var(--accent-hover); }

.acoes { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.switch { position: relative; width: 38px; height: 22px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); padding: 0; transition: background .15s, border-color .15s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-faint); transition: transform .18s, background .15s; }
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(16px); background: #fff; }
.switch-wrap { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--text-dim); }

.vazio-lista { text-align: center; padding: 48px 16px; color: var(--text-dim); font-size: 14px; border: 1px dashed var(--border); border-radius: 14px; }
.pendentes { margin-top: 16px; font-size: 12.5px; color: var(--text-faint); line-height: 1.5; }

/* ---------- pop-up (mesmo estilo do painel) ---------- */
.sheet { position: fixed; inset: 0; z-index: 100; background: rgba(5,8,10,.72); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 40px; overflow-y: auto; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.sheet-card {
  width: 100%; max-width: 520px; padding: 24px 24px 20px; position: relative;
  background: linear-gradient(180deg, var(--panel), color-mix(in srgb, var(--panel) 92%, #000));
  border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.6);
  animation: modalIn .22s ease;
}
.sheet-card h2 { font-family: var(--font-display); font-size: 17px; margin: 0 0 6px; padding-right: 36px; }
.sheet-card .sub { margin: 0 0 18px; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.sheet-close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text-dim); display: flex; align-items: center; justify-content: center; }
.sheet-close:hover { background: var(--panel-raised); color: var(--text); border-color: var(--border-soft); }
.sheet-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

.glista { max-height: 50vh; overflow-y: auto; margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.gitem { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid transparent; background: transparent; text-align: left; font-size: 13.5px; font-weight: 600; width: 100%; }
.gitem:hover { background: var(--panel-raised); border-color: var(--border-soft); }
.gitem.sel { background: var(--accent-dim); border-color: rgba(47,125,255,.45); }
.gitem small { color: var(--text-faint); font-weight: 600; font-size: 11.5px; white-space: nowrap; }
.gitem .tag { font-size: 10.5px; font-weight: 700; color: var(--accent-hover); background: var(--accent-dim); border-radius: 6px; padding: 2px 6px; margin-left: 6px; }
.gsec { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); padding: 10px 12px 4px; }

/* prévia: balão do WhatsApp */
.bolha { background: #144D37; color: #E9F5EE; border-radius: 12px 12px 4px 12px; padding: 12px 14px; font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; max-height: 60vh; overflow-y: auto; font-family: var(--font-body); }
.bolha-wrap { background: #0B1418; border: 1px solid var(--border-soft); border-radius: 14px; padding: 14px; }

/* confirmação e progresso do envio */
.resumo { display: flex; flex-direction: column; gap: 6px; max-height: 42vh; overflow-y: auto; margin: 6px 0 4px; }
.ritem { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 11px; background: var(--bg); border: 1px solid var(--border-soft); border-radius: 10px; font-size: 13px; }
.ritem .nome { font-weight: 700; }
.ritem .dest { color: var(--text-faint); font-size: 11.5px; font-weight: 600; display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.skip { font-size: 12px; color: var(--text-dim); margin-top: 10px; line-height: 1.5; }
.teste-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding: 11px 13px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border-soft); font-size: 13px; }
.teste-box b { display: block; }
.teste-box small { color: var(--text-dim); font-size: 12px; }
.barra { height: 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border-soft); overflow: hidden; margin: 4px 0 12px; }
.barra i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #4a8cff, var(--green)); transition: width .4s ease; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; background: var(--panel-raised); border: 1px solid var(--border); color: var(--text); padding: 11px 16px; border-radius: 12px; font-size: 13px; font-weight: 600; box-shadow: 0 14px 40px rgba(0,0,0,.45); animation: modalIn .2s ease; max-width: calc(100% - 32px); }
.toast.err { border-color: rgba(255,93,93,.5); color: #ffd0d0; }

.spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); border-top-color: currentColor; animation: girar .8s linear infinite; display: inline-block; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- celular ---------- */
@media (max-width: 900px) {
  .row { grid-template-columns: 1fr; gap: 10px; }
  .acoes { justify-content: space-between; }
}
@media (max-width: 720px) {
  .app-shell { flex-direction: column; }
  .sidenav { width: 100%; height: auto; position: sticky; top: 0; z-index: 50; flex-direction: row; align-items: center; gap: 4px; padding: 8px 12px; border-right: none; border-bottom: 1px solid var(--border-soft); overflow-x: auto; }
  .brand-logo { width: 34px; height: 34px; border-radius: 9px; margin: 0 6px 0 0; }
  .nav-label, .nav-sep { display: none; }
  .nav-btn { width: auto; padding: 8px 10px; font-size: 13px; white-space: nowrap; flex-shrink: 0; }
  .nav-btn .lbl-long, .nav-btn .ext { display: none; }
  .nav-btn.active::before { display: none; }
  .nav-bottom { margin: 0 0 0 auto; padding: 0; border: none; flex-direction: row; }
  .wrap { padding: 18px 16px 60px; }
  h1 { font-size: 20px; }
  .search { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
