/* CRMchi 2026 visual system. Loaded last; behavior and layout ownership stay intact. */
:root {
  --canvas: #f3f6fb;
  --surface: #fff;
  --soft: #f7f9fc;
  --line: #e2e8f1;
  --ink: #172640;
  --muted: #64748b;
  --blue: #356de8;
  --blue-soft: #edf3ff;
  --teal: #087f70;
  --teal-soft: #e8f6f1;
  --shadow: 0 4px 6px -4px rgba(28,45,76,.04), 0 16px 40px -20px rgba(28,45,76,.12);
  --radius-card: 20px;
}
body { background: radial-gradient(ellipse at 90% 0%, #e8eefb 0%, transparent 42%), var(--canvas); -webkit-font-smoothing: antialiased; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 60%, transparent); outline-offset: 3px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
::selection { background: #dce8ff; color: #172640; }
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
.sidebar { background: radial-gradient(ellipse at 0% 0%, #213959 0%, transparent 45%), linear-gradient(165deg,#101e35,#0a1324 80%); box-shadow: 8px 0 35px rgba(15,30,53,.07); }
.brand { padding-bottom: 24px; }
.workspace-switcher { border-radius: 16px; background: rgba(255,255,255,.055); border-color: rgba(255,255,255,.1); }
.nav { gap: 5px; }
.nav button { border-radius: 12px; min-height: 44px; color: #afbed2; }
.nav button:hover { background: rgba(255,255,255,.07); }
.nav button.active { background: linear-gradient(110deg,#244779,#19345f); box-shadow: inset 0 1px rgba(255,255,255,.1), 0 4px 14px rgba(0,0,0,.1); }
.nav-label { color: #8399b7; letter-spacing: .13em; }
.topbar { background: color-mix(in srgb,var(--surface) 94%,transparent); box-shadow: 0 3px 18px rgba(20,40,80,.025); border-color: var(--line); }
.search input { background: var(--soft); border-radius: 14px; }
.page { padding: 32px; }
.page-header { margin-bottom: 26px; align-items: center; }
h1 { font-size: clamp(25px,2.2vw,34px); letter-spacing: -1.2px; }
h2 { line-height: 1.4; }
.subtitle { line-height: 1.65; }
.eyebrow { letter-spacing: .12em; font-size: 10px; }
.btn { min-height: 40px; border-radius: 11px; padding: 10px 16px; box-shadow: 0 3px 8px rgba(53,109,232,.1); }
.btn:hover { box-shadow: 0 5px 14px rgba(53,109,232,.18); }
.btn.secondary { color: var(--ink); background: var(--surface); border-color: var(--line); box-shadow: 0 2px 4px rgba(20,40,80,.025); }
.btn.ghost { box-shadow: none; }
.btn.small { min-height: 33px; }
.panel, .metric-card, .control-card, .connection-card, .agent-card, .setting-card { border-radius: var(--radius-card); border-color: var(--line); box-shadow: var(--shadow); }
.panel-header { padding: 22px 24px 16px; }
.panel-body { padding: 0 24px 24px; }
.metrics { gap: 18px; }
.metric-card { padding: 22px; }
.metric-label { font-size: 12px; }
.metric-value { font-size: 32px; letter-spacing: -1.2px; }
.metric-foot { font-size: 11px; line-height: 1.5; }
.metric-icon { border-radius: 13px; width: 38px; height: 38px; }
.control-card { background: var(--surface); }
.control-week-chart > div > span { background: #edf3f7; border-radius: 12px 12px 5px 5px; overflow: hidden; }
.control-week-chart > div > span > i { display: block; background: linear-gradient(180deg,#55c8b0,#118d79); border-radius: 10px 10px 3px 3px; }
table { border-collapse: collapse; }
thead th { color: var(--muted); background: var(--soft); font-size: 11px; letter-spacing: .03em; }
tbody td { border-color: var(--line); }
tbody tr:hover { background: color-mix(in srgb,var(--blue-soft) 35%,var(--surface)); }
.form-grid input, .form-grid select, .form-grid textarea { border-radius: 11px; background: var(--soft); color: var(--ink); }
.modal { border-radius: 22px; box-shadow: 0 30px 100px rgba(15,30,53,.22); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; }
.modal-header { padding: 22px 24px; flex-shrink: 0; }
.modal-body { padding: 24px; overflow-y: auto; min-height: 0; }
.modal-backdrop { backdrop-filter: blur(5px); }
.empty-content { min-height: 150px; padding: 28px; }
.empty-content strong { font-size: 13px; }
.empty-content small { font-size: 11px; }
.toast { border-radius: 14px; box-shadow: 0 12px 40px rgba(15,30,53,.13); }
/* Inbox: calm canvas, stronger hierarchy, and readable conversation density. */
.chat-avatar { position: relative; flex-shrink: 0; overflow: hidden; }
.chat-avatar.has-photo { position: relative; }
.chat-avatar .avatar-fallback { position: absolute; inset: 0; display: grid; place-items: center; }
.chat-avatar .profile-photo { position: absolute; inset: 0; z-index: 1; display: block; width: 100%; height: 100%; max-width: 100%; max-height: 100%; background: var(--surface); object-fit: cover; }
.chat-avatar .profile-photo[hidden] { display: none !important; }
.inbox-pro { background: var(--canvas); color: var(--ink); min-height: 0; height: 100dvh; }
.inbox-pro-topbar { min-height: 74px; padding: 12px 22px; background: var(--surface); border-color: var(--line); }
.inbox-brand strong { font-size: 20px; }
.inbox-brand span { font-size: 12px; color: var(--muted); }
.inbox-pro .inbox-layout { grid-template-columns: minmax(280px,320px) minmax(0,1fr) 290px; }
.inbox-pro .inbox-column, .inbox-pro .conversation-head, .inbox-pro .lead-side, .inbox-pro .chat-list { background: var(--surface); border-color: var(--line); }
.inbox-pro .inbox-filter { padding: 16px 14px; }
.inbox-pro .inbox-search, .inbox-global-search, .inbox-period { background: var(--soft); border-color: var(--line); border-radius: 12px; }
.inbox-pro .inbox-search input, .inbox-global-search input { color: var(--ink); font-size: 12px; }
.inbox-channel { font-size: 10px; min-height: 34px; }
.inbox-pro .chat-item { margin: 4px 8px; border-radius: 13px; border-bottom: 0; padding: 13px 10px; min-height: 86px; }
.inbox-pro .chat-item.active { background: var(--teal-soft); box-shadow: inset 3px 0 var(--teal); }
.inbox-pro .chat-item:hover { background: var(--soft); }
.inbox-pro .chat-item.active:hover { background: var(--teal-soft); }
.inbox-pro .chat-name { color: var(--ink); font-size: 12px; }
.inbox-pro .chat-identity { color: var(--muted); font-size: 10px; }
.inbox-pro .chat-preview { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; color: var(--muted); }
.inbox-pro .chat-meta { min-width: 34px; }
.inbox-pro .chat-avatar { background: var(--blue-soft); color: #426495; border-color: var(--line); }
.inbox-pro .conversation-head { padding: 14px 20px; min-height: 78px; gap: 12px; }
.inbox-pro .conversation-title { min-width: 0; }
.inbox-pro .conversation-title strong { color: var(--ink); font-size: 14px; }
.inbox-pro .conversation-title .conversation-handle { font-size: 11px; }
.inbox-pro .messages { background: var(--soft); background-image: none; padding: 24px; gap: 9px; }
.inbox-pro .message { padding: 13px 16px; line-height: 1.65; font-size: 13px; max-width: min(82%,620px); }
.inbox-pro .message.in { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: 0 3px 12px rgba(24,39,75,.035); }
.inbox-pro .message.out, .inbox-pro .message.ai { background: #087f70; color: #fff; box-shadow: 0 3px 12px rgba(8,127,112,.1); }
.inbox-pro .message-meta { font-size: 9px; }
.message-day span { color: var(--muted); background: var(--surface); border-color: var(--line); font-size: 10px; }
.conversation-mode, .inbox-pro .composer { background: var(--surface); border-color: var(--line); }
.inbox-pro .composer { padding: 12px 16px 16px; gap: 8px; }
.inbox-pro .composer input { background: var(--soft); color: var(--ink); border-color: var(--line); min-height: 46px; font-size: 12px; }
.inbox-pro .composer-send { background: var(--teal); width: 42px; height: 42px; }
.inbox-pro .lead-summary { padding: 22px 18px; }
.inbox-pro .lead-person strong { color: var(--ink); }
.inbox-pro .lead-summary h3 { color: var(--muted); font-size: 10px; letter-spacing: .09em; }
.inbox-pro .lead-summary dl { font-size: 11px; line-height: 1.6; }
.inbox-pro .lead-summary dt { color: var(--muted); }
.inbox-pro .lead-summary dd { color: var(--ink); overflow-wrap: anywhere; }
/* Setup studio shares the same visual language while retaining its focused layout. */
.agent-studio, .agent-studio-main { background: var(--soft); color: var(--ink); }
.agent-studio-topbar, .agent-studio-inspector { background: var(--surface); border-color: var(--line); }
.agent-studio-thread { padding-top: 32px; gap: 24px; width: min(calc(100% - 48px),720px); }
.studio-message { color: var(--ink); font-size: 14px; line-height: 1.8; }
.studio-message.user > div { background: var(--blue-soft); border-radius: 18px 18px 5px 18px; padding: 13px 18px; }
.agent-studio-prompt { border-color: #cdd8e8; box-shadow: var(--shadow); border-radius: 20px; background: var(--surface); }
.agent-studio-prompt textarea { color: var(--ink); }
.studio-setting-item { background: var(--surface); border-color: var(--line); border-radius: 16px; }
.studio-setting-item:hover { background: var(--soft); border-color: #b8c9e2; transform: translateX(2px); }
.studio-setting-item strong { color: var(--ink); }
.studio-setting-icon { color: var(--blue); background: var(--blue-soft); border-radius: 12px; }
.studio-change-note { background: var(--surface); border-color: var(--line); }
.auth-card { border-radius: 24px; box-shadow: var(--shadow); }
.control-kpis article { border-radius: var(--radius-card); border-color: var(--line); box-shadow: var(--shadow); }
.control-toolbar { border-radius: 16px; border-color: var(--line); box-shadow: var(--shadow); }
.setting-grid, .connection-grid, .agent-grid { gap: 20px; }
.integration-modal, .market-shell { border-radius: 22px; }
.integration-tabs button.active { color: var(--blue); }
.landing-faq-list details { border-radius: 16px; border-color: var(--line); }
.auth-form input { border-radius: 12px; min-height: 48px; }
.auth-card h2 { letter-spacing: -1px; }
.ai-control-summary p { color: var(--muted); font-size: 11px; line-height: 1.65; }
:root[data-theme="dark"] { --canvas:#0c1424; --surface:#142035; --soft:#111c30; --line:#29374e; --ink:#e7edf7; --muted:#a1b0c6; --blue:#7aa6ff; --blue-soft:#233757; --teal:#50c9b0; --teal-soft:#163d3a; --shadow:0 12px 35px rgba(0,0,0,.15); }
:root[data-theme="dark"] body { background: var(--canvas); }
:root[data-theme="dark"] .inbox-pro .message.out, :root[data-theme="dark"] .inbox-pro .message.ai { background:#166d62; }
:root[data-theme="dark"] .control-week-chart > div > span { background:var(--soft); }
:root[data-theme="dark"] .studio-setting-icon { color:var(--blue); background:var(--blue-soft); }
@media (max-width:1200px) {
  .inbox-pro .inbox-layout { grid-template-columns: 280px minmax(0,1fr); }
  .inbox-pro .lead-side { display: none; }
  .inbox-pro .conversation-actions .btn { padding: 8px 10px; font-size: 10px; }
}
@media (max-width:760px) {
  .page { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
  .panel-header { padding: 18px; }
  .panel-body { padding: 0 18px 18px; }
  .metrics { gap: 12px; }
  .metric-card { padding: 16px; }
  .inbox-pro .inbox-layout { grid-template-columns: 220px minmax(0,1fr); }
  .inbox-pro .messages { padding: 16px 12px; }
  .inbox-pro .conversation-head { padding: 10px 12px; flex-wrap: wrap; }
  .inbox-pro .conversation-actions { width: 100%; }
  .inbox-pro .message { max-width: 92%; }
  .inbox-global-search { width: min(35vw,240px); }
}
@media (max-width:620px) {
  .inbox-pro-topbar { padding: 12px; gap: 8px; }
  .inbox-top-actions { gap: 6px; }
  .inbox-global-search { display: none; }
  .inbox-brand span { display: none; }
  .inbox-pro .inbox-layout { grid-template-columns: 1fr; }
  .inbox-pro .inbox-list-column { max-height: 185px; border-bottom: 1px solid var(--line); }
  .inbox-pro .inbox-filter { padding: 8px 12px; }
  .inbox-pro .chat-list { display: flex; overflow-x: auto; overflow-y: hidden; }
  .inbox-pro .chat-item { flex: 0 0 240px; min-height: 74px; margin: 4px; }
  .inbox-pro .conversation { display: flex; min-height: 0; }
  .inbox-pro .inbox-layout { display: flex; flex-direction: column; }
  .inbox-pro .conversation { flex: 1; }
  .inbox-period { display: none; }
  .agent-studio-thread { width: calc(100% - 32px); }
  .agent-studio-prompt { width: calc(100% - 24px); }
}
@media (prefers-reduced-motion:reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
/* Configurable follow-ups and verified workspace Telegram notifications. */
.followup-table { border: 1px solid var(--border, #dce4ee); border-radius: 16px; overflow: hidden; }
.followup-table-head, .followup-attempt { display: grid; grid-template-columns: 1fr minmax(140px, 1.3fr) 44px; align-items: center; gap: 12px; padding: 14px 16px; }
.followup-table-head { background: #f5f8fc; color: #71809a; font-size: 13px; }
.followup-attempt { border-top: 1px solid #e2e8f0; }
.followup-attempt select { width: 100%; min-height: 44px; border: 1px solid #dce4ee; border-radius: 10px; padding: 8px 12px; background: transparent; color: inherit; }
.notification-field { display: grid; grid-template-columns: 1fr 1.2fr 44px; gap: 10px; margin-bottom: 10px; }
.notification-field input { width: 100%; min-width: 0; border: 1px solid #dce4ee; border-radius: 10px; padding: 10px; background: transparent; color: inherit; }
.notification-event-grid { display: grid; gap: 12px; }
.notification-event-grid label { display: flex; align-items: center; gap: 10px; }
.notification-pair-command { display: block; overflow-wrap: anywhere; user-select: all; margin: 12px 0; padding: 12px; background: #eef3fb; border-radius: 10px; color: #15345d; }
[data-followup-manual][hidden] { display: none !important; }
[data-theme="dark"] .followup-table-head, [data-theme="dark"] .notification-pair-command { background: #18243a; color: #b6c8e5; }
@media (max-width: 480px) { .followup-table-head, .followup-attempt { padding: 12px 8px; gap: 6px; grid-template-columns: 1fr 1.2fr 36px; } .notification-field { grid-template-columns: 1fr 36px; } .notification-field input:first-child { grid-column: 1; } .notification-field input:nth-child(2) { grid-column: 1; } .notification-field button { grid-column: 2; grid-row: 1 / 3; } }
.agent-chat-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; white-space: normal; }
.agent-group-pair { display: grid; gap: 12px; width: 100%; max-width: 480px; border: 1px solid var(--line, #dce4ee); border-radius: 16px; padding: 16px; background: var(--surface, white); }
.agent-group-pair details { font-size: 12px; line-height: 1.6; color: var(--muted, #71809a); }
.agent-group-pair summary { cursor: pointer; color: var(--ink, #15345d); }
.agent-chat-actions .btn { text-decoration: none; white-space: normal; text-align: center; }
.usage-models { display: block; margin-top: 5px; max-width: 280px; overflow-wrap: anywhere; color: var(--muted); font-size: 11px; }
.usage-cost { font-size: 22px; overflow-wrap: anywhere; }
.agent-quick-action[aria-pressed="true"] { background: var(--blue-soft); color: var(--blue); }
