/* Flow Mode Layout — NORMA CODE (v1.0) */

/* Beta 2026-02-21: Ocultar elementos Flow cuando NO está activo */
body:not(.flow-mode) .flow-panel-wizard,
body:not(.flow-mode) .flow-panel-checklist,
body:not(.flow-mode) .flow-panel-missing,
body:not(.flow-mode) .flow-stage-card,
body:not(.flow-mode) #flowNav,
body:not(.flow-mode) .flow-dossier-panel,
body:not(.flow-mode) .flow-municipal-panel,
body:not(.flow-mode) #flowProfileBar,
body:not(.flow-mode) .flow-profile-bar {
  display: none !important;
}

body.flow-mode #mainNav {
  display: none;
}

body.flow-mode #flowNav {
  display: block;
}

body.flow-mode #progressStepperBar {
  display: none !important;
}

.flow-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.flow-nav-item .nav-text {
  flex: 1;
}

.flow-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.flow-profile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px 16px;
}

.flow-profile-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flow-form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flow-form-row label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.flow-input {
  width: 100%;
}

.flow-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.flow-mini-btn {
  padding: 6px 10px;
  font-size: 11px;
}

.flow-stage-editor {
  margin-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
}

.flow-stage-editor-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 6px;
}

.flow-stage-editor-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flow-stage-editor-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.flow-stage-editor-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.flow-stage-editor-actions {
  display: flex;
  gap: 6px;
}

.flow-stage-editor-btn {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  font-size: 10px;
  padding: 2px 6px;
  cursor: pointer;
}

.flow-stage-editor-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.flow-profile-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.flow-chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

.flow-cta {
  background: #2bd4a6;
  color: #0b0f14;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.flow-cta:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.flow-cta:active {
  transform: translateY(0);
}

.flow-stages {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.flow-stage {
  display: none;
}

.flow-stage.active {
  display: block;
}

.flow-stage-grid {
  display: grid;
  grid-template-columns: var(--flow-left-width, 260px) minmax(0, 1fr) var(--flow-right-width, 280px);
  gap: var(--flow-gap, 16px);
  align-items: start;
  width: 100%;
  min-width: 0;
}

.flow-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.flow-panel {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.flow-panel h3 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.flow-panel-status {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flow-status-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
}

.flow-status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.flow-status-toggle {
  display: flex;
  gap: 6px;
}

.flow-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.flow-status-card {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.flow-status-card strong {
  font-size: 12px;
}

.flow-status-card.is-ok {
  border-color: rgba(43, 212, 166, 0.4);
}

.flow-status-card.is-warn {
  border-color: rgba(255, 200, 87, 0.4);
}

.flow-status-card.is-risk {
  border-color: rgba(239, 68, 68, 0.5);
}

.flow-status-alerts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flow-status-alert {
  font-size: 11px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: rgba(255, 175, 175, 0.95);
}

.flow-review-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.flow-review-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  font-size: 11px;
}

.flow-review-item.done {
  border-color: rgba(43, 212, 166, 0.4);
}

.flow-review-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.flow-panel-missing {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flow-missing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.flow-missing-header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.flow-missing-count {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
}

.flow-missing-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flow-missing-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  font-size: 11px;
}

.flow-missing-label {
  font-weight: 600;
}

.flow-missing-sub {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
}

.flow-missing-action {
  border: none;
  background: rgba(74, 222, 128, 0.12);
  color: #4ade80;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  cursor: pointer;
}

.flow-missing-action:hover {
  background: rgba(74, 222, 128, 0.2);
}

.flow-missing-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 2px 0;
}

.flow-panel-wizard {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flow-wizard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.flow-wizard-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
}

.flow-wizard-subtitle {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
}

.flow-wizard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flow-wizard-step {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(77, 163, 255, 0.25);
  background: rgba(77, 163, 255, 0.06);
}

.flow-wizard-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
}

.flow-wizard-controls {
  display: flex;
  gap: 8px;
}

.flow-wizard-controls button {
  padding: 4px 8px;
  font-size: 11px;
}

.flow-wizard-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.flow-wizard-item.is-done {
  border-color: rgba(43, 212, 166, 0.4);
  color: rgba(255, 255, 255, 0.7);
}

.flow-wizard-item-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.flow-wizard-action {
  align-self: flex-start;
  margin-top: 4px;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(77, 163, 255, 0.5);
  color: rgba(77, 163, 255, 0.9);
  background: rgba(77, 163, 255, 0.08);
  cursor: pointer;
}

.flow-panel-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flow-stage-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.flow-info-card {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.flow-info-card-title {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.flow-info-card-value {
  font-size: 16px;
  font-weight: 600;
}

.flow-info-card-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
}

.flow-view-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.flow-toggle-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: inherit;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}

.flow-toggle-btn.active {
  border-color: rgba(43, 212, 166, 0.8);
  background: rgba(43, 212, 166, 0.15);
}

.flow-placeholder {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
}

.flow-municipal-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flow-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-left: 2px solid rgba(255, 255, 255, 0.08);
  padding-left: 12px;
}

.flow-timeline-item {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
}

.flow-timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  position: absolute;
  left: -18px;
}

.flow-timeline-item.is-done .flow-timeline-dot {
  background: #2bd4a6;
}

.flow-timeline-item.is-active .flow-timeline-dot {
  background: #4da3ff;
}

.flow-timeline-item.is-optional {
  opacity: 0.85;
}

.flow-timeline-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.flow-timeline-dot.is-optional {
  background: rgba(255, 255, 255, 0.3);
  border: 1px dashed rgba(255, 255, 255, 0.35);
}

.flow-status-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
}

.flow-status-badge.done {
  border-color: rgba(43, 212, 166, 0.6);
  color: #2bd4a6;
}

.flow-status-badge.active {
  border-color: rgba(77, 163, 255, 0.6);
  color: #4da3ff;
}

.flow-status-badge.optional {
  border-color: rgba(255, 255, 255, 0.35);
  color: rgba(255, 255, 255, 0.7);
}

.flow-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.flow-board-column {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 8px;
}

.flow-board-column h4 {
  margin: 0 0 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.flow-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.flow-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.flow-card.is-optional {
  border-style: dashed;
  opacity: 0.8;
}

.flow-card:hover {
  border-color: rgba(77, 163, 255, 0.5);
  background: rgba(255, 255, 255, 0.06);
}

.flow-card .flow-status-badge {
  margin-top: 6px;
  display: inline-flex;
}

.flow-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.flow-checklist li {
  margin: 6px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.flow-checklist li.is-done {
  color: #2bd4a6;
}

.flow-checklist li.is-auto {
  cursor: default;
  opacity: 0.85;
}

.flow-check-icon {
  width: 16px;
  text-align: center;
  font-size: 12px;
}

.flow-check-label {
  flex: 1;
}

.flow-auto-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
}

.flow-panel-modules {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.flow-slot {
  min-height: 40px;
  width: 100%;
  min-width: 0;
}

.flow-module,
.flow-slot > .section {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.flow-panel-dossier {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
}

.flow-stage-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
}

.flow-stage-badge.complete {
  border-color: rgba(43, 212, 166, 0.7);
  color: #2bd4a6;
}

.flow-dossier-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 0;
}

.flow-dossier-label {
  color: rgba(255, 255, 255, 0.5);
}

.flow-nav-item.active {
  border-color: rgba(43, 212, 166, 0.8);
  background: rgba(43, 212, 166, 0.12);
}

/* Flow-mode width guards (avoid module overflow inside 3-column grid) */
body.flow-mode .lab-bench {
  min-width: 0 !important;
}

body.flow-mode #section-config .grid-2-1,
body.flow-mode #section-demand .grid-3 {
  min-width: 0 !important;
  width: 100% !important;
}

body.flow-mode .constructora-layout {
  min-width: 0;
  grid-template-columns: minmax(240px, 35%) minmax(0, 1fr);
}

body.flow-mode .constructora-layout .lab-bench {
  min-width: 0;
}

@media (max-width: 1100px) {
  .flow-stage-grid {
    grid-template-columns: 1fr;
  }

  .flow-column-right {
    order: 3;
  }
}
