:root {
  --navy: #0b0c5e;
  --teal: #008080;
  --orange: #ff6900;
  --teal-light: #3aafa6;
  --orange-light: #ffb84d;
  --blue-accent: #1e90ff;
  --text: #20283d;
  --muted: #657084;
  --line: #e4e7ef;
  --bg: #f5f6fa;
  --card: #ffffff;
  --green: #1c9e63;
  --red: #d64545;
  --amber: #c98a1b;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
}

a { color: var(--teal); text-decoration: none; }
h1 { font-size: 28px; letter-spacing: -1px; font-weight: 650; color: var(--navy); }
h2 { font-size: 20px; letter-spacing: -.35px; color: var(--navy); margin-top: 0; }
h3 { font-size: 16px; margin: 0 0 12px; color: var(--navy); }
.muted { color: var(--muted); font-size: 13px; }
.eyebrow { text-transform: uppercase; letter-spacing: 2px; font-size: 11px; font-weight: 700; color: var(--teal); margin-bottom: 12px; }

/* ---- Barra superior ---- */
.topbar {
  background: var(--navy);
  color: #fff;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.logo-chip { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; font-size: 15px; }
.logo-chip img { height: 44px; width: auto; object-fit: contain; }
.logo-big { width: 220px; height: 110px; object-fit: contain; object-position: left; }
.topbar button {
  background: rgba(255,255,255,.14);
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.topbar button:hover { background: rgba(255,255,255,.24); }

.wrap { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
.wrap-admin { max-width: 1260px; margin: 24px auto; padding: 0 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(11,12,94,.05);
}
.card + .card { margin-top: 16px; }

input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal-light); outline-offset: 0; border-color: var(--teal); }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 4px; color: var(--navy); }

.btn {
  display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 650; cursor: pointer;
  transition: background .15s, box-shadow .15s;
}
.btn:hover { background: #f1f4f8; box-shadow: 0 3px 8px rgba(11,12,94,.08); }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.primary:hover { background: #242578; }
.btn.orange { background: var(--orange); color: #341500; border-color: var(--orange); }
.btn.orange:hover { background: #e85f00; }
.btn.teal { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--navy); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.green { background: var(--green); color: #fff; border-color: var(--green); }
.btn.red { background: var(--red); color: #fff; border-color: var(--red); }
.btn.gray { background: #8595a5; color: #fff; border-color: #8595a5; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.tabla { width: 100%; border-collapse: collapse; }
.tabla th, .tabla td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tabla th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .02em; }
.tabla td { font-size: 14px; }

.badge { display: inline-block; border-radius: 20px; padding: 2px 10px; font-size: 12px; font-weight: 600; }
.badge.green { background: #e2f5ea; color: var(--green); }
.badge.gray { background: #e9edf1; color: var(--muted); }
.badge.amber { background: #fbeecf; color: var(--amber); }
.badge.red { background: #fbe2e2; color: var(--red); }
.badge.teal { background: #dff3f3; color: var(--teal); }

.flash { padding: 10px 12px; border-radius: 8px; margin: 12px 0; font-size: 14px; display: none; }
.flash.error { display: block; background: #fdecec; color: #b02828; border: 1px solid #f3c2c2; }
.flash.ok { display: block; background: #e6f6ee; color: #157347; border: 1px solid #bfe6cf; }

/* ---- Login institucional (como en Appencuestas) ---- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.login-brand {
  background: var(--navy); color: #fff; min-height: 100vh; padding: 42px 9%;
  display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.login-brand:after {
  content: ""; position: absolute; width: 520px; height: 520px; border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%; bottom: -260px; right: -230px; box-shadow: 0 0 0 80px rgba(255,255,255,.03), 0 0 0 160px rgba(255,255,255,.02);
}
.login-brand .eyebrow { color: var(--teal-light); }
.brand-copy { max-width: 460px; position: relative; z-index: 1; padding: 30px 0; }
.brand-copy h1 { color: #fff; font-size: clamp(30px, 4vw, 42px); line-height: 1.12; letter-spacing: -1.5px; margin-bottom: 16px; }
.brand-copy h1 span { color: var(--orange-light); }
.brand-copy p { color: rgba(255,255,255,.82); font-size: 16px; line-height: 1.6; }
.brand-detail { display: flex; align-items: center; gap: 10px; margin-top: 26px; color: #fff; font-weight: 600; font-size: 14px; }
.brand-detail span { width: 34px; height: 3px; background: var(--orange); border-radius: 3px; }
.login-foot { color: rgba(255,255,255,.55); font-size: 12px; letter-spacing: 1px; position: relative; z-index: 1; }
.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-card { width: 380px; }
.login-card .lead { color: var(--muted); margin: 0 0 18px; }
.form-actions { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 820px) { .login { grid-template-columns: 1fr; } .login-brand { min-height: auto; padding: 28px 8%; } }

/* ---- Revisión (dos paneles) ---- */
.split { display: grid; grid-template-columns: 1fr 400px; gap: 14px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-title { padding: 10px 14px; background: #f0f4f8; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px; color: var(--navy); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.iframe-host { height: 78vh; }
.iframe-host iframe { width: 100%; height: 100%; border: 0; }
.panel-body { padding: 14px; }

.vers-chip { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 13px; }
.vers-chip.act { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.obs-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-top: 10px; }
.obs-item .q { font-weight: 700; color: var(--navy); }
.obs-item .tx { margin: 4px 0; white-space: pre-wrap; }
.obs-item .dt { font-size: 12px; color: var(--muted); }

.aprove-note { font-size: 13px; color: var(--muted); font-style: italic; line-height: 1.5; margin: 6px 0 10px; border-left: 3px solid var(--teal-light); padding-left: 10px; }

.ob-banner { padding: 10px 12px; border-radius: 8px; background: #e6f6ee; color: #157347; border: 1px solid #bfe6cf; font-size: 14px; margin-bottom: 10px; }

/* ---- Modal ---- */
.modal-back { position: fixed; inset: 0; background: rgba(11,12,94,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: #fff; border-radius: 12px; width: 640px; max-width: 94vw; max-height: 86vh; overflow: auto; padding: 18px 20px; }
.modal h3 { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid .full { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.menu-tabs button.on { background: var(--navy); color: #fff; border-color: var(--navy); }