:root {
  --ui-navy-950:#06192b;
  --ui-navy-900:#092b45;
  --ui-navy-800:#123f60;
  --ui-blue-700:#0874c9;
  --ui-blue-600:#078edf;
  --ui-blue-500:#12a9e8;
  --ui-blue-100:#daf2ff;
  --ui-blue-50:#f1f9fe;
  --ui-surface:#fff;
  --ui-bg:#f3f7fb;
  --ui-text:#102a43;
  --ui-muted:#61798e;
  --ui-line:#d8e6f0;
  --ui-success:#07845a;
  --ui-warning:#a26908;
  --ui-danger:#b42336;
  --ui-radius:18px;
  --ui-shadow:0 16px 42px rgba(20,65,94,.09);
  --ui-shadow-hover:0 20px 52px rgba(20,65,94,.14);
}

body.auth-page,
body.admin-shell,
body.contacts-page,
body.chatbot-admin-shell {
  color:var(--ui-text);
  background:
    radial-gradient(circle at 92% 5%,rgba(18,169,232,.08),transparent 25rem),
    var(--ui-bg)!important;
  font-family:Inter,"Segoe UI",ui-sans-serif,system-ui,-apple-system,sans-serif;
}

body.admin-shell .admin-topbar,
body.contacts-page .topbar,
body.chatbot-admin-shell .cb-product-topbar {
  border:1px solid rgba(216,230,240,.9)!important;
  background:rgba(255,255,255,.88)!important;
  box-shadow:0 10px 34px rgba(20,65,94,.07)!important;
  backdrop-filter:blur(18px) saturate(1.08);
  -webkit-backdrop-filter:blur(18px) saturate(1.08);
}

.lc-admin-brand small { padding-left:2px; font-size:.72rem; font-weight:700; }

body.admin-shell .admin-main,
body.contacts-page .page,
body.chatbot-admin-shell .cb-admin-main {
  width:min(100%,1440px);
  margin-inline:auto;
}

body.admin-shell .page-title,
body.admin-shell .integrations-title,
body.contacts-page .page-head,
body.chatbot-admin-shell .cb-page-head,
body.chatbot-admin-shell .cb-editor-head {
  margin-bottom:24px;
}

body.admin-shell .page-title h1,
body.admin-shell .integrations-title h1,
body.contacts-page .page-head h1,
body.chatbot-admin-shell .cb-page-head h1,
body.chatbot-admin-shell .cb-editor-head h1 {
  color:var(--ui-navy-950)!important;
  font-weight:800!important;
  letter-spacing:-.035em!important;
}

body.admin-shell .page-title p,
body.admin-shell .integrations-title p,
body.contacts-page .page-head p,
body.chatbot-admin-shell .cb-page-head p,
body.chatbot-admin-shell .cb-editor-head p { color:var(--ui-muted)!important; }

body.admin-shell .settings-card,
body.admin-shell .stat-card,
body.admin-shell .table-wrap,
body.admin-shell .source-card,
body.contacts-page .card,
body.contacts-page dialog,
body.chatbot-admin-shell .cb-card,
body.chatbot-admin-shell .cb-table-wrap,
body.chatbot-admin-shell .cb-form-card,
body.chatbot-admin-shell .cb-filter-card,
body.chatbot-admin-shell .cb-version-card {
  border:1px solid var(--ui-line)!important;
  border-radius:var(--ui-radius)!important;
  background:rgba(255,255,255,.96)!important;
  box-shadow:var(--ui-shadow)!important;
}

body.admin-shell .stat-card,
body.admin-shell .source-card,
body.chatbot-admin-shell .cb-card,
body.chatbot-admin-shell .cb-version-card {
  transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease;
}

body.admin-shell .stat-card:hover,
body.admin-shell .source-card:hover,
body.chatbot-admin-shell .cb-card:hover,
body.chatbot-admin-shell .cb-version-card:hover {
  border-color:#bddbea!important;
  box-shadow:var(--ui-shadow-hover)!important;
  transform:translateY(-2px);
}

body.admin-shell input,
body.admin-shell select,
body.admin-shell textarea,
body.contacts-page input,
body.contacts-page select,
body.contacts-page textarea,
body.chatbot-admin-shell input,
body.chatbot-admin-shell select,
body.chatbot-admin-shell textarea,
body.auth-page input {
  min-height:46px;
  border:1px solid #cbdce7!important;
  border-radius:12px!important;
  background:#fff!important;
  color:var(--ui-text)!important;
  transition:border-color .16s ease,box-shadow .16s ease,background .16s ease;
}

body.admin-shell input:focus,
body.admin-shell select:focus,
body.admin-shell textarea:focus,
body.contacts-page input:focus,
body.contacts-page select:focus,
body.contacts-page textarea:focus,
body.chatbot-admin-shell input:focus,
body.chatbot-admin-shell select:focus,
body.chatbot-admin-shell textarea:focus,
body.auth-page input:focus {
  border-color:var(--ui-blue-500)!important;
  outline:0!important;
  box-shadow:0 0 0 4px rgba(18,169,232,.13)!important;
}

.ui-action,
body.admin-shell .primary-button,
body.admin-shell .secondary-button,
body.admin-shell .admin-button,
body.contacts-page .btn-primary,
body.contacts-page .secondary,
body.chatbot-admin-shell .cb-btn,
body.chatbot-admin-shell .cb-row-actions a,
body.chatbot-admin-shell .cb-row-actions button,
body.chatbot-admin-shell .cb-card-actions a,
body.chatbot-admin-shell .cb-card-actions button,
body.auth-page .auth-card button[type="submit"],
body.auth-page .auth-actions .button-link {
  min-height:42px!important;
  padding:9px 15px!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:8px!important;
  border:1px solid #cfe0eb!important;
  border-radius:11px!important;
  background:#fff!important;
  color:#24445d!important;
  box-shadow:0 5px 14px rgba(20,65,94,.06)!important;
  font-size:.82rem!important;
  font-weight:750!important;
  line-height:1.2!important;
  text-decoration:none!important;
  cursor:pointer;
  transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease,background .16s ease!important;
}

.ui-action:hover,
body.admin-shell .primary-button:hover,
body.admin-shell .secondary-button:hover,
body.contacts-page .btn-primary:hover,
body.contacts-page .secondary:hover,
body.chatbot-admin-shell .cb-btn:hover,
body.chatbot-admin-shell .cb-row-actions a:hover,
body.chatbot-admin-shell .cb-row-actions button:hover {
  border-color:#a8d2e8!important;
  box-shadow:0 10px 24px rgba(20,65,94,.12)!important;
  transform:translateY(-1px);
}

.ui-action-icon { width:17px; height:17px; flex:none; stroke:currentColor; }

.ui-action {
  max-width:100%;
  min-width:0;
  white-space:normal;
  overflow-wrap:anywhere;
}

[data-ui-action="save"],
[data-ui-action="create"],
[data-ui-action="publish"],
body.admin-shell .primary-button,
body.contacts-page .btn-primary,
body.chatbot-admin-shell .cb-btn.primary,
body.chatbot-admin-shell .cb-btn.success,
body.auth-page .auth-card button[type="submit"] {
  border-color:transparent!important;
  background:linear-gradient(135deg,var(--ui-blue-500),var(--ui-blue-700))!important;
  color:#fff!important;
  box-shadow:0 10px 24px rgba(8,116,201,.22)!important;
}

[data-ui-action="test"] { border-color:#bfd8ef!important; background:#eef7ff!important; color:#075f9e!important; }
[data-ui-action="edit"] { border-color:#c9e4f0!important; background:#f2fbff!important; color:#096c9e!important; }
[data-ui-action="delete"],.ui-action.danger,.cb-btn.danger { border-color:#f1c5cb!important; background:#fff5f6!important; color:var(--ui-danger)!important; }
[data-ui-action="back"] { background:#f7fafc!important; color:#526d82!important; }
[data-ui-action="refresh"] { border-color:#c7e5dd!important; background:#f0fbf7!important; color:#08775d!important; }
[data-ui-action="chat"], [data-ui-action="open"] { border-color:transparent!important; background:linear-gradient(135deg,var(--ui-blue-600),var(--ui-blue-700))!important; color:#fff!important; }
[data-ui-action="block"] { border-color:#edd9a5!important; background:#fff9e9!important; color:#8a6507!important; }
[data-ui-action="history"], [data-ui-action="filter"] { border-color:#d4e1ea!important; background:#f7fafc!important; color:#405e75!important; }
[data-ui-action="cancel"] { border-color:#d6e1e8!important; background:#f7f9fb!important; color:#526979!important; }
[data-ui-action="check"] { border-color:#bde2d4!important; background:#effaf6!important; color:#08775d!important; }
[data-ui-action="layout"], [data-ui-action="expand"], [data-ui-action="collapse"], [data-ui-action="copy"] { border-color:#c9deea!important; background:#f3f9fc!important; color:#24627f!important; }
[data-ui-action="send"] { border-color:transparent!important; background:linear-gradient(135deg,var(--ui-blue-600),var(--ui-blue-700))!important; color:#fff!important; }

body.admin-shell .source-card { display:flex; flex-direction:column; min-height:100%; }
body.admin-shell .source-card footer { margin-top:auto; padding-top:20px; }
body.admin-shell .source-card:has(input[name="active"]:checked) {
  border-color:#7fcbed!important;
  box-shadow:0 18px 48px rgba(8,142,223,.15)!important;
}
body.admin-shell .source-card:has(input[name="active"]:checked) .connection-pill.ok::before {
  content:"Ativa · ";
}
body.admin-shell .source-switch { border:1px solid transparent; }
body.admin-shell .source-switch:has(input:focus-visible) { border-color:var(--ui-blue-500); box-shadow:0 0 0 4px rgba(18,169,232,.12); }

body.admin-shell .admin-actions { gap:10px!important; }
body.admin-shell .admin-actions .primary-button { min-width:190px; }
body.admin-shell table th,
body.chatbot-admin-shell .cb-table th { color:#637c90!important; font-size:.72rem!important; letter-spacing:.045em; }
body.admin-shell table td,
body.chatbot-admin-shell .cb-table td { font-size:.79rem!important; line-height:1.45; }

@media(min-width:1100px) {
  body.admin-shell .stat-grid { grid-template-columns:repeat(3,minmax(0,1fr))!important; }
}

body.chatbot-admin-shell:has(#chatbot-editor) { overflow-x:hidden; }
body.chatbot-admin-shell .cb-admin-main:has(#chatbot-editor) { width:100%; max-width:none; padding-inline:16px; overflow-x:hidden; }
body.chatbot-admin-shell #chatbot-editor,
body.chatbot-admin-shell #chatbot-editor .cb-editor-view,
body.chatbot-admin-shell #chatbot-editor .cb-customer-editor,
body.chatbot-admin-shell #chatbot-editor .cb-editor-grid { max-width:100%; min-width:0; }

@media(min-width:1051px) and (max-width:1399px) {
  body.chatbot-admin-shell #chatbot-editor .cb-customer-editor {
    grid-template-columns:230px minmax(390px,1fr) 260px!important;
    gap:10px!important;
  }
}

body.contacts-page .topbar { border-radius:18px!important; }
body.contacts-page .contact-row { transition:background .16s ease,transform .16s ease; }
body.contacts-page .contact-row:hover { transform:translateX(2px); }
body.contacts-page dialog { overflow:hidden; }

body.chatbot-admin-shell .cb-product-topbar { height:82px!important; }
body.chatbot-admin-shell .cb-topbar-title strong { font-size:1.15rem; letter-spacing:-.02em; }
body.chatbot-admin-shell .cb-section-tabs { height:46px; }
body.chatbot-admin-shell .cb-section-tabs a { min-height:44px; font-weight:700; }
body.chatbot-admin-shell .cb-table { min-width:860px; }
body.chatbot-admin-shell .cb-row-actions { min-width:230px; gap:6px; }
body.chatbot-admin-shell .cb-row-actions a,
body.chatbot-admin-shell .cb-row-actions button,
body.chatbot-admin-shell .cb-card-actions a,
body.chatbot-admin-shell .cb-card-actions button { min-height:38px!important; padding:8px 11px!important; font-size:.75rem!important; }
body.chatbot-admin-shell .cb-pill { min-height:25px; padding:5px 9px; border-radius:999px; font-size:.68rem; }
body.chatbot-admin-shell .cb-kpi small,
body.chatbot-admin-shell .cb-card p,
body.chatbot-admin-shell .cb-definition-list,
body.chatbot-admin-shell .cb-simple-table { font-size:.76rem!important; }

body.auth-page .auth-card { position:relative; }
body.auth-page .auth-card button[type="submit"],
body.auth-page .auth-card .pwa-install-btn { width:100%; }
body.auth-page .auth-field .ui-password-wrap { width:100%; }
body.auth-page .auth-field .ui-password-wrap > input { padding-right:48px!important; }

.ui-password-wrap { position:relative; }
.ui-password-wrap > input { width:100%; padding-right:48px!important; }
.ui-password-toggle {
  position:absolute!important;
  right:6px; bottom:5px;
  width:38px!important; min-width:38px!important; min-height:38px!important;
  padding:0!important; border:0!important; border-radius:9px!important;
  background:transparent!important; color:#58758c!important; box-shadow:none!important;
}

@media(max-width:899px) {
  body.admin-shell .admin-main,body.contacts-page .page,body.chatbot-admin-shell .cb-admin-main { padding-inline:14px!important; }
  body.chatbot-admin-shell .cb-product-topbar { height:70px!important; padding-inline:68px 14px!important; }
  body.admin-shell .admin-actions { display:grid!important; grid-template-columns:1fr 1fr; }
  body.admin-shell .admin-actions button { width:100%; }
  body.admin-shell .admin-topbar,
  body.contacts-page .topbar,
  body.chatbot-admin-shell .cb-product-topbar { min-width:0; }
}

@media(max-width:620px) {
  body.contacts-page .topbar { padding-left:68px!important; padding-right:10px!important; gap:8px!important; }
  body.contacts-page .topbar .brand strong { display:none!important; }
  body.contacts-page .topbar .back-link { display:none!important; }
  body.contacts-page .topbar .top-actions { margin-left:auto; gap:6px!important; }
  body.contacts-page .topbar #new-contact { min-width:42px; padding-inline:11px!important; }
  body.admin-shell .admin-actions { grid-template-columns:1fr; }
  body.admin-shell .source-card footer { display:grid; grid-template-columns:1fr; }
  body.admin-shell .source-card footer button,
  body.contacts-page dialog footer button,
  body.chatbot-admin-shell .cb-head-actions>.cb-btn,
  body.chatbot-admin-shell .cb-head-actions>form>.cb-btn { width:100%; }
  body.chatbot-admin-shell .cb-head-actions { width:100%; display:grid; grid-template-columns:1fr 1fr; }
  body.admin-shell .ui-action,
  body.contacts-page .ui-action,
  body.chatbot-admin-shell .ui-action { min-height:44px!important; }
}

@media(prefers-reduced-motion:reduce) {
  body.admin-shell .stat-card,body.admin-shell .source-card,body.chatbot-admin-shell .cb-card,.ui-action { transition:none!important; }
}

/* Unified application interface — desktop and mobile */
:root {
  --ui-content:1440px;
  --ui-header-height:76px;
  --ui-control-height:44px;
  --ui-space-1:6px;
  --ui-space-2:10px;
  --ui-space-3:14px;
  --ui-space-4:20px;
  --ui-space-5:28px;
  --ui-radius-sm:10px;
  --ui-radius-md:14px;
  --ui-radius-lg:20px;
  --ui-focus:0 0 0 4px rgba(18,169,232,.15);
}

html { max-width:100%; overflow-x:hidden; }
body { text-rendering:optimizeLegibility; -webkit-font-smoothing:antialiased; }
button,a,input,select,textarea { -webkit-tap-highlight-color:transparent; }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible {
  outline:2px solid var(--ui-blue-500)!important;
  outline-offset:2px;
}
.ui-icon-only { display:inline-grid!important; place-items:center!important; }
.ui-icon-only .ui-action-icon { width:19px; height:19px; }

/* Global navigation */
.app-rail {
  border-right:1px solid rgba(205,224,236,.95)!important;
  background:linear-gradient(180deg,#f8fcff 0%,#eaf7fe 100%)!important;
  box-shadow:8px 0 28px rgba(21,78,112,.06)!important;
}
.app-rail-item {
  border-radius:12px!important;
  transition:background .16s ease,color .16s ease,box-shadow .16s ease,transform .16s ease!important;
}
.app-rail-item:hover { background:#e1f4fd!important; color:var(--ui-blue-700)!important; transform:translateY(-1px); }
.app-rail-item.active {
  color:#fff!important;
  background:linear-gradient(145deg,var(--ui-blue-500),var(--ui-blue-700))!important;
  box-shadow:0 9px 22px rgba(8,116,201,.24)!important;
}
.app-rail-item svg.app-rail-icon {
  width:38px!important;
  height:38px!important;
  padding:8px!important;
  border:1px solid rgba(8,116,201,.14)!important;
  border-radius:11px!important;
  color:#126f9f!important;
  background:rgba(255,255,255,.78)!important;
  stroke-width:1.8!important;
  box-shadow:0 5px 14px rgba(16,99,143,.09),inset 0 1px 0 #fff!important;
}
.app-rail-item:hover svg.app-rail-icon,
.app-rail-item:focus-visible svg.app-rail-icon,
.app-rail-item[aria-expanded="true"] svg.app-rail-icon {
  color:var(--ui-blue-700)!important;
  border-color:rgba(8,116,201,.25)!important;
  background:#fff!important;
}
.app-rail-item.active svg.app-rail-icon {
  color:#fff!important;
  border-color:rgba(255,255,255,.32)!important;
  background:rgba(255,255,255,.15)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.25)!important;
}
.app-rail-flyout {
  border:1px solid var(--ui-line)!important;
  border-radius:18px!important;
  background:rgba(255,255,255,.98)!important;
  box-shadow:0 22px 58px rgba(11,51,78,.16)!important;
  padding:10px!important;
}
.app-rail-flyout header { padding:8px 10px 11px!important; }
.app-rail-flyout a {
  min-height:43px!important;
  border-radius:10px!important;
  padding:9px 11px!important;
  gap:10px!important;
}
.app-rail-flyout a:hover,.app-rail-flyout a.active { background:var(--ui-blue-50)!important; color:var(--ui-blue-700)!important; }

/* Shared page framing */
body.admin-shell .admin-topbar,
body.contacts-page .topbar,
body.chatbot-admin-shell .cb-product-topbar {
  min-height:var(--ui-header-height)!important;
  height:var(--ui-header-height)!important;
  border-radius:0!important;
  border-width:0 0 1px!important;
  box-shadow:0 8px 24px rgba(20,65,94,.055)!important;
}
body.admin-shell .admin-main,
body.contacts-page .page,
body.chatbot-admin-shell .cb-admin-main,
.channel-admin {
  width:min(100%,var(--ui-content));
  margin-inline:auto;
}
body.admin-shell .admin-main,
body.contacts-page .page,
body.chatbot-admin-shell .cb-admin-main { padding:30px 28px 44px!important; }

body.admin-shell .page-title,
body.admin-shell .integrations-title,
body.contacts-page .page-head,
body.chatbot-admin-shell .cb-page-head,
.channel-admin-heading {
  min-height:64px;
  align-items:flex-start!important;
  gap:18px!important;
  margin-bottom:24px!important;
}
body.admin-shell h1,body.contacts-page h1,body.chatbot-admin-shell h1,.channel-admin h1 {
  color:var(--ui-navy-950)!important;
  font-size:clamp(1.65rem,2.5vw,2.15rem)!important;
  line-height:1.16!important;
  letter-spacing:-.035em!important;
  font-weight:820!important;
}

/* Shared surfaces */
body.admin-shell .settings-card,
body.admin-shell .stat-card,
body.admin-shell .table-wrap,
body.admin-shell .source-card,
body.contacts-page .card,
body.contacts-page dialog,
body.chatbot-admin-shell .cb-card,
body.chatbot-admin-shell .cb-table-wrap,
body.chatbot-admin-shell .cb-form-card,
body.chatbot-admin-shell .cb-filter-card,
body.chatbot-admin-shell .cb-version-card,
.channel-card,.channel-create {
  border:1px solid var(--ui-line)!important;
  border-radius:var(--ui-radius-lg)!important;
  background:#fff!important;
  box-shadow:var(--ui-shadow)!important;
}
body.admin-shell .settings-card,
body.admin-shell .source-card,
body.chatbot-admin-shell .cb-card,
body.chatbot-admin-shell .cb-form-card,
.channel-card,.channel-create { padding:22px!important; }

/* Controls, fields and switches */
body.admin-shell input,body.admin-shell select,body.admin-shell textarea,
body.contacts-page input,body.contacts-page select,body.contacts-page textarea,
body.chatbot-admin-shell input,body.chatbot-admin-shell select,body.chatbot-admin-shell textarea,
.channel-admin input,.channel-admin select,.channel-admin textarea {
  width:100%;
  min-width:0;
  min-height:var(--ui-control-height);
  padding:10px 13px;
  border:1px solid #cbdce7!important;
  border-radius:12px!important;
  color:var(--ui-text)!important;
  background:#fff!important;
}
body.admin-shell label,body.contacts-page label,body.chatbot-admin-shell label,.channel-admin label {
  color:#24425a;
}
body.admin-shell input[type="checkbox"],body.admin-shell input[type="radio"],
body.contacts-page input[type="checkbox"],body.contacts-page input[type="radio"],
body.chatbot-admin-shell input[type="checkbox"],body.chatbot-admin-shell input[type="radio"],
.channel-admin input[type="checkbox"],.channel-admin input[type="radio"] {
  width:auto!important;
  min-width:16px!important;
  min-height:16px!important;
  padding:0!important;
  box-shadow:none!important;
}
body.admin-shell .source-switch { min-height:68px; border-radius:14px!important; }
body.admin-shell .source-switch i { flex:none; }

/* Uniform actions */
.channel-admin button,.channel-admin .channel-back,
.channel-admin a:not(.app-rail-brand),
.app-shell .conversation-sort-popover button {
  min-height:42px;
  display:inline-flex;
  align-items:center;
  justify-content:flex-start;
  gap:8px;
  padding:9px 14px;
  border:0;
  border-radius:11px;
  background:transparent;
  color:#24445d;
  font:750 .82rem/1.2 Inter,"Segoe UI",sans-serif;
  text-decoration:none;
  cursor:pointer;
}
.channel-admin button[type="submit"] {
  border-color:transparent;
  color:#fff;
  background:linear-gradient(135deg,var(--ui-blue-500),var(--ui-blue-700));
  box-shadow:0 10px 24px rgba(8,116,201,.22);
}
.channel-admin .channel-back { background:#f7fafc; }
.ui-action:disabled,.ui-icon-only:disabled { opacity:.48!important; cursor:not-allowed!important; transform:none!important; }

/* Tables, status and feedback */
body.admin-shell table,body.chatbot-admin-shell .cb-table { width:100%; border-collapse:separate; border-spacing:0; }
body.admin-shell table th,body.chatbot-admin-shell .cb-table th {
  min-height:44px;
  padding:12px 14px!important;
  background:#f5f9fc!important;
  color:#526e83!important;
}
body.admin-shell table td,body.chatbot-admin-shell .cb-table td { padding:13px 14px!important; border-bottom:1px solid #e8f0f5!important; }
body.admin-shell table tbody tr:hover,body.chatbot-admin-shell .cb-table tbody tr:hover { background:#f8fcff; }
.connection-pill,.channel-card-status,.cb-pill,.badge {
  min-height:25px!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  padding:5px 9px!important;
  border-radius:999px!important;
  font-size:.7rem!important;
  font-weight:800!important;
}
.alert,.dialog-alert,.channel-alert,.cb-alert,.composer-error,.channel-dialog-error {
  border-radius:12px!important;
  padding:12px 14px!important;
  font-size:.82rem!important;
  line-height:1.5!important;
}
.pagination,.conversation-pagination { min-height:54px; display:flex; align-items:center; justify-content:center; gap:9px; padding:10px; }
.pagination button,.conversation-pagination button {
  min-width:42px; min-height:42px; border:1px solid var(--ui-line); border-radius:10px; background:#fff; color:var(--ui-blue-700); font-weight:750;
}

/* Contacts */
body.contacts-page .page-head { display:grid!important; grid-template-columns:minmax(0,1fr) minmax(300px,430px)!important; }
body.contacts-page .search-field { align-self:center; min-height:46px; border-radius:12px!important; }
body.contacts-page .contact-row { min-height:112px; padding:18px 20px!important; gap:16px!important; }
body.contacts-page .row-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px!important; }
body.contacts-page dialog {
  width:min(540px,calc(100vw - 32px))!important;
  max-height:min(760px,calc(100dvh - 32px))!important;
  margin:auto!important;
  padding:0!important;
}
body.contacts-page dialog form { max-height:inherit; overflow:auto; padding:22px; }
body.contacts-page dialog header { position:sticky; top:-22px; z-index:2; background:#fff; }
body.contacts-page dialog footer { display:flex; justify-content:flex-end; gap:10px; }
body.contacts-page dialog::backdrop { background:rgba(3,24,39,.5); backdrop-filter:blur(4px); }

/* Unified administration and channels */
.integrations-title>span { flex:none; }
.integrations-title>span svg { width:25px; height:25px; }
.channel-admin {
  min-height:100dvh;
  margin-left:auto!important;
  padding:34px 28px 48px!important;
  color:var(--ui-text);
}
.channel-admin-heading h1 { margin:4px 0 7px!important; }
.channel-admin-heading p { margin:0; }
.channel-grid { gap:20px!important; }
.channel-card>header { min-height:54px; }
.channel-card-icon { width:46px!important; height:46px!important; border-radius:13px!important; }
.channel-create { grid-template-columns:minmax(260px,.8fr) minmax(360px,1.2fr)!important; gap:28px!important; }
.webqr-actions { flex-wrap:wrap; }

/* Chatbot remains wide, but uses the same identity */
body.chatbot-admin-shell .cb-app-shell { grid-template-columns:minmax(0,1fr)!important; }
body.chatbot-admin-shell .cb-workspace { min-width:0; }
body.chatbot-admin-shell .cb-product-topbar { padding-left:28px!important; }
body.chatbot-admin-shell .cb-section-tabs a { color:#49657a!important; border-color:transparent; }
body.chatbot-admin-shell .cb-section-tabs a.active { color:var(--ui-blue-700)!important; border-color:var(--ui-blue-600)!important; }
body.chatbot-admin-shell .cb-eyebrow,body.chatbot-admin-shell .cb-kicker { color:var(--ui-blue-700)!important; }
body.chatbot-admin-shell .cb-admin-main:has(#chatbot-editor) { max-width:none!important; padding-inline:18px!important; }
body.chatbot-admin-shell .cb-editor-head { border-radius:14px!important; }
body.chatbot-admin-shell .cb-editor-tabs button.active,
body.chatbot-admin-shell .cb-mobile-editor-tabs button.active { background:var(--ui-blue-700)!important; }
body.chatbot-admin-shell .cb-customer-editor,
body.chatbot-admin-shell .cb-editor-grid { max-width:100%; min-width:0; }
body.chatbot-admin-shell .cb-agenda-table__head,
body.chatbot-admin-shell .cb-agenda-table__row {
  grid-template-columns:minmax(170px,1.05fr) minmax(360px,1.75fr) minmax(90px,.45fr) minmax(214px,.75fr)!important;
  gap:16px!important;
}
body.chatbot-admin-shell .cb-inline-actions {
  display:grid!important;
  grid-template-columns:repeat(2,minmax(98px,1fr));
  gap:8px!important;
  justify-content:stretch!important;
  min-width:214px;
}
body.chatbot-admin-shell .cb-inline-actions form { min-width:0; }
body.chatbot-admin-shell .cb-inline-actions .cb-btn {
  width:100%!important;
  min-width:98px!important;
  white-space:nowrap!important;
  overflow-wrap:normal!important;
  padding-inline:12px!important;
}

/* Central: dedicated desktop workspace */
body.app-shell.has-app-rail { color:var(--ui-text); }
body.app-shell.has-app-rail .channel-context-button,
body.app-shell.has-app-rail .app-header,
body.app-shell.has-app-rail .chat-header,
body.app-shell.has-app-rail .details-heading { background:rgba(255,255,255,.97)!important; }
body.app-shell.has-app-rail .channel-context-button { border:1px solid var(--ui-line)!important; border-radius:14px!important; }
body.app-shell.has-app-rail .conversation-list { border-right:1px solid var(--ui-line)!important; }
body.app-shell.has-app-rail .conversation-item {
  align-items:flex-start;
  min-height:84px;
  padding:14px 12px;
  gap:12px;
  border-radius:12px;
}
body.app-shell.has-app-rail .conversation-item:hover,
body.app-shell.has-app-rail .conversation-item.selected { background:var(--ui-blue-50)!important; }
body.app-shell.has-app-rail .conversation-item .list-avatar {
  width:44px; height:44px; margin-top:2px;
}
body.app-shell.has-app-rail .conversation-copy {
  min-width:0; flex:1 1 auto; gap:4px;
}
body.app-shell.has-app-rail .conversation-copy strong {
  display:flex; align-items:center; gap:8px; min-width:0;
  font-size:.95rem; line-height:1.3; font-weight:750;
}
body.app-shell.has-app-rail .conversation-name {
  min-width:0; flex:1 1 auto; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
body.app-shell.has-app-rail .conversation-channel-badge {
  flex:none; max-width:78px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  font-size:.62rem; font-style:normal; font-weight:800;
  padding:2px 7px; border-radius:999px; background:#e8f3ff; color:#17639a;
}
body.app-shell.has-app-rail .conversation-copy small {
  display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  color:#667781; font-size:.8rem; line-height:1.35; margin-top:2px;
}
body.app-shell.has-app-rail .conversation-ownership {
  display:flex; flex-wrap:wrap; align-items:center; gap:6px 8px; margin-top:6px;
}
body.app-shell.has-app-rail .conversation-ownership i {
  font-size:.64rem; padding:3px 8px; line-height:1.2;
}
body.app-shell.has-app-rail .conversation-ownership em {
  max-width:100%; white-space:normal; overflow:visible; text-overflow:unset;
  font-size:.72rem; line-height:1.3; color:#5b6f86;
}
body.app-shell.has-app-rail .conversation-side {
  flex:none; padding-top:2px; min-width:3.2rem;
}
body.app-shell.has-app-rail .conversation-side time {
  font-size:.72rem; white-space:nowrap;
}
body.app-shell.has-app-rail .composer.is-idle,
body.app-shell.has-app-rail .chat-composer.is-idle {
  opacity:.55;
  pointer-events:none;
  filter:grayscale(.35);
}
body.app-shell.has-app-rail .composer.is-idle #message-input,
body.app-shell.has-app-rail .chat-composer.is-idle #message-input {
  background:#e8eef4!important;
  color:#7a8a9c!important;
}
body.app-shell.has-app-rail .composer.is-idle .composer-action,
body.app-shell.has-app-rail .chat-composer.is-idle .composer-action,
body.app-shell.has-app-rail .composer.is-idle .send,
body.app-shell.has-app-rail .chat-composer.is-idle .send,
body.app-shell.has-app-rail .composer.is-idle .send.is-mic,
body.app-shell.has-app-rail .chat-composer.is-idle .send.is-mic {
  background:#d9e2ec!important;
  color:#8a97a8!important;
  box-shadow:none!important;
}
body.app-shell.has-app-rail .workspace > .details-panel {
  display:flex!important;
  flex-direction:column!important;
  overflow:hidden!important;
}
body.app-shell.has-app-rail .workspace > .details-panel.details-hidden {
  display:none!important;
}
body.app-shell.has-app-rail .workspace > .details-panel .details-content,
body.app-shell.has-app-rail .workspace > .details-panel #details-content {
  flex:1 1 auto!important;
  min-height:0!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  overscroll-behavior:contain;
}
body.app-shell.has-app-rail .chat-header-action,
body.app-shell.has-app-rail .composer-action {
  flex:none; width:42px; min-width:42px; height:42px; min-height:42px; border-radius:11px!important;
}
body.app-shell.has-app-rail .chat-header-action:hover,
body.app-shell.has-app-rail .composer-action:hover { background:var(--ui-blue-50)!important; color:var(--ui-blue-700)!important; }
body.app-shell.has-app-rail .welcome-card { border:1px solid var(--ui-line)!important; box-shadow:var(--ui-shadow)!important; }
body.app-shell.has-app-rail .channel-dialog,
body.app-shell.has-app-rail .message-status-dialog,
body.app-shell.has-app-rail .shared-all-modal,
body.app-shell.has-app-rail .erp-customer-dialog,
body.app-shell.has-app-rail .ownership-dialog {
  width:min(620px,calc(100vw - 32px))!important;
  max-width:calc(100vw - 32px)!important;
  max-height:calc(100dvh - 32px)!important;
  border-radius:20px!important;
  box-shadow:0 26px 70px rgba(5,32,50,.22)!important;
}

/* Tablet */
@media(max-width:1024px) {
  body.admin-shell .admin-main,body.contacts-page .page,body.chatbot-admin-shell .cb-admin-main,.channel-admin { padding:24px 18px 38px!important; }
  body.contacts-page .page-head { grid-template-columns:1fr minmax(280px,380px)!important; }
  body.admin-shell .source-grid { grid-template-columns:1fr!important; }
  .channel-create { grid-template-columns:1fr!important; }
  body.chatbot-admin-shell .cb-table-wrap,body.admin-shell .table-wrap { overflow:auto; scrollbar-gutter:stable; }
  body.chatbot-admin-shell .cb-agenda-table { overflow-x:auto!important; }
  body.chatbot-admin-shell .cb-agenda-table__head,
  body.chatbot-admin-shell .cb-agenda-table__row { min-width:880px; }
}

/* Mobile is a separate interaction layout, not a squeezed desktop */
@media(max-width:899px) {
  :root { --ui-header-height:64px; }
  .app-rail { box-shadow:18px 0 50px rgba(6,35,54,.2)!important; }
  .app-rail-flyout {
    position:fixed!important;
    left:76px!important;
    right:12px!important;
    top:auto!important;
    bottom:calc(12px + env(safe-area-inset-bottom))!important;
    width:auto!important;
    max-height:min(68dvh,560px)!important;
    overflow:auto!important;
  }
  body.admin-shell .admin-topbar,body.contacts-page .topbar,body.chatbot-admin-shell .cb-product-topbar {
    padding-left:76px!important;
    padding-right:12px!important;
  }
  body.admin-shell .admin-main,body.contacts-page .page,body.chatbot-admin-shell .cb-admin-main,.channel-admin {
    width:100%; padding:20px 14px calc(92px + env(safe-area-inset-bottom))!important;
  }
  body.app-shell.has-app-rail:not([data-user-id]) {
    width:100%!important;
    height:auto!important;
    min-height:100dvh!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    background:var(--ui-bg)!important;
  }
  body.admin-shell .page-title,body.admin-shell .integrations-title,body.contacts-page .page-head,
  body.chatbot-admin-shell .cb-page-head,.channel-admin-heading { min-height:0; margin-bottom:18px!important; }

  /* Central switches between list, conversation and details */
  body.app-shell.has-app-rail,.shell-body,.workspace { width:100%!important; max-width:100vw!important; height:100dvh!important; overflow:hidden!important; }
  body.app-shell.has-app-rail .workspace { display:block!important; position:relative!important; }
  body.app-shell.has-app-rail .conversation-list,
  body.app-shell.has-app-rail .chat-panel,
  body.app-shell.has-app-rail .details-panel {
    position:absolute!important; inset:0!important; width:100%!important; max-width:none!important; height:100dvh!important; min-height:0!important;
  }
  body.app-shell.has-app-rail .conversation-list { display:flex!important; flex-direction:column!important; z-index:1; padding-left:0!important; min-height:0!important; overflow:hidden!important; }
  body.app-shell.has-app-rail .chat-panel { display:none!important; z-index:3; }
  body.app-shell.has-app-rail.chat-open .conversation-list { display:none!important; }
  body.app-shell.has-app-rail.chat-open .chat-panel { display:grid!important; grid-template-rows:auto auto minmax(0,1fr) auto auto auto; }
  body.app-shell.has-app-rail .details-panel { display:none!important; z-index:8!important; transform:none!important; overflow:hidden!important; }
  body.app-shell.has-app-rail .details-panel.details-open {
    display:flex!important;
    flex-direction:column!important;
    overflow:hidden!important;
  }
  body.app-shell.has-app-rail .details-panel.details-open .details-heading {
    flex:none!important;
  }
  body.app-shell.has-app-rail .details-panel.details-open .details-content,
  body.app-shell.has-app-rail .details-panel.details-open #details-content {
    flex:1 1 auto!important;
    min-height:0!important;
    height:auto!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior:contain;
  }
  body.app-shell.has-app-rail .conversation-list .conversation-items {
    flex:1 1 auto!important;
    min-height:0!important;
    overflow-y:auto!important;
    -webkit-overflow-scrolling:touch;
  }
  body.app-shell.has-app-rail .conversation-item {
    align-items:flex-start!important;
    min-height:76px!important;
    padding:12px 10px!important;
    gap:10px!important;
  }
  body.app-shell.has-app-rail .conversation-item .list-avatar {
    width:46px!important;
    height:46px!important;
    margin-top:2px;
  }
  body.app-shell.has-app-rail .conversation-copy {
    min-width:0!important;
    flex:1 1 auto!important;
    gap:3px!important;
  }
  body.app-shell.has-app-rail .conversation-copy strong {
    display:flex!important;
    align-items:center;
    gap:6px;
    min-width:0;
    overflow:hidden;
    font-size:.92rem!important;
    line-height:1.25!important;
  }
  body.app-shell.has-app-rail .conversation-copy strong {
    white-space:nowrap;
    text-overflow:ellipsis;
  }
  body.app-shell.has-app-rail .conversation-channel-badge {
    flex:none;
    max-width:64px;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  body.app-shell.has-app-rail .conversation-copy small {
    display:block!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    font-size:.78rem!important;
    line-height:1.3!important;
    color:#667781!important;
  }
  body.app-shell.has-app-rail .conversation-ownership {
    flex-wrap:wrap!important;
    gap:4px 6px!important;
    margin-top:4px!important;
  }
  body.app-shell.has-app-rail .conversation-ownership i {
    font-size:.62rem!important;
    padding:3px 7px!important;
    line-height:1.2!important;
  }
  body.app-shell.has-app-rail .conversation-ownership em {
    max-width:100%!important;
    font-size:.66rem!important;
  }
  body.app-shell.has-app-rail .conversation-side {
    flex:none!important;
    padding-top:2px;
  }
  body.app-shell.has-app-rail .conversation-side time {
    font-size:.68rem!important;
    white-space:nowrap;
  }
  body.app-shell.has-app-rail .conversation-list .app-header {
    min-height:48px!important;
    padding:10px 14px 6px!important;
  }
  body.app-shell.has-app-rail .conversation-list .app-header h1 {
    font-size:1.2rem!important;
  }
  body.app-shell.has-app-rail .conversation-list .search {
    margin:0 12px 8px!important;
  }
  body.app-shell.has-app-rail .conversation-list .filters {
    padding:0 12px 8px!important;
  }
  body.app-shell.has-app-rail .channel-context { padding:10px 12px 6px!important; }
  body.app-shell.has-app-rail .app-header,body.app-shell.has-app-rail .chat-header { min-height:64px!important; height:auto!important; padding:10px 12px!important; }
  body.app-shell.has-app-rail:not(.chat-open) .chat-header-actions { max-width:calc(100vw - 150px); overflow-x:auto; scrollbar-width:none; }
  body.app-shell.has-app-rail.chat-open .chat-header-actions { max-width:none!important; overflow:visible!important; }
  body.app-shell.has-app-rail .message-area { min-height:0!important; padding:14px 10px!important; }
  body.app-shell.has-app-rail .message-bubble { max-width:88%!important; }
  /* Composer phone: pílula + bolinha (estilo WhatsApp mobile) */
  body.app-shell.has-app-rail .composer,
  body.app-shell.has-app-rail .chat-composer {
    display:flex!important;
    flex-direction:column!important;
    align-items:stretch!important;
    gap:0!important;
    padding:8px 10px max(10px,env(safe-area-inset-bottom))!important;
  }
  body.app-shell.has-app-rail .composer-main {
    display:flex!important;
    align-items:flex-end!important;
    gap:8px!important;
    width:100%;
  }
  body.app-shell.has-app-rail .composer-pill {
    flex:1 1 auto!important;
    min-width:0!important;
  }
  body.app-shell.has-app-rail .chat-composer-actions {
    display:none!important;
  }
  body.app-shell.has-app-rail .composer-action {
    width:40px!important; min-width:40px!important; height:40px!important; min-height:40px!important;
    touch-action:manipulation;
    border-radius:50%!important;
  }
  body.app-shell.has-app-rail .chat-composer-input,
  body.app-shell.has-app-rail .composer #message-input {
    min-width:0!important;
    width:auto!important;
    background:transparent!important;
    border-radius:0!important;
  }
  body.app-shell.has-app-rail .composer .send,
  body.app-shell.has-app-rail .chat-composer .send {
    width:48px!important; min-width:48px!important; height:48px!important;
    border-radius:50%!important;
  }
  body.app-shell.has-app-rail .composer.is-voice-active .send,
  body.app-shell.has-app-rail .chat-composer.is-voice-active .send,
  body.app-shell.has-app-rail .composer.is-voice-active .composer-main,
  body.app-shell.has-app-rail .chat-composer.is-voice-active .composer-main,
  body.app-shell.has-app-rail .composer.is-voice-active .composer-tools,
  body.app-shell.has-app-rail .chat-composer.is-voice-active .composer-tools,
  body.app-shell.has-app-rail .composer.is-voice-active .composer-pill,
  body.app-shell.has-app-rail .chat-composer.is-voice-active .composer-pill {
    display:none!important;
  }
  body.app-shell.has-app-rail .composer.is-voice-active,
  body.app-shell.has-app-rail .chat-composer.is-voice-active {
    display:flex!important;
  }
  body.app-shell.has-app-rail .conversation-list .app-header .list-action {
    width:40px!important; height:40px!important; min-width:40px; min-height:40px;
  }
  body.app-shell.has-app-rail .message-react-btn,
  body.app-shell.has-app-rail .message-menu-btn,
  body.app-shell.has-app-rail .message-reply-btn,
  body.app-shell.has-app-rail .reply-message-action {
    width:40px!important; height:40px!important; min-width:40px!important;
  }

  /* Chatbot panels become switchable/full-width */
  body.chatbot-admin-shell .cb-section-tabs { display:none!important; }
  body.chatbot-admin-shell .cb-top-actions { min-width:0; margin-left:auto; }
  body.chatbot-admin-shell .cb-top-actions .cb-btn.secondary { display:none!important; }
  body.chatbot-admin-shell .cb-editor-grid,body.chatbot-admin-shell .cb-customer-editor { display:block!important; height:auto!important; min-height:0!important; }
  body.chatbot-admin-shell .cb-component-panel,body.chatbot-admin-shell .cb-canvas-panel,
  body.chatbot-admin-shell .cb-properties-panel { width:100%!important; max-width:100%!important; min-height:60dvh; }
  body.chatbot-admin-shell .cb-properties-panel { position:fixed!important; inset:76px 10px 10px!important; height:auto!important; z-index:60!important; }
}

@media(max-width:899px) {
  body.contacts-page .topbar { display:flex!important; min-height:64px!important; }
  body.contacts-page .topbar .brand { min-width:0; }
  body.contacts-page .topbar .brand strong,body.contacts-page .back-link { display:none!important; }
  body.contacts-page .page-head { display:grid!important; grid-template-columns:1fr!important; gap:14px!important; }
  body.contacts-page .search-field { width:100%!important; }
  body.contacts-page .contact-row { display:grid!important; grid-template-columns:auto minmax(0,1fr)!important; padding:16px 14px!important; }
  body.contacts-page .row-actions { grid-column:1/-1; display:grid!important; grid-template-columns:1fr 1fr; width:100%; }
  body.contacts-page .row-actions>* { width:100%!important; }
  body.contacts-page dialog { width:calc(100vw - 20px)!important; max-height:calc(100dvh - 20px)!important; }
  body.contacts-page dialog form { padding:17px!important; }
  body.contacts-page dialog footer { position:sticky; bottom:-17px; padding:12px 0 0; background:#fff; display:grid!important; grid-template-columns:1fr 1fr; }

  body.admin-shell .page-title,body.admin-shell .integrations-title,.channel-admin-heading,
  body.chatbot-admin-shell .cb-page-head,body.chatbot-admin-shell .cb-editor-head { display:grid!important; grid-template-columns:1fr!important; }
  body.admin-shell .source-fields,body.admin-shell .settings-grid { grid-template-columns:1fr!important; }
  body.admin-shell .source-fields label:first-child { grid-column:auto!important; }
  body.admin-shell .source-card footer,.webqr-actions { display:grid!important; grid-template-columns:1fr!important; }
  body.admin-shell .source-card footer button,.webqr-actions button { width:100%!important; }
  .channel-admin-heading { display:grid!important; }
  .channel-grid { grid-template-columns:minmax(0,1fr)!important; }
  .channel-card>header { display:grid!important; grid-template-columns:auto minmax(0,1fr)!important; }
  .channel-card-status { grid-column:1/-1; margin-left:0!important; width:max-content; max-width:100%; }
  .webqr-qr { height:min(300px,70vw)!important; }

  body.admin-shell .table-wrap,body.chatbot-admin-shell .cb-table-wrap { margin-inline:-2px; overflow:auto!important; }
  body.admin-shell table { min-width:680px; }
  body.chatbot-admin-shell .cb-table { min-width:760px!important; }
  body.chatbot-admin-shell .cb-head-actions { display:grid!important; grid-template-columns:1fr 1fr!important; width:100%; }
  body.chatbot-admin-shell .cb-head-actions>* { min-width:0; }
  body.chatbot-admin-shell .cb-head-actions .cb-btn,body.chatbot-admin-shell .cb-head-actions form .cb-btn { width:100%!important; }
  body.chatbot-admin-shell .cb-agenda-table { overflow:visible!important; }
  body.chatbot-admin-shell .cb-agenda-table__head,
  body.chatbot-admin-shell .cb-agenda-table__row {
    min-width:0;
    grid-template-columns:minmax(0,1fr)!important;
    gap:10px!important;
    padding:14px!important;
  }
  body.chatbot-admin-shell .cb-agenda-table__head { display:none!important; }
  body.chatbot-admin-shell .cb-agenda-table__row>div { display:block!important; grid-column:auto!important; }
  body.chatbot-admin-shell .cb-agenda-table__row>div:nth-child(3)::before {
    content:"Feriados: ";
    color:var(--ui-muted);
    font-weight:700;
  }
  body.chatbot-admin-shell .cb-inline-actions {
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    min-width:0;
    width:100%;
    margin-top:4px;
  }
}

@media(max-width:430px) {
  body.admin-shell .admin-main,body.contacts-page .page,body.chatbot-admin-shell .cb-admin-main,.channel-admin { padding-inline:10px!important; }
  body.admin-shell h1,body.contacts-page h1,body.chatbot-admin-shell h1,.channel-admin h1 { font-size:1.55rem!important; }
  body.admin-shell .settings-card,body.admin-shell .source-card,body.chatbot-admin-shell .cb-card,
  body.chatbot-admin-shell .cb-form-card,.channel-card,.channel-create { padding:16px!important; border-radius:16px!important; }
  body.contacts-page .row-actions,body.contacts-page dialog footer,body.chatbot-admin-shell .cb-head-actions { grid-template-columns:1fr!important; }
  body.chatbot-admin-shell .cb-topbar-title small { display:none; }
  body.chatbot-admin-shell .cb-top-actions .cb-btn { font-size:0!important; width:42px!important; padding:0!important; }
  body.chatbot-admin-shell .cb-top-actions .cb-btn .ui-action-icon { margin:0; }
  body.app-shell.has-app-rail:not(.chat-open) .chat-header-actions { max-width:calc(100vw - 136px); }
  body.app-shell.has-app-rail .message-bubble { max-width:92%!important; }
}

@media(prefers-reduced-motion:reduce) {
  .app-rail-item,.app-rail-flyout,.channel-card,.channel-create { transition:none!important; }
}
