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

[hidden] {
  display: none !important;
}

body {
  font-family: "Inter", sans-serif;
  background: #f4f6f8;
  color: #1e293b;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1400px;
  margin: auto;
  padding: 40px 20px;
}

.hero {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  border-radius: 24px;
  padding: 50px;
  color: white;
  margin-bottom: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.hero h1 {
  font-size: 42px;
  font-weight: 800;
  margin-bottom: 15px;
}

.hero p {
  font-size: 18px;
  opacity: 0.9;
  line-height: 1.6;
  max-width: 900px;
}

.hero-actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: 0.25s;
}

.btn-primary {
  background: #2563eb;
  color: white;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-outline {
  background: transparent;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.4);
}

.btn-outline:hover {
  border-color: white;
}

.dibujo-lateral {
  position: static;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin-top: 72px;
}

.diagrama-concepto {
  margin: 0;
  width: 100%;
  background: #fff;
  border: 1px solid #e7e5e4;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
  padding: 8px 6px 2px;
}

.diagrama-concepto svg {
  display: block;
  width: 100%;
  height: auto;
  background: transparent;
}

.field-hint {
  font-size: 12px;
  color: #64748b;
  margin-top: 6px;
  line-height: 1.45;
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 25px;
}

.sidebar {
  background: white;
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  height: fit-content;
  position: sticky;
  top: 20px;
}

.tab-btn {
  width: 100%;
  border: none;
  background: #f1f5f9;
  padding: 18px;
  border-radius: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  text-align: left;
  transition: 0.3s;
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}

.tab-btn:hover {
  background: #dbeafe;
  transform: translateX(4px);
}

.tab-btn.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
}

.content {
  background: white;
  border-radius: 22px;
  padding: 35px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  min-height: 700px;
}

.tab-content {
  display: none;
  animation: fade 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-title {
  font-size: 34px;
  margin-bottom: 10px;
  color: #0f172a;
  font-weight: 800;
}

.section-subtitle {
  font-size: 17px;
  color: #64748b;
  margin-bottom: 30px;
  line-height: 1.7;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 22px;
  transition: 0.3s;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
  border-color: #3b82f6;
}

.card h3 {
  font-size: 18px;
  margin-bottom: 10px;
  color: #0f172a;
}

.card p {
  font-size: 14px;
  color: #64748b;
  line-height: 1.6;
  flex: 1;
  margin-bottom: 16px;
}

.card .btn-select {
  align-self: flex-start;
  background: #2563eb;
  color: white;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.card .btn-select:hover {
  background: #1d4ed8;
}

.badge {
  display: inline-block;
  padding: 8px 14px;
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
}

/* Formulario concepto */
.form-page {
  max-width: 1120px;
  margin: 0 auto;
}

.form-header {
  margin-bottom: 28px;
}

.form-header .back {
  display: inline-flex;
  align-items: center;
  margin-bottom: 16px;
  padding: 10px 16px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
}

.form-header .back:hover {
  border-color: #2563eb;
  color: #1d4ed8;
}

#btn-salir-sesion {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 40;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: #0f172a;
  color: #fff;
  font: 600 13px/1 Inter, sans-serif;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

#btn-salir-sesion:hover { background: #1e293b; }

.form-page.container {
  padding-top: 40px;
  padding-bottom: 12px;
}

.form-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.form-header-row .badge {
  margin-bottom: 0;
}

.form-page .form-header {
  margin-bottom: 22px;
}

.form-page .section-title {
  font-size: 24px;
  line-height: 1.15;
  margin-bottom: 2px;
}

.form-page .section-subtitle {
  font-size: 13px;
  line-height: 1.35;
  margin-bottom: 2px;
}

.form-page .obra-selector {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.form-page .form-step {
  padding: 10px 12px 2px;
  margin-bottom: 8px;
}

.form-page .step-num {
  width: 24px;
  height: 24px;
  line-height: 24px;
  margin: 0 8px 0 0;
  vertical-align: middle;
}

.form-page .form-step > h3 {
  display: inline;
  font-size: 16px;
  vertical-align: middle;
}

.form-page .step-hint {
  margin: 4px 0 6px;
  font-size: 13px;
}

.form-page .form-group {
  gap: 4px;
  margin-bottom: 8px;
}

.form-page .form-grid {
  gap: 10px 14px;
}

.form-page .form-group input:not([type="checkbox"]):not([type="radio"]),
.form-page .form-group select,
.form-page .form-group textarea {
  padding: 8px 12px;
}

.form-page .field-hint {
  margin-top: 2px;
}

.form-page .form-actions {
  position: static;
  margin-top: 12px;
  padding: 0;
  gap: 8px;
}

.notas-opcional {
  margin-top: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  padding: 10px 14px;
}

.notas-opcional summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: #334155;
}

.notas-opcional .form-group {
  margin: 10px 0 0;
}

.form-page .ld-workspace-embed {
  min-height: 0;
  align-items: start;
  grid-template-columns: minmax(240px, 34%) minmax(0, 1fr);
}

.form-page .ld-workspace-embed .ld-panel-left {
  max-width: none;
}

.form-page .ld-workspace-embed .ld-toolbar {
  flex-direction: row;
  flex-wrap: wrap;
  margin: 6px 0;
}

.form-page .ld-workspace-embed .ld-btn {
  width: auto;
  padding: 8px 10px;
}

.form-page .ld-workspace-embed .ld-points-list {
  max-height: 88px;
}

.form-page .ld-workspace-embed .ld-panel-right,
.form-page .ld-workspace-embed .ld-canvas-wrap {
  min-height: 280px;
  height: 280px;
}

.captura-con-dibujo {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(420px, 0.96fr);
  gap: 16px 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .captura-con-dibujo {
    grid-template-columns: 1fr;
  }

  .dibujo-lateral {
    order: -1;
    margin-top: 8px;
  }
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 22px;
  margin-bottom: 8px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.form-grid > .form-group {
  margin-bottom: 0;
}

.form-group.full {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select,
.form-group textarea {
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
}

.form-group input:not([type="checkbox"]):not([type="radio"]):focus {
  outline: 2px solid #93c5fd;
  border-color: #3b82f6;
}

.alert {
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: 14px;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.portal {
  background: white;
  border-radius: 22px;
  padding: 28px;
  margin-bottom: 25px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.portal h2 {
  font-size: 26px;
  margin-bottom: 8px;
}

.portal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 20px 0;
}

.portal-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
}

.portal-card h3 {
  font-size: 16px;
  margin: 0 0 18px;
}

.portal-card .form-group:last-of-type {
  margin-bottom: 20px;
}

.portal-card .btn {
  align-self: flex-start;
  margin-top: 2px;
}

.cliente-bloque {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
}

.cliente-bloque h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.obra-fila {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid #e2e8f0;
}

.obra-fila p {
  margin: 0;
  color: #64748b;
  font-size: 13px;
}

.prueba-box {
  margin-top: 22px;
  padding: 18px 20px 20px;
  border-radius: 16px;
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.prueba-box strong {
  display: block;
  margin-bottom: 8px;
}

.prueba-box p {
  margin: 0 0 16px;
}

#lista-clientes {
  margin-top: 8px;
}

#lista-clientes > .section-subtitle {
  margin-top: 6px;
  margin-bottom: 8px;
}

.banner-obra {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.banner-obra.prueba {
  background: #fffbeb;
  border-color: #fde68a;
}

.banner-obra strong {
  display: block;
}

@media (max-width: 800px) {
  .portal-grid {
    grid-template-columns: 1fr;
  }
}

.materiales-preview {
  margin-top: 24px;
  background: #f8fafc;
  border-radius: 14px;
  padding: 20px;
  border: 1px solid #e2e8f0;
}

.materiales-preview h3 {
  margin-bottom: 12px;
  font-size: 16px;
}

.materiales-preview table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.materiales-preview th,
.materiales-preview td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.panel-calculo {
  margin-top: 20px;
  padding: 20px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 16px;
}

.panel-calculo h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #1e40af;
}

.panel-calculo .hint {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 14px;
}

.struct-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card {
  background: white;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #dbeafe;
}

.stat-label {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 4px;
}

.notas-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: #334155;
  line-height: 1.6;
}

.form-step {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 18px;
}

.form-step h3 {
  margin: 0 0 6px;
  font-size: 17px;
  color: #0f172a;
}

.step-num {
  display: inline-block;
  background: #2563eb;
  color: white;
  width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}

.step-hint {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 14px;
}

.form-actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-group select {
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  width: 100%;
}

@media (max-width: 1000px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: relative;
    top: 0;
  }
  .hero h1 {
    font-size: 32px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* ——— Diseñador de Losa (ETAPA 4) ——— */
.losa-disenador-page .ld-return-link {
  margin-left: 16px;
}

.ld-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 20px;
  align-items: stretch;
  min-height: 520px;
}

.ld-panel-left {
  background: white;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 20px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.ld-panel-right {
  background: white;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 480px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.ld-panel-title {
  font-size: 18px;
  margin-bottom: 8px;
  color: #0f172a;
}

.ld-subtitle {
  font-size: 14px;
  margin: 16px 0 8px;
  color: #334155;
}

.ld-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
}

.ld-btn {
  width: 100%;
  justify-content: center;
  color: #2563eb;
  border-color: #93c5fd;
}

.ld-btn.btn-primary {
  color: white;
}

.ld-btn.btn-active {
  background: #fef2f2;
  border-color: #dc2626;
  color: #dc2626;
}

.ld-state-box {
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 14px;
}

.ld-state-label {
  color: #64748b;
}

.ld-state-value {
  font-weight: 600;
  color: #334155;
}

.ld-state-value.ld-state-complete,
.ld-state-complete {
  color: #16a34a;
}

.ld-points-list {
  list-style: none;
  font-size: 13px;
  max-height: 180px;
  overflow-y: auto;
}

.ld-points-list li {
  padding: 6px 0;
  border-bottom: 1px solid #f1f5f9;
}

.ld-points-list .ld-empty,
.ld-points-list .ld-seg-hint {
  color: #94a3b8;
}

.ld-muted {
  color: #94a3b8;
  font-size: 12px;
}

.ld-workspace-embed {
  display: grid;
  grid-template-columns: minmax(220px, 26%) minmax(0, 74%);
  gap: 16px;
  min-height: 460px;
  width: 100%;
}

.ld-workspace-embed .ld-panel-left {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  max-width: 300px;
}

.ld-workspace-embed .ld-panel-right {
  padding: 0;
  min-height: 440px;
  min-width: 0;
  flex: 1;
}

.ld-workspace-embed .ld-canvas-wrap {
  min-height: 440px;
  width: 100%;
}

.ld-place-hint {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 8px 0;
  color: #1d4ed8;
  font-weight: 500;
}

.ld-canvas-wrap {
  flex: 1;
  min-height: 400px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.ld-canvas-wrap.ld-canvas-placing {
  cursor: crosshair;
  border-color: #2563eb;
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.ld-canvas-wrap.ld-canvas-placing canvas {
  cursor: crosshair;
}

.ld-canvas-wrap.ld-canvas-closing,
.ld-canvas-wrap.ld-canvas-placing.ld-canvas-closing {
  cursor: pointer;
  border-color: #16a34a;
  box-shadow: inset 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.ld-canvas-wrap.ld-canvas-closing canvas,
.ld-canvas-wrap.ld-canvas-placing.ld-canvas-closing canvas {
  cursor: pointer;
}

.ld-place-hint.ld-place-hint-close {
  background: #f0fdf4;
  border-color: #86efac;
  color: #15803d;
}

#ld-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.ld-canvas-hint {
  margin-top: 8px;
  text-align: center;
}

.ld-measures-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 12px 0;
}

.ld-measures-table th,
.ld-measures-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}

.ld-measure-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
}

.ld-measures-actions {
  margin-top: 12px;
}

.ld-future-hint {
  margin-top: 16px;
  font-style: italic;
}

.losa-resumen-dibujo {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.losa-resumen-dibujo h4 {
  margin: 0 0 8px;
  font-size: 15px;
  color: #166534;
}

.losa-resumen-lados {
  font-size: 14px;
  color: #334155;
  margin: 0 0 10px;
  line-height: 1.5;
}

.losa-resumen-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  font-size: 14px;
  margin-bottom: 6px;
}

.losa-disenador-banner {
  background: linear-gradient(135deg, #eff6ff, #f0fdf4);
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.losa-disenador-banner p {
  flex: 1;
  min-width: 200px;
  margin: 0;
  font-size: 14px;
  color: #334155;
}

.card-featured {
  border: 2px solid #2563eb;
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 40%);
}

.card-featured h3::before {
  content: "✏️ ";
}

@media (max-width: 900px) {
  .ld-workspace,
  .ld-workspace-embed,
  .form-page .ld-workspace-embed {
    grid-template-columns: 1fr;
  }
  .ld-workspace-embed .ld-panel-left,
  .form-page .ld-workspace-embed .ld-panel-left {
    max-width: none;
    width: 100%;
  }
  .ld-canvas-wrap,
  .ld-workspace-embed .ld-canvas-wrap,
  .form-page .ld-workspace-embed .ld-panel-right,
  .form-page .ld-workspace-embed .ld-canvas-wrap {
    width: 100%;
    min-width: 0;
    min-height: 320px;
    height: min(92vw, 460px);
  }
}

/* Lados curvos y losa circular en el diseñador */
.ld-forma-select,
.ld-flecha-input,
.ld-diametro-input,
.ld-circulo input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
}
.ld-diametro-input {
  width: 120px;
}
.ld-circulo {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}
.ld-circulo input {
  flex: 1;
  min-width: 0;
}
.ld-measures-table td:nth-child(3) {
  min-width: 150px;
}
.ld-lado-tipo {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
