/* DiPlantão — identidade: noite violeta + dourado de Vênus (a IA) */
:root {
  --night: #17122b; --night-2: #221a3e; --night-3: #2e2552; --night-text: #b9b2d6;
  --violet: #6a4bff; --violet-2: #5638e8; --violet-soft: #efebff;
  --amber: #f3b23a; --amber-2: #d9940f; --amber-soft: #fff5e0;
  --paper: #f3f4f8; --surface: #ffffff; --surface-2: #f8f8fb;
  --ink: #1b1931; --ink-2: #4a4766; --muted: #7d7a96; --line: #e4e3ee;
  --green: #12a877; --green-soft: #e3f7ef; --red: #e5484d; --red-soft: #fdecec; --blue: #2f80ed; --blue-soft: #e8f1fd;
  --r-lg: 18px; --r: 12px; --r-sm: 8px;
  --shadow: 0 1px 2px rgba(23,18,43,.06), 0 8px 24px -12px rgba(23,18,43,.18);
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Bricolage Grotesque', 'Figtree', system-ui, sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --paper: #0f0c1c; --surface: #19152c; --surface-2: #1f1a36; --ink: #ecebf6; --ink-2: #c4c0dc; --muted: #8e89aa; --line: #2c2647;
  --violet-soft: #2a2152; --amber-soft: #33270f; --green-soft: #0e2c22; --red-soft: #3a1518; --blue-soft: #102640;
  --night: #0b0915; --night-2: #151127; --night-3: #221b3d;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.5 var(--font); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: var(--violet); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.02em; margin: 0; line-height: 1.15; }
h1 { font-size: 28px; font-weight: 700; } h2 { font-size: 20px; font-weight: 650; } h3 { font-size: 16px; font-weight: 650; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.hidden { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ===== 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 var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: #cfcde0; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--violet); border-color: var(--violet); color: #fff; }
.btn.primary:hover { background: var(--violet-2); }
.btn.ai { background: var(--amber-soft); border-color: #f1d48f; color: #7a5200; }
[data-theme="dark"] .btn.ai { color: var(--amber); border-color: #5b4513; }
.btn.danger { color: var(--red); } .btn.danger:hover { background: var(--red-soft); border-color: #f3b8ba; }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; } .btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 38px; padding: 0; } .btn.sm.icon { width: 32px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 12px; }
.input, .field input, .field select, .field textarea { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; }
.field textarea, textarea.input { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 3px color-mix(in srgb, var(--violet) 18%, transparent); }
.field input[type=color] { padding: 4px; width: 64px; }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--violet); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.chips-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-select label { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; cursor: pointer; font-size: 13px; }
.chips-select input { accent-color: var(--violet); }

/* Switch */
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfcde0; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--amber); }
.switch input:checked + span::after { transform: translateX(18px); }

/* ===== Badges ===== */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge.green { background: var(--green-soft); color: var(--green); border-color: transparent; }
.badge.red { background: var(--red-soft); color: var(--red); border-color: transparent; }
.badge.amber { background: var(--amber-soft); color: #946200; border-color: transparent; }
[data-theme="dark"] .badge.amber { color: var(--amber); }
.badge.violet { background: var(--violet-soft); color: var(--violet); border-color: transparent; }
.badge.blue { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* ===== Shell ===== */
.shell { display: grid; grid-template-columns: 240px 1fr; height: 100vh; height: 100dvh; }
.side { background: var(--night); color: var(--night-text); display: flex; flex-direction: column; padding: 18px 12px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; color: #fff; font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: -.02em; }
.planet { width: 30px; height: 30px; position: relative; flex: none; }
.planet::before { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe3a3, var(--amber) 45%, #b9670a); box-shadow: 0 0 14px rgba(243,178,58,.45); }
.planet::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid rgba(185,178,214,.45); transform: rotateX(68deg) rotateZ(-20deg); }
.brand small { display: block; font: 500 11px var(--font); color: var(--night-text); letter-spacing: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .group { font-size: 12px; color: #7e76a3; padding: 16px 12px 6px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 12px; border-radius: 10px; color: var(--night-text); font-weight: 500; font-size: 14px; position: relative; }
.nav a:hover { background: var(--night-2); color: #fff; }
.nav a.active { background: var(--night-3); color: #fff; }
.nav a.active::before { content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--amber); }
.nav a .count { margin-left: auto; min-width: 22px; height: 20px; border-radius: 99px; background: var(--violet); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }
.nav a .count.amber { background: var(--amber); color: #3b2600; }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--night-2); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; cursor: pointer; }
.me:hover { background: var(--night-2); }
.me b { color: #fff; font-size: 14px; display: block; line-height: 1.2; }
.me .tiny { color: #8a83ad; }
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; height: 100dvh; overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; min-height: 66px; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar h1 { font-size: 21px; }
.topbar .sp { flex: 1; }
.menu-btn { display: none; }
.content { flex: 1; overflow-y: auto; padding: 26px 28px 40px; }
.content.flush { padding: 0; overflow: hidden; }
.banner { display: flex; align-items: center; gap: 12px; padding: 10px 28px; font-size: 14px; font-weight: 500; background: var(--amber-soft); color: #7a5200; border-bottom: 1px solid #f1d48f; }
.banner.red { background: var(--red-soft); color: var(--red); border-color: #f3b8ba; }
[data-theme="dark"] .banner { color: var(--amber); border-color: #5b4513; }

/* ===== Cartões / tabelas ===== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.card + .card { margin-top: 16px; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-h .sp { flex: 1; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; }
.kpi .l { font-size: 13px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.kpi .v { font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: -.03em; margin-top: 6px; line-height: 1; }
.kpi .v small { font: 500 14px var(--font); color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 6px; }
.kpi.ai-kpi { background: linear-gradient(180deg, var(--amber-soft), var(--surface) 70%); border-color: #f1d48f; }
[data-theme="dark"] .kpi.ai-kpi { border-color: #5b4513; }
.cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
.cols > .card + .card { margin-top: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
table.t td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr:hover td { background: var(--surface-2); }
table.t td.actions { text-align: right; white-space: nowrap; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .sp { flex: 1; }
.toolbar .input { max-width: 320px; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--violet); border-radius: 99px; }
.meter.amber > i { background: var(--amber); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }

/* Avatar com órbita (atendimento sob a IA) */
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; flex: none; position: relative; background: var(--violet); }
.av.sm { width: 32px; height: 32px; font-size: 12px; }
.av.orbit::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--amber); border-right-color: var(--amber); animation: spin 2.4s linear infinite; }
.av .on { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: var(--green); border: 2px solid var(--surface); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Inbox ===== */
.inbox { display: grid; grid-template-columns: 340px 1fr 300px; height: 100%; }
.inbox.no-info { grid-template-columns: 340px 1fr; }
.ib-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.ib-search { padding: 14px 14px 10px; display: flex; gap: 8px; }
.tabs { display: flex; gap: 4px; padding: 0 10px 10px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border-radius: 8px; border: 0; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.tabs button:hover { background: var(--surface-2); }
.tabs button.on { background: var(--violet-soft); color: var(--violet); }
.tabs button.on.ai-tab { background: var(--amber-soft); color: #8a5c00; }
[data-theme="dark"] .tabs button.on.ai-tab { color: var(--amber); }
.tabs .n { font-size: 11px; background: var(--surface-2); border-radius: 99px; padding: 1px 7px; }
.tabs button.on .n { background: var(--surface); }
.ib-items { flex: 1; overflow-y: auto; }
.tk { display: flex; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; }
.tk:hover { background: var(--surface-2); }
.tk.sel { background: var(--violet-soft); }
.tk.sel::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--violet); }
.tk .grow { flex: 1; min-width: 0; }
.tk .row1 { display: flex; align-items: baseline; gap: 8px; }
.tk .name { font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk .time { font-size: 12px; color: var(--muted); flex: none; }
.tk .last { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 2px 0 6px; }
.tk .row3 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tk .unread { position: absolute; right: 14px; top: 38px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--green); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.prio-urgente { background: var(--red); } .prio-alta { background: #f97316; } .prio-normal { background: var(--blue); } .prio-baixa { background: #a3a1b8; }

.ib-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--paper); }
.chat-h { display: flex; align-items: center; gap: 12px; padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--line); min-height: 66px; flex-wrap: wrap; }
.chat-h .who { flex: 1; min-width: 160px; }
.chat-h .who b { display: block; font-size: 15px; }
.chat-h .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.msgs { flex: 1; overflow-y: auto; padding: 22px 26px; display: flex; flex-direction: column; gap: 6px;
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 6%, transparent) 1px, transparent 0); background-size: 22px 22px; }
.day-sep { align-self: center; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 3px 12px; border-radius: 99px; margin: 10px 0; }
.bub { max-width: min(560px, 76%); padding: 9px 13px 7px; border-radius: 16px; position: relative; white-space: pre-wrap; word-wrap: break-word; font-size: 14.5px; line-height: 1.45; box-shadow: 0 1px 1px rgba(23,18,43,.05); }
.bub .meta { display: flex; gap: 6px; justify-content: flex-end; align-items: center; font-size: 11px; opacity: .7; margin-top: 3px; }
.bub .by { font-size: 12px; font-weight: 700; margin-bottom: 2px; display: flex; align-items: center; gap: 5px; }
.bub.contact { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.bub.agent { align-self: flex-end; background: var(--violet); color: #fff; border-bottom-right-radius: 5px; }
.bub.ai { align-self: flex-end; background: var(--amber-soft); border: 1px solid #f1d48f; border-bottom-right-radius: 5px; }
[data-theme="dark"] .bub.ai { border-color: #5b4513; }
.bub.ai .by { color: #8a5c00; } [data-theme="dark"] .bub.ai .by { color: var(--amber); }
.bub.note { align-self: flex-end; background: transparent; border: 1.5px dashed #d8b65a; color: var(--ink-2); border-bottom-right-radius: 5px; }
.sys { align-self: center; max-width: 80%; text-align: center; font-size: 12.5px; color: var(--muted); padding: 4px 10px; white-space: pre-wrap; }
.typing { align-self: flex-end; display: flex; gap: 4px; padding: 12px 14px; background: var(--amber-soft); border-radius: 16px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--amber-2); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.composer { background: var(--surface); border-top: 1px solid var(--line); padding: 12px 16px; position: relative; }
.composer.note-mode { background: color-mix(in srgb, var(--amber-soft) 60%, var(--surface)); }
.composer textarea { width: 100%; border: 0; outline: none; resize: none; background: transparent; min-height: 44px; max-height: 160px; font-size: 14.5px; line-height: 1.45; }
.composer .bar { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.composer .bar .sp { flex: 1; }
.qr-pop { position: absolute; bottom: 100%; left: 16px; right: 16px; max-height: 240px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 6px; }
.qr-pop div { padding: 9px 14px; cursor: pointer; font-size: 14px; border-bottom: 1px solid var(--line); }
.qr-pop div:hover, .qr-pop div.on { background: var(--violet-soft); }
.qr-pop b { color: var(--violet); margin-right: 8px; }
.locked { text-align: center; padding: 14px; color: var(--muted); font-size: 14px; background: var(--surface); border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.ib-info { border-left: 1px solid var(--line); background: var(--surface); overflow-y: auto; padding: 18px; }
.ib-info section { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.ib-info section:last-child { border: 0; }
.ib-info h3 { font-size: 14px; margin-bottom: 10px; }
.ib-info .field { margin-bottom: 10px; }
.ib-info .field input, .ib-info .field select { height: 34px; font-size: 14px; }
.summary { background: var(--amber-soft); border-radius: 12px; padding: 12px; font-size: 13.5px; white-space: pre-wrap; }
.chat-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 30px; }
.chat-empty .big-planet { width: 120px; height: 120px; margin: 0 auto 18px; position: relative; }
.big-planet::before { content: ''; position: absolute; inset: 24px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe3a3, var(--amber) 45%, #b9670a); box-shadow: 0 0 40px rgba(243,178,58,.35); }
.big-planet::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--violet) 45%, transparent); transform: rotateX(70deg) rotateZ(-18deg); }
.big-planet i { position: absolute; inset: 0; animation: spin 7s linear infinite; }
.big-planet i::after { content: ''; position: absolute; left: 50%; top: -4px; width: 9px; height: 9px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 10px var(--violet); }
.back-btn { display: none; }

/* ===== Modal / toast ===== */
.overlay { position: fixed; inset: 0; background: rgba(15,11,30,.5); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 20px; width: 100%; max-width: 520px; max-height: calc(100dvh - 40px); display: flex; flex-direction: column; box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); animation: pop .18s ease-out; }
.modal.wide { max-width: 760px; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 18px 22px 8px; }
.modal-h h2 { flex: 1; }
.modal-b { padding: 10px 22px; overflow-y: auto; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--night); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); max-width: 360px; animation: pop .2s; display: flex; gap: 10px; align-items: center; }
.toast.err { background: var(--red); }
.toast.ok svg { color: #6ee7b7; }

/* ===== Login ===== */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { background: var(--night); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-art .brand { padding: 0; font-size: 22px; }
.auth-art .sky { position: absolute; inset: 0; background-image: radial-gradient(1px 1px at 20% 30%, #fff8, transparent), radial-gradient(1px 1px at 70% 20%, #fff6, transparent), radial-gradient(1.5px 1.5px at 85% 60%, #fff7, transparent), radial-gradient(1px 1px at 40% 80%, #fff5, transparent), radial-gradient(1px 1px at 10% 65%, #fff6, transparent), radial-gradient(1px 1px at 55% 50%, #fff4, transparent); }
.orbit-art { position: absolute; right: -120px; top: 50%; width: 520px; height: 520px; transform: translateY(-50%); }
.orbit-art .core { position: absolute; inset: 150px; border-radius: 50%; background: radial-gradient(circle at 32% 28%, #ffe7b0, var(--amber) 40%, #a85a06 85%); box-shadow: 0 0 120px rgba(243,178,58,.35), inset -30px -30px 60px rgba(80,30,0,.35); }
.orbit-art .ring { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid rgba(185,178,214,.28); }
.orbit-art .ring.r2 { inset: 60px; border-color: rgba(185,178,214,.18); }
.orbit-art .sat { position: absolute; inset: 0; animation: spin 18s linear infinite; }
.orbit-art .sat.s2 { inset: 60px; animation-duration: 11s; animation-direction: reverse; }
.orbit-art .sat::after { content: ''; position: absolute; left: 50%; top: -6px; width: 12px; height: 12px; border-radius: 50%; background: #a996ff; box-shadow: 0 0 16px #a996ff; }
.orbit-art .sat.s2::after { background: #fff; width: 8px; height: 8px; top: -4px; box-shadow: 0 0 12px #fff; }
.auth-copy { margin-top: auto; position: relative; max-width: 420px; }
.auth-copy h1 { font-size: 44px; line-height: 1.05; font-weight: 700; letter-spacing: -.035em; }
.auth-copy p { color: var(--night-text); font-size: 16px; margin: 16px 0 0; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 10px; color: #ddd8f3; font-size: 14px; }
.auth-points li { display: flex; gap: 10px; align-items: center; }
.auth-points svg { color: var(--amber); }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-form form { width: 100%; max-width: 380px; }
.auth-form h2 { font-size: 28px; margin-bottom: 6px; }
.auth-form .btn.primary { width: 100%; height: 44px; margin-top: 6px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.pw-wrap { position: relative; }
.pw-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; display: grid; }

/* Charts */
.chart { width: 100%; height: 220px; }
.chart .bar { fill: var(--violet); } .chart .bar-ai { fill: var(--amber); }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .gl { stroke: var(--line); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.donut-wrap { display: flex; gap: 20px; align-items: center; }
.hbars .row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin-bottom: 12px; font-size: 13.5px; }
.hbars .row .meter { grid-column: 1 / -1; }

/* Planos / PIX */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.plan { border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 18px; cursor: pointer; background: var(--surface); position: relative; }
.plan.on { border-color: var(--violet); box-shadow: 0 0 0 3px color-mix(in srgb, var(--violet) 15%, transparent); }
.plan .price { font-family: var(--display); font-size: 28px; font-weight: 700; margin: 6px 0; letter-spacing: -.03em; }
.plan .price small { font: 500 13px var(--font); color: var(--muted); }
.plan ul { padding: 0; margin: 10px 0 0; list-style: none; font-size: 13.5px; color: var(--ink-2); display: grid; gap: 5px; }
.seg { display: inline-flex; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--violet); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.pix-box { text-align: center; }
.pix-box img { width: 240px; height: 240px; border-radius: 12px; border: 1px solid var(--line); background: #fff; padding: 8px; }
.pix-code { font-family: ui-monospace, monospace; font-size: 12px; word-break: break-all; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin: 12px 0; text-align: left; max-height: 90px; overflow: auto; }
.lic-hero { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.lic-hero .ring-days { width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; text-align: center; flex: none; }
.lic-hero .ring-days b { font-family: var(--display); font-size: 32px; display: block; line-height: 1; }
.qr-img { width: 260px; height: 260px; border-radius: 14px; background: #fff; padding: 10px; border: 1px solid var(--line); margin: 6px auto; display: block; }
.code { font-family: ui-monospace, monospace; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; word-break: break-all; }
.playground { display: flex; flex-direction: column; height: 520px; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--paper); }
.playground .msgs { padding: 16px; }
.playground form { display: flex; gap: 8px; padding: 10px; background: var(--surface); border-top: 1px solid var(--line); }

/* ===== Responsivo ===== */
@media (max-width: 1280px) {
  .inbox, .inbox.info-hidden { grid-template-columns: 320px 1fr; }
  .ib-info, .inbox.info-hidden .ib-info { display: none; }
  .inbox.show-info .ib-info, .inbox.show-info.info-hidden .ib-info { display: block; position: fixed; right: 0; top: 0; bottom: 0; width: 340px; max-width: 92vw; z-index: 45; box-shadow: -20px 0 50px -10px rgba(15,11,30,.45); padding-top: 52px; animation: slidein .18s ease-out; }
  .inbox.show-info .info-close { display: inline-flex; }
}
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
.ib-info { position: relative; }
.info-close { position: absolute; top: 10px; right: 10px; z-index: 2; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } .cols { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; } .content { padding: 18px 16px 30px; } .banner { padding: 10px 16px; }
  .inbox, .inbox.no-info { grid-template-columns: 1fr; }
  .inbox .ib-chat { display: none; } .inbox.chat-open .ib-list { display: none; } .inbox.chat-open .ib-chat { display: flex; }
  .back-btn { display: inline-flex; }
  .auth { grid-template-columns: 1fr; } .auth-art { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .msgs { padding: 16px 12px; } .bub { max-width: 88%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 860px) { .composer .bar .tiny { display: none; } .composer .bar .btn.ghost { padding: 0 8px; } }

/* ===== Anexos ===== */
.bub.has-media { padding: 5px 5px 6px; }
.bub.has-media .txt, .bub.has-media .by, .bub.has-media .transcript { padding: 4px 8px 0; }
.bub.has-media .meta { padding: 0 8px; }
.att-img { display: block; border-radius: 12px; overflow: hidden; cursor: zoom-in; background: var(--surface-2); }
.att-img img { display: block; max-width: 100%; width: 320px; max-height: 360px; object-fit: cover; }
.att-audio { display: flex; align-items: center; gap: 8px; padding: 6px 8px; }
.att-audio svg { color: var(--violet); }
.bub.agent .att-audio svg { color: #fff; }
.att-audio audio { height: 38px; width: 270px; max-width: 100%; }
.transcript { font-size: 13px; color: var(--ink-2); white-space: pre-wrap; border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 6px !important; }
.att-video { display: block; width: 320px; max-width: 100%; max-height: 360px; border-radius: 12px; background: #000; }
.att-doc { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); min-width: 240px; text-decoration: none; }
.att-doc:hover { border-color: var(--violet); }
.att-doc div { flex: 1; min-width: 0; }
.att-doc b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-doc span { font-size: 12px; color: var(--muted); }
.att-doc .ext { flex: none; width: 42px; height: 42px; border-radius: 10px; background: var(--violet); color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.att-doc.expired { opacity: .7; }
.bub.agent .att-doc { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.25); color: #fff; }
.bub.agent .att-doc span { color: rgba(255,255,255,.75); }
.bub.agent .att-doc .ext { background: #fff; color: var(--violet); }
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(10,8,20,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; animation: fade .15s; }
.lightbox img { max-width: 100%; max-height: calc(100dvh - 100px); border-radius: 8px; cursor: zoom-in; transition: transform .2s; }
.lightbox img.zoom { transform: scale(1.8); cursor: zoom-out; }
.lightbox .lb-bar { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }
.upl { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); padding: 2px 0 8px; }
.upl .meter { flex: 1; }
.ib-chat.drop { position: relative; }
.ib-chat.drop::after { content: 'Solte os arquivos para enviar'; position: absolute; inset: 10px; border: 2px dashed var(--violet); border-radius: 16px; background: color-mix(in srgb, var(--violet-soft) 85%, transparent); display: grid; place-items: center; font: 600 18px var(--display); color: var(--violet); z-index: 5; pointer-events: none; }
.files-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.files-grid a { aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--ink-2); font-size: 10px; text-align: center; padding: 4px; }
.files-grid img { width: 100%; height: 100%; object-fit: cover; }
.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.mode-card { border: 1.5px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; background: var(--surface); }
.mode-card input { display: none; }
.mode-card b { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.mode-card p { margin: 0; font-size: 13px; color: var(--muted); }
.mode-card.on { border-color: var(--violet); box-shadow: 0 0 0 3px color-mix(in srgb, var(--violet) 15%, transparent); }
.mode-card.ai-mode.on { border-color: var(--amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 22%, transparent); }
.mode-card.disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 860px) { .mode-cards { grid-template-columns: 1fr; } .att-img img, .att-video { width: 100%; } }
.composer .bar .tiny { white-space: nowrap; }
@media (max-width: 1500px) { .composer .bar .tiny { display: none; } }
.att-doc.failed { border-color: #f3b8ba; background: var(--red-soft); }
.att-doc.failed span { color: var(--red); }
.att-doc.failed { min-width: 320px; }
.att-doc.failed .btn { flex: none; }
/* Status do atendente */
.st-wrap { position: relative; margin-bottom: 8px; }
.st-btn { width: 100%; display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--night-3); background: var(--night-2); color: #fff; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.st-btn:hover { background: var(--night-3); }
.st-menu { position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 20; }
.st-menu button { width: 100%; display: grid; grid-template-columns: 12px 1fr; align-items: center; gap: 2px 10px; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; color: var(--ink); font-weight: 600; font-size: 14px; }
.st-menu button:hover { background: var(--surface-2); }
.st-menu small { grid-column: 2; font-weight: 400; font-size: 12px; color: var(--muted); }
.bub.auto { align-self: flex-end; background: var(--surface); border: 1px dashed #c9c6da; border-bottom-right-radius: 5px; }
.bub.auto .by { color: var(--muted); }

/* Painel de detalhes recolhível */
.inbox.info-hidden { grid-template-columns: 340px 1fr; }
.inbox.info-hidden .ib-info { display: none; }
.inbox.info-hidden .bub { max-width: min(720px, 70%); }
/* Menu lateral recolhido (só ícones) */
.nav-toggle { display: inline-flex; }
.shell { transition: grid-template-columns .18s; }
.shell.nav-mini { grid-template-columns: 72px 1fr; }
.shell.nav-mini .side { padding: 18px 10px; }
.shell.nav-mini .brand > div:last-child, .shell.nav-mini .nav .group, .shell.nav-mini .nav a span:not(.count), .shell.nav-mini .me > div:last-child, .shell.nav-mini .st-btn span:not(.dot), .shell.nav-mini .st-btn svg:last-child { display: none; }
.shell.nav-mini .brand { justify-content: center; padding: 4px 0 20px; }
.shell.nav-mini .nav a { justify-content: center; padding: 0; }
.shell.nav-mini .nav a .count { position: absolute; top: 2px; right: 4px; min-width: 18px; height: 16px; font-size: 10px; }
.shell.nav-mini .nav .group + a, .shell.nav-mini .nav a + .group { margin-top: 10px; }
.shell.nav-mini .me { justify-content: center; padding: 6px 0; }
.shell.nav-mini .st-btn { justify-content: center; padding: 0; }
.shell.nav-mini .st-menu { left: 0; right: auto; width: 230px; }
@media (max-width: 860px) { .nav-toggle { display: none; } .shell.nav-mini { grid-template-columns: 1fr; } }

/* Chat interno */
.ic { display: grid; grid-template-columns: 300px 1fr; height: 100%; }
.ic-list { border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; }
.ic-item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; }
.ic-item:hover { background: var(--surface-2); }
.ic-item.sel { background: var(--violet-soft); }
.ic-item .grow { flex: 1; min-width: 0; }
.ic-item b { display: block; font-size: 14.5px; }
.ic-item .last { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ic-item .unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--green); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.ic-room { width: 40px; height: 40px; border-radius: 12px; background: var(--night); color: var(--amber); display: grid; place-items: center; flex: none; }
.ic-chat { display: flex; flex-direction: column; min-width: 0; background: var(--paper); }
.ic-chat .msgs .bub.mine { align-self: flex-end; background: var(--violet); color: #fff; border-bottom-right-radius: 5px; }
.ic-chat .msgs .bub.theirs { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.ic-chat .msgs .bub .by { color: var(--violet); }
@media (max-width: 860px) { .ic { grid-template-columns: 1fr; } .ic .ic-chat { display: none; } .ic.open .ic-list { display: none; } .ic.open .ic-chat { display: flex; } }

@media (min-width: 1281px) { .info-close { display: inline-flex; } }

/* App no celular */
.banner.pwa { background: var(--violet-soft); color: var(--ink); border-bottom-color: var(--line); }
@media (display-mode: standalone) {
  .topbar { padding-top: max(14px, env(safe-area-inset-top)); }
  .side { padding-top: max(18px, env(safe-area-inset-top)); }
}
.composer, .ic-chat .composer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
@media (max-width: 860px) {
  body { overscroll-behavior-y: none; }
  .topbar h1 { font-size: 19px; }
  .topbar { min-height: 58px; }
  .chat-h { padding: 10px 12px; min-height: 58px; }
  .chat-h .acts .btn.sm { padding: 0 10px; }
  .chat-h .acts { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; padding-bottom: 2px; }
  .chat-h .who { min-width: 0; }
  .composer textarea { font-size: 16px; } /* evita zoom no iPhone */
  .input, .field input, .field select, .field textarea { font-size: 16px; }
  .tk { padding: 12px; }
  .kpis { gap: 10px; } .kpi .v { font-size: 26px; }
  .banner { font-size: 13px; }
}
@media (max-width: 860px) {
  .composer .bar .lbl { display: none; }
  .composer .bar .btn.sm { padding: 0 10px; }
  .composer .bar .btn.primary { padding: 0 16px; }
  #page-actions .seg { flex-wrap: nowrap; padding: 3px; }
  #page-actions .seg button { padding: 6px 9px; font-size: 12.5px; }
  #page-actions > .small { display: none; }
}
