/* =========================================================
   FONED — Painel da equipe
   ========================================================= */
:root {
  --navy-900: #061A38; --navy-800: #0B2A55; --navy-700: #123A70; --navy-500: #2B5596;
  --cyan: #2EC4D6; --cyan-dk: #1BA9BC; --coral: #FF7A59; --coral-dk: #EE5E3B;
  --ink: #12233F; --muted: #5A6B85; --line: #E1E7F0; --bg: #F4F7FB; --surface: #FFFFFF;
  --st-otima: #12A37F; --st-boa: #2B7BD6; --st-ruim: #E8962E; --st-mruim: #E5484D;
  --font-display: "Lexend", system-ui, sans-serif; --font-body: "Nunito Sans", system-ui, sans-serif;
  --radius: 18px; --shadow: 0 10px 30px -18px rgba(11,42,85,.35);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0; }
a { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); margin: 0; }
.wrap { width: min(1320px, 100% - 2rem); margin-inline: auto; }
[hidden] { display: none !important; }

/* ---------- Topo ---------- */
.topbar { background: linear-gradient(120deg, var(--navy-900), var(--navy-800)); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 4px 20px -10px rgba(0,0,0,.4); }
.topbar__in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; }
.topbar__brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; font: 800 1.2rem var(--font-display); letter-spacing: .05em; }
.topbar__brand img { height: 32px; }
.topbar__brand small { display: block; font: 500 .72rem var(--font-body); letter-spacing: .04em; color: var(--cyan); }
.topbar__nav { display: flex; flex-wrap: wrap; gap: .3rem; }
.topbar__nav a { text-decoration: none; padding: .45rem .85rem; border-radius: 999px; font-weight: 700; font-size: .9rem; color: rgba(255,255,255,.85); transition: background .2s; }
.topbar__nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.topbar__nav a.is-on { background: rgba(46,196,214,.18); color: #fff; }

/* ---------- Página ---------- */
.page { padding: 1.6rem 0 3rem; }
.page__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.page__title { font-size: 1.8rem; color: var(--navy-800); }
.page__actions { display: flex; align-items: center; gap: .8rem; }
.updated { font-size: .82rem; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card__title { font-size: 1.1rem; color: var(--navy-800); margin-bottom: .8rem; }

/* ---------- Botões ---------- */
.abtn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .62rem 1.1rem; border-radius: 999px; border: 2px solid transparent; font: 600 .9rem var(--font-display); cursor: pointer; text-decoration: none; transition: all .2s; }
.abtn svg { width: 16px; height: 16px; }
.abtn--primary { background: var(--navy-800); color: #fff; }
.abtn--primary:hover { background: var(--navy-700); }
.abtn--outline { background: #fff; border-color: var(--line); color: var(--navy-800); }
.abtn--outline:hover { border-color: var(--navy-800); }
.abtn--ghost { background: transparent; color: var(--navy-500); }
.abtn--ghost:hover { background: var(--bg); }
.abtn--danger { background: #fff; border-color: #F6C9CA; color: #C7353A; }
.abtn--danger:hover { background: #FDECEC; }
.abtn--block { width: 100%; }
.abtn:disabled { opacity: .5; cursor: wait; }
.link-danger { background: none; border: 0; color: #C7353A; font-weight: 700; cursor: pointer; padding: 0; }

/* ---------- Filtros ---------- */
.filters { padding: 1rem 1.2rem .8rem; }
.filters__grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)) auto; gap: .7rem; align-items: end; }
.filters label, .form label, .sortsel { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
input, select { font: 600 .92rem var(--font-body); color: var(--ink); padding: .55rem .7rem; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; min-width: 0; }
input:focus, select:focus { outline: none; border-color: var(--navy-500); box-shadow: 0 0 0 3px rgba(43,85,150,.12); }
.filters__count { margin: .7rem 0 0; font-size: .86rem; color: var(--muted); }
.filters__count b { color: var(--navy-800); }

/* ---------- Indicadores ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--navy-800); }
.kpi--voice::before { background: var(--cyan-dk); } .kpi--body::before { background: var(--coral); } .kpi--alert::before { background: var(--st-mruim); }
.kpi__label { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); }
.kpi__value { display: block; font: 800 2rem/1.2 var(--font-display); color: var(--navy-800); margin: .25rem 0 .1rem; }
.kpi__sub { font-size: .8rem; color: var(--muted); }

/* ---------- Gráficos ---------- */
.charts { display: grid; gap: 1rem; }
.charts--2-1 { grid-template-columns: 2fr 1fr; }
.charts--3 { grid-template-columns: repeat(3, 1fr); }
.charts--1-2 { grid-template-columns: 1fr 1.2fr; }
.charts .card { margin-bottom: 1rem; }
.chart-card__head { margin-bottom: .8rem; }
.chart-card__head h2 { font-size: 1.02rem; color: var(--navy-800); }
.chart-card__head p { margin: .15rem 0 0; font-size: .84rem; color: var(--muted); }
.chart-card__head--row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.chart-card__head--row > div:first-child { flex: 1; min-width: 220px; }
.chart-box { position: relative; width: 100%; }
.chart-box--md { height: 270px; }
.chart-box--tall { height: 620px; }
.sortsel { flex-direction: row; align-items: center; gap: .5rem; text-transform: none; letter-spacing: 0; font-size: .85rem; }

.seg { display: inline-flex; background: var(--bg); border-radius: 999px; padding: 4px; }
.seg__btn { border: 0; background: transparent; padding: .45rem .95rem; border-radius: 999px; font: 600 .85rem var(--font-display); color: var(--muted); cursor: pointer; }
.seg__btn.is-on { background: #fff; color: var(--navy-800); box-shadow: 0 2px 8px -3px rgba(11,42,85,.3); }

.toplist { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.toplist li { display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .7rem; align-items: center; }
.toplist .tl-q { font: 700 .78rem var(--font-display); padding: .2rem .5rem; border-radius: 6px; color: #fff; }
.toplist .tl-q--vocal { background: var(--cyan-dk); } .toplist .tl-q--fisica { background: var(--coral-dk); }
.toplist .tl-text { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toplist .tl-pct { font: 700 .88rem var(--font-display); color: var(--navy-800); }
.toplist .tl-bar { grid-column: 2 / 4; height: 6px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.toplist .tl-bar span { display: block; height: 100%; border-radius: 4px; background: #D9482B; }

/* ---------- Tabela ---------- */
.search { width: min(320px, 100%); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font: 700 .76rem var(--font-display); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .6rem .7rem; border-bottom: 2px solid var(--line); white-space: nowrap; }
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]:hover { color: var(--navy-800); }
.table th.is-asc::after { content: " ▲"; } .table th.is-desc::after { content: " ▼"; }
.table td { padding: .65rem .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table--click tbody tr { cursor: pointer; transition: background .15s; }
.table--click tbody tr:hover { background: #F2F6FC; }
.tag { display: inline-block; padding: .1rem .45rem; margin: 0 .2rem .2rem 0; border-radius: 6px; background: var(--bg); font-size: .74rem; font-weight: 700; color: var(--navy-500); }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .55rem; border-radius: 999px; font: 700 .78rem var(--font-display); white-space: nowrap; }
.pill i { width: 8px; height: 8px; border-radius: 50%; }
.pill--otima { background: #E3F5EF; color: #0B7A5E; } .pill--otima i { background: var(--st-otima); }
.pill--boa { background: #E6EFFB; color: #1F5FA8; } .pill--boa i { background: var(--st-boa); }
.pill--ruim { background: #FDF1E1; color: #A3610F; } .pill--ruim i { background: var(--st-ruim); }
.pill--muito-ruim { background: #FDECEC; color: #B32A2F; } .pill--muito-ruim i { background: var(--st-mruim); }
.num { font-family: var(--font-display); font-weight: 700; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-top: .9rem; font-size: .85rem; color: var(--muted); }
.pager div { display: flex; gap: .4rem; }

/* ---------- Estados ---------- */
.state { text-align: center; padding: 3rem 1rem; background: #fff; border-radius: var(--radius); border: 1px dashed var(--line); color: var(--muted); margin-bottom: 1rem; }
.state b { display: block; font: 700 1.2rem var(--font-display); color: var(--navy-800); margin-bottom: .3rem; }

/* ---------- Modal ---------- */
.modal { width: min(820px, 100% - 2rem); max-height: 90vh; border: 0; border-radius: 22px; padding: 0; box-shadow: 0 40px 80px -20px rgba(0,0,0,.45); }
.modal::backdrop { background: rgba(6,26,56,.55); backdrop-filter: blur(3px); }
.modal__head { display: flex; justify-content: space-between; gap: 1rem; padding: 1.3rem 1.5rem 1rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal__head h2 { font-size: 1.35rem; color: var(--navy-800); }
.modal__close { border: 0; background: var(--bg); width: 36px; height: 36px; border-radius: 50%; font-size: 1.4rem; cursor: pointer; color: var(--navy-800); }
.modal__scores { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; padding: 1rem 1.5rem 0; }
.modal__scores div { background: var(--bg); border-radius: 14px; padding: .8rem 1rem; }
.modal__scores span { display: block; font-size: .78rem; font-weight: 700; color: var(--muted); }
.modal__scores b { font: 800 1.4rem var(--font-display); color: var(--navy-800); margin-right: .4rem; }
.modal__body { padding: 1rem 1.5rem; }
.modal__body h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; margin: 1rem 0 .5rem; }
.modal__body h3.v { color: #0E8C9B; } .modal__body h3.f { color: var(--coral-dk); }
.ans { display: grid; grid-template-columns: 2.2rem 1fr auto; gap: .6rem; align-items: start; padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.ans b { font-family: var(--font-display); color: var(--navy-500); }
.ans em { font-style: normal; font: 700 .8rem var(--font-display); padding: .15rem .5rem; border-radius: 6px; white-space: nowrap; }
.ans em.a0 { background: #DDF3F1; color: #0B6E62; } .ans em.a1 { background: #EEF6F5; color: #2E6C65; }
.ans em.a2 { background: #FCEDE7; color: #9C3F25; } .ans em.a3 { background: #F9D8CE; color: #8E2A12; }
.modal__foot { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 1.5rem 1.3rem; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff; }

.confirm { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(6,26,56,.5); }
.confirm__box { background: #fff; border-radius: 18px; padding: 1.4rem; width: min(380px, 100% - 2rem); box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); }
.confirm__box p { margin: 0 0 1.1rem; font-weight: 700; }
.confirm__box div { display: flex; justify-content: flex-end; gap: .6rem; }

.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 150%); background: var(--navy-800); color: #fff; padding: .75rem 1.2rem; border-radius: 12px; font-weight: 700; transition: transform .35s; z-index: 70; }
.toast.is-on { transform: translate(-50%, 0); }

/* ---------- Login / instalação ---------- */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: radial-gradient(900px 500px at 85% 10%, rgba(46,196,214,.2), transparent 60%), linear-gradient(160deg, var(--navy-900), var(--navy-800)); }
.auth__card { width: min(420px, 100%); background: #fff; border-radius: 24px; padding: 2rem; box-shadow: 0 40px 80px -30px rgba(0,0,0,.6); }
.auth__card h1 { font-size: 1.5rem; color: var(--navy-800); margin: .5rem 0 .3rem; }
.auth__logo { width: 90px; display: block; }
.auth__back { display: block; text-align: center; margin-top: 1rem; font-size: .88rem; color: var(--muted); }
.form { display: grid; gap: .85rem; margin-top: 1.2rem; }
.form label { text-transform: none; letter-spacing: 0; font-size: .85rem; color: var(--navy-800); }
.form input { padding: .7rem .85rem; }
.alert { padding: .75rem 1rem; border-radius: 12px; background: var(--bg); font-weight: 700; font-size: .9rem; margin: 1rem 0 0; }
.alert--err { background: #FDECEC; color: #B32A2F; }
.alert--ok { background: #E3F5EF; color: #0B7A5E; }
code { background: var(--bg); padding: .1rem .35rem; border-radius: 5px; }
.grid2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1rem; align-items: start; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .filters__grid { grid-template-columns: repeat(3, 1fr); }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .charts--2-1, .charts--3, .charts--1-2, .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .filters__grid, .kpis { grid-template-columns: 1fr 1fr; }
  .topbar__brand small { display: none; }
  .modal__scores { grid-template-columns: 1fr; }
  .chart-box--tall { height: 760px; }
}

.alert--warn { background: #FDF1E1; color: #8A520C; margin: 0 0 1rem; }
.alert--warn a { color: inherit; }
.card--accent { border-color: #BFE9EF; box-shadow: 0 0 0 3px rgba(46,196,214,.15), var(--shadow); }
@media (max-width: 640px) {
  .topbar__in { flex-direction: column; align-items: flex-start; gap: .4rem; }
  .topbar__nav a { padding: .4rem .65rem; font-size: .85rem; }
  .page__head { align-items: flex-start; }
  .page__actions { flex-wrap: wrap; }
  .chart-card__head--row .seg, .chart-card__head--row .sortsel { width: 100%; }
  .card { padding: 1rem; }
}
.filters__grid input, .filters__grid select { width: 100%; }
@media (max-width: 640px) {
  .filters__grid label { min-width: 0; }
  .filters__grid input[type="date"] { font-size: .85rem; padding: .5rem .45rem; }
  .page__title { font-size: 1.45rem; }
}

/* ---------- Seleção e exclusão ---------- */
.col-check { width: 36px; }
.col-check input { width: 18px; height: 18px; accent-color: var(--navy-800); cursor: pointer; }
.col-act { width: 44px; text-align: right; }
.trash { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 9px; color: #9AA6B8; cursor: pointer; display: inline-grid; place-items: center; }
.trash svg { width: 18px; height: 18px; }
.trash:hover { background: #FDECEC; color: #C7353A; }
.table tbody tr.is-sel { background: #EEF4FD; }
.bulkbar { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; padding: .7rem .9rem; margin-bottom: .8rem; border-radius: 12px; background: #FDF1F1; border: 1px solid #F6C9CA; }
.bulkbar span { font-weight: 700; color: #8E2A2E; flex: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
