/* Consumidor ArcGIS — misma paleta del portal: azul naval, acero metalizado, cobalto y blanco */
:root {
  --page: #eef2f7; --surface: #fff; --surface-2: #f5f8fb; --line: #d6dfea; --line-strong: #b9c7d8;
  --ink: #0f2340; --ink-2: #3a5372; --muted: #64809f;
  --cobalt: #1f5fd1; --cobalt-hover: #184fb3; --cobalt-soft: #e3ecfb; --focus: #3b82f6;
  --metal: linear-gradient(165deg, #2a4b78 0%, #37608f 38%, #23426c 62%, #1a3357 100%);
  --ok: #0f7a5c; --ok-soft: #dcf3ea; --warn: #9a5b00; --warn-soft: #fbefd8; --closed: #4f6176; --closed-soft: #e5eaf0;
  --danger: #c0352b; --danger-soft: #fbe5e3;
  --code-bg: #0f1d33; --code-ink: #d7e4f6;
  --shadow: 0 1px 2px rgba(15,35,64,.06), 0 8px 24px -14px rgba(15,35,64,.35);
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0a1526; --surface: #10203a; --surface-2: #142744; --line: #213a5e; --line-strong: #2e4c76;
    --ink: #e7eef8; --ink-2: #b6c7de; --muted: #8aa3c2; --cobalt: #5b93f0; --cobalt-hover: #79a8f5; --cobalt-soft: #16305a;
    --ok: #4cc79f; --ok-soft: #12382f; --warn: #f0b252; --warn-soft: #3a2c12; --closed: #a3b3c7; --closed-soft: #22344d;
    --danger: #f0786d; --danger-soft: #3d1c1c; --code-bg: #071022; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #0a1526; --surface: #10203a; --surface-2: #142744; --line: #213a5e; --line-strong: #2e4c76;
  --ink: #e7eef8; --ink-2: #b6c7de; --muted: #8aa3c2; --cobalt: #5b93f0; --cobalt-hover: #79a8f5; --cobalt-soft: #16305a;
  --ok: #4cc79f; --ok-soft: #12382f; --warn: #f0b252; --warn-soft: #3a2c12; --closed: #a3b3c7; --closed-soft: #22344d;
  --danger: #f0786d; --danger-soft: #3d1c1c; --code-bg: #071022; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.5 var(--font); }
h1, h2 { font-stretch: 85%; letter-spacing: -.01em; margin: 0 0 4px; }
h1 { font-size: 24px; } h2 { font-size: 17px; }
code { font: 13px ui-monospace, SFMono-Regular, Consolas, monospace; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.muted { color: var(--muted); margin: 0; } .small { font-size: 13px; margin-top: 10px; } .right { text-align: right; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.topbar { background: var(--metal); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { display: block; font-size: 18px; font-stretch: 85%; }
.brand span { font-size: 13px; color: #cddbee; }
.logo { width: 38px; height: 38px; border-radius: 9px; background: linear-gradient(180deg, #e9eff6, #cfdae7); display: grid; place-items: center; }
.logo svg { width: 22px; height: 22px; stroke: #1b3557; stroke-width: 2.4; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.top-link { color: #dfe8f3; font-size: 14px; }
.session { font-size: 13px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); border-radius: 999px; padding: 3px 10px; }
.icon-btn { background: transparent; border: 1px solid transparent; color: inherit; border-radius: 8px; padding: 6px; cursor: pointer; display: inline-grid; place-items: center; }
.topbar .icon-btn:hover { background: rgba(255,255,255,.12); }
.topbar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.35); }

.flow { display: grid; grid-template-columns: 1fr auto 1.4fr auto 1fr; align-items: stretch; gap: 8px; max-width: 1480px; margin: 18px auto 0; padding: 0 24px; }
.node { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow); }
.node b { display: block; font-size: 14px; } .node span { font-size: 12.5px; color: var(--muted); }
.node-me { border-left: 4px solid var(--cobalt); } .node-wrap { border-left: 4px solid #2a4b78; } .node-src { border-left: 4px solid #b9852a; opacity: .85; }
.arrow { display: flex; flex-direction: column; justify-content: center; align-items: center; min-width: 90px; color: var(--muted); font-size: 11.5px; text-align: center; }
.arrow::before { content: "⇄"; font-size: 20px; color: var(--cobalt); line-height: 1; }

main { max-width: 1480px; margin: 18px auto 40px; padding: 0 24px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.login { max-width: 460px; margin: 30px auto; }
.login form { display: grid; gap: 12px; margin-top: 16px; }

.field { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea { font: 15px var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.field textarea { min-height: 70px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.field .err { color: var(--danger); font-weight: 500; font-size: 12.5px; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.compact input, .compact select { padding: 6px 8px; font-size: 14px; }
.error { color: var(--danger); background: var(--danger-soft); border-radius: 8px; padding: 8px 10px; margin: 0; }

.btn { font: 600 14px var(--font); border-radius: 8px; padding: 8px 14px; cursor: pointer; border: 1px solid transparent; white-space: nowrap; }
.btn-primary { background: var(--cobalt); color: #fff; } .btn-primary:hover { background: var(--cobalt-hover); }
.btn-secondary { background: linear-gradient(180deg, #e9eff6, #cfdae7); color: #1b3557; border-color: #b9c7d8; }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line-strong); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 9px; font-size: 13px; }
.btn[disabled] { opacity: .6; cursor: progress; }

.toolbar { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: flex-end; padding: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; }
.search, .filters { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.search input { width: 120px; }
.notice { border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; border: 1px solid; }
.notice.info { background: var(--cobalt-soft); border-color: var(--cobalt); }
.notice.warn { background: var(--warn-soft); border-color: var(--warn); }
.notice.danger { background: var(--danger-soft); border-color: var(--danger); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.highlight td { background: var(--cobalt-soft); }
td .sub { display: block; font-size: 12.5px; color: var(--muted); }
td.actions { white-space: nowrap; text-align: right; }
td.nowrap { white-space: nowrap; } td.project { min-width: 170px; }
td.actions .btn { margin-left: 4px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.b-VIGENTE, .b-HIT, .b-ok { background: var(--ok-soft); color: var(--ok); }
.b-EN_ANALISIS, .b-MISS, .b-STALE { background: var(--warn-soft); color: var(--warn); }
.b-CERRADO, .b-none { background: var(--closed-soft); color: var(--closed); }
.b-error { background: var(--danger-soft); color: var(--danger); }

.trace { position: sticky; top: 16px; }
.trace dl { display: grid; grid-template-columns: 96px 1fr; gap: 6px 10px; margin: 12px 0; font-size: 13.5px; }
.trace dt { color: var(--muted); } .trace dd { margin: 0; word-break: break-all; }
.trace .explain { font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 0 0 10px; }
pre.json { background: var(--code-bg); color: var(--code-ink); border-radius: 10px; padding: 12px; font: 12.5px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; max-height: 420px; overflow: auto; margin: 0; white-space: pre; }
.json .k { color: #8cc4ff; } .json .s { color: #b5e08c; } .json .n { color: #f5c26b; } .json .l { color: #f08fb0; }

.modal-back { position: fixed; inset: 0; background: rgba(8,18,34,.55); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal { background: var(--surface); border-radius: 14px; width: min(860px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); }
.modal-head, .modal-foot { padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-head { border-bottom: 1px solid var(--line); } .modal-foot { border-top: 1px solid var(--line); justify-content: flex-end; }
.modal-body { padding: 16px 18px; overflow: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 30; }
.toast { background: #0f2340; color: #fff; border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); max-width: 380px; font-size: 14px; }
.toast.error { background: var(--danger); }

@media (max-width: 1100px) { .layout { grid-template-columns: minmax(0, 1fr); } .trace { position: static; } }
@media (max-width: 760px) {
  .topbar, main, .flow { padding-left: 16px; padding-right: 16px; }
  .flow { grid-template-columns: 1fr; } .arrow { flex-direction: row; gap: 6px; min-width: 0; } .arrow::before { content: "⇅"; }
  .form-grid { grid-template-columns: 1fr; }
  .card-head { flex-direction: column; }
}
