.admin-body { padding-bottom: 102px; }
.admin-warning { border-bottom-color: #e7cd8d; }
.admin-shell { width: min(1560px, calc(100% - 36px)); margin: 26px auto; }
.admin-intro {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 28px;
  margin-bottom: 22px;
}
.admin-intro h2 { margin: 4px 0 7px; font-size: 27px; letter-spacing: -.04em; }
.admin-intro > div:first-child > p:last-child { margin: 0; color: var(--muted); font-size: 13px; }
.technical-name { display: none !important; }
body.show-technical-names .technical-name { display: inline !important; }
.model-glossary { margin-bottom: 18px; border: 1px solid #c5d7f7; border-radius: 14px; background: #f3f7ff; overflow: hidden; }
.model-glossary summary { min-height: 66px; display: flex; align-items: center; gap: 12px; padding: 13px 17px; cursor: pointer; list-style: none; }
.model-glossary summary::-webkit-details-marker { display: none; }
.glossary-icon { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #fff; background: var(--brand); font-weight: 900; }
.model-glossary summary > span:nth-child(2) { display: grid; gap: 3px; }
.model-glossary summary b { font-size: 13px; }
.model-glossary summary small { color: var(--muted); font-size: 11px; }
.glossary-action { margin-left: auto; color: var(--brand); font-size: 11px; font-weight: 800; }
.model-glossary[open] .glossary-action { font-size: 0; }
.model-glossary[open] .glossary-action::after { content: "Ocultar glosario"; font-size: 11px; }
.glossary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; padding: 1px; border-top: 1px solid #d7e3f7; background: #d7e3f7; }
.glossary-item { min-width: 0; padding: 13px 15px; background: #fff; }
.glossary-item b { display: block; margin-bottom: 3px; color: var(--brand-dark); font-size: 12px; }
.glossary-item strong { display: block; margin-bottom: 4px; font-size: 11px; }
.glossary-item p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.admin-summary {
  min-width: 390px; display: grid; grid-template-columns: repeat(3, 1fr); overflow: hidden;
  border: 1px solid var(--line); border-radius: 12px; background: var(--line);
}
.admin-summary div { display: grid; gap: 5px; padding: 13px 16px; background: rgba(255,255,255,.78); }
.admin-summary span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.admin-summary strong { font-size: 14px; }
.amber-text { color: #916016; }

.admin-loading { min-height: 460px; display: grid; justify-items: center; align-content: center; color: var(--muted); }
.admin-loading .spinner { margin-bottom: 10px; }
.admin-loading p { font-size: 12px; }
.admin-fatal {
  min-height: 320px; display: flex; align-items: center; justify-content: center; gap: 18px;
  padding: 40px; border: 1px solid #edc5c5; border-radius: 18px; background: #fff7f7;
}
.admin-fatal > span { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--red); font-weight: 900; }
.admin-fatal h2 { margin: 0 0 5px; font-size: 18px; }
.admin-fatal p { margin: 0; color: var(--muted); font-size: 12px; }

.draft-library {
  margin-bottom: 18px; border: 1px solid rgba(26,76,165,.12); border-radius: 18px;
  background: #fff; box-shadow: 0 13px 38px rgba(17,47,100,.08); overflow: hidden;
}
.draft-library-heading {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 22px;
  padding: 22px 25px; border-bottom: 1px solid var(--line);
}
.draft-library-heading h2 { margin: 4px 0 5px; font-size: 21px; letter-spacing: -.03em; }
.draft-library-heading > div:first-child > p:last-child { margin: 0; color: var(--muted); font-size: 13px; }
.database-status {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 9px;
  color: #72501b; background: var(--amber-soft); border: 1px solid #ead2a3; font-size: 11px;
}
.database-status span { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.database-status.online { color: var(--brand-dark); background: var(--brand-soft); border-color: #bdd0f4; }
.database-status.online span { background: var(--brand); }
.database-status.offline { color: #7a3434; background: var(--red-soft); border-color: #ecc7c7; }
.database-status.offline span { background: var(--red); }
.draft-library-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 18px; background: #f4f7fc; }
.draft-create-card, .persisted-list-card, .draft-history-card {
  min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: #fff;
}
.draft-history-card { grid-column: 1 / -1; }
.draft-card-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.draft-card-title h3 { margin: 0 0 3px; font-size: 14px; }
.draft-card-title p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.text-button { padding: 0; border: 0; color: var(--brand); background: transparent; font-size: 11px; font-weight: 800; }
.draft-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.draft-form-grid .field > span { font-size: 12px; }
.draft-form-grid input { font-size: 13px; }
.persistence-help { margin: 9px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; text-align: center; }
.persisted-draft-list { display: grid; gap: 7px; max-height: 205px; overflow-y: auto; }
.persisted-empty { padding: 23px; border: 1px dashed #d2ddec; border-radius: 9px; color: var(--muted); background: #fafcff; text-align: center; font-size: 11px; line-height: 1.45; }
.persisted-draft-row {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px;
  padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; color: inherit;
  background: #fafcff; text-align: left;
}
.persisted-draft-row:hover, .persisted-draft-row.active { border-color: #a9c2ed; background: var(--brand-soft); }
.persisted-draft-row > div { min-width: 0; display: grid; gap: 3px; }
.persisted-draft-row strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.persisted-draft-row small { color: var(--muted); font-size: 9px; }
.persisted-draft-row > span { align-self: center; padding: 5px 7px; border-radius: 6px; color: var(--brand); background: #fff; font-size: 9px; font-weight: 850; }
.revision-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 5px; }
.revision-chip { flex: 0 0 auto; min-width: 145px; display: grid; gap: 3px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fafcff; }
.revision-chip.latest { color: var(--brand-dark); border-color: #abc3ed; background: var(--brand-soft); }
.revision-chip b { font-size: 11px; }
.revision-chip span { color: var(--muted); font-size: 9px; }
.change-comparison { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.change-comparison-list { display: grid; gap: 7px; }
.change-row { display: grid; grid-template-columns: minmax(150px, 1.25fr) 1fr 25px 1fr; gap: 9px; align-items: center; padding: 9px 10px; border-radius: 8px; background: #f4f7fc; }
.change-row > code { overflow-wrap: anywhere; color: #425049; font-size: 9px; }
.change-path { min-width: 0; display: grid; gap: 2px; }
.change-path strong { font-size: 10px; }
.change-path code { overflow-wrap: anywhere; color: #718079; font-size: 8px; }
.change-row > span { color: var(--muted); font-size: 9px; }
.change-row > b { color: var(--brand); text-align: center; }

.admin-workspace {
  display: grid; grid-template-columns: 240px minmax(500px, 1fr) 370px; align-items: start;
  border: 1px solid rgba(26,76,165,.12); border-radius: 18px; background: #fff;
  box-shadow: var(--shadow); overflow: hidden;
}
.parameter-nav { min-width: 0; min-height: 760px; padding: 20px 14px; background: #f2f6fc; border-right: 1px solid var(--line); }
.nav-heading { display: grid; gap: 3px; padding: 0 9px 14px; }
.nav-heading span { color: var(--brand); font-size: 9px; font-weight: 850; letter-spacing: .14em; }
.nav-heading small { color: var(--muted); font-size: 10px; }
#section-nav { display: grid; gap: 3px; }
.section-nav-button {
  width: 100%; display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 0;
  border-radius: 9px; color: #4d5d76; background: transparent; text-align: left; font-size: 11px; font-weight: 700;
}
.section-nav-button span {
  width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 6px; color: #687892; background: #e2e9f4; font-size: 8px; font-weight: 850;
}
.section-nav-button:hover { background: #e6edf8; }
.section-nav-button.active { color: var(--brand-dark); background: #dce8fb; }
.section-nav-button.active span { color: #fff; background: var(--brand); }
.section-nav-button.modified::after { content: ""; width: 6px; height: 6px; margin-left: auto; border-radius: 50%; background: var(--amber); }
.locked-card {
  display: flex; gap: 9px; margin: 18px 3px 0; padding: 12px; color: #56625c;
  border: 1px solid #d9e0dc; border-radius: 10px; background: rgba(255,255,255,.62);
}
.locked-card > span { color: var(--brand); font-size: 18px; }
.locked-card div { display: grid; gap: 3px; }
.locked-card b { font-size: 10px; }
.locked-card small { color: var(--muted); font-size: 9px; line-height: 1.4; }

.parameter-editor { min-width: 0; min-height: 760px; border-right: 1px solid var(--line); }
.editor-heading {
  min-height: 112px; display: flex; justify-content: space-between; align-items: flex-start; gap: 18px;
  padding: 23px 25px 19px; border-bottom: 1px solid var(--line);
}
.editor-path { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.editor-path span { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; color: var(--brand); background: var(--brand-soft); font-size: 9px; font-weight: 900; }
.editor-path code { color: #718079; font-size: 10px; }
.editor-heading h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.03em; }
.editor-heading p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.editor-heading .button { padding: 9px 11px; white-space: nowrap; font-size: 10px; }
.editor-tools { display: flex; align-items: center; gap: 10px; }
.technical-toggle { display: flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; color: #56625c; background: #fff; cursor: pointer; white-space: nowrap; }
.technical-toggle input { width: 16px; min-height: 16px; accent-color: var(--brand); }
.technical-toggle span { font-size: 10px; font-weight: 750; }
.field-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; padding: 22px 25px 32px; }
.parameter-field {
  min-width: 0; display: grid; gap: 8px; align-content: start; padding: 14px;
  border: 1px solid var(--line); border-radius: 11px; background: #fbfcff;
}
.parameter-field.wide { grid-column: 1 / -1; }
.parameter-field.changed { border-color: #e4c17f; background: #fffbf3; box-shadow: inset 3px 0 0 var(--amber); }
.parameter-field.pending { border-style: dashed; border-color: #d8b46f; }
.parameter-label { display: flex; align-items: flex-start; justify-content: space-between; gap: 9px; }
.parameter-label > div { min-width: 0; display: grid; gap: 3px; }
.parameter-label b { color: #36423c; font-size: 11px; line-height: 1.3; }
.parameter-label code { overflow: hidden; color: #829089; font-size: 8px; text-overflow: ellipsis; }
.type-badge {
  flex: 0 0 auto; padding: 4px 6px; border-radius: 5px; color: var(--brand);
  background: var(--brand-soft); font-size: 7px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase;
}
.type-badge.pending { color: #805513; background: var(--amber-soft); }
.field-badges { display: flex; flex: 0 0 auto; align-items: center; justify-content: flex-end; gap: 5px; flex-wrap: wrap; }
.unit-badge { padding: 4px 6px; border-radius: 5px; color: #5d6b82; background: #edf1f7; font-size: 7px; font-weight: 850; }
.parameter-field input, .parameter-field select, .parameter-field textarea { min-height: 38px; padding: 8px 10px; font-family: inherit; font-size: 12px; }
.parameter-field textarea { min-height: 92px; font-family: "Cascadia Code", Consolas, monospace; font-size: 10px; line-height: 1.45; }
.parameter-field small { color: var(--muted); font-size: 8px; line-height: 1.4; }
.parameter-field .field-description { color: #59655f; }
.parameter-field .field-format-help { padding-top: 5px; border-top: 1px solid #e8ece9; color: #7b8680; }
.field-error { color: var(--red) !important; font-weight: 700; }

.validation-panel { position: sticky; top: 0; min-height: 760px; padding: 23px 20px; background: #fbfcff; }
.validation-heading { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.validation-heading h2 { margin: 4px 0 5px; font-size: 19px; letter-spacing: -.03em; }
.validation-heading > p:last-child { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.validation-heading.valid h2 { color: var(--brand); }
.validation-heading.invalid h2 { color: var(--red); }
.validation-empty { min-height: 290px; display: grid; justify-items: center; align-content: center; gap: 13px; text-align: center; }
.validation-empty span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: var(--brand); background: var(--brand-soft); font-weight: 900; }
.validation-empty p { max-width: 260px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.issue-groups { display: grid; gap: 17px; padding-top: 18px; }
.issue-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 9px; }
.issue-title h3 { margin: 0; font-size: 11px; }
.issue-title > span { padding: 4px 6px; border-radius: 5px; color: #795216; background: var(--amber-soft); font-size: 7px; font-weight: 900; }
.issue-list { display: grid; gap: 7px; }
.issue-row { padding: 9px; border-radius: 8px; background: var(--amber-soft); border: 1px solid #f0dab1; }
.issue-row.error { background: var(--red-soft); border-color: #efc8c8; }
.issue-row b { display: block; margin-bottom: 3px; color: #624617; font-size: 9px; }
.issue-row.error b { color: #7c3030; }
.issue-row p { margin: 0; color: #695b42; font-size: 9px; line-height: 1.4; }
.issue-row.error p { color: #745050; }
.preview-section { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.preview-comparison { display: grid; gap: 8px; }
.preview-comparison article { padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.preview-comparison article.draft-preview { border-color: #bfd1f1; background: #f1f6ff; }
.preview-comparison article > span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .06em; }
.preview-comparison article > strong { display: block; color: #26332d; font-size: 11px; }
.preview-scores { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 9px; }
.preview-scores span { display: grid; gap: 2px; padding: 6px; border-radius: 6px; color: var(--brand); background: var(--brand-soft); font-size: 7px; }
.preview-scores b { color: var(--ink); font-size: 10px; }
.preview-note { margin: 9px 0 0; color: var(--muted); font-size: 8px; line-height: 1.4; }

.draft-notice {
  position: fixed; right: 24px; bottom: 104px; z-index: 20; max-width: 360px; padding: 12px 16px;
  border: 1px solid #b9cdf0; border-radius: 10px; color: #173d7a; background: #eff5ff;
  box-shadow: 0 12px 32px rgba(17,47,100,.18); font-size: 11px; font-weight: 700;
}
.draft-notice.error { color: #762f2f; background: #fff1f1; border-color: #eac1c1; }
.admin-actions {
  position: fixed; inset: auto 0 0; z-index: 15; min-height: 82px; display: flex;
  justify-content: space-between; align-items: center; gap: 20px; padding: 13px clamp(20px, 4vw, 64px);
  background: rgba(255,255,255,.96); border-top: 1px solid #cdd8e8; box-shadow: 0 -10px 35px rgba(17,47,100,.1); backdrop-filter: blur(12px);
}
.admin-actions > div:first-child { display: grid; gap: 3px; }
.admin-actions > div:first-child span { color: #3c4943; font-size: 10px; font-weight: 750; }
.admin-actions > div:first-child small { color: var(--muted); font-size: 8px; }
.action-buttons { display: flex; align-items: center; gap: 8px; }
.admin-validate { min-width: 205px; }
.admin-footer { margin-bottom: 8px; }

/* Refuerzo de legibilidad para formularios densos de configuración. */
.admin-intro > div:first-child > p:last-child { font-size: 16px; }
.model-glossary summary b { font-size: 15px; }
.model-glossary summary small, .glossary-action { font-size: 12px; }
.glossary-item b { font-size: 14px; }
.glossary-item strong { font-size: 13px; }
.glossary-item p { font-size: 12px; }
.draft-library-heading > div:first-child > p:last-child { font-size: 14px; }
.database-status { font-size: 12px; }
.draft-card-title h3 { font-size: 15px; }
.draft-card-title p { font-size: 12px; }
.text-button { font-size: 12px; }
.draft-form-grid .field > span { font-size: 13px; }
.draft-form-grid input { font-size: 14px; }
.persistence-help { font-size: 11px; }
.persisted-empty { font-size: 12px; }
.persisted-draft-row strong { font-size: 13px; }
.persisted-draft-row small, .persisted-draft-row > span { font-size: 10px; }
.revision-chip b { font-size: 12px; }
.revision-chip span { font-size: 10px; }
.change-row > code, .change-row > span { font-size: 10px; }
.admin-summary span { font-size: 12px; }
.admin-summary strong { font-size: 17px; }
.nav-heading span { font-size: 12px; }
.nav-heading small { font-size: 13px; }
.section-nav-button { font-size: 14px; }
.section-nav-button span { font-size: 11px; }
.locked-card b { font-size: 13px; }
.locked-card small { font-size: 12px; }
.editor-path code { font-size: 13px; }
.editor-heading h2 { font-size: 23px; }
.editor-heading p { font-size: 14px; }
.editor-heading .button { font-size: 13px; }
.technical-toggle span { font-size: 12px; }
.parameter-label b { font-size: 14px; }
.parameter-label code { font-size: 11px; }
.type-badge { font-size: 10px; }
.unit-badge { font-size: 9px; }
.parameter-field input,
.parameter-field select,
.parameter-field textarea { font-size: 15px; }
.parameter-field textarea { font-size: 13px; }
.parameter-field small { font-size: 11px; }
.validation-heading > p:last-child { font-size: 13px; }
.validation-empty p { font-size: 13px; }
.issue-title h3 { font-size: 14px; }
.issue-title > span { font-size: 10px; }
.issue-row b { font-size: 12px; }
.issue-row p { font-size: 12px; }
.preview-comparison article > span { font-size: 11px; }
.preview-comparison article > strong { font-size: 14px; }
.preview-scores span { font-size: 10px; }
.preview-scores b { font-size: 13px; }
.preview-note { font-size: 11px; }
.admin-actions > div:first-child span { font-size: 13px; }
.admin-actions > div:first-child small { font-size: 11px; }

@media (max-width: 1260px) {
  .admin-workspace { grid-template-columns: 220px minmax(470px, 1fr); }
  .validation-panel { position: static; grid-column: 1 / -1; min-height: 0; border-top: 1px solid var(--line); }
  .parameter-nav, .parameter-editor { min-height: 680px; }
  .preview-comparison { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1360px) {
  .admin-body { padding-bottom: 132px; }
  .admin-actions { align-items: stretch; flex-direction: column; gap: 8px; }
  .admin-actions > div:first-child { display: flex; justify-content: space-between; gap: 16px; }
  .action-buttons { justify-content: flex-end; }
}

@media (max-width: 820px) {
  .admin-body { padding-bottom: 170px; }
  .admin-intro { align-items: stretch; flex-direction: column; }
  .admin-summary { min-width: 0; }
  .admin-workspace { grid-template-columns: 1fr; }
  .draft-library-grid { grid-template-columns: 1fr; }
  .draft-history-card { grid-column: auto; }
  .parameter-nav { min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  #section-nav { display: flex; max-width: 100%; overflow-x: auto; padding-bottom: 5px; }
  .section-nav-button { flex: 0 0 auto; width: auto; white-space: nowrap; }
  .locked-card { display: none; }
  .parameter-editor { min-height: 0; border-right: 0; }
  .glossary-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-actions { align-items: stretch; flex-direction: column; gap: 10px; }
  .admin-actions > div:first-child { text-align: center; }
  .action-buttons { justify-content: center; flex-wrap: wrap; }
}

@media (max-width: 600px) {
  .admin-body { padding-bottom: 0; }
  .admin-shell { width: calc(100% - 20px); margin-top: 15px; }
  .admin-summary { grid-template-columns: 1fr; }
  .draft-library-heading { align-items: stretch; flex-direction: column; padding: 18px; }
  .database-status { align-self: flex-start; }
  .draft-library-grid { padding: 10px; }
  .draft-form-grid { grid-template-columns: 1fr; }
  .change-row { grid-template-columns: 1fr; }
  .change-row > b { display: none; }
  .editor-heading { flex-direction: column; padding: 19px 17px; }
  .editor-tools { width: 100%; align-items: stretch; flex-direction: column; }
  .technical-toggle { justify-content: center; }
  .glossary-grid { grid-template-columns: 1fr; }
  .model-glossary summary { align-items: flex-start; }
  .glossary-action { display: none; }
  .field-list { grid-template-columns: 1fr; padding: 17px; }
  .parameter-field.wide { grid-column: auto; }
  .preview-comparison { grid-template-columns: 1fr; }
  .action-buttons { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .action-buttons .button { width: 100%; }
  .admin-validate { grid-column: 1 / -1; }
  .parameter-field { padding: 13px; }
  .validation-panel { padding: 20px 17px; }
  .admin-actions {
    position: static; margin: 12px 10px 18px; padding: 16px; border: 1px solid var(--line);
    border-radius: 14px; box-shadow: 0 10px 30px rgba(17,47,100,.08); backdrop-filter: none;
  }
}
