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

:root {
  --bg:        #f0f4f8;
  --surface:   #ffffff;
  --navy:      #0f1e3d;
  --blue:      #1e3a8a;
  --accent:    #3b82f6;
  --accent-lt: #60a5fa;
  --green:     #059669;
  --green-lt:  #d1fae5;
  --rose:      #dc2626;
  --rose-lt:   #fef2f2;
  --amber:     #d97706;
  --amber-lt:  #fffbeb;
  --gray-50:   #f9fafb;
  --gray-100:  #f3f4f6;
  --gray-200:  #e5e7eb;
  --gray-400:  #9ca3af;
  --gray-500:  #6b7280;
  --gray-700:  #374151;
  --gray-900:  #111827;
  --text:      #1f2937;
  --muted:     #6b7280;
  --border:    #e5e7eb;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.05);
  --font-body:    'DM Sans', -apple-system, sans-serif;
  --font-display: 'Barlow Condensed', sans-serif;
  --font-mono:    'Share Tech Mono', monospace;
  --radius:    8px;
  --radius-lg: 12px;
}

/* Restored original colors and increased max-width for better browser coverage */
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f9fafb;
  color: #1f2937;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  line-height: 1.6;
}

.form-container {
  max-width: 1400px; /* Increased from 1200px to use more browser space */
  width: 100%;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

/* Restored original header colors */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1e3a8a;
  color: #ffffff;
  padding: 20px;
  border-bottom: 2px solid #3b82f6;
}

.header .company-logo-header {
  max-height: 50px;
}

.header .sisco-op {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.5px;
}

/* Progress section positioned below header with white background and colorful progress bar */
.progress-section {
  background: #ffffff;
  padding: 24px;
  border-bottom: 1px solid #e5e7eb;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.progress-header h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: #1e3a8a;
}

.progress-percentage {
  font-size: 20px;
  font-weight: 700;
  color: #1e3a8a;
  background: #f3f4f6;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

/* More prominent progress bar with white background and red-to-green gradient */
.progress-bar {
  width: 100%;
  height: 8px;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid #e5e7eb;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ef4444 0%, #f59e0b 25%, #eab308 50%, #84cc16 75%, #10b981 100%);
  border-radius: 4px;
  transition: width 0.5s ease;
  width: 0%;
}

.progress-summary {
  font-size: 14px;
  color: #4b5563;
  text-align: center;
  font-weight: 500;
}

.tabs {
  display: flex;
  background: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
}

.tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border-right: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab-icon {
  font-size: 16px;
  transition: all 0.2s ease;
}

.tab:last-child {
  border-right: none;
}

.tab:hover {
  background: #e5e7eb;
  color: #1f2937;
}

/* Restored original tab colors */
.tab.active {
  background: #ffffff;
  color: #3b82f6;
  border-bottom: 2px solid #3b82f6;
  font-weight: 600;
}

.tab.completed {
  background: #e6fffa;
  color: #059669;
  border-bottom: 2px solid #059669;
  font-weight: 600;
}

/* Added conditional styling for datos-generales when DMA completion is pending */
.tab.conditional {
  background: #fef3c7;
  color: #92400e;
  border-bottom: 2px solid #f59e0b;
  font-weight: 600;
}

.tab.conditional .tab-icon {
  color: #f59e0b;
}

.tab.completed .tab-icon {
  color: #059669;
}

.tab-content {
  display: none;
  padding: 24px;
  background: #f9fafb;
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.field-container {
  position: relative;
}

.field-status {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  min-height: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.field-status.valid {
  color: #059669;
}

.field-status.invalid {
  color: #dc2626;
}

.field-status.valid::before {
  content: "✓";
  font-weight: bold;
}

.field-status.invalid::before {
  content: "⚠";
  font-weight: bold;
}

.punto-bombeo {
  background: #ffffff;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  margin-top: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s ease;
}

.punto-bombeo:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

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

label {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  background: #f9fafb;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Restored original focus colors */
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #3b82f6;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input.valid,
select.valid,
textarea.valid {
  border-color: #059669;
  background: #f0fdf4;
}

input.invalid,
select.invalid,
textarea.invalid {
  border-color: #dc2626;
  background: #fef2f2;
}

input:invalid,
select:invalid {
  border-color: #b91c1c;
  background: #fef2f2;
}

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

.add-btn,
.remove-btn,
.add-punto-btn,
button[type="submit"],
.load-previous-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.add-btn,
.add-punto-btn,
.load-previous-btn {
  background: #1e3a8a;
  color: #ffffff;
  margin-top: 12px;
}

.add-btn:hover,
.add-punto-btn:hover,
.load-previous-btn:hover {
  background: #3b82f6;
  opacity: 0.9;
}

.remove-btn {
  background: #b91c1c;
  color: #ffffff;
  margin-top: 12px;
}

.remove-btn:hover {
  background: #dc2626;
  opacity: 0.9;
}

/* Restored original button colors */
button[type="submit"] {
  background: #1e3a8a;
  color: #ffffff;
  width: 100%;
  padding: 14px;
  font-size: 14px;
  font-weight: 500;
  margin: 24px auto;
  display: none;
  border-radius: 6px;
}

button[type="submit"].visible {
  display: block;
}

button[type="submit"]:hover {
  background: #3b82f6;
  opacity: 0.9;
}

button[type="submit"]:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  opacity: 0.6;
}

.error {
  color: #b91c1c;
  font-size: 12px;
  margin-top: 6px;
  display: none;
  font-weight: 500;
}

.error-visible {
  display: block;
}

.nave,
.dma,
.rov {
  background: #ffffff;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s ease;
}

.nave:hover,
.dma:hover,
.rov:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.dma-header {
  background: #f3f4f6;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 500;
  color: #1f2937;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 3px solid #3b82f6;
}

.dma-select {
  width: 160px;
  display: inline-block;
  margin-right: 12px;
}

.observaciones-container {
  margin-top: 12px;
}

.puntos-bombeo-container {
  display: none;
}

/* Adding styles for section status messages */
.section-status-message {
  background: #f3f4f6;
  border-left: 4px solid #6b7280;
  padding: 12px 16px;
  margin-bottom: 20px;
  border-radius: 0 6px 6px 0;
  font-weight: 500;
  font-size: 14px;
}

.section-status-message.completed {
  background: #d1fae5;
  border-left-color: #059669;
  color: #065f46;
}

.section-status-message.conditional {
  background: #fef3c7;
  border-left-color: #f59e0b;
  color: #92400e;
}

.section-status-message.incomplete {
  background: #fef2f2;
  border-left-color: #dc2626;
  color: #991b1b;
}

.status-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-text {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 13px;
}

.footer {
  background: #f3f4f6;
  color: #4b5563;
  padding: 16px;
  text-align: center;
  border-top: 1px solid #e5e7eb;
  font-size: 13px;
  font-weight: 500;
}

.footer p {
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 768px) {
  body {
    padding: 16px;
  }

  .form-grid,
  .punto-bombeo-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    flex-direction: column;
  }

  .tab {
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
  }

  .header {
    flex-direction: column;
    gap: 10px;
  }

  .header .company-logo-header {
    max-height: 40px;
  }

  .header .sisco-op {
    font-size: 20px;
  }

  button[type="submit"] {
    font-size: 14px;
    padding: 12px;
  }

  .footer {
    font-size: 12px;
    padding: 12px;
  }

  .progress-header {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

/* ══════════════ LOGIN ══════════════ */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background:
    radial-gradient(ellipse 70% 50% at 15% 85%, rgba(59,130,246,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 15%, rgba(15,30,61,0.15) 0%, transparent 60%),
    linear-gradient(160deg, #e8f0fe 0%, #f0f4f8 50%, #e8f4f0 100%);
  overflow: hidden;
}

.login-bg-glow {
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,.08) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.login-wrap { text-align: center; width: 100%; max-width: 420px; position: relative; }

.login-badge {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .35rem 1rem;
  background: rgba(30,58,138,.08);
  border: 1px solid rgba(30,58,138,.18);
  border-radius: 99px;
  font-family: var(--font-mono); font-size: .62rem;
  color: var(--blue); letter-spacing: .2em;
  margin-bottom: 1.5rem;
}
.badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  animation: blink 2s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

.login-card {
  background: var(--surface, #ffffff);
  border: 1px solid rgba(0,0,0,.07);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(15,30,61,.12), 0 4px 16px rgba(0,0,0,.06);
  overflow: hidden;
  animation: slideUp .45s cubic-bezier(.16,1,.3,1) both;
}
@keyframes slideUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:none} }

.login-card-header {
  padding: 2rem 2rem 1.5rem;
  border-bottom: 1px solid var(--border, #e5e7eb);
  text-align: center;
  background: linear-gradient(160deg, var(--gray-50, #f9fafb) 0%, var(--surface, #ffffff) 100%);
}
.login-icon-wrap {
  display: inline-flex; align-items: center; justify-content: center;
  width: 60px; height: 60px; border-radius: 14px;
  background: linear-gradient(135deg, var(--blue, #1e3a8a), var(--accent, #3b82f6));
  margin-bottom: 1rem;
  box-shadow: 0 8px 20px rgba(30,58,138,.25);
}
.login-logo { width: 44px; height: 44px; object-fit: contain; }
.login-icon-fallback {
  display: none; align-items: center; justify-content: center;
  color: #fff; font-size: 1.5rem;
}
.login-card-header h1 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--navy, #0f1e3d); }
.login-card-header p  { font-size: .83rem; color: var(--muted, #6b7280); margin-top: .25rem; }

.login-card-body { padding: 1.75rem 2rem 2rem; }

.login-alert {
  display: none; align-items: center; gap: .6rem;
  padding: .7rem 1rem;
  background: var(--rose-lt, #fef2f2); border: 1px solid rgba(220,38,38,.25);
  border-radius: var(--radius, 8px); font-size: .82rem; color: #b91c1c;
  margin-bottom: 1rem;
}
.login-alert.show { display: flex; animation: shake .4s ease; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-5px)} 40%,80%{transform:translateX(5px)} }

.login-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

.lf { margin-bottom: .85rem; text-align: left; }
.lf label {
  display: block; font-size: .72rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--gray-700, #374151); margin-bottom: .35rem;
}
.lf input {
  width: 100%; padding: .7rem .9rem;
  background: var(--gray-50, #f9fafb); border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--radius, 8px); color: var(--text, #1f2937);
  font-family: var(--font-body); font-size: .9rem;
  transition: border-color .2s, box-shadow .2s, background .2s; outline: none;
}
.lf input:focus { border-color: var(--accent, #3b82f6); background: #fff; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.lf input.err  { border-color: var(--rose, #dc2626); background: var(--rose-lt, #fef2f2); }
.lf-hint { font-family: var(--font-mono); font-size: .62rem; color: var(--muted, #6b7280); margin-top: .3rem; }

.login-btn {
  width: 100%; padding: .8rem;
  background: linear-gradient(135deg, var(--blue, #1e3a8a), var(--accent, #3b82f6));
  border: none; border-radius: var(--radius, 8px); color: #fff;
  font-family: var(--font-body); font-size: .9rem; font-weight: 600;
  cursor: pointer; transition: opacity .2s, transform .1s;
  box-shadow: 0 4px 12px rgba(30,58,138,.25);
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  margin-top: .25rem;
}
.login-btn:hover { opacity: .9; }
.login-btn:active { transform: scale(.98); }
.login-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.login-spinner {
  display: none; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
.login-btn.loading .login-spinner { display: block; }
@keyframes spin { to{transform:rotate(360deg)} }

.login-card-footer {
  padding: .9rem 2rem; border-top: 1px solid var(--border, #e5e7eb);
  text-align: center; font-size: .7rem; color: var(--muted, #6b7280);
}
