:root {
  --wa-green: #008069;      /* barra/brand */
  --wa-green-d: #017561;
  --wa-teal: #25d366;       /* acentos claros */
  --app-bg: #f0f2f5;        /* fundo geral */
  --panel: #ffffff;         /* paineis */
  --line: #e9edef;          /* bordas */
  --chat-bg: #efeae2;       /* papel de parede do chat */
  --in: #ffffff;            /* balao recebido */
  --out: #d9fdd3;           /* balao enviado */
  --bot: #fff3c4;           /* balao do bot */
  --txt: #111b21;
  --muted: #667781;
  --danger: #e11d48;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--app-bg); color: var(--txt); height: 100vh;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01"; letter-spacing: -0.01em; }

/* topbar */
.topbar { display: flex; align-items: center; gap: 14px; background: var(--wa-green);
  color: #fff; padding: 11px 18px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.topbar .brand { font-weight: 700; font-size: 16px; color: #fff; }
.topbar .spacer { flex: 1; }
.topbar a { color: rgba(255,255,255,.9); text-decoration: none; margin-left: 16px; font-size: 14px; }
.topbar a:hover { color: #fff; text-decoration: underline; }
.badge { font-size: 12px; background: rgba(255,255,255,.18); padding: 3px 10px; border-radius: 12px; color: #fff; }

/* login */
.login-page { min-height: 100vh; background: #f0f2f5; display: flex; flex-direction: column; }
.login-hero { background: linear-gradient(135deg, #075e54 0%, #008069 45%, #25d366 100%);
  color: #fff; padding: 52px 22px; display: flex; align-items: center; justify-content: center;
  gap: 20px; flex-wrap: wrap; text-align: left; box-shadow: 0 4px 18px rgba(0,0,0,.20); }
.login-logo { width: 66px; height: 66px; border-radius: 16px; background: #fff; padding: 5px;
  box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.login-brand-1 { font-size: 30px; font-weight: 800; line-height: 1.05; letter-spacing: .3px; }
.login-brand-2 { font-size: 16px; font-weight: 500; opacity: .96; margin-top: 3px; }
.login-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 30px 18px; }
.login-card { width: 360px; }
.login-card h1 { font-size: 22px; }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 0 22px; }
.login-wrap { display: flex; align-items: center; justify-content: center; height: 100vh;
  background: linear-gradient(180deg,#008069 0 22%, #f0f2f5 22% 100%); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 30px; width: 350px; box-shadow: 0 6px 24px rgba(11,20,26,.12); }
.card h1 { margin: 0 0 6px; font-size: 20px; color: var(--wa-green); }
.card p.sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=time], select, textarea {
  width: 100%; background: #fff; border: 1px solid #d1d7db; color: var(--txt);
  border-radius: 8px; padding: 10px 12px; font-size: 14px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--wa-green);
  box-shadow: 0 0 0 3px rgba(0,128,105,.13); }
button, .btn { background: var(--wa-green); color: #fff; border: none; border-radius: 9px;
  padding: 10px 16px; font-weight: 600; cursor: pointer; font-size: 14px;
  transition: background .15s, transform .06s, box-shadow .15s; }
button:hover, .btn:hover { background: var(--wa-green-d); box-shadow: 0 3px 10px rgba(0,128,105,.28); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled, button[disabled] { background: #c7cdd1; color: #f0f2f5; cursor: not-allowed;
  box-shadow: none; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-ghost { background: #e9edef; color: var(--txt); }
.btn-ghost:hover { background: #dfe5e7; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #be123c; }
.flash { padding: 10px 13px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }
.flash.error { background: #fde8e8; color: #9b1c1c; border: 1px solid #f9c9c9; }
.flash.ok { background: #def7ec; color: #03543f; border: 1px solid #bcf0da; }

/* inbox layout */
.inbox { display: grid; grid-template-columns: 400px 1fr; height: calc(100vh - 49px); }
.list { border-right: 1px solid var(--line); overflow-y: auto; background: var(--panel); }
.list .filter { padding: 10px; border-bottom: 1px solid var(--line); display: flex; gap: 8px;
  position: sticky; top: 0; background: var(--panel); z-index: 2; }
.list .filter select { flex: 1; }
.conv { padding: 12px 15px; border-bottom: 1px solid var(--line); cursor: pointer; }
.conv:hover { background: #f5f6f6; }
.conv.active { background: #f0f2f5; }
.conv .row1 { display: flex; justify-content: space-between; align-items: center; }
.conv .name { font-weight: 600; font-size: 15px; color: var(--txt); }
.conv .sector { font-size: 12px; color: var(--wa-green); font-weight: 500; }
.conv .last { color: var(--muted); font-size: 12px; margin-top: 3px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.conv .unread { background: var(--wa-teal); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 11px; padding: 1px 8px; min-width: 20px; text-align: center; }
.conv .status { font-size: 10px; text-transform: uppercase; color: var(--muted); letter-spacing: .3px; }

/* chat */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat .head { padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel);
  display: flex; align-items: center; gap: 12px; }
.chat .head .who { font-weight: 600; font-size: 15px; }
.chat .head .spacer { flex: 1; }
.chat .body { flex: 1; overflow-y: auto; padding: 20px 8%; display: flex; flex-direction: column; gap: 6px;
  background-color: var(--chat-bg); }
.msg { max-width: 65%; padding: 7px 11px 6px; border-radius: 8px; font-size: 14px; line-height: 1.4;
  white-space: pre-wrap; word-wrap: break-word; box-shadow: 0 1px 1px rgba(11,20,26,.13); position: relative; }
.msg.in { background: var(--in); align-self: flex-start; border-top-left-radius: 2px; }
.msg.out { background: var(--out); align-self: flex-end; border-top-right-radius: 2px; }
.msg.bot { background: var(--bot); align-self: flex-end; border-top-right-radius: 2px; }
.msg .sender { display: block; font-weight: 700; font-size: 12.5px; color: var(--wa-green); margin-bottom: 1px; }
.msg.bot .sender { color: #92710a; }
.msg .meta { display: block; font-size: 10.5px; color: var(--muted); text-align: right; margin-top: 2px; }
.chat .compose { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line);
  background: var(--panel); align-items: center; }
.chat .compose textarea { flex: 1; resize: none; height: 44px; border-radius: 22px; padding: 11px 16px; }
.empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted);
  background-color: var(--chat-bg); }

/* admin */
.container { max-width: 1000px; margin: 22px auto; padding: 0 18px; }
h2 { color: var(--txt); }
h3 { color: var(--wa-green); margin-top: 22px; }
.panel-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px; margin-bottom: 18px; box-shadow: 0 1px 3px rgba(11,20,26,.08); }
table { width: 100%; border-collapse: collapse; margin-top: 12px; background: var(--panel);
  border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(11,20,26,.08); }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; background: #f7f8fa; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
details.rowedit { margin-top: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chk { display: inline-flex; align-items: center; gap: 6px; margin-right: 12px; font-size: 13px; color: var(--txt); }
.chk input { width: auto; }
.muted { color: var(--muted); font-size: 13px; }
code { background: #eef1f2; padding: 1px 5px; border-radius: 4px; font-size: 13px; }

/* abas */
.tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 0; z-index: 3; }
.tab { flex: 1; background: none; color: var(--muted); border: none; border-bottom: 3px solid transparent;
  border-radius: 0; padding: 12px 6px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.tab:hover { background: #f5f6f6; }
.tab.active { color: var(--wa-green); border-bottom-color: var(--wa-green); background: none; }
.tab .cnt { display: inline-block; background: #e9edef; color: var(--muted); border-radius: 10px;
  padding: 0 7px; font-size: 11px; margin-left: 3px; }
.tab.active .cnt { background: var(--wa-green); color: #fff; }

/* botoes de midia */
.icon-btn { background: #e9edef; color: #54656f; border: none; border-radius: 50%; width: 42px; height: 42px;
  font-size: 18px; cursor: pointer; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: #dfe5e7; }
.icon-btn.recording { background: #fde8e8; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

.media-img { max-width: 240px; max-height: 240px; border-radius: 8px; cursor: pointer; display: block; }
.doc-link { display: inline-block; color: var(--txt); text-decoration: none; font-weight: 500;
  background: rgba(0,0,0,.05); padding: 8px 12px; border-radius: 6px; }
a.doc-link:hover { text-decoration: underline; }
.msg audio { max-width: 250px; height: 40px; margin: 2px 0; }

/* banner de trava (somente leitura) */
.lock-banner { background: #fff3c4; color: #92710a; padding: 10px 16px; font-size: 13px;
  text-align: center; border-top: 1px solid var(--line); }

/* modal de transferencia */
.modal { position: fixed; inset: 0; background: rgba(11,20,26,.5); display: flex;
  align-items: center; justify-content: center; z-index: 50; }
.modal-box { background: #fff; border-radius: 12px; padding: 22px; width: 360px;
  box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal-box h3 { color: var(--txt); }
.modal-lg { width: 460px; max-height: 85vh; overflow-y: auto; }
.info-block { background: #f7f8fa; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; margin: 12px 0; font-size: 13px; line-height: 1.7; }
.timeline { border-left: 2px solid var(--line); padding-left: 12px; margin-left: 4px; }
.tl-item { position: relative; font-size: 13px; padding: 5px 0; color: var(--txt); }
.tl-item::before { content: ''; position: absolute; left: -17px; top: 10px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--wa-green); }
.tl-when { color: var(--muted); font-size: 11px; margin-right: 6px; }

/* logo na barra do topo */
.topbar-logo { width: 30px; height: 30px; border-radius: 8px; background: #fff; padding: 2px;
  box-shadow: 0 1px 4px rgba(0,0,0,.15); }

/* guia de instalacao (obrigatorio) */
.install-steps { margin: 6px 0; }
.install-steps .step { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0;
  border-bottom: 1px dashed var(--line); font-size: 14px; line-height: 1.55; }
.install-steps .step:last-child { border-bottom: none; }
.step-n { flex: 0 0 auto; width: 27px; height: 27px; border-radius: 50%; background: var(--wa-green);
  color: #fff; font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,128,105,.3); }

/* refinamentos gerais */
h1, h2, h3, h4 { letter-spacing: -0.02em; }
.conv { transition: background .12s; }
.tab { transition: color .12s, border-color .12s; }
a { transition: color .12s; }
