/* ============================================================================
   Painel Admin NPS — EasyNPS
   ============================================================================ */
@font-face {
    font-family: 'Rubik';
    src: url('../../fonts/Rubik-VariableFont_wght.ttf') format('truetype');
    font-weight: 300 900; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Rubik';
    src: url('../../fonts/Rubik-Italic-VariableFont_wght.ttf') format('truetype');
    font-weight: 300 900; font-style: italic; font-display: swap;
}
:root {
    --rosa: #403ADD;
    --rosa-dark: #322bb0;
    --rosa-soft: #d9d7f7;
    --rosa-tint: #f4f3fd;
    --ink: #1d1d1b;
    --ink-soft: #5b5b66;
    --line: #e7e7ee;
    --bg: #f7f7fa;
    --white: #fff;
    --promoter: #12B886;
    --passive: #9A8C84;
    --detractor: #E2554A;
    --promoter-bg: #d8f3e9;
    --passive-bg: #efeae5;
    --detractor-bg: #fceae8;
    --radius: 14px;
    --shadow: 0 2px 14px rgba(64,58,221,.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}
a { color: var(--rosa-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Topbar ---- */
.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--line);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-brand {
    font-family: 'Rubik', sans-serif;
    font-size: 19px;
    font-weight: 500;
    color: var(--rosa);
    display: flex;
    align-items: center;
    gap: 10px;
}
.topbar-logo { height: 30px; width: auto; display: block; }
.topbar-tag { font-size: 11px; font-weight: 500; color: var(--ink-soft); background: var(--rosa-tint); padding: 3px 9px; border-radius: 999px; letter-spacing: .05em; }
.topbar-brand small { color: var(--ink-soft); font-weight: 400; font-size: 12px; }
.menu-toggle {
    display: none; background: none; border: none; color: var(--ink);
    cursor: pointer; padding: 6px; border-radius: 8px; align-items: center; justify-content: center;
}
.menu-toggle:hover { background: var(--rosa-tint); }
.topbar-user { font-size: 13px; color: var(--ink-soft); display: flex; align-items: center; gap: 14px; }

/* ---- Layout ---- */
.shell { display: flex; min-height: calc(100vh - 60px); position: relative; }
.sidebar {
    width: 220px;
    background: var(--white);
    border-right: 1px solid var(--line);
    padding: 18px 0;
    flex-shrink: 0;
}
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 60px; left: 0; right: 0; bottom: 0;
    background: rgba(42,34,38,0.4);
    z-index: 40;
}
.sidebar-overlay.show { display: block; }

/* No mobile: sidebar vira menu deslizante */
@media (max-width: 899px) {
    .menu-toggle { display: inline-flex; }
    .sidebar {
        position: fixed;
        top: 60px; left: 0; bottom: 0;
        z-index: 45;
        transform: translateX(-100%);
        transition: transform .28s cubic-bezier(.4,0,.2,1);
        box-shadow: 4px 0 24px rgba(160,90,95,.12);
    }
    .sidebar.open { transform: translateX(0); }
    .topbar-username { display: none; }
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 24px;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all .15s;
}
.nav-item:hover { background: var(--rosa-tint); text-decoration: none; color: var(--ink); }
.nav-item.active { color: var(--rosa); border-left-color: var(--rosa); background: var(--rosa-tint); }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #bbb; padding: 16px 24px 6px; }

.content { flex: 1; padding: 28px 32px; max-width: 1100px; }
.page-title { font-family: 'Rubik', sans-serif; font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.page-sub { color: var(--ink-soft); font-size: 14px; margin-bottom: 24px; }

/* ---- Cards / boxes ---- */
.card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--ink); }

/* ---- Botões ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--rosa);
    color: var(--white);
    border: none;
    border-radius: 10px;
    padding: 11px 20px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.btn:hover { background: var(--rosa-dark); text-decoration: none; color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-danger { background: var(--detractor); }
.btn-danger:hover { background: #a93b2e; }

/* ---- Formulários ---- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field input, .field select, .field textarea {
    width: 100%;
    border: 1.5px solid var(--line);
    border-radius: 9px;
    padding: 11px 13px;
    font-family: inherit;
    font-size: 14px;
    color: var(--ink);
    background: var(--white);
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--rosa); box-shadow: 0 0 0 3px var(--rosa-soft);
}
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }
.help { font-size: 12px; color: var(--ink-soft); margin-top: 5px; }

/* ---- Tabelas ---- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); padding: 10px 12px; border-bottom: 2px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: var(--rosa-tint); }

/* ---- Badges / tags ---- */
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.tag-promotor { background: var(--promoter-bg); color: var(--promoter); }
.tag-passivo { background: var(--passive-bg); color: var(--passive); }
.tag-detrator { background: var(--detractor-bg); color: var(--detractor); }
.tag-ativo { background: var(--promoter-bg); color: var(--promoter); }
.tag-pendente { background: #fff3e0; color: #b8740c; }
.tag-inativo { background: #eee; color: #999; }

/* ---- Alertas ---- */
.alert { padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 18px; }
.alert-ok { background: var(--promoter-bg); color: #1d6e54; }
.alert-err { background: var(--detractor-bg); color: #a93b2e; }
.alert-info { background: #e7f0fb; color: #2c5d96; }

/* ---- Métricas / NPS ---- */
.metrics { display: grid; grid-template-columns: 1.1fr 1.4fr; gap: 24px; align-items: center; }
@media (max-width: 760px) { .metrics { grid-template-columns: 1fr; } }
.gauge-wrap { text-align: center; }
.gauge-status { font-size: 14px; color: var(--ink-soft); margin-top: 6px; font-weight: 500; }
.cat-cards { display: flex; flex-direction: column; gap: 10px; }
.cat { padding: 14px 18px; border-radius: 10px; display: flex; align-items: center; justify-content: space-between; }
.cat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.cat-pct { font-size: 24px; font-weight: 700; }
.cat-count { font-size: 12px; color: var(--ink-soft); }
.cat-promotor { background: var(--promoter-bg); } .cat-promotor .cat-label, .cat-promotor .cat-pct { color: var(--promoter); }
.cat-passivo { background: var(--passive-bg); } .cat-passivo .cat-label, .cat-passivo .cat-pct { color: var(--passive); }
.cat-detrator { background: var(--detractor-bg); } .cat-detrator .cat-label, .cat-detrator .cat-pct { color: var(--detractor); }

/* ---- Ranking bars ---- */
.rank-row { display: grid; grid-template-columns: 160px 1fr 50px 80px; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rank-row:last-child { border: 0; }
.rank-name { font-size: 14px; font-weight: 500; }
.rank-bar { height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; position: relative; }
.rank-bar::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 1.5px; background: rgba(0,0,0,0.12); transform: translateX(-50%); z-index: 1; }
.rank-fill { height: 100%; border-radius: 5px; position: relative; }
.rank-score { font-weight: 700; text-align: right; }
.rank-count { font-size: 12px; color: var(--ink-soft); text-align: right; }

/* ---- Filtros ---- */
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 22px; }
.filters .field { margin: 0; min-width: 150px; }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--rosa-tint); }
.login-box { background: var(--white); border-radius: 18px; padding: 38px; max-width: 400px; width: 100%; box-shadow: 0 8px 40px rgba(160,90,95,.12); }
.login-brand { font-family: 'Rubik', sans-serif; font-size: 26px; color: var(--rosa); text-align: center; margin-bottom: 4px; }
.login-logo { display: block; height: 60px; width: auto; margin: 0 auto 14px; }
.login-sub { text-align: center; color: var(--ink-soft); font-size: 13px; margin-bottom: 26px; }

.empty { text-align: center; color: var(--ink-soft); padding: 40px 0; font-style: italic; }
.qr-preview { max-width: 200px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #fff; }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--ink-soft); font-size: 13px; }
.comment-item { padding: 12px 14px; border-radius: 10px; border-left: 3px solid var(--line); background: var(--rosa-tint); margin-bottom: 10px; }
.comment-item.detrator { border-color: var(--detractor); background: var(--detractor-bg); }
.comment-item.promotor { border-color: var(--promoter); }
.comment-item.passivo { border-color: var(--passive); }
.comment-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-soft); margin-bottom: 5px; }

/* ---- Powered by Coop ---- */
.powered-by {
    text-align: center;
    padding: 18px 16px 24px;
    font-family: 'Rubik', sans-serif;
    font-weight: 700;
    font-size: 11px;
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-top: 1px solid var(--line);
    background: var(--white);
}
.powered-logo { height: 18px !important; max-height: 18px !important; width: auto !important; display: inline-block; vertical-align: middle; }

/* ---- Boxes de NPS por loja (clicáveis) ---- */
.loja-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.loja-box {
    display: block; background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 18px; transition: border-color .15s, transform .12s;
    text-decoration: none; color: inherit;
}
.loja-box:hover { border-color: var(--rosa); transform: translateY(-2px); text-decoration: none; }
.loja-box-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.loja-box-nome { font-size: 14px; font-weight: 500; color: var(--ink); }
.loja-box-nps { font-size: 30px; font-weight: 700; line-height: 1; }
.loja-box-total { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.loja-box-dist { display: flex; height: 7px; border-radius: 4px; overflow: hidden; margin-top: 12px; background: var(--bg); }
.loja-box-dist span { display: block; height: 100%; }
.loja-box-legend { display: flex; gap: 12px; margin-top: 9px; font-size: 11px; color: var(--ink-soft); }
.loja-box-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }

/* ---- Perfil do cliente ---- */
.cli-tags { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0; }
.cli-row { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.cli-row:last-child { border: 0; }
.cli-row .lbl { color: var(--ink-soft); font-size: 13px; }
.resp-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.resp-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { padding: 10px 16px; font-size: 14px; font-weight: 500; color: var(--ink-soft); cursor: pointer; border-bottom: 2px solid transparent; background: none; border-top: 0; border-left: 0; border-right: 0; font-family: inherit; }
.tab.active { color: var(--rosa); border-bottom-color: var(--rosa); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Ranking de vendedora clicável ---- */
a.rank-row { text-decoration: none; color: inherit; cursor: pointer; transition: background .12s; border-radius: 8px; }
a.rank-row:hover { background: var(--rosa-tint); text-decoration: none; }
a.rank-row:hover .rank-name { color: var(--rosa-dark); }

/* ---- Gráfico de evolução no tempo (Relatórios) ---- */
.evo-chart { display: flex; align-items: flex-end; gap: 10px; overflow-x: auto; padding: 6px 2px; }
.evo-col { flex: 1 0 44px; min-width: 44px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.evo-val { font-size: 12px; font-weight: 700; color: var(--ink); }
.evo-track { width: 100%; height: 140px; position: relative; background: linear-gradient(to bottom, transparent calc(50% - 1px), var(--line) calc(50%), transparent calc(50% + 1px)); border-radius: 6px; }
.evo-bar { position: absolute; left: 22%; right: 22%; border-radius: 4px; min-height: 2px; }
.evo-bar-pos { bottom: 50%; }
.evo-bar-neg { top: 50%; }
.evo-rotulo { font-size: 11px; color: var(--ink-soft); white-space: nowrap; }

/* ---- Modo TV: overlay de nova avaliação ---- */
.nps-toast {
    display: none; position: fixed; inset: 0; z-index: 9999;
    align-items: center; justify-content: center; text-align: center;
    background: rgba(208,103,106,0.96); color: #fff; padding: 24px;
}
.nps-toast.show { display: flex; animation: nps-toast-fade 5s ease forwards; }
.nps-toast-kicker { font-size: clamp(22px, 5vw, 52px); font-weight: 600; letter-spacing: .18em; text-transform: uppercase; opacity: .92; }
.nps-toast-loja { font-family: 'Rubik', sans-serif; font-size: clamp(40px, 11vw, 130px); font-weight: 700; line-height: 1.05; margin-top: 10px; }
@keyframes nps-toast-fade {
    0%   { opacity: 0; transform: scale(.94); }
    8%   { opacity: 1; transform: scale(1); }
    88%  { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.02); }
}

/* ---- Cabeçalho de impressão (só aparece no PDF) ---- */
.rel-print-head { display: none; }

/* ---- Impressão / Exportar PDF ---- */
@media print {
    .topbar, .sidebar, .sidebar-overlay, .menu-toggle, .powered-by,
    .filters, .no-print, .btn { display: none !important; }
    body { background: #fff; }
    .shell { display: block; min-height: 0; }
    .content { max-width: none; padding: 0; }
    .rel-print-head { display: block; margin-bottom: 18px; }
    .card { box-shadow: none; border-color: #ddd; break-inside: avoid; page-break-inside: avoid; }
    a.rank-row, .loja-box { color: inherit !important; }
    .comment-item { break-inside: avoid; }
}
