/* ===== Reset & base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #eef0f2;
  color: #333;
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; }

/* ===== Gov header ===== */
.gov-header { background: #fff; width: 100%; }
.gov-header .bar {
  max-width: 1152px; margin: 0 auto; padding: 16px 24px;
  display: flex; align-items: center; gap: 16px;
}
.logo-gob {
  width: 48px; height: 48px; border-radius: 50%; background: #0B3D91;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 8px; font-weight: 700; text-align: center; line-height: 1.1;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.logo-sat {
  width: 48px; height: 48px; border-radius: 50%; background: #007bff;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.gov-title { flex: 1; text-align: center; font-size: 20px; font-weight: 600; color: #333; }
.gov-sub { width: 112px; text-align: right; font-size: 11px; color: #666; line-height: 1.2; }
.gold-sep { height: 3px; background: #B39257; }

/* ===== Main container ===== */
main.portal { max-width: 896px; margin: 0 auto; padding: 32px 16px; }

/* ===== Form heading ===== */
.form-heading { text-align: center; margin-bottom: 24px; }
.form-heading h1 { font-size: 24px; font-weight: 600; color: #28a745; }
.form-heading p { font-size: 12px; color: #808080; margin-top: 8px; }

/* ===== Form card ===== */
.form-card {
  background: #fff; border-radius: 8px; border: 1px solid #e0e0e0;
  box-shadow: 0 1px 2px rgba(0,0,0,.05); padding: 32px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 32px; }
.col { display: flex; flex-direction: column; gap: 20px; }

/* ===== Labels & inputs ===== */
.field label {
  display: flex; align-items: center; gap: 4px;
  font-size: 14px; font-weight: 600; color: #333; margin-bottom: 6px;
}
.field label svg { width: 14px; height: 14px; color: #666; }
.input, .select {
  width: 100%; border: 1px solid #ccc; border-radius: 4px;
  padding: 8px 12px; font-size: 14px; color: #333; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus {
  outline: none; border-color: #007bff; box-shadow: 0 0 0 3px rgba(0,123,255,.2);
}
.input.upper { text-transform: uppercase; letter-spacing: .05em; }

/* ===== Captcha ===== */
.captcha-wrap { display: flex; align-items: center; gap: 12px; }
.captcha-box {
  position: relative; width: 176px; height: 56px;
  background: linear-gradient(135deg, #e9d8f3, #d4e4f7);
  border: 1px solid #ccc; border-radius: 4px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; user-select: none;
}
.captcha-noise {
  position: absolute; inset: 0; opacity: .2; font-size: 6px; line-height: 12px;
  color: #666; user-select: none; overflow: hidden; word-break: break-all;
}
.captcha-text {
  position: relative; font-size: 24px; font-weight: 700; color: #4a2e6b;
  letter-spacing: .1em; font-style: italic;
  text-shadow: 1px 1px 0 rgba(255,255,255,.6);
}
.btn-captcha {
  background: #007bff; color: #fff; font-size: 12px; font-weight: 500;
  padding: 12px 16px; border: none; border-radius: 4px; cursor: pointer; transition: background .15s;
}
.btn-captcha:hover { background: #0069d9; }

/* ===== Submit ===== */
.submit-row { margin-top: 28px; display: flex; justify-content: center; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: #007bff; color: #fff; padding: 12px 40px; border: none;
  border-radius: 4px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s;
}
.btn-primary:hover { background: #0069d9; }
.btn-primary:disabled { opacity: .6; cursor: default; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Results ===== */
.results { margin-top: 32px; padding-top: 32px; border-top: 1px solid #e0e0e0; }
.results h2 { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; color: #333; margin-bottom: 16px; }
.results h2 svg { width: 20px; height: 20px; color: #28a745; }
.result-head { background: #f8f9fa; border: 1px solid #e0e0e0; border-radius: 4px; overflow: hidden; }
.result-head .row { padding: 16px; }
.result-head .row .k { font-size: 12px; color: #808080; margin-bottom: 4px; }
.result-head .row .v { font-family: ui-monospace, monospace; font-weight: 600; color: #333; letter-spacing: .05em; }
.result-head-grid { display: grid; grid-template-columns: 1fr 1fr; }
.result-head-grid > div + div { border-left: 1px solid #e0e0e0; }
.result-row { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px solid #eee; }
.result-row .k { width: 176px; flex-shrink: 0; font-size: 14px; font-weight: 600; color: #333; }
.result-row .v { font-size: 14px; color: #555; }
.result-actions { margin-top: 24px; display: flex; gap: 12px; }
.result-actions .btn-primary { flex: 1; justify-content: center; padding: 12px 24px; }
.btn-outline {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid #007bff; color: #007bff; background: #fff;
  padding: 12px 24px; border-radius: 4px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.btn-outline:hover { background: #007bff; color: #fff; }

/* ===== Footer ===== */
.portal-footer {
  background: #fff; border-top: 4px solid #B39257;
  padding: 24px; text-align: center; font-size: 12px; color: #666;
}

/* ===== Modal ===== */
.modal-root { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-root.open { display: flex; }
.overlay { position: absolute; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(2px); }
.modal {
  position: relative; background: #fff; border-radius: 8px; box-shadow: 0 25px 50px rgba(0,0,0,.35);
  width: 100%; max-width: 512px; max-height: 90vh; overflow-y: auto;
}
.modal.error { border: 2px solid #6D2536; }
.modal .body { padding: 32px; }
.modal h2 { font-size: 17px; font-weight: 600; color: #333; margin-bottom: 24px; padding-right: 24px; }
.modal.error h2 { color: #6D2536; }
.modal .sub { font-size: 14px; color: #666; margin-bottom: 24px; }

/* Steps */
.steps { list-style: none; display: flex; flex-direction: column; gap: 16px; }
.steps li { display: flex; align-items: flex-start; gap: 12px; font-size: 14px; color: #333; }
.steps .num {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
  background: #6D2536; color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.steps .txt { line-height: 1.5; padding-top: 2px; }
kbd { padding: 2px 8px; background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 12px; font-weight: 600; font-family: ui-monospace, monospace; }
.win-icon { width: 14px; height: 14px; vertical-align: middle; fill: currentColor; }

/* Copied notice */
.copied-ok { margin-top: 20px; font-size: 12px; color: #1B4332; font-weight: 500; background: rgba(27,67,50,.1); padding: 8px 12px; border-radius: 4px; }

/* Modal actions */
.modal-actions { margin-top: 32px; display: flex; justify-content: flex-end; gap: 12px; }
.btn-validate {
  background: #6D2536; color: #fff; padding: 12px 32px; border: none;
  border-radius: 4px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s, transform .1s;
}
.btn-validate:hover { background: #8a3346; }
.btn-validate:active { transform: scale(.98); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .result-head-grid { grid-template-columns: 1fr; }
  .result-head-grid > div + div { border-left: none; border-top: 1px solid #e0e0e0; }
  .gov-sub { display: none; }
  .result-actions { flex-direction: column; }
  .result-row .k { width: 140px; }
}
