:root {
  --ink: #18202a;
  --muted: #697483;
  --line: #dfe5ec;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --blue: #245b8f;
  --teal: #127c79;
  --green: #22835a;
  --amber: #a86800;
  --red: #ad3434;
  --gray: #69707a;
  --shadow: 0 14px 34px rgba(22, 32, 42, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { background: #18202a; color: #f8fafc; padding: 22px 18px; display: flex; flex-direction: column; gap: 24px; }
.brand { display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: center; color: #fff; }
.brand strong { display: block; font-size: 15px; }
.brand small { display: block; color: #b8c1cc; font-size: 12px; margin-top: 2px; }
.mark { width: 42px; height: 42px; border-radius: 8px; background: linear-gradient(135deg, #f7c96a, #2f84b7 55%, #22a06b); position: relative; box-shadow: inset 0 0 0 1px rgba(255,255,255,.28); }
.mark:before, .mark:after { content: ""; position: absolute; background: rgba(255,255,255,.88); border-radius: 2px; }
.mark:before { width: 20px; height: 4px; top: 13px; left: 11px; }
.mark:after { width: 14px; height: 4px; top: 24px; left: 11px; }
.nav { display: grid; gap: 6px; }
.nav a { display: grid; grid-template-columns: 24px 1fr; align-items: center; gap: 10px; min-height: 42px; padding: 0 10px; border-radius: 8px; color: #ced7e0; }
.nav a.active, .nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.ico { width: 20px; height: 20px; display: inline-block; position: relative; }
.ico:before, .ico:after { content: ""; position: absolute; border: 2px solid currentColor; border-radius: 4px; inset: 3px; }
.ico.dashboard:after { inset: 7px 3px 3px 11px; border-left: 2px solid currentColor; border-top: 0; border-bottom: 0; border-right: 0; }
.ico.files:before { border-radius: 3px; inset: 2px 4px 2px 5px; }
.ico.files:after { inset: 6px 8px 9px 9px; border-left: 0; border-right: 0; border-radius: 0; }
.ico.cpv:before { border-radius: 50%; }
.ico.cpv:after { width: 8px; height: 2px; border: 0; background: currentColor; transform: rotate(45deg); right: 1px; bottom: 2px; left: auto; top: auto; }
.ico.audit:before { inset: 2px 5px; }
.ico.audit:after { border: 0; border-top: 2px solid currentColor; border-bottom: 2px solid currentColor; height: 7px; left: 9px; right: 9px; top: 7px; border-radius: 0; }
.ico.users:before { border-radius: 50%; inset: 2px 6px 9px; }
.ico.users:after { inset: 11px 3px 3px; border-radius: 8px 8px 4px 4px; border-top: 2px solid currentColor; }
.sidebar-card { margin-top: auto; padding: 14px; border-radius: 8px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); }
.sidebar-card strong { display: block; margin-bottom: 6px; }
.sidebar-card span { color: #b8c1cc; font-size: 13px; line-height: 1.4; }

.main { min-width: 0; display: grid; grid-template-rows: auto 1fr; }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 28px; background: rgba(255,255,255,.88); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3; }
.crumb strong { display: block; font-size: 15px; }
.crumb span { color: var(--muted); font-size: 13px; }
.user { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #e8eef4; color: var(--blue); display: grid; place-items: center; font-weight: 800; flex: 0 0 auto; }
.content { padding: 26px 28px 42px; min-width: 0; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }

h1 { font-size: 28px; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 0; }
h3 { font-size: 15px; margin: 14px 0 8px; }
p { color: var(--muted); line-height: 1.45; }
.muted { color: var(--muted); font-size: 13px; }

.hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, .7fr); gap: 18px; align-items: stretch; margin-bottom: 18px; }
.hero-main { min-height: 214px; border-radius: 8px; overflow: hidden; position: relative; background: linear-gradient(120deg, rgba(24,32,42,.92), rgba(36,91,143,.72)), repeating-linear-gradient(90deg, rgba(255,255,255,.1) 0 1px, transparent 1px 72px), repeating-linear-gradient(0deg, rgba(255,255,255,.08) 0 1px, transparent 1px 54px); box-shadow: var(--shadow); color: #fff; padding: 24px; display: flex; flex-direction: column; justify-content: space-between; }
.hero-main:after { content: ""; position: absolute; width: 260px; height: 260px; right: -72px; bottom: -80px; border-radius: 50%; border: 36px solid rgba(247,201,106,.36); }
.hero-main h1, .hero-main p, .hero-actions { position: relative; z-index: 1; }
.hero-main h1 { color: #fff; font-size: 30px; max-width: 760px; }
.hero-main p { max-width: 760px; color: rgba(255,255,255,.78); margin: 0; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.button, button { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; min-height: 38px; padding: 8px 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; font-weight: 700; }
.button.primary, button.primary, .primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.button.danger { border-color: #efb1ad; color: var(--red); background: #fff7f6; }
.button.light { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.32); color: #fff; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; display: inline-flex; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 22px rgba(22,32,42,.05); overflow: hidden; }
.panel.pad { padding: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel-head span { color: var(--muted); font-size: 13px; }
.quick-stack { display: grid; gap: 12px; }
.quick-item { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px; padding: 12px; border-radius: 8px; border: 1px solid var(--line); }
.tile-icon { width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-weight: 900; }
.tile-icon.blue { background: var(--blue); }
.tile-icon.teal { background: var(--teal); }
.tile-icon.amber { background: var(--amber); }
.quick-item strong { display: block; }
.quick-item span { color: var(--muted); font-size: 13px; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; min-height: 118px; display: grid; align-content: space-between; position: relative; overflow: hidden; }
.metric:after { content: ""; position: absolute; width: 96px; height: 96px; right: -32px; top: -28px; border-radius: 50%; background: rgba(36,91,143,.1); }
.metric strong { font-size: 34px; }
.metric span { color: var(--muted); }
.metric small { color: var(--green); font-weight: 800; }
.metric.warn small { color: var(--amber); }
.metric.danger small { color: var(--red); }

.grid-two { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; margin-bottom: 18px; }
.grid-equal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.toolbar, .detail-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: start; margin-bottom: 18px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 20px; box-shadow: var(--shadow); }
.toolbar p, .detail-title p { margin: 0; }
.summary-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.summary { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.summary span.label { color: var(--muted); font-size: 12px; text-transform: uppercase; font-weight: 800; }
.summary strong { display: block; margin-top: 7px; font-size: 15px; }

table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; overflow-wrap: anywhere; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; font-weight: 800; background: #f9fafb; }
.code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 800; color: var(--blue); }

.status, .semaphore { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.status:before, .semaphore:before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.green, .verde { color: var(--green); background: #e3f5eb; }
.yellow, .amarillo, .preventiva { color: var(--amber); background: #fff0d1; }
.red, .rojo, .fuerte, .bloqueo, .critica { color: var(--red); background: #fde2e0; }
.gray, .gris, .info { color: var(--gray); background: #e9edf1; }

.risk-list { display: grid; gap: 10px; padding: 16px 18px; }
.risk { border-radius: 8px; border: 1px solid var(--line); padding: 12px; display: grid; gap: 5px; background: #fff; }
.risk strong { font-size: 14px; }
.risk span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.risk.red { border-color: #f1b5b5; background: #fff7f6; color: var(--red); }
.risk.yellow { border-color: #edd09a; background: #fffaf0; color: var(--amber); }
.alert { border-left: 4px solid var(--gray); background: #fff; border-radius: 8px; padding: 12px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.alert.fuerte, .alert.bloqueo, .alert.critica { border-left-color: var(--red); }
.alert.preventiva { border-left-color: var(--amber); }
.alert p { margin: 5px 0 0; }

.timeline { padding: 16px 18px 18px; display: grid; gap: 12px; }
.phase { display: grid; grid-template-columns: 36px 1fr 82px; gap: 12px; align-items: center; }
.phase-dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 900; }
.phase-dot.done { background: var(--green); }
.phase-dot.now { background: var(--blue); }
.phase-dot.wait { background: #a8b2be; }
.phase strong { display: block; font-size: 14px; }
.phase span { color: var(--muted); font-size: 13px; }
.percent { height: 8px; background: #edf1f4; border-radius: 999px; overflow: hidden; }
.percent i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--blue)); border-radius: inherit; }

.workflow { display: grid; grid-template-columns: repeat(6, minmax(112px, 1fr)); gap: 10px; padding: 16px; overflow-x: auto; }
.workflow-step { min-height: 94px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fff; display: grid; align-content: space-between; }
.workflow-step.current { border-color: rgba(36,91,143,.45); background: #f2f7fc; }
.workflow-step strong { font-size: 13px; }
.workflow-step span { color: var(--muted); font-size: 12px; }
.gantt { padding: 18px; display: grid; gap: 12px; }
.gantt-row { display: grid; grid-template-columns: 190px minmax(0, 1fr) 150px auto; gap: 12px; align-items: center; }
.bar-track { height: 18px; background: #edf1f4; border-radius: 999px; position: relative; overflow: hidden; }
.bar { position: absolute; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--teal), var(--blue)); }
.bar.amber { background: linear-gradient(90deg, #d88917, #f2bd5a); }
.bar.red { background: linear-gradient(90deg, #b83c3c, #df7373); }
.gantt-meta { color: var(--muted); font-size: 12px; }

.docs { display: grid; gap: 10px; padding: 16px; }
.doc { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.check { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--green); font-size: 13px; font-weight: 900; }
.check.pending { background: var(--amber); }
.check.blocked { background: var(--red); }
.doc strong { display: block; font-size: 14px; }
.doc span { color: var(--muted); font-size: 12px; }
.hash { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; color: var(--muted); max-width: 142px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.blocked { background: #fff4f2; border: 1px solid #f0b6ad; border-radius: 8px; padding: 14px; margin-bottom: 16px; color: var(--red); }
.blocked pre { white-space: pre-wrap; color: var(--ink); }
.message { padding: 10px 12px; border-radius: 8px; background: #eef2f6; border: 1px solid var(--line); margin-bottom: 10px; }
.message.success { background: #e3f3eb; border-color: #adddc3; }
.message.error { background: #fde2e0; border-color: #efb1ad; }

.form-panel, .login-panel { max-width: 980px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 20px; }
.login-panel { max-width: 440px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
label, .form label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 800; margin: 0 0 12px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; color: var(--ink); background: #fff; }
textarea { resize: vertical; }
.filters { display: flex; gap: 8px; margin-bottom: 14px; }
.filters input { min-width: 280px; }
.filters select { width: auto; min-width: 180px; }
dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; }
dt { color: var(--muted); font-weight: 800; }
dd { margin: 0; }
.access-box { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin: 4px 0 16px; background: #f9fafb; }
.access-box p { margin: 8px 0 0; font-size: 13px; }
.form label.checkline, label.checkline { display: inline-flex; grid-template-columns: none; flex-direction: row; align-items: center; gap: 10px; margin: 0 0 10px; color: var(--ink); }
.form label.checkline input[type="checkbox"], label.checkline input[type="checkbox"] { width: 16px; height: 16px; flex: 0 0 auto; margin: 0; }
.audit-dl { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin: 0 0 16px; }

@media (max-width: 1060px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hero, .grid-two, .grid-equal, .summary-strip, .toolbar, .detail-header { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .actions { justify-content: flex-start; }
}
@media (max-width: 680px) {
  .content { padding: 18px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .metrics { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .gantt-row { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
  .nav { grid-template-columns: 1fr; }
  .quick-item, .doc { grid-template-columns: 1fr; }
}
