.sob-demand-shell {
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: 1680px;
  margin-left: auto;
  margin-right: auto;
  min-width: 0;
  overflow-x: hidden;
}

#sobDemanda,
#sobDemanda .panel,
#sobDemanda .tableWrap {
  max-width: 100%;
  min-width: 0;
}

body.sob-demanda-active {
  overflow-x: hidden;
}

body.sob-demanda-active main {
  width: 100%;
  max-width: none;
  overflow-x: hidden;
}

body.sob-demanda-active #sobDemanda.active {
  width: min(1680px, 100%);
  margin-left: auto;
  margin-right: auto;
}

#sobDemanda .tableWrap {
  overflow-x: auto;
}

.sob-demand-table {
  table-layout: fixed;
  min-width: 0;
}

.sob-demand-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.sob-demand-kpis .metric {
  border-left: 4px solid #1a5c9a;
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 8px 18px rgba(10, 40, 70, .06);
}

.sob-demand-kpis strong {
  display: block;
  font-size: 24px;
  color: #082b54;
}

.sob-demand-filters {
  display: grid;
  grid-template-columns: 1.4fr repeat(5, minmax(140px, 1fr)) auto;
  gap: 10px;
  align-items: center;
}

.sob-demand-filters input,
.sob-demand-filters select {
  height: 40px;
  border: 1px solid #c7d9ea;
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
}

.sob-demand-table th,
.sob-demand-table td {
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sob-demand-table th {
  text-transform: uppercase;
}

.sob-demand-desc {
  max-width: 170px;
  cursor: help;
}

.sob-status-cell {
  min-width: 0;
  width: 110px;
  text-align: center;
  font-weight: 700;
  color: #0d2440;
}

.sob-status-cell.ok {
  background: #83c486;
}

.sob-status-cell.warn {
  background: #ffd85a;
}

.sob-status-cell.bad {
  background: #d95045;
  color: #fff;
}

.sob-status-cell.muted {
  background: #eef3f8;
  color: #64748b;
}

.sob-status-cell.empty {
  background: #fff;
}

.sob-demand-detail {
  display: grid;
  gap: 12px;
}

.sob-demand-phases {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 10px;
}

.sob-demand-phase {
  border: 1px solid #c7d9ea;
  border-radius: 8px;
  padding: 10px;
  background: #f8fbff;
}

.sob-demand-phase b {
  display: block;
  color: #073763;
  margin-bottom: 4px;
}

.sob-phase-form {
  border: 1px solid #c7d9ea;
  border-radius: 8px;
  padding: 10px;
  background: #f8fbff;
}

.sob-phase-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  color: #073763;
  margin-bottom: 8px;
}

.sob-phase-head span {
  font-size: 12px;
  background: #e8f1fb;
  border-radius: 999px;
  padding: 4px 8px;
}

.sob-phase-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sob-phase-grid label {
  display: grid;
  gap: 4px;
  color: #52647a;
  font-size: 12px;
  font-weight: 700;
}

.sob-phase-grid input,
.sob-phase-grid select,
.sob-phase-grid textarea {
  width: 100%;
  border: 1px solid #c7d9ea;
  border-radius: 6px;
  padding: 8px;
  background: #fff;
  color: #10233f;
}

.sob-phase-grid input[readonly] {
  background: #eef4fa;
  color: #52647a;
}

.sob-phase-wide {
  grid-column: 1 / -1;
}

.sob-phase-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.sob-phase-actions button {
  border: 0;
  border-radius: 7px;
  padding: 9px 12px;
  background: #1a4f8f;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.sob-phase-actions button:disabled {
  background: #b8c6d6;
  cursor: not-allowed;
}

.sob-phase-actions [data-sob-edit-phase] {
  background: #0b6fa4;
}

.sob-demand-history {
  max-height: 240px;
  overflow: auto;
  border: 1px solid #d5e3f2;
  border-radius: 8px;
  background: #fff;
}

.sob-demand-history div {
  padding: 8px 10px;
  border-bottom: 1px solid #e8f0f8;
}

.sob-demand-flag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid #c7d9ea;
  border-radius: 8px;
  background: #f8fbff;
  font-weight: 700;
  color: #073763;
}

.sob-demand-flag input {
  width: 18px;
  height: 18px;
}

@media (max-width: 900px) {
  .sob-demand-filters {
    grid-template-columns: 1fr;
  }
}
