:root{
  --bg:#f3f6ff;
  --panel:#ffffff;
  --panel2:#f7f9ff;
  --text:#0b1220;
  --muted:#475569;
  --line:rgba(15,23,42,.10);
  --primary:#2a77fd;        /* Azul Office Cont */
  --primary2:#375cfb;       /* variação */
  --danger:#dc2626;
  --ok:#14b8a6;
  --warn:#f59e0b;
  --shadow: 0 10px 30px rgba(2,6,23,.10);
  --shadow2: 0 8px 20px rgba(2,6,23,.08);
  --radius:16px;
  --radius2:22px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family:var(--font);
  background:
    radial-gradient(1200px 600px at 10% 10%, rgba(42,119,253,.14), transparent 55%),
    radial-gradient(900px 500px at 90% 20%, rgba(55,92,251,.10), transparent 60%),
    var(--bg);
  color:var(--text);
}

.topbar{
  position:sticky; top:0;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 18px;
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(12px);
  border-bottom:1px solid var(--line);
  z-index:10;
  gap:12px;
}

.brand{ display:flex; align-items:center; gap:12px; min-width: 280px; }
.logo{
  width:44px; height:44px; border-radius:14px;
  display:grid; place-items:center;
  background: linear-gradient(135deg, rgba(42,119,253,1), rgba(55,92,251,1));
  color: #fff;
  font-weight:800; letter-spacing:.5px;
  box-shadow: var(--shadow2);
}
.brand-text{ display:flex; flex-direction:column; gap:2px; }
.brand-text span{ color:var(--muted); font-size:13px; }

.tabs{ display:flex; gap:8px; flex-wrap:wrap; }
.tab{
  border:1px solid var(--line);
  background: rgba(255,255,255,.9);
  color: var(--text);
  padding:10px 12px;
  border-radius: 14px;
  cursor:pointer;
}
.tab:hover{ border-color: rgba(42,119,253,.35); }
.tab.active{
  background: rgba(42,119,253,1);
  border-color: rgba(42,119,253,.55);
  color: #fff;
}

.top-actions{ display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end; }

.container{ max-width:1200px; margin:18px auto; padding:0 18px 26px; }

.kpis{
  display:grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap:12px;
  margin-top:16px;
}
.kpis-3{ grid-template-columns: repeat(3, minmax(180px, 1fr)); }

.kpi{
  background: linear-gradient(180deg, rgba(255,255,255,1), rgba(247,249,255,1));
  border:1px solid var(--line);
  border-radius: var(--radius2);
  padding:14px 14px 12px;
  box-shadow: var(--shadow);
}
.kpi-title{ color:var(--muted); font-size:12px; letter-spacing:.2px; }
.kpi-value{ font-size:28px; font-weight:800; margin-top:6px; }
.kpi-sub{ color:var(--muted); font-size:12px; margin-top:4px; }

.filters{
  margin-top:14px;
  background: rgba(255,255,255,.9);
  border:1px solid var(--line);
  border-radius: var(--radius2);
  padding:12px;
  display:grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap:10px;
}

.field{ display:flex; flex-direction:column; gap:6px; }
label{ font-size:12px; color:var(--muted); }
input, select, textarea{
  border:1px solid var(--line);
  background: rgba(255,255,255,1);
  color: var(--text);
  border-radius: 14px;
  padding:10px 12px;
  outline:none;
  box-shadow: 0 0 0 rgba(0,0,0,0);
}
input:focus, select:focus, textarea:focus{
  border-color: rgba(42,119,253,.55);
  box-shadow: 0 0 0 4px rgba(42,119,253,.12);
}
textarea{ resize: vertical; }
.hint{ color: rgba(71,85,105,.95); font-size:11px; }
.muted{ color: var(--muted); }
.small{ font-size: 12px; }
.mt{ margin-top: 10px; }

.board{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:12px;
  margin-top:14px;
}
.col{
  background: rgba(255,255,255,.9);
  border:1px solid var(--line);
  border-radius: var(--radius2);
  overflow:hidden;
  min-height: 520px;
  box-shadow: var(--shadow);
}
.col-head{
  padding:12px 12px 10px;
  display:flex; align-items:center; justify-content:space-between;
  border-bottom:1px solid var(--line);
  background: rgba(247,249,255,1);
}
.col-head h3{ margin:0; font-size:14px; letter-spacing:.2px; }
.badge{
  font-size:12px;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  color: var(--muted);
  background: rgba(255,255,255,.9);
}
.col-body{ padding:10px; display:flex; flex-direction:column; gap:10px; }

.card{
  border:1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,1);
  padding:10px 10px 10px;
  cursor: grab;
  box-shadow: var(--shadow2);
}
.card:hover{ border-color: rgba(42,119,253,.28); }
.card:active{ cursor: grabbing; }
.card-top{ display:flex; justify-content:space-between; align-items:flex-start; gap:10px; }
.pill{
  font-size:11px;
  padding:3px 8px;
  border-radius:999px;
  border:1px solid var(--line);
  color: var(--muted);
  white-space:nowrap;
  background: rgba(247,249,255,1);
}
.pill.p1{ border-color: rgba(220,38,38,.25); color:#b91c1c; background: rgba(220,38,38,.06); }
.pill.p2{ border-color: rgba(245,158,11,.25); color:#92400e; background: rgba(245,158,11,.08); }
.pill.p3{ border-color: rgba(42,119,253,.28); color:#1e40af; background: rgba(42,119,253,.08); }
.pill.p4{ border-color: rgba(71,85,105,.22); color:#334155; background: rgba(71,85,105,.06); }

.card h4{ margin:8px 0 4px; font-size:13px; line-height:1.25; }
.meta{ display:flex; flex-wrap:wrap; gap:8px; color:var(--muted); font-size:11px; }
.meta strong{ color: var(--text); font-weight:700; }
.sep{ opacity:.55; }

.flag{
  font-size:11px;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid var(--line);
  background: rgba(247,249,255,1);
}
.flag.warn{ border-color: rgba(245,158,11,.35); color:#92400e; background: rgba(245,158,11,.10);}
.flag.danger{ border-color: rgba(220,38,38,.35); color:#991b1b; background: rgba(220,38,38,.08);}
.flag.ok{ border-color: rgba(20,184,166,.35); color:#0f766e; background: rgba(20,184,166,.10);}

.card-actions{
  margin-top:10px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.btn{
  border:1px solid var(--line);
  background: rgba(255,255,255,1);
  color: var(--text);
  padding:10px 12px;
  border-radius: 14px;
  cursor:pointer;
  transition: transform .05s ease, background .15s ease, border .15s ease, box-shadow .15s ease;
  box-shadow: 0 6px 16px rgba(2,6,23,.06);
}
.btn:hover{
  border-color: rgba(42,119,253,.28);
  box-shadow: 0 10px 22px rgba(2,6,23,.08);
}
.btn:active{ transform: translateY(1px); }
.btn-primary{
  background: linear-gradient(135deg, rgba(42,119,253,1), rgba(55,92,251,1));
  border-color: rgba(42,119,253,.55);
  color:#fff;
}
.btn-primary:hover{ filter: brightness(1.03); }
.btn-danger{
  background: rgba(220,38,38,1);
  border-color: rgba(220,38,38,.55);
  color:#fff;
}
.btn-ghost{ background: transparent; box-shadow: none; }
.btn-more{
  width: 100%;
  margin-top: 8px;
}

.icon-btn{
  border:1px solid var(--line);
  background: rgba(255,255,255,1);
  color: var(--text);
  width:38px; height:38px;
  border-radius: 12px;
  cursor:pointer;
  box-shadow: 0 6px 16px rgba(2,6,23,.06);
}
.icon-btn:hover{ border-color: rgba(42,119,253,.28); }

.modal{
  position:fixed; inset:0;
  display:none;
  background: rgba(2,6,23,.55);
  backdrop-filter: blur(6px);
  padding:18px;
}
.modal.show{ display:grid; place-items:center; }
.modal-card{
  width:min(920px, 100%);
  max-height: 92vh;
  overflow:auto;
  background: linear-gradient(180deg, rgba(255,255,255,1), rgba(247,249,255,1));
  border:1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.modal-card.modal-sm{ width:min(680px, 100%); }
.modal-head{
  position:sticky; top:0;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 14px;
  border-bottom:1px solid var(--line);
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(10px);
}
.modal-head h2{ margin:0; font-size:16px; }
form{ padding:14px; }
.modal-body{
  padding: 14px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.grid{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:10px;
}
.row{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.row-between{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.check{
  display:flex; gap:10px; align-items:center;
  user-select:none;
}
.divider{
  height:1px;
  background: var(--line);
  margin:14px 0;
}
.modal-actions{
  display:flex; align-items:center; gap:10px;
}
.spacer{ flex:1; }

.toast{
  position: fixed;
  left: 18px;
  bottom: 18px;
  background: rgba(255,255,255,.95);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 12px;
  color: var(--text);
  box-shadow: var(--shadow);
  display:none;
  max-width: min(520px, calc(100vw - 36px));
}
.toast.show{ display:block; }

/* ====== Métricas ====== */
.hidden{ display:none; }

.panel{
  margin-top: 16px;
  background: rgba(255,255,255,.92);
  border:1px solid var(--line);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
  padding: 14px;
}
.panel-head h2{ margin: 0 0 6px; font-size: 16px; }
.panel-head p{ margin: 0; }

.grid-metrics{
  margin-top: 10px;
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:10px;
}
.field-full{ grid-column: 1 / -1; }
.actions{
  grid-column: 1 / -1;
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top: 4px;
}

.field.compact{ min-width: 160px; }
.dash-charts{
  margin-top: 12px;
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}
.dash-grid{
  margin-top: 12px;
  display:grid;
  grid-template-columns: 1.2fr 1.2fr 1fr 1fr;
  gap: 12px;
}
.dash-card{
  background: rgba(255,255,255,1);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  box-shadow: var(--shadow2);
}
.chart-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 6px;
}
.chart-head h3{ margin:0; }
.chart-legend{
  display:flex;
  flex-wrap:wrap;
  gap:8px 12px;
  margin-bottom: 6px;
}
.legend-item{
  display:flex;
  align-items:center;
  gap:6px;
  font-size: 11px;
  color: var(--muted);
}
.legend-swatch{
  width: 18px;
  height: 4px;
  border-radius: 999px;
  background: var(--swatch, #2a77fd);
}
.chart-canvas{
  height: 220px;
}
.chart-svg{
  width: 100%;
  height: 100%;
  display:block;
}
.chart-grid-line{ stroke: rgba(2,6,23,.08); stroke-width:1; }
.chart-axis-text{ fill: var(--muted); font-size: 10px; }
.chart-axis-title{ fill: var(--muted); font-size: 11px; font-weight: 600; }
.chart-line{ fill:none; stroke-width:2.2; }
.chart-wave-area{ fill: rgba(42,119,253,.15); }
.chart-wave-line{ stroke:#2A77FD; stroke-width:2.2; fill:none; }
.wave-dot{
  fill: #2A77FD;
  stroke: #fff;
  stroke-width: 1.5;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
  transform-box: fill-box;
  transform-origin: center;
}
.wave-dot.empty{ opacity: .35; }
.wave-dot.active{ transform: scale(1.15); }
.wave-title{ font-size:12px; font-weight:600; }
.wave-item{
  display:flex;
  flex-direction:column;
  gap:2px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(2,6,23,.08);
  background: rgba(247,249,255,1);
}
.wave-item strong{ font-size:12px; }
.wave-item span{ font-size:11px; color: var(--muted); }
.dash-card h3{ margin:0 0 10px; font-size: 13px; }
.section-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:10px;
}
.filter-chip{
  border:1px solid rgba(42,119,253,.25);
  background: rgba(42,119,253,.08);
  color: #1e3a8a;
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: border .15s ease, background .15s ease, transform .05s ease;
}
.filter-chip:hover{ border-color: rgba(42,119,253,.5); }
.filter-chip:active{ transform: translateY(1px); }
.filter-chip:focus-visible{
  outline: 2px solid rgba(42,119,253,.6);
  outline-offset: 2px;
}
.mini-bars{ display:flex; flex-direction:column; gap:8px; }
.bar-row{
  display:flex; align-items:center; gap:10px;
}
.bar-row .lbl{ width: 140px; color: var(--muted); font-size:12px; }
.bar{
  flex:1;
  height: 10px;
  background: rgba(2,6,23,.06);
  border-radius: 999px;
  overflow:hidden;
  border:1px solid rgba(2,6,23,.06);
}
.bar > span{
  display:block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(42,119,253,1), rgba(55,92,251,1));
}
.bar-row .val,
.bar-row .bar-val{
  width: 80px;
  text-align:right;
  font-size: 14px;
  text-decoration: none;
  color: #5f63ed;
}
.bar-row .bar-val{
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.bar-row .bar-val:hover{ color: var(--text); }
.bar-row .bar-val:focus-visible{
  outline: 2px solid rgba(42,119,253,.6);
  outline-offset: 2px;
}
.bar-row.active .bar-val{ color: var(--text); font-weight: 700; }

.mini-list{ display:flex; flex-direction:column; gap:8px; }
.item{
  display:flex; justify-content:space-between; gap:10px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(2,6,23,.08);
  background: rgba(247,249,255,1);
}
.item strong{ font-size: 12px; }
.item span{ font-size: 12px; color: var(--muted); }

.table-wrap{ overflow:auto; border-radius: 16px; border: 1px solid rgba(2,6,23,.10); box-shadow: var(--shadow2); }
.table{
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  background: rgba(255,255,255,1);
}
.table th, .table td{
  padding: 10px;
  border-bottom: 1px solid rgba(2,6,23,.08);
  font-size: 12px;
  vertical-align: top;
}
.table th{ text-align:left; color:var(--muted); font-weight: 700; background: rgba(247,249,255,1); }
.tag{
  display:inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(2,6,23,.10);
  font-size: 11px;
}
.tag.bad{ border-color: rgba(220,38,38,.35); color:#991b1b; background: rgba(220,38,38,.08); }
.tag.warn{ border-color: rgba(245,158,11,.35); color:#92400e; background: rgba(245,158,11,.10); }
.tag.ok{ border-color: rgba(20,184,166,.35); color:#0f766e; background: rgba(20,184,166,.10); }

@media (max-width: 1080px){
  .kpis{ grid-template-columns: repeat(2, 1fr); }
  .filters{ grid-template-columns: 1fr 1fr; }
  .board{ grid-template-columns: 1fr 1fr; }
  .grid{ grid-template-columns: 1fr 1fr; }
  .grid-metrics{ grid-template-columns: 1fr 1fr; }
  .dash-charts{ grid-template-columns: 1fr; }
  .dash-grid{ grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px){
  .topbar{ align-items:flex-start; }
  .brand{ min-width: unset; }
  .board{ grid-template-columns: 1fr; }
  .grid{ grid-template-columns: 1fr; }
  .grid-metrics{ grid-template-columns: 1fr; }
  .dash-grid{ grid-template-columns: 1fr; }
}
