/* Volyte Chat - Copyright (c) 2026 Volyte. All rights reserved. Developed by Pankaj Kumar Rai. */
:root {
  /* Volyte brand: orange actions on warm white, dark navy accents */
  --brand: #ec6428;
  --brand-hover: #d9541b;
  --brand-soft: #fdf1ec;
  --brand-ink: #9a3412;
  --navy: #1c2430;
  --text: #111827;
  --muted: #6b7280;
  --faint: #9ca3af;
  --line: #ece7e3;
  --bg: #faf7f5;
  --red: #dc2626;
  --green: #22c55e;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
a { color: var(--brand); }

.pill { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 10px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 600; text-align: center; line-height: 18px; }
.pill.green { background: var(--green); }
.secondary { border: 1px solid #d1d5db; background: #fff; border-radius: 8px; padding: 7px 12px; }
.secondary:hover { background: #f9fafb; }
.danger { color: var(--red); }
.icon-btn { border: none; background: none; font-size: 18px; padding: 6px 8px; border-radius: 8px; line-height: 1; }
.icon-btn:hover { background: #f3f4f6; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(90% 70% at 100% 0%, #fde3d6 0%, transparent 60%), radial-gradient(70% 60% at 0% 100%, #fdf1ec 0%, transparent 60%), var(--bg); }
.login form { background: #fff; padding: 32px; border-radius: 18px; border: 1px solid var(--line); width: 100%; max-width: 360px; box-shadow: 0 8px 30px rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 12px; }
.login h1 { margin: 0; color: var(--text); font-size: 26px; letter-spacing: -.02em; }
.login h1 span { color: var(--brand); }
.login p { margin: 0 0 8px; color: var(--muted); }
.login input { padding: 11px 12px; border: 1px solid #ddd5cf; border-radius: 10px; }
.login input:focus, .form input:focus, .form select:focus, .form textarea:focus, .reply textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(236, 100, 40, .15); }
.login button { padding: 12px; border: none; border-radius: 10px; background: var(--brand); color: #fff; font-weight: 600; box-shadow: 0 6px 16px rgba(236, 100, 40, .25); }
.login button:hover { background: var(--brand-hover); }
.error { color: var(--red); font-size: 13px; min-height: 16px; }

/* ---------- layout ---------- */
.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 0 12px 0 16px; height: 52px; background: #fff; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); font-size: 16px; letter-spacing: -.01em; }
.brand b { color: var(--brand); font-weight: 700; }
.msg .orig { display: block; font-size: 12px; opacity: .75; margin-top: 4px; padding-top: 4px; border-top: 1px dashed currentColor; }

.brand-logo { height: 26px; max-width: 120px; object-fit: contain; }
.brand-tag { background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 700; border-radius: 6px; padding: 2px 7px; }
.login-logo { height: 40px; max-width: 200px; object-fit: contain; align-self: flex-start; margin-bottom: 4px; }
.nav { display: flex; gap: 4px; }
.nav button { border: none; background: none; padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav button.active { background: var(--brand-soft); color: var(--brand); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.team { display: flex; margin-right: 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: #fde5d9; color: var(--brand-ink); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; margin-left: -6px; position: relative; }
.avatar.on::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border-radius: 50%; background: var(--green); border: 2px solid #fff; }
.avatar.off { opacity: .45; }
.menu { position: relative; }
.me-btn { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 5px 12px; font-weight: 500; }
.menu-pop { position: absolute; right: 0; top: 40px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.1); padding: 4px; min-width: 150px; z-index: 10; }
.menu-pop button { display: block; width: 100%; text-align: left; border: none; background: none; padding: 8px 12px; border-radius: 6px; }
.menu-pop button:hover { background: #f3f4f6; }

.inbox { flex: 1; display: flex; min-height: 0; }
.sidebar { width: 330px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.section-head { padding: 10px 16px 6px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; display: flex; justify-content: space-between; align-items: center; }
.live { border-bottom: 1px solid var(--line); max-height: 30%; display: flex; flex-direction: column; flex-shrink: 0; }
.visitor-list { list-style: none; margin: 0; padding: 0 0 6px; overflow-y: auto; }
.visitor-list li { padding: 6px 16px; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.visitor-list .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.visitor-list .info { flex: 1; min-width: 0; }
.visitor-list .vpage { color: var(--faint); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.visitor-list button { border: 1px solid var(--brand); color: var(--brand); background: #fff; border-radius: 6px; padding: 3px 9px; font-size: 12px; flex-shrink: 0; }
.visitor-list .none { color: var(--faint); }
.search { padding: 10px 12px 6px; }
.search input { width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #f9fafb; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; padding: 9px; border: none; background: none; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.conv-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.conv-list li { padding: 11px 16px; border-bottom: 1px solid #f3f4f6; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; }
.conv-list li:hover { background: #f9fafb; }
.conv-list li.active { background: var(--brand-soft); }
.conv-list .presence { width: 9px; height: 9px; border-radius: 50%; background: #d1d5db; margin-top: 5px; flex-shrink: 0; }
.conv-list .presence.on { background: var(--green); }
.conv-list .body { flex: 1; min-width: 0; }
.conv-list .top { display: flex; justify-content: space-between; gap: 8px; }
.conv-list .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-list .time { font-size: 11px; color: var(--faint); flex-shrink: 0; }
.conv-list .preview { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv-list .tags { font-size: 11px; color: var(--faint); margin-top: 3px; }
.conv-list .empty-list { color: var(--faint); cursor: default; justify-content: center; }

.chat { flex: 1; display: flex; min-width: 0; min-height: 0; }
.empty { margin: auto; color: var(--faint); text-align: center; }
.empty-icon { font-size: 40px; }
.chat-view { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head { background: #fff; padding: 10px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.chat-title { flex: 1 1 180px; min-width: 0; }
.chat-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-name { font-weight: 600; font-size: 15px; }
.chat-meta { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chat-actions button { white-space: nowrap; }
.chat-actions select { border: 1px solid #d1d5db; border-radius: 8px; padding: 6px 8px; background: #fff; max-width: 150px; }
.back { display: none; border: none; background: none; font-size: 20px; padding: 0 4px; }
.messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 65%; padding: 9px 13px; border-radius: 14px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.msg.visitor { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.agent { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.agent a { color: #fff; }
.msg img { display: block; max-width: 100%; max-height: 260px; border-radius: 8px; margin-bottom: 4px; cursor: zoom-in; }
.msg .ts { display: block; font-size: 10px; opacity: .6; margin-top: 4px; }
.day { align-self: center; font-size: 11px; color: var(--faint); margin: 6px 0; }
.peek { padding: 0 20px 6px; font-size: 12px; color: var(--muted); font-style: italic; min-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.closed-note { text-align: center; padding: 14px; color: var(--muted); background: #fff; border-top: 1px solid var(--line); }
.reply { position: relative; display: flex; gap: 4px; align-items: flex-end; padding: 10px 12px; background: #fff; border-top: 1px solid var(--line); }
.reply textarea { flex: 1; resize: none; height: 60px; padding: 10px; border: 1px solid #d1d5db; border-radius: 8px; }
.send-btn { border: none; background: var(--brand); color: #fff; border-radius: 8px; padding: 0 20px; height: 60px; font-weight: 600; }
.quick-pop { position: absolute; left: 12px; right: 12px; bottom: 100%; margin: 0 0 4px; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 -6px 24px rgba(0,0,0,.08); max-height: 240px; overflow-y: auto; }
.quick-pop li { padding: 8px 10px; border-radius: 6px; cursor: pointer; display: flex; gap: 10px; }
.quick-pop li.sel, .quick-pop li:hover { background: var(--brand-soft); }
.quick-pop b { color: var(--brand); flex-shrink: 0; }
.quick-pop span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-pop .none { color: var(--faint); cursor: default; }

/* ---------- settings ---------- */
.settings { flex: 1; display: flex; min-height: 0; }
.settings-nav { width: 220px; background: #fff; border-right: 1px solid var(--line); padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.settings-nav button { text-align: left; border: none; background: none; padding: 9px 12px; border-radius: 8px; color: var(--muted); }
.settings-nav button.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.settings-body { flex: 1; overflow-y: auto; padding: 28px 32px 60px; }
.settings-body section { max-width: 720px; }
.settings-body h2 { margin: 0 0 4px; }
.settings-body h3 { margin: 28px 0 10px; font-size: 15px; }
.hint { color: var(--muted); margin: 0 0 18px; }
.warn { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; padding: 8px 12px; border-radius: 8px; margin: 0; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-weight: 500; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.form input:not([type=checkbox]):not([type=color]), .form select, .form textarea { padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; font-weight: 400; }
.form input[type=color] { width: 60px; height: 36px; padding: 2px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; }
.form-actions { display: flex; align-items: center; gap: 10px; }
.form-actions button:not(.secondary), .form.grid > button { border: none; background: var(--brand); color: #fff; border-radius: 8px; padding: 9px 18px; font-weight: 600; }
.form.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hours-table td { padding: 4px 10px 4px 0; }
.hours-table input[type=time] { padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 6px; }
.quick-rows { display: flex; flex-direction: column; gap: 8px; }
.quick-row { display: flex; gap: 8px; align-items: flex-start; }
.quick-row input { width: 120px; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; }
.quick-row textarea { flex: 1; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; resize: vertical; min-height: 38px; }
.table-wrap { overflow-x: auto; }
.team-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.team-table th, .team-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.team-table th { font-size: 12px; color: var(--muted); font-weight: 600; }
.team-table td:last-child { text-align: right; }
.team-table td button { border: 1px solid #d1d5db; background: #fff; border-radius: 6px; padding: 3px 8px; font-size: 12px; margin-left: 4px; }
.code { background: var(--navy); color: #e5e7eb; padding: 14px; border-radius: 10px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; font-size: 12.5px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: calc(100vw - 32px); }
.toast.bad { background: var(--red); }


/* ---------- chat + details layout ---------- */
.chat-view { flex-direction: row; }
.chat-col { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.details { width: 320px; flex-shrink: 0; background: #fff; border-left: 1px solid var(--line); overflow-y: auto; padding: 16px; }
.details.collapsed { display: none; }
.primary { border: none; background: var(--brand); color: #fff; border-radius: 8px; padding: 8px 14px; font-weight: 600; }
.primary:hover { background: var(--brand-hover); }
.status-sel { border: 1px solid var(--line); border-radius: 20px; padding: 5px 8px; background: #fff; margin-right: 4px; }

.d-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.d-avatar { width: 44px; height: 44px; border-radius: 50%; background: #fde5d9; color: var(--brand-ink); font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 15px; }
.d-name { font-weight: 600; font-size: 15px; }
.d-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.d-section { border-top: 1px solid var(--line); padding: 12px 0; }
.d-section h4 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.d-row { display: flex; gap: 8px; font-size: 13px; padding: 3px 0; }
.d-row .k { color: var(--muted); width: 92px; flex-shrink: 0; }
.d-row .v { flex: 1; min-width: 0; word-break: break-word; }
.d-row a { word-break: break-all; }
.d-edit { display: flex; flex-direction: column; gap: 6px; }
.d-edit input, .d-edit textarea { width: 100%; padding: 7px 9px; border: 1px solid #d1d5db; border-radius: 7px; font-size: 13px; }
.d-edit textarea { resize: vertical; min-height: 60px; }
.d-edit .row { display: flex; gap: 6px; justify-content: flex-end; }
.d-edit button, .d-actions button { border: 1px solid #d1d5db; background: #fff; border-radius: 7px; padding: 5px 10px; font-size: 12px; }
.d-edit button.save { background: var(--brand); color: #fff; border-color: var(--brand); }
.d-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.d-actions .danger { color: var(--red); }
.trail { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.trail li { padding: 5px 0 5px 14px; border-left: 2px solid var(--line); position: relative; }
.trail li::before { content: ""; position: absolute; left: -5px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; }
.trail li.now::before { background: var(--green); }
.trail .t { color: var(--faint); font-size: 11px; }
.trail .pt { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.past { list-style: none; margin: 0; padding: 0; }
.past li { padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 12.5px; }
.past li:hover { background: #f3f4f6; }
.past .when { color: var(--faint); font-size: 11px; }
.tags-box { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag { background: var(--brand-soft); color: var(--brand-ink); border-radius: 12px; padding: 2px 4px 2px 10px; font-size: 12px; display: inline-flex; align-items: center; gap: 2px; }
.tag button { border: none; background: none; color: var(--brand); font-size: 14px; line-height: 1; padding: 0 4px; }
.tags-box input { border: 1px dashed #c7d2fe; border-radius: 12px; padding: 3px 10px; font-size: 12px; width: 110px; }
.attrib { font-size: 10px; color: var(--faint); margin-top: 10px; }
.attrib a { color: inherit; }
.seen { align-self: flex-end; font-size: 11px; color: var(--faint); margin-top: -4px; }
.flag { font-size: 15px; }

.profile-view { flex: 1; overflow-y: auto; display: flex; justify-content: center; padding: 24px 16px; }
.profile-card { width: 100%; max-width: 520px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; height: fit-content; }
.profile-actions { display: flex; justify-content: space-between; margin-bottom: 10px; }
.profile-actions .back { display: block; visibility: hidden; }

.emoji-pop { position: absolute; left: 12px; bottom: 100%; margin-bottom: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 -6px 24px rgba(0,0,0,.08); padding: 6px; display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px; z-index: 5; }
.emoji-pop button { border: none; background: none; font-size: 20px; padding: 4px; border-radius: 6px; }
.emoji-pop button:hover { background: #f3f4f6; }

/* ---------- full-page views ---------- */
.page { flex: 1; overflow-y: auto; padding: 24px 28px 60px; }
.page-head { margin-bottom: 16px; }
.page-head.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h2 { margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.data-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.visitors-table tbody tr { cursor: pointer; }
.visitors-table tbody tr:hover { background: #f9fafb; }
.visitors-table .sub { color: var(--faint); font-size: 11.5px; margin-top: 2px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visitors-table button { border: 1px solid var(--brand); color: var(--brand); background: #fff; border-radius: 6px; padding: 3px 10px; font-size: 12px; }
.chatting-badge { background: #dcfce7; color: #166534; border-radius: 10px; padding: 1px 8px; font-size: 11px; margin-left: 6px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: none; background: none; padding: 7px 12px; color: var(--muted); }
.seg button.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

/* ---------- reports ---------- */
.viz-root { --surface-1: #ffffff; --grid: #ececea; --text-primary: #111827; --text-secondary: #52514e; --series-1: #ec6428; --series-2: #334155; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.tile .label { font-size: 12px; color: var(--muted); }
.tile .value { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.card h3 { margin: 0 0 4px; font-size: 14px; }
.card .card-sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-secondary); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.chart { position: relative; height: 180px; display: flex; gap: 0; padding-left: 34px; }
.chart .yaxis { position: absolute; left: 0; top: 0; bottom: 20px; width: 30px; font-size: 10px; color: var(--text-secondary); }
.chart .yaxis span { position: absolute; right: 4px; transform: translateY(-50%); }
.chart .gridline { position: absolute; left: 34px; right: 0; height: 1px; background: var(--grid); }
.chart .cols { position: relative; flex: 1; display: flex; align-items: flex-end; height: calc(100% - 20px); border-bottom: 1px solid #d6d5d0; }
.chart .col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.chart .stack { width: 70%; max-width: 24px; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.chart .seg-bar { width: 100%; }
.chart .stack .seg-bar:first-child { border-radius: 4px 4px 0 0; }
.chart .xl { position: absolute; bottom: -18px; font-size: 10px; color: var(--text-secondary); white-space: nowrap; }
.chart .col:hover .stack { filter: brightness(0.92); }
.chart-tip { position: fixed; pointer-events: none; background: var(--navy); color: #fff; font-size: 12px; padding: 7px 10px; border-radius: 8px; z-index: 50; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.chart-tip b { display: block; margin-bottom: 2px; }
.link-btn { border: none; background: none; color: var(--brand); padding: 0; font-size: 12px; }
.bar-cell { display: flex; align-items: center; gap: 8px; }
.bar-cell .b { height: 8px; border-radius: 0 4px 4px 0; background: var(--series-1); min-width: 2px; }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .topbar { gap: 8px; padding: 0 8px; }
  .brand span, .team { display: none; }
  .sidebar { width: 100%; border-right: none; }
  .inbox.chatting .sidebar { display: none; }
  .inbox:not(.chatting) .chat { display: none; }
  .back { display: block; }
  .msg { max-width: 85%; }
  .chat-head { flex-wrap: wrap; }
  .chat-actions { width: 100%; }
  .chat-actions select { flex: 1; max-width: none; }
  .settings { flex-direction: column; }
  .settings-nav { width: 100%; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); padding: 6px; }
  .settings-nav button { white-space: nowrap; }
  .settings-body { padding: 20px 16px 60px; }
  .form.grid { grid-template-columns: 1fr; }
  .send-btn { padding: 0 14px; }
  .topbar .brand, #soundBtn, .status-sel { display: none; }
  .topbar { gap: 4px; }
  .nav { gap: 0; min-width: 0; }
  .nav button { padding: 7px 7px; font-size: 13px; white-space: nowrap; }
  .nav .pill { min-width: 16px; padding: 0 4px; line-height: 16px; }
  .me-btn { max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 5px 8px; }
  .icon-btn { padding: 6px 5px; }
  .d-close { display: block !important; }
  .details { position: fixed; inset: 52px 0 0 0; width: auto; z-index: 20; border-left: none; }
  .page { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .visitors-table th:nth-child(6), .visitors-table td:nth-child(6), .visitors-table th:nth-child(7), .visitors-table td:nth-child(7) { display: none; }
}
@media (max-width: 1100px) and (min-width: 761px) {
  .details { position: absolute; right: 0; top: 52px; bottom: 0; z-index: 15; box-shadow: -8px 0 24px rgba(0,0,0,.08); }
}

.avatar.away::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border-radius: 50%; background: #f59e0b; border: 2px solid #fff; }
.trigger-rows { display: flex; flex-direction: column; gap: 12px; }
.trigger-rows .card { margin: 0; gap: 10px; }

.mobile-only { display: none !important; }
@media (max-width: 760px) { .mobile-only { display: block !important; } }
.msg.agent.bot { background: #ede9fe; color: #3b0764; }
.msg.agent.bot .ts { color: #6d28d9; }
.ai-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; font-size: 13px; background: #f5f3ff; color: #4c1d95; border-bottom: 1px solid #ddd6fe; flex-wrap: wrap; }
.ai-bar.human { background: #fff7ed; color: #9a3412; border-bottom-color: #fed7aa; }
.ai-bar span { flex: 1; min-width: 200px; }
.ai-bar button { border: 1px solid currentColor; background: #fff; color: inherit; border-radius: 7px; padding: 4px 10px; font-size: 12px; }
.radios { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; background: #fff; }
.radios legend { font-weight: 500; padding: 0 4px; }
.steps { margin: 0 0 12px; padding-left: 20px; color: var(--text); line-height: 1.7; }
.tg-box { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; max-width: 520px; }
.tg-box .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tg-box select { border: 1px solid #d1d5db; border-radius: 8px; padding: 6px 8px; background: #fff; }
.btn-link { display: inline-block; text-decoration: none; padding: 8px 14px; border-radius: 8px; font-weight: 600; }
a.secondary.btn-link { border: 1px solid #d1d5db; background: #fff; color: var(--text); font-weight: 500; }
a.primary.btn-link { color: #fff; }
.tg-cmd { font-size: 14px; padding: 8px 12px; background: #f3f4f6; border-radius: 8px; user-select: all; word-break: break-all; }
.ok-text { color: #15803d; font-weight: 600; }
.provider-card { margin: 0 0 6px; gap: 12px; background: #fafaff; border-color: #e0e7ff; }
.provider-card h3 { margin: 0; }
.key-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.key-row label { flex: 1; min-width: 220px; }
.key-row button { height: 38px; }
.test-ok { color: #15803d; }
.test-bad { color: var(--red); }
.alert-banner { border: none; background: var(--brand-soft); color: var(--brand-ink); border-bottom: 1px solid #f6d5c5; padding: 9px 16px; font-weight: 600; text-align: center; cursor: pointer; flex-shrink: 0; }
.alert-banner:hover { background: #fbe2d6; }
.msg-popup { position: fixed; right: 20px; bottom: 20px; z-index: 60; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 12px 16px; width: 300px; max-width: calc(100vw - 40px); cursor: pointer; animation: popin .2s ease-out; }
.msg-popup b { display: block; margin-bottom: 4px; }
.msg-popup div { color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
@keyframes popin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.install-url { display: flex; flex-direction: column; gap: 5px; font-weight: 500; margin-bottom: 12px; max-width: 520px; }
.install-url input { padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 8px; font-weight: 400; }
.howto { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 8px 0; }
.howto summary { cursor: pointer; }
.howto ol { margin: 10px 0 4px; padding-left: 20px; line-height: 1.7; }
.platforms { display: flex; flex-direction: column; }
.d-close { display: none; margin-left: auto; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 4px 10px; font-size: 16px; }
html, body { overflow-x: hidden; }

.copyright { font-size: 11px; color: var(--faint); text-align: center; margin: 8px 0 0; line-height: 1.5; }
.nav-copy { margin-top: auto; padding: 16px 8px 4px; text-align: left; }
@media (max-width: 760px) { .nav-copy { display: none; } }
