/* CRM Wyntech — palette extracted from wyntech.com.br (primary #00B4D8, secondary #023E8A, accent #0077B6, base #0B0F19) */
:root {
  --brand-900: #0B0F19;
  --brand-800: #111827;
  --brand-700: #023E8A;
  --brand-600: #0077B6;
  --brand-500: #00B4D8;
  --brand-400: #48CAE4;
  --brand-100: #E0F7FC;
  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --border: #E2E7EF;
  --border-strong: #CBD3DF;
  --text: #111827;
  --text-2: #4B5563;
  --muted: #6B7280;
  --success: #0E9F6E;
  --success-bg: #E7F7F0;
  --warning: #B45309;
  --warning-bg: #FEF3C7;
  --danger: #DC2626;
  --danger-bg: #FDECEC;
  --info-bg: #E0F2FE;
  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .18);
  --font: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.45; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; color: var(--brand-900); }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; } h4 { font-size: .92rem; }
p { margin: 0 0 .75rem; }
small, .small { font-size: .82rem; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nowrap { white-space: nowrap; }
.right { text-align: right; } .center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.gap { gap: .5rem; }
.flex { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.grow { flex: 1 1 auto; }

/* ---------- Top bar ---------- */
.topbar { background: var(--brand-900); color: #fff; position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 0 rgba(255,255,255,.06); }
.topbar-inner { display: flex; align-items: center; gap: .75rem; padding: 0 1rem; height: 50px; max-width: 1600px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: .55rem; color: #fff; font-weight: 800; letter-spacing: .5px; flex: 0 0 auto; }
.brand:hover { text-decoration: none; }
.brand svg { display: block; max-height: 32px; width: auto; }
.brand img { display: block; height: 38px; width: auto; }
.mainnav { flex: 1 1 auto; display: flex; align-items: stretch; height: 100%; }
.mega { position: relative; display: flex; align-items: center; }
.mega-trigger { display: inline-flex; align-items: center; gap: .4rem; background: none; border: 0; color: #E5E7EB; font: inherit; font-weight: 700; letter-spacing: .5px; padding: .45rem .8rem; border-radius: 6px; cursor: pointer; }
.mega-trigger .icon { width: 16px; height: 16px; }
.mega-trigger .caret { font-size: .7rem; opacity: .7; }
.mega-trigger:hover, .mega:hover .mega-trigger, .mega.open .mega-trigger { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.mega-trigger.active { color: var(--brand-500); }
/* Hover opens the panel; the transparent bridge (padding-top) keeps it open while the pointer moves down. */
.mega-panel { display: none; position: absolute; left: 0; top: 100%; padding-top: 6px; z-index: 70; }
.mega:hover .mega-panel, .mega:has(:focus-visible) .mega-panel, .mega.open .mega-panel { display: flex; }
.mega-panel > .mega-col { background: var(--surface); padding: 1rem 1.4rem 1.1rem; min-width: 200px; border-top: 3px solid var(--brand-500); box-shadow: var(--shadow-lg); }
.mega-panel > .mega-col + .mega-col { border-left: 1px solid var(--border); }
.mega-panel > .mega-col:first-child { border-radius: 0 0 0 var(--radius); }
.mega-panel > .mega-col:last-child { border-radius: 0 0 var(--radius) 0; }
.mega-col h4 { font-size: 1.05rem; font-weight: 500; color: var(--brand-900); margin: 0 0 .6rem; }
.mega-col a { display: block; color: var(--text-2); font-size: .86rem; padding: .28rem 0; white-space: nowrap; }
.mega-col a:hover { color: var(--brand-600); text-decoration: none; }
.mega-col a.active { color: var(--brand-600); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: .5rem; margin-left: auto; flex: 0 0 auto; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; color: #D1D5DB; border: 1px solid rgba(255,255,255,.15); }
.icon-btn:hover, .icon-btn.active { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.icon-btn .icon { width: 17px; height: 17px; }
.company-switch { display: flex; align-items: center; gap: .35rem; color: #9CA3AF; }
.company-switch .icon { width: 16px; height: 16px; flex: 0 0 auto; }
.company-switch select { background: var(--brand-800); color: #fff; border: 1px solid rgba(255,255,255,.18); border-radius: var(--radius-sm); padding: .3rem .45rem; font-size: .82rem; max-width: 190px; width: auto; }
.user-menu { position: relative; }
.user-menu > button { background: transparent; border: 0; padding: 0; cursor: pointer; display: flex; border-radius: 50%; }
.user-menu > button:hover .avatar, .user-menu > button[aria-expanded="true"] .avatar { box-shadow: 0 0 0 3px rgba(0,180,216,.35); }
.user-menu .avatar { width: 34px; height: 34px; font-size: .8rem; }
.dropdown-head { display: flex; flex-direction: column; padding: .35rem .65rem .45rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-600); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .75rem; color: #fff; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 220px; padding: .35rem; z-index: 60; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: .5rem .65rem; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); text-decoration: none; }
.dropdown .sep { border-top: 1px solid var(--border); margin: .3rem 0; }
.dropdown a .icon, .dropdown button .icon { width: 15px; height: 15px; margin-right: .45rem; vertical-align: -2px; color: var(--muted); }
.dropdown-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: .35rem .65rem .25rem; }
.dropdown-head-row { flex-direction: row; align-items: center; gap: .6rem; }
.dropdown-head-row > div { display: flex; flex-direction: column; min-width: 0; }

/* Top bar menus (bell, help, gear, company) */
.top-menu { position: relative; display: flex; }
button.icon-btn { background: none; cursor: pointer; padding: 0; position: relative; }
.icon-btn[aria-expanded="true"] { color: #fff; background: rgba(255,255,255,.12); }
.notif-badge { position: absolute; top: -4px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #EF4444; color: #fff; font-size: .65rem; font-weight: 700; line-height: 17px; text-align: center; border: 2px solid var(--brand-900); box-sizing: content-box; }
.notif-badge.hidden { display: none; }
.dropdown-panel { padding: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem .8rem; border-bottom: 1px solid var(--border); }
.panel-filters { display: flex; gap: .4rem; padding: .5rem .8rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.panel-filters .fchip { flex: 1 1 0; min-width: 0; }
.panel-filters .fchip select { max-width: none; width: 100%; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand-600); cursor: pointer; font: inherit; }
.dropdown .link-btn { width: auto; display: inline; padding: 0; }
.dropdown .link-btn:hover { background: none; text-decoration: underline; }
.notif-panel { width: 360px; }
.notif-list { max-height: min(420px, calc(100vh - 170px)); overflow-y: auto; }
.notif-empty { text-align: center; color: var(--muted); font-size: .85rem; padding: 1.6rem .8rem; margin: 0; }
.notif-empty.hidden { display: none; }
.dropdown a.notif-item { display: flex; flex-direction: column; gap: .1rem; padding: .55rem .8rem; border-radius: 0; border-bottom: 1px solid var(--border); font-size: .84rem; }
.dropdown a.notif-item:last-child { border-bottom: 0; }
.notif-item.unread { background: #EFF9FC; box-shadow: inset 3px 0 0 var(--brand-500); }
.notif-meta { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.notif-item strong { font-weight: 600; line-height: 1.3; }
.notif-body { color: var(--text-2); font-size: .78rem; }
.company-btn { display: inline-flex; align-items: center; gap: .4rem; height: 34px; max-width: 210px; padding: 0 .65rem; border-radius: 17px; border: 1px solid rgba(255,255,255,.18); background: var(--brand-800); color: #E5E7EB; font: inherit; font-size: .82rem; cursor: pointer; }
.company-btn:hover, .company-btn[aria-expanded="true"] { color: #fff; border-color: rgba(255,255,255,.35); }
.company-btn .icon { width: 15px; height: 15px; flex: 0 0 auto; }
.company-btn-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-btn .caret { font-size: .65rem; opacity: .7; }
.company-panel { width: 320px; }
.picker-search { display: flex; align-items: center; gap: .4rem; padding: .5rem .7rem; border-bottom: 1px solid var(--border); }
.picker-search .icon { width: 15px; height: 15px; color: var(--muted); }
.picker-search input { border: 0; padding: .25rem 0; box-shadow: none; outline: none; font-size: .88rem; }
.company-list { max-height: min(380px, calc(100vh - 140px)); overflow-y: auto; padding: .3rem; }
.dropdown .company-item { display: flex; align-items: center; gap: .6rem; padding: .45rem .55rem; }
.company-item.hidden { display: none; }
.company-item.current { background: var(--surface-2); }
.company-initials { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 8px; background: linear-gradient(135deg, #0E5F78, #1C9BBB); color: #fff; font-weight: 700; font-size: .78rem; display: inline-flex; align-items: center; justify-content: center; }
.company-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.company-text strong { font-weight: 600; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown .company-check .icon { color: var(--brand-600); margin: 0; }
.avatar.has-photo { padding: 0; overflow: hidden; background: var(--surface-2); }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-md { width: 38px; height: 38px; font-size: .85rem; flex: 0 0 auto; }
.avatar-xl { width: 96px; height: 96px; font-size: 2rem; flex: 0 0 auto; }
.profile-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.profile-photo-actions { display: flex; flex-direction: column; gap: .15rem; }
.profile-photo-actions label.btn { cursor: pointer; }
.text-success { color: var(--success, #15803D); }
.menu-toggle { display: none; background: none; border: 0; color: #fff; font-size: 1.4rem; cursor: pointer; }

/* ---------- Layout ---------- */
.page { max-width: 1600px; margin: 0 auto; padding: 1rem 1.25rem; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-header h1 { margin: 0; }
.breadcrumb { font-size: .82rem; color: var(--muted); margin-bottom: .25rem; }
.breadcrumb a { color: var(--muted); }
.subnav { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.subnav a { padding: .55rem .85rem; color: var(--text-2); border-bottom: 2px solid transparent; font-weight: 500; }
.subnav a.active { color: var(--brand-700); border-bottom-color: var(--brand-500); }
.subnav a:hover { text-decoration: none; color: var(--brand-700); }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-all { grid-column: 1 / -1; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 1rem 1.1rem; }
.card-header { padding: .8rem 1.1rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.card-header h2, .card-header h3 { margin: 0; }
.card + .card { margin-top: 1rem; }
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 1rem 0 .5rem; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .75rem 1rem; }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; } .col-9 { grid-column: span 9; } .col-5 { grid-column: span 5; } .col-7 { grid-column: span 7; }
.field label, label.lbl { display: block; font-weight: 600; font-size: .82rem; margin-bottom: .25rem; color: var(--text-2); }
.field .req::after { content: " *"; color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=tel], input[type=url], select, textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; font: inherit; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus, .editor-area:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(0,180,216,.18); }
input[readonly], input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
textarea { min-height: 80px; resize: vertical; }
.is-invalid { border-color: var(--danger) !important; }
.field-error { color: var(--danger); font-size: .78rem; margin-top: .2rem; }
.field-help { color: var(--muted); font-size: .78rem; margin-top: .2rem; }
.field-status { font-size: .78rem; margin-top: .2rem; }
.field-status.ok { color: var(--success); } .field-status.err { color: var(--danger); } .field-status.loading { color: var(--brand-600); }
.check { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; }
.input-group { display: flex; gap: .4rem; }
.input-group > input, .input-group > select { flex: 1 1 auto; }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 700; padding: 0 .35rem; color: var(--brand-700); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .48rem .9rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: #fff; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; line-height: 1.2; }
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-primary:hover { background: var(--brand-700); }
.btn-accent { background: var(--brand-500); border-color: var(--brand-500); color: var(--brand-900); }
.btn-accent:hover { background: var(--brand-400); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.94); background: var(--success); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.94); background: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand-600); }
.btn-ghost:hover { background: var(--brand-100); }
.btn-sm { padding: .3rem .6rem; font-size: .82rem; }
.btn-icon { padding: .35rem .5rem; }
.icon { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; flex: none; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .55rem .7rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; background: var(--surface-2); white-space: nowrap; }
.table th a { color: var(--muted); }
.table tr:hover td { background: #FAFCFE; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
.table .actions { white-space: nowrap; text-align: right; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }

.pagination { display: flex; gap: .25rem; justify-content: flex-end; align-items: center; padding: .75rem 1rem; flex-wrap: wrap; }
.pagination a, .pagination span { padding: .3rem .6rem; border: 1px solid var(--border); border-radius: 5px; font-size: .85rem; }
.pagination .current { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }

/* ---------- Badges & alerts ---------- */
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .12rem .5rem; border-radius: 999px; font-size: .74rem; font-weight: 700; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge-success { background: var(--success-bg); color: var(--success); border-color: transparent; }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.badge-info { background: var(--info-bg); color: var(--brand-700); border-color: transparent; }
.badge-hot { background: #FDECEC; color: #B91C1C; border-color: transparent; }
.badge-warm { background: #FEF3C7; color: #92400E; border-color: transparent; }
.badge-cold { background: #E0F2FE; color: #075985; border-color: transparent; }
.alert { padding: .7rem .9rem; border-radius: var(--radius-sm); margin-bottom: .75rem; border: 1px solid transparent; display: flex; gap: .5rem; align-items: flex-start; }
.alert-success { background: var(--success-bg); color: #065F46; border-color: #A7E3CB; }
.alert-error { background: var(--danger-bg); color: #991B1B; border-color: #F5B5B5; }
.alert-warning { background: var(--warning-bg); color: #92400E; border-color: #F5D58A; }
.alert-info { background: var(--info-bg); color: #075985; border-color: #B6DDF7; }
.flash-stack { position: fixed; right: 1rem; top: 66px; z-index: 80; width: min(420px, calc(100vw - 2rem)); }
.flash-stack .alert { box-shadow: var(--shadow-lg); }

/* ---------- KPIs / Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow); }
.kpi .kpi-label { color: var(--muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi .kpi-value { font-size: 1.5rem; font-weight: 800; color: var(--brand-900); margin-top: .2rem; }
.kpi .kpi-sub { font-size: .8rem; color: var(--text-2); margin-top: .15rem; }
.bar-chart svg { width: 100%; height: auto; display: block; }
.bar-chart text { font-family: var(--font); font-size: 12px; fill: var(--text-2); }

/* ---------- Kanban ---------- */
.board { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; }
.column { flex: 0 0 255px; background: #EAEFF5; border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 150px); }
.column-header { padding: .65rem .75rem .5rem; border-bottom: 1px solid var(--border-strong); }
.column-header h3 { margin: 0; font-size: .9rem; display: flex; justify-content: space-between; }
.column-totals { font-size: .75rem; color: var(--text-2); margin-top: .2rem; }
.column-body { padding: .5rem; overflow-y: auto; flex: 1 1 auto; min-height: 80px; }
.column.drag-over { background: #D6EEF6; outline: 2px dashed var(--brand-500); }
.opp-card { background: #fff; border: 1px solid var(--border); border-radius: 7px; padding: .6rem .65rem; margin-bottom: .5rem; box-shadow: var(--shadow); cursor: grab; position: relative; }
.opp-card:active { cursor: grabbing; }
.opp-card.dragging { opacity: .5; }
.opp-card .opp-title { font-weight: 700; color: var(--brand-900); display: block; margin-right: 1.6rem; }
.opp-card .opp-meta { font-size: .78rem; color: var(--text-2); margin-top: .25rem; display: flex; flex-wrap: wrap; gap: .25rem .6rem; }
.opp-card .opp-values { font-size: .8rem; margin-top: .35rem; display: flex; gap: .6rem; flex-wrap: wrap; }
.opp-card .card-menu { position: absolute; top: .35rem; right: .35rem; }
.opp-card .overdue { color: var(--danger); font-weight: 600; }
.card-menu > button { border: 0; background: transparent; cursor: pointer; padding: .15rem .3rem; border-radius: 4px; color: var(--muted); }
.card-menu > button:hover { background: var(--surface-2); }
.card-menu .dropdown { min-width: 200px; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.6rem; border-left: 2px solid var(--border); margin-left: .45rem; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand-500); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--brand-500); }
.timeline li.t-system::before { background: var(--muted); box-shadow: 0 0 0 1px var(--muted); }
.timeline li.t-won::before { background: var(--success); box-shadow: 0 0 0 1px var(--success); }
.timeline li.t-lost::before { background: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.timeline .t-head { font-size: .8rem; color: var(--muted); }
.timeline .t-title { font-weight: 600; }
.timeline .t-body { white-space: pre-wrap; margin-top: .2rem; color: var(--text-2); }

/* ---------- Details ---------- */
dl.details { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: .35rem .75rem; margin: 0; }
dl.details dt { color: var(--muted); font-size: .82rem; }
dl.details dd { margin: 0; word-break: break-word; }
.header-values { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.header-values .hv-label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.header-values .hv-value { font-weight: 700; font-size: 1.05rem; }
.tag-missing { color: var(--warning); font-size: .75rem; font-weight: 600; }

/* ---------- Repeaters (contacts/addresses/items) ---------- */
.repeater-item { border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem; margin-bottom: .75rem; background: var(--surface-2); position: relative; }
.repeater-item .remove-row { position: absolute; right: .5rem; top: .5rem; }
.items-table input, .items-table select { padding: .35rem .4rem; font-size: .85rem; }
.items-table td { padding: .35rem .4rem; }
.totals-box { margin-left: auto; width: min(380px, 100%); }
.totals-box div { display: flex; justify-content: space-between; padding: .25rem 0; }
.totals-box .grand { font-weight: 800; font-size: 1.05rem; border-top: 1px solid var(--border); margin-top: .25rem; padding-top: .45rem; }

/* ---------- Modal ---------- */
dialog.modal { border: 0; border-radius: 10px; padding: 0; width: min(560px, calc(100vw - 2rem)); box-shadow: var(--shadow-lg); }
dialog.modal.wide { width: min(900px, calc(100vw - 2rem)); }
dialog.modal::backdrop { background: rgba(11, 15, 25, .55); }
.modal-header { padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { margin: 0; font-size: 1.05rem; }
.modal-body { padding: 1rem 1.1rem; max-height: 70vh; overflow-y: auto; }
.modal-footer { padding: .75rem 1.1rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .5rem; }

/* ---------- Rich text editor ---------- */
.editor { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: .2rem; padding: .35rem; border-bottom: 1px solid var(--border); background: var(--surface-2); position: sticky; top: 56px; z-index: 5; }
.editor-toolbar button, .editor-toolbar select { border: 1px solid transparent; background: transparent; border-radius: 4px; padding: .25rem .45rem; cursor: pointer; font: inherit; font-size: .82rem; color: var(--text); }
.editor-toolbar button:hover { background: #fff; border-color: var(--border); }
.editor-toolbar select { border-color: var(--border); background: #fff; }
.editor-toolbar .sep { width: 1px; background: var(--border-strong); margin: 0 .2rem; }
.editor-area { min-height: 260px; padding: 1rem 1.2rem; outline: none; }
.editor-area.small { min-height: 70px; }
.editor-area table { border-collapse: collapse; width: 100%; margin: .5rem 0; }
.editor-area td, .editor-area th { border: 1px dashed var(--border-strong); padding: .3rem .4rem; min-width: 40px; }
.editor-area .page-break { border-top: 2px dashed var(--brand-500); margin: 1rem 0; height: 0; }
.editor-area .field, .field-token { background: var(--brand-100); color: var(--brand-700); border-radius: 3px; padding: 0 2px; }
.al-left { text-align: left; } .al-center { text-align: center; } .al-right { text-align: right; } .al-justify { text-align: justify; }
.text-small { font-size: .85em; } .text-large { font-size: 1.2em; } .text-muted { color: var(--muted); }

/* ---------- Auth pages ---------- */
/* ---------- Login / guest pages: brand panel + form ---------- */
.auth-body { background: #fff; }
.auth-split { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-hero { position: relative; overflow: hidden; color: #fff; display: flex; align-items: center; justify-content: center; padding: 2.5rem 2rem;
  background: radial-gradient(900px 700px at 100% 100%, rgba(37, 99, 235, .95), transparent 60%), radial-gradient(700px 500px at 0% 0%, rgba(8, 22, 70, .9), transparent 70%), linear-gradient(160deg, #071a4d 0%, #0b2a86 55%, #1d4ed8 100%); }
.auth-hero::after { content: ""; position: absolute; right: -10%; bottom: -15%; width: 60%; height: 50%; background: radial-gradient(closest-side, rgba(56, 189, 248, .35), transparent); pointer-events: none; }
.auth-hero-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 2.2rem; width: min(520px, 100%); }
.auth-hero-logo img { height: auto; width: min(340px, 70vw); display: block; }
.auth-hero-title { margin: 0; font-size: clamp(1.8rem, 3.3vw, 2.9rem); font-weight: 800; letter-spacing: .2px; text-align: center; }
.auth-flow { display: flex; align-items: center; justify-content: center; width: 100%; margin-top: 1rem; }
.auth-tile { position: relative; flex: 0 0 auto; width: clamp(90px, 11vw, 150px); aspect-ratio: 1.12 / 1; display: grid; place-items: center; color: rgba(219, 234, 254, .95);
  border-radius: 18px; background: linear-gradient(160deg, rgba(255,255,255,.22), rgba(255,255,255,.06)); border: 1px solid rgba(255,255,255,.35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 12px 30px rgba(3, 10, 40, .35); backdrop-filter: blur(6px); }
.auth-tile svg { width: 52%; height: 52%; }
.auth-link { flex: 1 1 auto; max-width: 56px; min-width: 14px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, rgba(96,165,250,.4), #60a5fa, rgba(96,165,250,.4)); box-shadow: 0 0 10px rgba(96,165,250,.9); }
.auth-check { position: absolute; right: 9%; bottom: 10%; width: 27%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: #2563eb; box-shadow: 0 0 0 3px rgba(255,255,255,.25), 0 4px 12px rgba(37,99,235,.6); }
.auth-check svg { width: 62%; height: 62%; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; background: #fff; }
.auth-panel { width: min(420px, 100%); }
.auth-panel h1 { font-size: clamp(1.6rem, 2.4vw, 2.1rem); font-weight: 800; text-align: center; color: #0b1437; margin-bottom: 1.8rem; }
.auth-panel .field { margin-bottom: 1.1rem; }
.auth-panel .field label { font-size: .92rem; font-weight: 600; color: #1f2937; margin-bottom: .35rem; }
.auth-panel input[type=email], .auth-panel input[type=password], .auth-panel input[type=text] { height: 46px; font-size: .95rem; border-radius: 7px; }
.auth-panel .btn { width: 100%; }
.auth-forgot { text-align: right; margin-top: .55rem; font-size: .88rem; }
.auth-forgot a { color: #1d4ed8; }
.auth-submit { height: 48px; font-size: 1rem; border-radius: 7px; background: #0b2a6b; border-color: #0b2a6b; margin-top: .6rem; }
.auth-submit:hover { background: #12388f; border-color: #12388f; }
.auth-mobile-logo { display: none; }
@media (max-width: 900px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-main { align-items: flex-start; padding-top: 2.5rem; }
  .auth-mobile-logo { display: flex; justify-content: center; margin-bottom: 1.5rem; }
  .auth-mobile-logo img { height: 52px; width: auto; }
}
.crm-tag { font-size: .72rem; font-weight: 700; color: #17839F; border: 1px solid rgba(23,131,159,.5); border-radius: 4px; padding: 1px 6px; letter-spacing: 1px; }
.captcha-box { display: flex; gap: .5rem; align-items: center; }
.captcha-box img { border-radius: 5px; border: 1px solid var(--border); }
.recovery-codes { font-family: Consolas, Menlo, monospace; display: grid; grid-template-columns: repeat(2, 1fr); gap: .35rem; background: var(--surface-2); padding: .75rem; border-radius: var(--radius-sm); }
.secret-box { font-family: Consolas, Menlo, monospace; font-size: 1.05rem; letter-spacing: 2px; background: var(--surface-2); padding: .6rem .8rem; border-radius: var(--radius-sm); word-break: break-all; }
code, .mono { font-family: Consolas, Menlo, monospace; font-size: .85em; }
.copy-field { display: flex; gap: .4rem; }
.copy-field input { font-family: Consolas, Menlo, monospace; font-size: .82rem; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { min-width: 140px; }
.filters .field.wide { min-width: 230px; flex: 1 1 230px; }
.view-toggle { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.view-toggle a { padding: .42rem .75rem; color: var(--text-2); font-weight: 600; display: inline-flex; gap: .3rem; align-items: center; }
.view-toggle a.active { background: var(--brand-600); color: #fff; }
.view-toggle a:hover { text-decoration: none; }

.diff-table td:first-child { width: 28%; color: var(--muted); }
.diff-table .changed { background: #FFFBEB; }
.settings-hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem; }
.settings-hub a { display: block; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow); }
.settings-hub a:hover { border-color: var(--brand-500); text-decoration: none; }
.settings-hub strong { display: block; color: var(--brand-700); margin-bottom: .2rem; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.status-dot.on { background: var(--success); } .status-dot.off { background: var(--border-strong); } .status-dot.err { background: var(--danger); }
.preview-frame { width: 100%; height: 75vh; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.logo-preview { max-height: 60px; max-width: 200px; border: 1px solid var(--border); padding: .25rem; border-radius: 4px; background: #fff; }

/* ---------- Contracts / integrations ---------- */
.table-form td { padding: .35rem .4rem; vertical-align: middle; }
.table-form input, .table-form select { width: 100%; min-width: 0; }
.input-xs { max-width: 4.5rem; }
.doc-preview { max-height: 70vh; overflow: auto; line-height: 1.55; }
.doc-preview .al-center { text-align: center; } .doc-preview .al-right { text-align: right; } .doc-preview .al-justify { text-align: justify; }
.doc-preview table { border-collapse: collapse; width: 100%; } .doc-preview td, .doc-preview th { border: 1px solid var(--border); padding: .3rem; }
ol.steps { list-style: none; padding: 0; margin: 0; counter-reset: st; }
ol.steps li { counter-increment: st; padding: .35rem 0 .35rem 2rem; position: relative; color: var(--muted); }
ol.steps li::before { content: counter(st); position: absolute; left: 0; top: .3rem; width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 1px solid var(--border); display: grid; place-items: center; font-size: .75rem; }
ol.steps li.current { color: var(--text); font-weight: 600; } ol.steps li.current::before { border-color: var(--brand-600); color: var(--brand-600); }
ol.steps li.done { color: var(--text); } ol.steps li.done::before { content: '✓'; background: var(--success); border-color: var(--success); color: #fff; }
.integration-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.integration-card .card-body { display: flex; flex-direction: column; gap: .5rem; height: 100%; }
.secret-state { font-size: .8rem; }
.mfa-qr { margin: .75rem 0 1rem; }
.mfa-qr img { display: block; width: 220px; height: 220px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; }
.copy-field { display: flex; gap: .4rem; } .copy-field input { flex: 1; font-family: var(--mono, monospace); font-size: .8rem; }

/* ---------- Tooltips (data-tip) ---------- */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-within::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); background: var(--brand-900); color: #fff;
  font-size: .74rem; font-weight: 500; line-height: 1.2; padding: .3rem .5rem; border-radius: 4px; white-space: nowrap; pointer-events: none; z-index: 90; box-shadow: var(--shadow);
}

/* ---------- PF/PJ switch ---------- */
.seg-toggle { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; }
.seg-toggle label { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 36px; cursor: pointer; color: var(--muted); margin: 0; }
.seg-toggle label + label { border-left: 1px solid var(--border-strong); }
.seg-toggle label:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.seg-toggle label:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.seg-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-toggle label:has(input:checked) { background: var(--brand-600); color: #fff; }
.seg-toggle label:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(0,180,216,.35); }
.seg-toggle .icon { width: 17px; height: 17px; }
.seg-toggle [data-tip]:hover::after, .seg-toggle [data-tip]:focus-within::after { left: 0; transform: none; bottom: auto; top: calc(100% + 5px); }
.input-group > .btn { flex: 0 0 auto; }

/* ---------- Toolbar + compact filters ---------- */
.toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .6rem; }
.toolbar h1 { font-size: 1.15rem; margin: 0 .25rem 0 0; white-space: nowrap; }
.toolbar-actions { display: flex; align-items: center; gap: .4rem; margin-left: auto; }
.filters.compact { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: 0; order: 3; flex: 1 1 100%; }
.fchip { display: inline-flex; align-items: center; gap: .3rem; height: 30px; padding: 0 .2rem 0 .55rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; font-size: .8rem; margin: 0; cursor: pointer; white-space: nowrap; }
.fchip > span { color: var(--muted); font-weight: 600; font-size: .74rem; }
.fchip select, .fchip input { border: 0; box-shadow: none !important; padding: 0 .15rem; height: 28px; font-size: .8rem; width: auto; max-width: 150px; background: transparent; }
.fchip:focus-within { border-color: var(--brand-500); box-shadow: 0 0 0 2px rgba(0,180,216,.18); }
.fchip-search { padding-left: .45rem; cursor: text; }
.fchip-search input { width: 190px; max-width: 220px; }
.fchip .icon { width: 14px; height: 14px; color: var(--muted); }
.fmore { position: relative; }
.fmore > summary { list-style: none; padding-right: .55rem; color: var(--text-2); font-weight: 600; }
.fmore > summary::-webkit-details-marker { display: none; }
.fmore[open] > summary { border-color: var(--brand-500); color: var(--brand-700); }
.fmore-panel { position: absolute; top: calc(100% + 4px); left: 0; z-index: 40; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .5rem; display: flex; flex-direction: column; gap: .35rem; min-width: 250px; }
.fmore-panel .fchip { justify-content: space-between; }
.filters.compact .btn-sm { height: 30px; }
.view-toggle a .icon { width: 16px; height: 16px; }
.view-toggle a { padding: .32rem .55rem; }
.kanban-hint { font-size: .76rem; margin: 0 0 .4rem; }

/* ---------- Popup forms ---------- */
dialog.modal.modal-form { width: min(620px, calc(100vw - 1.5rem)); overflow: visible; }
dialog.modal.modal-form > form { display: flex; flex-direction: column; max-height: calc(100vh - 2rem); }
dialog.modal.modal-form .modal-body { max-height: none; overflow-y: auto; flex: 1 1 auto; }
.form-grid.compact { gap: .55rem .75rem; }
.form-grid.compact .field label, .form-grid.compact .lbl { font-size: .78rem; margin-bottom: .15rem; }
.form-grid.compact input, .form-grid.compact select { padding: .4rem .5rem; }
.lbl { display: block; font-weight: 600; font-size: .82rem; margin-bottom: .25rem; color: var(--text-2); }

/* ---------- Lead picker ---------- */
.lead-picker { position: relative; }
.picker-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .4rem .55rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; font: inherit; color: var(--muted); cursor: pointer; text-align: left; }
.lead-picker.has-value .picker-toggle { color: var(--text); }
.picker-toggle:focus-visible, .picker-toggle[aria-expanded="true"] { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(0,180,216,.18); }
.picker-toggle .caret { font-size: .7rem; color: var(--muted); }
.picker-panel { position: absolute; left: 0; right: 0; top: calc(100% + 3px); z-index: 80; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .45rem; }
.picker-search { display: flex; align-items: center; gap: .35rem; border: 1px solid var(--border-strong); border-radius: 999px; padding: 0 .6rem; margin-bottom: .35rem; }
.picker-search .icon { width: 14px; height: 14px; color: var(--muted); }
.picker-search input { border: 0; box-shadow: none !important; padding: .35rem 0; }
.picker-list { max-height: 250px; overflow-y: auto; }
.picker-item { display: flex; flex-direction: column; width: 100%; text-align: left; background: none; border: 0; border-left: 3px solid transparent; padding: .4rem .55rem; cursor: pointer; font: inherit; border-bottom: 1px solid var(--border); }
.picker-item:hover, .picker-item.active { background: var(--surface-2); border-left-color: var(--brand-500); }
.picker-item.selected { border-left-color: var(--brand-600); background: var(--brand-100); }
.pi-name { font-weight: 600; font-size: .84rem; color: var(--text); }
.pi-meta { font-size: .74rem; color: var(--muted); }
.picker-empty { padding: .6rem; color: var(--muted); font-size: .82rem; }
.picker-more { display: block; margin: .4rem auto .2rem; background: #fff; border: 1px solid var(--border-strong); border-radius: 999px; padding: .2rem .9rem; font: inherit; font-size: .78rem; cursor: pointer; }
.picker-add { display: flex; align-items: center; justify-content: center; gap: .35rem; width: 100%; margin-top: .35rem; padding: .45rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; font-size: .82rem; font-weight: 600; color: var(--brand-700); cursor: pointer; }
.picker-add:hover { background: var(--brand-100); }
.picker-add .icon { width: 14px; height: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main-side { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .topbar-inner { padding: 0 .6rem; gap: .4rem; }
  .brand svg { max-width: 80px; }
  .brand img { height: 26px; }
  .company-switch select { max-width: 96px; }
  .company-switch .icon { display: none; }
  .mega-trigger { padding: .4rem .45rem; }
  .mega-trigger .icon { display: none; }
  .icon-btn, .user-menu .avatar { width: 30px; height: 30px; }
  .mega { position: static; }
  .mega-panel { left: 0; right: 0; flex-direction: column; max-height: calc(100vh - 50px); overflow-y: auto; }
  .mega:hover .mega-panel { display: none; }
  .mega.open .mega-panel, .mega:has(:focus-visible) .mega-panel { display: flex; }
  .mega-panel > .mega-col { border-radius: 0 !important; border-left: 0 !important; border-top: 1px solid var(--border); padding: .6rem 1rem; }
  .mega-panel > .mega-col:first-child { border-top: 3px solid var(--brand-500); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid > * { grid-column: 1 / -1 !important; }
  .page { padding: .75rem; }
  dl.details { grid-template-columns: 1fr; }
  dl.details dt { margin-top: .4rem; }
  .column { flex-basis: 85vw; }
  .table-stack thead { display: none; }
  .table-stack tr { display: block; border-bottom: 1px solid var(--border); padding: .4rem 0; }
  .table-stack td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .25rem .7rem; text-align: right; }
  .table-stack td::before { content: attr(data-label); font-weight: 600; color: var(--muted); text-align: left; }
}
@media print {
  .topbar, .no-print, .flash-stack { display: none !important; }
  body { background: #fff; }
}

/* ---------- Integrations (logo tiles) ---------- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .8rem; }
.int-tile { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .25rem; padding: 1.1rem .9rem .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); }
.int-tile:hover { text-decoration: none; border-color: var(--brand-500); box-shadow: 0 4px 14px rgba(0,119,182,.14); }
.int-tile.hidden { display: none; }
.int-logo { width: 64px; height: 64px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 1.05rem; letter-spacing: .3px; margin: .35rem 0 .45rem; background: #0077B6; }
.int-logo .icon { width: 30px; height: 30px; }
.int-zapsign { background: linear-gradient(135deg, #1D4ED8, #3B82F6); font-size: 1.9rem; }
.int-cnpj { background: linear-gradient(135deg, #047857, #10B981); font-size: .95rem; }
.int-viacep { background: linear-gradient(135deg, #B45309, #F59E0B); }
.int-smtp { background: linear-gradient(135deg, #0E5F78, #1C9BBB); }
.int-captcha { background: linear-gradient(135deg, #6D28D9, #A78BFA); }
.int-name { font-size: .9rem; line-height: 1.25; }
.int-scope { color: var(--text-2); display: inline-flex; align-items: center; gap: .25rem; }
.int-scope .icon { width: 13px; height: 13px; }
.int-status { position: absolute; top: .55rem; right: .55rem; font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; padding: .12rem .45rem; border-radius: 10px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.int-status.on { background: var(--success-bg); color: var(--success); border-color: transparent; }
.int-action { margin-top: .45rem; font-size: .8rem; color: var(--brand-600); display: inline-flex; align-items: center; gap: .3rem; }
.int-action .icon { width: 14px; height: 14px; }

/* ---------- Import center ---------- */
.source-logo { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 7px; color: #fff; font-weight: 800; margin-right: .45rem; vertical-align: middle; }
.source-excel { background: linear-gradient(135deg, #166534, #22C55E); }
.source-table td { vertical-align: middle; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border); padding: 0 .75rem; overflow-x: auto; }
.tabs [data-tab] { display: inline-flex; align-items: center; gap: .4rem; background: none; border: 0; border-bottom: 3px solid transparent; padding: .7rem .8rem .6rem; font: inherit; font-size: .88rem; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.tabs [data-tab] .icon { width: 15px; height: 15px; }
.tabs [data-tab]:hover { color: var(--brand-600); }
.tabs [data-tab].active { color: var(--brand-600); border-bottom-color: var(--brand-500); font-weight: 600; }
.card-footer { display: flex; justify-content: flex-end; gap: .5rem; padding: .7rem 1rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.user-header h1 { margin: 0; }
.user-header .flex { align-items: center; gap: .7rem; }
.user-cell { display: inline-flex; align-items: center; gap: .55rem; }
.user-cell .avatar { width: 30px; height: 30px; flex: 0 0 auto; }
.company-initials.sm { width: 24px; height: 24px; border-radius: 6px; font-size: .62rem; vertical-align: middle; }
.compact-table td, .compact-table th { padding: .45rem .6rem; vertical-align: middle; }
.compact-table select { padding: .3rem .45rem; font-size: .85rem; }

/* ---------- Privileges matrix ---------- */
.priv-top { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.priv-top > div:first-child { flex: 1 1 260px; }
.priv-presets { display: flex; gap: .4rem; }
.btn-danger-outline { color: var(--danger); border-color: #F5B5B5; }
.btn-danger-outline:hover { background: var(--danger-bg); }
.priv-matrix { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: .8rem; }
.priv-matrix.is-disabled { opacity: .55; }
.priv-group { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; align-self: start; }
.priv-row { display: grid; grid-template-columns: 1fr 52px 52px 52px; align-items: center; padding: .38rem .7rem; border-top: 1px solid var(--border); font-size: .86rem; }
.priv-row:hover:not(.priv-head) { background: var(--surface-2); }
.priv-head { border-top: 0; background: var(--brand-100); font-weight: 700; color: var(--brand-700); font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; }
.priv-col { text-align: center; display: flex; justify-content: center; }
.priv-head .icon { width: 15px; height: 15px; }
.priv-col input { width: 17px; height: 17px; cursor: pointer; margin: 0; }
.priv-col input.priv-view { accent-color: #0077B6; }
.priv-col input.priv-edit { accent-color: var(--success); }
.priv-col input.priv-blocked { accent-color: var(--danger); }
.priv-hint { display: inline-flex; width: 15px; height: 15px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); font-size: .65rem; align-items: center; justify-content: center; color: var(--muted); cursor: help; }

/* ---------- Notification rules modal ---------- */
dialog.modal.modal-wide { width: min(980px, 96vw); }
.rule-body { display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 1.2rem; }
.rule-h { font-size: .95rem; margin: 0 0 .6rem; color: var(--brand-700); }
.check-list { display: flex; flex-direction: column; gap: .3rem; max-height: 320px; overflow-y: auto; }
.check-all { padding-bottom: .3rem; border-bottom: 1px solid var(--border); }
.rule-events { max-height: 430px; overflow-y: auto; padding-right: .3rem; }
.event-group { border: 1px solid var(--border); border-radius: var(--radius); padding: .4rem .7rem .55rem; margin: 0 0 .6rem; display: flex; flex-direction: column; gap: .2rem; }
.event-group legend { padding: 0 .3rem; font-weight: 700; font-size: .85rem; }
.event-group .check { font-size: .85rem; }
@media (max-width: 860px) { .rule-body { grid-template-columns: 1fr; } }

/* ---------- Trainings ---------- */
.training-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .8rem; align-items: start; }
.training-card { padding: 0; }
.training-card summary { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; cursor: pointer; list-style: none; }
.training-card summary::-webkit-details-marker { display: none; }
.training-icon { width: 34px; height: 34px; border-radius: 8px; background: var(--brand-100); color: var(--brand-600); display: inline-flex; align-items: center; justify-content: center; }
.training-icon .icon { width: 18px; height: 18px; }
.training-card ol { margin: 0; padding: 0 1rem .9rem 2.6rem; font-size: .88rem; color: var(--text-2); display: flex; flex-direction: column; gap: .35rem; }
@media (max-width: 860px) { .notif-panel, .company-panel { width: min(340px, 92vw); } .company-btn { max-width: 120px; } }
.seg-toggle.seg-text label { width: auto; height: 32px; padding: 0 .8rem; font-size: .84rem; white-space: nowrap; color: var(--text-2); }
.seg-toggle.seg-text label:has(input:checked) { color: #fff; }
form.inline { display: inline-block; margin: 0; }
@media (max-width: 860px) {
  .topbar-right { gap: .3rem; }
  .topbar-right > a.icon-btn { display: none; } /* Agenda stays in the CRM menu */
  .company-btn { width: 30px; height: 30px; padding: 0; justify-content: center; border-radius: 50%; }
  .company-btn-name, .company-btn .caret { display: none; }
  .top-menu { position: static; }
  .top-menu > .dropdown { position: fixed; left: .5rem; right: .5rem; top: 54px; width: auto; max-width: none; }
  .notif-badge { top: -3px; right: -4px; }
}
.col-check { width: 60px; } .col-role { width: 190px; }
