:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #1a2b3c;
  --muted: #6b7a8a;
  --accent: #1f4e79;
  --accent2: #2e75b6;
  --border: #e2e8f0;
  --danger: #c0392b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}

.topbar {
  background: #12283c;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  height: 54px;
}
.topbar .brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; }
.topbar .brand span { font-weight: 400; color: #a9c1d6; margin-left: 6px; font-size: 14px; }
.topbar nav a {
  color: #cfe0ef; text-decoration: none; margin-left: 18px; font-size: 14px;
}
.topbar nav a:hover { color: #fff; }

.container { max-width: 1180px; margin: 0 auto; padding: 26px 22px 60px; }

.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 18px; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.page-head h1 { margin: 4px 0 2px; font-size: 24px; }
.crumb { color: var(--accent2); text-decoration: none; font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px; margin-bottom: 16px;
}
.card h2 { margin-top: 0; font-size: 16px; }

.btn {
  display: inline-block; background: #eef2f6; color: var(--ink);
  border: 1px solid var(--border); border-radius: 7px;
  padding: 8px 14px; font-size: 13.5px; cursor: pointer; text-decoration: none;
  font-family: inherit;
}
.btn:hover { background: #e2e9f1; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #173e63; }
.btn.danger { background: #fdf1f0; color: var(--danger); border-color: #f2c9c4; }
.btn.tiny { padding: 2px 8px; font-size: 12px; }

.table { width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { background: #f0f4f8; font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.table a.strong { color: var(--accent); text-decoration: none; font-weight: 600; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } }

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label, .grid2 label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.full { grid-column: 1 / -1; }

input, select, textarea {
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 7px;
  font-size: 14px; font-family: inherit; width: 100%;
}
textarea.mono, .mono { font-family: Consolas, "Courier New", monospace; }
.hint { color: var(--muted); font-size: 12.5px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); font-style: italic; }

.tag { background: #e6f0f9; color: var(--accent); border-radius: 5px;
  padding: 2px 8px; font-size: 12px; font-family: Consolas, monospace; }
.tag.ext { background: #fdf3e0; color: #9a6b00; }

.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline { display: inline; }

.doc-body h1 { font-size: 21px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.doc-body h2 { font-size: 17px; margin-top: 22px; }
.doc-body h3 { font-size: 15px; }
.doc-body table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 13px; }
.doc-body table th, .doc-body table td { border: 1px solid var(--border); padding: 6px 9px; }
.doc-body table th { background: #f0f4f8; }
.doc-body blockquote { border-left: 3px solid var(--accent2); margin: 10px 0;
  padding: 4px 14px; color: #40586e; background: #f5f9fc; }
.doc-body code { background: #eef1f4; padding: 1px 5px; border-radius: 4px; font-size: 13px; }

.adjuntos { list-style: none; padding: 0; }
.adjuntos li { display: flex; gap: 10px; align-items: center; padding: 7px 0;
  border-bottom: 1px solid var(--border); }
.adjuntos li:last-child { border-bottom: none; }

.group { margin: 22px 0 6px; font-size: 15px; color: var(--accent); }

.rels { list-style: none; padding: 0; margin: 4px 0 14px; }
.rels li { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.rels li:last-child { border-bottom: none; }
.rels .tag { margin-right: 6px; }

.oculto { display: none; }
.table tr.asignado td { color: var(--muted); background: #fafbfc; }
.cell-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cell-actions .inline-form { display: inline-flex; gap: 6px; align-items: center; }

.batch-tools { display: flex; gap: 6px; }
.batch { max-height: 280px; overflow-y: auto; border: 1px solid var(--border);
  border-radius: 7px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.batch .check { display: flex; align-items: center; gap: 8px; font-weight: 400;
  font-size: 13.5px; padding: 3px 4px; cursor: pointer; border-radius: 4px; }
.batch .check:hover { background: #f2f6fa; }
.batch .check input { width: auto; }
.flash { background: #eaf7ea; border: 1px solid #bfe3bf; color: #1e7b1e;
  border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.error-box { border-color: #f2c9c4; background: #fdf6f5; }
