@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@600;700;800&display=swap');

:root {
    --bg: #f5f7f6;
    --surface: #ffffff;
    --surface-2: #f9fbfa;
    --ink: #18241f;
    --muted: #74817b;
    --muted-2: #98a39e;
    --line: #e2e9e6;
    --line-strong: #d5dfdb;
    --brand: #0f1330;
    --brand-dark: #070a1f;
    --brand-soft: #e9ecf6;
    --brand-ring: rgba(15,19,48,.14);
    --brand-glow: rgba(15,19,48,.07);
    /* Barras do gráfico. Nomes por significado, não por tom: evita a confusão de
       trocar qual é qual. Matizes vizinhos (220° e 211°) para combinarem entre si. */
    --chart-oportunidades: #6aa6e8;
    --chart-vendas: #12306b;
    /* Sobre o fundo escuro do balão, o azul escuro sumiria. */
    --chart-vendas-claro: #9dc4f2;
    --navy: #172b27;
    --danger: #d34d45;
    --warning: #d9901a;
    --blue: #3478f6;
    --violet: #8155d9;
    --shadow: 0 14px 36px rgba(26, 48, 41, .07);
    --radius: 14px;
    --sidebar: 252px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; color: var(--ink); background: var(--bg); font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif; font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Loading + login */
.boot-screen { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 16px; background: #f7f9f8; color: var(--muted); }
/* A logo real, em vez de um símbolo genérico: é a primeira coisa que a clínica vê ao abrir. */
.boot-mark { width: 62px; height: 62px; display: block; border-radius: 18px; object-fit: cover; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { transform: scale(.92); box-shadow: 0 0 0 12px var(--brand-glow); } }
.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 47%) 1fr; background: #f8faf9; }
.login-aside { min-height: 100vh; padding: 48px clamp(42px,6vw,92px); display: flex; flex-direction: column; color: #fff; background: #02112d; position: relative; overflow: hidden; }
.login-aside::before, .login-aside::after { content:""; position:absolute; border-radius:50%; border:1px solid rgba(255,255,255,.08); }
.login-aside::before { width:560px; height:560px; right:-320px; top:90px; box-shadow:0 0 0 70px rgba(255,255,255,.025),0 0 0 140px rgba(255,255,255,.018); }
.login-aside::after { width:220px; height:220px; left:-120px; bottom:-90px; background:rgba(20,184,166,.08); }
.brand { min-height: 44px; display: flex; align-items: center; gap: 11px; font-family: Manrope, sans-serif; font-size: 18px; font-weight: 800; letter-spacing: -.4px; }
.brand-mark { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: var(--brand); font-size: 20px; }
.brand-mark-img { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 11px; object-fit: cover; display: block; }
.brand-light .brand-mark { background: #18a78e; }
.login-copy { margin: auto 0; max-width: 590px; position: relative; z-index: 1; }
.eyebrow { display: inline-block; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.eyebrow.light { color: #00e3fb; font-size: 18px; font-weight: 500; letter-spacing: 0; }
.brand-logo { max-width: 200px; height: auto; display: block; }
.login-copy h1 { margin: 22px 0 22px; max-width: 610px; font: 800 clamp(42px,5vw,66px)/1.02 Manrope,sans-serif; letter-spacing: -3.2px; }
.login-copy > p { max-width: 510px; color: #b6c5c0; font-size: 18px; line-height: 1.65; }
.login-proof { margin-top: 48px; display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; }
.login-proof div { display: grid; gap: 4px; }
.login-proof strong { font: 700 15px Manrope,sans-serif; }
.login-proof span { color: #8ca09a; font-size: 12px; }
.login-foot { margin: 0; color: #799089; font-size: 12px; position: relative; z-index: 1; }
.login-form-wrap { display: grid; place-items: center; padding: 42px; }
.login-card { width: min(100%, 420px); }
.login-card h2 { margin: 10px 0 8px; font: 800 34px/1.15 Manrope,sans-serif; letter-spacing: -1.5px; }
.login-card > p { margin: 0 0 34px; color: var(--muted); line-height: 1.6; }
.login-card label, .field { display: grid; gap: 8px; margin: 0 0 17px; color: #42514a; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 10px; outline: 0; background: var(--surface); color: var(--ink); transition: border .15s, box-shadow .15s; }
input, select { min-height: 42px; padding: 9px 12px; }
textarea { min-height: 92px; padding: 12px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
input::placeholder, textarea::placeholder { color: #a6b0ab; }
.password-field { position: relative; }
.password-field input { padding-right: 66px; }
.show-password { position: absolute; right: 7px; top: 7px; border: 0; background: transparent; color: var(--brand); font-size: 12px; font-weight: 700; cursor: pointer; }
.form-error { margin: 4px 0 16px; padding: 11px 13px; border: 1px solid #f3c5c1; border-radius: 9px; background: #fff3f2; color: #a63d36; font-size: 13px; }
.form-error.success { border-color:#bfe4d7; color:#0b715f; background:#effbf7; }
.login-help { text-align: center; font-size: 12px; margin-top: 22px !important; }
.auth-text-link { width:100%; margin-top:13px; border:0; color:var(--brand); background:transparent; text-align:center; text-decoration:none; font-size:12px; font-weight:700; cursor:pointer; }
.standalone-auth { min-height:100vh; padding:32px; display:grid; place-items:center; background:linear-gradient(135deg,var(--brand-soft),var(--bg)); }
.standalone-auth .login-card { padding:30px; border:1px solid var(--line); border-radius:17px; background:var(--surface); box-shadow:var(--shadow); }
.standalone-auth .brand { margin-bottom:28px; }
.standalone-auth .btn { text-decoration:none; }
.success-mark { width:54px; height:54px; margin:20px auto; display:grid; place-items:center; border-radius:50%; color:#fff; background:var(--brand); font-size:26px; }
.mobile-brand { display: none; }

/* Application shell */
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: var(--sidebar); padding: 22px 16px 16px; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #fbfcfc; }
.sidebar > .brand { padding: 0 9px; }
.nav { margin-top: 28px; display: grid; gap: 3px; }
.nav-label { margin: 20px 12px 8px; color: #a1aaa6; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.nav-label:first-child { margin-top: 0; }
.nav-item { width: 100%; min-height: 43px; padding: 0 12px; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 9px; color: #5f6c66; background: transparent; text-align: left; font-size: 13px; font-weight: 600; cursor: pointer; transition: .15s ease; }
.nav-item:hover { color: var(--ink); background: #f1f5f3; }
.nav-item.active { color: var(--brand-dark); background: var(--brand-soft); font-weight: 700; }
.nav-icon { width: 19px; color: #7d8b85; text-align: center; font-size: 18px; line-height: 1; }
.nav-item.active .nav-icon { color: var(--brand); }
.nav-count { margin-left: auto; padding: 2px 7px; border-radius: 99px; color: var(--brand); background: #d7efe9; font-size: 10px; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 8px; }
.workspace-card { padding: 10px; display: grid; grid-template-columns: 34px 1fr auto; gap: 9px; align-items: center; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.workspace-avatar, .user-avatar { display: grid; place-items: center; border-radius: 9px; color: var(--brand-dark); background: var(--brand-soft); font-weight: 800; }
.workspace-avatar { width: 34px; height: 34px; font-size: 11px; }
.workspace-card div { min-width: 0; display: grid; gap: 2px; }
.workspace-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.workspace-card span { color: var(--muted); font-size: 9px; }
.logout-button { padding: 7px 10px; display: flex; justify-content: space-between; border: 0; color: #89938f; background: transparent; font-size: 11px; cursor: pointer; }
.main-area { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { height: 84px; padding: 0 clamp(22px,3vw,42px); display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.78); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20; }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar h1 { margin: 0; font: 800 20px Manrope,sans-serif; letter-spacing: -.5px; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.topbar-actions { display: flex; align-items: center; gap: 11px; position:relative; }
.global-search { width: 218px; height: 39px; padding: 0 11px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.global-search span { color: var(--muted); font-size: 19px; }
.global-search input { min-height: auto; padding: 0; border: 0; box-shadow: none; background: transparent; font-size: 12px; }
.icon-button { width: 39px; height: 39px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; }
.notification-button { position:relative; }
.bell-icon { position:relative; width:18px; height:18px; display:block; }
.bell-icon::before { content:''; position:absolute; left:3px; top:2px; width:10px; height:11px; border:2px solid currentColor; border-radius:8px 8px 4px 4px; }
.bell-icon::after { content:''; position:absolute; left:7px; bottom:0; width:5px; height:2px; border-radius:0 0 5px 5px; background:currentColor; box-shadow:-5px -3px 0 -1px currentColor,5px -3px 0 -1px currentColor; }
.notification-dot { position:absolute; right:6px; top:6px; width:7px; height:7px; border:2px solid var(--surface); border-radius:50%; background:#e4774f; }
.notification-menu { position:absolute; z-index:61; right:174px; top:53px; width:340px; overflow:hidden; border:1px solid var(--line); border-radius:14px; background:var(--surface); box-shadow:0 20px 55px rgba(20,40,33,.18); }
.notification-menu header { min-height:58px; padding:0 13px 0 16px; display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid var(--line); }
.notification-menu header div { display:grid; gap:2px; }
.notification-menu header strong { font:800 12px Manrope,sans-serif; }
.notification-menu header span { color:var(--muted); font-size:8px; }
.notification-menu header button { width:29px; height:29px; border:0; border-radius:8px; color:var(--muted); background:var(--surface-2); font-size:17px; cursor:pointer; }
.notification-list { max-height:360px; padding:7px; display:grid; gap:4px; overflow:auto; }
.notification-list > p { margin:0; padding:22px 14px; color:var(--muted); text-align:center; font-size:10px; }
.notification-item { width:100%; padding:11px; display:grid; grid-template-columns:34px 1fr auto; gap:10px; align-items:center; border:0; border-radius:10px; color:var(--ink); background:transparent; text-align:left; cursor:pointer; }
.notification-item:hover { background:var(--surface-2); }
.notification-item-icon { width:34px; height:34px; display:grid; place-items:center; border-radius:10px; color:var(--brand-dark); background:var(--brand-soft); font-size:17px; font-weight:900; }
.notification-item-copy { min-width:0; display:grid; gap:3px; }
.notification-item-copy strong { font-size:10px; }
.notification-item-copy span { color:var(--muted); font-size:8px; line-height:1.4; }
.notification-item-arrow { color:var(--muted); font-size:16px; }
.user-menu { margin-left:4px; padding:3px 5px 3px 3px; display:flex; align-items:center; gap:9px; border:0; border-radius:10px; background:transparent; text-align:left; cursor:pointer; }
.user-menu:hover { background:var(--surface-2); }
.user-avatar { width: 37px; height: 37px; font-size: 11px; }
.user-avatar img,.lead-avatar img,.profile-avatar img { width:100%; height:100%; border-radius:inherit; object-fit:cover; }
.user-menu div { display: grid; gap: 1px; }
.user-menu strong { font-size: 11px; }
.user-menu span { color: var(--muted); font-size: 9px; }
.user-menu .user-chevron { padding:0 3px; font-size:13px; }
.account-menu { position:absolute; z-index:60; right:0; top:53px; width:190px; padding:6px; display:grid; border:1px solid var(--line); border-radius:11px; background:var(--surface); box-shadow:0 16px 42px rgba(20,40,33,.15); }
.account-menu button { min-height:38px; padding:0 11px; border:0; border-radius:7px; background:transparent; text-align:left; font-size:11px; font-weight:700; cursor:pointer; }
.account-menu button:hover { background:var(--brand-soft); }
.account-menu button:last-child { color:#a74640; }
.content { padding: 28px clamp(20px,3vw,42px) 54px; }
.mobile-menu, .mobile-close { display: none; }

/* Common components */
.page-toolbar { margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.toolbar-copy h2 { margin: 0; font: 800 24px Manrope,sans-serif; letter-spacing: -.8px; }
.toolbar-copy p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.toolbar-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.date-range { padding: 4px; display: flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.date-range button { min-height: 32px; padding: 0 11px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 700; cursor: pointer; }
.date-range button.active { color: var(--brand-dark); background: var(--brand-soft); }
.level-toggle { margin: 14px 0; padding: 4px; display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.level-toggle button { min-height: 32px; padding: 0 16px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; cursor: pointer; }
.level-toggle button.active { color: var(--brand-dark); background: var(--brand-soft); }
.btn { min-height: 40px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; font-size: 12px; font-weight: 700; cursor: pointer; transition: .15s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26,48,41,.07); }
.btn:disabled { opacity: .55; cursor: wait; transform: none; }
.btn-primary { border-color: var(--brand); color: #fff; background: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-soft { border-color: #d5ebe5; color: var(--brand-dark); background: var(--brand-soft); }
.btn-danger { border-color: #f0cac6; color: #b84640; background: #fff5f4; }
.btn-lg { width: 100%; min-height: 48px; justify-content: space-between; padding: 0 18px; border-radius: 11px; font-size: 13px; }
.btn-sm { min-height: 33px; padding: 0 10px; font-size: 11px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 1px rgba(20,40,33,.02); }
.card-header { min-height: 58px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.card-header h3 { margin: 0; font: 700 13px Manrope,sans-serif; }
.card-header p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.card-body { padding: 18px; }
.kpi-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 12px; }
.kpi-card { min-width: 0; padding: 17px; position: relative; overflow: hidden; }
.kpi-card::after { content:""; position:absolute; width:64px; height:64px; right:-25px; top:-28px; border-radius:50%; background:var(--brand-soft); opacity:.7; }
.kpi-with-gauge { display: flex !important; align-items: center !important; justify-content: space-between !important; gap: 20px; padding: 18px 20px !important; flex-direction: row !important; }
.kpi-with-gauge::after { display: none !important; }
.kpi-left { flex: 0 1 auto; display: flex; flex-direction: column; gap: 4px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-meta { font-size: 12px; color: var(--muted); margin-top: 6px; font-weight: 500; }
.kpi-gauge { flex-shrink: 0; width: clamp(95px, 15vw, 130px); height: auto; min-width: clamp(95px, 15vw, 130px); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.kpi-icon { width:34px; height:34px; display:grid; place-items:center; border-radius:10px; color:var(--brand); background:var(--brand-soft); font-size:18px; font-weight:900; line-height:1; }
.kpi-value { margin-top: 13px; font: 800 24px Manrope,sans-serif; letter-spacing: -.8px; }
.kpi-foot { margin-top: 6px; display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 9px; }
.trend-up { color: #0a8b70; font-weight: 800; }
.trend-down { color: var(--danger); font-weight: 800; }
.dashboard-grid { margin-top: 14px; display: grid; grid-template-columns: 1fr; gap: 14px; }
.chart-grid { margin-top: 14px; display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; }
.chart-wrap { height: 238px; padding: 10px 8px 2px; position: relative; }
.chart-wrap canvas { width: 100%; height: 100%; }
.funnel-boxes-wrapper { padding-bottom: 8px; }
.funnel-boxes-grid { display: flex; align-items: center; gap: clamp(8px, 2vw, 16px); flex-wrap: nowrap; }
.funnel-conversion { font-size: clamp(10px, 1.5vw, 12px); font-weight: 700; color: var(--brand); display: flex; flex-direction: column; align-items: center; gap: 3px; flex-shrink: 0; }
.funnel-conversion::before { content: "→"; font-size: clamp(12px, 1.8vw, 16px); }
.funnel-box { display: flex; align-items: center; justify-content: space-between; gap: clamp(8px, 1.5vw, 12px); padding: clamp(14px, 2vw, 18px) clamp(12px, 1.5vw, 16px); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); flex: 1; min-width: 0; }
.funnel-box.success { background: var(--brand-soft); border-color: var(--brand); }
.funnel-box-left { display: flex; flex-direction: column; gap: 4px; }
.funnel-box-label { font-size: clamp(9px, 1.2vw, 11px); color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.funnel-box-number { font: 800 clamp(26px, 4vw, 36px) Manrope, sans-serif; letter-spacing: -.6px; color: var(--ink); }
.funnel-box-meta { font-size: clamp(8px, 1vw, 10px); color: var(--muted); }
.funnel-box-right { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.chart-legend { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 10px; }
.legend-dot { width: 7px; height: 7px; display: inline-block; margin-right: 5px; border-radius: 50%; background: var(--chart-oportunidades); }
.legend-dot.spend { background: var(--chart-vendas); }
.funnel-list { display: grid; gap: 13px; }
.funnel-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px; }
.funnel-title { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; }
.stage-dot { width: 7px; height: 7px; border-radius: 50%; }
.funnel-count { font: 700 11px Manrope,sans-serif; }
.funnel-bar { height: 5px; grid-column: 1/-1; border-radius: 99px; background: #edf1ef; overflow: hidden; }

.pipeline-list { display: grid; gap: 10px; }
.pipeline-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid #f0f5f2; }
.pipeline-row:last-child { border-bottom: none; }
.pipeline-stage { display: flex; align-items: center; gap: 10px; flex: 1; }
.pipeline-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.pipeline-count { font: 700 14px Manrope, sans-serif; color: var(--brand); white-space: nowrap; }
.funnel-bar span { height: 100%; display: block; border-radius: inherit; }
.bottom-grid { margin-top: 14px; display: grid; grid-template-columns: minmax(0,1.45fr) minmax(300px,.75fr); gap: 14px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 14px; border-bottom: 1px solid var(--line); color: #8c9892; background: #fbfcfc; font-size: 9px; font-weight: 800; letter-spacing: .06em; text-align: left; white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid #edf1ef; color: #4c5b54; font-size: 11px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdfc; }
.cell-main { display: grid; gap: 2px; }
.cell-main strong { color: var(--ink); font-size: 11px; }
.cell-main span { color: var(--muted); font-size: 9px; }
.status-pill, .source-pill { width: fit-content; padding: 4px 8px; border-radius: 99px; font-size: 9px; font-weight: 700; }
.status-pill { color: var(--brand-dark); background: var(--brand-soft); }
.source-pill { color: #56635d; background: #eff2f1; }
.avatar-stack { display: flex; align-items: center; }
.mini-avatar { width: 25px; height: 25px; display: grid; place-items:center; border:2px solid #fff; border-radius:50%; color:var(--brand-dark); background:var(--brand-soft); font-size:8px; font-weight:800; }
.upcoming-list { display: grid; }
.appointment-row { padding: 13px 18px; display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 11px; border-bottom: 1px solid #edf1ef; }
.appointment-row:last-child { border-bottom: 0; }
.appointment-date { width: 42px; height: 42px; display: grid; place-content: center; justify-items: center; border-radius: 9px; color: var(--brand-dark); background: var(--brand-soft); }
.appointment-date strong { font: 800 14px Manrope,sans-serif; }
.appointment-date span { font-size: 8px; text-transform: uppercase; }
.appointment-info { min-width: 0; display: grid; gap: 3px; }
.appointment-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.appointment-info span { color: var(--muted); font-size: 9px; }
.empty-state { min-height: 180px; padding: 28px; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--muted); }
.empty-icon { width: 44px; height: 44px; display: grid; place-items: center; margin-bottom: 10px; border-radius: 13px; color: var(--brand); background: var(--brand-soft); font-size: 21px; }
.empty-state strong { color: var(--ink); }
.empty-state p { max-width: 320px; margin: 6px 0 15px; font-size: 11px; line-height: 1.5; }

/* Filters, lists, Kanban */
.filter-bar { padding: 12px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.filter-search { width: min(290px,100%); display: flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; }
.filter-search input { min-height: 36px; padding: 0; border: 0; box-shadow: none; font-size: 11px; }
.filter-bar select { width: auto; min-width: 135px; min-height: 36px; padding: 0 28px 0 10px; border-color: var(--line); font-size: 10px; }
.filter-count { margin-left: auto; color: var(--muted); font-size: 10px; }
.kanban { margin-top: 14px; padding-bottom: 4px; display: flex; align-items: stretch; gap: 12px; overflow-x: auto; overflow-y: hidden; }
.kanban-column { flex: 0 0 272px; min-width: 272px; padding: 11px; border: 1px solid var(--line); border-radius: 13px; background: #f0f3f2; display: flex; flex-direction: column; min-height: 0; }
.kanban-column.drag-over { border-color: var(--brand); background: #eaf5f1; }
.kanban-head { margin-bottom: 10px; padding: 2px 3px 7px; display: flex; align-items: center; gap: 8px; }
.kanban-head strong { font-size: 11px; }
.kanban-head .count { margin-left: auto; min-width: 20px; padding: 2px 6px; border-radius: 99px; color: var(--muted); background: #fff; font-size: 9px; text-align: center; }
.kanban-value { color: var(--muted); font-size: 8px; }
.kanban-cards { min-height: 90px; display: grid; gap: 8px; align-content: start; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; flex: 1 1 auto; }
.kanban-cards::-webkit-scrollbar { width: 6px; }
.kanban-cards::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }
.kanban-cards::-webkit-scrollbar-track { background: transparent; }
.kanban::-webkit-scrollbar { height: 10px; }
.kanban::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }
.kanban::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }
.kanban::-webkit-scrollbar-track { background: transparent; }
.lead-card { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: grab; transition: .2s; display: flex; flex-direction: column; gap: 10px; }
.lead-card:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: 0 8px 20px rgba(2,132,122,.08); }
.lead-card.dragging { opacity: 0.5; }
.lead-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.lead-card h4 { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink); }
.lead-card-phone { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.lead-card-badge { display: flex; align-items: center; justify-content: center; min-width: 60px; max-width: 140px; padding: 6px 8px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-dark); font-size: 10px; font-weight: 600; line-height: 1.3; text-align: center; word-wrap: break-word; }
.lead-card-status { display: flex; flex-direction: column; gap: 6px; }
.status-tag { display: inline-flex; padding: 4px 8px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-dark); font-size: 11px; font-weight: 600; width: fit-content; }
.last-contact { color: var(--muted); font-size: 10px; }
.no-contact { color: var(--danger); font-size: 10px; font-weight: 600; }
.lead-card-action { display: flex; gap: 8px; }
.btn-action-executed { flex: 1; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--ink); font-size: 11px; font-weight: 600; cursor: pointer; transition: .15s; }
.btn-action-executed:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.lead-card-info { font-size: 10px; color: var(--ink); }
.lead-card-info .info-label { font-weight: 600; color: var(--muted); }
.lead-card-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 8px; border-top: 1px solid var(--line); }
.lead-origin { color: var(--muted); font-size: 10px; }
select { appearance: none; -webkit-appearance: none; -moz-appearance: none; cursor: pointer; }
select::-ms-expand { display: none; }
.lead-avatar-mini { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-dark); font-size: 9px; font-weight: 700; }
.table-card { margin-top: 14px; overflow: hidden; }
.clickable-row { cursor: pointer; }
.lead-name-cell { display:flex; align-items:center; gap:9px; }
.lead-avatar { width:29px; height:29px; display:grid; place-items:center; border-radius:9px; color:var(--brand-dark); background:var(--brand-soft); font-size:9px; font-weight:800; }
.stage-badge { display:inline-flex; align-items:center; gap:6px; font-size:9px; font-weight:700; }
.value-cell { color:var(--ink); font-weight:700; }

/* Agenda */
.agenda-layout { margin-top: 14px; display:grid; grid-template-columns:minmax(0,1fr) 320px; gap:14px; }
.agenda-days { display:grid; grid-template-columns:repeat(7,1fr); border-bottom:1px solid var(--line); }
.agenda-day-label { padding:12px 8px; color:var(--muted); background:#fbfcfc; font-size:9px; font-weight:800; text-align:center; }
.calendar-grid { display:grid; grid-template-columns:repeat(7,1fr); }
.calendar-day { min-height:116px; padding:8px; border-right:1px solid var(--line); border-bottom:1px solid var(--line); background:#fff; }
.calendar-day:nth-child(7n) { border-right:0; }
.calendar-day.muted { background:#fafbfb; color:#b7bfbb; }
.calendar-day.today { background:#f5fbf9; }
.calendar-number { width:24px; height:24px; display:grid; place-items:center; border-radius:7px; font-size:10px; font-weight:700; }
.today .calendar-number { color:#fff; background:var(--brand); }
.calendar-event { margin-top:5px; padding:5px 6px; overflow:hidden; border-left:2px solid var(--brand); border-radius:4px; color:#386158; background:var(--brand-soft); font-size:8px; text-overflow:ellipsis; white-space:nowrap; cursor:pointer; }
.calendar-event.cancelled { border-color:#9ba5a0; color:#7d8782; background:#f0f2f1; text-decoration:line-through; }
.agenda-side .appointment-row { grid-template-columns:42px 1fr; }
.agenda-side .appointment-row > .status-pill { grid-column:2; }

/* Settings, forms and entities */
.settings-layout { display:grid; grid-template-columns:210px minmax(0,740px); gap:20px; align-items:start; }
.settings-nav { padding:7px; display:grid; gap:3px; }
.settings-nav button { padding:10px 11px; border:0; border-radius:8px; color:var(--muted); background:transparent; text-align:left; font-size:11px; font-weight:700; cursor:pointer; }
.settings-nav button.active { color:var(--brand-dark); background:var(--brand-soft); }
.settings-card { padding:24px; }
.settings-card h3 { margin:0 0 7px; font:800 18px Manrope,sans-serif; }
.settings-card > p { margin:0 0 24px; color:var(--muted); font-size:11px; line-height:1.55; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.form-grid > .full { grid-column:1/-1; }
.field { margin:0; }
.field.full { grid-column:1/-1; }
.field small { color:var(--muted); font-size:9px; font-weight:400; line-height:1.4; }
.field .secret-status { color:var(--brand); font-weight:700; }
.field.demo { display:flex; grid-column:1/-1; flex-direction:row; align-items:center; gap:8px; }
.field.demo input { width:auto; min-height:auto; }
.form-actions { margin-top:20px; padding-top:18px; display:flex; justify-content:flex-end; align-items:center; gap:8px; border-top:1px solid var(--line); }
.save-status { margin-right:auto; color:var(--muted); font-size:9px; }
.info-box { margin:18px 0; padding:13px 15px; border:1px solid #cee9e1; border-radius:10px; color:#41645b; background:#eff9f6; font-size:10px; line-height:1.55; }
.backup-intro { margin:18px 0; padding:16px; display:grid; grid-template-columns:46px 1fr; gap:13px; align-items:center; border:1px solid var(--line); border-radius:12px; background:var(--surface-2); }
.backup-intro-icon { width:50px; height:50px; display:grid; place-items:center; border-radius:14px; color:#fff; background:linear-gradient(135deg,var(--brand),var(--brand-dark)); font:800 29px/1 Manrope,sans-serif; }
.backup-intro strong { display:block; margin-bottom:4px; font:800 12px Manrope,sans-serif; }
.backup-intro span { color:var(--muted); font-size:9px; line-height:1.5; }
.backup-contents { margin:16px 0; display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.backup-contents span { min-height:38px; padding:9px 11px; display:flex; align-items:center; gap:8px; border:1px solid var(--line); border-radius:9px; color:var(--ink); background:var(--surface); font-size:9px; font-weight:700; }
.backup-contents span::before { content:'✓'; width:18px; height:18px; display:grid; place-items:center; flex:0 0 auto; border-radius:50%; color:var(--brand-dark); background:var(--brand-soft); font-size:9px; }
.entity-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.entity-card { padding:16px; }
.entity-head { display:flex; align-items:center; gap:10px; }
.entity-head .lead-avatar { width:36px; height:36px; }
.entity-head div { min-width:0; display:grid; gap:2px; }
.entity-head strong { overflow:hidden; text-overflow:ellipsis; font-size:11px; }
.entity-head span { overflow:hidden; text-overflow:ellipsis; color:var(--muted); font-size:9px; }
.entity-meta { margin-top:14px; padding-top:12px; display:flex; justify-content:space-between; border-top:1px solid var(--line); color:var(--muted); font-size:9px; }

/* Modal + Drawer */
.modal-backdrop, .drawer-backdrop { position:fixed; inset:0; z-index:70; background:rgba(15,30,25,.38); backdrop-filter:blur(2px); }
.modal-backdrop { padding:20px; display:grid; place-items:center; }
.modal { width:min(100%,620px); max-height:calc(100vh - 40px); overflow:auto; border-radius:17px; background:#fff; box-shadow:0 24px 70px rgba(11,30,24,.22); animation:modalIn .16s ease-out; }
@keyframes modalIn { from { opacity:0; transform:translateY(8px) scale(.98); } }
.modal-header { min-height:65px; padding:0 21px; display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid var(--line); }
.modal-header h2 { margin:0; font:800 17px Manrope,sans-serif; }
.modal-header .modal-close,.drawer-head .modal-close { width:31px; height:31px; flex:0 0 31px; padding:0; display:grid; place-items:center; border:0; border-radius:8px; color:var(--muted); background:#f2f5f4; font-size:20px; line-height:1; cursor:pointer; }
.modal-body { padding:21px; }
.modal-footer { padding:15px 21px; display:flex; justify-content:flex-end; align-items:center; gap:8px; border-top:1px solid var(--line); background:#fbfcfc; }
.modal-footer .modal-close { width:auto; height:auto; flex:0 0 auto; }
.drawer-backdrop { z-index:75; }
.drawer { position:fixed; z-index:80; inset:0 0 0 auto; width:min(100%,480px); padding:0; overflow:auto; border-left:1px solid var(--line); background:#fff; box-shadow:-18px 0 50px rgba(20,40,33,.12); transform:translateX(102%); transition:transform .24s ease; }
.drawer.open { transform:translateX(0); }
.drawer-head { min-height:72px; padding:0 22px; display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid var(--line); position:sticky; top:0; z-index:2; background:rgba(255,255,255,.94); backdrop-filter:blur(10px); }
.drawer-head h2 { margin:0; font:800 17px Manrope,sans-serif; }
.drawer-body { padding:22px; }
.lead-hero { display:flex; gap:13px; align-items:center; }
.lead-hero .lead-avatar { width:46px; height:46px; border-radius:13px; font-size:12px; }
.lead-hero div { display:grid; gap:4px; }
.lead-hero h3 { margin:0; font:800 17px Manrope,sans-serif; }
.lead-hero span { color:var(--muted); font-size:10px; }
.lead-quick-actions { margin:18px 0; display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.lead-quick-actions a, .lead-quick-actions button { min-height:40px; display:flex; align-items:center; justify-content:center; gap:5px; border:1px solid var(--line); border-radius:9px; color:var(--ink); background:#fff; text-decoration:none; font-size:10px; font-weight:700; cursor:pointer; }
.drawer-section { margin-top:22px; }
.drawer-section-title { margin-bottom:10px; display:flex; align-items:center; justify-content:space-between; color:var(--muted); font-size:9px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:9px; }
.detail-item { padding:10px; border-radius:9px; background:#f6f8f7; border:1px solid transparent; }
.detail-item span { display:block; margin-bottom:4px; color:var(--muted); font-size:8px; }
.detail-item strong { font-size:10px; font-weight:700; }
.detail-item.editable { position:relative; cursor:pointer; border:1px dashed var(--line-strong); padding-right:26px; transition:background .15s ease, border-color .15s ease; }
.detail-item.editable:hover { background:var(--brand-soft); border-color:var(--brand); border-style:solid; }
.detail-item.editable:focus-visible { outline:2px solid var(--brand); outline-offset:1px; }
.detail-item.editable strong.is-empty { color:var(--brand); font-weight:600; }
.detail-edit-icon { position:absolute; top:9px; right:9px; color:var(--muted-2); font-size:10px; font-style:normal; line-height:1; transition:color .15s ease; }
.detail-item.editable:hover .detail-edit-icon { color:var(--brand); }
.note-form { display:flex; gap:8px; }
.note-form textarea { min-height:68px; }
.note-list, .activity-list { display:grid; gap:9px; }
.note { padding:11px; border:1px solid var(--line); border-radius:9px; background:#fbfcfc; }
.note p { margin:0 0 8px; color:#43524b; font-size:10px; line-height:1.5; white-space:pre-wrap; }
.note span { color:var(--muted); font-size:8px; }
.activity { padding-left:16px; position:relative; color:#53615b; font-size:10px; }
.activity::before { content:""; position:absolute; left:2px; top:5px; width:6px; height:6px; border-radius:50%; background:#8dcabd; box-shadow:0 0 0 3px #edf7f4; }
.activity span { display:block; margin-top:2px; color:var(--muted); font-size:8px; }
.toast-region { position:fixed; z-index:100; right:20px; bottom:20px; display:grid; gap:8px; }
.toast { min-width:250px; max-width:360px; padding:12px 14px; display:flex; align-items:center; gap:9px; border:1px solid #cde4de; border-radius:10px; color:#31564d; background:#f5fffb; box-shadow:var(--shadow); font-size:11px; animation:toastIn .2s ease-out; }
.toast.error { border-color:#f0cac6; color:#9e403a; background:#fff6f5; }
@keyframes toastIn { from { opacity:0; transform:translateY(8px); } }
.skeleton { min-height:12px; border-radius:6px; background:linear-gradient(90deg,#edf1ef 25%,#f7f9f8 37%,#edf1ef 63%); background-size:400% 100%; animation:shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position:-100% 0; } }

/* API hub */
.integration-hero { margin-bottom:16px; padding:22px 24px; display:flex; align-items:center; justify-content:space-between; gap:22px; overflow:hidden; position:relative; color:#eafff8; border:0; background:linear-gradient(125deg,var(--navy),#104f45); }
.integration-hero::after { content:""; position:absolute; width:260px; height:260px; right:-90px; top:-145px; border:1px solid rgba(128,240,209,.18); border-radius:50%; box-shadow:0 0 0 45px rgba(128,240,209,.04),0 0 0 90px rgba(128,240,209,.025); }
.integration-hero h2 { margin:0 0 7px; font:800 22px Manrope,sans-serif; letter-spacing:-.7px; }
.integration-hero p { max-width:610px; margin:0; color:#b8d2ca; font-size:11px; line-height:1.55; }
.integration-hero-badge { min-width:108px; padding:10px 13px; border:1px solid rgba(255,255,255,.14); border-radius:11px; background:rgba(255,255,255,.07); text-align:center; position:relative; z-index:1; }
.integration-hero-badge strong { display:block; font:800 18px Manrope,sans-serif; }
.integration-hero-badge span { color:#a9c8be; font-size:8px; text-transform:uppercase; letter-spacing:.08em; }
.integration-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:13px; }
.integration-card { min-height:205px; padding:18px; display:flex; flex-direction:column; position:relative; overflow:hidden; }
.integration-card::after { content:""; position:absolute; width:74px; height:74px; right:-28px; top:-29px; border-radius:50%; background:var(--brand-soft); opacity:.62; }
.integration-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.integration-logo { width:42px; height:42px; display:grid; place-items:center; border-radius:12px; color:#fff; background:var(--brand); font:800 15px Manrope,sans-serif; }
.integration-logo.google { color:#3569c8; background:#eef4ff; }
.integration-logo.whatsapp { background:#1eab62; }
.integration-logo.instagram { background:linear-gradient(135deg,#6f47d8,#d84f80,#ef9d3c); }
.integration-logo.meta { background:#3478f6; }
.integration-logo.claude { background:#da7756; }
.connection-status { display:inline-flex; align-items:center; gap:5px; padding:4px 8px; border-radius:99px; color:#728079; background:#eef2f0; font-size:8px; font-weight:800; }
.connection-status::before { content:""; width:5px; height:5px; border-radius:50%; background:#9aa49f; }
.connection-status.connected { color:#08735f; background:#e5f6f0; }
.connection-status.connected::before { background:#11a881; box-shadow:0 0 0 3px rgba(17,168,129,.12); }
.connection-status.error { color:#a4463f; background:#fff0ef; }
.connection-status.error::before { background:#d34d45; }
.integration-card h3 { margin:15px 0 5px; font:800 14px Manrope,sans-serif; }
.integration-card > p { margin:0; color:var(--muted); font-size:10px; line-height:1.5; }
.integration-account { margin-top:8px; color:var(--brand); font-size:9px; font-weight:700; }
.integration-error { margin-top:8px; display:-webkit-box; overflow:hidden; color:#a4463f; font-size:8px; line-height:1.45; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.integration-actions { margin-top:auto; padding-top:15px; display:flex; gap:7px; }
.integration-actions .btn { flex:1; }
.integration-actions .btn { min-width:0; padding-inline:9px; }
.integration-steps { margin-bottom:2px; padding:14px 15px; border:1px solid #ded5f3; border-radius:11px; background:#faf8ff; color:#4b425d; font-size:10px; line-height:1.55; }
.integration-steps > strong { display:block; margin-bottom:7px; color:#6041a0; font:800 12px Manrope,sans-serif; }
.integration-steps ol { margin:0; padding-left:18px; }
.integration-steps a { color:var(--brand); font-weight:800; }
.webhook-box { padding:11px; display:flex; align-items:center; gap:9px; border:1px dashed var(--line-strong); border-radius:9px; background:var(--surface-2); }
.webhook-box code { flex:1; min-width:0; overflow:hidden; color:var(--muted); font-size:9px; text-overflow:ellipsis; white-space:nowrap; }

/* Unified inbox */
.inbox-shell { height:calc(100vh - 142px); min-height:560px; display:grid; grid-template-columns:292px minmax(380px,1fr) 270px; overflow:hidden; }
.inbox-sidebar,.inbox-chat { border-right:1px solid var(--line); }
.inbox-sidebar { min-width:0; display:flex; flex-direction:column; }
.inbox-search { margin:13px; }
.conversation-list { min-height:0; overflow:auto; }
.conversation-item { width:100%; padding:13px; display:grid; grid-template-columns:38px 1fr auto; gap:9px; align-items:center; border:0; border-bottom:1px solid #edf1ef; background:transparent; text-align:left; cursor:pointer; }
.conversation-item:hover,.conversation-item.active { background:var(--brand-soft); }
.channel-avatar { width:38px; height:38px; display:grid; place-items:center; border-radius:12px; color:#fff; background:#1eab62; font-size:11px; font-weight:800; }
.channel-avatar.instagram { background:linear-gradient(135deg,#6f47d8,#d84f80,#ef9d3c); }
.conversation-copy { min-width:0; display:grid; gap:3px; }
.conversation-copy strong,.conversation-copy span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.conversation-copy strong { font-size:10px; }
.conversation-copy span { color:var(--muted); font-size:8px; }
.conversation-time { align-self:start; color:var(--muted); font-size:7px; }
.unread-badge { min-width:17px; height:17px; display:grid; place-items:center; margin-left:auto; border-radius:99px; color:#fff; background:var(--brand); font-size:7px; font-weight:800; }
.inbox-chat { min-width:0; display:flex; flex-direction:column; background:var(--surface-2); }
.chat-header { min-height:62px; padding:0 17px; display:flex; align-items:center; justify-content:space-between; gap:12px; border-bottom:1px solid var(--line); background:var(--surface); }
.chat-person { display:flex; align-items:center; gap:9px; }
.chat-person div { display:grid; gap:2px; }
.chat-person strong { font-size:11px; }
.chat-person span { color:var(--muted); font-size:8px; }
.message-list { flex:1; min-height:0; padding:20px; display:flex; flex-direction:column; gap:9px; overflow:auto; }
.message { max-width:min(76%,520px); padding:10px 12px; border:1px solid var(--line); border-radius:5px 13px 13px 13px; background:var(--surface); box-shadow:0 2px 7px rgba(20,40,33,.03); }
.message.outbound { align-self:flex-end; border-color:#cfe9e1; border-radius:13px 5px 13px 13px; background:var(--brand-soft); }
.message p { margin:0; color:#35443e; font-size:10px; line-height:1.5; white-space:pre-wrap; }
.message span { display:block; margin-top:5px; color:var(--muted); font-size:7px; text-align:right; }
.chat-composer { padding:12px; display:grid; grid-template-columns:auto 1fr auto; gap:8px; align-items:end; border-top:1px solid var(--line); background:var(--surface); }
.chat-composer textarea { min-height:42px; max-height:110px; }
.ai-suggest-button { width:42px; height:42px; display:grid; place-items:center; border:1px solid #d8d1f0; border-radius:10px; color:#6946b2; background:#f4f0ff; cursor:pointer; }
.contact-panel { padding:17px; overflow:auto; background:var(--surface); }
.contact-panel h3 { margin:0 0 14px; font:800 13px Manrope,sans-serif; }
.contact-hero { display:grid; justify-items:center; gap:7px; padding:8px 0 20px; text-align:center; }
.contact-hero .lead-avatar { width:52px; height:52px; border-radius:16px; font-size:13px; }
.contact-hero strong { font-size:12px; }
.contact-hero span { color:var(--muted); font-size:9px; }
.ai-panel { margin-top:15px; padding:13px; border:1px solid #ded5f3; border-radius:11px; background:#faf8ff; }
.ai-panel-head { display:flex; align-items:center; gap:7px; color:#6041a0; font-size:9px; font-weight:800; text-transform:uppercase; letter-spacing:.06em; }
.ai-result { margin-top:10px; color:#493f59; font-size:9px; line-height:1.6; white-space:pre-wrap; }
.ai-lead-card { padding:14px; border:1px solid #ded5f3; border-radius:11px; background:linear-gradient(135deg,#faf8ff,#f5fbf9); }
.ai-lead-card .btn { margin-top:10px; }
.ai-lead-result { margin-top:11px; color:#4c4656; font-size:10px; line-height:1.6; white-space:pre-wrap; }
.copiloto-report { padding:16px 18px; border:1px solid var(--line); border-radius:10px; background:var(--surface-2); color:var(--ink); font-size:12.5px; line-height:1.65; max-height:560px; overflow-y:auto; overscroll-behavior:contain; }
.copiloto-report.is-streaming { white-space:pre-wrap; }
.copiloto-report > *:first-child { margin-top:0; }
.copiloto-report > *:last-child { margin-bottom:0; }
.copiloto-report h3 { margin:20px 0 8px; font:800 15px Manrope,sans-serif; letter-spacing:-.2px; color:var(--ink); }
.copiloto-report h4 { margin:18px 0 6px; font:700 13px Manrope,sans-serif; text-transform:uppercase; letter-spacing:.06em; color:var(--brand-dark); }
.copiloto-report h5, .copiloto-report h6 { margin:14px 0 5px; font:700 12px Manrope,sans-serif; color:var(--muted); }
.copiloto-report p { margin:0 0 9px; }
.copiloto-report strong { font-weight:700; color:var(--ink); }
.copiloto-report ul { margin:0 0 10px; padding-left:18px; }
.copiloto-report li { margin-bottom:5px; }
.copiloto-report blockquote { margin:0 0 10px; padding:9px 13px; border-left:3px solid var(--brand); border-radius:0 8px 8px 0; background:var(--surface); color:#4c5a54; }
.copiloto-report code { padding:1px 5px; border-radius:5px; background:var(--brand-soft); font-size:11.5px; }
.copiloto-report hr { margin:14px 0; border:0; border-top:1px solid var(--line); }
.copiloto-report.is-streaming { min-height:120px; border-color:var(--brand); }
.copiloto-report.is-streaming::after { content:"▌"; margin-left:2px; color:var(--brand); animation:copiloto-caret 1s steps(2) infinite; }
@keyframes copiloto-caret { 50% { opacity:0; } }
.lead-search-box { position:relative; max-width:420px; }
.lead-search-box input { width:100%; }
.lead-search-results { position:absolute; z-index:20; top:calc(100% + 6px); left:0; right:0; max-height:320px; overflow-y:auto; border:1px solid var(--line); border-radius:12px; background:var(--surface); box-shadow:0 20px 45px rgba(20,40,33,.16); }
.lead-search-result { width:100%; padding:10px 14px; display:flex; flex-direction:column; gap:2px; border:0; border-bottom:1px solid var(--line); background:transparent; text-align:left; cursor:pointer; }
.lead-search-result:last-child { border-bottom:0; }
.lead-search-result:hover { background:var(--surface-2); }
.lead-search-result strong { font-size:12px; color:var(--ink); }
.lead-search-result span { font-size:10px; color:var(--muted); }
.lead-search-empty { padding:14px; color:var(--muted); font-size:11px; text-align:center; }

/* Global AI assistant popup */
@keyframes aiPopupIn { from { opacity:0; transform:translateY(14px) scale(.94); } to { opacity:1; transform:none; } }
@keyframes aiNudgeIn { from { opacity:0; transform:translateY(8px) scale(.97); } to { opacity:1; transform:none; } }

/* Appearance */
.theme-preview { margin:18px 0; padding:18px; border:1px solid var(--line); border-radius:13px; background:var(--bg); }
.theme-preview-card { padding:15px; border:1px solid var(--line); border-radius:11px; background:var(--surface); box-shadow:var(--shadow); }
.theme-preview-brand { display:block; margin-bottom:12px; color:var(--ink); font:800 13px Manrope,sans-serif; }
.theme-preview-bar { width:72%; height:8px; border-radius:99px; background:var(--brand); }
.theme-preview-lines { margin-top:12px; display:grid; gap:7px; }
.theme-preview-lines span { width:100%; height:6px; border-radius:99px; background:var(--line); }
.theme-preview-lines span:last-child { width:56%; }
.color-picker-row { display:flex; align-items:center; gap:10px; }
.color-picker-row input[type=color] { width:52px; height:42px; padding:4px; cursor:pointer; }

/* Team, profile and audit */
.team-summary { margin-bottom:14px; padding:17px 20px; display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.team-summary > div { display:grid; gap:3px; }
.team-summary strong { font:800 22px Manrope,sans-serif; }
.team-summary span { color:var(--muted); font-size:9px; }
.online-number { color:#0a8b70; }
.team-card { position:relative; }
.team-card.is-online { border-color:#bfe4d8; box-shadow:inset 0 2px 0 #22a983; }
.team-card .entity-head { position:relative; }
.team-card .presence-dot { margin-left:auto; width:8px; height:8px; border-radius:50%; background:#c2cac6; }
.team-card .presence-dot.online { background:#17a77f; box-shadow:0 0 0 4px rgba(23,167,127,.12); }
.team-card-foot { margin:14px 0; padding-top:12px; display:flex; justify-content:space-between; gap:8px; border-top:1px solid var(--line); color:var(--muted); font-size:8px; }
.team-card .edit-member { width:100%; }
.user-photo { overflow:hidden; }
.profile-layout { max-width:920px; display:grid; grid-template-columns:1fr 1fr; gap:14px; align-items:start; }
.profile-card { padding:21px; }
.profile-card h3 { margin:0 0 6px; font:800 14px Manrope,sans-serif; }
.profile-card > p,.profile-photo-row p { margin:0 0 19px; color:var(--muted); font-size:10px; line-height:1.55; }
.profile-photo-row { margin-bottom:22px; padding-bottom:20px; display:flex; align-items:center; gap:15px; border-bottom:1px solid var(--line); }
.profile-avatar { width:72px; height:72px; flex:0 0 72px; display:grid; place-items:center; overflow:hidden; border-radius:20px; color:var(--brand-dark); background:var(--brand-soft); font:800 20px Manrope,sans-serif; }
.file-button { position:relative; overflow:hidden; }
.file-button input { position:absolute; inset:0; opacity:0; cursor:pointer; }
.two-factor-card { grid-column:1/-1; }
.security-card-head { margin-bottom:16px; display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.security-card-head > div { display:flex; gap:12px; align-items:flex-start; }
.security-card-head p { margin:3px 0 0; color:var(--muted); font-size:10px; }
.security-icon { width:40px; height:40px; display:grid; place-items:center; border-radius:11px; color:#5e44a1; background:#f1ecff; font-size:22px; }
.logout-card { grid-column:1/-1; display:flex; align-items:center; justify-content:space-between; gap:16px; }
.logout-card p { margin:0; }
.modal-intro { margin:0 0 18px; color:var(--muted); font-size:11px; line-height:1.6; }
.totp-enrollment { margin-bottom:20px; display:grid; grid-template-columns:210px 1fr; gap:22px; align-items:center; }
.totp-qr { min-height:210px; padding:10px; display:grid; place-items:center; border:1px solid var(--line); border-radius:13px; background:#fff; }
.totp-qr svg { width:100%; height:auto; }
.totp-enrollment h3 { margin:0 0 10px; font:800 14px Manrope,sans-serif; }
.totp-enrollment ol { margin:0 0 13px; padding-left:18px; color:var(--muted); font-size:10px; line-height:1.7; }
.totp-enrollment details { color:var(--muted); font-size:10px; }
.setup-key { display:block; margin-top:7px; padding:9px; overflow-wrap:anywhere; border-radius:8px; color:var(--ink); background:var(--surface-2); font-size:10px; }
.recovery-codes { margin:18px 0; padding:15px; display:grid; grid-template-columns:1fr 1fr; gap:8px; border:1px dashed var(--line-strong); border-radius:11px; background:var(--surface-2); }
.recovery-codes code { padding:6px; border-radius:6px; background:var(--surface); text-align:center; font-size:11px; font-weight:800; letter-spacing:.06em; }
.warning-box { margin-bottom:18px; padding:12px; border:1px solid #f2cbc7; border-radius:9px; color:#9f4640; background:#fff5f4; font-size:10px; }
.audit-filters { margin-bottom:14px; padding:14px; display:grid; grid-template-columns:1.1fr 1.2fr .8fr .8fr 1.3fr auto; gap:9px; align-items:end; }
.audit-filters label { display:grid; gap:5px; color:var(--muted); font-size:8px; font-weight:800; text-transform:uppercase; letter-spacing:.05em; }
.audit-filters input,.audit-filters select { min-height:38px; text-transform:none; }
.audit-card { overflow:hidden; }
.audit-list { display:grid; }
.audit-row { min-height:66px; padding:11px 15px; display:grid; grid-template-columns:36px minmax(180px,1fr) minmax(180px,.8fr); gap:11px; align-items:center; border-bottom:1px solid var(--line); }
.audit-row:last-child { border-bottom:0; }
.audit-avatar { width:36px; height:36px; border-radius:10px; overflow:hidden; }
.audit-copy,.audit-actor { min-width:0; display:grid; gap:3px; }
.audit-copy strong,.audit-actor strong { font-size:10px; }
.audit-copy span,.audit-actor span { overflow:hidden; color:var(--muted); font-size:8px; text-overflow:ellipsis; white-space:nowrap; }
.audit-actor { text-align:right; }

/* Dark theme */
html[data-theme="dark"] { color-scheme:dark; --bg:#0f1714; --surface:#16201c; --surface-2:#121b18; --ink:#e8f1ed; --muted:#91a19a; --muted-2:#708078; --line:#28362f; --line-strong:#34453d; --navy:#0b1512; --shadow:0 14px 36px rgba(0,0,0,.22); }
html[data-theme="dark"] body,html[data-theme="dark"] .main-area { background:var(--bg); }
html[data-theme="dark"] .sidebar,html[data-theme="dark"] .topbar { background:rgba(18,27,24,.94); }
html[data-theme="dark"] .card,html[data-theme="dark"] .workspace-card,html[data-theme="dark"] .icon-button,html[data-theme="dark"] .btn,html[data-theme="dark"] input,html[data-theme="dark"] select,html[data-theme="dark"] textarea,html[data-theme="dark"] .modal,html[data-theme="dark"] .drawer,html[data-theme="dark"] .lead-card { background:var(--surface); color:var(--ink); }
html[data-theme="dark"] .filter-bar,html[data-theme="dark"] .date-range,html[data-theme="dark"] .level-toggle,html[data-theme="dark"] .chat-header,html[data-theme="dark"] .chat-composer,html[data-theme="dark"] .contact-panel { background:var(--surface); }
html[data-theme="dark"] .kanban-column { background:#121b18; }
html[data-theme="dark"] th,html[data-theme="dark"] .card-header,html[data-theme="dark"] .modal-footer { background:#131d19; }
html[data-theme="dark"] td,html[data-theme="dark"] .lead-card h4,html[data-theme="dark"] .cell-main strong,html[data-theme="dark"] .toolbar-copy h2,html[data-theme="dark"] .appointment-info strong,html[data-theme="dark"] .message p { color:var(--ink); }
html[data-theme="dark"] tbody tr:hover,html[data-theme="dark"] .nav-item:hover { background:#1b2924; }
html[data-theme="dark"] .calendar-day { background:var(--surface); }
html[data-theme="dark"] .calendar-day.muted { background:#111916; }
html[data-theme="dark"] .ai-panel,html[data-theme="dark"] .ai-lead-card { border-color:#453b5f; background:#1c1924; }
html[data-theme="dark"] .integration-steps { border-color:#453b5f; color:#c9c0dc; background:#1c1924; }
html[data-theme="dark"] .global-search { border-color:var(--line-strong); background:var(--surface-2); }
html[data-theme="dark"] .global-search input { background:transparent; color:var(--ink); }
html[data-theme="dark"] .date-range button.active,html[data-theme="dark"] .level-toggle button.active { color:#d8fff6; background:var(--brand-soft); }
html[data-theme="dark"] .info-box { border-color:#315249; color:#a9c9c0; background:#162923; }
html[data-theme="dark"] .ai-result,html[data-theme="dark"] .ai-lead-result { color:#c9c0dc; }
html[data-theme="dark"] .copiloto-report blockquote { background:var(--surface-2); color:#b9c6c0; }
html[data-theme="dark"] .copiloto-report h4 { color:#7fe3cd; }
html[data-theme="dark"] .conversation-item { border-color:var(--line); }
html[data-theme="dark"] .account-menu,html[data-theme="dark"] .profile-card,html[data-theme="dark"] .audit-card,html[data-theme="dark"] .recovery-codes code,html[data-theme="dark"] .setup-key { background:var(--surface); color:var(--ink); }
html[data-theme="dark"] .notification-menu,html[data-theme="dark"] .lead-search-results { background:var(--surface); color:var(--ink); box-shadow:0 20px 55px rgba(0,0,0,.38); }
html[data-theme="dark"] .totp-qr { border-color:#405149; background:#fff; }
html[data-theme="dark"] .warning-box { border-color:#6e3c39; color:#efa59f; background:#2b1b1a; }
html[data-theme="dark"] .security-icon { color:#c5b2f1; background:#282137; }

/* Dashboard Priority Metrics */
.kpi-grid.priority { grid-template-columns: repeat(2, 1fr); gap: 14px; }
.kpi-grid.priority .kpi-card { padding: 24px; border-radius: 16px; min-height: 140px; display: flex; flex-direction: column; justify-content: space-between; }
.kpi-grid.priority .kpi-card.highlight { background: linear-gradient(135deg, var(--brand-soft), #e0f2f0); border: 1px solid var(--brand); box-shadow: 0 8px 20px rgba(8, 127, 108, 0.12); }
.kpi-grid.priority .kpi-value { font: 800 36px/1.1 Manrope, sans-serif; letter-spacing: -1px; }
.kpi-grid.priority .kpi-foot { color: #58655f; font-size: 12px; }

/* Dashboard Efficiency Metrics */
.kpi-grid.efficiency { grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.kpi-grid.efficiency .kpi-card { padding: 20px; border-radius: 14px; min-height: 110px; display: flex; flex-direction: column; justify-content: space-between; }
.kpi-grid.efficiency .kpi-value { font: 700 28px/1.1 Manrope, sans-serif; }

/* Funnel Summary Visualization */
.funnel-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px; background: linear-gradient(to bottom, var(--surface-2), var(--surface)); border-radius: 12px; }
.funnel-step { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 40px 24px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); position: relative; min-width: 150px; text-align: center; min-height: 260px; }
.funnel-step.success { background: linear-gradient(135deg, #d7f5eb, #c2ebe1); border-color: var(--brand); }
.funnel-step.success .step-number { color: var(--brand); }
.step-number { font: 800 56px/1 Manrope, sans-serif; color: var(--ink); }
.step-label { font: 600 15px DM Sans, sans-serif; color: var(--muted); }
.step-conversion { font: 500 10px DM Sans, sans-serif; color: #7c3aed; padding: 3px 6px; border-radius: 4px; background: #f3e8ff; }
.funnel-arrow { display: grid; place-items: center; color: var(--line-strong); font-size: 18px; font-weight: 300; }

/* KPI Card Highlight Classes */
.kpi-card { transition: all 0.2s ease; }
.kpi-card.highlight { background: linear-gradient(135deg, var(--brand-soft), #e0f2f0); border: 1px solid var(--brand); box-shadow: 0 8px 20px rgba(8, 127, 108, 0.12); }
.kpi-card.highlight::after { background: var(--brand); opacity: 0.08; }
.kpi-card.highlight .kpi-value { color: var(--brand); }

/* Metas */
.metas-layout { display:grid; grid-template-columns:1fr; gap:20px; }
.variables-grid { display:flex; align-items:flex-end; gap:12px; overflow-x:auto; padding:8px 20px; }
.variable-card { display:flex; flex-direction:column; gap:8px; flex:1; min-width:120px; }
.variable-card label { font-size:11px; font-weight:800; color:var(--muted); text-transform:uppercase; letter-spacing:0.7px; }
.funnel-projection { display:flex; align-items:center; gap:10px; overflow-x:auto; padding:4px 0; }
.funnel-step { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; padding:16px 14px; background:var(--surface-2); border:1px solid var(--line); border-radius:12px; flex:1.1; min-height:140px; min-width:110px; }
.funnel-step.success { background:var(--brand-soft); border-color:var(--brand); flex:1; min-width:100px; }
.funnel-step.highlight { background:var(--brand-soft); border:2px solid var(--brand); flex:1.4; min-height:160px; min-width:200px; }
.step-number { font-size:32px; font-weight:800; color:var(--ink); line-height:1; }
.funnel-step.highlight .step-number { color:var(--brand); font-size:32px; }
.step-label { font-size:11px; font-weight:800; color:var(--muted); text-align:center; text-transform:uppercase; letter-spacing:0.6px; }
.funnel-arrow { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; min-width:40px; flex-shrink:0; }
.funnel-arrow span { color:var(--muted); font-size:16px; font-weight:600; }
.arrow-percent { font-size:11px; font-weight:800; color:var(--brand); text-transform:uppercase; letter-spacing:0.6px; }
.input-group { display:grid; gap:8px; }
.input-group label { font-size:11px; font-weight:800; color:var(--muted); text-transform:uppercase; letter-spacing:0.7px; }
.input-with-icon { display:flex; align-items:center; gap:10px; padding:0 14px; border:1px solid var(--line); border-radius:10px; background:var(--surface); height:50px; }
.input-with-icon span { color:var(--muted); font-size:12px; font-weight:700; }
.input-with-icon input { flex:1; border:0; padding:0; background:transparent; color:var(--ink); font-size:18px; font-weight:700; outline:0; }
.projection-divider { height:1px; background:var(--line); margin:12px 0; }
.projection-item { padding:12px; border-radius:9px; background:var(--surface-2); border-left:3px solid var(--brand); }
.projection-item.highlight { background:var(--brand-soft); border-left-color:var(--brand); }
.proj-label { font-size:9px; font-weight:800; color:var(--muted); text-transform:uppercase; letter-spacing:0.6px; margin-bottom:4px; }
.proj-value { font-size:20px; font-weight:800; color:var(--ink); line-height:1.2; }
.projection-item.highlight .proj-value { color:var(--brand); font-size:24px; }

@media (max-width:1180px) {
    .integration-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .inbox-shell { grid-template-columns:260px minmax(360px,1fr); }
    .contact-panel { display:none; }
    .audit-filters { grid-template-columns:repeat(3,1fr); }
}

@media (max-width: 1180px) {
    .kpi-grid { grid-template-columns: repeat(3,1fr); gap: 12px; }
    .kpi-grid.priority { grid-template-columns: 1fr 1fr; gap: 12px; }
    .kpi-grid.efficiency { grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
    .kpi-grid .kpi-card:nth-child(n+4) { grid-column: span 1; }
    .dashboard-grid, .bottom-grid { grid-template-columns: 1fr; }
    .funnel-summary { grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .funnel-arrow { display: none; }
    .entity-grid { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 860px) {
    :root { --sidebar: 264px; }
    .login-screen { grid-template-columns: 1fr; }
    .login-aside { display:none; }
    .login-form-wrap { min-height:100vh; padding:26px; }
    .mobile-brand { display:flex; margin-bottom:46px; }
    .sidebar { transform:translateX(-105%); transition:transform .22s ease; box-shadow:14px 0 40px rgba(20,40,33,.13); }
    .sidebar.open { transform:translateX(0); }
    .sidebar-overlay { display:none; position:fixed; z-index:25; inset:0; background:rgba(15,30,25,.32); }
    .sidebar-overlay.open { display:block; }
    .mobile-close { display:block; position:absolute; right:12px; top:15px; width:34px; height:34px; border:0; background:transparent; font-size:24px; cursor:pointer; }
    .main-area { margin-left:0; }
    .mobile-menu { display:grid; }
    .global-search, .notification-button, .notification-menu, .user-menu div { display:none; }
    .content { padding-top:20px; }
    .agenda-layout { grid-template-columns:1fr; }
    .settings-layout { grid-template-columns:1fr; }
    .settings-nav { grid-template-columns:repeat(5,1fr); }
    .settings-nav button { text-align:center; }
    .inbox-shell { height:calc(100vh - 112px); grid-template-columns:230px minmax(340px,1fr); }
    .metas-layout { grid-template-columns:1fr; }
    .variables-grid { padding:8px 12px; gap:10px; }
    .variable-card { min-width:100px; }
    .funnel-projection { gap:8px; }
    .funnel-step { padding:12px 10px; min-height:110px; }
    .step-number { font-size:24px; }
    .step-label { font-size:10px; }
    .funnel-step.highlight .step-number { font-size:28px; }
    .funnel-arrow { min-width:32px; }
    .funnel-arrow span { font-size:14px; }
    .arrow-percent { font-size:9px; }
}

@media (max-width: 620px) {
    .topbar { height:72px; padding:0 15px; }
    .topbar h1 { font-size:17px; }
    .topbar p { display:none; }
    .content { padding:16px 12px 42px; }
    .page-toolbar { align-items:flex-start; }
    .toolbar-copy h2 { font-size:20px; }
    .toolbar-actions { width:100%; }
    .date-range { max-width:100%; overflow:auto; }
    .kpi-grid { grid-template-columns:1fr 1fr; gap:10px; }
    .kpi-grid.priority { grid-template-columns: 1fr; gap: 10px; }
    .kpi-grid.efficiency { grid-template-columns: 1fr; gap: 10px; margin-top: 10px; }
    .kpi-card { padding:14px; }
    .kpi-card:first-child { grid-column:1/-1; }
    .kpi-grid.priority .kpi-card { padding: 18px; min-height: 110px; }
    .kpi-grid.primary .kpi-card.highlight { padding: 18px; }
    .kpi-grid.efficiency .kpi-card { padding: 14px; min-height: 90px; }
    .kpi-grid.priority .kpi-value { font-size: 28px; }
    .kpi-grid.efficiency .kpi-value { font-size: 22px; }
    .funnel-summary { grid-auto-flow: column; grid-auto-columns: auto; gap: 8px; padding: 16px; overflow-x: auto; }
    .funnel-step { padding: 16px 18px; min-width: 110px; }
    .step-number { font-size: 24px; }
    .step-label { font-size: 11px; }
    .funnel-arrow { font-size: 14px; }
    .kpi-value { font-size:21px; }
    .filter-bar { align-items:stretch; }
    .filter-search { width:100%; }
    .filter-bar select { flex:1; min-width:120px; }
    .filter-count { width:100%; margin:0; }
    .kanban-column { flex-basis:82vw; min-width:82vw; }
    .calendar-day { min-height:74px; padding:4px; }
    .calendar-event { max-width:100%; padding:4px 3px; font-size:0; }
    .calendar-event::before { content:"•"; font-size:10px; }
    .agenda-side { display:none; }
    .entity-grid, .form-grid { grid-template-columns:1fr; }
    .field.full { grid-column:auto; }
    .settings-nav { grid-template-columns:1fr 1fr; }
    .backup-contents { grid-template-columns:1fr; }
    .modal-backdrop { padding:0; align-items:end; }
    .modal { width:100%; max-height:92vh; border-radius:17px 17px 0 0; }
    .detail-grid { grid-template-columns:1fr; }
    .drawer { width:100%; }
    .toast-region { left:12px; right:12px; bottom:12px; }
    .toast { min-width:0; max-width:none; width:100%; }
    .integration-hero { align-items:flex-start; }
    .integration-hero-badge { display:none; }
    .integration-grid { grid-template-columns:1fr; }
    .inbox-shell { height:auto; min-height:620px; grid-template-columns:1fr; }
    .inbox-sidebar { min-height:560px; border-right:0; }
    .inbox-chat { display:none; border-right:0; }
    .inbox-shell.chat-open .inbox-sidebar { display:none; }
    .inbox-shell.chat-open .inbox-chat { display:flex; min-height:620px; }
    .chat-back { display:grid !important; }
    .profile-layout { grid-template-columns:1fr; }
    .two-factor-card,.logout-card { grid-column:auto; }
    .totp-enrollment { grid-template-columns:1fr; }
    .totp-qr { width:min(100%,240px); margin:auto; }
    .audit-filters { grid-template-columns:1fr 1fr; }
    .audit-row { grid-template-columns:36px 1fr; }
    .audit-actor { grid-column:2; text-align:left; }
}

@media (max-width:520px) {
    .team-summary { grid-template-columns:1fr; }
    .audit-filters { grid-template-columns:1fr; }
    .recovery-codes { grid-template-columns:1fr; }
    .logout-card { align-items:flex-start; flex-direction:column; }
    .settings-nav { grid-template-columns:1fr 1fr; }
    .modal-footer { flex-wrap:wrap; }
    .modal-footer .btn { min-width:110px; }
    .save-status { width:100%; margin:0 0 4px; }
}

/* ===== Paginação de cards e linhas ===== */
.kanban-more,
.table-more button {
    width: 100%;
    padding: 9px 12px;
    margin-top: 8px;
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

.kanban-more:hover,
.table-more button:hover {
    background: var(--brand-soft);
    color: var(--brand-dark);
    border-color: var(--brand);
}

.table-more {
    padding: 12px 16px 16px;
}

/* Notas do Diagnóstico de Avaliação */
.score-list { list-style:none; display:grid; gap:8px; margin:2px 0 16px; padding:0; }
.score-item { --band:var(--brand); font-size:12.5px; line-height:1.55; color:var(--muted); }
.score-item[data-band="low"] { --band:var(--danger); }
.score-item[data-band="mid"] { --band:var(--warning); }
.score-item[data-band="good"] { --band:var(--blue); }
.score-item b { font-weight:800; color:var(--ink); letter-spacing:-.1px; }
.score-value { font-weight:700; color:var(--band); font-variant-numeric:tabular-nums; }
.score-why { color:var(--muted); }
.report-disclaimer { margin:10px 0 0; padding:9px 12px; border-radius:8px; background:var(--surface-2); border:1px solid var(--line); color:var(--muted-2); font-size:10.5px; line-height:1.55; }
.pipeline-numbers { display: flex; align-items: baseline; gap: 10px; }
.pipeline-value { color: var(--muted-2); font-size: 10px; font-variant-numeric: tabular-nums; }

/* Edição no lugar, dentro do painel do lead */
.inline-edit-input { width:100%; padding:6px 8px; border:1px solid var(--brand); border-radius:7px; background:var(--surface); color:var(--ink); font:700 11px inherit; font-family:inherit; box-shadow:0 0 0 2px var(--brand-ring); }
.inline-edit-input:focus { outline:none; }
.inline-edit-money .inline-edit-input:focus { box-shadow:none; border:0; }
/* Setinhas de incremento não servem para dinheiro nem para valores grandes. */
.inline-edit-input::-webkit-outer-spin-button,
.inline-edit-input::-webkit-inner-spin-button { -webkit-appearance:none; margin:0; }
.inline-edit-input[type=number] { -moz-appearance:textfield; appearance:textfield; }
.inline-edit-money { display:flex; align-items:center; gap:6px; padding:0 8px; border:1px solid var(--brand); border-radius:7px; background:var(--surface); box-shadow:0 0 0 2px var(--brand-ring); }
.inline-edit-money span { color:var(--muted); font:700 11px Manrope,sans-serif; }
.inline-edit-money .inline-edit-input { padding:6px 0; border:0; background:transparent; box-shadow:none; text-align:right; font-variant-numeric:tabular-nums; }
/* grid com gap, igual aos outros campos: display:block anulava o espaço do rótulo */
.money-label { display:grid; gap:8px; margin-bottom:0; }
.money-field { display:flex; align-items:center; gap:7px; padding:0 10px; border:1px solid var(--line); border-radius:8px; background:var(--surface); transition:border-color .15s ease, box-shadow .15s ease; }
.money-field:focus-within { border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-ring); }
.money-prefix { color:var(--muted); font:700 12px Manrope,sans-serif; }
.money-field input { flex:1; padding:10px 0; border:0; background:transparent; color:var(--ink); font:700 14px Manrope,sans-serif; font-variant-numeric:tabular-nums; text-align:right; }
.money-field input:focus { outline:none; box-shadow:none; border:0; }
.money-field input::placeholder { color:var(--muted-2); font-weight:600; }

/* Faixa de contexto: o administrador da plataforma está dentro de uma clínica */
.acting-banner { position:fixed; top:0; left:0; right:0; z-index:60; display:flex; align-items:center; justify-content:center; gap:14px; padding:9px 16px; background:var(--navy); color:#fff; font-size:11.5px; line-height:1.4; }
.acting-banner strong { color:#fff; font-weight:800; }
.acting-banner button { flex:0 0 auto; padding:5px 12px; border:1px solid rgba(255,255,255,.35); border-radius:99px; background:transparent; color:#fff; font:700 11px Manrope,sans-serif; white-space:nowrap; cursor:pointer; transition:background .15s ease; }
#acting-tools { border-color:rgba(255,255,255,.2); color:rgba(255,255,255,.75); }
.acting-banner button:hover { background:rgba(255,255,255,.14); }
body.has-acting-banner .app-shell { padding-top:34px; }
body.has-acting-banner .sidebar { top:34px; }
@media (max-width:760px) { .acting-banner { flex-direction:column; gap:7px; padding:9px 12px; text-align:center; } body.has-acting-banner .app-shell { padding-top:62px; } }

.entity-actions { display:flex; flex-wrap:wrap; gap:7px; margin-top:12px; padding-top:12px; border-top:1px solid var(--line); }
.entity-hint { color:var(--muted-2); font-size:10px; font-weight:700; align-self:center; }
/* Meta de faturamento: campo grande, com R$ fixo fora da área de digitação */
.meta-money { display:flex; align-items:center; justify-content:center; gap:10px; padding:10px 14px; border:2px solid var(--brand); border-radius:9px; background:var(--surface); }
.meta-money span { color:var(--muted); font:800 18px Manrope,sans-serif; }
.meta-money input { width:auto; min-width:0; flex:0 1 auto; padding:0; border:0; background:transparent; color:var(--ink); font:800 24px Manrope,sans-serif; font-variant-numeric:tabular-nums; text-align:center; }
.meta-money input:focus { outline:none; box-shadow:none; }
.variable-card .input-with-icon input[type="text"] { font-variant-numeric:tabular-nums; }

/* Plano e Copiloto no cartão da clínica parceira */
.entity-plan { display:grid; gap:10px; margin-top:12px; padding-top:12px; border-top:1px solid var(--line); }
.entity-plan label { display:grid; gap:6px; color:var(--muted); font-size:10px; font-weight:700; }
.entity-plan select { min-height:34px; padding:6px 9px; font-size:11px; }
.entity-copilot { display:flex; flex-wrap:wrap; align-items:center; gap:7px; }
.copilot-pill { padding:4px 9px; border-radius:99px; background:var(--surface-2); border:1px solid var(--line); color:var(--muted); font-size:10px; font-weight:700; }
.copilot-pill[data-situacao="ativo"] { border-color:var(--brand); background:var(--brand-soft); color:var(--brand-dark); }
.copilot-pill[data-situacao="teste"] { border-color:var(--warning); background:#fdf6e9; color:#8a5d10; }
.copilot-pill[data-situacao="teste_expirado"] { border-color:var(--danger); background:#fdf1f0; color:#a63d36; }

/* Apresentação do Copiloto para quem ainda não tem o adicional */
.copiloto-oferta { display:grid; gap:14px; margin-top:14px; }
.oferta-aviso { padding:11px 14px; border:1px solid var(--warning); border-radius:10px; background:#fdf6e9; color:#8a5d10; font-size:12px; font-weight:600; }
.oferta-topo { padding:22px 24px; }
.oferta-topo h2 { margin:0 0 6px; font:800 20px/1.25 Manrope,sans-serif; letter-spacing:-.4px; color:var(--ink); }
.oferta-topo p { margin:0; color:var(--muted); font-size:13px; line-height:1.6; }
.oferta-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(300px,100%),1fr)); gap:14px; }
.oferta-item { padding:22px 24px; }
.oferta-icone { width:34px; height:34px; margin-bottom:12px; display:grid; place-items:center; border-radius:10px; background:var(--brand-soft); color:var(--brand-dark); font-size:16px; }
.oferta-item h3 { margin:0 0 10px; font:800 15px Manrope,sans-serif; color:var(--ink); }
.oferta-item p { margin:0 0 10px; color:var(--muted); font-size:12.5px; line-height:1.65; }
.oferta-item p:last-child { margin-bottom:0; }
.oferta-dor { padding-left:11px; border-left:3px solid var(--line-strong); color:var(--ink) !important; font-weight:600; }
.oferta-chamada { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:16px; padding:20px 24px; }
.oferta-chamada h3 { margin:0 0 4px; font:800 15px Manrope,sans-serif; color:var(--ink); }
.oferta-chamada p { margin:0; color:var(--muted); font-size:12.5px; }

.oferta-chamada .btn { display:inline-flex; align-items:center; text-decoration:none; }

/* Copiloto Comercial */
.copiloto-busca { display:flex; align-items:center; gap:12px; margin-top:14px; padding:12px 16px; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); box-shadow:var(--shadow); }
.copiloto-busca-icone { flex:0 0 32px; width:32px; height:32px; display:grid; place-items:center; border-radius:10px; background:var(--brand-soft); color:var(--brand-dark); font-size:14px; }
.copiloto-busca .lead-search-box { flex:1 1 320px; min-width:0; }
.copiloto-busca small { flex:0 1 auto; color:var(--muted-2); font-size:10.5px; }

.copiloto-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(380px,100%),1fr)); gap:14px; margin-top:14px; align-items:start; }
/* Coluna em flex para o formulário ficar ancorado embaixo e os dois botões alinharem. */
.copiloto-card { display:flex; flex-direction:column; padding:0; overflow:hidden; }
.copiloto-card-head { display:flex; align-items:flex-start; gap:12px; padding:16px 18px; border-bottom:1px solid var(--line); }
.copiloto-icone { flex:0 0 34px; width:34px; height:34px; display:grid; place-items:center; border-radius:10px; background:var(--brand-soft); color:var(--brand-dark); font-size:15px; }
.copiloto-card-head h3 { margin:0 0 2px; font:800 14px Manrope,sans-serif; letter-spacing:-.2px; color:var(--ink); }
.copiloto-card-head p { margin:0; color:var(--muted); font-size:11px; line-height:1.45; }
.copiloto-card-head .btn { margin-left:auto; flex:0 0 auto; }

.copiloto-saida { padding:16px 18px; }
.copiloto-saida .copiloto-report { max-height:420px; }
.copiloto-vazio { display:grid; gap:4px; padding:26px 18px; border:1px dashed var(--line-strong); border-radius:10px; background:var(--surface-2); text-align:center; }
.copiloto-vazio strong { font:700 12.5px Manrope,sans-serif; color:var(--ink); }
.copiloto-vazio span { color:var(--muted); font-size:11px; }

.copiloto-acao { margin-top:auto; display:grid; gap:12px; padding:16px 18px; border-top:1px solid var(--line); background:var(--surface-2); }
.copiloto-acao .field { margin:0; }
.copiloto-acao textarea { min-height:104px; }
.copiloto-acao .btn-primary { justify-self:start; }
.copiloto-quando { color:var(--muted-2); font-size:10px; font-weight:700; }
@media (max-width:760px) { .copiloto-busca { flex-wrap:wrap; } .copiloto-busca small { flex-basis:100%; } }

/* Copiloto: como a página se apresenta antes de escolher um paciente */
.copiloto-inicio { display:grid; gap:14px; margin-top:14px; }
.copiloto-inicio-passo { display:flex; align-items:center; gap:12px; padding:14px 18px; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); }
.copiloto-inicio-passo > span { flex:0 0 28px; width:28px; height:28px; display:grid; place-items:center; border-radius:50%; background:var(--brand); color:#fff; font:800 13px Manrope,sans-serif; }
.copiloto-inicio-passo strong { display:block; font:800 13px Manrope,sans-serif; color:var(--ink); }
.copiloto-inicio-passo small { color:var(--muted); font-size:11px; }
.copiloto-inicio-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(320px,100%),1fr)); gap:14px; }
.copiloto-inicio-cards article { padding:20px 22px; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); box-shadow:var(--shadow); }
.copiloto-inicio-cards h4 { margin:12px 0 8px; font:800 14px Manrope,sans-serif; color:var(--ink); }
.copiloto-inicio-cards p { margin:0 0 10px; color:var(--muted); font-size:12px; line-height:1.6; }
.copiloto-inicio-cards small { display:block; padding-left:10px; border-left:2px solid var(--line-strong); color:var(--muted-2); font-size:10.5px; font-weight:600; }
.copiloto-recentes { padding:16px 18px; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); }
.copiloto-recentes > strong { display:block; margin-bottom:10px; color:var(--muted); font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.06em; }
.copiloto-recentes > div { display:flex; flex-wrap:wrap; gap:8px; }
.copiloto-recentes button { display:flex; align-items:center; gap:8px; padding:6px 12px 6px 6px; border:1px solid var(--line); border-radius:99px; background:var(--surface-2); color:var(--ink); font:600 11.5px Manrope,sans-serif; cursor:pointer; transition:border-color .15s ease, background .15s ease; }
.copiloto-recentes button:hover { border-color:var(--brand); background:var(--brand-soft); }
.copiloto-recentes .lead-avatar { width:24px; height:24px; font-size:9px; }
.copiloto-aviso { display:block; color:var(--muted-2); font-size:10px; line-height:1.5; }

/* Consumo de IA no cartão da clínica parceira */
.entity-consumo { display:grid; grid-template-columns:repeat(3,1fr); gap:10px 12px; margin-top:10px; padding:11px 13px; border-radius:10px; background:var(--surface-2); border:1px solid var(--line); }
.entity-consumo > div { display:grid; gap:1px; }
.entity-consumo strong { font:800 14px Manrope,sans-serif; color:var(--ink); font-variant-numeric:tabular-nums; }
.entity-consumo small { color:var(--muted); font-size:9.5px; }
.entity-consumo > span:only-child { grid-column:1/-1; color:var(--muted-2); font-size:10.5px; }
.entity-consumo-total { grid-column:1/-1; padding-top:8px; border-top:1px solid var(--line); color:var(--muted-2); font-size:10px; }

/* Uso do Copiloto contra o teto do nível contratado */
.copilot-uso { display:grid; gap:8px; margin-top:10px; }
.copilot-uso label { display:grid; gap:5px; color:var(--muted); font-size:10px; font-weight:700; }
.copilot-uso select { min-height:32px; padding:5px 9px; font-size:11px; }
.copilot-barra { height:6px; border-radius:99px; background:var(--line); overflow:hidden; }
.copilot-barra i { display:block; height:100%; border-radius:99px; background:var(--brand); transition:width .25s ease; }
.copilot-uso[data-faixa="atencao"] .copilot-barra i { background:var(--warning); }
.copilot-uso[data-faixa="estourou"] .copilot-barra i { background:var(--danger); }
.copilot-uso > span { color:var(--muted); font-size:10px; font-variant-numeric:tabular-nums; }
.copilot-uso[data-faixa="estourou"] > span { color:var(--danger); font-weight:700; }
.copilot-pill[data-situacao="limite_atingido"] { border-color:var(--danger); background:#fdf1f0; color:#a63d36; }


/* Celular: blocos criados depois da revisão original.
   O min(Xpx,100%) acima impede que a coluna fique mais larga que a tela;
   aqui vai o que precisa mudar de forma, não só de tamanho. */
@media (max-width: 620px) {
    /* Copiloto */
    .copiloto-busca { flex-direction:column; align-items:stretch; gap:10px; padding:14px; }
    /* Empilhado, a base de 320px do flex vira ALTURA e abria um vazio enorme. */
    .copiloto-busca .lead-search-box { flex:0 0 auto; max-width:none; }
    .copiloto-busca-icone { display:none; }
    .copiloto-busca small { text-align:center; }
    .copiloto-card-head { flex-wrap:wrap; padding:14px; }
    .copiloto-card-head .btn { margin-left:0; width:100%; }
    .copiloto-saida, .copiloto-acao { padding:14px; }
    .copiloto-saida .copiloto-report { max-height:340px; }
    .copiloto-acao .btn-primary { justify-self:stretch; }
    .copiloto-inicio-passo { padding:12px 14px; }
    .copiloto-inicio-cards article { padding:16px; }
    .copiloto-recentes button { flex:1 1 100%; }

    /* Clínicas parceiras */
    .entity-consumo { grid-template-columns:1fr 1fr; padding:10px; }
    .entity-consumo strong { font-size:13px; }
    .entity-actions { flex-direction:column; }
    .entity-actions .btn { width:100%; }
    .entity-plan select, .copilot-uso select { width:100%; }

    /* Oferta do Copiloto */
    .oferta-topo, .oferta-item, .oferta-chamada { padding:16px; }
    .oferta-topo h2 { font-size:17px; }
    .oferta-chamada { flex-direction:column; align-items:stretch; }
    .oferta-chamada .btn { width:100%; justify-content:center; }

    /* Notas do diagnóstico e campos de dinheiro */
    .score-list { gap:10px; }
    .meta-money input { font-size:19px; }
    .money-field input { font-size:13px; }

    /* Faixa de contexto da clínica */
    .acting-banner button { width:100%; }
}


/* Celular: grades que não colapsavam e empurravam a página para o lado.
   Cada regra abaixo corrige um estouro observado em tela de 390px. */
@media (max-width: 860px) {
    /* Grafico e pipeline ficavam lado a lado, os dois espremidos e cortados. */
    .chart-grid { grid-template-columns:1fr; }

    /* Filtros e seletor de quadro no funil: viravam duas colunas sem caber. */
    .page-filters-row { grid-template-columns:1fr !important; }
}

@media (max-width: 620px) {
    /* O funil comercial era uma fila unica de quatro caixas mais setas.
       Vira grade de duas colunas, e as setas somem: em coluna elas apontam
       para o lado errado e so ocupam espaco. */
    /* Uma etapa embaixo da outra: no celular a leitura e vertical, e o funil
       continua fazendo sentido porque a taxa aparece entre uma etapa e a seguinte. */
    .funnel-boxes-grid { display:grid; grid-template-columns:1fr; gap:6px; }
    /* A taxa fica centralizada entre uma etapa e a seguinte, com a seta para baixo.
       Os tamanhos sao fixos aqui porque o clamp por vw encolhe demais no celular. */
    .funnel-conversion { flex-direction:row; justify-content:center; gap:7px; padding:3px 0; font-size:13px; }
    .funnel-conversion::before { content:"\2193"; font-size:15px; }
    .funnel-box { padding:14px 16px; }
    .funnel-box-label { font-size:11px; }
    .funnel-box-number { font-size:30px; }
    .funnel-box-meta { font-size:11px; }

    /* Calculadora de metas.
       O cartao precisa poder encolher: sem min-width zero, o conteudo interno
       empurra a largura e a pagina inteira estoura para o lado. */
    .metas-layout > .card, .metas-layout .card-body { min-width:0; }

    /* Meta de faturamento: o campo cortava o valor. O numero passa a ocupar o
       espaco que sobra, alinhado a direita como nos demais campos de dinheiro. */
    .meta-money { justify-content:space-between; gap:8px; padding:10px 12px; }
    .meta-money span { font-size:15px; }
    .meta-money input { flex:1 1 auto; width:100%; min-width:0; font-size:22px; text-align:right; }

    /* A projecao vira vertical, como o Funil Comercial: a leitura no celular e de
       cima para baixo, e a taxa entre uma etapa e a seguinte mantem o sentido de funil. */
    .funnel-projection { display:grid; grid-template-columns:1fr; gap:6px; overflow:visible; padding:0; }
    .funnel-step, .funnel-step.success, .funnel-step.highlight { min-width:0; min-height:0; flex:none; padding:14px 16px; flex-direction:row; align-items:center; justify-content:space-between; gap:12px; }
    .step-number, .funnel-step.highlight .step-number { font-size:28px; }
    .step-label { font-size:11px; text-align:right; }
    /* A taxa entre uma etapa e a seguinte e a razao de ser da calculadora:
       sem ela sobram cinco numeros soltos. Seletor mais especifico porque a
       regra da versao em linha vencia por especificidade. */
    .metas-layout .funnel-arrow { display:flex; flex-direction:row; align-items:center; justify-content:center; gap:8px; min-width:0; padding:4px 0; }
    .metas-layout .funnel-arrow span { display:inline-block; transform:rotate(90deg); color:var(--muted-2); font-size:15px; }
    .metas-layout .arrow-percent { font-size:12px; color:var(--brand); }

    /* O investimento e a resposta da conta, entao ganha destaque proprio:
       fundo escuro da marca, para fechar a leitura de cima para baixo. */
    .metas-layout .funnel-step.highlight { background:var(--brand); border-color:var(--brand); }
    .metas-layout .funnel-step.highlight .step-number,
    .metas-layout .funnel-step.highlight .step-label { color:#fff; }

    /* Variaveis de controle: duas por linha em vez de rolagem lateral. */
    .variables-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px 12px; overflow:visible; padding:14px; align-items:stretch; }
    .variable-card { min-width:0; justify-content:flex-end; }
    /* Os rotulos tem alturas diferentes: "Taxa de comparecimento" quebra em duas
       linhas e "Taxa de conversao" nao. Reservando duas linhas para todos, os
       campos alinham na mesma altura em vez de ficarem desencontrados. */
    .variable-card label { font-size:10px; min-height:2.6em; display:flex; align-items:flex-end; }
    /* O ticket medio define toda a projecao e sobrava sozinho na ultima linha:
       ocupa a largura inteira, o que tambem o destaca. */
    .variable-card:last-child { grid-column:1 / -1; }

    /* Rede de seguranca: nada deve empurrar a pagina para o lado. */
    .content, .app-shell { max-width:100%; overflow-x:hidden; }
    .table-wrap, .funnel-projection, .variables-grid, .kanban { overflow-x:auto; }
}
.sync-status { align-self:center; margin-right:10px; color:var(--muted); font-size:11px; font-weight:600; white-space:nowrap; }
