/* =============================================================================
   TCR PARTNERS — Dashboard Gerencial  |  styles.css
   Identidade: escuro + dourado (mesma marca do site institucional)
============================================================================= */
:root {
  --black: #0D0F14;
  --panel: #14171F;
  --panel-2: #1B1F29;
  --panel-3: #222735;
  --line: #2A303C;
  --gold: #C9A24B;
  --gold-deep: #B8932E;
  --bronze: #8B6F2E;
  --beige: #EDE4CE;
  --text: #E9EBF0;
  --text-2: #A6ACBB;
  --text-3: #6F7686;
  --green: #58B48A;
  --red: #D9736B;
  --blue: #7C9CBF;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 30px rgba(0,0,0,0.35);
  --sidebar-w: 236px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #171b24 0%, var(--black) 55%) fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
h1,h2,h3,h4 { font-family: 'Poppins', sans-serif; font-weight: 600; letter-spacing: .2px; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2c3340; border-radius: 20px; }
::-webkit-scrollbar-track { background: transparent; }

/* ===================== LOGIN ===================== */
.login-screen {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(900px 500px at 50% -10%, #1a1f2a, var(--black));
}
.login-card {
  width: 380px; max-width: 92vw;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 16px;
  padding: 38px 34px; box-shadow: var(--shadow); text-align: center;
}
.login-card img { height: 54px; margin-bottom: 18px; }
.login-card h2 { font-size: 18px; margin-bottom: 4px; }
.login-card p { color: var(--text-2); font-size: 12.5px; margin-bottom: 24px; }
.login-card label { display: block; text-align: left; font-size: 12px; color: var(--text-2); margin: 12px 0 6px; }
.login-card input, .login-card select {
  width: 100%; background: var(--black); border: 1px solid var(--line);
  color: var(--text); border-radius: var(--radius-sm); padding: 11px 13px; font-size: 14px;
}
.login-card input:focus, .login-card select:focus { outline: none; border-color: var(--gold); }
.btn-gold {
  width: 100%; margin-top: 22px; padding: 12px;
  background: linear-gradient(135deg, var(--gold), var(--bronze));
  color: #14110a; font-weight: 700; border-radius: var(--radius-sm); font-size: 14px;
  transition: filter .2s, transform .1s;
}
.btn-gold:hover { filter: brightness(1.08); }
.btn-gold:active { transform: translateY(1px); }
.login-err { color: var(--red); font-size: 12.5px; margin-top: 12px; min-height: 16px; }
.login-hint { color: var(--text-3); font-size: 11px; margin-top: 18px; line-height: 1.6; }

/* ===================== LAYOUT ===================== */
.app { display: none; min-height: 100vh; }
.app.visible { display: block; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: linear-gradient(180deg, #10131a, #0c0e13);
  border-right: 1px solid var(--line); padding: 22px 14px; z-index: 40;
  display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; }
.brand img { height: 34px; }
.brand .bt { font-family: 'Poppins'; font-weight: 600; font-size: 15px; line-height: 1; }
.brand .bs { font-size: 9.5px; color: var(--gold); letter-spacing: 1.6px; text-transform: uppercase; margin-top: 3px; }
.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px;
  color: var(--text-2); font-size: 13.5px; font-weight: 500; transition: background .15s, color .15s;
}
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(201,162,75,.18), rgba(201,162,75,.03)); color: var(--gold); box-shadow: inset 2px 0 0 var(--gold); }
.sidebar-foot { margin-top: auto; padding: 12px 10px 2px; border-top: 1px solid var(--line); }
.sidebar-foot .who { font-size: 12px; color: var(--text); }
.sidebar-foot .role { font-size: 10.5px; color: var(--text-3); }
.logout { font-size: 11.5px; color: var(--text-3); margin-top: 8px; }
.logout:hover { color: var(--red); }

.main { margin-left: var(--sidebar-w); padding: 0 30px 60px; }

/* ===================== TOPBAR / FILTROS ===================== */
.topbar {
  position: sticky; top: 0; z-index: 30; margin: 0 -30px 24px; padding: 18px 30px;
  background: rgba(13,15,20,.82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap;
}
.topbar .title-wrap { margin-right: auto; }
.topbar h1 { font-size: 20px; }
.topbar .sub { color: var(--text-2); font-size: 12.5px; margin-top: 3px; }
.filter { display: flex; flex-direction: column; gap: 5px; }
.filter label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-3); }
.filter select {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 8px 12px; border-radius: 8px; font-size: 13px; min-width: 150px;
}
.filter select:focus { outline: none; border-color: var(--gold); }
.period-chip { font-size: 11.5px; color: var(--gold); background: rgba(201,162,75,.1); border: 1px solid rgba(201,162,75,.25); padding: 3px 10px; border-radius: 20px; align-self: center; }

/* ===================== KPI CARDS ===================== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.kpi {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden;
}
.kpi::after { content:''; position:absolute; right:-30px; top:-30px; width:90px; height:90px; background: radial-gradient(circle, rgba(201,162,75,.08), transparent 70%); }
.kpi .k-label { font-size: 11.5px; color: var(--text-2); text-transform: uppercase; letter-spacing: .6px; display: flex; align-items: center; gap: 7px; }
.kpi .k-label svg { width: 15px; height: 15px; color: var(--gold); }
.kpi .k-value { font-family: 'Poppins'; font-size: 25px; font-weight: 600; margin-top: 9px; letter-spacing: .3px; }
.kpi .k-value small { font-size: 14px; color: var(--text-2); font-weight: 500; }
.kpi .k-foot { display: flex; align-items: center; gap: 7px; margin-top: 9px; font-size: 12px; color: var(--text-3); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; padding: 1px 7px; border-radius: 20px; font-size: 11.5px; }
.delta.up { color: var(--green); background: rgba(88,180,138,.12); }
.delta.down { color: var(--red); background: rgba(217,115,107,.12); }
.delta.flat { color: var(--text-3); background: rgba(255,255,255,.05); }

/* ===================== CARDS / GRID ===================== */
.grid { display: grid; gap: 16px; margin-bottom: 22px; }
.g-2 { grid-template-columns: 2fr 1fr; }
.g-2eq { grid-template-columns: 1fr 1fr; }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
}
.card h3 { font-size: 14.5px; margin-bottom: 3px; }
.card .card-sub { font-size: 11.5px; color: var(--text-3); margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 210px; }
.chart-box.lg { height: 300px; }

/* ===================== TABELAS ===================== */
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th {
  text-align: left; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-3); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.t th.num, table.t td.num { text-align: right; }
table.t td { padding: 11px 12px; border-bottom: 1px solid rgba(42,48,60,.5); white-space: nowrap; }
table.t tbody tr { transition: background .12s; }
table.t tbody tr:hover { background: rgba(255,255,255,.02); }
table.t tbody tr.clickable { cursor: pointer; }
table.t tbody tr.clickable:hover { background: rgba(201,162,75,.06); }
.rank-badge { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 6px; background: var(--panel-3); font-size: 11px; font-weight: 700; color: var(--text-2); }
.rank-badge.top { background: linear-gradient(135deg, var(--gold), var(--bronze)); color: #14110a; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }

/* barra de progresso (metas) */
.bar { background: var(--panel-3); border-radius: 20px; height: 8px; overflow: hidden; min-width: 90px; }
.bar > span { display: block; height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--gold), var(--bronze)); }
.bar.ok > span { background: linear-gradient(90deg, #4ea87e, #58B48A); }
.bar.low > span { background: linear-gradient(90deg, #c76b62, #D9736B); }
.mini-num { font-variant-numeric: tabular-nums; }

/* funil */
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel-row { display: flex; align-items: center; gap: 14px; }
.funnel-bar { height: 40px; border-radius: 8px; display: flex; align-items: center; padding: 0 14px; color: #14110a; font-weight: 700; min-width: 60px; transition: width .4s; }
.funnel-meta { font-size: 12px; color: var(--text-2); }
.funnel-label { width: 120px; font-size: 12.5px; color: var(--text-2); flex: none; }

/* legenda unidades */
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; font-size: 12px; color: var(--text-2); }
.legend .li { display: flex; align-items: center; }

/* estados vazios */
.empty { text-align: center; color: var(--text-3); padding: 40px 10px; font-size: 13px; }

/* view switching */
.view { display: none; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* selo demo */
.demo-flag { position: fixed; bottom: 14px; right: 16px; z-index: 20; background: rgba(201,162,75,.12); border: 1px solid rgba(201,162,75,.3); color: var(--gold); font-size: 11px; padding: 6px 12px; border-radius: 20px; }

.section-title { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 16px; }
.section-title h2 { font-size: 17px; }
.section-title span { font-size: 12px; color: var(--text-3); }

.micro-hint { background: rgba(124,156,191,.08); border: 1px solid rgba(124,156,191,.2); color: var(--text-2); font-size: 12.5px; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .g-2, .g-2eq, .g-3 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; padding: 0 16px 60px; }
  .topbar { margin: 0 -16px 18px; padding: 14px 16px; }
  .kpi-grid { grid-template-columns: 1fr; }
}
