:root {
  --bg: oklch(0.978 0.004 25);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.968 0.006 25);
  --surface-3: oklch(0.93 0.012 25);
  --line: oklch(0.88 0.012 25);
  --ink: oklch(0.22 0.02 25);
  --muted: oklch(0.47 0.02 25);
  --dim: oklch(0.61 0.018 25);
  --gold: oklch(0.54 0.225 25);
  --gold-hover: oklch(0.47 0.235 25);
  --gold-ink: oklch(0.99 0 0);
  --success: oklch(0.62 0.16 155);
  --danger: oklch(0.58 0.2 25);
  --warning: oklch(0.67 0.15 75);
  --radius: 12px;
  --z-sticky: 20;
  --z-modal: 40;
  --z-toast: 50;
  color-scheme: light;
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.5rem; line-height: 1.25; letter-spacing: -0.025em; }
h2 { font-size: 1.05rem; }
small { color: var(--muted); }

.button { min-height: 42px; padding: 0 16px; border-radius: 9px; border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; font-weight: 700; cursor: pointer; transition: background 180ms ease, color 180ms ease, opacity 180ms ease; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button-primary { background: var(--gold); color: var(--gold-ink); }
.button-primary:hover:not(:disabled) { background: var(--gold-hover); }
.button-secondary { background: var(--surface-3); color: var(--ink); }
.button-secondary:hover:not(:disabled) { background: var(--line); }
.button-block { width: 100%; }

.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--gold); color: var(--gold-ink); font-family: Georgia, serif; font-size: 20px; font-weight: 800; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: 0 0 auto; }
.status-dot.is-online { background: var(--success); box-shadow: 0 0 0 3px oklch(0.75 0.14 155 / .12); }
.status-dot.is-warning { background: var(--warning); box-shadow: 0 0 0 3px oklch(0.77 0.14 75 / .12); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; overflow: hidden; position: relative; background: var(--surface-3); color: var(--gold); font-weight: 800; }
.avatar .avatar-initials, .avatar img { grid-area: 1 / 1; }
.avatar img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: inherit; position: relative; z-index: 1; }
.avatar-large { width: 72px; height: 72px; font-size: 1.4rem; }

/* Authentication */
.auth-page { min-height: 100vh; background: var(--bg); display: grid; place-items: center; padding: 28px 18px; }
.auth-shell { width: min(100%, 430px); }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 28px; font-weight: 750; font-size: 1rem; }
.auth-panel { background: var(--surface); border-top: 2px solid var(--gold); padding: 34px; border-radius: var(--radius); box-shadow: 0 8px 8px oklch(0 0 0 / .18); }
.auth-step { color: var(--gold); font-size: .76rem; font-weight: 750; margin-bottom: 8px; }
.auth-panel h1 { font-size: 1.65rem; margin-bottom: 10px; }
.auth-copy { color: var(--muted); line-height: 1.55; margin-bottom: 25px; }
.auth-form { display: grid; gap: 17px; }
.auth-form label, .dialog-form > label, .detail-field { display: grid; gap: 7px; color: var(--muted); font-size: .82rem; font-weight: 650; }
input, textarea, select { width: 100%; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; transition: border-color 180ms ease, background 180ms ease; }
input { height: 43px; padding: 0 12px; }
textarea { padding: 11px 12px; resize: vertical; line-height: 1.5; }
select { height: 36px; padding: 0 28px 0 10px; }
input:hover, textarea:hover, select:hover { border-color: var(--dim); }
input::placeholder, textarea::placeholder { color: var(--dim); }
.auth-form small { font-weight: 400; }
.notice { padding: 11px 12px; border-radius: 8px; margin-bottom: 18px; line-height: 1.45; }
.notice-error { background: oklch(0.26 0.055 25); color: oklch(0.9 0.05 25); }
.notice-success { background: oklch(0.25 0.045 155); color: oklch(0.9 0.05 155); }
.setup-link { color: var(--muted); display: block; text-align: center; margin-top: 20px; font-size: .8rem; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 17px 0; color: var(--dim); font-size: .72rem; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
#google-signin { display: flex; justify-content: center; min-height: 44px; }
.auth-foot { text-align: center; color: var(--dim); margin-top: 20px; font-size: .75rem; }

/* App shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 84px minmax(0, 1fr); }
.sidebar { background: oklch(0.29 0.14 25); border-right: 0; padding: 14px 8px 12px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: var(--z-sticky); }
.sidebar-brand { color: white; text-decoration: none; display: flex; justify-content: center; align-items: center; padding: 0 0 18px; font-size: 0; font-weight: 800; }
.sidebar-brand .brand-mark { background: white; color: var(--gold); box-shadow: 0 3px 8px oklch(0.15 0.08 25 / .24); }
.nav-list { display: grid; gap: 6px; }
.nav-item { position: relative; width: 100%; min-height: 58px; border: 0; border-radius: 9px; background: transparent; color: oklch(0.91 0.025 25); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 4px; padding: 6px 3px; cursor: pointer; font-size: .61rem; font-weight: 650; }
.nav-item:hover { color: white; background: oklch(0.38 0.15 25); }
.nav-item.is-active { color: var(--gold); background: white; box-shadow: 0 4px 12px oklch(0.14 0.06 25 / .18); }
.nav-item.is-active .nav-icon { color: var(--gold); }
.nav-item b { position: absolute; top: 5px; right: 7px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; display: grid; place-items: center; background: oklch(0.65 0.2 25); color: white; font-size: .57rem; }
.nav-item b:empty, .nav-item b[data-count="0"] { display: none; }
.nav-icon { text-align: center; font-size: 1.1rem; line-height: 1; }
.sidebar-status { margin-top: auto; display: grid; justify-items: center; gap: 7px; padding: 12px 2px; border-bottom: 1px solid oklch(0.47 0.1 25); color: white; text-align: center; }
.sidebar-status div, .user-menu > div { min-width: 0; display: grid; gap: 2px; }
.sidebar-status strong { font-size: .58rem; }
.sidebar-status small { max-width: 70px; font-size: .55rem; color: oklch(0.89 0.025 25); }
.user-menu { display: grid; justify-items: center; gap: 6px; padding: 14px 2px 0; color: white; text-align: center; }
.user-menu > div { max-width: 70px; }
.user-menu strong { font-size: .61rem; }
.user-menu small { color: oklch(0.89 0.025 25); font-size: .56rem; }
.user-menu button { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.workspace { min-width: 0; display: grid; grid-template-rows: 62px minmax(0, 1fr); }
.app-topbar { position: sticky; top: 0; z-index: var(--z-sticky); min-width: 0; height: 62px; display: grid; grid-template-columns: minmax(180px, 1fr) minmax(280px, 520px) minmax(180px, 1fr); align-items: center; gap: 18px; padding: 0 24px; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-menu { display: none; border: 0; background: transparent; color: var(--ink); font-size: 1.2rem; cursor: pointer; }
.topbar-title { min-width: 0; display: flex; align-items: center; gap: 10px; }
.topbar-title > span { color: var(--muted); font-size: 1.15rem; }
.topbar-title h1 { font-size: 1.15rem; }
.topbar-search { min-width: 0; height: 38px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; color: var(--dim); }
.topbar-search input { height: 36px; padding: 0; border: 0; background: transparent; outline: 0; }
.topbar-search kbd { min-width: 24px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--dim); font: inherit; font-size: .66rem; text-align: center; }
.topbar-organization { min-width: 0; display: grid; justify-items: end; gap: 2px; }
.topbar-organization strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .76rem; }
.topbar-organization small { font-size: .62rem; text-transform: uppercase; }
.connection-alert { position: fixed; top: 74px; left: 104px; right: 20px; z-index: var(--z-modal); min-height: 66px; padding: 12px 14px; border: 1px solid color-mix(in oklch, var(--danger) 42%, var(--line)); border-radius: 10px; background: color-mix(in oklch, var(--danger) 8%, white); box-shadow: 0 10px 28px oklch(0.18 0.04 25 / .14); display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.connection-alert[hidden] { display: none; }
.connection-alert-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--danger); color: white; font-weight: 850; }
.connection-alert strong { color: oklch(0.43 0.16 25); font-size: .8rem; }
.connection-alert p { margin-top: 3px; color: var(--muted); font-size: .7rem; }
.connection-alert button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 8px; background: var(--danger); color: white; cursor: pointer; font-size: .7rem; font-weight: 750; }
.view { display: none; min-height: calc(100vh - 62px); }
.view.is-active { display: block; }

/* Home */
.home-page { padding: 28px 26px 40px; }
.home-welcome { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.home-welcome > div { display: flex; align-items: center; gap: 13px; }
.home-avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in oklch, var(--gold) 14%, white); color: var(--gold); font-weight: 800; }
.home-welcome h2 { font-size: 1.25rem; }
.home-welcome p { margin-top: 4px; color: var(--muted); font-size: .78rem; }
.home-health { padding: 6px 10px; border-radius: 999px; background: color-mix(in oklch, var(--success) 12%, white); color: oklch(0.47 0.13 155); font-size: .68rem; font-weight: 750; }
.home-health.is-error { background: color-mix(in oklch, var(--danger) 10%, white); color: oklch(0.48 0.16 25); }
.home-quick-actions { margin-bottom: 18px; }
.home-quick-actions h3 { margin-bottom: 10px; font-size: .8rem; }
.home-quick-actions > div { display: flex; flex-wrap: wrap; gap: 9px; }
.home-quick-actions button { min-height: 39px; padding: 0 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: .72rem; font-weight: 700; }
.home-quick-actions button:hover { border-color: color-mix(in oklch, var(--gold) 45%, var(--line)); color: var(--gold); }
.home-quick-actions button span { margin-right: 6px; color: var(--gold); }
.home-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.home-metrics button { min-height: 112px; padding: 17px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; display: grid; align-content: center; gap: 5px; }
.home-metrics button:hover { border-color: color-mix(in oklch, var(--gold) 45%, var(--line)); }
.home-metrics strong { color: var(--gold); font-size: 1.45rem; }
.home-metrics span { font-size: .78rem; font-weight: 750; }
.home-metrics small { font-size: .65rem; }
.home-overview-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 12px; }
.home-overview-panel { min-height: 260px; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.home-overview-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.home-overview-panel h3 { font-size: .84rem; }
.home-overview-panel header button { border: 0; background: transparent; color: var(--gold); cursor: pointer; font-size: .68rem; font-weight: 750; }
#home-stage-summary { display: grid; gap: 12px; }
.home-stage-row { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(100px, 2fr) 32px; align-items: center; gap: 10px; font-size: .7rem; }
.home-stage-bar { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.home-stage-bar span { display: block; height: 100%; border-radius: inherit; background: var(--gold); }
.home-stage-row strong { text-align: right; }
#home-recent-contacts { display: grid; gap: 4px; }
.home-recent-contact { width: 100%; min-height: 48px; padding: 7px 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 9px; text-align: left; cursor: pointer; }
.home-recent-contact .avatar { width: 34px; height: 34px; font-size: .68rem; }
.home-recent-contact span:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.home-recent-contact strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .72rem; }
.home-recent-contact small { font-size: .62rem; }

/* Inbox */
.inbox-layout { height: calc(100vh - 62px); min-height: 0; overflow: hidden; display: grid; grid-template-columns: 330px minmax(360px, 1fr) 280px; }
.conversation-list-panel, .chat-panel, .contact-panel { min-height: 0; }
.conversation-list-panel, .chat-panel { border-right: 1px solid var(--line); min-width: 0; }
.conversation-list-panel { display: flex; flex-direction: column; background: var(--surface); }
.panel-header { min-height: 86px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 18px 12px; }
.panel-header p, .view-header p { color: var(--muted); margin-top: 4px; font-size: .8rem; }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 8px; background: var(--gold); color: var(--gold-ink); font-size: 1.2rem; cursor: pointer; }
.search-box { margin: 0 14px; height: 39px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; display: flex; align-items: center; gap: 7px; padding: 0 10px; color: var(--muted); }
.search-box input { height: auto; padding: 0; border: 0; background: transparent; outline: 0; }
.filter-row { display: flex; gap: 5px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.filter { border: 0; border-radius: 7px; background: transparent; color: var(--muted); padding: 6px 9px; cursor: pointer; font-size: .75rem; }
.filter.is-active { background: var(--surface-3); color: var(--ink); }
.conversation-list { flex: 1; min-height: 0; overflow-y: auto; }
.conversation-item { width: 100%; min-height: 76px; border: 0; border-bottom: 1px solid var(--line); background: transparent; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 14px; text-align: left; cursor: pointer; }
.conversation-item:hover { background: var(--surface-2); }
.conversation-item.is-active { background: var(--surface-3); box-shadow: inset 2px 0 var(--gold); }
.conversation-main { min-width: 0; }
.conversation-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.conversation-top strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .86rem; }
.conversation-time { color: var(--dim); font-size: .68rem; flex: 0 0 auto; }
.conversation-preview { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: .76rem; }
.conversation-preview span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread-badge { min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--gold); color: var(--gold-ink); font-size: .66rem; font-weight: 800; display: grid; place-items: center; }
.list-state { color: var(--muted); text-align: center; padding: 42px 24px; line-height: 1.5; }
.skeleton-row { height: 76px; margin: 0 14px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, transparent, var(--surface-3), transparent); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

.chat-panel { height: 100%; overflow: hidden; background: var(--bg); min-width: 0; }
.empty-chat { height: 100%; display: grid; place-content: center; justify-items: center; text-align: center; padding: 30px; }
.empty-symbol { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--gold); font-size: 1.3rem; margin-bottom: 15px; }
.empty-chat h2 { font-size: 1.1rem; margin-bottom: 7px; }
.empty-chat p { color: var(--muted); max-width: 38ch; line-height: 1.5; }
.chat-content { height: 100%; min-height: 0; display: grid; grid-template-rows: 70px minmax(0, 1fr) auto; }
.chat-header { min-width: 0; display: flex; gap: 14px; align-items: center; padding: 0 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.back-button { display: none; flex: 0 0 28px; width: 28px; padding: 0; border: 0; background: transparent; color: var(--ink); font-size: 1.2rem; cursor: pointer; }
.chat-identity { min-width: 0; flex: 1 1 auto; display: flex; align-items: center; gap: 10px; }
.chat-header .avatar { display: grid; width: 40px; height: 40px; background: color-mix(in oklch, var(--gold) 10%, white); color: var(--gold); }
.chat-identity-copy { min-width: 0; }
.chat-identity-copy h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-identity-copy p { color: var(--muted); font-size: .75rem; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-control { flex: 0 0 150px; display: grid; gap: 4px; color: var(--muted); font-size: .64rem; font-weight: 700; }
.stage-control select { width: 150px; height: 34px; background: var(--surface-2); }
.messages { min-height: 0; overflow-y: auto; padding: 24px max(18px, 5%); display: flex; flex-direction: column; gap: 8px; }
.message { max-width: min(78%, 580px); padding: 9px 11px 7px; border-radius: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.message-in { align-self: flex-start; background: var(--surface-3); border-bottom-left-radius: 3px; }
.message-out { align-self: flex-end; background: color-mix(in oklch, var(--gold) 14%, white); border-bottom-right-radius: 3px; }
.message-type-image, .message-type-video { width: min(78%, 420px); }
.message-image-link { display: block; border-radius: 8px; overflow: hidden; }
.message-image { display: block; width: 100%; max-height: 440px; object-fit: contain; background: oklch(0.12 0 0); }
.message-video { display: block; width: 100%; max-height: 440px; border-radius: 8px; background: black; }
.message-audio { display: block; width: min(320px, 66vw); height: 42px; }
.message-document { min-width: 240px; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 8px; background: var(--surface-2); color: var(--ink); text-decoration: none; }
.message-document > span:first-child { font-size: 1.45rem; }
.message-document > span:last-child { min-width: 0; display: grid; gap: 2px; }
.message-document strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.message-document small { font-size: .67rem; }
.message-body { margin-top: 7px; }
.message-media-missing { color: var(--muted); font-style: italic; }
.message-meta { display: flex; justify-content: flex-end; gap: 5px; color: var(--muted); font-size: .62rem; margin-top: 4px; }
.message-retry { margin-top: 7px; padding: 5px 8px; border: 1px solid color-mix(in oklch, var(--danger) 38%, var(--line)); border-radius: 7px; background: color-mix(in oklch, var(--danger) 8%, white); color: var(--danger); cursor: pointer; font-size: .68rem; font-weight: 750; }
.message-retry:hover { background: color-mix(in oklch, var(--danger) 14%, white); }
.message-retry:disabled { opacity: .6; cursor: wait; }
.day-divider { align-self: center; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 4px 9px; margin: 8px 0; font-size: .67rem; }
.composer { min-height: 72px; padding: 10px 16px 12px; border-top: 1px solid var(--line); background: var(--surface); display: grid; grid-template-columns: auto minmax(0, 1fr) 42px; align-items: end; gap: 10px; }
.composer textarea { min-height: 43px; max-height: 130px; resize: none; }
.composer-tools { min-height: 43px; display: flex; align-items: center; gap: 2px; }
.composer-tools button { width: 34px; height: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem; }
.composer-tools button:hover { background: var(--surface-3); color: var(--ink); }
.composer-tools button:disabled { opacity: .4; cursor: not-allowed; }
.composer-tools button.is-recording { background: oklch(0.32 0.1 25); color: oklch(0.94 0.05 25); animation: recording-pulse 1s ease-in-out infinite; }
.composer-tools #compose-ai { color: var(--gold); font-weight: 900; }
.composer-tools #compose-ai.is-loading { animation: recording-pulse .85s ease-in-out infinite; }
.attachment-preview { grid-column: 1 / -1; min-height: 60px; padding: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.attachment-preview-content { min-width: 0; }
#attachment-preview-content { min-width: 0; display: flex; align-items: center; gap: 10px; }
#attachment-preview-content img, #attachment-preview-content video { width: 54px; height: 54px; border-radius: 7px; object-fit: cover; background: black; }
#attachment-preview-content audio { width: min(300px, 45vw); height: 38px; }
#attachment-preview-content > span:last-child { min-width: 0; display: grid; gap: 3px; }
#attachment-preview-content strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#attachment-preview-content small { font-size: .66rem; color: var(--muted); }
.attachment-icon { width: 44px; text-align: center; font-size: 1.4rem; }
#remove-attachment { width: 32px; height: 32px; flex: 0 0 auto; border: 0; border-radius: 8px; background: var(--surface-3); color: var(--muted); cursor: pointer; font-size: 1.1rem; }
.send-button { width: 42px; height: 42px; border: 0; border-radius: 9px; background: var(--gold); color: var(--gold-ink); cursor: pointer; }
.send-button:disabled { opacity: .45; }
@keyframes recording-pulse { 50% { opacity: .65; } }

.contact-panel { background: var(--surface); padding: 0 18px 20px; overflow-y: auto; }
.contact-panel > header { height: 70px; display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.contact-profile { text-align: center; display: grid; justify-items: center; padding: 24px 0; border-bottom: 1px solid var(--line); }
.contact-profile h3 { margin-top: 11px; font-size: .95rem; }
.contact-profile p { color: var(--muted); margin-top: 5px; font-size: .76rem; }
.detail-section { display: flex; justify-content: space-between; align-items: center; padding: 17px 0; border-bottom: 1px solid var(--line); font-size: .78rem; }
.detail-section span { color: var(--muted); }
.detail-section strong { color: var(--gold); }
.detail-field { margin-top: 17px; }
.detail-field select[multiple] {
  min-height: 168px;
  padding: 6px;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
.detail-field select[multiple]:focus { border-color: var(--gold); box-shadow: 0 0 0 2px color-mix(in oklch, var(--gold) 12%, transparent); }
.detail-field select[multiple] option { padding: 9px 10px; border-radius: 7px; }
.detail-field select[multiple] option:checked { background: var(--gold); color: white; }
.field-hint { color: var(--muted); font-size: .72rem; font-weight: 500; }
.contact-panel .button { margin-top: 16px; }

/* Pipeline and contacts */
.view-header { min-height: 94px; display: flex; align-items: center; justify-content: space-between; padding: 20px 26px; border-bottom: 1px solid var(--line); background: var(--surface); }
.pipeline { min-height: calc(100vh - 156px); padding: 20px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 12px; overflow-x: auto; align-items: start; }
.pipeline-column { background: var(--surface); border-radius: var(--radius); min-height: 150px; transition: outline-color .16s ease, background .16s ease, transform .16s ease; }
.pipeline-header { min-height: 56px; padding: 9px 10px 9px 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); }
.pipeline-header h2 { font-size: .78rem; }
.pipeline-header span { color: var(--muted); font-size: .7rem; }
.stage-actions { display: flex; gap: 5px; flex: 0 0 auto; }
.stage-actions button { border: 0; border-radius: 6px; background: var(--surface-2); color: var(--muted); min-height: 28px; padding: 0 8px; cursor: pointer; font-size: .66rem; font-weight: 700; }
.stage-actions button:hover { background: var(--surface-3); color: var(--ink); }
.pipeline-body { min-height: 96px; padding: 8px; display: grid; align-content: start; gap: 7px; border-radius: 0 0 var(--radius) var(--radius); transition: background .16s ease; }
.deal { width: 100%; padding: 11px; text-align: left; border: 0; border-radius: 8px; background: var(--surface-2); cursor: grab; user-select: none; transition: opacity .16s ease, transform .16s ease, background .16s ease; }
.deal:hover { background: var(--surface-3); }
.deal:active { cursor: grabbing; }
.deal.is-dragging { opacity: .38; transform: scale(.98); }
.pipeline-column.is-drop-target { outline: 2px solid var(--gold); outline-offset: -2px; background: color-mix(in oklch, var(--gold) 7%, white); transform: translateY(-2px); }
.pipeline-column.is-drop-target .pipeline-body { background: color-mix(in oklch, var(--gold) 6%, white); }
.deal strong { display: block; font-size: .8rem; margin-bottom: 5px; }
.deal span { color: var(--muted); font-size: .7rem; }
.contacts-table-wrap { margin: 20px; background: var(--surface); border-radius: var(--radius); overflow-x: auto; }
.contacts-table { width: 100%; border-collapse: collapse; min-width: 680px; }
.contacts-table th, .contacts-table td { padding: 13px 16px; border-bottom: 1px solid var(--line); text-align: left; }
.contacts-table th { color: var(--muted); font-size: .7rem; font-weight: 650; }
.contacts-table td { font-size: .8rem; }
.contact-cell { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.stage-badge { display: inline-flex; padding: 4px 8px; border-radius: 6px; background: var(--surface-3); color: var(--gold); font-size: .7rem; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.contact-action { border: 0; border-radius: 7px; background: var(--surface-3); color: var(--muted); min-height: 30px; padding: 0 10px; cursor: pointer; font-size: .7rem; font-weight: 750; }
.contact-action:hover { color: var(--ink); background: var(--line); }
.contact-action-danger { color: var(--danger); }
.contact-action-danger:hover { color: var(--danger); background: color-mix(in oklch, var(--danger) 10%, white); }
.blocked-badge { display: inline-flex; align-items: center; margin-left: 6px; padding: 2px 6px; border-radius: 999px; background: color-mix(in oklch, var(--danger) 12%, white); color: var(--danger); font-size: .62rem; font-weight: 800; vertical-align: middle; }
.conversation-item.is-blocked,
.deal.is-blocked,
.contacts-table tr.is-blocked { opacity: .68; }

/* WhatsApp connection */
.view-header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.whatsapp-connections-page { min-height: calc(100vh - 156px); padding: 24px 26px 40px; }
.whatsapp-catalog-heading { max-width: 1440px; margin: 0 auto 16px; display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.whatsapp-catalog-heading h2 { font-size: 1rem; }
.whatsapp-catalog-heading p { max-width: 68ch; margin-top: 5px; color: var(--muted); font-size: .76rem; line-height: 1.45; }
.whatsapp-catalog-heading > span { color: var(--dim); font-size: .7rem; }
.whatsapp-connection-grid { max-width: 1440px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; }
.whatsapp-connection-card { min-height: 190px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); display: flex; flex-direction: column; transition: border-color 180ms ease, background 180ms ease, transform 180ms cubic-bezier(.22, 1, .36, 1); }
.whatsapp-connection-card:hover { border-color: var(--dim); background: var(--surface-2); transform: translateY(-2px); }
.whatsapp-connection-card.is-connected { border-color: color-mix(in oklch, var(--success) 45%, var(--line)); background: color-mix(in oklch, var(--success) 4%, var(--surface)); }
.whatsapp-connection-main { width: 100%; padding: 0; border: 0; background: transparent; color: inherit; display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 12px; text-align: left; cursor: pointer; }
.whatsapp-logo { width: 48px; height: 48px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in oklch, var(--success) 13%, var(--surface-3)); color: var(--success); font-size: 1.2rem; font-weight: 900; }
.whatsapp-connection-copy { min-width: 0; padding-top: 2px; }
.whatsapp-connection-copy strong { display: block; margin-bottom: 5px; font-size: .88rem; }
.whatsapp-connection-copy small { display: block; color: var(--muted); font-size: .72rem; }
.whatsapp-connection-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 16px 0 12px; }
.whatsapp-instance-label { max-width: 100%; overflow: hidden; color: var(--dim); font-family: ui-monospace, "Cascadia Code", monospace; font-size: .64rem; text-overflow: ellipsis; white-space: nowrap; }
.whatsapp-default-badge { padding: 3px 7px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: .59rem; font-weight: 800; }
.whatsapp-connection-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 13px; border-top: 1px solid var(--line); }
.whatsapp-connection-status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .67rem; font-weight: 800; }
.whatsapp-connection-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.whatsapp-connection-status.is-connected { color: var(--success); }
.whatsapp-connection-status.is-connected i { background: var(--success); box-shadow: 0 0 0 3px color-mix(in oklch, var(--success) 15%, transparent); }
.connection-config-button { min-height: 30px; padding: 0 9px; border: 0; border-radius: 7px; background: var(--surface-3); color: var(--muted); cursor: pointer; font-size: .66rem; font-weight: 750; }
.connection-config-button:hover { background: var(--line); color: var(--ink); }
.whatsapp-config-dialog { width: min(720px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 14px; background: transparent; box-shadow: none; overflow: hidden; }
.whatsapp-config-dialog[open] { display: grid; animation: ai-modal-in 190ms cubic-bezier(.22, 1, .36, 1); }
.whatsapp-config-dialog::backdrop { background: oklch(0.13 0.025 25 / .58); backdrop-filter: blur(3px); }
.whatsapp-config-card { width: 100%; max-height: calc(100dvh - 32px); padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: auto; overscroll-behavior: contain; }
.whatsapp-config-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-bottom: 17px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.whatsapp-config-heading > div { display: grid; gap: 3px; }
.whatsapp-config-heading > div > span { color: var(--muted); font-size: .7rem; }
.whatsapp-modal-fields { display: grid; gap: 14px; }
.whatsapp-modal-fields > label { display: grid; gap: 7px; color: var(--muted); font-size: .74rem; font-weight: 750; }
.whatsapp-instance-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 42px; padding: 0 12px; border-radius: 8px; background: var(--surface-2); }
.whatsapp-instance-row span { color: var(--muted); font-size: .7rem; }
.whatsapp-instance-row strong { overflow: hidden; font-family: ui-monospace, "Cascadia Code", monospace; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.whatsapp-state { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.whatsapp-state > div { display: grid; gap: 3px; }
.whatsapp-state small { font-size: .72rem; }
.whatsapp-qr { width: min(100%, 310px); margin: 18px auto; padding: 12px; border-radius: 12px; background: white; }
.whatsapp-qr img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
.whatsapp-instructions { margin: 0 auto 16px; width: min(100%, 520px); }
.whatsapp-instructions h3 { margin-bottom: 8px; font-size: .82rem; }
.whatsapp-instructions ol { margin: 0; padding-left: 20px; color: var(--muted); font-size: .72rem; line-height: 1.65; }
.whatsapp-instructions strong { color: var(--ink); }
.whatsapp-note { margin-top: 13px; color: var(--dim); font-size: .67rem; line-height: 1.45; }
.whatsapp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* Agents */
.agent-page-header { align-items: flex-end; }
.agents-page { min-height: calc(100vh - 156px); padding: 24px 26px 40px; }
.agents-catalog { max-width: 1180px; margin: 0 auto; }
.agents-catalog-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.agents-catalog-heading h2 { font-size: 1rem; }
.agents-catalog-heading p { margin-top: 5px; color: var(--muted); font-size: .76rem; line-height: 1.45; }
.agents-catalog-heading a { color: var(--gold); font-size: .72rem; font-weight: 800; text-decoration: none; }
.agents-catalog-heading a:hover { text-decoration: underline; }
.agent-grid { display: grid; grid-template-columns: repeat(2, minmax(280px, 1fr)); gap: 14px; }
.agent-card { min-height: 300px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); display: flex; flex-direction: column; transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms cubic-bezier(.22, 1, .36, 1); }
.agent-card:hover { border-color: var(--dim); transform: translateY(-2px); }
.agent-card.is-active { border-color: color-mix(in oklch, var(--gold) 42%, var(--line)); box-shadow: 0 10px 30px color-mix(in oklch, var(--gold) 7%, transparent); }
.agent-card-header { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 14px; }
.agent-card-icon { width: 52px; height: 52px; border-radius: 13px; display: grid; place-items: center; background: color-mix(in oklch, var(--gold) 12%, var(--surface-3)); color: var(--gold); font-size: 1.25rem; font-weight: 900; }
.agent-card-title { min-width: 0; }
.agent-card-title h3 { margin: 0 0 5px; font-size: .95rem; }
.agent-card-title p { color: var(--muted); font-size: .72rem; line-height: 1.4; }
.agent-provider { display: inline-flex; align-items: center; gap: 6px; width: fit-content; margin: 16px 0 13px; padding: 5px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .64rem; font-weight: 750; }
.agent-provider.is-missing { color: var(--danger); background: color-mix(in oklch, var(--danger) 8%, white); }
.agent-feature-list { list-style: none; display: grid; gap: 9px; margin: 0; padding: 0; color: var(--muted); font-size: .7rem; }
.agent-feature-list li { display: grid; grid-template-columns: 17px minmax(0, 1fr); gap: 7px; align-items: start; line-height: 1.4; }
.agent-feature-list li::before { content: "✓"; color: var(--gold); font-weight: 900; }
.agent-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); }
.agent-state { display: grid; gap: 3px; }
.agent-state strong { color: var(--muted); font-size: .72rem; }
.agent-state small { font-size: .62rem; }
.agent-card.is-active .agent-state strong { color: var(--gold); }
.agent-switch { position: relative; width: 50px; height: 29px; flex: 0 0 auto; padding: 0; border: 0; border-radius: 999px; background: var(--line); cursor: pointer; transition: background 180ms ease; }
.agent-switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 21px; height: 21px; border-radius: 50%; background: var(--muted); transition: transform 180ms cubic-bezier(.22, 1, .36, 1), background 180ms ease; }
.agent-switch[aria-checked="true"] { background: var(--gold); }
.agent-switch[aria-checked="true"]::after { transform: translateX(21px); background: white; }
.agent-switch:disabled { opacity: .5; cursor: wait; }
.agent-card-action { width: fit-content; margin-top: 16px; }
.agent-page-note { display: flex; align-items: flex-start; gap: 11px; margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); color: var(--muted); }
.agent-page-note > span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: white; color: var(--gold); font-weight: 900; }
.agent-page-note p { display: grid; gap: 3px; font-size: .7rem; line-height: 1.45; }
.agent-page-note strong { color: var(--ink); }

.recruitment-dialog { width: min(94vw, 720px); max-height: min(88dvh, 760px); }
.recruitment-form { grid-template-rows: auto auto minmax(160px, 1fr) auto auto; max-height: min(88dvh, 760px); }
.recruitment-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 9px; background: var(--surface-2); color: var(--muted); font-size: .72rem; }
.recruitment-select-all { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 750; cursor: pointer; }
.recruitment-select-all input, .recruitment-contact input { accent-color: var(--gold); }
.recruitment-contact-list { min-height: 160px; max-height: 330px; overflow: auto; display: grid; align-content: start; gap: 7px; padding-right: 4px; }
.recruitment-contact { display: grid; grid-template-columns: auto 38px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.recruitment-contact:hover { border-color: color-mix(in oklch, var(--gold) 36%, var(--line)); }
.recruitment-contact.is-processed { opacity: .7; cursor: default; background: var(--surface-2); }
.recruitment-contact .avatar { width: 36px; height: 36px; font-size: .68rem; }
.recruitment-contact-copy { min-width: 0; display: grid; gap: 3px; }
.recruitment-contact-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .77rem; }
.recruitment-contact-copy small { color: var(--muted); font-size: .67rem; }
.recruitment-status { padding: 5px 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: .61rem; font-weight: 750; white-space: nowrap; }
.recruitment-status.status-available, .recruitment-status.status-interested, .recruitment-status.status-forwarded { color: var(--gold); background: color-mix(in oklch, var(--gold) 9%, white); }
.recruitment-status.status-declined, .recruitment-status.status-failed { color: var(--danger); background: color-mix(in oklch, var(--danger) 8%, white); }
.recruitment-message-preview { padding: 12px 14px; border-left: 3px solid var(--gold); border-radius: 7px; background: var(--surface-2); }
.recruitment-message-preview strong { display: block; margin-bottom: 5px; font-size: .71rem; }
.recruitment-message-preview p { color: var(--muted); font-size: .68rem; line-height: 1.5; }
.announcement-message-field { display: grid; gap: 7px; color: var(--ink); font-size: .75rem; font-weight: 750; }
.announcement-message-field textarea { min-height: 92px; resize: vertical; }
.announcement-message-field small { color: var(--muted); font-size: .65rem; font-weight: 500; line-height: 1.4; }
.announcement-message-field small strong { color: var(--gold); }

/* AI connectors */
.integration-header { align-items: flex-end; }
.ai-header-status { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface-2); font-size: .72rem; font-weight: 750; }
.ai-header-status.is-active { border-color: color-mix(in oklch, var(--gold) 42%, var(--line)); color: var(--gold); background: color-mix(in oklch, var(--gold) 8%, white); }
.integrations-page { min-height: calc(100vh - 156px); padding: 24px 26px 40px; }
.integration-catalog { max-width: 1440px; margin: 0 auto; }
.integration-catalog-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.integration-catalog-heading h2, .ai-config-heading h2 { font-size: 1rem; }
.integration-catalog-heading p { margin-top: 5px; color: var(--muted); font-size: .76rem; line-height: 1.45; }
.integration-catalog-heading > span { color: var(--dim); font-size: .7rem; }
.ai-provider-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 12px; }
.ai-provider { --provider-color: var(--gold); min-height: 202px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); display: flex; flex-direction: column; transition: border-color 180ms ease, background 180ms ease, transform 180ms cubic-bezier(.22, 1, .36, 1); }
.ai-provider:hover { border-color: var(--dim); background: var(--surface-2); transform: translateY(-2px); }
.ai-provider.is-selected { border-color: var(--gold); }
.ai-provider.is-active { border-color: color-mix(in oklch, var(--provider-color) 55%, var(--line)); background: color-mix(in oklch, var(--provider-color) 5%, var(--surface)); }
.ai-provider[data-provider="openai"] { --provider-color: oklch(0.73 0.13 170); }
.ai-provider[data-provider="gemini"] { --provider-color: oklch(0.61 0.2 25); }
.ai-provider[data-provider="anthropic"] { --provider-color: oklch(0.74 0.13 45); }
.ai-provider[data-provider="groq"] { --provider-color: oklch(0.75 0.17 55); }
.ai-provider[data-provider="openrouter"] { --provider-color: oklch(0.77 0.04 260); }
.ai-provider[data-provider="deepseek"] { --provider-color: oklch(0.69 0.17 255); }
.ai-provider-main { width: 100%; padding: 0; border: 0; background: transparent; color: inherit; display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 13px; text-align: left; cursor: pointer; }
.ai-provider-logo { width: 50px; height: 50px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in oklch, var(--provider-color) 16%, var(--surface-3)); color: var(--provider-color); font-size: 1.25rem; font-weight: 850; }
.ai-provider-copy { min-width: 0; padding-top: 2px; }
.ai-provider-copy strong { display: block; margin-bottom: 5px; font-size: .88rem; }
.ai-provider-copy small { display: block; min-height: 38px; color: var(--muted); font-size: .71rem; line-height: 1.35; }
.ai-provider-actions { display: flex; flex-wrap: wrap; gap: 5px; min-height: 27px; margin: 12px 0 9px; }
.ai-action-badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 999px; background: color-mix(in oklch, var(--provider-color) 11%, var(--surface-3)); color: var(--provider-color); font-size: .61rem; font-weight: 800; }
.ai-action-empty { color: var(--dim); font-size: .65rem; }
.ai-provider-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 13px; border-top: 1px solid var(--line); }
.ai-provider-status { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 999px; background: var(--surface-3); color: var(--dim); font-size: .65rem; font-weight: 800; }
.ai-provider-status.is-configured { color: var(--muted); }
.ai-provider-status.is-active { background: color-mix(in oklch, var(--provider-color) 15%, var(--surface-3)); color: var(--provider-color); }
.ai-provider-switch { position: relative; width: 44px; height: 25px; flex: 0 0 auto; padding: 0; border: 0; border-radius: 999px; background: var(--line); cursor: pointer; transition: background 180ms ease; }
.ai-provider-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: var(--muted); transition: transform 180ms cubic-bezier(.22, 1, .36, 1), background 180ms ease; }
.ai-provider-switch[aria-checked="true"] { background: var(--provider-color); }
.ai-provider-switch[aria-checked="true"]::after { transform: translateX(19px); background: oklch(0.98 0 0); }
.ai-provider-switch:disabled { opacity: .5; cursor: wait; }
.ai-config-dialog { width: min(920px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 14px; background: transparent; box-shadow: none; overflow: hidden; }
.ai-config-dialog[open] { display: grid; animation: ai-modal-in 190ms cubic-bezier(.22, 1, .36, 1); }
.ai-config-dialog::backdrop { background: oklch(0.13 0.025 25 / .58); backdrop-filter: blur(3px); }
.ai-config-card { width: 100%; max-height: calc(100dvh - 32px); margin: 0; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: auto; overscroll-behavior: contain; }
.ai-config-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-bottom: 17px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.ai-config-heading > div:first-child { display: grid; gap: 3px; }
.ai-config-heading > div:first-child > span { color: var(--muted); font-size: .7rem; }
.ai-config-heading-actions { display: flex; align-items: center; gap: 9px; }
.ai-config-close { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: var(--surface-3); color: var(--muted); cursor: pointer; font-size: 1.2rem; line-height: 1; }
.ai-config-close:hover { background: var(--line); color: var(--ink); }
.ai-connector-status { padding: 5px 9px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: .66rem; font-weight: 800; white-space: nowrap; }
.ai-connector-status.is-configured { color: var(--gold); }
#ai-config-form { display: grid; gap: 17px; }
#ai-config-form > label:not(.ai-toggle) { display: grid; gap: 7px; color: var(--muted); font-size: .74rem; font-weight: 750; }
#ai-config-form input, #ai-config-form textarea { color: var(--ink); }
#ai-config-form textarea { min-height: 190px; resize: vertical; line-height: 1.5; }
.ai-action-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; min-width: 0; padding: 0; border: 0; }
.ai-action-picker legend { grid-column: 1 / -1; margin-bottom: 3px; color: var(--ink); font-size: .78rem; font-weight: 850; }
.ai-action-picker > p { grid-column: 1 / -1; margin: -4px 0 4px; color: var(--muted); font-size: .69rem; line-height: 1.45; }
.ai-action-picker .ai-toggle { height: 100%; margin: 0; }
.secret-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.secret-field input { border-radius: 8px 0 0 8px; }
.secret-field button { min-width: 76px; border: 1px solid var(--line); border-left: 0; border-radius: 0 8px 8px 0; background: var(--surface-3); color: var(--muted); cursor: pointer; font-size: .7rem; font-weight: 750; }
.ai-toggle { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.ai-toggle input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--gold); }
.ai-toggle span { display: grid; gap: 4px; }
.ai-toggle strong { font-size: .76rem; }
.ai-toggle small { color: var(--muted); font-size: .68rem; line-height: 1.4; }
.ai-form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.button-danger { border-color: color-mix(in oklch, var(--danger) 30%, var(--line)); background: color-mix(in oklch, var(--danger) 9%, white); color: var(--danger); }
.button-danger:hover { background: color-mix(in oklch, var(--danger) 14%, white); }
.ai-security-note { color: var(--dim); font-size: .67rem; line-height: 1.45; }
@keyframes ai-modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }

/* Facebook and Instagram */
.meta-page { min-height: calc(100vh - 142px); padding: 28px; display: grid; grid-template-columns: minmax(0, 760px) minmax(260px, 360px); justify-content: center; align-items: start; gap: 18px; }
.meta-connect-card, .meta-help-card { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.meta-connect-card { padding: 22px; }
.meta-brand-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 13px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.meta-brand-icon, .meta-account-avatar { display: grid; place-items: center; border-radius: 12px; background: #0866ff; color: white; font: 900 1.35rem/1 Arial, sans-serif; }
.meta-brand-icon { width: 48px; height: 48px; }
.meta-brand-row h2 { font-size: 1rem; }
.meta-brand-row p { margin-top: 4px; color: var(--muted); font-size: .75rem; }
.meta-status-pill { padding: 6px 10px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: .68rem; font-weight: 800; white-space: nowrap; }
.meta-status-pill.is-connected { background: #e6f7ee; color: #157347; }
.meta-account-list { padding: 18px 0; }
.meta-account { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.meta-account-avatar { width: 42px; height: 42px; }
.meta-account > div { display: grid; gap: 3px; }
.meta-account small { color: var(--muted); font-size: .7rem; }
.meta-account em { color: var(--danger); font-size: .65rem; font-style: normal; }
.meta-account-state { color: #157347; font-size: .68rem; font-weight: 800; white-space: nowrap; }
.meta-empty { display: grid; gap: 5px; padding: 26px; border: 1px dashed var(--line); border-radius: 11px; text-align: center; }
.meta-empty span { color: var(--muted); font-size: .75rem; }
.meta-actions { display: flex; gap: 8px; }
.meta-actions .button { text-decoration: none; }
.meta-security-note { margin-top: 14px; color: var(--muted); font-size: .67rem; }
.meta-help-card { padding: 22px; }
.meta-help-card h3 { font-size: .9rem; }
.meta-help-card ol { margin: 14px 0 20px; padding-left: 18px; color: var(--muted); font-size: .75rem; line-height: 1.7; }
.meta-help-card strong { display: block; margin-bottom: 7px; font-size: .72rem; }
.meta-help-card code { display: block; overflow-wrap: anywhere; padding: 10px; border-radius: 8px; background: var(--surface-3); color: var(--muted); font-size: .65rem; }
.meta-permission-list { display: grid; gap: 10px; margin: 16px 0 22px; padding: 0; list-style: none; color: var(--muted); font-size: .74rem; }
.meta-permission-list li { display: flex; align-items: center; gap: 8px; }
.meta-permission-list span { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in oklch, var(--success) 12%, white); color: oklch(0.48 0.15 155); font-size: .65rem; font-weight: 900; }

/* Social studio */
.social-studio { min-height: calc(100vh - 142px); padding: 20px 26px 44px; }
.social-tabs { max-width: 1440px; min-height: 48px; margin: 0 auto 18px; padding: 4px; border-bottom: 1px solid var(--line); display: flex; align-items: end; gap: 4px; overflow-x: auto; }
.social-tabs button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 8px 8px 0 0; background: transparent; color: var(--muted); cursor: pointer; font-size: .76rem; font-weight: 750; white-space: nowrap; }
.social-tabs button:hover { color: var(--ink); background: var(--surface-2); }
.social-tabs button.is-active { color: var(--gold); box-shadow: inset 0 -2px 0 var(--gold); }
.social-tabs button span { min-width: 20px; height: 20px; margin-left: 5px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--surface-3); color: var(--muted); font-size: .62rem; }
.social-tabs button.is-active span { background: color-mix(in oklch, var(--gold) 11%, white); color: var(--gold); }
.social-panel { display: none; max-width: 1440px; margin: 0 auto; }
.social-panel.is-active { display: block; }
.social-overview-head { min-height: 110px; padding: 22px 24px; border: 1px solid color-mix(in oklch, var(--gold) 20%, var(--line)); border-radius: 14px 14px 0 0; background: color-mix(in oklch, var(--gold) 4%, white); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.social-overview-head > div { min-width: 0; display: flex; align-items: center; gap: 14px; }
.social-overview-mark { width: 52px; height: 52px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center; background: var(--gold); color: white; font-family: Georgia, serif; font-size: 1.6rem; font-weight: 900; }
.social-overview-head h2 { font-size: 1.18rem; letter-spacing: -.015em; }
.social-overview-head p { margin-top: 5px; color: var(--muted); font-size: .76rem; }
.social-metrics { border: 1px solid var(--line); border-top: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface); }
.social-metrics article { min-height: 112px; padding: 20px 24px; display: grid; align-content: center; gap: 4px; }
.social-metrics article + article { border-left: 1px solid var(--line); }
.social-metrics span { color: var(--muted); font-size: .69rem; font-weight: 700; }
.social-metrics strong { color: var(--ink); font-size: 1.65rem; line-height: 1.1; letter-spacing: -.035em; }
.social-metrics small { font-size: .67rem; }
.social-overview-grid { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 18px; align-items: start; }
.social-section { min-height: 320px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.social-section > header { min-height: 72px; padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.social-section h3 { font-size: .88rem; }
.social-section header p { margin-top: 4px; color: var(--muted); font-size: .68rem; }
.social-section header button, .social-compact-item, .social-empty button { border: 0; background: transparent; color: var(--gold); cursor: pointer; font-size: .69rem; font-weight: 750; }
.social-compact-list { display: grid; align-content: start; }
.social-compact-item { width: 100%; min-height: 70px; padding: 12px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; color: inherit; text-align: left; }
.social-compact-item:hover { background: var(--surface-2); }
.social-compact-item > span:nth-child(2) { min-width: 0; display: grid; gap: 4px; }
.social-compact-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .74rem; }
.social-compact-item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .65rem; }
.social-date-tile { width: 40px; height: 42px; border-radius: 8px; display: grid; place-items: center; align-content: center; background: color-mix(in oklch, var(--gold) 9%, white); color: var(--gold); line-height: 1; }
.social-date-tile strong { font-size: .83rem; }
.social-date-tile small { margin-top: 3px; color: inherit; font-size: .55rem; text-transform: uppercase; }
.social-campaign-compact { grid-template-columns: auto minmax(0, 1fr) auto; }
.social-campaign-compact em { color: var(--muted); font-size: .62rem; font-style: normal; }
.social-campaign-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); }
.social-campaign-dot.is-active { background: var(--success); }
.social-campaign-dot.is-paused { background: var(--warning); }
.social-campaign-dot.is-completed { background: var(--gold); }
.social-empty { min-height: 230px; padding: 32px; display: grid; place-items: center; align-content: center; gap: 8px; text-align: center; }
.social-empty strong { font-size: .8rem; }
.social-empty span { max-width: 46ch; color: var(--muted); font-size: .7rem; line-height: 1.5; }
.social-empty button { margin-top: 5px; }
.social-paid-note { margin-top: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); display: flex; align-items: flex-start; gap: 11px; color: var(--muted); }
.social-paid-note > span { width: 23px; height: 23px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; background: white; color: var(--gold); font-size: .7rem; font-weight: 900; }
.social-paid-note strong { display: block; margin-bottom: 3px; color: var(--ink); font-size: .72rem; }
.social-paid-note p { font-size: .68rem; line-height: 1.45; }
.social-panel-heading { min-height: 76px; margin-bottom: 14px; padding: 0 2px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.social-panel-heading h2 { font-size: 1rem; }
.social-panel-heading p { margin-top: 5px; color: var(--muted); font-size: .72rem; }
.social-filter-row { margin-bottom: 12px; display: flex; align-items: center; gap: 5px; overflow-x: auto; }
.social-filter-row button { min-height: 34px; padding: 0 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: .69rem; font-weight: 750; }
.social-filter-row button:hover { background: var(--surface-2); color: var(--ink); }
.social-filter-row button.is-active { border-color: var(--line); background: var(--surface); color: var(--gold); }
.social-post-list, .social-campaign-list { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.social-post-row { min-height: 112px; padding: 13px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 86px minmax(0, 1fr) auto; align-items: center; gap: 15px; }
.social-post-row:last-child, .social-campaign-row:last-child { border-bottom: 0; }
.social-post-thumb { width: 86px; height: 86px; border-radius: 9px; background: var(--surface-3); overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: .64rem; font-weight: 800; }
.social-post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.social-post-copy { min-width: 0; display: grid; gap: 7px; }
.social-post-copy > div { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.social-post-copy > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .77rem; }
.social-post-copy > small { color: var(--muted); font-size: .65rem; }
.social-post-copy > em { color: var(--danger); font-size: .64rem; font-style: normal; line-height: 1.35; }
.social-network-badge, .social-status { min-height: 23px; padding: 0 8px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: .6rem; font-weight: 800; }
.social-network-badge.is-facebook { background: #e8f1ff; color: #0866ff; }
.social-network-badge.is-instagram { background: #fbeaf4; color: #b22a77; }
.social-status { margin-left: 2px; background: var(--surface-3); color: var(--muted); }
.social-status.is-active, .social-status.is-published { background: color-mix(in oklch, var(--success) 12%, white); color: oklch(0.45 0.15 155); }
.social-status.is-scheduled { background: color-mix(in oklch, var(--gold) 9%, white); color: var(--gold); }
.social-status.is-failed, .social-status.is-partial { background: color-mix(in oklch, var(--danger) 9%, white); color: var(--danger); }
.social-status.is-paused { background: color-mix(in oklch, var(--warning) 13%, white); color: oklch(0.5 0.13 75); }
.social-row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.social-row-actions button { min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); cursor: pointer; font-size: .63rem; font-weight: 750; }
.social-row-actions button:hover { border-color: var(--dim); color: var(--ink); }
.social-row-actions button.is-danger { color: var(--danger); }
.social-campaign-row { min-height: 92px; padding: 15px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(220px, 1.3fr) minmax(180px, .8fr) minmax(100px, .45fr) auto minmax(190px, auto); align-items: center; gap: 14px; }
.social-campaign-main { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 11px; }
.social-campaign-main > div { min-width: 0; display: grid; gap: 4px; }
.social-campaign-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .76rem; }
.social-campaign-main small, .social-campaign-progress small { color: var(--muted); font-size: .64rem; }
.social-campaign-channels { display: flex; flex-wrap: wrap; gap: 5px; }
.social-campaign-progress { display: grid; gap: 3px; }
.social-campaign-progress strong { font-size: .78rem; }
.social-accounts-layout.meta-page { min-height: 0; padding: 0; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr); justify-content: stretch; }

.social-dialog { width: min(1040px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); border-radius: 14px; background: var(--surface); box-shadow: 0 8px 8px oklch(0 0 0 / .28); overflow: hidden; }
.social-dialog[open] { display: block; animation: social-dialog-in 180ms cubic-bezier(.22, 1, .36, 1); }
.social-dialog::backdrop { background: oklch(0.13 0.025 25 / .62); backdrop-filter: blur(3px); }
.social-dialog-form { max-height: calc(100dvh - 32px); padding: 22px; overflow: auto; display: grid; gap: 17px; }
.social-dialog-form > label, .social-compose-fields > label { display: grid; gap: 7px; color: var(--muted); font-size: .73rem; font-weight: 750; }
.social-dialog-heading { padding-bottom: 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.social-dialog-heading > div { display: grid; gap: 3px; }
.social-dialog-heading span { color: var(--muted); font-size: .67rem; }
.social-dialog-heading h2 { font-size: 1.02rem; }
.social-dialog-heading button { width: 34px; height: 34px; border: 0; border-radius: 8px; background: var(--surface-3); color: var(--muted); cursor: pointer; font-size: 1.15rem; }
.social-compose-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(290px, .9fr); gap: 22px; align-items: start; }
.social-compose-fields { display: grid; gap: 15px; }
.social-compose-fields textarea { min-height: 150px; }
.social-channel-picker { padding: 0; border: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.social-channel-picker legend, .social-inline-channels legend { grid-column: 1 / -1; margin-bottom: 7px; color: var(--muted); font-size: .73rem; font-weight: 750; }
.social-channel-picker label { min-height: 64px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; display: grid; grid-template-columns: auto 34px minmax(0, 1fr); align-items: center; gap: 9px; cursor: pointer; }
.social-channel-picker label:has(input:checked) { border-color: color-mix(in oklch, var(--gold) 40%, var(--line)); background: color-mix(in oklch, var(--gold) 4%, white); }
.social-channel-picker label:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.social-channel-picker input { width: 16px; height: 16px; accent-color: var(--gold); }
.social-channel-picker label > span:last-child { display: grid; gap: 2px; }
.social-channel-picker strong { color: var(--ink); font-size: .7rem; }
.social-channel-picker small { font-size: .6rem; font-weight: 500; }
.social-channel-icon { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: white; font-size: .95rem; font-weight: 900; }
.social-channel-icon.is-facebook { background: #0866ff; }
.social-channel-icon.is-instagram { background: #b22a77; }
.social-preview { border: 1px solid var(--line); border-radius: 11px; background: white; overflow: hidden; }
.social-preview-bar { min-height: 60px; padding: 10px 12px; display: flex; align-items: center; gap: 9px; }
.social-preview-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: white; font-family: Georgia, serif; font-weight: 900; }
.social-preview-bar > span:last-child { display: grid; gap: 2px; }
.social-preview-bar strong { font-size: .7rem; }
.social-preview-bar small { font-size: .59rem; }
.social-preview-media { aspect-ratio: 1 / 1; max-height: 440px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); font-size: .69rem; overflow: hidden; }
.social-preview-media img { width: 100%; height: 100%; object-fit: cover; }
.social-preview > p { min-height: 54px; padding: 12px; color: var(--ink); font-size: .7rem; line-height: 1.45; white-space: pre-wrap; }
.social-preview-actions { min-height: 42px; padding: 0 12px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .59rem; font-weight: 650; }
.social-dialog-actions { padding-top: 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.social-campaign-dialog { width: min(680px, calc(100vw - 32px)); }
.social-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.social-form-grid label { display: grid; gap: 7px; color: var(--muted); font-size: .73rem; font-weight: 750; }
.social-inline-channels { padding: 0; border: 0; display: flex; align-items: center; gap: 18px; }
.social-inline-channels label { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); font-size: .7rem; font-weight: 650; cursor: pointer; }
.social-inline-channels input { width: 16px; height: 16px; accent-color: var(--gold); }
.social-form-note { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: .66rem; line-height: 1.45; }
@keyframes social-dialog-in { from { opacity: 0; transform: translateY(8px) scale(.99); } }

/* Dialog and feedback */
dialog { width: min(92vw, 440px); padding: 0; border: 0; border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: 0 8px 8px oklch(0 0 0 / .3); }
dialog::backdrop { background: oklch(0.05 0 0 / .72); }
.dialog-form { padding: 22px; display: grid; gap: 16px; }
.dialog-header { display: flex; justify-content: space-between; gap: 12px; }
.dialog-header p { color: var(--muted); margin-top: 5px; font-size: .78rem; }
.dialog-header button { border: 0; background: transparent; color: var(--muted); font-size: 1.4rem; cursor: pointer; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: var(--z-toast); display: grid; gap: 8px; }
.toast { width: min(360px, calc(100vw - 36px)); background: var(--ink); color: white; padding: 12px 14px; border-radius: 9px; box-shadow: 0 6px 8px oklch(0 0 0 / .18); animation: toast-in 180ms ease-out; }
.toast.is-error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1180px) {
  .inbox-layout { grid-template-columns: 310px minmax(360px, 1fr); }
  .contact-panel { display: none; }
}

@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-102%); width: 84px; transition: transform 200ms ease-out; box-shadow: 6px 0 8px oklch(0 0 0 / .18); }
  .sidebar.is-open { transform: translateX(0); }
  .app-topbar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 0 14px; }
  .connection-alert { top: 70px; left: 12px; right: 12px; grid-template-columns: 28px minmax(0, 1fr); }
  .connection-alert button { grid-column: 1 / -1; width: 100%; }
  .topbar-menu { display: block; }
  .topbar-title > span { display: none; }
  .topbar-search { display: none; }
  .topbar-organization strong { font-size: .7rem; }
  .view { min-height: calc(100vh - 62px); }
  .inbox-layout { height: calc(100vh - 62px); grid-template-columns: 1fr; }
  .conversation-list-panel { border-right: 0; }
  .chat-panel { display: none; position: fixed; inset: 62px 0 0; z-index: 10; }
  .chat-panel.is-mobile-open { display: block; }
  .back-button { display: block; }
  .chat-header { gap: 9px; padding: 0 12px; }
  .stage-control { display: none; }
  .view-header { min-height: 80px; padding: 16px; }
  .pipeline { min-height: calc(100vh - 142px); }
  .contacts-table-wrap { margin: 12px; }
  .integrations-page { min-height: calc(100vh - 142px); padding: 16px; }
  .agents-page { min-height: calc(100vh - 142px); padding: 16px; }
  .whatsapp-connections-page { min-height: calc(100vh - 142px); padding: 16px; }
  .meta-page { min-height: calc(100vh - 142px); padding: 16px; grid-template-columns: 1fr; }
  .social-studio { min-height: calc(100vh - 142px); padding: 14px 16px 32px; }
  .social-tabs { margin-bottom: 14px; }
  .social-overview-grid { grid-template-columns: 1fr; }
  .social-campaign-row { grid-template-columns: minmax(0, 1fr) auto; }
  .social-campaign-channels, .social-campaign-progress { grid-column: 1; }
  .social-campaign-row > .social-status { grid-column: 2; grid-row: 1; }
  .social-campaign-row > .social-row-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .social-accounts-layout.meta-page { grid-template-columns: 1fr; }
  .social-compose-layout { grid-template-columns: 1fr; }
  .social-preview { max-width: 480px; width: 100%; margin: 0 auto; }
  .home-page { padding: 18px 14px 30px; }
  .home-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .auth-panel { padding: 26px 20px; }
  .panel-header { padding-inline: 14px; }
  .message { max-width: 88%; }
  .view-header .button { min-height: 38px; padding: 0 11px; }
  .view-header-actions { width: 100%; justify-content: flex-start; }
  .view-header h1 { font-size: 1.2rem; }
  .whatsapp-catalog-heading { align-items: flex-start; }
  .whatsapp-catalog-heading > span { display: none; }
  .whatsapp-connection-grid { grid-template-columns: 1fr; }
  .whatsapp-config-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); }
  .whatsapp-config-card { max-height: calc(100dvh - 20px); padding: 16px; }
  .meta-brand-row { grid-template-columns: 44px minmax(0, 1fr); }
  .meta-status-pill { grid-column: 1 / -1; width: fit-content; }
  .meta-account { grid-template-columns: 38px minmax(0, 1fr); }
  .meta-account-state, .meta-account .button { grid-column: 2; width: fit-content; }
  .social-overview-head { align-items: flex-start; padding: 18px; }
  .social-overview-head > div { align-items: flex-start; }
  .social-overview-mark { width: 44px; height: 44px; }
  .social-overview-head .meta-status-pill { display: none; }
  .social-metrics { grid-template-columns: 1fr; }
  .social-metrics article { min-height: 88px; }
  .social-metrics article + article { border-left: 0; border-top: 1px solid var(--line); }
  .social-panel-heading { align-items: flex-start; flex-direction: column; }
  .social-post-row { grid-template-columns: 68px minmax(0, 1fr); align-items: start; }
  .social-post-thumb { width: 68px; height: 68px; }
  .social-post-row > .social-row-actions { grid-column: 2; justify-content: flex-start; }
  .social-campaign-row { grid-template-columns: 1fr; }
  .social-campaign-row > .social-status, .social-campaign-channels, .social-campaign-progress, .social-campaign-row > .social-row-actions { grid-column: 1; grid-row: auto; }
  .social-campaign-row > .social-status { width: fit-content; }
  .social-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); }
  .social-dialog-form { max-height: calc(100dvh - 20px); padding: 16px; }
  .social-channel-picker, .social-form-grid { grid-template-columns: 1fr; }
  .social-dialog-actions .button { flex: 1 1 auto; }
  .ai-provider-grid { grid-template-columns: 1fr; }
  .agent-grid { grid-template-columns: 1fr; }
  .agents-catalog-heading { align-items: flex-start; }
  .agents-catalog-heading a { display: none; }
  .recruitment-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); }
  .recruitment-form { max-height: calc(100dvh - 20px); padding: 16px; }
  .recruitment-contact { grid-template-columns: auto 34px minmax(0, 1fr); }
  .recruitment-status { grid-column: 2 / -1; width: fit-content; }
  .integration-header { align-items: flex-start; }
  .integration-header .ai-header-status { display: none; }
  .ai-config-card { padding: 16px; }
  .ai-config-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); }
  .ai-config-card { max-height: calc(100dvh - 20px); }
  .ai-config-heading { align-items: flex-start; }
  .ai-action-picker { grid-template-columns: 1fr; }
  .home-welcome { align-items: flex-start; }
  .home-health { display: none; }
  .home-metrics { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
