/*
 * LicitAI — Cockpit Pré-Vendas
 * Camada visual isolada. Não altera regras de negócio nem outras páginas.
 */
#dashboard.cockpit-enabled {
  --cockpit-bg: #06131f;
  --cockpit-bg-soft: #091b2a;
  --cockpit-panel: #081a29;
  --cockpit-panel-2: #0a2031;
  --cockpit-border: #17344a;
  --cockpit-text: #edf8ff;
  --cockpit-muted: #8fa9bc;
  --cockpit-blue: #1788e8;
  --cockpit-cyan: #23b7e5;
  --cockpit-green: #58c95a;
  --cockpit-yellow: #f2cf22;
  --cockpit-orange: #f47b20;
  --cockpit-red: #ef4040;
  --cockpit-purple: #a94be8;
  background: var(--cockpit-bg) !important;
  color: var(--cockpit-text) !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  min-height: calc(100vh - 72px);
  overflow: visible;
}

#dashboard.cockpit-enabled > :not(#licitaiCockpitDashboard):not(script) {
  display: none !important;
}

#licitaiCockpitDashboard,
#licitaiCockpitDashboard * {
  box-sizing: border-box;
}

#licitaiCockpitDashboard {
  width: 100%;
  min-width: 0;
  padding: 12px;
  background:
    radial-gradient(circle at 72% 0%, rgba(25, 136, 232, .08), transparent 34%),
    linear-gradient(180deg, #05111c 0%, #071522 100%);
  color: var(--cockpit-text);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 13px;
}

.cockpit-header {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(520px, 1.7fr);
  gap: 18px;
  align-items: center;
  min-height: 76px;
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--cockpit-border);
}

.cockpit-title-block {
  min-width: 0;
  padding-left: 4px;
  border-left: 3px solid var(--cockpit-blue);
}

.cockpit-eyebrow {
  margin: 0 0 3px;
  color: var(--cockpit-cyan);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
}

.cockpit-title-block h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(18px, 1.8vw, 26px);
  line-height: 1.05;
  letter-spacing: .02em;
  font-weight: 750;
}

.cockpit-title-block p {
  margin: 5px 0 0;
  color: #b7c9d7;
  font-size: 12px;
}

.cockpit-update {
  min-width: 130px;
  padding-left: 16px;
  border-left: 1px solid var(--cockpit-border);
}

.cockpit-update span {
  display: block;
  margin-bottom: 4px;
  color: var(--cockpit-muted);
  font-size: 10px;
}

.cockpit-update strong {
  display: block;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.cockpit-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.cockpit-filters label span {
  display: block;
  margin: 0 0 5px;
  color: #c0d0dd;
  font-size: 10px;
  font-weight: 700;
}

.cockpit-filters select,
.cockpit-clear-button {
  width: 100%;
  min-height: 34px;
  border: 1px solid #345066;
  border-radius: 4px;
  outline: none;
  background: #081725;
  color: #e9f6ff;
  font: inherit;
}

.cockpit-filters select {
  padding: 0 30px 0 10px;
}

.cockpit-filters select:focus,
.cockpit-clear-button:focus-visible,
.cockpit-icon-button:focus-visible,
.cockpit-link-button:focus-visible {
  border-color: var(--cockpit-cyan);
  box-shadow: 0 0 0 3px rgba(35, 183, 229, .18);
}

.cockpit-clear-button {
  width: auto;
  min-width: 126px;
  padding: 0 14px;
  border-color: #1267b0;
  background: linear-gradient(180deg, #0870c8, #075aa3);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
}

.cockpit-clear-button:hover {
  filter: brightness(1.12);
}

.cockpit-notice {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid #6d5a19;
  border-radius: 6px;
  background: rgba(242, 207, 34, .1);
  color: #ffe98a;
}

.cockpit-metric-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(112px, 1fr)) repeat(2, minmax(145px, 1.25fr));
  gap: 8px;
  margin: 10px 0;
}

.cockpit-metric-card {
  position: relative;
  min-width: 0;
  min-height: 88px;
  padding: 10px 11px;
  overflow: hidden;
  border: 1px solid var(--cockpit-border);
  border-top: 2px solid var(--metric-color, var(--cockpit-blue));
  border-radius: 6px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--metric-color, var(--cockpit-blue)) 14%, transparent), transparent 60%),
    var(--cockpit-panel);
  box-shadow: inset 0 0 22px rgba(0,0,0,.12);
}

@supports not (background: color-mix(in srgb, red 20%, transparent)) {
  .cockpit-metric-card { background: var(--cockpit-panel); }
}

.cockpit-metric-card::after {
  content: attr(data-icon);
  position: absolute;
  right: 10px;
  bottom: 7px;
  color: var(--metric-color, var(--cockpit-blue));
  font-size: 26px;
  opacity: .9;
}

.cockpit-metric-card span {
  display: block;
  max-width: calc(100% - 22px);
  color: var(--metric-color, var(--cockpit-blue));
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.15;
}

.cockpit-metric-card strong {
  display: block;
  margin-top: 7px;
  color: #fff;
  font-size: 23px;
  line-height: 1;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cockpit-metric-card small {
  display: block;
  margin-top: 8px;
  color: #cad9e4;
  font-size: 10px;
}

.cockpit-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.cockpit-grid-top {
  grid-template-columns: 1.1fr 1.15fr .75fr 1fr;
}

.cockpit-grid-middle {
  grid-template-columns: 1.7fr 1fr;
}

.cockpit-grid-bottom {
  grid-template-columns: 1.35fr .72fr 1fr 1.08fr;
}

.cockpit-panel {
  min-width: 0;
  min-height: 190px;
  overflow: hidden;
  border: 1px solid var(--cockpit-border);
  border-radius: 6px;
  background: linear-gradient(180deg, var(--cockpit-panel-2), var(--cockpit-panel));
  box-shadow: 0 5px 18px rgba(0, 0, 0, .14);
}

.cockpit-panel-table {
  min-height: 260px;
}

.cockpit-panel-title {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--cockpit-border);
}

.cockpit-panel-title-actions {
  justify-content: space-between;
}

.cockpit-panel-title h2 {
  margin: 0;
  color: #f3f9fd;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .015em;
}

.cockpit-icon-button {
  width: 28px;
  height: 24px;
  border: 1px solid #345066;
  border-radius: 4px;
  background: #0b2335;
  color: #a9d8f5;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.cockpit-icon-button.is-loading {
  animation: cockpitSpin 1s linear infinite;
}

@keyframes cockpitSpin { to { transform: rotate(360deg); } }

.cockpit-chart-body {
  min-height: 150px;
  padding: 12px;
}

.cockpit-empty {
  display: grid;
  min-height: 120px;
  place-items: center;
  color: var(--cockpit-muted);
  text-align: center;
  font-size: 11px;
}

.cockpit-donut-layout {
  display: grid;
  grid-template-columns: 126px 1fr;
  gap: 14px;
  align-items: center;
  min-height: 145px;
}

.cockpit-donut {
  position: relative;
  width: 118px;
  height: 118px;
  margin: auto;
  border-radius: 50%;
  background: conic-gradient(var(--donut-stops, #315268 0 100%));
}

.cockpit-donut::after {
  content: "";
  position: absolute;
  inset: 24px;
  border-radius: inherit;
  background: #081a29;
  box-shadow: inset 0 0 12px rgba(0,0,0,.5);
}

.cockpit-donut-center {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
}

.cockpit-donut-center strong {
  color: #fff;
  font-size: 23px;
  line-height: 1;
}

.cockpit-donut-center span {
  margin-top: 5px;
  color: #c7d7e2;
  font-size: 10px;
}

.cockpit-legend {
  display: grid;
  gap: 7px;
}

.cockpit-legend-row {
  display: grid;
  grid-template-columns: 9px minmax(0,1fr) auto;
  gap: 7px;
  align-items: center;
  color: #d9e6ee;
  font-size: 10px;
}

.cockpit-legend-row i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--legend-color);
}

.cockpit-legend-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cockpit-legend-row b {
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.cockpit-bars {
  display: grid;
  gap: 10px;
}

.cockpit-bar-row {
  display: grid;
  grid-template-columns: minmax(105px, .9fr) minmax(100px, 1.5fr) auto;
  gap: 9px;
  align-items: center;
  min-width: 0;
}

.cockpit-bar-label {
  overflow: hidden;
  color: #d3e1eb;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cockpit-bar-track {
  height: 15px;
  overflow: hidden;
  border: 1px solid #1d3b50;
  border-radius: 2px;
  background: #06131f;
}

.cockpit-bar-fill {
  height: 100%;
  width: var(--bar-width, 0%);
  min-width: 0;
  background: var(--bar-color, var(--cockpit-blue));
  transition: width .35s ease;
}

.cockpit-bar-value {
  min-width: 58px;
  color: #eff9ff;
  font-size: 10px;
  text-align: right;
  white-space: nowrap;
}

.cockpit-gauge {
  position: relative;
  min-height: 150px;
  display: grid;
  place-items: center;
}

.cockpit-gauge svg {
  width: min(220px, 100%);
  height: 122px;
  overflow: visible;
}

.cockpit-gauge-label {
  position: absolute;
  left: 50%;
  top: 75px;
  transform: translate(-50%, -50%);
  text-align: center;
}

.cockpit-gauge-label strong {
  display: block;
  color: #fff;
  font-size: 25px;
  line-height: 1;
}

.cockpit-gauge-label span {
  display: block;
  margin-top: 6px;
  color: #c9d8e2;
  font-size: 10px;
}

.cockpit-gauge-scale {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 5px;
  display: flex;
  justify-content: space-between;
  color: #8fa9bc;
  font-size: 9px;
}

.cockpit-table-wrap {
  width: 100%;
  overflow: auto;
}

.cockpit-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  table-layout: auto;
}

.cockpit-table th,
.cockpit-table td {
  padding: 7px 8px;
  border-bottom: 1px solid #17344a;
  color: #d8e5ed;
  font-size: 10px;
  text-align: left;
  white-space: nowrap;
}

.cockpit-table th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: #0a2031;
  color: #c0d0dd;
  font-weight: 800;
}

.cockpit-table tbody tr:hover {
  background: rgba(23, 136, 232, .07);
}

.cockpit-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--status-color) 55%, transparent);
  border-radius: 3px;
  background: color-mix(in srgb, var(--status-color) 18%, transparent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
}

.cockpit-progress {
  display: inline-grid;
  grid-template-columns: 58px auto;
  gap: 5px;
  align-items: center;
}

.cockpit-progress-track {
  width: 58px;
  height: 7px;
  overflow: hidden;
  background: #243a49;
}

.cockpit-progress-track i {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  background: var(--cockpit-blue);
}

.cockpit-risk-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--risk-color, #8fa9bc);
  box-shadow: 0 0 8px color-mix(in srgb, var(--risk-color) 50%, transparent);
}

.cockpit-link-button {
  display: block;
  margin: 8px auto 10px;
  padding: 3px 12px;
  border: 0;
  background: transparent;
  color: var(--cockpit-cyan);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
}

.cockpit-timeline {
  padding: 10px;
}

.cockpit-timeline-head,
.cockpit-timeline-row {
  display: grid;
  grid-template-columns: 130px repeat(4, 1fr);
}

.cockpit-timeline-head > div,
.cockpit-timeline-row > div {
  min-height: 28px;
  padding: 6px;
  border-right: 1px solid #17344a;
  border-bottom: 1px solid #17344a;
  color: #cbdbe5;
  font-size: 9px;
}

.cockpit-timeline-head > div {
  background: #0a2031;
  color: #a9c0d0;
  font-weight: 800;
  text-align: center;
}

.cockpit-timeline-head > div:first-child,
.cockpit-timeline-row > div:first-child {
  text-align: left;
}

.cockpit-timeline-cell {
  position: relative;
  padding: 4px !important;
  background: #071522;
}

.cockpit-timeline-bar {
  display: grid;
  place-items: center;
  height: 19px;
  width: var(--stage-width, 0%);
  min-width: 0;
  border-radius: 1px;
  background: var(--stage-color, var(--cockpit-green));
  color: #fff;
  font-size: 9px;
  font-weight: 800;
}

.cockpit-line-chart svg {
  width: 100%;
  height: 150px;
  overflow: visible;
}

.cockpit-line-legend {
  display: flex;
  gap: 14px;
  margin-bottom: 5px;
  color: #c7d7e2;
  font-size: 9px;
}

.cockpit-line-legend i {
  display: inline-block;
  width: 12px;
  height: 3px;
  margin-right: 5px;
  vertical-align: middle;
  background: var(--line-color);
}

.cockpit-deadlines {
  padding: 8px 10px;
}

.cockpit-deadline-row {
  display: grid;
  grid-template-columns: 14px minmax(0,1fr) auto;
  gap: 7px;
  align-items: center;
  min-height: 27px;
  border-bottom: 1px solid #17344a;
}

.cockpit-deadline-row:last-child {
  border-bottom: 0;
}

.cockpit-deadline-row i {
  color: var(--deadline-color, var(--cockpit-muted));
  font-style: normal;
  font-size: 12px;
}

.cockpit-deadline-row span {
  overflow: hidden;
  color: #d8e5ed;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cockpit-deadline-row time {
  color: var(--deadline-color, #d8e5ed);
  font-size: 9px;
  font-weight: 700;
}

.cockpit-operational-kpis {
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--cockpit-border);
  border-radius: 6px;
  background: var(--cockpit-panel);
}

.cockpit-operational-card {
  position: relative;
  min-height: 76px;
  padding: 10px 12px;
  border-right: 1px solid var(--cockpit-border);
}

.cockpit-operational-card:last-child {
  border-right: 0;
}

.cockpit-operational-card span {
  display: block;
  color: #d6e3ec;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.cockpit-operational-card strong {
  display: block;
  margin-top: 8px;
  color: #fff;
  font-size: 20px;
  line-height: 1;
}

.cockpit-operational-card small {
  display: block;
  margin-top: 7px;
  color: #9cb1c1;
  font-size: 9px;
}

.cockpit-operational-card i {
  position: absolute;
  right: 12px;
  bottom: 12px;
  color: var(--kpi-color, var(--cockpit-blue));
  font-size: 25px;
  font-style: normal;
  opacity: .9;
}

@media (max-width: 1500px) {
  .cockpit-header { grid-template-columns: minmax(220px, .9fr) auto minmax(460px, 1.5fr); }
  .cockpit-metric-grid { grid-template-columns: repeat(5, minmax(130px, 1fr)); }
  .cockpit-grid-top { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .cockpit-grid-bottom { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .cockpit-operational-kpis { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
  .cockpit-operational-card:nth-child(4) { border-right: 0; }
  .cockpit-operational-card:nth-child(-n+4) { border-bottom: 1px solid var(--cockpit-border); }
}

@media (max-width: 1100px) {
  .cockpit-header { grid-template-columns: 1fr auto; }
  .cockpit-filters { grid-column: 1 / -1; }
  .cockpit-grid-middle { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  #licitaiCockpitDashboard { padding: 8px; }
  .cockpit-header { grid-template-columns: 1fr; gap: 10px; }
  .cockpit-update { padding: 8px 0 0; border-left: 0; border-top: 1px solid var(--cockpit-border); }
  .cockpit-filters { grid-template-columns: 1fr 1fr; }
  .cockpit-clear-button { width: 100%; }
  .cockpit-metric-grid,
  .cockpit-grid-top,
  .cockpit-grid-bottom { grid-template-columns: 1fr; }
  .cockpit-operational-kpis { grid-template-columns: 1fr 1fr; }
  .cockpit-operational-card,
  .cockpit-operational-card:nth-child(4) { border-right: 1px solid var(--cockpit-border); border-bottom: 1px solid var(--cockpit-border); }
  .cockpit-operational-card:nth-child(even) { border-right: 0; }
  .cockpit-donut-layout { grid-template-columns: 110px 1fr; }
  .cockpit-donut { width: 104px; height: 104px; }
  .cockpit-donut::after { inset: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  #licitaiCockpitDashboard * { transition: none !important; animation: none !important; }
}

/* LICITAI_DASHBOARD_REPAIR_20260714 */
body:has(#dashboard.cockpit-enabled) {
  overflow-x: hidden !important;
}

#dashboard.cockpit-enabled,
#licitaiCockpitDashboard {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
}

#licitaiCockpitDashboard {
  container-type: inline-size;
}

#licitaiCockpitDashboard > * {
  min-width: 0;
}

#licitaiCockpitDashboard .cockpit-header {
  grid-template-columns: minmax(250px, 1fr) auto minmax(0, 2fr);
}

#licitaiCockpitDashboard .cockpit-filters {
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(126px, auto);
}

#licitaiCockpitDashboard .cockpit-metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
}

#licitaiCockpitDashboard .cockpit-grid-top,
#licitaiCockpitDashboard .cockpit-grid-bottom {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

#licitaiCockpitDashboard .cockpit-grid-middle {
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr);
}

#licitaiCockpitDashboard .cockpit-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

#licitaiCockpitDashboard .cockpit-js-error {
  margin: 10px 0;
  padding: 12px;
  border: 1px solid #913443;
  border-radius: 6px;
  background: rgba(239, 64, 64, .12);
  color: #ffc5cd;
  font-size: 12px;
}

@container (max-width: 1050px) {
  #licitaiCockpitDashboard .cockpit-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #licitaiCockpitDashboard .cockpit-filters {
    grid-column: 1 / -1;
  }

  #licitaiCockpitDashboard .cockpit-grid-middle {
    grid-template-columns: minmax(0, 1fr);
  }
}

@container (max-width: 720px) {
  #licitaiCockpitDashboard .cockpit-header,
  #licitaiCockpitDashboard .cockpit-filters,
  #licitaiCockpitDashboard .cockpit-grid-top,
  #licitaiCockpitDashboard .cockpit-grid-bottom,
  #licitaiCockpitDashboard .cockpit-operational-kpis {
    grid-template-columns: minmax(0, 1fr);
  }
}
