:root { color-scheme: light; --ink: #30251f; --muted: #62564c; --line: #d8cec0; --paper: #faf7f0; --green: #225b43; }
* { box-sizing: border-box; }
body { margin: 0; background: #f1ece2; color: var(--ink); font: 15px/1.5 system-ui, sans-serif; }
a { color: #174f39; }
:focus-visible { outline: 3px solid #a75a19; outline-offset: 3px; }
.site-header { background: var(--ink); color: #fffaf1; padding: 17px 4%; display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.site-header strong { letter-spacing: .08em; }
.site-header span { color: #eee3d2; font-size: 13px; }
main { max-width: 1500px; margin: auto; padding: 32px 4% 70px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-weight: 700; font-size: 12px; color: var(--green); margin: 0; }
h1 { font: 36px/1.1 Georgia, serif; margin: 8px 0; }
p { color: var(--muted); }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.notice { max-width: 430px; border-left: 3px solid #a47637; padding-left: 14px; font-size: 13px; }
.workspace { background: var(--paper); border: 1px solid var(--line); margin-top: 25px; }
.filters { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; padding: 20px; border-bottom: 1px solid var(--line); }
.filters .field { display: grid; gap: 5px; flex: 1 1 150px; min-width: 0; align-content: end; }
.filters .field label, .chips legend { font-size: 13px; font-weight: 700; }
.filters .search { flex: 2 1 230px; }
.filter-actions { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.chips { flex: 1 1 320px; min-width: 0; margin: 0; padding: 0; border: 0; }
.chips legend { padding: 0; margin-bottom: 6px; }
.chip-list { position: relative; display: flex; flex-wrap: wrap; gap: 8px; }
.chip-input { position: absolute; width: 1px; height: 1px; min-height: 0; margin: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid #a99b89; border-radius: 20px; background: #fffdfa; color: var(--ink); font-size: 14px; line-height: 1.2; cursor: pointer; user-select: none; }
.chip:hover { background: #ebe3d7; }
.chip-input:checked + .chip { border-color: var(--green); background: var(--green); color: #fff; font-weight: 700; }
.chip-input:checked + .chip:hover { background: #1b4a36; }
.chip-input:checked + .chip::before { content: "\2713"; content: "\2713" / ""; }
.chip-input:focus-visible + .chip { outline: 3px solid #a75a19; outline-offset: 3px; }
/* Tom Select (vendored) drawn like the native inputs; without the script the plain select shows. */
.filters .ts-wrapper { min-width: 0; }
.filters .ts-wrapper .ts-control { min-height: 42px; padding: 8px 11px; border: 1px solid #a99b89; border-radius: 3px; background: #fffdfa; box-shadow: none; color: inherit; font: inherit; cursor: pointer; align-items: center; }
.filters .ts-wrapper.single .ts-control, .filters .ts-wrapper.single.input-active .ts-control { background: #fffdfa; }
.filters .ts-wrapper.single .ts-control > .item { max-width: calc(100% - 22px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filters .ts-wrapper .ts-control > input { min-height: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; }
.filters .ts-wrapper .ts-control > input::placeholder { color: var(--muted); }
.filters .ts-wrapper .ts-control > input:focus-visible { outline: none; }
.filters .ts-wrapper:has(:focus-visible) .ts-control { outline: 3px solid #a75a19; outline-offset: 3px; }
.filters .ts-dropdown { z-index: 30; width: max-content; min-width: 100%; max-width: min(440px, 90vw); border: 1px solid #a99b89; border-radius: 3px; background: #fffdfa; color: var(--ink); font: inherit; box-shadow: 0 6px 16px rgba(48, 37, 31, .18); }
.filters .ts-dropdown .option, .filters .ts-dropdown .no-results { padding: 10px 11px; }
.filters .ts-dropdown .option { white-space: normal; overflow-wrap: anywhere; }
.filters .ts-dropdown .active { background: #e3efe7; color: #1c4d36; }
.filters .ts-dropdown [aria-disabled="true"] { color: var(--muted); cursor: not-allowed; }
.filters .ts-dropdown .no-results { color: var(--muted); }
input, select, button { min-width: 0; min-height: 42px; border: 1px solid #a99b89; border-radius: 3px; background: #fffdfa; padding: 8px 11px; color: inherit; font: inherit; }
input, select { width: 100%; box-sizing: border-box; }
select { cursor: pointer; }
button { cursor: pointer; font-weight: 650; }
button:hover { background: #ebe3d7; }
.clear { padding: 10px 0; font-weight: 700; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.count, .pagination { padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.pagination { justify-content: center; gap: 18px; border-top: 1px solid var(--line); }
.pagination a { font-weight: 700; }
.pagination [aria-current="page"] { color: var(--ink); font-weight: 700; }
button:disabled { cursor: progress; opacity: .7; background: #ebe3d7; }
.gazette-form { margin: 0; }
.table-scroll { overflow-x: auto; }
.table-scroll:focus-visible { outline-offset: -3px; }
.results { border-collapse: collapse; width: 100%; min-width: 1100px; text-align: left; table-layout: fixed; overflow-wrap: anywhere; }
.results .col-id { width: 10%; }
.results .col-name { width: 14%; }
.results .col-action { width: 13%; }
.results .col-priority { width: 8%; }
.results .col-alerts { width: 15%; }
.results .col-matches { width: 16%; }
.results .col-class { width: 6%; }
.results .col-type { width: 9%; }
.results .col-status { width: 9%; }
.results .action-badge { white-space: normal; }
th { background: #eee8dc; color: #51463d; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.matches, .detail-link { color: #194d37; font-weight: 700; }
.empty-row td { padding: 24px 20px; }
.empty-row p { margin-bottom: 0; }
.back-link { display: inline-block; margin-bottom: 24px; font-weight: 700; }
.detail-panel { padding: 24px; }
.details-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 0 24px; margin: 0; }
.details-grid div { padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; }
dt { color: var(--muted); font-size: 13px; font-weight: 700; }
dd { margin: 4px 0 0; }
.detail-matches { margin-top: 24px; }
h2 { font: 26px/1.2 Georgia, serif; }
@media (max-width: 800px) {
  .site-header span { display: none; }
  .intro { display: block; }
  h1 { font-size: 30px; }
  .notice { max-width: none; }
  .filters .field, .filters .search, .chips { flex-basis: 100%; }
  .table-scroll { overflow-x: visible; }
  .results { min-width: 0; }
  .results, .results tbody, .results tr, .results td { display: block; width: 100%; }
  .results thead, .results colgroup { display: none; }
  .results tr { padding: 14px 20px; border-bottom: 1px solid var(--line); }
  .results td { padding: 4px 0; border: 0; }
  .results td::before { content: attr(data-label) ': '; font-weight: 700; }
  .results .empty-row td { padding: 4px 0; }
  .results .empty-row td::before { content: none; }
}
/* A cited DO alert is the strongest finding of the row: a critical tag, read first. */
.tag-cited { border-color: #8a2519; background: #fbe4e0; color: #6e1d13; font-weight: 700; }
/* "Sin alertas" / "Sin coincidencias" mean nothing to show, not a positive status. */
.alerts .empty, .matches .empty { color: var(--muted); font-weight: 400; }
.tag { display: inline-block; max-width: 100%; margin: 0 4px 6px 0; padding: 3px 8px; border: 1px solid #a47637; border-radius: 6px; background: #fbf4e6; color: #4a3411; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; vertical-align: top; }
.tag-flag { border-color: #b3261e; background: #fdecea; color: #7a1812; }
.tag-juan_valdez { border-color: #8a3b12; background: #f9e6d9; color: #5c2709; }
.tag-sim_ort, .tag-sim_fon { border-color: #3b5f8a; background: #e8eff8; color: #1f3a5c; }
.stale { border-left: 3px solid #8a3b12; padding-left: 14px; }
.detail-alerts { margin-top: 24px; }
.detail-alerts blockquote { margin: 4px 0 12px; padding-left: 12px; border-left: 2px solid #a47637; }
.gazette-header { margin: 12px 20px 0; color: var(--muted); }
.gazette-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 20px 20px 0; }
.gazette-hint { margin: 0; font-size: 13px; }
.workspace > p[role="status"], .workspace > .pending, .workspace > .stale { margin: 12px 20px 0; }
.workspace > .stale { padding-left: 14px; }
.priority { font-weight: 700; color: #8a3b12; white-space: nowrap; }
.priority-header { margin: 10px 20px 0; font-size: 13px; }
.priority-notice { margin: 4px 20px 0; border-left: 3px solid #a47637; padding-left: 14px; font-size: 13px; }
.detail-priority { margin-top: 24px; }
.detail-priority ul { margin: 8px 0 14px; }
.detail-action { margin-top: 24px; }
.detail-action ul { margin: 10px 0 14px; }
.action-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 0 24px; margin: 0; }
.action-facts div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.action-link { text-decoration: none; }
.action-badge { display: inline-block; max-width: 100%; padding: 3px 8px; border: 1px solid currentColor; border-radius: 6px; font-size: 12px; font-weight: 700; line-height: 1.4; white-space: nowrap; overflow-wrap: anywhere; vertical-align: top; }
.action-oposicion { background: #fbe4e0; color: #8a2519; }
.action-carta { background: #e3efe7; color: #1c4d36; }
.action-aviso { background: #fbf0da; color: #6d4a09; }
.action-archivo { background: #ece7df; color: #4b4239; }
.action-vencido { background: #e4ded6; color: #5b5147; }
.detail-summary { padding-bottom: 8px; border-bottom: 2px solid var(--line); }
.detail-summary h2 { font-size: 20px; margin: 0 0 8px; }
.summary-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 0 24px; margin: 0; }
.summary-facts div { padding: 10px 0; min-width: 0; }
.summary-facts dd { font-size: 17px; font-weight: 700; }
.summary-facts .badge { font-size: 12px; }
.detail-summary .notice { max-width: none; margin: 8px 0 8px; }
.detail-term { margin-top: 24px; }
.detail-dossier { margin-top: 24px; }
.detail-dossier h3 { margin: 20px 0 8px; font-size: 16px; }
.dossier-form { margin: 0 0 12px; }
.dossier-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 0 24px; margin: 0; }
.dossier-facts div { padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; }
.dossier-table { overflow-x: auto; }
.dossier-table table { width: 100%; border-collapse: collapse; }
.dossier-table td { overflow-wrap: anywhere; }
.term-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 0 24px; margin: 0; }
.term-facts div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.term-status { margin: 14px 0 6px; }
.badge { display: inline-block; max-width: 100%; padding: 3px 8px; border: 1px solid currentColor; border-radius: 6px; line-height: 1.4; overflow-wrap: anywhere; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.badge-abierto { background: #e3efe7; color: #1c4d36; }
.badge-vence-hoy { background: #fbf0da; color: #6d4a09; }
.badge-vencido { background: #fbe4e0; color: #8a2519; }
.badge-no-iniciado { background: #ece7df; color: #4b4239; }
.term-note { font-size: 13px; }
.term-header { color: var(--muted); }
.term-calendar h3 { font: 20px/1.2 Georgia, serif; margin: 20px 0 8px; }
.term-legend { margin: 0 0 14px; padding-left: 20px; font-size: 13px; color: var(--muted); }
.term-legend li { margin-bottom: 2px; }
.calendar { border-collapse: collapse; table-layout: fixed; width: 100%; margin-bottom: 18px; background: #fffdfa; }
.calendar caption { text-align: left; font-weight: 700; padding: 6px 0; color: var(--ink); }
.calendar th { padding: 6px 4px; font-size: 12px; text-align: center; }
.calendar td { height: 72px; padding: 4px; border: 1px solid var(--line); vertical-align: top; font-size: 12px; }
.calendar .calendar-date { display: block; font-weight: 700; font-size: 13px; }
.calendar .calendar-number { display: block; color: var(--green); font-weight: 700; }
.calendar .calendar-mark { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.calendar .weekend { background: #f0ebe1; }
.calendar .holiday { background: #f6eda8; }
.calendar .publication { background: #d9e6f2; }
.calendar .deadline { background: #f3cfc7; }
.calendar .today { outline: 3px solid #a75a19; outline-offset: -3px; }
.calendar .calendar-empty { background: #f7f3ec; }
@media (max-width: 800px) {
  .calendar td { height: 72px; padding: 2px; }
  .calendar .calendar-mark { font-size: 12px; hyphens: auto; }
}
.session { display: flex; align-items: center; gap: 12px; }
.site-header .session-user { display: inline; color: #fffaf1; font-size: 13px; }
.session form { margin: 0; }
.session button { min-height: 32px; padding: 3px 12px; background: transparent; color: #fffaf1; border-color: #eee3d2; font-size: 13px; }
.session button:hover { background: rgba(255, 250, 241, .15); }
.login-panel { max-width: 420px; margin: 48px auto 0; padding: 28px; }
.login-form { display: grid; gap: 16px; margin-top: 16px; }
.login-form .field { display: grid; gap: 5px; }
.login-form label { font-size: 13px; font-weight: 700; }
.login-error { margin: 0; border-left: 3px solid #a33a2a; padding-left: 12px; color: #7a2418; font-weight: 650; }
.flash { margin: 0 0 16px; border-left: 3px solid #a47637; background: var(--paper); padding: 8px 12px; color: var(--ink); font-size: 14px; font-weight: 650; }
.flash.warning { border-left-color: #a33a2a; color: #7a2418; }
.flash.success, .flash.info { border-left-color: var(--green); }
.error-panel { max-width: 520px; margin: 48px auto 0; padding: 28px; }
.error-panel a { color: var(--green); font-weight: 700; }
