:root {
  --bg: #070A10; --bg-2: #0A0F18; --surface: #0C1422; --surface-2: #0F1B2E;
  --navy: #06264C; --line: #1A2638; --line-2: #2A3A52;
  --text: #F2F5FA; --text-2: #B8C3D3; --muted: #8C99AD; --accent: #7DB4FF; --ink: #06101F;
  --ok: #7FD6A8; --warn: #F2B84B; --bad: #F28B82;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: 'Barlow', system-ui, sans-serif; font-size: 15px; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.erro { color: var(--bad); margin: 0; }

.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--line-2); background: transparent; text-decoration: none; color: var(--text); font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn.primary { background: var(--accent); color: var(--ink); border-color: var(--accent); }
input, select, textarea { background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; padding: 9px 12px; min-height: 40px; }
textarea { width: 100%; resize: vertical; }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px; display: flex; flex-direction: column; gap: 12px; }
.login-card img { align-self: flex-start; }
.login-card h1 { margin: 8px 0; font-family: 'Barlow Condensed', sans-serif; text-transform: uppercase; font-size: 30px; }

.app { display: flex; min-height: 100vh; }
.side { width: 220px; flex: 0 0 220px; background: var(--bg-2); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 600; padding: 0 8px; }
.logo img { height: 24px; width: auto; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.side nav button { text-align: left; background: transparent; border: 0; border-radius: 8px; padding: 10px 12px; cursor: pointer; color: var(--text-2); display: flex; justify-content: space-between; align-items: center; }
.side nav button:hover { background: var(--surface); color: var(--text); }
.side nav button.on { background: var(--surface-2); color: var(--text); }
.badge { background: var(--accent); color: var(--ink); border-radius: 99px; font-size: 12px; font-weight: 700; padding: 1px 8px; }
.badge:empty { display: none; }
.sair { margin-top: auto; background: transparent; border: 1px solid var(--line-2); border-radius: 8px; padding: 9px; cursor: pointer; color: var(--muted); }

.main { flex: 1 1 auto; min-width: 0; padding: 24px 28px 48px; }
.top { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.top h1 { margin: 0; font-family: 'Barlow Condensed', sans-serif; text-transform: uppercase; font-size: 32px; }
.tools { display: flex; gap: 10px; flex-wrap: wrap; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi b { font-family: 'Barlow Condensed', sans-serif; font-size: 40px; line-height: 1; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 14px; min-width: 0; }
.panel.flush { padding: 0; overflow-x: auto; }
.ph { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.ph h2 { margin: 0; font-size: 15px; font-weight: 600; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; }
.legend { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.l-v { background: #2E4A72; } .l-l { background: var(--accent); }

.chart { height: 200px; display: flex; align-items: flex-end; gap: 4px; }
.chart .day { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; position: relative; }
.chart .bar { width: 45%; max-width: 18px; border-radius: 3px 3px 0 0; min-height: 2px; }
.chart .v { background: #2E4A72; } .chart .l { background: var(--accent); }
.chart .day:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--bg); border: 1px solid var(--line-2); padding: 6px 8px; border-radius: 6px; font-size: 12px; white-space: nowrap; z-index: 2; }

.frow { display: grid; grid-template-columns: 150px 1fr 90px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 14px; }
.track { background: var(--bg); border-radius: 4px; height: 22px; overflow: hidden; }
.track span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.frow .n { text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--text-2); }
.pipe { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.pipe div { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.pipe b { display: block; font-family: 'Barlow Condensed', sans-serif; font-size: 26px; }
.pipe span { font-size: 12px; color: var(--muted); }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl.hover tbody tr { cursor: pointer; }
.tbl.hover tbody tr:hover { background: var(--surface-2); }
.tbl td.num { text-align: right; font-family: 'JetBrains Mono', monospace; }
.vazio { color: var(--muted); text-align: center; padding: 28px !important; }
.st { border-radius: 99px; padding: 2px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st-novo { background: rgba(125,180,255,.15); color: var(--accent); }
.st-em_contato { background: rgba(242,184,75,.15); color: var(--warn); }
.st-proposta { background: rgba(181,140,255,.15); color: #C9A8FF; }
.st-fechado { background: rgba(127,214,168,.15); color: var(--ok); }
.st-perdido { background: rgba(242,139,130,.12); color: var(--bad); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.filters input { flex: 1 1 280px; }

.drawer { position: fixed; top: 0; right: 0; width: min(440px, 100%); height: 100vh; overflow-y: auto; background: var(--bg-2); border-left: 1px solid var(--line-2); padding: 24px; display: flex; flex-direction: column; gap: 12px; z-index: 10; box-shadow: -30px 0 60px rgba(0,0,0,.5); }
.drawer h2 { margin: 0; font-family: 'Barlow Condensed', sans-serif; text-transform: uppercase; font-size: 28px; }
.drawer dl { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; margin: 0; }
.drawer dt { color: var(--muted); }
.drawer dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.fechar { align-self: flex-end; background: transparent; border: 1px solid var(--line-2); border-radius: 8px; width: 40px; height: 40px; cursor: pointer; }

@media (max-width: 800px) {
  .app { flex-direction: column; }
  .side { width: auto; flex: none; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .sair { margin-top: 0; margin-left: auto; }
  .main { padding: 18px 16px 40px; }
  .cols { grid-template-columns: 1fr; }
  .frow { grid-template-columns: 110px 1fr 70px; }
  .pipe { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
