/* Painel Convertlab — estilos */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --text: #16191f;
  --text-2: #4a5160;
  --muted: #7a8291;
  --accent: #0f8f72;
  --accent-600: #0b7a61;
  --accent-50: #e7f6f1;
  --danger: #c8372d;
  --danger-50: #fdecea;
  --warn: #b26a00;
  --warn-50: #fff4e0;
  --side: #121418;
  --side-2: #1b1e24;
  --side-text: #c9ced8;
  --side-muted: #7d8492;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --lead: #6366f1;
  --mql: #d97706;
  --sql: #0f8f72;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.ic { flex: none; }

/* ------------------------------------------------------------ botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s, opacity .12s; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-600); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-lg { height: 46px; font-size: 15px; }
.btn-block { width: 100%; }
.btn.danger, .icon-btn.danger { color: var(--danger); }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--text-2); cursor: pointer; flex: none; text-decoration: none; }
.icon-btn:hover:not(:disabled) { background: rgba(0, 0, 0, .06); color: var(--text); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font-weight: 500; }
.link:hover { text-decoration: underline; }

/* ------------------------------------------------------------ inputs */
.input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); outline: none; transition: border-color .12s, box-shadow .12s; }
textarea.input { height: auto; padding: 9px 11px; resize: vertical; min-height: 60px; line-height: 1.5; }
select.input { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a8291' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }
.input-sm { height: 32px; font-size: 13px; }
.input-lg { height: 48px; font-size: 16px; }
.input.has-value { border-color: var(--accent); background-color: var(--accent-50); }
.input-title { border-color: transparent; background: transparent; font-weight: 600; font-size: 15px; }
.input-title:hover { border-color: var(--border); }
.input-suffix { display: flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.input-suffix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }
.input-suffix .input { border: 0; box-shadow: none !important; }
.input-suffix span { padding: 0 11px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.code-input { text-align: center; letter-spacing: .5em; font-size: 22px; font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--muted); }
.field-hint.warn { color: var(--warn); }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-inline { display: flex; gap: 10px; align-items: center; }
.form-inline.wrap { flex-wrap: wrap; gap: 10px 22px; }
.form-inline > .input, .form-inline > select { flex: 1; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; color: var(--text-2); user-select: none; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.row-end { display: flex; justify-content: flex-end; margin-top: 10px; }

.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { width: 36px; height: 20px; border-radius: 20px; background: var(--border-strong); position: relative; transition: background .15s; flex: none; }
.toggle-thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(16px); }
.toggle input:focus-visible + .toggle-track { box-shadow: 0 0 0 3px var(--accent-50); }
.toggle-label { font-size: 14px; color: var(--text); }

.segmented { display: inline-flex; background: #e9ecf0; border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 0 12px; height: 28px; border-radius: 5px; cursor: pointer; font-size: 13px; color: var(--text-2); font-weight: 500; white-space: nowrap; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented-block { display: flex; }
.segmented-block button { flex: 1; }

.search { position: relative; display: flex; align-items: center; }
.search .ic { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 32px; }

/* ------------------------------------------------------------ chips e tags */
.chip { --chip: #999; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 4px 0 10px; border-radius: 13px; font-size: 12px; font-weight: 500; background: color-mix(in srgb, var(--chip) 18%, #fff); color: color-mix(in srgb, var(--chip) 55%, #000); border: 1px solid color-mix(in srgb, var(--chip) 40%, #fff); max-width: 100%; }
.chip-sm { height: 20px; padding: 0 8px; font-size: 11px; }
.chip-x { border: 0; background: transparent; cursor: pointer; width: 18px; height: 18px; border-radius: 50%; color: inherit; font-size: 15px; line-height: 1; display: grid; place-items: center; }
.chip-x:hover { background: rgba(0, 0, 0, .1); }
.chips-picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-add { width: auto; min-width: 170px; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; background: #eef0f3; color: var(--text-2); font-size: 11px; font-weight: 500; white-space: nowrap; }
.tag-person { background: #eef0ff; color: #4246b8; }
.tag-warn { background: var(--warn-50); color: var(--warn); }
.badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; background: #eef0f3; color: var(--muted); text-transform: uppercase; }
.badge-lead { background: #eef0ff; color: var(--lead); }
.badge-mql { background: #fff4e0; color: var(--mql); }
.badge-sql { background: var(--accent-50); color: var(--sql); }

.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; background: #dfe6ee; color: #3d4757; font-weight: 600; font-size: 13px; flex: none; object-fit: cover; }
.avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }

/* ------------------------------------------------------------ login */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-side { background: radial-gradient(1200px 600px at -10% -10%, #1f6f5c 0%, transparent 60%), var(--side); color: #e9edf3; padding: 56px; display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.auth-side h1 { font-size: 34px; line-height: 1.15; max-width: 420px; }
.auth-side p { color: var(--side-text); max-width: 420px; font-size: 15px; }
.auth-logo { width: 54px; height: 54px; object-fit: contain; margin-bottom: 8px; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth > .auth-main:only-child { grid-column: 1 / -1; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 32px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form h2 { font-size: 22px; }
.auth-phone { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text-2); }
.auth-links { display: flex; justify-content: space-between; }
.client-list { display: flex; flex-direction: column; gap: 8px; }
.client-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: left; }
.client-item:hover { border-color: var(--accent); background: var(--accent-50); }

/* ------------------------------------------------------------ shell */
.shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 248px; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; flex: none; transition: width .18s ease; overflow: hidden; z-index: 30; }
.sidebar.collapsed { width: 64px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 14px; min-height: 68px; border-bottom: 1px solid #22262d; }
.brand .avatar { width: 36px; height: 36px; background: #2a2f37; color: #fff; }
.brand-name { font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 8px; color: var(--side-text); text-decoration: none; background: none; border: 0; width: 100%; cursor: pointer; text-align: left; position: relative; font-size: 14px; }
.nav-item:hover { background: var(--side-2); color: #fff; }
.nav-item.active { background: #23332f; color: #fff; }
.nav-item.active::before { content: ''; position: absolute; left: -8px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: #2ed3a6; }
.nav-item.active .ic { color: #2ed3a6; }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.nav-badge { background: #2ed3a6; color: #08261e; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px; }
.sidebar.collapsed .nav-label, .sidebar.collapsed .brand-name, .sidebar.collapsed .user-name { display: none; }
.sidebar.collapsed .nav-badge { position: absolute; top: 4px; right: 4px; padding: 0 5px; font-size: 10px; }
.sidebar-foot { padding: 8px; border-top: 1px solid #22262d; display: flex; flex-direction: column; gap: 2px; }
.user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.user .avatar { background: #2a2f37; color: #fff; }
.user-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; display: flex; align-items: center; gap: 10px; padding: 0 20px 0 12px; border-bottom: 1px solid var(--border); background: var(--surface); flex: none; }
.top-title { font-size: 17px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.agent-select select { min-width: 190px; }
.main-scroll { flex: 1; overflow: auto; position: relative; }
.view { min-height: 100%; }
.conv-host { flex: 1; min-height: 0; display: flex; }
.conv-frame { flex: 1; min-height: 0; height: 100%; width: 100%; }
.conv-frame iframe { width: 100% !important; height: 100% !important; border: 0; display: block; }
.view-pad { padding: 40px 24px; }

/* ------------------------------------------------------------ páginas */
.page { max-width: 1040px; margin: 0 auto; padding: 28px 24px 120px; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; }
.page-head h1 { font-size: 22px; margin-bottom: 4px; }
.page-head p { max-width: 720px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: 16px 18px 0; }
.card-head h2 { font-size: 15px; font-weight: 600; }
.card-head p { margin-top: 3px; font-size: 13px; }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.card-sub { border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.card-sub h3, .subsection h3, .form-section h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.subsection { border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.subsection-head { display: flex; justify-content: space-between; align-items: center; }
.group-row { display: grid; grid-template-columns: 200px 1fr 32px; gap: 10px; align-items: start; }
.callout { display: flex; gap: 8px; align-items: center; background: var(--warn-50); color: var(--warn); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 3px 0; }
.kv-v { text-align: right; word-break: break-word; }
.status { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.ok { color: var(--accent); }
.status.off { color: var(--danger); }
.instance-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.instance-info { display: flex; flex-direction: column; gap: 2px; margin-right: 24px; }

.empty { text-align: center; padding: 48px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-ic { width: 44px; height: 44px; border-radius: 50%; background: var(--accent-50); color: var(--accent); display: grid; place-items: center; margin-bottom: 4px; }
.empty h3 { font-size: 16px; }
.empty .btn { margin-top: 8px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 60px 20px; color: var(--muted); }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ barra de salvar */
.savebar { position: sticky; bottom: 16px; margin-top: 16px; display: flex; align-items: center; gap: 10px; background: var(--side); color: #fff; border-radius: 12px; padding: 10px 10px 10px 18px; box-shadow: var(--shadow-lg); transform: translateY(140%); opacity: 0; pointer-events: none; transition: transform .2s, opacity .2s; z-index: 10; }
.savebar.show { transform: none; opacity: 1; pointer-events: auto; }
.savebar-dot { width: 8px; height: 8px; border-radius: 50%; background: #f6b343; }
.savebar-text { flex: 1; font-weight: 500; }
.savebar-actions { display: flex; gap: 8px; }
.savebar .btn-ghost { background: transparent; color: #dfe3ea; border-color: #3a3f48; }

/* ------------------------------------------------------------ CRM */
.crm-head { display: flex; flex-direction: column; gap: 10px; padding: 14px 20px 10px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.crm-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crm-filters .input { width: auto; min-width: 130px; }
.crm-filters .search .input { width: 230px; }
.crm-actions { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.crm-count { margin-right: auto; font-size: 13px; }
.board { display: flex; gap: 12px; padding: 16px 20px 24px; align-items: flex-start; min-height: calc(100vh - 200px); overflow-x: auto; }
.col { width: 290px; flex: none; background: #eceef2; border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 210px); border: 2px solid transparent; transition: border-color .12s, background .12s; }
.col.drop { border-color: var(--accent); background: var(--accent-50); }
.col-muted { background: #f0f1f3; }
.col-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.col-title { display: flex; align-items: center; gap: 6px; font-weight: 600; text-transform: capitalize; min-width: 0; }
.col-title span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-count { font-size: 12px; font-weight: 600; color: var(--muted); background: rgba(0, 0, 0, .06); border-radius: 10px; padding: 1px 8px; }
.col-list { padding: 0 8px 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 60px; }
.col-empty { font-size: 12px; color: var(--muted); text-align: center; padding: 16px 0; border: 1px dashed var(--border-strong); border-radius: 8px; }
.lead-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 11px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; box-shadow: 0 1px 1px rgba(16, 24, 40, .04); transition: box-shadow .12s, border-color .12s; }
.lead-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.lead-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lead-card.dragging { opacity: .45; }
.lead-card[draggable="true"] { cursor: grab; }
.lead-top { display: flex; gap: 9px; align-items: center; }
.lead-id { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lead-id strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-id .muted { font-size: 12px; }
.lead-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.unread { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 0 6px; min-width: 18px; text-align: center; }
.lead-notes { font-size: 12.5px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lead-tags { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.ia-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ia-dot.on { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }
.ia-dot.off { background: #b5bcc7; }

.lead-drawer { display: flex; flex-direction: column; gap: 16px; }
.lead-hero { display: flex; align-items: center; gap: 12px; }
.lead-hero strong { font-size: 16px; }

/* ------------------------------------------------------------ base de conhecimento */
.kb-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.kb-toolbar > div { display: flex; gap: 8px; }
.kb-head { display: flex; align-items: center; gap: 4px; padding: 8px 10px; }
.kb-caret .ic { transition: transform .15s; }
.kb-section.open .kb-caret .ic { transform: rotate(90deg); }
.kb-body { border-top: 1px solid var(--border); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.kb-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.kb-item-head { display: flex; gap: 6px; align-items: center; }
.kb-item-head > .input:first-child { flex: 1; font-weight: 500; }
.kb-type { width: 190px; flex: none; }
.list-editor { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.list-row { display: flex; gap: 6px; width: 100%; }

/* ------------------------------------------------------------ situações */
.sit-card { display: flex; gap: 14px; padding: 14px 14px 14px 16px; cursor: pointer; align-items: flex-start; transition: border-color .12s; }
.sit-card:hover { border-color: var(--border-strong); }
.sit-order { padding-top: 2px; }
.sit-id { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #eef0f3; font-weight: 700; font-size: 12px; color: var(--text-2); }
.sit-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.sit-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sit-quando { color: var(--text-2); font-size: 13px; }
.sit-actions-list { display: flex; flex-wrap: wrap; gap: 5px; }
.sit-buttons { display: flex; gap: 2px; }
.sit-editor { display: flex; flex-direction: column; gap: 4px; }
.form-section { display: flex; flex-direction: column; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.form-section:first-child { padding-top: 0; }
.form-section:last-child { border-bottom: 0; }
.var-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 6px; }
.var-chip { border: 1px solid var(--border); background: var(--surface-2); border-radius: 5px; font-size: 11px; padding: 2px 6px; cursor: pointer; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-2); }
.var-chip:hover { border-color: var(--accent); color: var(--accent); }
.fup-list { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.fup-item { display: flex; gap: 10px; align-items: center; }
.fup-item .input-suffix { width: 150px; }

/* ------------------------------------------------------------ áreas e usuários */
.area-row { display: grid; grid-template-columns: 220px 1fr 32px; gap: 12px; padding: 14px; align-items: start; }
.area-key-col, .area-desc-col { display: flex; flex-direction: column; gap: 6px; }
.area-row .icon-btn { margin-top: 24px; }
.user-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.user-card.inactive { opacity: .7; }
.user-card-head { display: flex; gap: 14px; align-items: center; }
.user-card-head .input { font-weight: 600; max-width: 380px; }
.user-card-head .toggle { margin-left: auto; }
.dep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.dep-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--surface-2); text-transform: capitalize; }
.dep-card ol { margin: 8px 0 0; padding-left: 20px; text-transform: none; display: flex; flex-direction: column; gap: 4px; }
.dep-card li .tag { margin-left: 6px; }

/* ------------------------------------------------------------ drawer / modal */
.overlay { position: fixed; inset: 0; background: rgba(13, 16, 22, .42); z-index: 100; opacity: 0; transition: opacity .16s; display: flex; }
.overlay.open { opacity: 1; }
.overlay.closing { opacity: 0; }
.overlay-drawer { justify-content: flex-end; }
.overlay-modal { align-items: center; justify-content: center; padding: 20px; }
.drawer { width: 480px; max-width: 100%; height: 100%; background: var(--surface); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateX(30px); transition: transform .18s; }
.drawer.wide { width: 720px; }
.overlay.open .drawer { transform: none; }
.modal { width: 440px; max-width: 100%; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateY(8px) scale(.98); transition: transform .16s; }
.overlay.open .modal { transform: none; }
.drawer-head, .modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-head h2, .modal-head h2 { font-size: 17px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.modal-body { padding: 18px 20px; }
.drawer-foot, .modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.confirm-text { font-size: 14.5px; color: var(--text-2); }

/* ------------------------------------------------------------ toasts */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--side); color: #fff; padding: 11px 16px; border-radius: 9px; box-shadow: var(--shadow-lg); font-weight: 500; max-width: min(560px, 90vw); animation: toastIn .18s ease; transition: opacity .3s, transform .3s; }
.toast-error { background: var(--danger); }
.toast-info { background: #2c3340; }
.toast.out { opacity: 0; transform: translateY(6px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------ responsivo */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; width: 260px !important; }
  .sidebar.mobile-open { transform: none; box-shadow: var(--shadow-lg); }
  .sidebar.collapsed .nav-label, .sidebar.collapsed .brand-name, .sidebar.collapsed .user-name { display: initial; }
  .form-grid, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .area-row, .group-row { grid-template-columns: 1fr; }
  .area-row .icon-btn { margin-top: 0; }
  .page { padding: 20px 14px 120px; }
  .crm-head { padding: 12px 14px 10px; }
  .crm-filters .search .input { width: 100%; }
  .crm-filters .search { flex: 1 1 100%; }
  .board { padding: 12px 14px 20px; }
  .col { width: 82vw; }
  .agent-select select { min-width: 0; max-width: 46vw; }
  .kb-item-head { flex-wrap: wrap; }
  .kb-type { width: 100%; }
}
