/* BitChat — console de atendimento de provedor.
   Linguagem: painel de NOC. LED + texto para estados, réguas para grandezas, linhas retas para listas.
   Raios: 4px controles · 6px painéis · 0 linhas de lista. */
:root {
  --abyss: #0a1322;      /* fundo */
  --hull: #0f1b2e;       /* superfícies */
  --deck: #14233b;       /* superfície elevada / hover */
  --rail: #1e3050;       /* linhas e bordas */
  --rail-hi: #2b4269;
  --ink: #e6ecf5;        /* texto */
  --fog: #8496b3;        /* texto secundário */
  --dim: #5d6f8e;
  --signal: #f58220;     /* marca: só ação principal e seleção */
  --signal-hi: #ff9a45;
  --ok: #3dbe7a; --warn: #e8a33d; --bad: #e5484d; --info: #4a9eff; --ai: #8b7cf6;
  --r-ctl: 4px; --r-pan: 6px;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-family: var(--sans); font-size: 14px; line-height: 1.45; color: var(--ink);
  font-feature-settings: "tnum" 1;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--abyss); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--signal-hi); }
.hidden { display: none !important; }
.muted { color: var(--fog); }
.small { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.mono { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
svg.i { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- controles ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r-ctl);
  background: var(--deck); border: 1px solid var(--rail); cursor: pointer; white-space: nowrap; font-weight: 500; font-size: 13px; }
.btn:hover { border-color: var(--rail-hi); background: #182a47; }
.btn.primary { background: var(--signal); border-color: var(--signal); color: #1c0e00; }
.btn.primary:hover { background: var(--signal-hi); }
.btn.danger { color: #ff9a9c; }
.btn.danger:hover { border-color: #6b2a2d; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--fog); }
.btn.ghost:hover { color: var(--ink); background: var(--deck); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: 32px; padding: 0; justify-content: center; }
.btn:disabled { opacity: .45; cursor: default; }
input, select, textarea { background: #0b1628; border: 1px solid var(--rail); border-radius: var(--r-ctl); padding: 7px 10px; width: 100%; }
input:hover, select:hover, textarea:hover { border-color: var(--rail-hi); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--signal); }
textarea { resize: vertical; min-height: 70px; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--fog); }
label.chk { display: flex; gap: 9px; align-items: center; cursor: pointer; }
label.chk input { width: 15px; height: 15px; accent-color: var(--signal); }

/* estado = LED + texto (sem fundo, sem pílula) */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fog); white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.chip.ok { color: #9fe3bf; } .chip.ok::before { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.chip.bad { color: #ffb0b2; } .chip.bad::before { background: var(--bad); box-shadow: 0 0 6px var(--bad); }
.chip.warn { color: #f5d08e; } .chip.warn::before { background: var(--warn); }
.chip.info { color: #a9cfff; } .chip.info::before { background: var(--info); }
.chip.ai { color: #c9c0ff; } .chip.ai::before { background: var(--ai); }
.chip.plain::before { display: none; }
.chip button { background: none; border: 0; cursor: pointer; padding: 0 0 0 2px; color: var(--dim); font-size: 14px; line-height: 1; }
.chip button:hover { color: var(--ink); }
/* etiqueta = marcador reto com faixa de cor */
.tag { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px 0 6px; font-size: 11.5px; color: var(--ink);
  background: #13223a; border-left: 3px solid var(--tc, var(--signal)); border-radius: 0 3px 3px 0; white-space: nowrap; }
.tag button { background: none; border: 0; color: var(--dim); cursor: pointer; padding: 0; font-size: 13px; }
.tag button:hover { color: var(--ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--dim); flex-shrink: 0; }
.dot.online { background: var(--ok); box-shadow: 0 0 6px var(--ok); } .dot.pausa { background: var(--warn); } .dot.offline { background: #3c4b66; }

/* ---------- casca ---------- */
#app { display: flex; height: 100vh; }
nav.side { width: 60px; flex-shrink: 0; position: relative; z-index: 40; }
nav.side .rail { position: absolute; inset: 0 auto 0 0; width: 60px; background: #08101d; border-right: 1px solid var(--rail);
  display: flex; flex-direction: column; padding: 12px 8px; gap: 2px; overflow: hidden; transition: width .16s ease, box-shadow .16s ease; }
nav.side:hover .rail { width: 232px; box-shadow: 12px 0 32px rgba(2, 6, 14, .55); }
nav.side .brandrow { display: flex; align-items: center; gap: 12px; height: 40px; margin-bottom: 14px; }
nav.side .logo { width: 44px; height: 32px; flex-shrink: 0; display: grid; place-items: center; }
nav.side .logo svg { width: 30px; height: 30px; }
nav.side .brandname { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
nav.side a { height: 42px; border-radius: var(--r-ctl); display: flex; align-items: center; gap: 10px; color: var(--fog); text-decoration: none; position: relative; cursor: pointer; white-space: nowrap; }
nav.side a .ic { width: 44px; flex-shrink: 0; display: grid; place-items: center; }
nav.side a .ic svg.i { width: 20px; height: 20px; }
nav.side .lb { opacity: 0; transition: opacity .1s ease; font-size: 13.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
nav.side:hover .lb { opacity: 1; transition-delay: .05s; }
nav.side a:hover { background: var(--deck); color: var(--ink); }
nav.side a.on { color: var(--signal); }
nav.side a.on::before { content: ""; position: absolute; left: -8px; top: 9px; bottom: 9px; width: 3px; background: var(--signal); border-radius: 0 2px 2px 0; }
nav.side a.on .lb { font-weight: 600; }
nav.side .spacer { flex: 1; }
main { flex: 1; min-width: 0; display: flex; }
.page { flex: 1; overflow: auto; padding: 22px 28px 40px; }
.page h1 { font-size: 20px; font-weight: 600; margin: 0 0 18px; letter-spacing: -.01em; }
.page h2 { font-size: 15px; font-weight: 600; margin: 0; }

/* painéis: um só nível de "caixa"; seções internas separadas por linha */
.card { background: var(--hull); border: 1px solid var(--rail); border-radius: var(--r-pan); padding: 16px; }
.card h3 { margin: 0 0 12px; font-size: 13.5px; font-weight: 600; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--rail); vertical-align: middle; }
table.t th { color: var(--fog); font-weight: 500; font-size: 12px; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.n, table.t th.n { text-align: right; }

/* ---------- painel gerencial ---------- */
.strip { display: flex; background: var(--hull); border: 1px solid var(--rail); border-radius: var(--r-pan); margin-bottom: 16px; }
.strip .m { flex: 1; padding: 14px 18px; border-left: 1px solid var(--rail); min-width: 0; }
.strip .m:first-child { border-left: 0; }
.strip .m .v { font-size: 28px; font-weight: 500; letter-spacing: -.02em; line-height: 1.1; }
.strip .m .v small { font-size: 14px; color: var(--fog); font-weight: 400; margin-left: 3px; }
.strip .m .l { font-size: 12.5px; color: var(--fog); margin-top: 4px; }
.strip .m.hot .v { color: var(--signal); }
.hours { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 8px; }
.hours div { flex: 1; background: var(--rail-hi); border-radius: 2px 2px 0 0; min-height: 2px; position: relative; }
.hours div.now { background: var(--signal); }
.hours-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); margin-top: 6px; }
.hbar { display: grid; grid-template-columns: 150px 1fr 40px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.hbar .track { height: 6px; background: #13223a; border-radius: 3px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--c, var(--signal)); }
.hbar .n { text-align: right; color: var(--fog); }

/* ---------- atendimento ---------- */
.inbox { width: 340px; flex-shrink: 0; border-right: 1px solid var(--rail); display: flex; flex-direction: column; background: var(--hull); }
.inbox .head { padding: 12px 12px 0; display: flex; flex-direction: column; gap: 10px; }
.search { position: relative; }
.search svg.i { position: absolute; left: 9px; top: 9px; width: 16px; height: 16px; color: var(--dim); }
.search input { padding-left: 32px; }
.tabs { display: flex; justify-content: space-between; border-bottom: 1px solid var(--rail); margin: 0 -12px; padding: 0 8px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 6px; cursor: pointer; color: var(--fog); font-size: 13px; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--signal); font-weight: 500; }
.tabs button .n { font-size: 11px; color: var(--fog); background: var(--deck); border-radius: 3px; padding: 0 5px; }
.tabs button.on .n { color: var(--signal); }
.list { overflow: auto; flex: 1; }
.item { padding: 11px 14px 11px 12px; border-bottom: 1px solid #172741; cursor: pointer; display: flex; gap: 11px; position: relative; }
.item:hover { background: var(--deck); }
.item.on { background: #172a49; }
.item.on::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--signal); }
.avatar { width: 34px; height: 34px; border-radius: var(--r-ctl); background: #1b2d4d; color: #b7c6de; display: grid; place-items: center; font-weight: 600; flex-shrink: 0; font-size: 12.5px; position: relative; }
.avatar .ch { position: absolute; right: -4px; bottom: -4px; width: 17px; height: 17px; border-radius: 3px; background: var(--abyss); display: grid; place-items: center; border: 1px solid var(--rail); }
.avatar .ch svg.i { width: 11px; height: 11px; stroke-width: 2; }
.item .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.item .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .last { color: var(--fog); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { display: flex; gap: 10px; align-items: center; margin-top: 5px; flex-wrap: wrap; }
.item .unread { min-width: 18px; height: 18px; padding: 0 5px; background: var(--signal); color: #1c0e00; border-radius: 9px; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.wait { font-size: 11.5px; color: var(--fog); }
.wait.late { color: var(--warn); } .wait.very { color: #ff9a9c; }

.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat .head { height: 60px; padding: 0 16px; border-bottom: 1px solid var(--rail); display: flex; align-items: center; gap: 12px; background: var(--hull); flex-shrink: 0; }
.chat .head .title { font-weight: 600; font-size: 14.5px; }
.chat .head .sub { display: flex; gap: 14px; align-items: center; font-size: 12px; color: var(--fog); margin-top: 1px; }
.msgs { flex: 1; overflow: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 4px; background: var(--abyss); }
.msg { max-width: min(620px, 72%); padding: 8px 11px 6px; border-radius: var(--r-pan); line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; position: relative; margin-top: 4px; }
.msg.in { align-self: flex-start; background: #17263f; }
.msg.out { align-self: flex-end; background: #1d3456; }
.msg.out.a-ai { background: #1f2146; box-shadow: inset 3px 0 0 var(--ai); }
.msg.out.a-flow, .msg.out.a-system { background: #16233a; box-shadow: inset 3px 0 0 var(--dim); }
.msg.internal { align-self: stretch; max-width: none; background: #241f10; box-shadow: inset 3px 0 0 var(--warn); font-size: 13px; color: #eadcb5; margin: 6px 0; }
.msg.system { align-self: stretch; max-width: none; background: none; color: var(--dim); font-size: 12px; padding: 6px 0; display: flex; align-items: center; gap: 12px; }
.msg.system::before, .msg.system::after { content: ""; flex: 1; height: 1px; background: var(--rail); }
.msg .who { font-size: 11.5px; color: var(--fog); margin-bottom: 2px; font-weight: 500; }
.msg.out.a-ai .who { color: #b4a9ff; }
.msg .when { font-size: 10.5px; color: var(--dim); text-align: right; margin-top: 2px; }
.msg img { max-width: 280px; border-radius: var(--r-ctl); display: block; margin-bottom: 4px; }
.msg.failed { box-shadow: inset 0 0 0 1px var(--bad); }
.msg .copy { margin-top: 6px; }
.msg .file { display: inline-flex; gap: 6px; align-items: center; }
.composer { border-top: 1px solid var(--rail); padding: 10px 14px 12px; background: var(--hull); display: flex; flex-direction: column; gap: 8px; }
.composer textarea { min-height: 46px; max-height: 180px; border-color: var(--rail); background: #0b1628; }
.composer.note textarea { background: #1c180b; border-color: #6b5a20; }
.composer .tools { display: flex; gap: 2px; align-items: center; }
.composer .tools .sep { width: 1px; height: 18px; background: var(--rail); margin: 0 6px; }
.qr { position: absolute; bottom: calc(100% + 4px); left: 0; right: 0; background: var(--deck); border: 1px solid var(--rail-hi); border-radius: var(--r-pan); max-height: 230px; overflow: auto; box-shadow: 0 -10px 30px rgba(2, 6, 14, .5); }
.qr div { padding: 8px 12px; cursor: pointer; display: flex; gap: 10px; } .qr div:hover, .qr div.on { background: #213660; }
.qr b { font-family: var(--mono); font-weight: 400; color: var(--signal-hi); }
.empty { flex: 1; display: grid; place-items: center; color: var(--fog); text-align: center; }
.empty svg.i { width: 34px; height: 34px; color: var(--rail-hi); margin-bottom: 8px; }

/* painel do cliente: seções separadas por linha, sem caixas dentro de caixas */
.side-panel { width: 352px; flex-shrink: 0; border-left: 1px solid var(--rail); background: var(--hull); overflow: auto; }
.side-panel .sec { padding: 14px 16px; border-bottom: 1px solid var(--rail); display: flex; flex-direction: column; gap: 10px; }
.side-panel .sec h3 { margin: 0; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.side-panel .sec h3 .grow { flex: 1; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 5px 10px; font-size: 13px; }
.kv .k { color: var(--fog); }
.contract { display: flex; flex-direction: column; gap: 10px; }
.contract + .contract { border-top: 1px dashed var(--rail); padding-top: 12px; }
.contract .plan { font-weight: 600; }
.banner { padding: 9px 11px; border-radius: var(--r-ctl); font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.banner svg.i { width: 16px; height: 16px; margin-top: 1px; }
.banner.bad { background: #2a1214; color: #ffc4c5; box-shadow: inset 3px 0 0 var(--bad); }
.banner.warn { background: #2a2210; color: #f3d9a6; box-shadow: inset 3px 0 0 var(--warn); }
.banner.ok { background: #10261b; box-shadow: inset 3px 0 0 var(--ok); }
.banner.info { background: #0f2238; color: #c3dcff; box-shadow: inset 3px 0 0 var(--info); }

/* medidor de sinal óptico (o detalhe de provedor) */
.meter { display: flex; flex-direction: column; gap: 6px; }
.meter .top { display: flex; justify-content: space-between; align-items: baseline; }
.meter .val { font-size: 22px; font-weight: 500; letter-spacing: -.02em; }
.meter .val small { font-size: 12px; color: var(--fog); margin-left: 3px; font-weight: 400; }
.meter .scale { position: relative; height: 10px; display: grid; grid-template-columns: 3fr 2fr 17fr 3fr; gap: 2px; }
.meter .scale span { border-radius: 1px; opacity: .55; }
.meter .scale .z-crit { background: var(--bad); } .meter .scale .z-att { background: var(--warn); }
.meter .scale .z-ok { background: var(--ok); } .meter .scale .z-hot { background: var(--info); }
.meter .needle { position: absolute; top: -4px; width: 3px; height: 18px; background: var(--ink); border-radius: 1px; transform: translateX(-1px); box-shadow: 0 0 0 2px var(--hull); }
.meter .ticks { position: relative; height: 14px; font-size: 10.5px; color: var(--dim); font-family: var(--mono); }
.meter .ticks span { position: absolute; transform: translateX(-50%); }
.meter .ticks span:first-child { transform: none; } .meter .ticks span:last-child { transform: translateX(-100%); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* modal e avisos */
.modal-bg { position: fixed; inset: 0; background: rgba(3, 8, 16, .72); display: grid; place-items: center; z-index: 50; }
.modal { background: var(--hull); border: 1px solid var(--rail-hi); border-radius: var(--r-pan); padding: 20px; width: min(640px, 94vw); max-height: 90vh; overflow: auto; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, .5); }
.modal h2 { margin: 0; font-size: 16px; font-weight: 600; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--deck); border: 1px solid var(--rail-hi); box-shadow: inset 3px 0 0 var(--ok), 0 10px 30px rgba(0, 0, 0, .4); padding: 10px 14px 10px 16px; border-radius: var(--r-ctl); max-width: 400px; font-size: 13px; }
.toast.err { box-shadow: inset 3px 0 0 var(--bad), 0 10px 30px rgba(0, 0, 0, .4); }

/* login */
.login { display: grid; grid-template-columns: minmax(320px, 440px) 1fr; height: 100vh; }
.login form { padding: 0 48px; display: flex; flex-direction: column; justify-content: center; gap: 14px; background: var(--hull); border-right: 1px solid var(--rail); }
.login .brand { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 600; margin-bottom: 18px; }
.login .brand svg { width: 34px; height: 34px; }
.login .art { position: relative; overflow: hidden; }
.login .art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.login .art p { position: absolute; left: 48px; bottom: 40px; max-width: 420px; color: var(--fog); font-size: 15px; margin: 0; }
@media (max-width: 760px) { .login { grid-template-columns: 1fr; } .login .art { display: none; } }

/* simulador */
.phone { width: 370px; height: 660px; border-radius: 28px; border: 8px solid #1a2840; background: var(--abyss); display: flex; flex-direction: column; overflow: hidden; flex-shrink: 0; }
.phone .bar { background: var(--hull); border-bottom: 1px solid var(--rail); padding: 14px 16px; font-weight: 600; }
.phone .msgs { padding: 14px; }
.phone .msg.in { align-self: flex-end; background: #1d3456; } .phone .msg.out { align-self: flex-start; background: #17263f; box-shadow: none; }

/* configurações */
.cfg { display: grid; grid-template-columns: 210px 1fr; gap: 28px; align-items: start; }
.subnav { display: flex; flex-direction: column; position: sticky; top: 0; }
.subnav a { padding: 7px 10px; border-radius: var(--r-ctl); text-decoration: none; color: var(--fog); font-size: 13.5px; position: relative; }
.subnav a:hover { color: var(--ink); background: var(--deck); }
.subnav a.on { color: var(--ink); background: var(--deck); font-weight: 500; }
.subnav a.on::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 2px; background: var(--signal); }
.form { display: grid; gap: 14px; max-width: 760px; }
.toolgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px 14px; }
.lrow { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--rail); }
.lrow:last-child { border-bottom: 0; }
.lrow .lic { width: 34px; height: 34px; border-radius: var(--r-ctl); background: var(--deck); display: grid; place-items: center; color: var(--fog); flex-shrink: 0; }
@media (max-width: 1100px) { .side-panel { display: none; } .cfg { grid-template-columns: 1fr; } .subnav { flex-direction: row; flex-wrap: wrap; position: static; } }
