@font-face { font-family: Poppins; font-weight: 700; src: url(/fonts/Poppins-Bold.ttf); font-display: swap; }
@font-face { font-family: Poppins; font-weight: 600; src: url(/fonts/Poppins-SemiBold.ttf); font-display: swap; }
@font-face { font-family: Lato; font-weight: 400; src: url(/fonts/Lato-Regular.ttf); font-display: swap; }

:root {
  color-scheme: light;
  --navy: #0d1b2a; --cyan: #00bcd4; --cyan-ink: #006a79; --cyan-soft: #e0f6f9; --orange: #ff5722; --orange-ink: #c43a10; --orange-soft: #fff0ea;
  --white: #fff; --gray: #f4f6f8; --line: #dde3e9; --muted: #52606d; --good: #1b7f4b; --good-soft: #e5f5ec; --bad: #b3261e; --bad-soft: #fbeae9; --warn: #8a5a00; --warn-soft: #fdf3dc;
  --radius: 10px; --shadow: 0 1px 2px rgb(13 27 42 / 8%);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--gray); color: var(--navy); font: 16px/1.5 Lato, system-ui, sans-serif; }
h1, h2, h3, h4 { font-family: Poppins, system-ui, sans-serif; font-weight: 600; line-height: 1.25; margin: 0; }
h1 { font-size: 28px; font-weight: 700; } h2 { font-size: 20px; } h3 { font-size: 16px; }
a { color: var(--cyan-ink); }
p { margin: 0; }
.muted { color: var(--muted); } .small { font-size: 14px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .between { justify-content: space-between; }
.stack { display: grid; gap: 14px; align-content: start; } .grow { flex: 1; min-width: 0; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Estrutura */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--navy); color: #fff; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.logo { display: flex; align-items: center; gap: 10px; padding: 0 8px 16px; font: 700 20px Poppins, sans-serif; color: inherit; text-decoration: none; }
.logo img { width: 30px; height: 30px; }
.side a.nav { color: #dbe3ea; text-decoration: none; padding: 9px 12px; border-radius: 8px; display: block; }
.side a.nav:hover { background: rgb(255 255 255 / 8%); color: #fff; }
.side a.nav.active { background: rgb(0 188 212 / 20%); color: #fff; box-shadow: inset 3px 0 0 var(--cyan); }
.side .nav-label { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: #93a3b3; padding: 14px 12px 4px; }
.side .foot { margin-top: auto; padding: 14px 12px 0; font-size: 14px; color: #c5d0da; }
.side .foot button { color: #fff; background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; font: inherit; }
.main { padding: 24px 28px 60px; min-width: 0; }
.topbar { display: none; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.head p { color: var(--muted); margin-top: 2px; }
.demo-bar { background: var(--warn-soft); color: var(--warn); padding: 8px 28px; font-size: 14px; border-bottom: 1px solid #efdcae; }
.search-box { position: relative; width: min(340px, 100%); }
.search-results { position: absolute; z-index: 20; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgb(13 27 42 / 15%); max-height: 320px; overflow: auto; }
.search-results button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; cursor: pointer; font: inherit; color: inherit; }
.search-results button:hover { background: var(--gray); }

/* Controles */
button, .btn { font: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--navy); cursor: pointer; text-decoration: none; font-family: Poppins, sans-serif; font-weight: 600; font-size: 14px; }
.btn:hover { border-color: var(--navy); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: var(--navy); }
.btn.primary:hover { background: #ff6d3f; }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.danger { color: var(--bad); border-color: #e6b8b5; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--cyan-ink); outline-offset: 2px; }
input, select, textarea { font: inherit; color: inherit; width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #b9c4ce; border-radius: 8px; background: #fff; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--cyan-ink); flex: none; }
textarea { min-height: 96px; resize: vertical; }
label.field { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
label.field > :is(input, select, textarea) { color: var(--navy); font-size: 16px; }
label.check { display: flex; gap: 8px; align-items: center; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }

/* Blocos */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.stat { display: block; color: inherit; text-decoration: none; }
a.stat:hover { border-color: var(--cyan-ink); }
.stat .label { color: var(--muted); font-size: 14px; }
.stat .value { font: 700 26px/1.2 Poppins, sans-serif; margin-top: 4px; overflow-wrap: anywhere; }
.stat .value.na { font-size: 18px; color: var(--muted); font-weight: 600; }
.stat .hint { color: var(--muted); font-size: 13px; margin-top: 2px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a, .tabs button { padding: 9px 12px; color: var(--muted); text-decoration: none; background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer; font: inherit; }
.tabs .active { color: var(--navy); border-bottom-color: var(--orange); font-weight: 700; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 400; background: var(--gray); white-space: nowrap; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: #f8fafb; }
.empty { padding: 26px; text-align: center; color: var(--muted); background: #fff; border: 1px dashed #c3ccd5; border-radius: var(--radius); }
.chip { display: inline-block; padding: 1px 9px; border-radius: 999px; background: var(--gray); font-size: 13px; white-space: nowrap; border: 1px solid var(--line); }
.chip.good { background: var(--good-soft); color: var(--good); border-color: #bfe3cd; } .chip.bad { background: var(--bad-soft); color: var(--bad); border-color: #f0c9c6; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: #efdcae; } .chip.info { background: var(--cyan-soft); color: var(--cyan-ink); border-color: #b5e7ee; }
.notice { background: var(--cyan-soft); border: 1px solid #b5e7ee; border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.notice.warn { background: var(--warn-soft); border-color: #efdcae; }
.list { display: grid; } .list > * { padding: 9px 0; border-bottom: 1px solid var(--line); } .list > *:last-child { border-bottom: 0; }
.link { background: none; border: 0; padding: 0; color: var(--cyan-ink); text-decoration: underline; cursor: pointer; font: inherit; text-align: left; }

/* Quadros */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: #e9edf1; border-radius: var(--radius); padding: 8px; min-height: 120px; }
.col.over { outline: 2px dashed var(--cyan-ink); }
.col-head { display: flex; justify-content: space-between; gap: 6px; padding: 4px 6px 8px; font: 600 14px Poppins, sans-serif; }
.col-head small { font: 400 13px Lato, sans-serif; color: var(--muted); }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; display: grid; gap: 4px; cursor: pointer; box-shadow: var(--shadow); }
.tile[draggable=true] { cursor: grab; }
.tile:hover { border-color: var(--cyan-ink); }
.tile select { min-height: 32px; padding: 2px 6px; font-size: 13px; }
.tile .title { font-weight: 700; overflow-wrap: anywhere; }

/* Etapas */
.steps { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.step { flex: 1 0 auto; padding: 6px 10px; font-size: 13px; background: #e9edf1; color: var(--muted); text-align: center; white-space: nowrap; border-radius: 6px; }
.step.done { background: var(--cyan-soft); color: var(--cyan-ink); } .step.now { background: var(--navy); color: #fff; font-weight: 700; }
.timeline { display: grid; gap: 0; } .timeline .ev { padding: 8px 0 8px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline .ev::before { content: ''; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--cyan-ink); }
.diff { font-size: 15px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.diff div { padding: 3px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff .add { background: var(--good-soft); } .diff .add::before { content: '+ '; font-weight: 700; color: var(--good); }
.diff .del { background: var(--bad-soft); } .diff .del::before { content: '− '; font-weight: 700; color: var(--bad); }
.diff .same::before { content: '  '; white-space: pre; }
.piece { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 8px; }
.piece.on { border-color: var(--cyan-ink); box-shadow: inset 3px 0 0 var(--cyan); }
.score { display: inline-flex; align-items: center; gap: 6px; }
.score i { display: block; width: 64px; height: 6px; background: #e3e8ed; border-radius: 3px; overflow: hidden; }
.score i b { display: block; height: 100%; background: var(--cyan-ink); }

/* Calendário */
.cal { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-width: 770px; }
.cal > div { background: #fff; padding: 6px; min-height: 92px; display: grid; align-content: start; gap: 4px; }
.cal .dow { min-height: 0; background: var(--gray); font-size: 13px; color: var(--muted); }
.cal .off { background: #fafbfc; color: #8b98a5; } .cal .today .num { background: var(--navy); color: #fff; border-radius: 4px; padding: 0 5px; }
.cal .num { font-size: 13px; justify-self: start; }
.cal button { all: unset; cursor: pointer; display: block; font-size: 13px; background: var(--cyan-soft); border-radius: 4px; padding: 1px 6px; overflow-wrap: anywhere; }
.cal button:hover { background: #c6edf3; } .cal button:focus-visible { outline: 2px solid var(--cyan-ink); }
.scroll-x { overflow-x: auto; }

/* Gantt */
.gantt { display: grid; grid-template-columns: 200px 1fr; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.gantt .names > div, .gantt .lane { height: 38px; border-bottom: 1px solid var(--line); }
.gantt .names { border-right: 1px solid var(--line); font-size: 14px; }
.gantt .names > div { display: flex; align-items: center; padding: 0 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.gantt .names .group { background: var(--gray); font-weight: 700; }
.gantt .chart { overflow-x: auto; position: relative; }
.gantt .inner { position: relative; }
.gantt .scale { height: 38px; position: relative; border-bottom: 1px solid var(--line); background: var(--gray); }
.gantt .scale span { position: absolute; top: 9px; font-size: 12px; color: var(--muted); padding-left: 4px; border-left: 1px solid var(--line); }
.gantt .lane { position: relative; } .gantt .lane.group { background: var(--gray); }
.gantt .bar { position: absolute; top: 8px; height: 22px; border-radius: 4px; background: var(--cyan); border: 0; cursor: pointer; padding: 0 6px; color: var(--navy); font-size: 12px; overflow: hidden; white-space: nowrap; text-align: left; }
.gantt .bar.done { background: #b9c4ce; } .gantt .bar.late { background: var(--orange); }
.gantt .now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--navy); opacity: .5; pointer-events: none; }
.gantt svg { position: absolute; left: 0; top: 0; pointer-events: none; }

/* Construtor */
.builder { display: grid; grid-template-columns: 170px minmax(0, 1fr) 270px; gap: 12px; align-items: start; }
.palette { display: grid; gap: 8px; }
.palette-item { padding: 9px 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px; cursor: grab; text-align: left; font: inherit; color: inherit; touch-action: none; }
.canvas-wrap { overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); height: 560px; }
.canvas { position: relative; width: 2000px; height: 1000px; background-image: radial-gradient(#d6dde3 1px, transparent 1px); background-size: 20px 20px; }
.canvas svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.canvas svg path { fill: none; stroke: #62707e; stroke-width: 2; }
.node { position: absolute; width: 150px; min-height: 52px; padding: 8px 18px 8px 10px; background: #fff; border: 2px solid var(--navy); border-radius: 8px; cursor: move; user-select: none; touch-action: none; font-size: 14px; display: grid; }
.node small { color: var(--muted); font-size: 12px; } .node.start small, .node.end small { display: none; }
.node.sel { box-shadow: 0 0 0 3px var(--cyan); }
.node.start, .node.end { border-radius: 26px; background: var(--navy); color: #fff; } .node.start small, .node.end small { color: #c5d0da; }
.node.approval { border-color: var(--orange-ink); background: var(--orange-soft); } .node.decision { border-color: var(--cyan-ink); background: var(--cyan-soft); border-style: dashed; }
.node .port { position: absolute; right: -9px; top: calc(50% - 9px); width: 18px; height: 18px; border-radius: 50%; background: var(--orange); border: 2px solid #fff; cursor: crosshair; touch-action: none; }

/* Gráficos */
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin: 6px 0; }
.chart-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.chart-box { position: relative; }
.chart-box svg { display: block; width: 100%; height: auto; }
.chart-box text { font: 12px Lato, sans-serif; fill: var(--muted); }
.tip { position: absolute; z-index: 10; background: var(--navy); color: #fff; font-size: 13px; padding: 6px 9px; border-radius: 6px; pointer-events: none; white-space: nowrap; }
.hbar { display: grid; grid-template-columns: minmax(90px, 150px) 1fr auto; gap: 8px; align-items: center; font-size: 14px; padding: 3px 0; }
.hbar .track { height: 12px; background: var(--gray); border-radius: 4px; overflow: hidden; } .hbar .fill { height: 100%; background: var(--cyan-ink); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .fill.won { background: var(--good); } .hbar .fill.lost { background: #8b98a5; }

/* Conversa */
.msg { padding: 8px 10px; border-radius: 8px; background: var(--gray); max-width: 85%; }
.msg.Enviada { background: var(--cyan-soft); justify-self: end; } .msg.Interna { background: var(--warn-soft); }
.answer { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; }

/* Janelas */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 32px); color: inherit; box-shadow: 0 20px 60px rgb(13 27 42 / 35%); }
dialog::backdrop { background: rgb(13 27 42 / 55%); }
.dlg-head { position: sticky; top: 0; background: #fff; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); z-index: 2; }
.dlg-body { padding: 16px 18px 20px; display: grid; gap: 14px; }
.x { background: none; border: 0; font-size: 24px; line-height: 1; cursor: pointer; padding: 4px 8px; color: var(--muted); }
#toast { position: fixed; z-index: 1000; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; max-width: calc(100vw - 24px); }
#toast.bad { background: var(--bad); }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 18px; }
.auth .card { width: min(460px, 100%); padding: 26px; display: grid; gap: 14px; }
.public { display: grid; place-items: start center; padding: 18px; min-height: 100vh; }
.public-card { width: min(720px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 22px; display: grid; gap: 14px; }
.toggle-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stage-row { display: grid; grid-template-columns: 1fr 90px 120px auto; gap: 8px; align-items: center; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .15s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgb(13 27 42 / 50%); }
  .topbar { display: flex; align-items: center; gap: 10px; background: var(--navy); color: #fff; padding: 8px 16px; position: sticky; top: 0; z-index: 30; }
  .topbar button { background: none; border: 1px solid #52606d; border-radius: 6px; color: #fff; padding: 4px 10px; font: inherit; }
  .topbar strong { font-family: Poppins, sans-serif; }
  .main { padding: 16px 16px 50px; } .demo-bar { padding: 8px 16px; } .search-row { padding: 14px 16px 0 !important; }
  h1 { font-size: 24px; }
  .builder { grid-template-columns: minmax(0, 1fr); } .palette { grid-template-columns: repeat(2, 1fr); }
  .canvas-wrap { height: 420px; }
  .gantt { grid-template-columns: 120px 1fr; }
  .stage-row { grid-template-columns: 1fr 70px; } .stage-row select { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Atendimento */
.sim-bar { background: var(--cyan-soft); color: var(--cyan-ink); padding: 8px 28px; font-size: 14px; border-bottom: 1px solid #b5e7ee; }
.inbox { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 12px; align-items: start; }
.inbox-list { display: grid; gap: 6px; max-height: 72vh; overflow-y: auto; }
.inbox-item { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; cursor: pointer; font: inherit; color: inherit; display: grid; gap: 3px; width: 100%; }
.inbox-item.sel { border-color: var(--cyan-ink); box-shadow: inset 3px 0 0 var(--cyan); }
.preview { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat { display: grid; gap: 8px; max-height: 50vh; overflow-y: auto; padding: 4px; }
.bubble { padding: 8px 10px; border-radius: 8px; max-width: 85%; background: var(--gray); }
.bubble.out { background: var(--cyan-soft); justify-self: end; } .bubble.human { background: var(--orange-soft); }
.bubble.cancelled { opacity: .55; text-decoration: line-through; }
.source { border-left: 3px solid var(--cyan-ink); padding: 4px 10px; background: var(--gray); font-size: 14px; }
.faq-row { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
@media (max-width: 900px) { .inbox { grid-template-columns: minmax(0, 1fr); } .sim-bar { padding: 8px 16px; } }
