* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: #f6f7f9; color: #1f2937; }
nav { background: #172033; color: #fff; padding: 12px 28px; display: flex; justify-content: space-between; align-items: center; }
nav a { color: #d1d5db; text-decoration: none; margin-left: 18px; font-size: 14px; }
nav a:hover { color: #fff; }
.brand { font-weight: 700; letter-spacing: 0; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; transition: grid-template-columns .18s ease; }
.admin-sidebar { background: #172033; color: #fff; padding: 18px 16px; display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.admin-sidebar a { color: #d1d5db; text-decoration: none; border-radius: 6px; padding: 10px 12px; font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.admin-sidebar a:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-brand { color: #fff !important; font-size: 17px !important; margin-bottom: 10px; }
.nav-icon { width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.1); color: #fff; flex: 0 0 24px; }
.nav-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-text { overflow: hidden; text-overflow: ellipsis; }
.nav-logout { margin-top: auto; }
.admin-main { min-width: 0; }
.admin-menu-toggle { display: none; }
.menu-button { display: none; width: 38px; height: 38px; border-radius: 6px; align-items: center; justify-content: center; flex-direction: column; gap: 4px; cursor: pointer; background: #172033; box-shadow: 0 8px 20px rgba(15,23,42,.18); }
.menu-button span { width: 18px; height: 2px; background: #e5e7eb; border-radius: 999px; }
.sidebar-toggle { width: 36px; height: 36px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 4px; cursor: pointer; margin: 0 0 12px 6px; }
.sidebar-toggle:hover { background: rgba(255,255,255,.08); }
.sidebar-toggle span { width: 18px; height: 2px; background: #e5e7eb; border-radius: 999px; }
.admin-menu-toggle:checked ~ .app-shell { grid-template-columns: 72px 1fr; }
.admin-menu-toggle:checked ~ .app-shell .admin-sidebar { padding-left: 12px; padding-right: 12px; }
.admin-menu-toggle:checked ~ .app-shell .nav-text { display: none; }
.admin-menu-toggle:checked ~ .app-shell .admin-sidebar a { padding-left: 12px; padding-right: 12px; justify-content: center; }
.admin-menu-toggle:checked ~ .app-shell .admin-brand { margin-bottom: 10px; }
.admin-menu-toggle:checked ~ .app-shell .sidebar-toggle { margin-left: 6px; }
.container { padding: 24px 32px; }
.panel { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 22px; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 18px; }
.stat-value { font-size: 30px; font-weight: 750; color: #2563eb; }
.stat-label { color: #6b7280; font-size: 13px; margin-top: 4px; }
h1 { font-size: 24px; margin: 0 0 18px; }
h2 { font-size: 18px; margin: 0 0 14px; }
.page-toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.page-toolbar h1 { margin-bottom: 0; }
.page-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.page-title h1 { overflow-wrap: anywhere; }
.filters-form { display: flex; align-items: center; gap: 10px; }
.filters-form select,
.filters-form input { width: auto; min-width: 150px; }
.sale-filters { margin-bottom: 16px; }
.sale-filters input[name="phone"] { min-width: 220px; }
.custom-date-range { display: flex; align-items: center; gap: 10px; }
.custom-date-range.is-hidden { display: none; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; background: #f9fafb; border-bottom: 1px solid #e5e7eb; padding: 10px 12px; font-weight: 650; }
td { border-bottom: 1px solid #eef0f3; padding: 10px 12px; vertical-align: middle; }
.abbr-header { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.abbr-help { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background: #e5e7eb; color: #4b5563; font-size: 11px; line-height: 1; font-weight: 800; cursor: help; outline: none; }
.abbr-help::after { content: attr(aria-label); position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: 20; transform: translateX(-50%); width: max-content; max-width: 260px; padding: 8px 10px; border-radius: 6px; background: #111827; color: #fff; box-shadow: 0 10px 24px rgba(15,23,42,.24); font-size: 12px; line-height: 1.35; font-weight: 500; white-space: normal; opacity: 0; visibility: hidden; pointer-events: none; }
.abbr-help::before { content: ""; position: absolute; left: 50%; bottom: calc(100% + 3px); z-index: 21; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #111827; opacity: 0; visibility: hidden; pointer-events: none; }
.abbr-help:hover::after,
.abbr-help:hover::before,
.abbr-help:focus::after,
.abbr-help:focus::before { opacity: 1; visibility: visible; }
.analytics-row.roi-positive { background: rgba(22,163,74,var(--roi-alpha)); }
.analytics-row.roi-negative { background: rgba(220,38,38,var(--roi-alpha)); }
.sale-unread-row { background: #fee2e2; }
.sale-folder-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin: 0 0 10px; }
.sale-folder-tabs { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.sale-folder-tab { flex: 0 1 auto; display: inline-flex; align-items: center; gap: 7px; max-width: 180px; padding: 7px 9px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; color: #374151; text-decoration: none; font-size: 12px; font-weight: 750; }
.sale-folder-tab span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sale-folder-tab:hover { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }
.sale-folder-tab.is-active { border-color: #2563eb; box-shadow: inset 0 0 0 1px #2563eb; color: #1d4ed8; }
.sale-folder-tab.is-drop-target { border-color: #16a34a; background: #ecfdf5; color: #166534; }
.sale-folder-dot { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
#saleFolderColor { width: 54px; min-width: 54px; height: 38px; padding: 3px; }
.sale-folder-name { display: inline-flex; align-items: center; gap: 7px; max-width: 160px; font-weight: 650; color: #374151; }
.sale-folder-name span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr.is-dragging { opacity: .55; }
.sale-lead-note-cell { min-width: 220px; max-width: 360px; color: #374151; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.muted { color: #9ca3af; }
.script-active-row { background: #ecfdf5; }
tfoot td { background: #f9fafb; border-top: 1px solid #d1d5db; font-weight: 750; }
.table-link { color: #2563eb; font-weight: 650; text-decoration: none; }
.table-link:hover { text-decoration: underline; }
.sort-link { color: #374151; text-decoration: none; font-weight: 750; white-space: nowrap; }
.sort-link:hover,
.sort-link.is-active { color: #2563eb; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.btn { display: inline-block; border: 0; border-radius: 6px; padding: 8px 13px; font-size: 13px; font-weight: 650; text-decoration: none; cursor: pointer; background: #e5e7eb; color: #111827; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-success { background: #16a34a; color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-warning { background: #d97706; color: #fff; }
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; line-height: 1; flex: 0 0 36px; }
.btn-icon.btn-sm { width: 30px; height: 30px; flex-basis: 30px; }
.btn-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-icon.btn-sm svg { width: 16px; height: 16px; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #e5e7eb; }
.badge-new { background: #dbeafe; color: #1d4ed8; }
.badge-contacted { background: #fef3c7; color: #a16207; }
.badge-payment { background: #ffedd5; color: #c2410c; }
.badge-converted { background: #dcfce7; color: #15803d; }
.badge-lost { background: #fee2e2; color: #b91c1c; }
.role-badge { color: #fff; }
.role-badge-super_admin { background: #111827; color: #fff; }
.role-badge-admin { background: #dc2626; color: #fff; }
.role-badge-sale { background: #16a34a; color: #fff; }
.role-badge-buyer { background: #2563eb; color: #fff; }
.field { margin-bottom: 14px; }
label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 5px; color: #4b5563; }
.label-with-help { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.help-icon { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; flex: 0 0 16px; border: 1px solid #cbd5e1; border-radius: 999px; color: #64748b; background: #f8fafc; font-size: 11px; font-weight: 800; line-height: 1; cursor: help; }
.help-icon::after { content: attr(data-tooltip); position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: 30; display: none; width: max-content; max-width: 280px; transform: translateX(-50%); padding: 8px 10px; border-radius: 6px; background: #111827; color: #fff; font-size: 12px; font-weight: 500; line-height: 1.35; white-space: normal; box-shadow: 0 10px 24px rgba(15, 23, 42, .18); }
.help-icon::before { content: ""; position: absolute; left: 50%; bottom: calc(100% + 3px); z-index: 31; display: none; width: 10px; height: 10px; transform: translateX(-50%) rotate(45deg); background: #111827; }
.help-icon:hover::before,
.help-icon:hover::after,
.help-icon:focus::before,
.help-icon:focus::after { display: block; }
.field-help { color: #6b7280; font-size: 12px; line-height: 1.45; margin: -1px 0 7px; }
.readonly-value { width: 100%; padding: 9px 11px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 14px; background: #f9fafb; color: #111827; }
input, select { width: 100%; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; background: #fff; }
select[multiple] { min-height: 130px; }
.form-card { max-width: 640px; }
.wide-form-card { max-width: none; }
.wide-form-card textarea { width: 100%; min-height: 360px; resize: vertical; }
textarea { width: 100%; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; background: #fff; font-family: inherit; resize: vertical; }
.voice-agent-form-panel { width: 100%; max-width: none; }
.voice-agent-top-grid { display: grid; grid-template-columns: minmax(320px, 2fr) repeat(5, minmax(140px, 1fr)) minmax(110px, .6fr); gap: 12px; align-items: end; margin-bottom: 8px; }
.voice-agent-name-field { min-width: 0; }
.voice-agent-text-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(380px, .75fr); gap: 18px; align-items: start; }
.voice-agent-phrases { min-width: 0; display: grid; gap: 12px; }
.voice-agent-form textarea { min-height: 90px; }
.voice-agent-form .voice-agent-prompt textarea { min-height: 520px; }
.voice-agent-form .voice-agent-escalation textarea { min-height: 238px; }
.voice-agent-form .voice-agent-phrase textarea { min-height: 112px; }
.voice-agent-checkbox-field { display: flex; align-items: center; min-height: 38px; padding-bottom: 3px; }
.tab-bar { display: flex; gap: 6px; border-bottom: 1px solid #e5e7eb; margin: -4px 0 18px; }
.tab-link { color: #4b5563; text-decoration: none; padding: 10px 12px; border-radius: 6px 6px 0 0; font-size: 14px; font-weight: 750; }
.tab-link:hover { background: #eef2ff; color: #1d4ed8; }
.tab-link.is-active { background: #fff; color: #1d4ed8; border: 1px solid #e5e7eb; border-bottom-color: #fff; margin-bottom: -1px; }
.ai-test-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; align-items: start; }
.ai-test-sidebar { position: sticky; top: 18px; }
.ai-test-dialogs { display: grid; gap: 8px; margin-top: 16px; }
.ai-test-dialog { display: block; text-decoration: none; color: #111827; border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 12px; background: #f9fafb; }
.ai-test-dialog:hover,
.ai-test-dialog.is-active { border-color: #93c5fd; background: #eff6ff; }
.ai-test-dialog strong { display: block; font-size: 14px; margin-bottom: 3px; }
.ai-test-dialog span { color: #6b7280; font-size: 12px; }
.ai-test-chat-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.ai-test-chat-header h2 { margin-bottom: 7px; }
.ai-test-live-status { margin: 0; color: #2563eb; font-weight: 650; }
.ai-test-workspace { display: grid; gap: 14px; }
.ai-test-conversation { min-width: 0; }
.ai-test-crm { border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px; background: #f9fafb; margin-bottom: 14px; }
.ai-test-crm summary { cursor: pointer; font-size: 14px; font-weight: 800; color: #111827; }
.ai-test-crm .sale-crm-card { margin-top: 10px; max-height: 260px; }
.ai-test-messages { display: grid; gap: 10px; margin-bottom: 18px; max-height: 58vh; overflow-y: auto; padding-right: 4px; }
.ai-test-message { max-width: 76%; border-radius: 8px; padding: 10px 12px; border: 1px solid #e5e7eb; background: #f9fafb; }
.ai-test-message span { display: block; font-size: 11px; font-weight: 800; color: #6b7280; text-transform: uppercase; margin-bottom: 5px; }
.ai-test-message p { margin: 0; line-height: 1.45; }
.ai-test-attachment { margin-top: 8px !important; color: #2563eb; font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.ai-test-message-user { margin-left: auto; background: #eff6ff; border-color: #bfdbfe; }
.ai-test-message-assistant { margin-right: auto; background: #f8fafc; }
.ai-test-message-system { max-width: none; background: #fef3c7; border-color: #fde68a; }
.ai-test-composer { border-top: 1px solid #e5e7eb; padding-top: 16px; }
.ai-test-composer-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; min-height: 38px; }
.ai-agent-analytics-note { margin-top: 14px; margin-bottom: 0; }
.errorlist { color: #b91c1c; margin: 8px 0; padding-left: 18px; font-size: 13px; }
.messages { margin-bottom: 16px; }
.message { padding: 10px 14px; border-radius: 6px; background: #e0f2fe; color: #075985; font-size: 14px; }
.search { display: flex; gap: 10px; margin-bottom: 16px; }
.search input { flex: 1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.copy { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 10px 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
.hint { color: #6b7280; font-size: 13px; line-height: 1.45; margin: -4px 0 16px; }
.sale-chat-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; overflow: visible; padding-bottom: 2px; }
.sale-chat-tab { flex: 0 1 auto; display: inline-flex; align-items: stretch; max-width: 180px; border: 1px solid #d1d5db; border-radius: 6px; overflow: hidden; background: #fff; }
.sale-chat-tab a { min-width: 0; max-width: 150px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; color: #374151; text-decoration: none; font-size: 12px; font-weight: 750; }
.sale-chat-tab a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sale-chat-tab a strong { min-width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: #dc2626; color: #fff; font-size: 11px; line-height: 1; }
.sale-chat-tab button { width: 26px; border: 0; border-left: 1px solid #e5e7eb; background: #f9fafb; color: #6b7280; cursor: pointer; font-size: 12px; font-weight: 800; }
.sale-chat-tab button:hover { background: #e5e7eb; color: #111827; }
.sale-chat-tab.is-active { border-color: #2563eb; box-shadow: inset 0 0 0 1px #2563eb; }
.sale-chat-tab.has-unread { border-color: #dc2626; background: #fef2f2; }
.sale-chat-tab.has-unread a { color: #991b1b; }
.sale-chat-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr); gap: 14px; align-items: stretch; }
.sale-chat-main { min-width: 0; }
.sale-chat-sidebar { display: grid; gap: 8px; align-self: start; position: sticky; top: 14px; }
.sale-chat-sidebar .panel { margin-bottom: 0; }
.sale-dialog-meta { display: grid; gap: 3px; padding: 7px 9px; border: 1px solid #e5e7eb; border-radius: 6px; background: #f9fafb; color: #6b7280; font-size: 11px; line-height: 1.35; }
.sale-dialog-meta-row { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 6px; min-width: 0; }
.sale-dialog-meta-label { color: #9ca3af; font-weight: 700; }
.sale-dialog-meta-value { min-width: 0; color: #4b5563; overflow-wrap: anywhere; }
.sale-control-panel { padding: 12px; }
.sale-control-panel h2 { margin-bottom: 8px; }
.sale-sidebar-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.sale-sidebar-tab { border: 1px solid #d1d5db; border-radius: 6px; background: #fff; color: #4b5563; font-size: 13px; font-weight: 800; padding: 8px 9px; cursor: pointer; }
.sale-sidebar-tab.is-active { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; }
.sale-sidebar-tab-panel[hidden] { display: none; }
.sale-chat-status-actions { display: grid; gap: 7px; }
.sale-chat-status-actions form { margin: 0; }
.sale-chat-status-actions .btn,
.sale-chat-status-actions form,
.sale-chat-status-actions form .btn { width: 100%; }
.sale-folder-select-form label { margin-bottom: 4px; }
.sale-folder-select-form select { width: 100%; }
.sale-chat-title { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.sale-chat-title > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.sale-chat-title-folder { display: inline-flex; align-items: center; gap: 7px; min-width: 0; color: #4b5563; font-size: 14px; font-weight: 750; }
.sale-chat-title-folder::before { content: "("; color: #9ca3af; font-weight: 500; }
.sale-chat-title-folder::after { content: ")"; color: #9ca3af; font-weight: 500; }
.sale-chat-title-folder span:last-child { min-width: 0; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sale-chat-action-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.sale-chat-action-buttons .btn { padding-left: 7px; padding-right: 7px; font-size: 12px; }
.sale-ai-control { display: grid; gap: 6px; border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px; background: #f9fafb; }
.sale-ai-control div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sale-ai-control span:first-child { color: #6b7280; font-size: 12px; }
.sale-ai-control strong { color: #111827; font-size: 13px; text-align: right; overflow-wrap: anywhere; }
.sale-ai-control .hint { margin: 0; }
.sale-crm-card { display: grid; gap: 6px; max-height: calc(100vh - 220px); overflow-y: auto; padding-right: 2px; }
.sale-crm-row { min-width: 0; display: grid; gap: 4px; border: 1px solid #e5e7eb; border-radius: 6px; padding: 7px 8px; background: #fff; }
.sale-crm-row span { color: #6b7280; font-size: 12px; font-weight: 750; }
.sale-crm-row strong { min-width: 0; color: #111827; font-size: 13px; font-weight: 650; overflow-wrap: anywhere; white-space: normal; }
.sale-crm-row ul { margin: 0; padding-left: 16px; }
.sale-crm-row li { margin: 3px 0; }
.sale-crm-nested { display: grid; gap: 6px; }
.sale-chat-translator-toggle { display: inline-flex; align-items: center; gap: 7px; margin: 0; padding: 7px 10px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; color: #374151; font-size: 13px; font-weight: 750; }
.sale-chat-translator-toggle input { width: auto; margin: 0; }
.sale-chat-translator-loading { width: 12px; height: 12px; border: 2px solid #bfdbfe; border-top-color: #2563eb; border-radius: 50%; animation: sale-chat-spin .7s linear infinite; }
@keyframes sale-chat-spin { to { transform: rotate(360deg); } }
.sale-payments-panel { padding: 12px; }
.sale-payments-panel h2 { margin-bottom: 8px; }
.sale-payments-list { display: grid; gap: 6px; }
.sale-payment-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px; background: #fff; }
.sale-payment-item strong { display: block; font-size: 14px; color: #111827; }
.sale-payment-item span { display: block; margin-top: 3px; color: #6b7280; font-size: 12px; }
.sale-payment-item form { flex: 0 0 auto; }
.sale-payments-total { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; padding-top: 8px; border-top: 1px solid #e5e7eb; color: #111827; font-size: 14px; }
.sale-payments-total span { color: #6b7280; }
.sale-note-panel { padding: 12px; }
.sale-note-panel textarea { min-height: 120px; }
.sale-note-actions { display: grid; gap: 6px; margin-top: 8px; }
.sale-note-actions .hint { margin: 0; }
.sale-note-actions .btn { width: 100%; }
.sale-chat-panel { display: grid; grid-template-rows: minmax(0, 1fr) auto; height: calc(100vh - 176px); min-height: 0; padding: 0; overflow: hidden; }
.sale-chat-messages { overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; background: #f8fafc; }
.sale-chat-empty { margin: auto; color: #6b7280; font-size: 14px; }
.sale-chat-message { max-width: min(72%, 720px); border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 12px; background: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.sale-chat-message-incoming { align-self: flex-start; }
.sale-chat-message-outgoing { align-self: flex-end; background: #eff6ff; border-color: #bfdbfe; }
.sale-chat-message-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 5px; }
.sale-chat-message-head strong { font-size: 12px; color: #374151; }
.sale-chat-message-head span { font-size: 11px; color: #6b7280; white-space: nowrap; }
.sale-chat-message p { margin: 0; line-height: 1.45; white-space: normal; overflow-wrap: anywhere; }
.sale-chat-translation { margin-top: 8px; border-top: 1px solid rgba(148,163,184,.45); padding-top: 8px; color: #374151; }
.sale-chat-translation span { display: inline-block; margin-bottom: 4px; color: #2563eb; font-size: 10px; font-weight: 900; letter-spacing: 0; }
.sale-chat-translation p { color: #1f2937; }
.sale-chat-attachment { display: grid; gap: 6px; margin-top: 8px; }
.sale-chat-image-preview { display: block; max-width: min(260px, 100%); max-height: 220px; object-fit: contain; border: 1px solid #e5e7eb; border-radius: 6px; background: #fff; }
.sale-chat-audio { display: block; width: min(320px, 100%); height: 36px; }
.sale-chat-file-link { color: #2563eb; font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.sale-chat-composer { border-top: 1px solid #e5e7eb; padding: 16px; background: #fff; }
.sale-chat-composer textarea { min-height: 82px; }
.sale-chat-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.sale-chat-actions .hint { margin: 0; }
.sale-chat-file-picker { display: inline-flex; align-items: center; gap: 7px; margin: 0; padding: 8px 11px; border: 1px solid #d1d5db; border-radius: 6px; background: #f9fafb; color: #374151; font-size: 13px; font-weight: 750; cursor: pointer; }
.sale-chat-file-picker input { width: min(220px, 42vw); padding: 0; border: 0; background: transparent; font-size: 12px; }
.sale-chat-voice-controls { display: inline-flex; align-items: center; gap: 6px; }
.sale-chat-audio-preview { width: min(260px, 100%); height: 34px; }
.script-preview { margin: 0; padding-left: 18px; max-width: 520px; white-space: normal; }
.script-preview li { margin-bottom: 8px; }
.script-preview strong { display: block; color: #111827; }
.script-preview span { color: #6b7280; }
.script-items { display: grid; gap: 14px; }
.script-editor-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.script-item-card { border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px; background: #fbfcfe; }
.script-item-card textarea { width: 100%; min-height: 150px; resize: vertical; }
.script-markdown-input { width: 100%; min-height: 420px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.5; }
.script-add-button { margin-top: 16px; }
.delete-field { display: none; }
.script-heading h2 { margin-bottom: 4px; }
.sale-script-layout { display: grid; grid-template-columns: minmax(230px, 300px) minmax(0, 1fr); gap: 16px; align-items: start; }
.sale-script-nav { position: sticky; top: 18px; max-height: calc(100vh - 36px); overflow: auto; }
.sale-script-search-label { display: block; margin-bottom: 8px; color: #374151; font-size: 13px; font-weight: 800; }
.sale-script-nav input { width: 100%; margin-bottom: 14px; }
.sale-script-nav-list { display: grid; gap: 6px; }
.sale-script-nav-title,
.sale-script-nav-link { display: block; text-decoration: none; border-radius: 6px; color: #111827; overflow-wrap: anywhere; }
.sale-script-nav-title { padding: 10px 10px 8px; background: #f3f4f6; border: 1px solid #e5e7eb; }
.sale-script-nav-title strong { display: block; font-size: 13px; line-height: 1.25; }
.sale-script-nav-title span { display: block; margin-top: 3px; color: #6b7280; font-size: 11px; font-weight: 700; }
.sale-script-nav-link { padding: 8px 10px; border: 1px solid transparent; font-size: 12px; line-height: 1.35; color: #374151; }
.sale-script-nav-link span { margin-right: 4px; color: #6b7280; font-weight: 800; }
.sale-script-nav-title:hover,
.sale-script-nav-link:hover { border-color: #bfdbfe; background: #eff6ff; color: #1d4ed8; }
.sale-script-content { min-width: 0; display: grid; gap: 16px; }
.sale-script-panel { scroll-margin-top: 18px; }
.sale-script-search-empty { margin: 12px 0 0; }
.sale-script-list { display: grid; gap: 14px; margin-top: 18px; }
.sale-script-item { border: 1px solid #e5e7eb; border-radius: 8px; background: #fbfcfe; overflow: hidden; }
.sale-script-item,
.sale-script-nav-title,
.sale-script-nav-link,
.sale-script-panel { scroll-margin-top: 18px; }
.sale-script-item.is-hidden,
.sale-script-nav-title.is-hidden,
.sale-script-nav-link.is-hidden,
.sale-script-panel.is-hidden { display: none; }
.sale-script-item summary { cursor: pointer; padding: 14px 16px; font-size: 15px; font-weight: 750; color: #111827; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sale-script-item summary:hover { background: #f3f4f6; }
.script-copy-button { flex: 0 0 auto; }
.sale-script-item p { margin: 0; padding: 0 16px 16px; line-height: 1.55; color: #374151; white-space: normal; }
.checkbox-field { display: flex; align-items: center; gap: 8px; margin: 0; }
.checkbox-field input { width: auto; }
.modal { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.48); align-items: center; justify-content: center; z-index: 20; }
.modal-body { background: #fff; border-radius: 8px; width: min(360px, calc(100vw - 32px)); padding: 24px; }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; }
.user-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: start; }
.user-meta { display: grid; gap: 10px; margin: 4px 0 18px; }
.user-meta div { border: 1px solid #e5e7eb; border-radius: 6px; padding: 10px 12px; background: #f9fafb; }
.user-meta span { display: block; color: #6b7280; font-size: 12px; margin-bottom: 3px; }
.user-meta strong { font-size: 14px; color: #111827; overflow-wrap: anywhere; }
.danger-zone { border-color: #fecaca; }
.danger-zone h2 { color: #991b1b; }
.confirm-dialog { border: 0; border-radius: 8px; padding: 24px; width: min(380px, calc(100vw - 32px)); box-shadow: 0 22px 70px rgba(15,23,42,.28); }
.confirm-dialog::backdrop { background: rgba(15,23,42,.48); }
.confirm-dialog h2 { margin-bottom: 8px; }
.confirm-dialog p { margin: 0; color: #4b5563; line-height: 1.45; }
@media (min-width: 1500px) {
  .ai-test-workspace { grid-template-columns: minmax(0, 7fr) minmax(360px, 5fr); align-items: start; }
  .ai-test-crm { position: sticky; top: 18px; margin-bottom: 0; }
  .ai-test-crm .sale-crm-card { max-height: calc(100vh - 240px); }
  .ai-test-messages { max-height: calc(100vh - 360px); }
}
@media (max-width: 980px) {
  .sale-chat-layout { grid-template-columns: 1fr; }
  .voice-agent-top-grid,
  .voice-agent-text-grid { grid-template-columns: 1fr; }
  .sale-chat-sidebar { position: static; order: -1; }
  .sale-script-layout { grid-template-columns: 1fr; }
  .sale-script-nav { position: static; max-height: none; }
}
@media (max-width: 760px) {
  .container { padding: 18px 14px; }
  .app-shell { display: block; }
  .admin-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: 240px; transform: translateX(-100%); transition: transform .18s ease; box-shadow: 10px 0 24px rgba(15,23,42,.18); }
  .admin-menu-toggle:checked ~ .app-shell .admin-sidebar { transform: translateX(0); }
  .admin-menu-toggle:checked ~ .app-shell .admin-sidebar { padding-left: 16px; padding-right: 16px; }
  .admin-menu-toggle:checked ~ .app-shell .nav-text { display: inline; }
  .admin-menu-toggle:checked ~ .app-shell .admin-sidebar a { padding: 10px 12px; justify-content: flex-start; }
  .admin-menu-toggle:checked ~ .app-shell .sidebar-toggle { margin-left: 6px; }
  .menu-button { display: flex; position: fixed; top: 12px; left: 14px; z-index: 20; }
  .admin-menu-toggle:checked ~ .app-shell .menu-button { left: 254px; }
  .admin-main .container { padding-top: 64px; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .toolbar, .search, .page-toolbar, .filters-form { align-items: stretch; flex-direction: column; }
  .ai-test-layout { grid-template-columns: 1fr; }
  .ai-test-sidebar { position: static; }
  .ai-test-chat-header { flex-direction: column; }
  .ai-test-message { max-width: 100%; }
  .sale-chat-tabs { display: none; }
  .sale-chat-panel { height: calc(100vh - 140px); min-height: 0; grid-template-rows: minmax(0, 1fr) auto; }
  .sale-chat-message { max-width: 100%; }
  .sale-chat-actions { align-items: stretch; flex-direction: column; }
  .filters-form select,
  .filters-form input,
  .custom-date-range { width: 100%; }
  .custom-date-range { flex-direction: column; align-items: stretch; }
}
