/* Layout: trilho de navegação + lista de conversas + conversa + ficha do lead.
   Mesma identidade do site parceirocury.com.br: azul-marinho, azul vibrante, Space Grotesk + Inter. Escuro por padrão. */
:root {
  --bg: #0B1530;
  --surface: #0F1B3A;
  --surface-2: #17264B;
  --line: #22325E;
  --line-strong: #2E4072;
  --fg: #F2F5FF;
  --muted: #A9B4D3;
  --faint: #7482A8;
  --accent: #2F6FFF;
  --accent-ink: #ffffff;
  --accent-soft: #1A3170;
  --bubble-in: #FFFFFF;
  --bubble-out: #D9FDD3;
  --bubble-fg: #111B21;
  --bubble-meta: #667781;
  --bubble-author: #1F7A4D;
  --bubble-link: #027EB5;
  --note: #3A3420;
  --note-line: #6B5A22;
  --chat-bg: #081127;
  --danger: #FF6B6B;
  --danger-soft: #4A2234;
  --warn: #F5B544;
  --ok: #3DD68C;
  --ad-bg: #3A3221;
  --ad-line: #6B5726;
  --ad-fg: #F5C46A;
  --tick-read: #53BDEB;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
  --font-ui: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Space Grotesk", "Inter", "Segoe UI", system-ui, sans-serif;
  --font-num: "Space Grotesk", "Inter", system-ui, sans-serif;
  --r: 10px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #EEF2FA; --surface: #FFFFFF; --surface-2: #F4F6FC; --line: #DCE2F0; --line-strong: #C9D2E8;
  --fg: #121A33; --muted: #56617F; --faint: #8590AE;
  --accent: #2F6FFF; --accent-ink: #ffffff; --accent-soft: #E3ECFF;
  --bubble-in: #FFFFFF; --bubble-out: #D9FDD3; --bubble-fg: #111B21; --bubble-meta: #667781; --bubble-author: #1F7A4D; --bubble-link: #027EB5;
  --note: #FFF6D9; --note-line: #EDD58A; --chat-bg: #E9EEF8;
  --danger: #D23B47; --danger-soft: #FBE9EB; --warn: #B7791F; --ok: #1B8A5A;
  --ad-bg: #FFF4E0; --ad-line: #F3D49A; --ad-fg: #8A5A0B; --tick-read: #53BDEB;
  --shadow: 0 1px 2px rgba(18, 26, 51, .06), 0 6px 18px rgba(18, 26, 51, .08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--font-ui); -webkit-font-smoothing: antialiased; }
h1, h2, h3, .brand, .kpi .value, .page-head h1, .list-title h1 { font-family: var(--font-display); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- botões e campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: 13px; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 8px; border: 0; background: transparent; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }
.icon-btn svg, .btn svg, .rail-btn svg { width: 18px; height: 18px; flex: none; }
.field { display: grid; gap: 6px; }
.field label, .label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.input, select.input, textarea.input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); outline: none; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding-block: 24px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; box-shadow: var(--shadow); display: grid; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.brand-mark svg { width: 20px; height: 20px; }
.login-card p { margin: 0; color: var(--muted); }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ---------- casca do app ---------- */
.app { height: 100%; display: grid; grid-template-columns: 64px 1fr; }
.rail { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 0; }
.rail .brand-mark { margin-bottom: 12px; }
.rail-btn { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; border: 0; background: transparent; color: var(--muted); }
.rail-btn:hover { background: var(--surface-2); color: var(--fg); }
.rail-btn.active { background: var(--accent-soft); color: var(--accent); }
.rail-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.rail-spacer { flex: 1; }
.rail-btn .tip { position: absolute; left: 52px; white-space: nowrap; background: var(--fg); color: var(--surface); font-size: 12px; padding: 4px 8px; border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 30; }
.rail-btn:hover .tip { opacity: 1; }
.avatar { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; overflow: hidden; background: var(--faint); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.view { min-width: 0; min-height: 0; overflow: hidden; }

/* ---------- conversas ---------- */
.inbox { height: 100%; display: grid; grid-template-columns: 340px minmax(0, 1fr) 300px; }
.inbox.no-detail { grid-template-columns: 340px minmax(0, 1fr); }
.list-pane { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.list-head { padding: 14px 14px 10px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.list-title { display: flex; align-items: center; justify-content: space-between; }
.list-title h1 { font-size: 18px; margin: 0; letter-spacing: -.01em; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.search .input { padding-left: 34px; background: var(--surface-2); border-color: transparent; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tab { flex: none; height: 30px; padding: 0 11px; border-radius: 15px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.tab.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tab .count { font-family: var(--font-num); font-size: 11px; opacity: .8; }
.filters { display: flex; gap: 6px; }
.filters select { height: 30px; font-size: 12px; padding: 0 8px; flex: 1; min-width: 0; }
.chat-list { flex: 1; overflow-y: auto; min-height: 0; }
.chat-item { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: center; }
.chat-item:hover { background: var(--surface-2); }
.chat-item.active { background: var(--accent-soft); }
.chat-item .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .preview { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .meta { display: grid; justify-items: end; gap: 4px; align-self: start; padding-top: 2px; }
.chat-item .time { font-size: 11px; color: var(--faint); }
.chat-item.unread .time { color: var(--accent); font-weight: 700; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; display: grid; place-items: center; font-family: var(--font-num); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.chip .sw { width: 7px; height: 7px; border-radius: 50%; }
.chip.ad { background: var(--ad-bg); border-color: var(--ad-line); color: var(--ad-fg); }
.chip.queue { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.empty { padding: 40px 24px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.empty svg { width: 40px; height: 40px; color: var(--faint); }
.empty strong { color: var(--fg); }

.chat-pane { display: flex; flex-direction: column; min-height: 0; background: var(--chat-bg); }
.chat-head { background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 14px; display: flex; align-items: center; gap: 10px; min-height: 60px; }
.chat-head .who { min-width: 0; flex: 1; }
.chat-head .who strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .who span { color: var(--muted); font-size: 12px; }
.chat-head .actions { display: flex; align-items: center; gap: 6px; }
.chat-head select { height: 32px; font-size: 12px; width: auto; max-width: 170px; }
.back-btn { display: none; }
.messages { flex: 1; overflow-y: auto; padding: 16px clamp(12px, 3vw, 40px); display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.day { align-self: center; margin: 10px 0 6px; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 3px 10px; border-radius: 12px; }
.msg { max-width: min(560px, 78%); padding: 7px 10px 5px; border-radius: 10px; background: var(--bubble-in); box-shadow: 0 1px 1px rgba(0,0,0,.05); position: relative; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.out { align-self: flex-end; background: var(--bubble-out); }
.msg { color: var(--bubble-fg); }
.msg .foot, .msg .ticks { color: var(--bubble-meta); }
.msg .author { color: var(--bubble-author); }
.msg a { color: var(--bubble-link); }
.msg .doc { background: rgba(0, 0, 0, .05); }
.msg .doc svg { color: var(--bubble-author); }
.msg.deleted .body { color: var(--bubble-meta); }
.msg.note { color: var(--fg); }
.msg.in { align-self: flex-start; }
.msg .body { white-space: pre-wrap; }
.msg .foot { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: 10.5px; color: var(--faint); margin-top: 2px; }
.msg .author { font-size: 11px; font-weight: 700; color: var(--bubble-author); margin-bottom: 2px; }
.msg .ticks svg { width: 15px; height: 15px; }
.msg .ticks.read { color: var(--tick-read); }
.msg.deleted .body { font-style: italic; color: var(--faint); }
.msg img.media, .msg video.media { display: block; max-width: 100%; max-height: 320px; border-radius: 6px; margin-bottom: 4px; background: var(--surface-2); }
.msg audio { width: 260px; max-width: 100%; }
.msg .doc { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 6px; background: var(--surface-2); text-decoration: none; color: inherit; margin-bottom: 4px; }
.msg .doc svg { width: 22px; height: 22px; color: var(--accent); }
.msg.note { align-self: center; max-width: min(560px, 90%); background: var(--note); border: 1px dashed var(--note-line); box-shadow: none; }
.msg.note .author { color: var(--warn); }
.sys { align-self: center; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 3px 10px; border-radius: 12px; margin: 4px 0; text-align: center; }
.composer { background: var(--surface); border-top: 1px solid var(--line); padding: 10px 12px; display: grid; gap: 8px; position: relative; }
.composer.note-mode { background: var(--note); }
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 20px; padding: 9px 14px; max-height: 140px; min-height: 40px; background: var(--surface-2); outline: none; line-height: 1.4; }
.composer textarea:focus { border-color: var(--accent); }
.send-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.send-btn svg { width: 18px; height: 18px; }
.mode-switch { display: flex; gap: 4px; }
.mode-switch button { height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--line); background: transparent; font-size: 12px; font-weight: 600; color: var(--muted); }
.mode-switch button.active { background: var(--fg); color: var(--surface); border-color: var(--fg); }
.qr-pop { position: absolute; left: 12px; right: 12px; bottom: calc(100% - 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 240px; overflow-y: auto; z-index: 10; }
.qr-pop button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.qr-pop button:hover, .qr-pop button.sel { background: var(--accent-soft); }
.qr-pop b { color: var(--accent); margin-right: 6px; font-family: var(--font-num); }
.qr-pop span { color: var(--muted); font-size: 12px; }
.attach-preview { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.chat-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 24px; }
.chat-empty .big { width: 72px; height: 72px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin: 0 auto 14px; }
.chat-empty .big svg { width: 34px; height: 34px; }
.queue-bar .btn { white-space: nowrap; }
.queue-bar { background: var(--accent-soft); color: var(--accent); padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 600; font-size: 13px; }

.detail-pane { background: var(--surface); border-left: 1px solid var(--line); overflow-y: auto; min-height: 0; }
.detail-top { padding: 22px 18px 16px; display: grid; justify-items: center; gap: 6px; text-align: center; border-bottom: 1px solid var(--line); }
.detail-top h2 { font-size: 16px; margin: 6px 0 0; }
.detail-top .phone { color: var(--muted); font-size: 13px; }
.detail-sec { padding: 14px 18px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.ad-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; gap: 3px; background: var(--surface-2); }
.ad-card strong { font-size: 13px; }
.ad-card span { font-size: 12px; color: var(--muted); }
.ad-card a { font-size: 12px; color: var(--accent); word-break: break-all; }
.stage-steps { display: grid; gap: 4px; }
.stage-step { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: 6px; border: 1px solid transparent; background: transparent; text-align: left; color: var(--muted); font-weight: 600; font-size: 13px; }
.stage-step .pin { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.stage-step.done .pin { background: var(--accent); border-color: var(--accent); }
.stage-step.current { background: var(--accent-soft); color: var(--accent); }
.stage-step.current .pin { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.stage-step.lost.current { background: var(--danger-soft); color: var(--danger); }
.stage-step.lost.current .pin { background: var(--danger); border-color: var(--danger); box-shadow: none; }
.stage-step:hover { border-color: var(--line); }
.tag-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pick button { height: 26px; padding: 0 9px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.tag-pick button .sw { width: 8px; height: 8px; border-radius: 50%; }
.tag-pick button.on { color: var(--fg); border-color: currentColor; background: var(--surface-2); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }

/* ---------- funil ---------- */
.page { height: 100%; overflow-y: auto; padding-block: 20px 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font-size: 22px; margin: 0; letter-spacing: -.02em; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 140px); min-height: 120px; }
.col-head { padding: 12px 12px 8px; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; }
.col-head .pin { width: 9px; height: 9px; border-radius: 50%; }
.col-head .n { margin-left: auto; color: var(--muted); font-family: var(--font-num); font-size: 12px; }
.col-body { padding: 0 8px 8px; display: grid; gap: 8px; overflow-y: auto; align-content: start; min-height: 60px; }
.col.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 6px; cursor: grab; }
.card:hover { border-color: var(--faint); }
.card.dragging { opacity: .5; }
.card-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.card-top strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.card .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-foot { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--faint); gap: 6px; }

/* ---------- painel ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 2px; }
.kpi .label { margin-bottom: 4px; }
.kpi .value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-family: var(--font-num); }
.kpi .hint { font-size: 12px; color: var(--muted); }
.kpi.alert .value { color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.panel.wide { grid-column: 1 / -1; }
table.t td:first-child { white-space: nowrap; }
.panel h2 { font-size: 14px; margin: 0 0 12px; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 140px) 1fr 44px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 5px; }
.bar-row .v { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: auto; display: block; }
.spark text { fill: var(--faint); font: 10px var(--font-num); }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t td.n { font-family: var(--font-num); font-variant-numeric: tabular-nums; text-align: right; }
table.t th.n { text-align: right; }

/* ---------- configurações ---------- */
.settings { display: grid; gap: 14px; max-width: 880px; }
.settings .panel.wide { grid-column: 1 / -1; }
table.t td:first-child { white-space: nowrap; }
.panel h2 { font-size: 15px; }
.settings .panel > p { color: var(--muted); margin: -6px 0 14px; }
.wa-box { display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: center; }
.qr-frame { width: 240px; height: 240px; border-radius: 12px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; overflow: hidden; }
.qr-frame img { width: 100%; height: 100%; object-fit: contain; }
.qr-frame .ph { color: #6b7a74; font-size: 13px; text-align: center; padding: 16px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.status-pill .d { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.status-pill.open { background: var(--accent-soft); color: var(--ok); }
.status-pill.open .d { background: var(--ok); }
.status-pill.connecting { color: var(--warn); }
.status-pill.connecting .d { background: var(--warn); }
.status-pill.close .d, .status-pill.offline .d { background: var(--danger); }
.steps { margin: 0; padding-left: 18px; color: var(--muted); display: grid; gap: 4px; }
.pairing { font-family: var(--font-num); font-size: 26px; letter-spacing: .2em; font-weight: 700; color: var(--fg); }
.row-list { display: grid; }
.row-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row-item:last-child { border-bottom: 0; }
.row-item .grow { flex: 1; min-width: 0; }
.row-item .grow small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.inline-form .input { flex: 1; min-width: 140px; }
.inline-form input[type=color] { width: 44px; padding: 3px; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { width: 40px; height: 22px; appearance: none; background: var(--line); border-radius: 11px; position: relative; cursor: pointer; transition: background .15s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }
.pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.pill.admin { background: var(--accent-soft); color: var(--accent); }
.pill.off { color: var(--danger); }

/* ---------- modal e aviso ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 20, 16, .45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { width: min(440px, 100%); background: var(--surface); border-radius: 14px; padding: 22px; display: grid; gap: 14px; box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto; }
.modal h3 { margin: 0; font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--surface); padding: 10px 16px; border-radius: 8px; font-weight: 600; font-size: 13px; z-index: 60; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.toast.err { background: var(--danger); color: #fff; }
.demo-banner { position: fixed; right: max(12px, env(safe-area-inset-right, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 4px; font-size: 12px; color: var(--muted); z-index: 40; box-shadow: var(--shadow); display: flex; align-items: center; gap: 4px; }
.demo-banner span { padding: 0 6px 0 8px; font-weight: 600; white-space: nowrap; }
.demo-banner button { height: 28px; padding: 0 12px; border-radius: 14px; border: 0; background: transparent; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.demo-banner button.active { background: var(--accent); color: var(--accent-ink); }
.wa-warn { background: var(--danger-soft); color: var(--danger); padding: 8px 14px; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- telas menores ---------- */
@media (max-width: 1180px) {
  .inbox { grid-template-columns: 300px minmax(0, 1fr); }
  .inbox .detail-pane { position: fixed; top: 0; right: 0; bottom: 0; width: min(340px, 100%); z-index: 40; box-shadow: var(--shadow); padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .inbox:not(.show-detail) .detail-pane { display: none; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .rail { grid-row: 2; flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); padding: 4px max(8px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
  .rail .brand-mark, .rail-spacer, .rail-btn .tip { display: none; }
  .view { grid-row: 1; }
  .inbox, .inbox.no-detail { grid-template-columns: minmax(0, 1fr); }
  .queue-bar { flex-wrap: wrap; }
  .inbox.has-chat .list-pane { display: none; }
  .inbox:not(.has-chat) .chat-pane { display: none; }
  .back-btn { display: inline-grid; }
  .chat-head { flex-wrap: wrap; row-gap: 8px; }
  .chat-head .actions { order: 3; width: 100%; }
  .chat-head .actions select { flex: 1; max-width: none; min-width: 0; }
  .msg { max-width: 88%; }
  .wa-box { grid-template-columns: 1fr; justify-items: center; }
  .bar-row { grid-template-columns: 90px 1fr 36px; }
  .col { max-height: none; }
  .demo-banner { left: 50%; right: auto; transform: translateX(-50%); bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }
  .app:has(.inbox.has-chat) + .demo-banner, .app:has(.show-detail) + .demo-banner { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.demo-chip { font-size: 11px; font-weight: 700; color: var(--warn); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 1px 8px; margin-left: 8px; vertical-align: middle; }
.funnel-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.funnel-filters .input { height: 34px; width: 220px; max-width: 100%; }

.out-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.out-btn { height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.out-btn svg { width: 16px; height: 16px; }
.out-btn:hover { background: var(--surface-2); color: var(--fg); }
.out-btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.out-btn.on.lost { background: var(--danger); border-color: var(--danger); color: #fff; }
.detail-sec .hint { font-size: 12px; color: var(--faint); }
.queue-bar.out { background: var(--surface-2); color: var(--muted); border-bottom: 1px solid var(--line); }
.arc-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.arc-row:last-child { border-bottom: 0; }
.arc-row .grow { flex: 1; min-width: 180px; }
.arc-row .grow small { display: block; color: var(--muted); font-size: 12px; }
.arc-actions { display: flex; gap: 6px; }

.wp-wrap { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }
.wp-card { background: #FFFFFF; color: #111B21; border-radius: 16px; padding: 28px 16px 24px; box-shadow: var(--shadow); text-align: center; max-width: 340px; }
.wp-photo { position: relative; width: 112px; height: 112px; border-radius: 50%; margin: 0 auto 12px; background: #DFE5E7; color: #54656F; display: grid; place-items: center; font: 700 34px var(--font-display); overflow: hidden; }
.wp-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.wp-name { font: 600 20px var(--font-ui); padding: 0 16px; }
.wp-num { color: #667781; font-size: 15px; margin-top: 2px; }
.wp-biz { display: inline-block; margin-top: 8px; font-size: 12px; color: #008069; font-weight: 600; }
.wp-rows { margin-top: 16px; text-align: left; border-top: 8px solid #F0F2F5; }
.wp-row { padding: 12px 20px; border-bottom: 1px solid #E9EDEF; display: grid; gap: 2px; }
.wp-row:last-child { border-bottom: 0; }
.wp-row span { font-size: 12px; color: #667781; }
.wp-row p { margin: 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.wp-row a { color: #027EB5; font-size: 14px; overflow-wrap: anywhere; }
.wp-side { display: grid; gap: 10px; }
.wp-tip { margin: 0; color: var(--muted); font-size: 13px; }
.wp-tip.warn { color: var(--warn); font-weight: 600; }
.wp-tip.ok { color: var(--ok); font-weight: 600; }
@media (max-width: 760px) { .wp-wrap { grid-template-columns: 1fr; } }

.q-auto { align-items: flex-start; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.q-auto span { display: grid; gap: 2px; }
.q-auto small { color: var(--muted); font-size: 12.5px; }
.q-list { list-style: none; margin: 0; padding: 0; display: grid; }
.q-item { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); background: var(--surface); position: relative; }
.q-item:last-child { border-bottom: 0; }
.q-item.dragging { z-index: 5; box-shadow: var(--shadow); border-radius: 8px; border-color: transparent; }
.q-item.off .grow strong, .q-item.off .q-pos { color: var(--faint); }
.q-item .grow { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.q-grip { width: 32px; height: 36px; border: 0; background: transparent; color: var(--faint); display: grid; place-items: center; cursor: grab; touch-action: none; border-radius: 6px; flex: none; }
.q-grip:hover { color: var(--fg); background: var(--surface-2); }
.q-grip:active { cursor: grabbing; }
.q-grip svg { width: 18px; height: 18px; }
.q-pos { width: 30px; font-weight: 700; color: var(--accent); flex: none; }
.q-lbl { font-size: 12px; color: var(--muted); min-width: 56px; }
.q-foot { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.q-item .pill { white-space: nowrap; }
.q-foot { padding-top: 4px; position: relative; }
@media (max-width: 760px) { .q-lbl { display: none; } .q-item { gap: 8px; } }

.q-reassign { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; flex-wrap: wrap; }
.q-reassign .switch { flex: 1; min-width: 220px; align-items: flex-start; }
.q-reassign .switch span { display: grid; gap: 2px; }
.q-reassign small { color: var(--muted); font-size: 12.5px; }
.q-reassign select { width: auto; height: 34px; }
.q-reassign.disabled { opacity: .5; }
