:root {
  --ink: #172a3a;
  --muted: #657786;
  --line: #dce5e9;
  --paper: #ffffff;
  --canvas: #f4f7f7;
  --nav: #102f35;
  --nav-soft: #1d4549;
  --teal: #167d7f;
  --teal-dark: #0e6468;
  --mint: #dff1ed;
  --lime: #b8d64f;
  --amber: #d99321;
  --red: #b84b4b;
  --blue: #376d92;
  --shadow: 0 12px 34px rgba(22, 53, 61, .08);
  --radius: 16px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--nav); color: #edf6f4; padding: 28px 20px 20px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 20; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 18px; }
.brand span:last-child { display: flex; flex-direction: column; line-height: 1.05; }
.brand small { font-size: 12px; font-weight: 500; letter-spacing: .08em; opacity: .7; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--lime); color: var(--nav); font-weight: 900; }
.brand-dark { color: var(--ink); }
.context-card { margin: 34px 0 20px; padding: 14px 15px; border-radius: 13px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; gap: 4px; }
.context-card strong { font-size: 14px; }
.context-card small { color: #a9c3c1; font-size: 11px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 10px; font-weight: 800; color: #91b2af; }
.eyebrow.accent { color: var(--teal); }
.eyebrow.light { color: #bbdcca; }
.sidebar-nav { display: flex; flex-direction: column; gap: 6px; }
.sidebar-nav a, .nav-disabled { min-height: 44px; padding: 11px 13px; display: flex; align-items: center; gap: 12px; border-radius: 11px; text-decoration: none; font-size: 13px; color: #c6d9d7; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: white; }
.sidebar-nav a.active { background: var(--nav-soft); color: white; box-shadow: inset 3px 0 var(--lime); }
.sidebar-nav a span, .nav-disabled > span { width: 19px; text-align: center; font-size: 17px; }
.nav-disabled { opacity: .48; cursor: default; }
.nav-disabled small { margin-left: auto; font-size: 8px; text-transform: uppercase; }
.sidebar-footer { margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.11); }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-chip > span { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #2d575a; font-weight: 800; }
.user-chip div { display: flex; flex-direction: column; min-width: 0; }
.user-chip strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.user-chip small { color: #91b2af; font-size: 10px; }
.link-button { border: 0; background: transparent; color: #9fbcb9; font-size: 11px; padding: 4px 0; }
.link-button:hover { color: white; }

.main-panel { min-width: 0; }
.mobile-header { display: none; }
.page-wrap { max-width: 1400px; margin: 0 auto; padding: 38px 44px 56px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-header h1 { margin: 6px 0 4px; font-size: clamp(26px, 3vw, 36px); letter-spacing: -.035em; }
.page-header p { margin: 0; color: var(--muted); font-size: 14px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.button { border: 1px solid transparent; border-radius: 10px; min-height: 42px; padding: 10px 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; font-weight: 750; font-size: 13px; }
.button.primary { color: white; background: var(--teal); box-shadow: 0 7px 16px rgba(22,125,127,.16); }
.button.primary:hover { background: var(--teal-dark); }
.button.secondary { border-color: var(--line); background: white; color: var(--ink); }
.button.danger { background: #fff2f1; color: var(--red); border-color: #edcfcb; }
.button.wide { width: 100%; }
.button.small { min-height: 34px; padding: 7px 11px; font-size: 11px; }

.grid { display: grid; gap: 18px; }
.grid.cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: minmax(0, 1.45fr) minmax(300px, .8fr); }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 21px; box-shadow: var(--shadow); }
.metric-card { min-height: 142px; display: flex; flex-direction: column; justify-content: space-between; }
.metric-card .metric-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--mint); color: var(--teal); font-weight: 900; }
.metric-card strong { font-size: 21px; letter-spacing: -.025em; }
.metric-card small { color: var(--muted); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 17px; }
.card-header h2, .card-header h3 { margin: 0; font-size: 17px; }
.card-header p { color: var(--muted); margin: 4px 0 0; font-size: 12px; }
.section-title { margin: 30px 0 13px; font-size: 16px; }

.status { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 9px; font-size: 10px; font-weight: 850; letter-spacing: .025em; background: #e8eef0; color: #4e626b; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.PUBLICADO { color: #2e765e; background: #e2f3eb; }
.status.EN_REVISION { color: #9a6513; background: #fff1cf; }
.status.PROCESANDO, .status.VALIDANDO { color: #376d92; background: #e4eff7; }
.status.RECIBIDO, .status.ABIERTO { color: #5d6870; background: #edf1f2; }
.status.FALLIDO, .status.RECHAZADO_VALIDACION, .status.CANCELADO { color: var(--red); background: #fbe8e6; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #aaa; }
.status-dot.success { background: var(--lime); box-shadow: 0 0 0 4px rgba(184,214,79,.16); }

.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { color: var(--muted); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.data-table td { padding: 14px 12px; border-bottom: 1px solid #edf1f2; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #f8faf9; }
.data-table a { color: var(--teal-dark); font-weight: 750; text-decoration: none; }
.table-wrap { overflow-x: auto; }
.muted { color: var(--muted); }
.mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 10px; word-break: break-all; }

.progress-flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 4px 0 8px; }
.flow-step { position: relative; padding: 8px 8px 8px 29px; font-size: 10px; color: var(--muted); }
.flow-step::before { content: ""; position: absolute; left: 7px; top: 8px; width: 11px; height: 11px; border-radius: 50%; background: #dce5e6; border: 3px solid white; box-shadow: 0 0 0 1px #dce5e6; }
.flow-step::after { content: ""; position: absolute; left: 18px; top: 14px; right: -6px; height: 1px; background: #dce5e6; }
.flow-step:last-child::after { display: none; }
.flow-step.done::before { background: var(--teal); box-shadow: 0 0 0 1px var(--teal); }
.flow-step.current { color: var(--ink); font-weight: 800; }
.flow-step.current::before { background: var(--lime); box-shadow: 0 0 0 1px #9fbd3b; }

.stack-form { display: flex; flex-direction: column; gap: 9px; }
label { font-size: 12px; font-weight: 750; }
input, select, textarea { width: 100%; border: 1px solid #cfdadd; border-radius: 10px; background: white; padding: 11px 12px; color: var(--ink); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(22,125,127,.11); }
.field-error, .form-error { color: var(--red); font-size: 11px; }
.form-error { border-radius: 9px; padding: 10px; background: #fff0ef; border: 1px solid #efd2cf; }
.help-text { font-size: 11px; color: var(--muted); line-height: 1.55; }
.filter-form { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: 10px; align-items: end; }
.filter-form > div { display: flex; flex-direction: column; gap: 5px; }
.file-drop { border: 1.5px dashed #b9cbce; background: #f8fbfa; padding: 28px; border-radius: 14px; text-align: center; }
.file-drop input { border: 0; padding: 10px 0; }
.file-name { display: block; margin-top: 8px; color: var(--teal-dark); font-weight: 700; font-size: 12px; }
.check-row { display: flex; gap: 9px; align-items: flex-start; }
.check-row input { width: auto; margin-top: 3px; }

.timeline { display: flex; flex-direction: column; }
.timeline-item { display: grid; grid-template-columns: 18px 1fr; gap: 10px; min-height: 64px; }
.timeline-marker { position: relative; width: 10px; height: 10px; border-radius: 50%; background: var(--teal); margin-top: 4px; }
.timeline-marker::after { content: ""; position: absolute; width: 1px; height: 54px; background: var(--line); left: 4px; top: 11px; }
.timeline-item:last-child .timeline-marker::after { display: none; }
.timeline-item strong { font-size: 12px; }
.timeline-item p { margin: 3px 0; font-size: 11px; color: var(--muted); }
.timeline-item time { font-size: 9px; color: #8a9ba4; }

.empty-state { text-align: center; padding: 44px 20px; }
.empty-state .empty-icon { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 16px; background: var(--mint); display: grid; place-items: center; color: var(--teal); font-size: 23px; }
.empty-state h3 { margin: 0 0 6px; }
.empty-state p { color: var(--muted); font-size: 12px; max-width: 460px; margin: 0 auto 16px; }
.artifact-list { display: grid; gap: 9px; }
.artifact-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px; border: 1px solid #e3eaec; border-radius: 11px; }
.artifact-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: #edf3f4; color: var(--teal-dark); font-size: 10px; font-weight: 900; }
.artifact-row strong { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.artifact-row small { color: var(--muted); font-size: 10px; }
.definition-list { display: grid; grid-template-columns: 160px 1fr; gap: 10px 18px; margin: 0; font-size: 12px; }
.definition-list dt { color: var(--muted); }
.definition-list dd { margin: 0; font-weight: 650; }
.json-view { max-height: 360px; overflow: auto; background: #112b31; color: #d7e9e6; border-radius: 12px; padding: 15px; font: 10px/1.6 "Cascadia Mono", Consolas, monospace; white-space: pre-wrap; }
.message-stack { position: fixed; top: 18px; right: 22px; z-index: 50; display: grid; gap: 8px; }
.message { background: #173f42; color: white; border-radius: 11px; padding: 12px 16px; box-shadow: var(--shadow); font-size: 12px; }

.login-body { min-height: 100vh; background: white; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, .85fr) minmax(520px, 1.15fr); }
.login-form-panel { display: grid; place-items: center; padding: 44px; }
.login-inner { width: min(390px, 100%); }
.login-heading { margin: 72px 0 30px; }
.login-heading h1 { font-size: 36px; letter-spacing: -.045em; margin: 8px 0; }
.login-heading p { color: var(--muted); font-size: 14px; line-height: 1.55; }
.security-note { margin-top: 22px; color: #8a9aa2; font-size: 10px; text-align: center; }
.login-visual { position: relative; overflow: hidden; background: linear-gradient(145deg, #0d3136 0%, #174b4d 56%, #1d6663 100%); padding: 66px; color: white; display: flex; flex-direction: column; justify-content: space-between; }
.visual-glow { position: absolute; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(circle, rgba(184,214,79,.21), transparent 64%); right: -90px; top: -100px; }
.visual-copy { position: relative; max-width: 560px; margin-top: 10vh; }
.visual-copy h2 { font-size: clamp(36px, 4vw, 60px); line-height: 1.02; letter-spacing: -.05em; margin: 13px 0 20px; }
.visual-copy p { max-width: 470px; color: #bed2cf; line-height: 1.65; }
.visual-card { position: relative; align-self: flex-end; width: min(410px, 80%); padding: 22px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); border-radius: 18px; backdrop-filter: blur(10px); box-shadow: 0 28px 65px rgba(0,0,0,.2); }
.visual-card > div:first-child { display: flex; align-items: center; gap: 11px; }
.visual-card small { color: #bcd3d0; }
.mini-chart { height: 70px; display: flex; align-items: flex-end; gap: 8px; margin: 22px 0 12px; }
.mini-chart i { flex: 1; background: linear-gradient(#b8d64f, #68a68d); border-radius: 5px 5px 2px 2px; }
.mini-chart i:nth-child(1) { height: 34%; }.mini-chart i:nth-child(2) { height: 55%; }.mini-chart i:nth-child(3) { height: 46%; }.mini-chart i:nth-child(4) { height: 76%; }.mini-chart i:nth-child(5) { height: 92%; }

@media (max-width: 1100px) {
  .grid.cards-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two { grid-template-columns: 1fr; }
  .filter-form { grid-template-columns: 1fr 1fr; }
  .login-shell { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; transform: translateX(-100%); transition: transform .2s ease; width: 270px; }
  .sidebar.open { transform: translateX(0); }
  .mobile-header { display: flex; align-items: center; gap: 13px; height: 58px; padding: 0 18px; background: white; border-bottom: 1px solid var(--line); }
  .menu-toggle { border: 0; background: transparent; font-size: 21px; }
  .page-wrap { padding: 24px 18px 44px; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .grid.cards-4, .filter-form { grid-template-columns: 1fr; }
  .progress-flow { grid-template-columns: 1fr; }
  .flow-step::after { width: 1px; height: 18px; left: 12px; top: 21px; right: auto; }
  .definition-list { grid-template-columns: 1fr; gap: 4px; }
  .definition-list dd { margin-bottom: 8px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-form-panel { padding: 30px 22px; min-height: 100vh; }
  .login-heading { margin-top: 50px; }
  .login-visual { display: none; }
  .message-stack { left: 16px; right: 16px; }
}
