:root {
  --blue: #4f46e5; --blue-d: #0e1b3d; --blue-l: #eef0ff; --brand-font: Sora, Roboto, system-ui, sans-serif;
  --bg: #f5f6fa; --card: #fff; --txt: #1f2430; --mut: #6b7280; --line: #e5e7eb;
  --ok: #2e9e4f; --ok-bg: #e6f5ea; --warn: #b7791f; --warn-bg: #fdf3dc; --bad: #d64545; --bad-bg: #fde8e8;
  --purple: #8e24aa; --shadow: 0 1px 3px rgba(16,24,40,.12), 0 1px 2px rgba(16,24,40,.06);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171f; --card: #1d212b; --txt: #e8ebf2; --mut: #9aa3b5; --line: #2c3240; --blue: #7872f4; --blue-d: #0e1b3d; --blue-l: #24294d;
    --ok-bg: #173323; --warn-bg: #3a2e12; --bad-bg: #3b1c1c; --shadow: 0 1px 3px rgba(0,0,0,.5); }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Roboto, system-ui, sans-serif; background: var(--bg); color: var(--txt); font-size: 15px; }
h1, h2, h3 { margin: 0; font-weight: 500; }
h1, h2, .page-title { font-family: var(--brand-font); }
a { color: var(--blue); text-decoration: none; cursor: pointer; }
button { font-family: inherit; cursor: pointer; }
.hidden, [hidden] { display: none !important; }

/* layout */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--card); border-right: 1px solid var(--line); padding: 16px 0; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { padding: 4px 22px 16px; font-weight: 700; font-size: 18px; color: var(--blue); display: flex; gap: 10px; align-items: center; }
.brand .logo { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, var(--blue), var(--blue-d)); color: #fff; display: grid; place-items: center; font-size: 16px; }
.side .grp { padding: 10px 22px 6px; color: var(--mut); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.side a.nav { display: flex; gap: 14px; align-items: center; padding: 11px 22px; color: var(--txt); font-weight: 500; border-left: 3px solid transparent; }
.side a.nav:hover { background: var(--blue-l); }
.side a.nav.on { color: var(--blue); background: var(--blue-l); border-left-color: var(--blue); }
.side .ico { width: 22px; text-align: center; font-size: 18px; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: var(--card); flex-wrap: wrap; }
.topbar .sp { flex: 1; }
.topbar .emp { font-weight: 500; }
.content { padding: 24px 28px 60px; max-width: 1200px; }
.page-title { color: var(--blue); font-size: 26px; font-weight: 400; margin-bottom: 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.page-title .sp { flex: 1; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; display: flex; overflow-x: auto; padding: 6px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .brand, .side .grp { display: none; }
  .side a.nav { padding: 10px 14px; white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; }
  .side a.nav.on { border-bottom-color: var(--blue); }
  .content { padding: 16px; } .topbar { padding: 12px 16px; }
}

/* controles */
.btn { border: 0; border-radius: 4px; padding: 10px 18px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; font-size: 13px; background: var(--blue); color: #fff; box-shadow: var(--shadow); }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.ghost { background: transparent; color: var(--blue); box-shadow: none; }
.btn.line { background: var(--card); color: var(--blue); border: 1px solid var(--blue); box-shadow: none; }
.btn.bad { background: var(--bad); }
.btn.sm { padding: 6px 12px; font-size: 12px; }
.btn.txt { background: transparent; color: var(--txt); box-shadow: none; }
.iconbtn { border: 0; background: transparent; color: var(--blue); font-size: 17px; padding: 6px 8px; border-radius: 4px; }
.iconbtn:hover { background: var(--blue-l); } .iconbtn.bad { color: var(--bad); }
label.f { display: block; font-size: 13px; color: var(--mut); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], input[type=time], select, textarea {
  width: 100%; padding: 12px 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--card); color: var(--txt); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
textarea { min-height: 96px; resize: vertical; }
.field { margin-bottom: 16px; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.hint { font-size: 12.5px; color: var(--mut); margin-top: 4px; }
.switch { display: flex; align-items: center; gap: 12px; padding: 12px 0; font-size: 16px; }
.switch input { appearance: none; width: 40px; height: 22px; border-radius: 11px; background: #9ca3af; position: relative; cursor: pointer; transition: .15s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: var(--shadow); }
.switch input:checked { background: var(--blue); } .switch input:checked::after { left: 20px; }

/* cards */
.card { background: var(--card); border-radius: 10px; box-shadow: var(--shadow); padding: 18px 20px; }
.card + .card { margin-top: 14px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 22px; margin-bottom: 4px; }
.stat .lb { color: var(--mut); font-size: 14px; } .stat .vl { font-size: 32px; font-weight: 700; line-height: 1.1; } .stat .sub { color: var(--mut); font-size: 12.5px; }
.bg-purple { background: linear-gradient(135deg, #6c63d6, #8e54c2); } .bg-green { background: linear-gradient(135deg, #12b886, #2fd36b); }
.bg-red { background: linear-gradient(135deg, #f0356d, #ff6a2b); } .bg-blue { background: linear-gradient(135deg, #4a90e2, #2f66a8); }
.bg-amber { background: linear-gradient(135deg, #f59e0b, #f97316); } .bg-gray { background: linear-gradient(135deg, #6b7280, #4b5563); }

.camp { display: block; color: inherit; }
.camp .head { display: flex; align-items: center; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.camp .badge-ic { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 24px; background: linear-gradient(135deg, #9c27b0, #7b1fa2); flex: none; }
.camp .nm { font-weight: 700; font-size: 17px; } .camp .id { color: var(--mut); font-size: 12.5px; }
.camp .info { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; padding-top: 14px; }
.camp .info .k { font-size: 11.5px; letter-spacing: .05em; color: var(--mut); text-transform: uppercase; }
.camp .info .v { font-weight: 500; margin-top: 3px; }
.pill { display: inline-block; padding: 4px 14px; border-radius: 14px; color: #fff; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.st-rascunho { background: #6b7280; } .st-agendada { background: #3b82f6; } .st-executando { background: #16a34a; }
.st-pausada { background: #d97706; } .st-concluida { background: var(--purple); } .st-cancelada { background: #9ca3af; } .st-erro { background: var(--bad); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 12px; font-size: 12.5px; font-weight: 500; }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.warn { background: var(--warn-bg); color: var(--warn); } .chip.mut { background: var(--line); color: var(--mut); } .chip.blue { background: var(--blue-l); color: var(--blue); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: #9ca3af; } .dot.ok { background: #22c55e; } .dot.bad { background: var(--bad); }
.progress { height: 12px; border-radius: 6px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), #22c55e); transition: width .6s; }

/* tabelas */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--mut); padding: 12px 14px; background: color-mix(in srgb, var(--line) 55%, transparent); }
.tbl th:first-child { border-radius: 10px 0 0 10px; } .tbl th:last-child { border-radius: 0 10px 10px 0; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl-wrap { overflow-x: auto; }
.avatar { width: 38px; height: 38px; border-radius: 50%; color: #fff; display: inline-grid; place-items: center; font-weight: 700; margin-right: 12px; vertical-align: middle; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding-top: 14px; color: var(--mut); }
.empty { text-align: center; color: var(--mut); padding: 40px 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.filters > div { min-width: 150px; flex: 1; }

/* tiles de criação de lista */
.tile { text-align: center; padding: 26px 14px; border-radius: 12px; background: var(--card); box-shadow: var(--shadow); border: 0; color: var(--txt); width: 100%; }
.tile .big { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 12px; color: #fff; font-size: 30px; }
.tile b { display: block; font-size: 17px; } .tile span { color: var(--mut); font-size: 14px; }
.tile[disabled] { opacity: .5; cursor: not-allowed; }

/* assistente */
.wiz { max-width: 920px; margin: 0 auto; background: var(--card); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.wiz-head { background: linear-gradient(135deg, var(--blue), var(--blue-d)); color: #fff; padding: 22px 26px; display: flex; gap: 18px; align-items: center; }
.wiz-head .ic { width: 54px; height: 54px; border-radius: 12px; background: rgba(255,255,255,.2); display: grid; place-items: center; font-size: 26px; }
.wiz-head h2 { font-size: 22px; font-weight: 700; }
.tabs { display: flex; background: color-mix(in srgb, var(--card) 94%, #000); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { flex: 1; min-width: 104px; border: 0; background: transparent; padding: 17px 10px; color: var(--mut); font-weight: 500; letter-spacing: .03em; border-bottom: 3px solid transparent; }
.tabs button.on { color: var(--txt); font-weight: 700; border-bottom-color: var(--blue); }
.tabs button.done { color: var(--ok); }
.wiz-body { padding: 24px 26px; min-height: 380px; }
.wiz-body h3 { color: var(--blue); font-size: 22px; font-weight: 700; margin-bottom: 20px; }
.wiz-foot { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.wiz-foot .sp { flex: 1; }
.opt { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; gap: 14px; align-items: center; cursor: pointer; background: var(--card); }
.opt.on { border-color: var(--blue); background: var(--blue-l); }
.opt.off { opacity: .5; cursor: not-allowed; }
.opt .meta { flex: 1; } .opt .meta b { display: block; }
.note { border-radius: 8px; padding: 12px 14px; font-size: 14px; display: flex; gap: 10px; margin-top: 14px; background: color-mix(in srgb, var(--line) 50%, transparent); }
.note.warn { background: var(--warn-bg); color: var(--warn); } .note.bad { background: var(--bad-bg); color: var(--bad); } .note.ok { background: var(--ok-bg); color: var(--ok); }
.rev { margin-bottom: 14px; padding: 16px 18px; border-radius: 10px; background: color-mix(in srgb, var(--card) 94%, #000); box-shadow: var(--shadow); }
.rev h4 { margin: 0 0 10px; font-size: 16px; } .rev dl { margin: 0; display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; }
.rev dt { color: var(--mut); font-weight: 500; } .rev dd { margin: 0; word-break: break-word; }
.phone { max-width: 330px; margin: 0 auto; background: #e5ddd5; border-radius: 16px; padding: 16px; border: 1px solid var(--line); }
.bubble { background: #dcf8c6; color: #111; border-radius: 8px; padding: 9px 12px; white-space: pre-wrap; word-break: break-word; font-size: 14.5px; box-shadow: 0 1px 1px rgba(0,0,0,.15); }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { border: 1px solid var(--line); border-radius: 16px; padding: 6px 12px; cursor: pointer; user-select: none; }
.days input { display: none; } .days input:checked + span { color: var(--blue); font-weight: 700; }
.days label:has(input:checked) { border-color: var(--blue); background: var(--blue-l); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, var(--blue), var(--blue-d)); }
.login .card { width: 100%; max-width: 400px; padding: 30px; }
.login h1 { color: var(--blue); font-size: 24px; margin-bottom: 4px; }

/* modal / toast */
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; z-index: 50; padding: 16px; }
#modal .box { background: var(--card); border-radius: 10px; width: 100%; max-width: 480px; padding: 22px; max-height: 92vh; overflow: auto; }
#modal h3 { margin-bottom: 14px; } #modal .acts { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: #1f2937; color: #fff; padding: 12px 20px; border-radius: 8px; opacity: 0; transition: .25s; pointer-events: none; z-index: 60; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); } #toast.bad { background: var(--bad); }
.mono { font-variant-numeric: tabular-nums; }
.sub-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 14px; }
.sub-tabs button { border: 0; background: transparent; padding: 10px 16px; color: var(--mut); font-weight: 500; border-bottom: 3px solid transparent; }
.sub-tabs button.on { color: var(--blue); border-bottom-color: var(--blue); }

/* ajustes */
.grid > .card + .card { margin-top: 0; }
.page-title input[type=text] { font-size: 15px; padding: 9px 12px; }
.page-title .btn { font-size: 13px; }

/* anexos na pré-visualização */
.bubble img { max-width: 100%; max-height: 220px; border-radius: 6px; display: block; margin-bottom: 6px; }

/* barra de formatação do WhatsApp */
.fmtbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fmtbar .fb { border: 1px solid var(--line); background: var(--card); color: var(--txt); border-radius: 6px; padding: 7px 11px; font: inherit; font-size: 14px; cursor: pointer; width: auto; min-width: 36px; }
.fmtbar .fb:hover { background: var(--blue-l); border-color: var(--blue); }
.fmtbar .fb.ia { border-color: var(--purple); color: var(--purple); font-weight: 500; }
.fmtbar select.fb { padding: 7px 8px; }
.emojis { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; max-height: 150px; overflow: auto; background: var(--card); }
.emojis button { border: 0; background: transparent; font-size: 22px; padding: 4px 6px; border-radius: 6px; cursor: pointer; line-height: 1; }
.emojis button:hover { background: var(--blue-l); }
.bubble b { font-weight: 700; } .bubble code { font-family: ui-monospace, Consolas, monospace; background: rgba(0,0,0,.06); padding: 0 3px; border-radius: 3px; }

/* gráficos do dashboard (cores validadas: ΔE de daltonismo >= 17 nos dois modos) */
:root { --c-sent: #4a90e2; --c-fail: #d64545; }
@media (prefers-color-scheme: dark) { :root { --c-sent: #5f93dc; --c-fail: #d95f5f; } }
.chart { width: 100%; height: auto; display: block; margin-top: 8px; }
.chart .gr { stroke: var(--line); stroke-width: 1; }
.chart .ax { fill: var(--mut); font-size: 11px; }
.lg { display: flex; gap: 14px; font-size: 13px; color: var(--mut); } .lg .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.hb { padding: 8px 0; } .hb-t { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 4px; } .hb-v { color: var(--mut); white-space: nowrap; }
.hb-bar { display: flex; gap: 2px; height: 10px; background: color-mix(in srgb, var(--line) 60%, transparent); border-radius: 5px; overflow: hidden; } .hb-bar i { display: block; height: 100%; border-radius: 5px; }

/* marca Ressohub */
.wm { font-family: var(--brand-font); font-weight: 700; letter-spacing: -.02em; color: var(--txt); } .wm b { font-weight: 500; color: var(--blue); }
.brand .simb { width: 34px; height: 34px; flex: none; }
.brand .wm { font-size: 20px; }
.login .marca { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; } .login .marca img { width: 44px; height: 44px; } .login .marca .wm { font-size: 28px; }
.institucional { margin-top: 18px; font-size: 12px; color: var(--mut); text-align: center; line-height: 1.5; }
.side .institucional { padding: 14px 18px; text-align: left; border-top: 1px solid var(--line); margin-top: 18px; }
@media (max-width: 900px) { .side .institucional { display: none; } }
