:root { --brand: #1769e8; }
:root { font: 15px/1.45 system-ui, sans-serif; color: #172638; background: #f5f7fb; }
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
header { height: 64px; padding: 0 28px; display: flex; align-items: center; gap: 12px; justify-content: flex-start; background: #fff; border-bottom: 1px solid #e2e8f0; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 18px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--brand); color: white; font-weight: 750; }
#status { position: fixed; right: 16px; bottom: 56px; z-index: 60; max-width: min(360px, calc(100vw - 32px)); margin: 0; padding: 10px 14px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: #334155; box-shadow: 0 8px 24px #0f172a26; font-size: 13px; }
#status:empty { display: none; }
.tab { border: 0; border-bottom: 2px solid transparent; padding: 0 4px; background: transparent; color: #64748b; cursor: pointer; font-weight: 600; }
.tab:hover { color: var(--brand); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.dialogues { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; grid-template-rows: minmax(0, 1fr); height: calc(100dvh - 64px); overflow: hidden; }
aside { min-height: 0; overflow-y: auto; overscroll-behavior: contain; background: white; border-right: 1px solid #e2e8f0; }
.conversation { width: 100%; border: 0; border-bottom: 1px solid #edf1f5; padding: 15px; text-align: left; background: white; cursor: pointer; }
.conversation:hover, .conversation.selected { background: var(--brand-faint); }
.conversation strong, .conversation small { display: block; }
.conversation-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.conversation-head strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation .stamp { flex: none; color: #64748b; font-size: 12px; }
.day-divider { align-self: center; padding: 3px 12px; margin: 6px 0; border-radius: 999px; background: #e2e8f0; color: #475569; font-size: 12px; font-weight: 600; }
.bubble time { color: #64748b; }
.conversation .author { font-weight: 600; color: #334155; }
.conversation .author.user { color: var(--brand); }
.conversation small { color: #64748b; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.chat-title { min-height: 56px; box-sizing: border-box; padding: 10px 20px; border-bottom: 1px solid #e2e8f0; background: white; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 8px 16px; }
.chat-title .chat-page { color: #64748b; font-size: 13px; overflow-wrap: anywhere; }
.chat-title #application[aria-pressed="true"] { border-color: #16a34a; background: #dcfce7; color: #166534; }
.lead-strip { flex-basis: 100%; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; padding-top: 10px; margin-top: 2px; border-top: 1px solid #edf1f5; }
.lead-strip[hidden] { display: none; }
.lead-strip > small:first-child { flex-basis: 100%; color: #64748b; }
.lead-contact { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.lead-copy { display: inline-flex; flex: none; align-items: center; justify-content: center; padding: 6px; border: 0; background: transparent; color: #64748b; cursor: pointer; }
.lead-copy:hover { background: var(--brand-faint); color: var(--brand); }
.lead-copy .icon { width: 16px; height: 16px; }
.lead-source { color: #64748b; }
.lead-value { cursor: text; }
.lead-edit { background: transparent; border: 0; padding: 4px; color: #64748b; font-size: 12px; cursor: pointer; }
.lead-edit:hover { color: var(--brand); }
.lead-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: 100%; }
.lead-editor input { min-width: 120px; width: 220px; max-width: 100%; padding: 6px 8px; box-sizing: border-box; }
.lead-editor button { padding: 6px 8px; font-size: 12px; }
.chat-title #delete-conversation { background: #f1f5f9; border-color: #cbd5e1; color: #64748b; }
.chat-title #delete-conversation:hover { background: #e2e8f0; color: #334155; }
#messages { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.bubble { flex: none; max-width: min(80%, 620px); padding: 10px 14px; border-radius: 14px; background: white; box-shadow: 0 1px 3px #0001; white-space: pre-wrap; }
.bubble.user { align-self: flex-start; }
.bubble.assistant, .bubble.operator { align-self: flex-end; background: var(--brand-soft); }
.bubble small { display: block; margin-bottom: 4px; color: #64748b; }
#reply { display: flex; gap: 10px; padding: 15px; background: white; border-top: 1px solid #e2e8f0; }
input, textarea { font: inherit; color: inherit; }
#message { flex: 1; min-width: 0; padding: 12px; border: 1px solid #cbd5e1; border-radius: 9px; }
button { font: inherit; }
#reply button, #mode, .actions button, .upload-button { border: 0; border-radius: 9px; padding: 10px 16px; background: var(--brand); color: white; cursor: pointer; font-weight: 600; }
button:disabled { opacity: .5; cursor: default; }
.settings-panel { width: 100%; max-width: 1200px; margin: 0; padding: 28px 32px 60px; }
#reports { max-width: none; }
.panel-heading h1 { margin: 0 0 6px; font-size: 25px; }
.panel-heading p { margin: 0 0 22px; color: #64748b; }
.agent-section { margin-top: 36px; }
.section-heading h2 { margin: 0 0 6px; font-size: 20px; }
.section-heading p { margin-bottom: 16px; }
.card { padding: 24px; background: white; border: 1px solid #e2e8f0; border-radius: 16px; box-shadow: 0 2px 8px #0f172a0a; }
.card label:not(.upload-button) { display: block; margin-top: 10px; font-weight: 700; }
.card textarea { display: block; width: 100%; margin: 10px 0 24px; padding: 13px; border: 1px solid #cbd5e1; border-radius: 10px; resize: vertical; }
.card textarea:focus, #message:focus { outline: 2px solid var(--brand-ring); border-color: var(--brand); }
#privacy-form input { display: block; width: 100%; margin: 10px 0 24px; padding: 13px; border: 1px solid #cbd5e1; border-radius: 10px; }
#privacy-form input:focus { outline: 2px solid var(--brand-ring); border-color: var(--brand); }
.hint { margin: 6px 0 10px; color: #64748b; font-size: 13px; }
.actions, .upload-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.actions span, #knowledge-status { color: #475569; font-size: 13px; }
#knowledge-file { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-button { display: inline-block; }
.knowledge-list { list-style: none; padding: 0; margin: 22px 0 0; }
.knowledge-list li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid #e2e8f0; }
.knowledge-list strong { min-width: 0; overflow-wrap: anywhere; }
.knowledge-list small { color: #64748b; margin-left: auto; white-space: nowrap; }
.secondary { border: 1px solid #cbd5e1; border-radius: 8px; padding: 7px 12px; background: white; color: #334155; cursor: pointer; }
/* Widget settings */

.widget-layout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; align-items: start; }
.widget-form fieldset { border: 0; padding: 0; margin: 0 0 26px; }
.widget-form legend { font-size: 17px; font-weight: 750; margin-bottom: 12px; }
.widget-form label:not(.check):not(.segmented label) { display: grid; gap: 6px; margin: 0 0 14px; font-weight: 600; font-size: 14px; }
.widget-form .label { display: block; margin: 4px 0 6px; font-weight: 600; font-size: 14px; }
.widget-form .label small { color: #64748b; font-weight: 400; }
.widget-form input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), .widget-form textarea { width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 9px; font-weight: 400; resize: vertical; }
.widget-form input:focus, .widget-form textarea:focus { outline: 2px solid var(--brand-ring); border-color: var(--brand); }
.widget-form input:disabled, .widget-form textarea:disabled { background: #f1f5f9; color: #94a3b8; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row.quick { margin-bottom: 10px; }
.color-input { display: flex; gap: 8px; align-items: center; }
.color-input input[type="color"] { width: 44px; height: 40px; padding: 2px; border: 1px solid #cbd5e1; border-radius: 9px; background: white; cursor: pointer; }
.widget-form .check { display: flex; align-items: center; gap: 9px; margin: 0 0 14px; font-weight: 600; font-size: 14px; cursor: pointer; }
.widget-form .check input { width: 17px; height: 17px; }
.segmented { display: inline-flex; padding: 3px; margin-bottom: 14px; border-radius: 10px; background: #eef2f7; gap: 3px; }
.widget-form .segmented label, .segmented button { display: flex; margin: 0; align-items: center; gap: 6px; padding: 7px 12px; border: 0; border-radius: 8px; background: transparent; font-size: 14px; font-weight: 600; color: #475569; cursor: pointer; }
.segmented label:has(input:checked), .segmented button.on { background: white; color: var(--brand); box-shadow: 0 1px 3px #0f172a1a; }
.segmented input { accent-color: var(--brand); }
.segmented.small { margin: 0; }
.segmented.small button { padding: 5px 10px; font-size: 13px; }
.snippet { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: #0f172a; }
.snippet code { flex: 1; min-width: 0; color: #e2e8f0; font-size: 12.5px; overflow-wrap: anywhere; }
.preview-card { position: sticky; top: 16px; padding: 16px; border: 1px solid #e2e8f0; border-radius: 12px; background: #f8fafc; }
.preview-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.preview-stage { position: relative; height: 700px; overflow: hidden; border-radius: 12px; border: 1px solid #e2e8f0; background: linear-gradient(#f8fafc, #eef2f7); transform: translateZ(0); }
.fake-site { padding: 24px; display: grid; gap: 12px; }
.fake-site span { height: 14px; border-radius: 7px; background: #dde3ea; }
.fake-site span:first-child { width: 55%; height: 22px; }
.fake-site span.short { width: 40%; }
.preview-stage #consultant-widget-frame { width: min(380px, calc(100% - var(--preview-offset-x, 24px) - 12px)) !important; height: min(620px, calc(100% - var(--preview-frame-bottom, 96px) - 12px)) !important; }
.preview-stage #consultant-widget-invitation { width: min(320px, calc(100% - var(--preview-offset-x, 24px) - 12px)) !important; }
@media (max-width: 1100px) { .widget-layout { grid-template-columns: 1fr; } .preview-card { position: static; } }
@media (max-width: 650px) { header { padding-left: 12px; padding-right: 12px; } .conversation { padding: 10px; } #messages { padding: 10px; } .settings-panel { padding: 18px 12px; } .card { padding: 16px; } .field-row { grid-template-columns: 1fr; } }

.auth-page { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: min(400px, 100%); display: grid; gap: 14px; }
.auth-card h1 { margin: 6px 0 0; font-size: 22px; }
.auth-card form { display: grid; gap: 12px; }
.auth-card.card label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; margin: 0; }
.auth-card input { padding: 11px 12px; border: 1px solid #cbd5e1; border-radius: 9px; font: inherit; }
.auth-card button[type="submit"] { border: 0; border-radius: 9px; padding: 11px 16px; background: var(--brand); color: white; font-weight: 600; cursor: pointer; }
.auth-error { margin: 0; color: #b91c1c; font-size: 14px; min-height: 0; }
.auth-links { margin: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; font-size: 14px; }
.auth-links:not(:has(a:not([hidden]))) { display: none; }
.auth-done { margin: 0; color: #15803d; font-size: 14px; }
.userbox { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.acting-bar { padding: 8px 28px; background: #fef3c7; color: #78350f; font-size: 14px; }
.acting-bar button { border: 0; background: none; color: #92400e; text-decoration: underline; cursor: pointer; font: inherit; }
.invite-form { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 10px; margin-bottom: 14px; }
.invite-form input, .invite-form select { padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 9px; font: inherit; }
.invite-form button { border: 0; border-radius: 9px; padding: 10px 16px; background: var(--brand); color: white; font-weight: 600; cursor: pointer; }
.invite-result { margin-bottom: 14px; }
.users-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.users-table th, .users-table td { padding: 10px 8px; border-bottom: 1px solid #e2e8f0; text-align: left; vertical-align: middle; }
.users-table th { color: #64748b; font-weight: 600; }
.row-actions { text-align: right; }
.row-actions button { margin: 3px 0 3px 6px; }
@media (max-width: 650px) { .invite-form { grid-template-columns: 1fr; } .users-table { display: block; overflow-x: auto; } }
.company-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 10px; margin-bottom: 14px; }
.company-form input { width: 100%; box-sizing: border-box; min-width: 0; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 9px; font: inherit; font-weight: 400; }
.company-form { align-items: end; }
.company-form label { display: grid; gap: 6px; min-width: 0; font-size: 13px; font-weight: 600; color: #334155; }
.company-form label small { color: #64748b; font-weight: 400; }
.company-form input:invalid:not(:placeholder-shown) { border-color: #f87171; }
.company-form button { border: 0; border-radius: 9px; padding: 10px 16px; background: var(--brand); color: white; font-weight: 600; cursor: pointer; }
.table-scroll { overflow-x: auto; }
.company-table { min-width: 820px; }
.company-table th:last-child { width: 330px; }
.company-actions { display: flex; gap: 6px; white-space: nowrap; }
.company-actions button { margin: 0; padding: 6px 8px; font-size: 13px; }
@media (max-width: 900px) { .company-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .company-form button { grid-column: 1 / -1; } }
@media (max-width: 650px) { .company-form { grid-template-columns: 1fr; } .company-table { display: table; } }

.channels-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.channels-layout h2 { margin: 0 0 8px; font-size: 18px; }
.channel-list ul, .catalog, .origin-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.channel-list li button, .catalog li button { width: 100%; text-align: left; display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; background: transparent; color: inherit; border: 1px solid #e2e8f0; }
.channel-list li button.on { border-color: var(--brand); background: var(--brand-faint); }
.channel-list small, .catalog small { color: #64748b; font-weight: 400; }
.catalog { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.origin-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid #f1f5f9; }
#site-origin-form { margin-bottom: 12px; }
#site-origin { flex: 1; min-width: 200px; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; }
.site-origins { margin-bottom: 20px; }
@media (max-width: 760px) { .channels-layout { grid-template-columns: 1fr; } }
.secondary.danger { color: #b91c1c; border-color: #fecaca; }
#messenger-form input { display: block; width: 100%; margin: 10px 0 16px; padding: 13px; border: 1px solid #cbd5e1; border-radius: 10px; }
#messenger-form input:focus { outline: 2px solid var(--brand-ring); border-color: var(--brand); }
#channel-messenger p { margin: 0 0 12px; }

.button-link { display: inline-block; margin-bottom: 12px; color: var(--brand); font-weight: 700; }

.conversation.awaiting { border-left: 3px solid #f59e0b; }
.awaiting-badge { display: inline-block; width: fit-content; margin: 4px 0; padding: 2px 8px; border-radius: 999px; background: #fef3c7; color: #92400e; font-size: 12px; font-weight: 700; }
.service-note { align-self: center; max-width: 80%; margin: 6px auto; padding: 6px 12px; border-radius: 10px; background: #f1f5f9; color: #475569; font-size: 13px; text-align: center; }

.account-menu-wrap { position: relative; }
.tour-trigger { display: inline-flex; flex: none; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tour-trigger:hover, .tour-trigger:focus-visible { border-color: var(--brand-ring); background: var(--brand-faint); }
.tour-trigger .icon { width: 17px; height: 17px; }
.account-toggle { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border: 1px solid #e2e8f0; border-radius: 999px; background: #fff; color: #0f172a; font: inherit; cursor: pointer; }
.account-toggle:hover, .account-toggle[aria-expanded="true"] { border-color: var(--brand-ring); background: #f8fafc; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.account-email { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #334155; }
.account-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 260px; padding: 8px; box-shadow: 0 12px 32px #0f172a26; display: grid; gap: 2px; }
.account-menu-head { display: grid; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid #f1f5f9; margin-bottom: 4px; }
.account-menu-head small { color: #64748b; overflow: hidden; text-overflow: ellipsis; }
.account-menu button { width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; color: #0f172a; font: inherit; cursor: pointer; }
.account-menu button:hover, .account-menu button:focus-visible { background: #f1f5f9; }
.account-panel .card { margin-bottom: 20px; }
.account-panel h2 { margin: 0 0 12px; font-size: 18px; }
.account-panel input { display: block; width: 100%; margin: 8px 0 16px; padding: 12px; border: 1px solid #cbd5e1; border-radius: 10px; font: inherit; }
.account-panel input:focus { outline: 2px solid var(--brand-ring); border-color: var(--brand); }
.account-panel #telegram-form input { display: inline-block; flex: 1; min-width: 200px; margin: 0; }
.account-panel #telegram-form { margin-bottom: 12px; }
.profile-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 16px; color: #334155; }
.profile-facts dt { color: #64748b; }
.profile-facts dd { margin: 0; }
@media (max-width: 640px) { .account-email { display: none; } .account-toggle { padding: 2px; } }
@media (max-width: 650px) { .tour-trigger { width: 36px; height: 36px; justify-content: center; padding: 0; } .tour-trigger span { display: none; } }

.tour-shield { position: fixed; inset: 0; z-index: 70; }
.tour-spotlight { position: fixed; z-index: 71; border: 2px solid var(--brand); border-radius: 12px; box-shadow: 0 0 0 200vmax #0f172a99; pointer-events: none; }
.tour-card { position: fixed; z-index: 72; width: min(360px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); margin: 0; overflow-y: auto; box-shadow: 0 18px 52px #0f172a38; }
.tour-count { color: var(--brand); font-size: 12px; font-weight: 700; }
.tour-card h2 { margin: 8px 0; font-size: 20px; line-height: 1.25; }
.tour-card p { margin: 0 0 20px; color: #475569; font-size: 14px; line-height: 1.5; }
.tour-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.tour-actions #tour-skip { margin-right: auto; }
.tour-actions #tour-next { border: 0; border-radius: 8px; padding: 8px 14px; background: var(--brand); color: #fff; font-weight: 600; cursor: pointer; }
.tour-actions button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .tour-card, .tour-spotlight { scroll-behavior: auto; } }


.report-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 18px; }
.report-filters .segmented { margin: 0; max-width: 100%; overflow-x: auto; }
.report-filters .segmented button { white-space: nowrap; }
.report-filters .segmented button:focus-visible { outline: 2px solid var(--brand-ring); outline-offset: 1px; }
#report-body { transition: opacity .15s; }
#report-body.loading { opacity: .55; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.report-group { margin: 4px 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #64748b; }
@media (max-width: 900px) { .stat-grid, .stat-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .stat-grid, .stat-grid.three { grid-template-columns: 1fr; } }
.stat { position: relative; display: grid; grid-template-rows: auto auto 1fr; gap: 6px; padding: 16px 18px; }
#reports .stat { gap: 4px; padding: 12px 14px; }
#reports .stat-heading small { font-size: 12px; }
.stat-heading { display: flex; align-items: center; gap: 6px; min-width: 0; }
.stat .stat-heading small { min-width: 0; white-space: normal; overflow: visible; text-overflow: clip; }
.metric-help { flex: none; display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 1px solid #94a3b8; border-radius: 50%; background: #fff; color: #475569; font-size: 12px; font-weight: 700; line-height: 1; cursor: help; }
.metric-help:hover, .metric-help:focus-visible { border-color: var(--brand); color: var(--brand); }
.metric-help:focus-visible { outline: 2px solid var(--brand-ring); outline-offset: 2px; }
.stat .metric-tooltip { display: none; position: absolute; z-index: 10; top: 42px; left: 12px; right: 12px; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #334155; box-shadow: 0 8px 24px #0f172a26; font-size: 12px; font-weight: 400; line-height: 1.45; white-space: normal; pointer-events: none; }
.metric-help:hover + .metric-tooltip, .metric-help:focus + .metric-tooltip { display: block; }
.stat small { color: #64748b; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat strong { font-size: 28px; line-height: 1.1; color: #0f172a; font-variant-numeric: tabular-nums; }
.stat span { color: #64748b; font-size: 12px; }
.chart-card { position: relative; margin-bottom: 16px; }
.chart-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 8px; }
.chart-head h2 { margin: 0; font-size: 18px; }
.chart-head .small { margin-left: auto; padding: 6px 12px; font-size: 13px; }
.chart-legend { display: flex; gap: 16px; color: #334155; font-size: 13px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.key.s1, .bar.s1, .tip-key.s1 { background: #2a78d6; fill: #2a78d6; }
.key.s2, .bar.s2, .tip-key.s2 { background: #eb6834; fill: #eb6834; }
.daily-chart svg { display: block; }
.daily-chart .grid { stroke: #e2e8f0; stroke-width: 1; }
.daily-chart .axis { fill: #64748b; font-size: 11px; }
.daily-chart .hit { fill: transparent; outline: none; }
.daily-chart .hit.active, .daily-chart .hit:focus-visible { fill: #0f172a0d; }
.chart-tooltip { position: absolute; top: 48px; z-index: 5; min-width: 170px; padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; box-shadow: 0 8px 24px #0f172a1f; pointer-events: none; font-size: 13px; }
.tip-day { color: #64748b; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-row strong { min-width: 24px; font-variant-numeric: tabular-nums; color: #0f172a; }
.tip-row span { color: #475569; }
.tip-key { display: inline-block; width: 12px; height: 2px; }
.report-columns { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }
.report-columns .card, .reports-panel > #report-body > .card { margin: 0 0 16px; }
.reports-panel h2 { margin: 0 0 12px; font-size: 18px; }
@media (max-width: 760px) { .report-columns { grid-template-columns: 1fr; } }
.link-button { padding: 0; border: 0; background: none; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.sla-form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-top: 8px; }
.sla-form label { display: grid; gap: 4px; font-size: 12px; color: #475569; }
.sla-form input { width: 90px; padding: 7px 8px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; }
.sla-form button { padding: 7px 12px; font-size: 13px; }
.sla-form span { flex-basis: 100%; color: #b91c1c; font-size: 12px; }

.brand-mark, .logo-preview { overflow: hidden; }
.brand-mark.has-logo, .logo-preview.has-logo { background: #fff; border: 1px solid #e2e8f0; }
.brand-mark img, .logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.company-panel .card { margin-bottom: 20px; }
.company-panel h2 { margin: 0 0 12px; font-size: 18px; }
.company-panel input:not([type="file"]), .company-panel select { display: block; width: 100%; margin: 8px 0 18px; padding: 12px; border: 1px solid #cbd5e1; border-radius: 10px; font: inherit; background: #fff; }
.company-panel #company-sla { width: 140px; }
.field-label { display: block; margin-top: 4px; font-weight: 700; }
.logo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 10px 0 6px; }
.logo-preview { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; background: var(--brand); color: #fff; font-size: 22px; font-weight: 750; }
.secondary-button { display: inline-flex; align-items: center; padding: 10px 16px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: #0f172a; font-weight: 600; cursor: pointer; }
.form-status { display: block; min-height: 18px; margin-bottom: 12px; color: #475569; font-size: 13px; }
.client-text { margin-bottom: 16px; }
.client-text label { font-weight: 700; }
.client-text textarea { display: block; width: 100%; margin: 6px 0 4px; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; font: inherit; resize: vertical; }
.color-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0 18px; }
.color-row input[type="color"] { width: 48px; height: 44px; padding: 2px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; }
.company-panel .color-row input:not([type="color"]) { width: 130px; margin: 0; }
.color-sample { padding: 10px 16px; border-radius: 9px; background: var(--brand); color: #fff; font-weight: 600; }
.auth-support { margin-top: 16px; text-align: center; }

/* Icons (operator/icons.js): drawn with currentColor; tinted chips follow the platform --brand color. */
:root { --brand-soft: color-mix(in srgb, var(--brand) 12%, #fff); --brand-faint: color-mix(in srgb, var(--brand) 7%, #fff); --brand-ring: color-mix(in srgb, var(--brand) 45%, #fff); }
.icon { flex: none; width: 18px; height: 18px; vertical-align: -3px; }
.icon-chip { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.icon-chip .icon { width: 20px; height: 20px; }
.tab { display: inline-flex; flex: none; align-items: center; gap: 8px; white-space: nowrap; }
.tab .icon { opacity: .85; }
.tab.active .icon { opacity: 1; }
.tab-count { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: #f59e0b; color: #fff; font-size: 12px; line-height: 18px; text-align: center; }
.account-menu button { display: flex; align-items: center; gap: 10px; }
.account-menu button .icon { color: #64748b; }
#reply button, .actions button, .upload-button, .secondary, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
#reply button .icon { width: 17px; height: 17px; }
.panel-heading h1 { display: flex; align-items: center; gap: 12px; }
.panel-heading h1 .icon-chip { width: 40px; height: 40px; border-radius: 12px; }
.card h2[data-icon], .section-heading h2[data-icon], .chart-head h2 { display: flex; align-items: center; gap: 10px; }
h2[data-icon] > .icon { color: var(--brand); }
.stat small { display: flex; align-items: center; gap: 6px; }
.stat small > .icon { width: 16px; height: 16px; color: var(--brand); }
.conversation-head strong .icon { width: 15px; height: 15px; margin-right: 6px; vertical-align: -2px; color: var(--brand); }
.awaiting-badge { display: inline-flex; align-items: center; gap: 4px; }
.awaiting-badge .icon { width: 13px; height: 13px; }
.channel-list li button, .catalog li button { grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: center; }
.channel-list li button .icon-chip, .catalog li button .icon-chip { grid-row: span 2; }
.catalog li button:disabled .icon-chip { background: #f1f5f9; color: #94a3b8; }
.empty-state { display: grid; justify-items: start; gap: 4px; }
.chat-empty { margin: auto; display: grid; justify-items: center; gap: 8px; max-width: 340px; padding: 24px; text-align: center; color: #64748b; }
.chat-empty .icon-chip { width: 64px; height: 64px; border-radius: 20px; margin-bottom: 6px; }
.chat-empty .icon-chip .icon { width: 30px; height: 30px; }
.chat-empty strong { color: #172638; font-size: 17px; }
.chat-empty p { margin: 0; font-size: 14px; }
.fox-mark { width: 82%; height: 82%; }
.fox-tint { fill: #fff; fill-opacity: .62; }
.fox-white { fill: #fff; }
.fox-ink { fill: var(--brand); }
/* Header: the platform (small, quiet) / the company the staff member works in. */
.platform-badge { display: flex; align-items: center; gap: 8px; color: #475569; font-size: 15px; font-weight: 400; white-space: nowrap; }
.brand-mark.platform-mark { width: 28px; height: 28px; border-radius: 9px; }
.brand-divider { margin: 0 2px; color: #cbd5e1; font-size: 24px; font-weight: 300; }
#company-name { font-weight: 500; letter-spacing: .01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand { min-width: 0; }
@media (max-width: 650px) { .platform-name { display: none; } }
/* Widget avatar upload */
.avatar-field { grid-column: 1 / -1; margin: 0 0 14px; }
.avatar-field .logo-row { margin: 6px 0 4px; }
.widget-form .avatar-field label.upload-button.secondary-button { display: inline-flex; gap: 8px; margin: 0; font-size: 14px; }
.avatar-preview { width: 48px; height: 48px; border-radius: 50%; font-size: 18px; }
.avatar-preview.has-logo { background: #fff !important; }
.avatar-preview img { object-fit: cover; }
.brand strong { font-weight: 500; }

/* Unbounded, self-hosted (operator/fonts): only for the platform and company names in the top corner. */
@font-face { font-family: 'Unbounded'; font-style: normal; font-weight: 300 500; font-display: swap; src: url('/operator/fonts/unbounded-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Unbounded'; font-style: normal; font-weight: 300 500; font-display: swap; src: url('/operator/fonts/unbounded-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
.brand strong, .platform-name { font-family: 'Unbounded', system-ui, sans-serif; letter-spacing: -.01em; }
.brand strong { font-size: 16px; font-weight: 400; }
.platform-name { font-size: 13px; font-weight: 300; }

/* Footer: platform, help, support contact. Hidden on the full-height dialogues screen (help is in the avatar menu there). */
.app-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; padding: 22px 16px 28px; color: #94a3b8; font-size: 13px; }
.app-footer a { color: #64748b; text-decoration: none; }
.app-footer a:hover { color: var(--brand); text-decoration: underline; }
.auth-page { grid-template-rows: 1fr auto; }
.account-menu a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #0f172a; text-decoration: none; }
.account-menu a:hover, .account-menu a:focus-visible { background: #f1f5f9; }
.account-menu a .icon { color: #64748b; }

/* Help page */
.help-page header a.secondary { margin-left: auto; text-decoration: none; font-weight: 600; }
.help-layout { display: grid; grid-template-columns: 230px minmax(0, 760px); gap: 40px; justify-content: center; padding: 28px 20px 20px; }
.help-toc { position: sticky; top: 20px; align-self: start; display: grid; gap: 2px; height: auto; padding: 0; background: none; border: 0; }
.help-toc a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: #475569; font-weight: 600; font-size: 14px; text-decoration: none; }
.help-toc a:hover { background: var(--brand-faint); color: var(--brand); }
.help-toc .icon { width: 16px; height: 16px; color: var(--brand); }
.help-content { line-height: 1.6; }
.help-content section { padding: 26px 30px; margin-bottom: 18px; background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; scroll-margin-top: 16px; }
.help-content h1 { margin: 0 0 10px; font-size: 26px; }
.help-content h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 21px; }
.help-content h2 .icon { width: 22px; height: 22px; color: var(--brand); }
#start h2 { margin-top: 26px; }
.help-content h3 { display: flex; align-items: center; gap: 8px; margin: 22px 0 8px; font-size: 16px; }
.help-content h3 .icon { color: var(--brand); }
.help-content a { color: var(--brand); }
.help-content li { margin-bottom: 6px; }
.help-content .lead { font-size: 16px; color: #334155; }
.help-content code { padding: 1px 6px; border-radius: 6px; background: #f1f5f9; font-size: 13px; }
.help-content pre { margin: 10px 0; padding: 14px 16px; overflow-x: auto; border-radius: 12px; background: #f8fafc; border: 1px solid #e2e8f0; font: 13.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.help-content .note { padding: 12px 14px; border-radius: 12px; background: var(--brand-faint); color: #334155; font-size: 14px; }
.steps { padding-left: 22px; }
.steps a { font-size: 13px; }
.example summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.help-terms { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 0; }
.help-terms dt { font-weight: 700; }
.help-terms dd { margin: 0; color: #334155; }
@media (max-width: 860px) {
  .help-layout { grid-template-columns: 1fr; gap: 16px; padding: 16px 12px; }
  .help-toc { position: static; display: flex; overflow-x: auto; scrollbar-width: none; }
  .help-toc a { flex: none; background: #fff; border: 1px solid #e2e8f0; }
  .help-content section { padding: 18px 16px; }
  .help-terms { grid-template-columns: 1fr; gap: 2px; }
  .help-terms dd { margin-bottom: 10px; }
}

/* Layout: header on top, sections in a left sidebar, every section the same width (up to 1200px). */
.userbox { margin-left: auto; }
.app-body { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100dvh - 64px); }
.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-main > main:not(.dialogues) { flex: 1; }
.sidebar { position: sticky; top: 0; align-self: start; height: calc(100dvh - 64px); overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 16px 12px; background: #fff; border-right: 1px solid #e2e8f0; }
.sidebar .tab { width: 100%; justify-content: flex-start; padding: 9px 12px; border: 0; border-radius: 10px; color: #475569; text-align: left; white-space: normal; }
.sidebar .tab:hover { background: #f1f5f9; color: #0f172a; }
.sidebar .tab.active { background: var(--brand-faint); color: var(--brand); }
.sidebar .tab-count { margin-left: auto; }
.nav-sub { display: grid; gap: 1px; margin: 2px 0 6px 21px; padding-left: 10px; border-left: 1px solid #e2e8f0; }
/* «Диалоги» with its fold arrow is one item: the row carries the hover and active background. */
.tab-row { display: flex; align-items: center; border-radius: 10px; }
.tab-row:hover { background: #f1f5f9; }
.tab-row:has(.tab.active) { background: var(--brand-faint); }
.sidebar .tab-row .tab { flex: 1; min-width: 0; padding-right: 4px; background: transparent; }
.nav-expand { flex: none; display: grid; place-items: center; width: 30px; height: 30px; margin-right: 4px; padding: 0; border: 0; border-radius: 8px; background: none; color: #64748b; cursor: pointer; }
.nav-expand:hover { background: #0f172a0d; color: #0f172a; }
.tab-row:has(.tab.active) .nav-expand { color: var(--brand); }
.nav-expand .icon { width: 16px; height: 16px; transition: transform .15s; }
.nav-expand[aria-expanded="false"] .icon { transform: rotate(-90deg); }
.nav-sub.collapsed { display: none; }
.nav-sub button { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 0; border-radius: 8px; background: none; color: #64748b; font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.nav-sub button:hover { background: #f1f5f9; color: #0f172a; }
.nav-sub button.on { color: var(--brand); font-weight: 600; }
.nav-sub button .icon { width: 15px; height: 15px; }
.sub-count { margin-left: auto; min-width: 18px; padding: 0 5px; border-radius: 999px; background: #f59e0b; color: #fff; font-size: 11px; font-weight: 700; line-height: 17px; text-align: center; }
.list-empty { margin: 0; padding: 24px 16px; color: #64748b; font-size: 14px; text-align: center; }
.nav-toggle { display: none; }
@media (max-width: 900px) {
  .nav-toggle { display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; padding: 0; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; color: #334155; cursor: pointer; }
  .nav-toggle .icon { width: 20px; height: 20px; }
  .app-body { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 64px; left: 0; bottom: 0; z-index: 40; width: min(280px, 85vw); height: auto; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 16px 40px #0f172a2e; }
  body.nav-open .sidebar { transform: none; }
  .settings-panel { padding: 20px 16px 48px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
#mode { padding: 7px 14px; font-size: 14px; }


/* App shell: header and footer span the full width and stay put; the sidebar stays put; only the section scrolls. */
body:has(> .app-body) { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body:has(> .app-body) > header, body:has(> .app-body) > .acting-bar { flex: none; }
body > .app-body { flex: 1; min-height: 0; }
body > .app-body > .sidebar { position: static; height: auto; align-self: stretch; }
.app-main { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.app-main > .dialogues { flex: 1; height: auto; min-height: 0; }
.app-bar { flex: none; justify-content: center; gap: 6px 22px; padding: 10px 28px; background: #fff; border-top: 1px solid #e2e8f0; font-size: 12.5px; }
@media (max-width: 900px) {
  body > .app-body > .sidebar { position: fixed; top: 64px; bottom: 0; height: auto; }
  .app-bar { padding: 8px 12px; }
}

/* Widget launcher icon picker */
.launcher-field { margin: 0 0 14px; }
.launcher-icons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.widget-form .launcher-icons label.launcher-icon { display: block; margin: 0; cursor: pointer; }
.launcher-icon { position: relative; }
.launcher-icon input { position: absolute; opacity: 0; pointer-events: none; }
.launcher-icon-face { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--w-color, #1f93ff); color: #fff; box-shadow: 0 0 0 3px #fff, 0 0 0 4px #e2e8f0; transition: box-shadow .15s; }
.launcher-icon-face svg { width: 26px; height: 26px; }
.launcher-icon input:checked + .launcher-icon-face { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--brand); }
.launcher-icon input:focus-visible + .launcher-icon-face { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--brand-ring); }

/* Agent switches */
.agent-switches { display: grid; gap: 12px; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid #f1f5f9; }
.card label.switch { position: relative; display: flex; align-items: flex-start; gap: 12px; margin: 0; font-weight: 400; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: relative; flex: none; width: 40px; height: 24px; margin-top: 1px; border-radius: 999px; background: #cbd5e1; transition: background .15s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0f172a33; transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--brand-ring); outline-offset: 2px; }
.switch-text { display: grid; gap: 2px; }
.switch-text small { color: #64748b; font-size: 13px; }
.switch.muted { opacity: .5; cursor: default; }

/* Working hours */
.working-hours { display: grid; gap: 8px; margin: 6px 0 14px; }
.hours-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 40px; }
.card label.hours-day { display: flex; align-items: center; gap: 9px; width: 150px; margin: 0; font-weight: 600; cursor: pointer; }
.hours-day input { width: 17px; height: 17px; accent-color: var(--brand); }
.company-panel .hours-row input[type="time"] { display: inline-block; width: 120px; margin: 0; padding: 8px 10px; }
.hours-off { color: #94a3b8; font-size: 14px; }
.working-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.company-panel .hours-day input { display: inline-block; width: 17px; margin: 0; padding: 0; }
.alert-switches { display: grid; gap: 12px; margin: 4px 0 16px; }
.account-panel .switch input { width: auto; margin: 0; }

/* Report PDF: printed through the browser on A4 */
.report-pdf { margin-left: auto; }
.print-head { display: none; }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  html, body { background: #fff !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body:has(> .app-body) { display: block; height: auto; overflow: visible; }
  body > .app-body { display: block; }
  .app-main { overflow: visible; }
  header, .sidebar, .app-bar, .acting-bar, #status, .report-filters, .panel-heading, #chart-table-toggle, .chart-tooltip, .metric-help, .metric-tooltip, .link-button, .sla-form, .account-menu, .tour-shield, .tour-spotlight, .tour-card { display: none !important; }
  .app-main > main:not(#reports) { display: none !important; }
  .settings-panel { max-width: none; padding: 0; }
  .print-head { display: grid; gap: 4px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid var(--brand); }
  .print-head strong { font-size: 20px; }
  .print-head span { color: #475569; font-size: 12px; }
  #report-body.loading { opacity: 1; }
  .card { box-shadow: none; break-inside: avoid; }
  .stat-grid, .stat-grid.three { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .stat-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat { padding: 10px 12px; }
  #reports .stat { padding: 10px 12px; }
  .stat small { white-space: normal; }
  .stat strong { font-size: 22px; }
  .report-columns { grid-template-columns: 2fr 1fr; }
  .users-table { font-size: 11.5px; }
  .users-table th, .users-table td { padding: 6px; }
  .daily-chart { break-inside: avoid; }
}

/* Loader while a conversation opens */
.chat-loading { margin: auto; display: grid; place-items: center; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* Effect block in reports and its settings */
.stat.effect { background: var(--brand-faint); border-color: var(--brand-soft); }
.stat.effect strong { color: var(--brand); }
.company-panel #company-minutes, .company-panel #company-rate { width: 180px; }
.company-panel .switch input { width: auto; margin: 0; padding: 0; }
.company-panel label.switch { margin: 6px 0 16px; }
.digest-actions span { color: #475569; font-size: 13px; }

/* Start-up loader over the whole panel until the first data arrives */
.app-splash { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: #f5f7fb; transition: opacity .25s ease, visibility .25s; }
/* Skeleton of the panel: header, sidebar, conversation cards and a few bubbles. */
.sk { display: block; border-radius: 8px; background: linear-gradient(90deg, #e8edf3 25%, #f3f6fa 45%, #e8edf3 65%); background-size: 300% 100%; animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
.sk-head { flex: none; height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 28px; background: #fff; border-bottom: 1px solid #e2e8f0; }
.sk-head .mark { width: 30px; height: 30px; border-radius: 9px; }
.sk-head .line { height: 14px; }
.sk-head .avatar { width: 36px; height: 36px; border-radius: 50%; margin-left: auto; }
.sk-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 240px minmax(240px, 320px) 1fr; }
.sk-side { display: grid; align-content: start; gap: 18px; padding: 24px 22px; background: #fff; border-right: 1px solid #e2e8f0; }
.sk.nav { height: 12px; }
.sk-list { background: #fff; border-right: 1px solid #e2e8f0; overflow: hidden; }
.sk-card { display: grid; gap: 10px; padding: 16px; border-bottom: 1px solid #edf1f5; }
.sk-card .sk { height: 11px; }
.sk-chat { display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.sk.bubble { height: 52px; width: 42%; border-radius: 14px; }
.sk.bubble.right { align-self: flex-end; width: 50%; }
.sk.bubble.short { width: 28%; }
.sk.w20 { width: 160px; } .sk.w45 { width: 45%; } .sk.w50 { width: 50%; } .sk.w55 { width: 55%; } .sk.w60 { width: 60%; }
.sk.w65 { width: 65%; } .sk.w70 { width: 70%; } .sk.w75 { width: 75%; } .sk.w80 { width: 80%; } .sk.w90 { width: 90%; }
@media (max-width: 900px) { .sk-body { grid-template-columns: minmax(200px, 320px) 1fr; } .sk-side { display: none; } }
@media (max-width: 650px) { .sk-body { grid-template-columns: 1fr; } .sk-chat { display: none; } .sk-head { padding: 0 12px; } }
.app-splash.done { opacity: 0; visibility: hidden; pointer-events: none; }
@media print { .app-splash { display: none; } }
.digest-when { display: flex; flex-wrap: wrap; gap: 16px 20px; margin: 16px 0 18px; }
.card .digest-when label { display: grid; gap: 6px; margin: 0; font-weight: 600; font-size: 14px; }
.digest-when select { padding: 9px 10px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; font: inherit; }
.digest-when select:disabled { color: #94a3b8; background: #f8fafc; }

/* Thin scrollbars in the platform brand color across the panel. */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--brand) 38%, #fff) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 999px; background: color-mix(in srgb, var(--brand) 38%, #fff) padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--brand) 60%, #fff); }

/* Ratings */
.stat-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1200px) { .stat-grid.five { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .stat-grid.five { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .stat-grid.five { grid-template-columns: 1fr; } }
@media print { .stat-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.answer-cell { max-width: 520px; color: #334155; }
.rating-mark { font-size: 12px; }

/* Resolved conversations */
.conversations-pane { display: flex; flex-direction: column; }
.list-filter { position: sticky; top: 0; z-index: 1; display: flex; margin: 0; padding: 8px; border-radius: 0; background: #fff; border-bottom: 1px solid #edf1f5; }
.list-filter button { flex: 1; justify-content: center; }
.segmented.list-filter button.on { background: var(--brand-faint); box-shadow: none; }
.resolved-badge { display: inline-flex; align-items: center; gap: 4px; width: fit-content; margin: 4px 0; padding: 2px 8px; border-radius: 999px; background: #dcfce7; color: #166534; font-size: 12px; font-weight: 700; }
.resolved-badge .icon { width: 13px; height: 13px; }
.application-badge { display: inline-flex; width: fit-content; margin: 4px 0; padding: 2px 8px; border-radius: 999px; background: #dbeafe; color: #1d4ed8; font-size: 12px; font-weight: 700; }
#resolve { padding: 6px 12px; font-size: 14px; font-weight: 600; }
#resolve.is-resolved { color: #166534; border-color: #bbf7d0; background: #f0fdf4; }

/* Launcher style: round or pill */
.launcher-style { margin: 0 0 16px; }
.launcher-style .segmented { margin: 6px 0 12px; }
#pill-fields .field-row.quick { margin-bottom: 8px; }
.check-note { color: #64748b; font-weight: 400; }
.warning-note { margin-bottom: 16px; padding: 12px 16px; border: 1px solid #fcd34d; border-radius: 12px; background: #fffbeb; color: #78350f; font-size: 14px; }
.warning-note .link-button { color: #92400e; font-weight: 600; }

/* Phones: the list and the open conversation take the whole width in turn; «←» returns to the list. */
.chat-back { display: none; }
@media (max-width: 650px) {
  .app-main > .dialogues { grid-template-columns: minmax(0, 1fr); }
  .dialogues:not(.chat-open) .chat, .dialogues.chat-open .conversations-pane { display: none; }
  .conversations-pane { border-right: 0; }
  .chat-back { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; margin-left: -6px; padding: 0; border: 0; border-radius: 10px; background: none; color: #334155; cursor: pointer; }
  .chat-back .icon { width: 22px; height: 22px; }
  .chat-title { padding: 8px 12px; gap: 6px 8px; }
  .chat-title > button:not(.chat-back) { padding: 6px 10px; font-size: 13px; }
  .chat-title > #conversation-title { margin-right: auto; }
  .chat-title > #conversation-title:has(+ .chat-page:not([hidden])) { margin-right: 0; }
  .chat-title > .chat-page { flex-basis: 100%; order: 1; }
  .lead-strip { gap: 4px 12px; padding-top: 8px; font-size: 14px; }
  #reply { gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  /* 16px keeps iOS Safari from zooming into the field on focus. */
  #message { font-size: 16px; padding: 10px 12px; }
  #reply button { padding: 10px 14px; }
  .bubble { max-width: 88%; }
}

/* Company switcher in the avatar menu: shown only to people who work in more than one company. */
.company-switch { display: grid; gap: 2px; padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid #f1f5f9; }
.company-switch-title { padding: 4px 10px 2px; color: #64748b; font-size: 12px; }
.account-menu .company-switch-item { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 8px; }
.company-switch-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-switch-item small { color: #64748b; font-size: 12px; }
.company-switch-item.current { background: #f1f5f9; font-weight: 600; }

/* Question–answer pairs in «Настройки агента». */
.knowledge-list .faq-make { margin-left: 0; }
.knowledge-list .faq-state { margin-left: 0; color: #64748b; font-size: 13px; }
.knowledge-list .faq-state.failed { color: #b91c1c; }
.faq-group { margin: 26px 0 8px; font-size: 16px; }
.faq-count { color: #64748b; font-weight: 400; }
.faq-list { list-style: none; padding: 0; margin: 0; }
.faq-list > li { padding: 14px 0; border-top: 1px solid #e2e8f0; }
.faq-list > li.faq-empty { color: #64748b; }
.faq-view strong { display: block; overflow-wrap: anywhere; }
.faq-view p { margin: 4px 0 0; color: #334155; white-space: pre-wrap; overflow-wrap: anywhere; }
.faq-meta { display: block; margin-top: 6px; color: #64748b; font-size: 12px; }
.faq-edit { display: grid; gap: 10px; }
.faq-edit label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: #475569; }
.faq-edit input, .faq-card .faq-edit textarea { width: 100%; margin: 0; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 9px; font-weight: 400; color: #172638; resize: vertical; }
.faq-edit input:focus, .faq-card .faq-edit textarea:focus { outline: 2px solid var(--brand-ring); border-color: var(--brand); }
#faq-new { margin-top: 18px; padding: 16px; border: 1px solid #e2e8f0; border-radius: 12px; background: var(--brand-faint); }
.faq-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.faq-primary { border: 0; border-radius: 8px; padding: 8px 14px; background: var(--brand); color: white; cursor: pointer; font-weight: 600; }


/* Pop-up windows of the knowledge base: collecting a site and reading a file. */
.modal { width: min(560px, calc(100vw - 32px)); box-sizing: border-box; padding: 22px; border: 0; border-radius: 16px; background: white; color: #0f172a; box-shadow: 0 20px 60px #0f172a40; }
.modal::backdrop { background: #0f172a66; }
.modal h2 { margin: 0 0 14px; font-size: 18px; }
.modal label { display: grid; gap: 6px; }
.modal-error { color: #b91c1c; min-height: 1em; }
.modal-wide { width: min(880px, calc(100vw - 32px)); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; }
.modal-head h2 { margin-right: auto; overflow-wrap: anywhere; }
#knowledge-view-text { max-height: 65vh; overflow: auto; margin: 0; padding: 14px; border-radius: 10px; background: #f8fafc; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
.knowledge-list .file-open { padding: 0; border: 0; background: none; color: #1d4ed8; font: inherit; font-weight: 600; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.knowledge-list .file-open:hover { text-decoration: underline; }
.modal .actions .secondary { background: white; color: #334155; border: 1px solid #cbd5e1; }

/* Page invitation rules in the site settings. */
.invitation-rules { display: grid; gap: 12px; margin: 8px 0; }
.invitation-rule { display: grid; gap: 8px; padding: 12px; border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; }
.invitation-rule label { display: grid; gap: 4px; }
.invitation-rule .check { display: flex; align-items: center; gap: 8px; }
.invitation-rule > button { justify-self: start; }
.read-mark { align-self: flex-end; margin: -4px 4px 8px; color: #64748b; font-size: 12px; }
.read-mark.unread { color: #94a3b8; }
.taker-badge { display: inline-flex; width: fit-content; margin: 4px 0; padding: 2px 8px; border-radius: 999px; background: #f1f5f9; color: #475569; font-size: 12px; font-weight: 700; }
.visitor-invite { display: block; margin-top: 4px; color: #64748b; font-size: 12px; }

/* Tabs inside a settings card: site settings and agent settings. */
.tabs { display: flex; flex-wrap: wrap; gap: 0 4px; margin: -8px 0 22px; border-bottom: 1px solid #e2e8f0; }
.tabs button { display: inline-flex; flex: none; align-items: center; gap: 6px; margin-bottom: -1px; padding: 10px 12px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: #475569; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.tabs button:hover:not(:disabled) { color: #0f172a; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.tabs button:disabled { cursor: not-allowed; }
.tabs button:focus-visible { outline: 2px solid var(--brand-ring); outline-offset: -2px; }
.site-origins h2 { margin-top: 0; }
.widget-layout.single { grid-template-columns: minmax(0, 1fr); }
