:root{color-scheme:light;--prod-bg:#f4f7fb;--prod-panel:#fff;--prod-panel-soft:#f7faff;--prod-text:#11243d;--prod-muted:#64748b;--prod-border:#dce6f2;--prod-blue:#0968e8;--prod-blue-strong:#064eb5;--prod-shadow:0 18px 50px rgba(23,55,95,.12)}
html[data-theme="dark"]{color-scheme:dark;--prod-bg:#071426;--prod-panel:#0d1f36;--prod-panel-soft:#102945;--prod-text:#edf6ff;--prod-muted:#9bb1c9;--prod-border:#213b58;--prod-blue:#48a1ff;--prod-blue-strong:#72b7ff;--prod-shadow:0 22px 60px rgba(0,0,0,.35)}
html[data-theme="dark"] body,html[data-theme="dark"] .app-shell{background:var(--prod-bg);color:var(--prod-text)}
html[data-theme="dark"] :is(.inbox-panel,.chat-panel,.details-panel,.panel-heading,.chat-heading,.composer,.stats,.search-box,.conversation-actions,.order-card,.auth-card){background:var(--prod-panel);color:var(--prod-text);border-color:var(--prod-border)}
html[data-theme="dark"] :is(h1,h2,h3,strong,.chat-identity h2,.conversation-top strong){color:var(--prod-text)}
html[data-theme="dark"] :is(p,small,label,.muted,.conversation-copy p,.chat-identity p,.composer-notice,.detail-row p){color:var(--prod-muted)}
html[data-theme="dark"] :is(input,textarea,select){background:var(--prod-panel-soft);color:var(--prod-text);border-color:var(--prod-border)}
html[data-theme="dark"] .conversation-item{color:var(--prod-text);border-color:var(--prod-border)}
html[data-theme="dark"] .conversation-item:hover,html[data-theme="dark"] .conversation-item.active{background:#123257}
html[data-theme="dark"] .bubble{background:#162f4c;color:var(--prod-text)}
html[data-theme="dark"] .outbound .bubble{background:#0871ea;color:#fff}
html[data-theme="dark"] .empty-state{color:var(--prod-muted)}
.production-theme-button{margin-top:auto;margin-bottom:54px}
.back-to-erp{display:inline-flex;align-items:center;justify-content:center;min-height:32px;padding:6px 10px;border:1px solid var(--prod-border);border-radius:10px;color:var(--prod-blue);font-size:12px;font-weight:850;text-decoration:none;white-space:nowrap}
.back-to-erp:hover{background:var(--prod-panel-soft)}
.panel-heading{gap:12px}.panel-heading .live-indicator{margin-left:auto}
.production-drawer-overlay{position:fixed;inset:0;z-index:5000;display:grid;grid-template-columns:1fr minmax(520px,760px)}
.production-drawer-backdrop{grid-column:1;border:0;background:rgba(3,12,25,.56);backdrop-filter:blur(3px);cursor:default}
.production-drawer{grid-column:2;height:100dvh;background:var(--prod-panel);color:var(--prod-text);box-shadow:-22px 0 70px rgba(6,26,54,.28);display:flex;flex-direction:column;min-height:0;animation:production-slide-in .22s ease-out}
.production-drawer>header{display:flex;justify-content:space-between;align-items:flex-start;gap:20px;padding:22px 24px;border-bottom:1px solid var(--prod-border)}
.production-drawer>header span{display:block;color:var(--prod-blue);font-size:10px;font-weight:950;letter-spacing:.15em}
.production-drawer>header h2{margin:5px 0 0;color:var(--prod-text);font-size:1.5rem}
.production-drawer>header button{width:40px;height:40px;border:1px solid var(--prod-border);border-radius:12px;background:var(--prod-panel-soft);color:var(--prod-text);font-size:24px;cursor:pointer}
.production-drawer-content{padding:22px 24px 32px;overflow-y:auto;min-height:0;background:var(--prod-bg)}
.production-loading{min-height:280px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;color:var(--prod-muted)}
.production-loading span{width:34px;height:34px;border:3px solid var(--prod-border);border-top-color:var(--prod-blue);border-radius:50%;animation:production-spin .8s linear infinite}
.production-stat-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
.production-stat{min-height:142px;padding:17px;border:1px solid var(--prod-border);border-radius:18px;background:var(--prod-panel);display:flex;flex-direction:column;gap:7px;position:relative;overflow:hidden}
.production-stat::before{content:"";position:absolute;inset:0 auto 0 0;width:4px;background:var(--stat-tone,var(--prod-blue))}
.production-stat span{color:var(--prod-muted);font-size:11px;font-weight:850;text-transform:uppercase;letter-spacing:.04em}
.production-stat strong{font-size:1.85rem;line-height:1.05;color:var(--prod-text)}
.production-stat small{margin-top:auto;color:var(--prod-muted);line-height:1.4}
.production-stat.blue{--stat-tone:#0968e8}.production-stat.cyan{--stat-tone:#0891b2}.production-stat.amber{--stat-tone:#d97706}.production-stat.green{--stat-tone:#16845b}.production-stat.purple{--stat-tone:#7c3aed}.production-stat.red{--stat-tone:#d92d20}
.production-lead-list{display:grid;gap:10px}
.production-lead-row{display:grid;grid-template-columns:54px minmax(0,1fr) auto;align-items:center;gap:14px;width:100%;padding:14px;border:1px solid var(--prod-border);border-radius:16px;background:var(--prod-panel);color:var(--prod-text);text-align:left;cursor:pointer}
.production-lead-row:hover{border-color:color-mix(in srgb,var(--prod-blue) 45%,var(--prod-border));transform:translateY(-1px)}
.production-lead-row:focus-visible{outline:3px solid color-mix(in srgb,var(--prod-blue) 30%,transparent);outline-offset:2px}
.production-lead-row>span:nth-child(2),.production-lead-row>span:nth-child(3){display:flex;flex-direction:column;gap:4px}.production-lead-row>span:nth-child(3){align-items:flex-end}
.production-lead-row small{color:var(--prod-muted)}
.production-lead-score{width:48px;height:48px;border-radius:14px;background:color-mix(in srgb,var(--prod-blue) 12%,var(--prod-panel));color:var(--prod-blue);display:grid;place-items:center;font-weight:950;font-size:1.1rem}
.lead-status{display:inline-flex;padding:5px 8px;border-radius:999px;background:#e8f1ff;color:#075bc4;font-size:10px;font-weight:900;font-style:normal;text-transform:uppercase;letter-spacing:.03em}
.lead-status.status-qualified,.lead-status.status-won{background:#dcf7eb;color:#0a704b}.lead-status.status-human_attention_required,.lead-status.status-follow_up_required{background:#fff0d5;color:#9a5900}.lead-status.status-lost,.lead-status.status-spam{background:#ffe4e2;color:#a51d16}
.integration-grid{display:grid;gap:12px}.integration-grid article{display:flex;gap:14px;align-items:flex-start;padding:17px;border:1px solid var(--prod-border);border-radius:16px;background:var(--prod-panel)}.integration-grid article strong{display:block;color:var(--prod-text);margin-bottom:5px}.integration-grid article p{margin:0;color:var(--prod-muted);line-height:1.5}
.health-dot{flex:0 0 auto;width:12px;height:12px;border-radius:50%;margin-top:5px;background:#a4b4c5;box-shadow:0 0 0 5px color-mix(in srgb,#a4b4c5 18%,transparent)}.health-dot.healthy{background:#16a66a;box-shadow:0 0 0 5px color-mix(in srgb,#16a66a 18%,transparent)}.health-dot.warning{background:#d97706;box-shadow:0 0 0 5px color-mix(in srgb,#d97706 18%,transparent)}
.production-actions{display:flex;gap:10px;margin-top:16px}.production-button{display:inline-flex;min-height:40px;align-items:center;justify-content:center;padding:9px 14px;border-radius:12px;background:var(--prod-blue);color:#fff;text-decoration:none;font-weight:850}.production-button.secondary{background:var(--prod-panel);color:var(--prod-blue);border:1px solid var(--prod-border)}
.production-table-wrap{overflow:auto;border:1px solid var(--prod-border);border-radius:16px;background:var(--prod-panel)}.production-table-wrap table{width:100%;border-collapse:collapse;min-width:650px}.production-table-wrap th,.production-table-wrap td{padding:12px 14px;text-align:left;border-bottom:1px solid var(--prod-border);vertical-align:top}.production-table-wrap th{position:sticky;top:0;background:var(--prod-panel-soft);color:var(--prod-muted);font-size:10px;text-transform:uppercase;letter-spacing:.06em}.production-table-wrap td{color:var(--prod-text);font-size:12px}.production-table-wrap td small{display:block;color:var(--prod-muted);margin-top:3px}
.production-error,.production-empty{min-height:220px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:24px;color:var(--prod-muted)}.production-error strong,.production-empty strong{color:var(--prod-text);font-size:1.05rem}.production-error p,.production-empty p{max-width:520px;line-height:1.55}
.erp-workspace{margin:14px 14px 24px;border:1px solid var(--prod-border);border-radius:18px;background:var(--prod-panel);overflow:hidden}.erp-workspace>header{padding:15px 16px;border-bottom:1px solid var(--prod-border);background:var(--prod-panel-soft)}.erp-workspace>header span{display:block;color:var(--prod-blue);font-size:9px;font-weight:950;letter-spacing:.14em}.erp-workspace>header h3{margin:4px 0 0;font-size:1rem;color:var(--prod-text)}
.erp-action-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;padding:10px;border-bottom:1px solid var(--prod-border)}.erp-action-grid button{min-height:36px;padding:7px;border:1px solid var(--prod-border);border-radius:10px;background:var(--prod-panel-soft);color:var(--prod-blue);font-size:10px;font-weight:850;cursor:pointer}.erp-action-grid button:hover{border-color:var(--prod-blue)}.erp-action-grid button:disabled{opacity:.55;cursor:wait}
#erpContextPanel{padding:12px}.erp-empty{min-height:105px;padding:14px;display:flex;flex-direction:column;justify-content:center;text-align:center;color:var(--prod-muted)}.erp-empty strong{color:var(--prod-text)}.erp-empty p{margin:5px 0 0;font-size:11px;line-height:1.5}.erp-empty.error strong{color:#b42318}
.erp-customer-card>span{color:var(--prod-blue);font-size:9px;font-weight:950;letter-spacing:.12em}.erp-customer-card>strong{display:block;margin-top:5px;color:var(--prod-text)}.erp-customer-card>small{color:var(--prod-muted)}.erp-customer-card dl{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:12px 0}.erp-customer-card dl div{padding:10px;border-radius:11px;background:var(--prod-panel-soft)}.erp-customer-card dt{color:var(--prod-muted);font-size:9px;text-transform:uppercase}.erp-customer-card dd{margin:4px 0 0;color:var(--prod-text);font-weight:850;font-size:11px}.erp-record-list{display:grid;gap:5px}.erp-record-list p{display:flex;justify-content:space-between;gap:8px;margin:0;padding:7px 8px;border-top:1px solid var(--prod-border);font-size:10px}.erp-record-list span{color:var(--prod-muted)}.erp-record-list strong{color:var(--prod-text)}
.production-drawer-open{overflow:hidden}
@keyframes production-slide-in{from{transform:translateX(36px);opacity:.7}to{transform:none;opacity:1}}@keyframes production-spin{to{transform:rotate(360deg)}}
@media(max-width:900px){.production-drawer-overlay{grid-template-columns:1fr}.production-drawer-backdrop{grid-column:1;grid-row:1}.production-drawer{grid-column:1;grid-row:1;margin-left:min(12vw,90px);z-index:2}.production-stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.details-panel{overflow-y:auto}}
@media(max-width:620px){.production-drawer{margin-left:0}.production-drawer>header,.production-drawer-content{padding-left:16px;padding-right:16px}.production-stat-grid{grid-template-columns:1fr 1fr;gap:9px}.production-stat{min-height:122px;padding:14px}.production-stat strong{font-size:1.5rem}.production-lead-row{grid-template-columns:46px minmax(0,1fr)}.production-lead-row>span:nth-child(3){grid-column:2;align-items:flex-start}.erp-action-grid{grid-template-columns:1fr}.back-to-erp{font-size:0}.back-to-erp::after{content:"ERP";font-size:11px}}
@media(prefers-reduced-motion:reduce){.production-drawer,.production-loading span{animation:none}.production-lead-row{transition:none}}
