* { box-sizing: border-box; }
body { margin: 0; background: #F4F6F8; font-family: -apple-system, "Segoe UI", Roboto, sans-serif; color: #1F2328; }

.cf-app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.cf-sidebar { background: #fff; border-right: 1px solid #E5E7EB; display: flex; flex-direction: column; padding: 16px 12px; gap: 2px; }
.cf-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; margin-bottom: 16px; padding: 0 6px; }
.cf-logo { width: 28px; height: 28px; border-radius: 7px; background: #1F3A5F; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.cf-nav-section { font-size: 10px; font-weight: 600; letter-spacing: 0.8px; color: #888; text-transform: uppercase; padding: 10px 10px 4px; }
.cf-nav { display: flex; flex-direction: column; gap: 1px; }
.cf-nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; color: #1A1A1A; text-decoration: none; border-radius: 6px; font-size: 13px; }
.cf-nav a:hover { background: #F4F6F8; }
.cf-nav a.active { background: #E6F1FB; color: #0C447C; font-weight: 500; }
.cf-nav a i { width: 18px; color: #656D76; }
.cf-nav a.active i { color: #0C447C; }
.cf-nav a span { flex: 1; }
.cf-badge { background: #378ADD; color: #fff; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 9px; min-width: 18px; text-align: center; }
.cf-badge.green { background: #1D9E75; }
.cf-badge.amber { background: #E4A13B; }
.cf-user { margin-top: auto; padding-top: 12px; border-top: 1px solid #E5E7EB; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.cf-avatar { width: 32px; height: 32px; border-radius: 50%; background: #FAECE7; color: #712B13; display: flex; align-items: center; justify-content: center; font-weight: 500; }
.cf-uname { font-weight: 500; }
.cf-signout { background: none; border: none; color: #378ADD; cursor: pointer; padding: 0; font-size: 11px; }

.cf-main { padding: 20px 28px; overflow-x: hidden; }
.cf-page-title { font-size: 20px; font-weight: 500; margin: 0 0 4px; }
.cf-page-sub { font-size: 13px; color: #656D76; margin: 0 0 18px; }

.cf-unauth { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #E6F1FB, #FFFFFF); }
.cf-card { background: #fff; border: 1px solid #E5E7EB; border-radius: 10px; padding: 18px 22px; margin-bottom: 14px; }
.cf-card h2, .cf-card h3 { margin-top: 0; }
.cf-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 14px; }
.cf-metric { background: #fff; border: 1px solid #E5E7EB; border-radius: 10px; padding: 12px 14px; }
.cf-metric-l { font-size: 11px; color: #656D76; text-transform: uppercase; letter-spacing: .3px; }
.cf-metric-v { font-size: 22px; font-weight: 500; margin-top: 3px; }
.cf-metric-delta { font-size: 11px; color: #888; margin-top: 2px; }
.cf-metric-delta.positive { color: #0F6E56; }
.cf-metric-delta.negative { color: #791F1F; }

.cf-activity { list-style: none; padding: 0; margin: 0; }
.cf-activity li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid #F0F2F5; }
.cf-activity li:last-child { border-bottom: none; }
.cf-activity-icon { width: 28px; height: 28px; border-radius: 50%; background: #F4F6F8; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.cf-activity-body { flex: 1; min-width: 0; }
.cf-activity-title { font-size: 13px; color: #1A1A1A; }
.cf-activity-sub { font-size: 11px; color: #888; }
.cf-activity-time { font-size: 11px; color: #888; flex-shrink: 0; }

.cf-threshold-row { display: flex; gap: 14px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid #F0F2F5; }
.cf-threshold-row:last-child { border-bottom: none; }
.cf-threshold-pct { width: 60px; text-align: center; padding: 6px 0; border-radius: 6px; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.cf-threshold-pct.green { background: #E1F5EE; color: #085041; }
.cf-threshold-pct.amber { background: #FAEEDA; color: #633806; }
.cf-threshold-pct.red { background: #FCEBEB; color: #791F1F; }
.cf-threshold-body { flex: 1; font-size: 13px; padding-top: 6px; }

.cf-kb-progress { position: relative; width: 140px; height: 18px; background: #F4F6F8; border-radius: 4px; overflow: hidden; }
.cf-kb-progress-bar { height: 100%; background: linear-gradient(90deg, #378ADD, #5BA0E5); transition: width .3s; }
.cf-kb-progress span { position: absolute; top: 0; left: 0; right: 0; text-align: center; font-size: 10px; font-weight: 500; line-height: 18px; color: #1A1A1A; }

.cf-conv-header { display: flex; align-items: center; gap: 14px; padding: 14px 0; margin-bottom: 12px; border-bottom: 1px solid #E5E7EB; }
.cf-conv-avatar { width: 44px; height: 44px; border-radius: 50%; background: #FAECE7; color: #712B13; display: flex; align-items: center; justify-content: center; font-weight: 500; font-size: 16px; flex-shrink: 0; }
.cf-watching-banner { background: #E1F5EE; color: #085041; padding: 6px 12px; border-radius: 8px; font-size: 12px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.cf-watching-dot { width: 8px; height: 8px; border-radius: 50%; background: #1D9E75; animation: pulse 1.5s infinite; }
@@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.cf-msg-row { margin-bottom: 12px; }
.cf-msg-meta { font-size: 10px; color: #888; margin-bottom: 3px; display: flex; align-items: center; gap: 4px; text-transform: uppercase; letter-spacing: .3px; }
.cf-msg-time { margin-left: auto; }
.cf-msg-dot { width: 6px; height: 6px; border-radius: 50%; }
.cf-msg-dot.bot { background: #378ADD; }
.cf-msg-dot.visitor { background: #BA7517; }
.cf-msg-dot.agent { background: #1D9E75; }
.cf-notes-card { background: #FFFBEA; border-color: #FFD580; }
.cf-note { background: #fff; border-left: 3px solid #FFD580; padding: 8px 10px; border-radius: 4px; margin-bottom: 6px; }

.cf-filter-bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.cf-filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; background: #fff; border: 1px solid #E5E7EB; border-radius: 20px; font-size: 12px; color: #1A1A1A; text-decoration: none; }
.cf-filter-chip:hover { background: #F4F6F8; }
.cf-filter-chip.active { background: #E6F1FB; border-color: #5BA0E5; color: #0C447C; font-weight: 500; }
.cf-chip-count { background: #F0F2F5; padding: 1px 7px; border-radius: 9px; font-size: 10px; font-weight: 600; }
.cf-filter-chip.active .cf-chip-count { background: #5BA0E5; color: #fff; }
.cf-temp-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.cf-temp-dot.red { background: #E24B4A; }
.cf-temp-dot.amber { background: #E4A13B; }
.cf-temp-dot.blue { background: #5BA0E5; }

.cf-leads-table tr.row-hot { background: #FFF8F8; }
.cf-leads-table tr.row-warm { background: #FFFBEA; }
.cf-leads-table tr.row-hot:hover { background: #FCEBEB; }
.cf-leads-table tr.row-warm:hover { background: #FAEEDA; }
.cf-score-cell { display: flex; align-items: center; gap: 8px; }
.cf-score-num { font-weight: 600; font-size: 15px; }

.cf-slider-row { margin-bottom: 14px; }
.cf-slider-row label { display: flex; justify-content: space-between; font-size: 11px; color: #656D76; text-transform: uppercase; letter-spacing: .3px; margin-bottom: 4px; }
.cf-slider-arrows { color: #ccc; font-weight: normal; }
.cf-slider-row input[type=range] { width: 100%; }

.cf-preview-card { background: linear-gradient(135deg, #F7FAFE, #FFFFFF); border-color: #E6F1FB; position: sticky; top: 20px; }
.cf-preview-bubble { background: #fff; border: 1px solid #E5E7EB; border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.55; min-height: 100px; box-shadow: 0 2px 8px rgba(0,0,0,.04); }

.cf-footer { margin-top: 40px; padding: 16px 0; border-top: 1px solid #E5E7EB; text-align: center; font-size: 11px; color: #888; }
.cf-footer a { color: #378ADD; text-decoration: none; font-weight: 500; }
.cf-footer a:hover { text-decoration: underline; }
.cf-unauth-footer { position: fixed; bottom: 16px; left: 0; right: 0; text-align: center; font-size: 11px; color: #888; }
.cf-unauth-footer a { color: #378ADD; text-decoration: none; font-weight: 500; }
.cf-unauth-footer a:hover { text-decoration: underline; }

/* Test widget preview */
.cf-tw-bar { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: end; background: #fff; padding: 12px 16px; border: 1px solid #E5E7EB; border-radius: 10px; margin-bottom: 14px; }
.cf-tw-url label, .cf-tw-device label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: #656D76; font-weight: 500; margin-bottom: 4px; }
.cf-device-group { display: flex; gap: 0; border: 1px solid #E5E7EB; border-radius: 6px; overflow: hidden; }
.cf-device-btn { border: none; background: #fff; padding: 7px 14px; font-size: 12px; cursor: pointer; color: #656D76; display: flex; align-items: center; gap: 6px; border-right: 1px solid #E5E7EB; }
.cf-device-btn:last-child { border-right: none; }
.cf-device-btn:hover { background: #F4F6F8; }
.cf-device-btn.active { background: #E6F1FB; color: #0C447C; font-weight: 500; }

.cf-tw-viewport { background: #2C2C2A; padding: 20px; border-radius: 10px; display: flex; justify-content: center; align-items: flex-start; min-height: 70vh; }
.cf-tw-frame-wrap { background: #fff; border-radius: 8px; overflow: hidden; width: 100%; transition: max-width .25s ease; box-shadow: 0 4px 24px rgba(0,0,0,.3); }
.cf-tw-frame-wrap.device { border: 10px solid #1A1A1A; border-radius: 24px; }
.cf-tw-frame-wrap iframe { width: 100%; height: 70vh; border: none; display: block; background: #fff; }
.cf-tw-frame-wrap.device iframe { height: 75vh; }

.cf-btn { display: inline-block; padding: 7px 14px; font-size: 13px; border-radius: 6px; border: 1px solid #E5E7EB; background: #fff; color: #1F2328; cursor: pointer; text-decoration: none; font-weight: 500; }
.cf-btn.primary { background: #378ADD; color: #fff; border-color: #378ADD; }
.cf-btn.danger { background: #FCEBEB; color: #791F1F; border-color: #F09595; }
.cf-btn.sm { padding: 4px 10px; font-size: 11px; }
.cf-btn-group { display: flex; gap: 8px; }

.cf-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #E5E7EB; border-radius: 10px; overflow: hidden; }
.cf-table th { background: #F7F9FB; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; color: #656D76; padding: 10px 14px; text-align: left; font-weight: 500; border-bottom: 1px solid #E5E7EB; }
.cf-table td { padding: 10px 14px; font-size: 13px; border-bottom: 1px solid #E5E7EB; }
.cf-table tr:last-child td { border-bottom: none; }
.cf-table tr:hover { background: #FAFBFC; }

.cf-pill { display: inline-block; padding: 2px 9px; font-size: 11px; border-radius: 10px; font-weight: 500; }
.cf-pill.green { background: #E1F5EE; color: #085041; }
.cf-pill.red { background: #FCEBEB; color: #791F1F; }
.cf-pill.amber { background: #FAEEDA; color: #633806; }
.cf-pill.blue { background: #E6F1FB; color: #0C447C; }
.cf-pill.purple { background: #EEEDFE; color: #3C3489; }
.cf-pill.grey { background: #F4F6F8; color: #656D76; }

.cf-form-field { margin-bottom: 12px; }
.cf-form-field label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; color: #656D76; margin-bottom: 4px; font-weight: 500; }
.cf-form-field input, .cf-form-field textarea, .cf-form-field select { width: 100%; padding: 8px 12px; border: 1px solid #E5E7EB; border-radius: 6px; font: inherit; }
.cf-danger-zone { border: 1px solid #F09595; background: #FDF3F3; border-radius: 10px; padding: 14px 18px; margin-top: 14px; }
.cf-danger-zone h3 { color: #791F1F; margin-top: 0; font-size: 14px; }

.cf-code { background: #2C2C2A; color: #F1EFE8; padding: 12px 14px; border-radius: 8px; font-family: ui-monospace, monospace; font-size: 12px; word-break: break-all; white-space: pre-wrap; }

.cf-auth-card { width: 440px; background: #fff; padding: 34px 40px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.cf-auth-logo { width: 44px; height: 44px; border-radius: 11px; background: #E6F1FB; color: #0C447C; display: flex; align-items: center; justify-content: center; margin: 0 auto; font-weight: 500; font-size: 22px; }
.cf-auth-title { text-align: center; font-size: 20px; font-weight: 500; margin: 12px 0 2px; color: #1A1A1A; }
.cf-auth-sub { text-align: center; font-size: 12px; color: #888; margin: 0 0 24px; }
.cf-auth-tabs { display: flex; border-bottom: 1px solid #E5E7EB; margin-bottom: 18px; }
.cf-auth-tab { flex: 1; text-align: center; padding: 8px 0; font-size: 13px; font-weight: 500; color: #888; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.cf-auth-tab.active { color: #1A1A1A; border-bottom-color: #378ADD; }
.cf-auth-footer { text-align: center; font-size: 11px; color: #888; margin-top: 14px; }
.cf-auth-footer a { color: #378ADD; text-decoration: none; }

.cf-transcript { display: flex; flex-direction: column; gap: 6px; padding: 14px; background: #F7F9FB; border-radius: 10px; min-height: 400px; }
.cf-bubble { padding: 8px 12px; border-radius: 12px; max-width: 80%; font-size: 13px; line-height: 1.5; }
.cf-bubble.visitor { background: #FAECE7; color: #712B13; align-self: flex-start; }
.cf-bubble.bot { background: #fff; border: 1px solid #E5E7EB; align-self: flex-start; }
.cf-bubble.agent { background: #E1F5EE; color: #0F6E56; align-self: flex-end; border-left: 3px solid #1D9E75; }
.cf-bubble.system { align-self: center; background: #F4F6F8; color: #656D76; font-size: 11px; padding: 3px 10px; }
