:root {
  --primary: #0050b3;
  --primary-soft: #e8f1ff;
  --primary-strong: #002766;
  --accent: #1890ff;
  --bg: #f3f5f9;
  --border-subtle: #dde3f0;
  --danger: #cf1322;
  --text-main: #1f2933;
  --text-muted: #727b88;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 12px 30px rgba(15, 23, 42, 0.07);
  --shadow-soft: 0 22px 55px rgba(15, 23, 42, 0.13);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #eef5ff 0%, #f8fbff 45%, #ffffff 100%);
  padding: 18px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-main);
}

.container {
  width: 100%;
  max-width: 1380px;
  min-height: calc(100vh - 36px);
  background: #ffffff;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(15, 23, 42, 0.04);
  box-shadow: var(--shadow-soft);
}

/* ===== Sidebar / Header ===== */
.header {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 20px;
  margin: 0;
  padding: 26px 22px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-right: 1px solid #dbe6f6;
}

.logo-box {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.logo {
  width: 100%;
  max-width: 250px;
  max-height: 90px;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.logo-text {
  display: none;
}

.header-meta {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
}

.meta-pill {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #dbe6f6;
  background: #ffffff;
  color: var(--primary-strong);
  font-size: 0.85rem;
  font-weight: 600;
}

.meta-pill.secondary {
  background: var(--primary-soft);
  color: #0958d9;
}

/* ===== Stepper ===== */
.stepper {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  align-self: start;
  flex-direction: column;
  gap: 12px;
  margin: 30px 20px 0;
  z-index: 2;
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 13px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #e0e8f5;
  color: var(--text-muted);
  font-size: 0.85rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.step::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 80, 179, 0.08), rgba(24, 144, 255, 0.08));
  opacity: 0;
  transition: opacity 0.18s ease-out;
}

.step.active {
  color: var(--primary-strong);
  background: linear-gradient(135deg, #ffffff, #eef5ff);
  border-color: #0b66e4;
  box-shadow: 0 12px 26px rgba(11, 102, 228, 0.12);
}

.step.active::before {
  opacity: 1;
}

.step-number {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #dde3f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: #334155;
  flex: 0 0 auto;
}

.step.active .step-number,
.step.completed .step-number {
  background: var(--primary);
  color: #ffffff;
}

.step-label {
  position: relative;
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* ===== Form layout ===== */
form {
  grid-column: 2;
  grid-row: 1 / span 2;
  padding: 26px;
  margin: 0;
  min-width: 0;
}

form::before {
  content: "REPORTE DE INSTALACIÓN / MANTENIMIENTO";
  display: block;
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #08245c;
  margin-bottom: 4px;
}

/*
form::after {
  content: "Sistema de generación de reportes técnicos";
  display: block;
  margin-top: -4px;
  margin-bottom: 22px;
  color: #72809a;
  font-size: 0.95rem;
}
*/


form::after {
  display: none;
}

.step-content {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

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

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

.field-group {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #dbe6f6;
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.field-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: #0058d6;
  font-size: 1.05rem;
  font-weight: 800;
}

.field-group-title::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
}

.grid {
  display: grid;
  gap: 14px;
}

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

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-full {
  grid-column: 1 / -1;
}

label {
  font-size: 0.82rem;
  color: var(--text-main);
}

.required {
  color: var(--danger);
  margin-left: 3px;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 11px;
  border: 1px solid #d6e0ef;
  font-size: 0.88rem;
  outline: none;
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #0b66e4;
  box-shadow: 0 0 0 3px rgba(11, 102, 228, 0.13);
  background: #ffffff;
}

.spacer {
  height: 14px;
}

.divider {
  margin: 16px 0 12px;
  border-top: 1px dashed var(--border-subtle);
}

/* ===== Conditional sections ===== */
.conditional,
.conditional-block {
  display: none;
}

.conditional.visible,
.conditional-block.visible {
  display: block;
}

.grid .conditional.visible {
  display: flex;
}

/* ===== File inputs ===== */
.file-input {
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-subtle);
  padding: 14px;
  background: #f4f7ff;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.file-input p {
  margin: 0 0 6px;
}

.file-input input {
  margin-top: 6px;
}

/* ===== Signatures ===== */
.signature-wrapper {
  background: #ffffff;
  border: 1px solid #dbe6f6;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.signature-wrapper > label {
  display: block;
  margin-bottom: 10px;
  font-weight: 800;
  color: #08245c;
}

.signature-canvas {
  width: 100%;
  max-width: 100%;
  height: 190px !important;
  display: block;
  touch-action: none;
  border-radius: 14px;
  border: 1.5px dashed #aebed3;
  background: radial-gradient(circle at center, rgba(11, 102, 228, 0.035), transparent 45%), #ffffff;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cline x1='16' y1='3' x2='16' y2='29' stroke='%230b66e4' stroke-width='2.4' stroke-linecap='round'/%3E%3Cline x1='3' y1='16' x2='29' y2='16' stroke='%230b66e4' stroke-width='2.4' stroke-linecap='round'/%3E%3Ccircle cx='16' cy='16' r='3.2' fill='white' stroke='%230b66e4' stroke-width='1.8'/%3E%3C/svg%3E") 16 16, crosshair;
}

.signature-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.signature-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ===== Buttons / messages ===== */
.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 30px;
  padding-top: 16px;
}

.actions-right {
  display: flex;
  gap: 8px;
}

.btn {
  min-height: 44px;
  border-radius: 14px;
  padding: 10px 18px;
  border: none;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease, color 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #0050c8, #1686ff);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(11, 102, 228, 0.24);
}

.btn-primary:hover {
  box-shadow: 0 14px 28px rgba(11, 102, 228, 0.3);
  transform: translateY(-1px);
}

.btn-outline {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.btn-outline:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn-outline:not(:disabled):hover {
  background: #f3f6ff;
}

.btn-ghost {
  min-height: auto;
  background: transparent;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  border: 1px dashed transparent;
  box-shadow: none;
}

.btn-ghost:hover {
  border-color: var(--border-subtle);
  background: #ffffff;
}

.error {
  color: var(--danger);
  font-size: 0.75rem;
  margin-top: 4px;
}

.error-message {
    color: #dc2626;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.message {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  body {
    padding: 12px;
  }

  .container {
    display: block;
    min-height: auto;
    border-radius: 16px;
  }

  .header {
    border-right: none;
    border-bottom: 1px solid #dbe6f6;
  }

  .stepper {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 14px;
  }

  form {
    padding: 16px;
  }

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .actions-right {
    width: 100%;
  }

  .btn {
    width: 100%;
  }
}

/* ===== Formularios dinámicos por tipo de servicio ===== */
.conditional-evidence {
  display: none;
}

.conditional-evidence.visible {
  display: block;
}

.section-note {
  margin: -4px 0 16px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #eef5ff;
  color: #24415f;
  font-size: 0.86rem;
  line-height: 1.45;
}
