/* =========================================================
   OuroPack CRM — identidade do Brandbook
   Black #221E1B · Orange #FC5315 · Greige #F2EFE8 · Dark gray #4D4D4D
   Tilt Warp (títulos) · Albert Sans (textos)
   ========================================================= */
:root {
  --black: #221E1B;
  --black-2: #2C2724;
  --black-3: #3A3430;
  --orange: #FC5315;
  --orange-600: #E04408;
  --orange-50: #FFF1EA;
  --orange-100: #FFE0D1;
  --greige: #F2EFE8;
  --greige-2: #E8E3D9;
  --greige-3: #D9D3C7;
  --gray: #4D4D4D;
  --gray-2: #77716B;
  --gray-3: #A39D96;
  --white: #FFFFFF;
  --red: #D9251D;
  --red-50: #FDECEB;
  --red-100: #FAD3D0;
  --green: #1E8E4E;
  --green-50: #E7F5EC;
  --blue: #2563A8;
  --blue-50: #E8F0FA;
  --amber: #B7791F;
  --amber-50: #FDF5E3;

  --bg: var(--greige);
  --surface: var(--white);
  --text: var(--black);
  --muted: var(--gray-2);
  --line: #E6E1D8;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(34,30,27,.06), 0 1px 1px rgba(34,30,27,.04);
  --shadow: 0 4px 18px rgba(34,30,27,.08), 0 1px 3px rgba(34,30,27,.06);
  --shadow-lg: 0 24px 60px rgba(34,30,27,.22);
  --font-title: 'Tilt Warp', 'Albert Sans', system-ui, sans-serif;
  --font: 'Albert Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --sidebar: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 14.5px; line-height: 1.45; color: var(--text);
  background: var(--bg); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-title); font-weight: 400; letter-spacing: .1px; margin: 0; line-height: 1.15; }
a { color: var(--orange-600); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--orange-100); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.hidden { display: none !important; }

.boot { height: 100vh; display: grid; place-items: center; background: var(--black); }
.boot img { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .7; } }

/* ---------------- Botões e campos ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--white); color: var(--black); font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; white-space: nowrap;
  border-color: var(--line);
}
.btn:hover { background: var(--greige); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn.primary { background: var(--orange); color: #fff; border-color: var(--orange); box-shadow: 0 2px 8px rgba(252,83,21,.25); }
.btn.primary:hover { background: var(--orange-600); border-color: var(--orange-600); }
.btn.dark { background: var(--black); color: var(--greige); border-color: var(--black); }
.btn.dark:hover { background: var(--black-3); }
.btn.danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn.danger:hover { filter: brightness(.94); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(34,30,27,.06); }
.btn.sm { height: 31px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 31px; }
.btn.block { width: 100%; }

label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
label.field .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--greige-3); border-radius: 10px;
  background: #fff; transition: border-color .15s, box-shadow .15s; font-weight: 400; font-size: 14px;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(252,83,21,.15); }
.input::placeholder { color: var(--gray-3); }
.input-group { position: relative; }
.input-group svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--gray-3); }
.input-group .input { padding-left: 36px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 42px; height: 24px; border-radius: 99px; background: var(--greige-3); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.switch input:checked + .track { background: var(--orange); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(252,83,21,.25); }

/* ---------------- Chips / badges ---------------- */
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--greige); color: var(--gray); white-space: nowrap; }
.chip svg { width: 13px; height: 13px; }
.chip.orange { background: var(--orange-50); color: var(--orange-600); }
.chip.dark { background: var(--black); color: var(--greige); }
.chip.green { background: var(--green-50); color: var(--green); }
.chip.red { background: var(--red); color: #fff; }
.chip.red-soft { background: var(--red-50); color: var(--red); }
.chip.blue { background: var(--blue-50); color: var(--blue); }
.chip.amber { background: var(--amber-50); color: var(--amber); }
.chip.outline { background: transparent; border: 1px solid var(--greige-3); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------------- Layout principal ---------------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--black); color: var(--greige); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 22px 14px 16px; overflow-y: auto;
}
.sidebar .brand { padding: 4px 10px 22px; }
.sidebar .brand img { height: 26px; display: block; }
.sidebar .brand .env { margin-top: 10px; display: inline-flex; font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--orange); font-weight: 700; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .label { font-size: 10.5px; letter-spacing: 1.6px; text-transform: uppercase; color: #8E857C; padding: 16px 12px 6px; font-weight: 700; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #CFC8BD;
  font-weight: 500; position: relative; transition: background .15s, color .15s;
}
.nav a svg { width: 19px; height: 19px; flex: none; opacity: .9; }
.nav a:hover { background: var(--black-2); color: #fff; }
.nav a.active { background: var(--black-3); color: #fff; }
.nav a.active::before { content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--orange); }
.nav a .count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { box-shadow: 0 0 0 5px rgba(217,37,29,.25); } }
.sidebar .me { margin-top: auto; padding: 12px; border-radius: 12px; background: var(--black-2); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--orange); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; text-transform: uppercase; }
.avatar.lg { width: 46px; height: 46px; font-size: 16px; }
.avatar.dark { background: var(--black); color: var(--greige); }
.avatar.soft { background: var(--orange-100); color: var(--orange-600); }
.me .who { min-width: 0; flex: 1; }
.me .who b { display: block; font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who span { font-size: 11.5px; color: #A79F95; }
.me .btn { color: #CFC8BD; }
.me .btn:hover { background: var(--black-3); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: rgba(242,239,232,.88); backdrop-filter: blur(10px);
  display: flex; align-items: center; gap: 14px; padding: 18px 32px 14px; border-bottom: 1px solid transparent;
}
.topbar h1 { font-size: 26px; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.topbar .actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.menu-btn { display: none; }
.content { padding: 8px 32px 48px; flex: 1; min-width: 0; }

/* Alerta global "aguardando atendente" */
.alert-bar {
  display: none; align-items: center; gap: 12px; margin: 0 32px 10px; padding: 12px 16px; border-radius: 12px;
  background: var(--red); color: #fff; font-weight: 600; box-shadow: 0 8px 24px rgba(217,37,29,.3); cursor: pointer;
  animation: alertIn .3s ease-out;
}
.alert-bar.show { display: flex; }
.alert-bar svg { width: 22px; height: 22px; flex: none; animation: shake 2.4s ease-in-out infinite; }
.alert-bar .btn { margin-left: auto; background: #fff; color: var(--red); border-color: #fff; }
@keyframes alertIn { from { transform: translateY(-8px); opacity: 0; } }
@keyframes shake { 0%, 88%, 100% { transform: rotate(0); } 91% { transform: rotate(-14deg); } 94% { transform: rotate(12deg); } 97% { transform: rotate(-8deg); } }

/* ---------------- Cards ---------------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.card .card-h { padding: 18px 20px 0; display: flex; align-items: center; gap: 10px; }
.card .card-h h3 { font-size: 17px; }
.card .card-b { padding: 16px 20px 20px; }
.section-title { font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--orange-600); font-weight: 700; display: flex; align-items: center; gap: 10px; }
.section-title::before { content: ''; width: 22px; height: 2px; background: var(--orange); }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; color: var(--greige-3); margin-bottom: 10px; }
.empty h4 { font-family: var(--font); font-weight: 700; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ---------------- Segmented / tabs ---------------- */
.segmented { display: inline-flex; background: var(--greige-2); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; height: 32px; padding: 0 13px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--gray); }
.segmented button.on { background: #fff; color: var(--black); box-shadow: var(--shadow-sm); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--greige-3); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: transparent; padding: 11px 14px; font-weight: 600; color: var(--gray-2); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.tabs button svg { width: 17px; height: 17px; }
.tabs button.on { color: var(--black); border-bottom-color: var(--orange); }
.tabs button:hover { color: var(--black); }

/* ---------------- Dashboard ---------------- */
.dash-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.dash-toolbar .range { color: var(--muted); font-size: 13px; }
.hero { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.hero .main-kpi { background: var(--black); color: var(--greige); border: 0; position: relative; overflow: hidden; }
.hero .main-kpi::after { content: ''; position: absolute; right: -40px; bottom: -60px; width: 220px; height: 220px; background: url('../img/icon.svg') no-repeat center / contain; opacity: .08; transform: rotate(-8deg); }
.kpi { padding: 20px 22px; display: flex; flex-direction: column; gap: 6px; min-height: 128px; }
.kpi .k-label { font-size: 12.5px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.main-kpi .k-label { color: #BDB5AA; }
.kpi .k-value { font-family: var(--font-title); font-size: 34px; line-height: 1.05; }
.main-kpi .k-value { font-size: 52px; color: #fff; }
.main-kpi .k-value small { font-size: 18px; color: var(--orange); margin-left: 6px; }
.kpi .k-foot { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; }
.main-kpi .k-foot { color: #BDB5AA; }
.delta { font-weight: 700; font-size: 12.5px; display: inline-flex; align-items: center; gap: 2px; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.main-kpi .delta.up { color: #6FD39A; }
.main-kpi .delta.down { color: #FF8A80; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi-grid .kpi { min-height: 112px; }
.kpi.alert { background: var(--red); border-color: var(--red); color: #fff; cursor: pointer; }
.kpi.alert .k-label, .kpi.alert .k-foot { color: rgba(255,255,255,.85); }
.info-tip { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--greige-2); color: var(--gray); font-size: 11px; font-weight: 700; cursor: help; position: relative; }
.info-tip:hover::after, .info-tip:focus::after { content: attr(data-tip); position: absolute; left: 50%; bottom: 140%; transform: translateX(-50%); width: 260px; background: var(--black); color: var(--greige); padding: 10px 12px; border-radius: 10px; font-weight: 400; font-size: 12.5px; line-height: 1.45; z-index: 30; box-shadow: var(--shadow-lg); }
.dash-cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; margin-bottom: 16px; }
.chart { width: 100%; height: 260px; display: block; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--gray-2); }
.chart .bar { fill: var(--orange); transition: opacity .15s; }
.chart .bar.prev { fill: var(--greige-3); }
.chart .bar:hover { opacity: .8; }
.chart .grid { stroke: var(--greige-2); }
.chart .val { font-weight: 700; fill: var(--black); font-size: 11px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.legend span { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel .f-row { display: grid; grid-template-columns: 150px 1fr 48px; align-items: center; gap: 10px; font-size: 13px; }
.funnel .f-bar { height: 26px; background: var(--greige); border-radius: 7px; overflow: hidden; }
.funnel .f-bar i { display: block; height: 100%; background: var(--orange); border-radius: 7px; min-width: 3px; transition: width .4s; }
.funnel .f-row:nth-child(2) .f-bar i { background: #FD7A49; }
.funnel .f-row:nth-child(3) .f-bar i { background: var(--red); }
.funnel .f-row:nth-child(4) .f-bar i { background: var(--gray); }
.funnel .f-row:nth-child(5) .f-bar i { background: var(--green); }
.funnel b { text-align: right; font-family: var(--font-title); font-weight: 400; font-size: 16px; }
.rank { width: 100%; border-collapse: collapse; }
.rank td { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.rank tr:last-child td { border-bottom: 0; }
.rank .bar-cell { width: 40%; padding-left: 12px; }
.rank .mini { height: 6px; background: var(--greige); border-radius: 99px; overflow: hidden; }
.rank .mini i { display: block; height: 100%; background: var(--orange); border-radius: 99px; }

/* ---------------- Tabelas ---------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 11.5px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr { cursor: pointer; transition: background .12s; }
table.data tbody tr:hover { background: #FBFAF7; }
table.data tbody tr:last-child td { border-bottom: 0; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user b { display: block; font-weight: 600; }
.money { font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---------------- Atendimento / Kanban ---------------- */
.att-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.att-toolbar .input-group { width: 280px; }
.att-toolbar select.input { width: auto; min-width: 150px; }
.kanban { display: grid; grid-template-columns: repeat(3, minmax(290px, 1fr)); gap: 16px; align-items: start; }
.column { background: var(--greige-2); border-radius: 16px; padding: 12px; min-height: 60vh; display: flex; flex-direction: column; gap: 10px; transition: background .15s, box-shadow .15s; }
.column.drop { background: var(--orange-50); box-shadow: inset 0 0 0 2px var(--orange); }
.column-h { display: flex; align-items: center; gap: 9px; padding: 4px 6px 6px; }
.column-h h3 { font-family: var(--font); font-weight: 700; font-size: 14px; }
.column-h .n { margin-left: auto; background: #fff; border-radius: 99px; padding: 1px 9px; font-weight: 700; font-size: 12.5px; color: var(--gray); }
.column-h .icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.column-h .icon svg { width: 16px; height: 16px; }
.col-auto .column-h .icon { background: var(--orange); color: #fff; }
.col-human .column-h .icon { background: var(--black); color: var(--greige); }
.col-done .column-h .icon { background: var(--green); color: #fff; }
.column .col-empty { text-align: center; color: var(--gray-3); padding: 30px 10px; font-size: 13px; border: 2px dashed var(--greige-3); border-radius: 12px; }

.tcard {
  background: #fff; border-radius: 12px; padding: 12px 13px; box-shadow: var(--shadow-sm); border: 1px solid var(--line);
  cursor: pointer; display: flex; flex-direction: column; gap: 7px; position: relative; transition: box-shadow .15s, transform .1s;
}
.tcard:hover { box-shadow: var(--shadow); }
.tcard.dragging { opacity: .5; transform: rotate(1.5deg); }
.tcard.active { box-shadow: 0 0 0 2px var(--orange), var(--shadow); }
.tcard .t-top { display: flex; align-items: center; gap: 9px; }
.tcard .t-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.tcard .t-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tcard .t-msg { color: var(--gray); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tcard .t-msg .from { font-weight: 600; color: var(--gray-2); }
.tcard .t-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tcard .unread { margin-left: auto; min-width: 21px; height: 21px; border-radius: 99px; background: var(--orange); color: #fff; font-weight: 700; font-size: 11.5px; display: grid; place-items: center; padding: 0 6px; }
.tcard.needs { border: 2px solid var(--red); box-shadow: 0 0 0 4px rgba(217,37,29,.12), var(--shadow-sm); animation: needsPulse 2s ease-in-out infinite; }
.tcard.needs::before { content: 'AGUARDANDO ATENDENTE'; position: absolute; top: -10px; left: 12px; background: var(--red); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: 1px; padding: 2px 8px; border-radius: 6px; }
.tcard.needs { margin-top: 6px; }
@keyframes needsPulse { 50% { box-shadow: 0 0 0 7px rgba(217,37,29,.07), var(--shadow-sm); } }
.tcard .t-reason { font-size: 12px; color: var(--red); font-weight: 600; background: var(--red-50); padding: 6px 8px; border-radius: 8px; }
.tcard .move { display: none; }

/* Lista (visão alternativa) */
.list-view .tcard { flex-direction: row; align-items: center; }

/* ---------------- Painel de conversa ---------------- */
.drawer-bg { position: fixed; inset: 0; background: rgba(34,30,27,.35); z-index: 40; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(1080px, 96vw); background: var(--greige); z-index: 41;
  display: grid; grid-template-columns: 1fr 330px; grid-template-rows: auto auto 1fr; box-shadow: var(--shadow-lg);
  animation: slideIn .22s ease-out;
}
.drawer.narrow { width: min(720px, 96vw); grid-template-columns: 1fr; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
.conv-head { grid-column: 1 / -1; background: #fff; padding: 14px 18px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.conv-head .who { min-width: 0; flex: 1; }
.conv-head .who h2 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-head .who .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.conv-head .acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.handoff-banner { grid-column: 1 / -1; background: var(--red); color: #fff; padding: 14px 18px; display: flex; gap: 14px; align-items: flex-start; }
.handoff-banner svg { width: 26px; height: 26px; flex: none; margin-top: 2px; }
.handoff-banner .txt { flex: 1; min-width: 0; }
.handoff-banner b.title { display: block; font-size: 15px; letter-spacing: .3px; }
.handoff-banner p { margin: 4px 0 0; font-size: 13.5px; opacity: .95; }
.handoff-banner .btn { background: #fff; color: var(--red); border-color: #fff; height: 42px; }
.conv-body { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); grid-column: 1; }
.messages { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 8px;
  background: radial-gradient(circle at 1px 1px, rgba(34,30,27,.05) 1px, transparent 0) 0 0 / 18px 18px, var(--greige); }
.msg { max-width: 76%; padding: 9px 12px 7px; border-radius: 14px; box-shadow: var(--shadow-sm); position: relative; word-wrap: break-word; font-size: 14px; }
.msg .m-body { white-space: pre-wrap; }
.msg .m-meta { display: flex; gap: 6px; justify-content: flex-end; align-items: center; font-size: 11px; color: var(--muted); margin-top: 4px; }
.msg .m-meta svg { width: 15px; height: 15px; }
.msg .m-who { font-size: 11px; font-weight: 700; letter-spacing: .4px; margin-bottom: 3px; display: flex; align-items: center; gap: 5px; }
.msg.in { align-self: flex-start; background: #fff; border-top-left-radius: 4px; }
.msg.ai { align-self: flex-end; background: var(--orange-50); border: 1px solid var(--orange-100); border-top-right-radius: 4px; }
.msg.ai .m-who { color: var(--orange-600); }
.msg.user { align-self: flex-end; background: var(--black); color: var(--greige); border-top-right-radius: 4px; }
.msg.user .m-who { color: var(--orange); }
.msg.user .m-meta { color: #A79F95; }
.msg.system { align-self: flex-end; background: var(--greige-2); }
.msg.failed { box-shadow: 0 0 0 2px var(--red); }
.msg .m-err { font-size: 12px; color: var(--red); font-weight: 600; margin-top: 4px; }
.msg.user .m-err { color: #FF9C94; }
.read { color: #3B9AE1; }
.event-line { align-self: center; font-size: 12px; color: var(--gray); background: rgba(255,255,255,.75); padding: 5px 12px; border-radius: 99px; display: inline-flex; gap: 6px; align-items: center; margin: 6px 0; text-align: center; }
.event-line.red { background: var(--red-50); color: var(--red); font-weight: 600; }
.event-line svg { width: 14px; height: 14px; flex: none; }
.day-sep { align-self: center; font-size: 11.5px; font-weight: 700; color: var(--gray-2); background: #fff; padding: 3px 12px; border-radius: 8px; margin: 8px 0; text-transform: uppercase; letter-spacing: .6px; }
.composer { background: #fff; border-top: 1px solid var(--line); padding: 12px 14px; }
.composer .row { align-items: flex-end; }
.composer textarea { flex: 1; min-height: 44px; max-height: 160px; resize: none; border-radius: 12px; }
.composer .note { font-size: 12px; color: var(--muted); margin-top: 7px; display: flex; gap: 6px; align-items: center; }
.composer .note.warn { color: var(--amber); font-weight: 600; }
.composer .note svg { width: 14px; height: 14px; }
.composer.locked { text-align: center; color: var(--muted); padding: 18px; }
.conv-side { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; grid-column: 2; grid-row: 3; }
.side-card { background: #fff; border-radius: 12px; padding: 14px; border: 1px solid var(--line); }
.side-card h4 { font-family: var(--font); font-weight: 700; font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.side-card.ai-summary { background: var(--orange-50); border-color: var(--orange-100); }
.side-card.ai-summary h4 { color: var(--orange-600); }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline li { display: grid; grid-template-columns: 10px 1fr; gap: 10px; font-size: 12.5px; }
.timeline li i { width: 10px; height: 10px; border-radius: 50%; background: var(--greige-3); margin-top: 4px; }
.timeline li.handoff i { background: var(--red); }
.timeline li.assumed i { background: var(--black); }
.timeline li.returned_ai i, .timeline li.opened i { background: var(--orange); }
.timeline li.concluded i { background: var(--green); }
.timeline li small { color: var(--muted); display: block; }

/* ---------------- Modal ---------------- */
.modal-bg { position: fixed; inset: 0; background: rgba(34,30,27,.5); z-index: 60; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
.modal.wide { width: min(820px, 100%); }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal-h { padding: 22px 24px 4px; display: flex; gap: 12px; align-items: flex-start; }
.modal-h h2 { font-size: 22px; flex: 1; }
.modal-b { padding: 14px 24px 8px; }
.modal-f { padding: 14px 24px 22px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.choice { border: 2px solid var(--greige-2); border-radius: 14px; padding: 16px 12px; text-align: center; cursor: pointer; background: #fff; transition: border-color .15s, background .15s; display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 700; }
.choice svg { width: 28px; height: 28px; }
.choice small { font-weight: 400; color: var(--muted); font-size: 12px; }
.choice:hover { border-color: var(--greige-3); }
.choice.on.sale { border-color: var(--green); background: var(--green-50); color: var(--green); }
.choice.on.nosale { border-color: var(--red); background: var(--red-50); color: var(--red); }
.choice.on.na { border-color: var(--gray); background: var(--greige); }
.ai-hint { background: var(--orange-50); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--orange-600); display: flex; gap: 8px; }
.ai-hint svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }

/* ---------------- Toasts ---------------- */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { background: var(--black); color: var(--greige); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); max-width: 380px; font-weight: 500; display: flex; gap: 10px; align-items: center; animation: toastIn .25s ease-out; }
.toast.error { background: var(--red); color: #fff; }
.toast.ok svg { color: #6FD39A; }
.toast svg { width: 18px; height: 18px; flex: none; }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } }

/* ---------------- Login ---------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--black); }
.auth .art { position: relative; overflow: hidden; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; color: var(--greige); }
.auth .art::after { content: ''; position: absolute; right: -120px; bottom: -120px; width: 520px; height: 520px; background: url('../img/icon.svg') no-repeat center / contain; opacity: .14; transform: rotate(-10deg); }
.auth .art img { height: 34px; width: auto; align-self: flex-start; }
.auth .art h2 { font-size: 44px; max-width: 480px; }
.auth .art h2 em { font-style: normal; color: var(--orange); }
.auth .art p { color: #BDB5AA; max-width: 420px; font-size: 15px; }
.auth .chevrons { display: flex; gap: 10px; }
.auth .chevrons i { width: 24px; height: 46px; background: var(--orange); clip-path: polygon(0 0, 55% 0, 100% 50%, 55% 100%, 0 100%, 45% 50%); }
.auth .chevrons i:nth-child(2) { opacity: .6; } .auth .chevrons i:nth-child(3) { opacity: .3; }
.auth .panel { background: var(--greige); display: grid; place-items: center; padding: 32px; border-radius: 28px 0 0 28px; }
.auth form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 16px; }
.auth form h1 { font-size: 30px; }
.auth .err { background: var(--red-50); color: var(--red); padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 13px; }

/* ---------------- Treinamento ---------------- */
.ready { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 20px; }
.ready .r-item { background: #fff; border-radius: 12px; border: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.ready .r-item b { font-size: 13px; line-height: 1.3; }
.ready .r-item .st { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.ready .r-item .st svg { width: 14px; height: 14px; }
.ready .ok .st { background: var(--green-50); color: var(--green); }
.ready .no .st { background: var(--amber-50); color: var(--amber); }
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.kb-card { background: #fff; border-radius: 14px; border: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 9px; cursor: pointer; transition: box-shadow .15s; }
.kb-card:hover { box-shadow: var(--shadow); }
.kb-card.off { opacity: .62; }
.kb-card.todo { border: 2px dashed var(--amber); }
.kb-card h4 { font-family: var(--font); font-weight: 700; font-size: 15px; }
.kb-card p { margin: 0; color: var(--gray); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rules { display: flex; flex-direction: column; gap: 10px; }
.rule { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.rule .num { width: 28px; height: 28px; border-radius: 8px; background: var(--red-50); color: var(--red); font-weight: 800; display: grid; place-items: center; flex: none; }
.rule.off { opacity: .55; }
.rule .txt { flex: 1; }
.rule .txt[contenteditable="true"] { outline: none; border-bottom: 2px solid var(--orange); }
.sandbox { display: grid; grid-template-columns: 1fr 360px; gap: 16px; min-height: 560px; }
.sandbox .chatbox { display: flex; flex-direction: column; overflow: hidden; }
.sandbox .messages { min-height: 380px; max-height: 60vh; border-radius: var(--radius) var(--radius) 0 0; }
.inspector .decision { border-radius: 12px; padding: 12px 14px; font-weight: 700; display: flex; gap: 10px; align-items: center; }
.inspector .decision.reply { background: var(--green-50); color: var(--green); }
.inspector .decision.handoff { background: var(--red-50); color: var(--red); }
.inspector .decision svg { width: 20px; height: 20px; }
.src { font-size: 12.5px; padding: 8px 10px; background: var(--greige); border-radius: 8px; }
.src.used { background: var(--orange-50); box-shadow: inset 3px 0 0 var(--orange); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 14px; background: #fff; border-top: 1px solid var(--line); }
.quick button { border: 1px solid var(--greige-3); background: #fff; border-radius: 99px; padding: 5px 11px; font-size: 12.5px; cursor: pointer; }
.quick button:hover { border-color: var(--orange); color: var(--orange-600); }
.typing { align-self: flex-end; display: flex; gap: 4px; padding: 12px 14px; background: var(--orange-50); border-radius: 14px; }
.typing i { width: 7px; height: 7px; background: var(--orange); border-radius: 50%; animation: typing 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 50% { transform: translateY(-4px); opacity: .5; } }

/* ---------------- Configurações ---------------- */
.settings-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 10px; font-weight: 700; font-size: 13px; }
.status-pill.ok { background: var(--green-50); color: var(--green); }
.status-pill.pending { background: var(--amber-50); color: var(--amber); }
.status-pill.err { background: var(--red-50); color: var(--red); }
.status-pill .dot { background: currentColor; }
.copy { display: flex; gap: 8px; }
.copy .input { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; background: var(--greige); }
.steps { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; color: var(--gray); }
.steps b { color: var(--black); }
.log-item { display: grid; grid-template-columns: 74px 90px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.log-item .lvl { font-weight: 700; text-transform: uppercase; font-size: 11px; }
.log-item .lvl.error { color: var(--red); } .log-item .lvl.warning { color: var(--amber); } .log-item .lvl.info { color: var(--green); }
.func-table td:first-child { font-weight: 600; }

/* ---------------- Responsivo ---------------- */
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .ready { grid-template-columns: repeat(3, 1fr); }
  .drawer { grid-template-columns: 1fr; }
  .conv-side { display: none; }
  .drawer.show-side .conv-side { display: flex; grid-column: 1; grid-row: 3; }
  .drawer.show-side .conv-body { display: none; }
}
@media (max-width: 1080px) {
  .hero, .dash-cols, .settings-grid, .sandbox { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(3, 86vw); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 10px; }
  .column { scroll-snap-align: start; }
}
@media (max-width: 860px) {
  :root { --sidebar: 0px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; width: 270px; transform: translateX(-100%); transition: transform .22s; box-shadow: var(--shadow-lg); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(34,30,27,.4); z-index: 45; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 21px; }
  .topbar .sub { display: none; }
  .content { padding: 4px 16px 40px; }
  .alert-bar { margin: 0 16px 10px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; min-height: 0; }
  .kpi .k-value { font-size: 26px; }
  .main-kpi .k-value { font-size: 40px; }
  .ready { grid-template-columns: 1fr 1fr; }
  .att-toolbar .input-group { width: 100%; }
  .att-toolbar select.input { flex: 1; min-width: 0; }
  .att-toolbar .segmented { margin-left: 0 !important; }
  .alert-bar { padding: 10px 12px; font-size: 13px; }
  .alert-bar .btn { height: 31px; padding: 0 10px; font-size: 12.5px; }
  .drawer, .drawer.narrow { width: 100vw; }
  .conv-head { flex-wrap: wrap; }
  .conv-head .acts { width: 100%; justify-content: flex-start; }
  .msg { max-width: 88%; }
  .choice-grid { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth .art { display: none; }
  .auth .panel { border-radius: 0; }
  .funnel .f-row { grid-template-columns: 110px 1fr 40px; }
  .tcard .move { display: flex; }
  .hide-sm { display: none !important; }
  .log-item { grid-template-columns: 64px 1fr; }
  .log-item .src-col { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
