* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #1a1a2e;
  color: #e0e0e0;
  font-family: 'Courier New', monospace;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 0.8rem 2rem;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-shrink: 0;
}

header h1 {
  color: #53d8fb;
  font-size: 1.4rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.8rem;
  color: #8899aa;
}

/* --- Main layout: planos + specs panel --- */
.main-layout {
  flex: 1;
  display: flex;
  min-height: 0;
}

.planos-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* --- Planta (arriba, grande) --- */
.planta-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #0f0f23;
  border-bottom: 2px solid #0f3460;
}

.planta-section h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #53d8fb;
  padding: 6px 12px;
  background: #0f3460;
  text-align: center;
  flex-shrink: 0;
}

.planta-section svg {
  flex: 1;
  width: 100%;
  min-height: 0;
}

/* --- 4 Vistas (abajo, en fila) --- */
.vistas-section {
  flex-shrink: 0;
  height: 30vh;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  padding: 3px;
  background: #0f0f23;
}

.vista {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.vista h2 {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #53d8fb;
  padding: 4px 8px;
  background: #0f3460;
  text-align: center;
  flex-shrink: 0;
}

.vista svg {
  flex: 1;
  width: 100%;
  min-height: 0;
}

/* --- Specs panel (derecha) --- */
.specs-panel {
  width: 280px;
  flex-shrink: 0;
  background: #16213e;
  border-left: 2px solid #0f3460;
  overflow-y: auto;
  padding: 0;
}

.specs-panel h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #53d8fb;
  padding: 8px 12px;
  background: #0f3460;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 1;
}

.spec-section {
  padding: 8px 12px;
  border-bottom: 1px solid #0f3460;
}

.spec-section h3 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #ff9800;
  margin-bottom: 6px;
}

.spec-field {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  font-size: 0.72rem;
  line-height: 1.4;
}

.spec-label {
  color: #8899aa;
}

.spec-value {
  color: #e0e0e0;
  text-align: right;
  max-width: 60%;
}

.spec-decisions {
  list-style: none;
  padding: 0;
}

.spec-decisions li {
  font-size: 0.68rem;
  color: #aabbcc;
  padding: 3px 0;
  border-bottom: 1px dotted #1a2a4a;
  line-height: 1.3;
}

.spec-decisions li:last-child {
  border-bottom: none;
}

.spec-date {
  color: #556677;
  font-size: 0.6rem;
}

.spec-empty {
  padding: 12px;
  font-size: 0.72rem;
  color: #556677;
  text-align: center;
}

/* --- View selector (mobile only) --- */
.view-selector {
  display: none;
  background: #0f3460;
  padding: 4px;
  gap: 2px;
  overflow-x: auto;
  flex-shrink: 0;
}

.view-tab {
  background: transparent;
  border: 1px solid #1a4a7a;
  color: #8899aa;
  font-family: 'Courier New', monospace;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 3px;
  white-space: nowrap;
  flex: 1;
}

.view-tab.active {
  background: #1a4a7a;
  color: #53d8fb;
  border-color: #53d8fb;
}

/* --- Specs toggle --- */
.specs-toggle {
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.toggle-arrow {
  font-size: 0.6rem;
  transition: transform 0.2s;
}

.specs-body {
  transition: max-height 0.3s ease;
  overflow: hidden;
}

/* --- Conversation history --- */
.conversation-section {
  background: #0f0f23;
  border-top: 2px solid #0f3460;
  flex-shrink: 0;
}

.conversation-toggle {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #53d8fb;
  padding: 8px 12px;
  background: #0f3460;
  text-align: center;
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.conversation-body {
  max-height: 35vh;
  overflow-y: auto;
  transition: max-height 0.3s ease;
}

.conversation-body.collapsed {
  max-height: 0;
  overflow: hidden;
}

.conv-empty {
  padding: 12px;
  font-size: 0.72rem;
  color: #556677;
  text-align: center;
}

.conv-entry {
  padding: 8px 12px;
  border-bottom: 1px solid #1a2a4a;
}

.conv-timestamp {
  font-size: 0.6rem;
  color: #556677;
  margin-bottom: 4px;
}

.conv-user {
  font-size: 0.72rem;
  color: #ff9800;
  margin-bottom: 4px;
  line-height: 1.3;
}

.conv-user::before {
  content: "Vos: ";
  color: #8899aa;
  font-size: 0.65rem;
}

.conv-bot {
  font-size: 0.72rem;
  color: #aabbcc;
  line-height: 1.4;
}

.conv-bot::before {
  content: "Arq: ";
  color: #53d8fb;
  font-size: 0.65rem;
}

.conv-cambios {
  font-size: 0.6rem;
  color: #4caf50;
  margin-top: 4px;
  font-style: italic;
}

/* --- Footer --- */
footer {
  padding: 0.4rem 2rem;
  background: #16213e;
  border-top: 1px solid #0f3460;
  font-size: 0.7rem;
  color: #556677;
  display: flex;
  justify-content: space-between;
  flex-shrink: 0;
}

footer strong {
  color: #4caf50;
}

/* --- Mobile --- */
@media (max-width: 768px) {
  header {
    padding: 0.5rem 1rem;
    flex-direction: column;
    gap: 0.3rem;
  }

  header h1 {
    font-size: 1.1rem;
  }

  .view-selector {
    display: flex;
  }

  .main-layout {
    flex-direction: column;
  }

  .planos-col {
    min-height: 50vh;
  }

  /* En mobile, la planta-section y vistas se muestran según el tab activo */
  .planta-section {
    display: none;
  }

  .planta-section.view-active {
    display: flex;
    flex: 1;
  }

  .vistas-section {
    display: none;
    height: auto;
  }

  .vistas-section.has-active-view {
    display: block;
  }

  .vista {
    display: none;
    height: 50vh;
  }

  .vista.view-active {
    display: flex;
  }

  /* Specs: panel colapsable debajo */
  .specs-panel {
    width: 100%;
    border-left: none;
    border-top: 2px solid #0f3460;
  }

  .specs-body.collapsed {
    max-height: 0;
    overflow: hidden;
  }

  .conversation-body {
    max-height: 50vh;
  }

  footer {
    padding: 0.3rem 1rem;
    font-size: 0.6rem;
  }
}
