/* EQUIPE COMERCIAL v4 — painel repaginado. Tudo restrito a #r-screen-team-commercial. */
#r-screen-team-commercial { width: 100%; container-type: inline-size; container-name: ec4; }
#r-screen-team-commercial.hidden-screen { display: none; }
.ec-hidden { display: none !important; }
#nav-mobile-team-commercial[aria-current="page"] { background: #b50f28; color: #fff; }

.ec4 {
    --ec4-red: #c8102e; --ec4-red-dark: #9e0d24; --ec4-red-soft: #fdecef;
    --ec4-bg: #fff; --ec4-soft: #f6f7f9; --ec4-line: #e4e7ec; --ec4-text: #172033; --ec4-muted: #5b6678;
    --ec4-green: #0f8a4b; --ec4-green-soft: #e7f6ee; --ec4-amber: #b45309; --ec4-amber-soft: #fff4e5;
    --ec4-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .05);
    display: grid; gap: 18px; width: 100%; max-width: 1440px; margin: 0 auto; color: var(--ec4-text);
    font-size: 14px; line-height: 1.45;
}
.dark .ec4 {
    --ec4-red-soft: #3a1820; --ec4-bg: #182231; --ec4-soft: #111827; --ec4-line: #2d3a4f; --ec4-text: #e8edf5;
    --ec4-muted: #a9b6c9; --ec4-green: #4ade80; --ec4-green-soft: #12301f; --ec4-amber: #fbbf24; --ec4-amber-soft: #33270f;
    --ec4-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
.ec4 svg.lucide { width: 18px; height: 18px; flex: none; }

/* neutraliza as regras globais de botão/título do app (visual-scale.css) dentro do painel */
#r-main-container #r-screen-team-commercial .ec4 button { min-height: 0; font-size: inherit !important; font: inherit; color: inherit; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
#r-main-container #r-screen-team-commercial .ec4 :is(h1, h2) { letter-spacing: -.01em !important; overflow-wrap: normal; margin: 0; }
#r-main-container #r-screen-team-commercial .ec4 h1 { font-size: 26px !important; line-height: 1.2 !important; font-weight: 800 !important; }
#r-main-container #r-screen-team-commercial .ec4 h2 { font-size: 16px !important; line-height: 1.3 !important; font-weight: 750 !important; display: flex; align-items: center; gap: 8px; }
#r-main-container #r-screen-team-commercial .ec4 h2 svg { color: var(--ec4-red); }
#r-screen-team-commercial .ec4 :focus-visible { outline: 2px solid var(--ec4-red); outline-offset: 2px; border-radius: 6px; }

/* topo */
.ec4-top { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; justify-content: space-between; }
.ec4-eyebrow { display: flex; align-items: center; gap: 6px; color: var(--ec4-red); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 4px; }
.ec4-eyebrow svg.lucide { width: 15px; height: 15px; }
.ec4-sub { margin: 4px 0 0; color: var(--ec4-muted); }
.ec4-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.ec4-field { display: grid; gap: 4px; min-width: 0; }
.ec4-field > span { font-size: 11px; font-weight: 700; color: var(--ec4-muted); text-transform: uppercase; letter-spacing: .04em; }
.ec4-field :is(select, input) {
    height: 40px; min-width: 150px; max-width: 220px; padding: 0 32px 0 12px; border: 1px solid var(--ec4-line); border-radius: 10px;
    background: var(--ec4-bg); color: var(--ec4-text); font: inherit; font-weight: 600; box-shadow: var(--ec4-shadow);
}
.ec4-field input { padding-right: 10px; min-width: 140px; }
.dark .ec4-field :is(select, input) { color-scheme: dark; }
#r-main-container #r-screen-team-commercial .ec4 .ec4-refresh {
    display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px;
    background: var(--ec4-red); color: #fff; font-weight: 700; box-shadow: var(--ec4-shadow);
}
#r-main-container #r-screen-team-commercial .ec4 .ec4-refresh:hover { background: var(--ec4-red-dark); }
#r-main-container #r-screen-team-commercial .ec4 .ec4-refresh:disabled { opacity: .6; cursor: progress; }
.ec4-period { display: flex; align-items: center; gap: 6px; margin: -6px 0 0; color: var(--ec4-muted); font-weight: 600; font-size: 13px; }
.ec4-period svg.lucide { width: 15px; height: 15px; }
.ec4-busy { opacity: .7; transition: opacity .2s; }

/* cartões base */
.ec4-card { background: var(--ec4-bg); border: 1px solid var(--ec4-line); border-radius: 16px; padding: 18px; box-shadow: var(--ec4-shadow); min-width: 0; }
.ec4-card-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ec4-hint { color: var(--ec4-muted); font-size: 12px; font-weight: 600; }
.ec4-note { color: var(--ec4-muted); font-size: 12px; margin: 12px 0 0; }
.ec4-empty { color: var(--ec4-muted); margin: 0; padding: 14px 0; }
#r-main-container #r-screen-team-commercial .ec4 .ec4-link { color: var(--ec4-red); font-weight: 700; font-size: 12px !important; }
#r-main-container #r-screen-team-commercial .ec4 .ec4-link:hover { text-decoration: underline; }
.dark .ec4 .ec4-link { color: #ff8095 !important; }

/* KPIs */
.ec4-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
#r-main-container #r-screen-team-commercial .ec4 .ec4-kpi {
    position: relative; display: grid; gap: 6px; align-content: start; padding: 16px 16px 46px; overflow: hidden;
    background: var(--ec4-bg); border: 1px solid var(--ec4-line); border-radius: 16px; box-shadow: var(--ec4-shadow); transition: transform .15s, box-shadow .15s;
}
#r-main-container #r-screen-team-commercial .ec4 .ec4-kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(16, 24, 40, .1); }
.ec4-kpi-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; color: var(--ec4-muted); }
.ec4-kpi-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--ec4-red-soft); color: var(--ec4-red); }
.ec4-kpi-icon svg.lucide { width: 16px; height: 16px; }
.ec4-kpi strong { font-size: 26px; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ec4-kpi-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 11px; color: var(--ec4-muted); position: relative; z-index: 1; }
.ec4-trend { font-weight: 800; font-size: 12px; padding: 1px 7px; border-radius: 99px; }
.ec4-up { color: var(--ec4-green); background: var(--ec4-green-soft); }
.ec4-down { color: var(--ec4-red); background: var(--ec4-red-soft); }
.ec4-flat { color: var(--ec4-muted); background: var(--ec4-soft); }
.ec4-spark { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 40px; }
.ec4-spark polyline { fill: none; stroke: var(--ec4-red); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.ec4-spark polygon { fill: var(--ec4-red); opacity: .08; }
#r-main-container #r-screen-team-commercial .ec4 .ec4-kpi-main { background: linear-gradient(135deg, #d0122f, #9e0d24); border-color: transparent; color: #fff; }
.ec4-kpi-main .ec4-kpi-head, .ec4-kpi-main .ec4-kpi-foot { color: rgba(255, 255, 255, .85); }
.ec4-kpi-main .ec4-kpi-icon { background: rgba(255, 255, 255, .18); color: #fff; }
.ec4-kpi-main .ec4-trend { background: rgba(255, 255, 255, .2); color: #fff; }
.ec4-kpi-main .ec4-spark polyline { stroke: #fff; }
.ec4-kpi-main .ec4-spark polygon { fill: #fff; opacity: .14; }

/* linhas do painel */
.ec4-row { display: grid; gap: 18px; min-width: 0; }
.ec4-row-a { grid-template-columns: minmax(0, 2.3fr) minmax(280px, 1fr); }
.ec4-row-b { grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); }
.ec4-row-c { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* equipe */
.ec4-team { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
#r-main-container #r-screen-team-commercial .ec4 .ec4-person {
    display: grid; align-content: start; border: 1px solid var(--ec4-line); border-radius: 14px; overflow: hidden; background: var(--ec4-bg); transition: border-color .15s, box-shadow .15s;
}
#r-main-container #r-screen-team-commercial .ec4 .ec4-person:hover { border-color: var(--ec4-red); box-shadow: 0 6px 18px rgba(200, 16, 46, .12); }
.ec4-person-head { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 10px; padding: 12px 14px; background: var(--ec4-soft); border-bottom: 1px solid var(--ec4-line); }
.ec4-avatar { grid-row: span 2; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--ec4-red-soft); color: var(--ec4-red); font-weight: 800; font-size: 13px; }
.ec4-person-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ec4-chip { justify-self: start; font-size: 11px; font-weight: 700; color: var(--ec4-muted); }
.ec4-person-top .ec4-person-head { background: linear-gradient(135deg, #d0122f, #9e0d24); color: #fff; border-bottom-color: transparent; }
.ec4-person-top .ec4-avatar { background: rgba(255, 255, 255, .2); color: #fff; }
.ec4-person-top .ec4-chip { color: rgba(255, 255, 255, .9); }
.ec4-person-lines { display: grid; padding: 6px 14px 2px; }
.ec4-person-lines > span { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--ec4-line); font-size: 13px; }
.ec4-person-lines > span:last-child { border-bottom: 0; }
.ec4-person-lines > span > span { color: var(--ec4-muted); }
.ec4-person-lines b { font-weight: 750; white-space: nowrap; }
.ec4-shared { margin: 4px 14px 0; font-size: 11px; font-weight: 700; color: var(--ec4-muted); }
.ec4-more { padding: 8px 14px 12px; color: var(--ec4-red); font-weight: 700; font-size: 12px; }
.dark .ec4-more { color: #ff8095; }

/* atenção */
.ec4-attn ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ec4-attn-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 12px; border-radius: 12px; background: var(--ec4-soft); border: 1px solid var(--ec4-line); }
.ec4-attn-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--ec4-bg); color: var(--ec4-muted); border: 1px solid var(--ec4-line); }
.ec4-attn-text { display: grid; gap: 2px; font-weight: 650; font-size: 13px; }
.ec4-attn-text .ec4-link { justify-self: start; }
.ec4-attn-item strong { font-size: 22px; font-weight: 800; }
.ec4-hot { background: var(--ec4-amber-soft); border-color: transparent; }
.ec4-hot .ec4-attn-icon { color: var(--ec4-amber); border-color: transparent; }
.ec4-hot strong { color: var(--ec4-amber); }
.ec4-attn-people { grid-column: 1 / -1; display: grid; gap: 4px !important; margin-top: 6px !important; padding-top: 8px !important; border-top: 1px solid var(--ec4-line); }
.ec4-attn-people li { display: flex; justify-content: space-between; font-size: 13px; }

/* evolução */
.ec4-legend { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; font-size: 12px; color: var(--ec4-muted); font-weight: 600; }
.ec4-lg-bar { width: 12px; height: 12px; border-radius: 3px; background: var(--ec4-red); }
.ec4-lg-line { width: 16px; height: 3px; border-radius: 2px; background: #334155; margin-left: 6px; }
.dark .ec4-lg-line { background: #cbd5e1; }
.ec4-chart { width: 100%; height: auto; display: block; overflow: visible; }
.ec4-grid { stroke: var(--ec4-line); stroke-dasharray: 3 4; }
.ec4-axis { fill: var(--ec4-muted); font-size: 11px; }
.ec4-month { font-weight: 700; }
.ec4-bar { fill: var(--ec4-red); opacity: .88; transition: opacity .15s; }
.ec4-bar-v { fill: var(--ec4-text); font-size: 12px; font-weight: 800; }
.ec4-bar-v.ec4-in { fill: #fff; }
.ec4-hit { fill: transparent; }
.ec4-bar-g { cursor: pointer; outline: none; }
.ec4-bar-g:hover .ec4-bar, .ec4-bar-g:focus .ec4-bar { opacity: 1; fill: var(--ec4-red-dark); }
.ec4-bar-g:focus-visible .ec4-hit { fill: var(--ec4-red-soft); }
.ec4-line { fill: none; stroke: #334155; stroke-width: 2.5; stroke-linejoin: round; }
.ec4-dot { fill: var(--ec4-bg); stroke: #334155; stroke-width: 2.5; }
.dark .ec4-line, .dark .ec4-dot { stroke: #cbd5e1; }

/* atividades */
.ec4-acts ul { list-style: none; margin: 0; padding: 0; display: grid; }
.ec4-acts li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--ec4-line); }
.ec4-acts li:last-child { border-bottom: 0; }
.ec4-act-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; }
.ec4-act-icon svg.lucide { width: 15px; height: 15px; }
.ec4-act-sale { background: var(--ec4-green-soft); color: var(--ec4-green); }
.ec4-act-cancel { background: var(--ec4-red-soft); color: var(--ec4-red); }
#r-main-container #r-screen-team-commercial .ec4 .ec4-act-text { display: grid; gap: 1px; min-width: 0; }
.ec4-act-text > span { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ec4-act-text:hover > span { color: var(--ec4-red); }
.ec4-act-text small { color: var(--ec4-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ec4-acts time { color: var(--ec4-muted); font-size: 12px; font-weight: 600; white-space: nowrap; }

/* mix (tipo / canal) */
.ec4-mix { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
#r-main-container #r-screen-team-commercial .ec4 .ec4-mix button { display: grid; gap: 6px; width: 100%; padding: 7px 8px; border-radius: 10px; }
#r-main-container #r-screen-team-commercial .ec4 .ec4-mix button:hover { background: var(--ec4-soft); }
.ec4-mix-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 650; }
.ec4-mix-top b { font-weight: 800; white-space: nowrap; }
.ec4-mix-top small { color: var(--ec4-muted); font-weight: 600; margin-left: 4px; }
.ec4-mix-track { height: 8px; border-radius: 99px; background: var(--ec4-soft); overflow: hidden; }
.dark .ec4-mix-track { background: #0b1220; }
.ec4-mix-track > span { display: block; height: 100%; border-radius: inherit; background: var(--ec4-red); }

/* rotina */
.ec4-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ec4-progress-track { flex: 1; height: 8px; border-radius: 99px; background: var(--ec4-soft); overflow: hidden; }
.dark .ec4-progress-track { background: #0b1220; }
.ec4-progress-track > span { display: block; height: 100%; background: var(--ec4-green); border-radius: inherit; }
.ec4-progress b { font-size: 13px; color: var(--ec4-green); }
.ec4-routine ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ec4-routine li { display: flex; gap: 10px; align-items: center; font-size: 13px; font-weight: 600; }
.ec4-check { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--ec4-line); flex: none; color: #fff; }
.ec4-check svg.lucide { width: 13px; height: 13px; stroke-width: 3; }
.ec4-done .ec4-check { background: var(--ec4-green); border-color: var(--ec4-green); }
.ec4-done > span:last-child { color: var(--ec4-muted); text-decoration: line-through; }

/* carregando / erro */
.ec4-skeleton { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.ec4-skeleton span { height: 128px; border-radius: 16px; background: linear-gradient(90deg, var(--ec4-soft), var(--ec4-line), var(--ec4-soft)); background-size: 200% 100%; animation: ec4-shine 1.4s infinite; }
@keyframes ec4-shine { to { background-position: -200% 0; } }
.ec4-loading { color: var(--ec4-muted); margin: 0; }
.ec4-error { display: grid; justify-items: center; gap: 10px; padding: 32px; text-align: center; color: var(--ec4-muted); }
.ec4-error svg.lucide { width: 32px; height: 32px; color: var(--ec4-red); }

/* detalhe */
.ec4-overlay { position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; padding: 20px; background: rgba(15, 23, 42, .55); }
.ec4-dialog { width: min(1100px, 100%); max-height: calc(100vh - 40px); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--ec4-bg); color: var(--ec4-text); border-radius: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); overflow: hidden; }
.ec4-dialog > header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--ec4-line); }
.ec4-dialog > header h2 { outline: none; }
#r-main-container #r-screen-team-commercial .ec4 .ec4-x { margin-left: auto; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 16px !important; color: var(--ec4-muted); }
#r-main-container #r-screen-team-commercial .ec4 .ec4-x:hover { background: var(--ec4-soft); color: var(--ec4-text); }
.ec4-table { overflow: auto; }
.ec4-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ec4-table th { position: sticky; top: 0; background: var(--ec4-soft); text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ec4-muted); padding: 10px 12px; white-space: nowrap; }
.ec4-table td { padding: 10px 12px; border-bottom: 1px solid var(--ec4-line); white-space: nowrap; }
.ec4-table tbody tr:hover { background: var(--ec4-soft); }
.ec4-num { text-align: right; font-weight: 700; }
.ec4-pages { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--ec4-line); font-size: 13px; }
#r-main-container #r-screen-team-commercial .ec4 .ec4-pages button { padding: 6px 12px; border: 1px solid var(--ec4-line); border-radius: 8px; font-weight: 700; }
#r-main-container #r-screen-team-commercial .ec4 .ec4-pages button:disabled { opacity: .45; cursor: default; }

/* responsivo — pelo tamanho real da área do painel */
@container ec4 (max-width: 1250px) {
    .ec4-row-a { grid-template-columns: minmax(0, 1fr); }
    .ec4-attn ul { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
    .ec4-row-c { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ec4-row-c > .ec4-routine { grid-column: 1 / -1; }
}
@container ec4 (max-width: 980px) {
    .ec4-row-b { grid-template-columns: minmax(0, 1fr); }
    .ec4-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #r-main-container #r-screen-team-commercial .ec4 .ec4-kpi-main { grid-column: 1 / -1; }
    .ec4-skeleton { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container ec4 (max-width: 700px) {
    .ec4 { gap: 14px; }
    .ec4-kpis { gap: 10px; }
    .ec4-kpi strong { font-size: 21px; }
    .ec4-row-c { grid-template-columns: minmax(0, 1fr); }
    .ec4-controls { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ec4-field :is(select, input) { min-width: 0; max-width: none; width: 100%; font-size: 16px; }
    #r-main-container #r-screen-team-commercial .ec4 .ec4-refresh { justify-content: center; grid-column: 1 / -1; }
    .ec4-card { padding: 14px; border-radius: 14px; }
    .ec4-team { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 82%; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; overscroll-behavior-x: contain; }
    #r-main-container #r-screen-team-commercial .ec4 .ec4-person { scroll-snap-align: start; }
    #r-main-container #r-screen-team-commercial .ec4 h1 { font-size: 22px !important; }
    .ec4-overlay { padding: 0; place-items: end stretch; }
    .ec4-dialog { max-height: 92vh; border-radius: 18px 18px 0 0; }
}
@container ec4 (max-width: 330px) {
    .ec4-kpis { grid-template-columns: minmax(0, 1fr); }
    .ec4-controls { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
    .ec4 *, .ec4 *::before { transition: none !important; animation: none !important; }
}
