
:root {
  color-scheme: light;
  --ink: #142b38;
  --muted: #4d626b;
  --paper: #fff;
  --canvas: #f4f7f6;
  --line: #dce6e2;
  --green: #116353;
  --green-dark: #0b4b3e;
  --pale: #e9f4ee;
  --radius: 11px;
  font: 16px/1.5 "Segoe UI", Calibri, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { opacity: .6; cursor: wait; }
a { color: var(--green); }
:focus-visible { outline: 3px solid #398f79; outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
svg { display: block; width: 1.15em; height: 1.15em; }

.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner, .site-nav, main { width: min(100% - 44px, 1120px); margin-inline: auto; }
.header-inner { min-height: 70px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 17px; line-height: 1.15; text-decoration: none; letter-spacing: -.02em; }
.brand small { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); letter-spacing: 0; }
.brand-mark { width: 39px; height: 39px; border-radius: 9px; background: #154b43; color: #d9f5e8; font-size: 21px; }
.site-nav { display: flex; gap: clamp(12px, 3vw, 30px); }
.nav-item { text-decoration: none; color: var(--muted); font-size: .91rem; font-weight: 600; padding: 10px 0; border-bottom: 3px solid transparent; white-space: nowrap; }
.nav-item:hover { color: var(--green); }
.nav-item[aria-current="page"] { color: var(--green); border-bottom-color: var(--green); }
main { padding-block: 34px 55px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); line-height: 1.09; letter-spacing: -.05em; font-weight: 730; }
h2 { font-size: 1.22rem; letter-spacing: -.025em; line-height: 1.25; }
h3 { font-size: 1rem; line-height: 1.4; }
.page-head p { color: var(--muted); margin-top: 6px; font-size: .94rem; }
.page-head .section-tag { margin: 0 0 5px; font-size: .83rem; color: var(--green); font-weight: 650; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.button { min-height: 40px; border-radius: 7px; border: 1px solid transparent; padding: 7px 12px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: .9rem; font-weight: 630; text-decoration: none; white-space: nowrap; line-height: 1.2; }
.button.primary { background: var(--green); color: white; }
.button.primary:hover { background: var(--green-dark); }
.button.outline { border-color: #cfdcd8; background: var(--paper); color: var(--ink); }
.button.outline:hover { background: var(--pale); border-color: #94b5aa; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); margin-bottom: 18px; }
.stat { min-width: 0; border: 0; border-radius: 0; border-right: 1px solid var(--line); background: transparent; text-align: left; padding: 10px 16px; display: flex; align-items: center; gap: 10px; color: var(--muted); }
.stat:first-child { border-radius: 10px 0 0 10px; }
.stat:last-child { border: 0; border-radius: 0 10px 10px 0; }
.stat:hover, .stat[aria-pressed="true"]:not([data-stat=""]) { background: var(--pale); color: var(--green-dark); }
.stat strong { color: var(--ink); font-size: 1.45rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: .88rem; }
.filters { padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid var(--line); }
.search { display: flex; align-items: center; flex: 1 1 200px; min-width: 130px; gap: 8px; padding-left: 10px; border-radius: 7px; border: 1px solid #cfdcd8; color: var(--muted); }
.search:focus-within { outline: 2px solid #398f79; outline-offset: 1px; }
.search input { border: 0; outline: 0; width: 100%; min-width: 0; height: 38px; background: transparent; padding-right: 7px; color: var(--ink); }
.search input::placeholder { color: #597079; }
.filters select { border: 1px solid #cfdcd8; border-radius: 7px; background: var(--paper); color: var(--ink); padding: 6px 9px; }
.filters select, .search input { font-size: .9rem; }
.table-wrap { position: relative; overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th { padding: 10px 12px; color: #3c555b; background: #f4f8f6; font-size: .83rem; font-weight: 650; white-space: nowrap; }
td { border-bottom: 1px solid #e6edeb; padding: 10px 12px; font-size: .9rem; }
th:first-child, td:first-child { padding-left: 16px; }
td:last-child { width: 40px; }
tbody tr:hover { background: #f7fbf9; }
.subject { color: var(--ink); font-weight: 650; text-align: left; border: 0; padding: 0; background: none; overflow-wrap: anywhere; }
.subject:hover { color: var(--green); text-decoration: underline; }
.subject-meta { display: block; margin-top: 2px; color: var(--muted); font-size: .79rem; }
.subject-deadline { display: none; }
.area-name, .date-value { white-space: nowrap; }
.chip { color: #425963; background: #edf2f3; border-radius: 5px; display: inline-block; padding: 3px 7px; white-space: nowrap; font-size: .8rem; font-weight: 630; }
.chip[data-status="Observado"] { color: #85430e; background: #f9ecdc; }
.chip[data-status="Recibido"], .chip[data-status="Solicitado"] { color: #31577d; background: #eaf1f8; }
.chip[data-status="Verificado"] { color: #145b4a; background: var(--pale); }
.overdue { color: #982b20; font-weight: 650; }
.empty { text-align: center; color: var(--muted); padding: 25px; }
.record-count { color: var(--muted); font-size: .84rem; padding: 10px 16px; }
.page-note { color: var(--muted); font-size: .84rem; margin-top: 12px; }

.guide-page { max-width: 920px; }
.guide-block { padding: 17px 20px; margin-bottom: 12px; }
.guide-block h2 { margin-bottom: 9px; }
.guide-block p { color: var(--muted); }
.guide-block > h3 { margin-top: 14px; }
.guide-links { display: flex; flex-wrap: wrap; gap: 5px 16px; font-size: .88rem; margin-top: 10px; }
.org-tree, .org-tree ul { list-style: none; margin: 0; padding: 0; }
.org-root { display: inline-block; background: #154b43; color: white; border-radius: 7px; padding: 7px 11px; font-weight: 680; }
.org-tree ul { margin-left: 15px; }
.org-tree ul li { position: relative; padding: 4px 0 3px 20px; }
.org-tree ul li::before { content: ""; position: absolute; inset: 0 auto 0 0; height: 100%; width: 13px; border-left: 1px solid #9dbbb1; }
.org-tree ul li::after { content: ""; position: absolute; top: .98em; left: 0; width: 13px; border-top: 1px solid #9dbbb1; }
.org-tree ul li:last-child::before { height: .98em; }
.org-focus { color: var(--green-dark); font-weight: 710; }
.request-text { margin: 4px 0 9px; }
.unit-list article { padding: 10px 0; border-top: 1px solid #e4ece8; }
.unit-list article:last-child { padding-bottom: 0; }
.unit-list small { display: inline-block; margin-left: 5px; font-weight: 500; color: var(--muted); font-size: .79rem; }
.legal-steps { padding-left: 24px; margin: 13px 0 0; }
.legal-steps li + li, .guide-list li + li { margin-top: 10px; }
.legal-steps li::marker { color: var(--green); font-weight: 680; }
.legal-steps h3 { margin-bottom: 3px; }
.guide-list { margin: 0; padding-left: 21px; }
.guide-list li { color: var(--muted); }
.source-link { border-bottom: 1px solid #e6eeeb; min-height: 48px; color: var(--ink); display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 600; padding: 7px 0; }
.source-link:last-child { border-bottom: 0; }
.source-link:hover { color: var(--green); text-decoration: underline; }
.source-icon { color: var(--green); width: 26px; height: 26px; background: var(--pale); border-radius: 5px; font-size: .9rem; }
.source-link span:last-child { margin-left: auto; color: var(--muted); }

dialog { width: min(620px, calc(100% - 24px)); max-height: calc(100dvh - 28px); border: 1px solid var(--line); border-radius: var(--radius); padding: 0; color: var(--ink); box-shadow: 0 15px 60px #122c3640; }
dialog::backdrop { background: #142b3899; }
.dialog-head { padding: 15px 18px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; border-bottom: 1px solid var(--line); }
.dialog-head p { color: var(--muted); font-size: .88rem; margin-top: 4px; }
.icon-button { width: 32px; height: 32px; background: transparent; border: 0; border-radius: 6px; color: var(--ink); }
.icon-button:hover { background: var(--pale); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; padding: 15px 18px; }
.fields label { display: grid; gap: 4px; font-size: .9rem; min-width: 0; font-weight: 630; }
.fields input, .fields select, .fields textarea { width: 100%; min-width: 0; padding: 7px 8px; color: var(--ink); background: white; border: 1px solid #cfdcd7; border-radius: 7px; font-weight: 400; }
.fields textarea { resize: vertical; line-height: 1.45; }
.wide { grid-column: 1 / -1; }
.field-note { color: var(--muted); font-size: .85rem; }
.field-note:empty { display: none; }
.dialog-actions { border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 18px; }
.toast { position: fixed; bottom: 16px; right: 18px; max-width: calc(100% - 36px); border-radius: 8px; color: #fff; background: #173d34; padding: 12px 16px; font-size: .9rem; box-shadow: 0 3px 18px #102b3838; }

@media (max-width: 640px) {
  .header-inner, .site-nav, main { width: calc(100% - 24px); }
  .header-inner { min-height: 57px; }
  .brand { font-size: .98rem; }
  .brand-mark { width: 34px; height: 34px; }
  .brand small { margin-top: 2px; }
  .site-nav { gap: 5px 12px; flex-wrap: wrap; }
  .nav-item { font-size: .83rem; padding-block: 7px; }
  main { padding-block: 20px 33px; }
  .page-head { align-items: flex-start; flex-wrap: wrap; gap: 8px; margin-bottom: 13px; }
  .page-head p { font-size: .86rem; }
  .button { min-height: 38px; padding-inline: 8px; font-size: .85rem; }
  .stats { grid-template-columns: 1fr 1fr; margin-bottom: 12px; }
  .stat { padding: 6px 10px; gap: 8px; }
  .stat:first-child { border-radius: 10px 0 0 0; }
  .stat:nth-child(2) { border-right: 0; border-radius: 0 10px 0 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stat:last-child { border-radius: 0 0 10px 0; }
  .stat span { font-size: .8rem; }
  .filters { padding: 10px; }
  .search { flex-basis: 100%; }
  .filters select { flex: 1 1 125px; width: 0; min-width: 120px; }
  .filters .button { justify-content: flex-start; }
  th, td { padding: 7px 5px; font-size: .82rem; }
  th:first-child, td:first-child { padding-left: 9px; }
  th:nth-child(n+4), td:nth-child(n+4) { display: none; }
  .subject-meta, .subject-deadline { font-size: .76rem; }
  .subject-deadline { display: block; margin-top: 2px; }
  .chip { font-size: .73rem; padding: 3px 4px; }
  .guide-block { padding: 12px 13px; }
  .fields { padding: 12px 13px; gap: 8px; }
  .dialog-head, .dialog-actions { padding: 12px 13px; }
}
@media print {
  :root { background: white; font-size: 11pt; }
  .site-header, #infra-page button, #infra-page .page-actions, dialog, .toast { display: none !important; }
  main, .guide-page { width: 100%; max-width: none; padding: 0; }
  .page-head { margin-bottom: 10px; }
  .guide-block { break-inside: avoid; padding: 8px 10px; }
  .org-root { background: none; padding: 0; color: var(--ink); }
  .guide-block h2 { margin-bottom: 4px; }
  .request-text, .guide-links { margin-bottom: 0; }
}
