:root {
  color-scheme: light;
  --navy: #142841; --blue: #1e527e; --bg: #f3f6fa;
  --line: #dce4ec; --txt: #1d3148; --green: #147a62;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--txt); font: 14px/1.5 system-ui,-apple-system,'Segoe UI',Arial,sans-serif; }
button, select, input { font: inherit; }
button { border: 1px solid #ced9e5; border-radius: 9px; background: #fff; color: var(--txt); padding: 9px 14px; cursor: pointer; font-weight: 650; min-height: 39px; }
button:hover { filter: brightness(.94); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #79b2ed; outline-offset: 2px; }
.blue { background: #265b87; color: #fff; border-color: #265b87; }
.green { background: #117f65; color: #fff; border-color: #117f65; }
.danger { background: #a83744; color: #fff; border-color: #a83744; }
.subtle { background: #e9eef5; }
.header { position: relative; min-height: 110px; display: flex; align-items: center; justify-content: center; background: var(--navy); color: #fff; padding: 16px 110px 16px 255px; box-shadow: 0 3px 14px #0002; }
.brand { position: absolute; left: 18px; width: 215px; max-height: 84px; object-fit: contain; }
.headertext { text-align: center; }
.header h1 { font-size: clamp(17px,2vw,25px); letter-spacing: .045em; margin: 0; }
.header p { margin: 6px 0 0; letter-spacing: .12em; font-size: 12px; color: #c3d8e9; }
.about { position: absolute; right: 18px; top: 22px; padding: 6px 11px; font-size: 12px; min-height: 32px; background: #2b4864; color: #fff; border-color: #54718a; }
main { margin: auto; max-width: 1800px; padding: 14px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: #fff; padding: 12px; border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 3px 12px #12243a10; }
#toggleMaster { order: 99; margin-left: auto; white-space: nowrap; }
.zonewrap { display: flex; align-items: center; gap: 8px; border: 2px solid #317bba; border-radius: 11px; padding: 3px 8px; font-weight: 700; background: #edf6ff; }
.zonewrap select { min-width: 162px; padding: 7px; border: 0; background: #fff; border-radius: 7px; color: #173b60; }
.topline { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin: 12px 0; }
.topline input { width: min(100%,590px); padding: 11px 13px; border: 1px solid #bacada; border-radius: 10px; background: #fff; }
.tablewrap { background: #fff; border: 1px solid var(--line); border-radius: 10px; max-height: 65vh; overflow: auto; box-shadow: 0 2px 10px #12243a12; }
#dataTable { border-collapse: separate; border-spacing: 0; width: 100%; white-space: nowrap; font-size: 13px; table-layout: auto; }
#dataTable.mode-zones { min-width: 860px; }
#dataTable.mode-divisional { min-width: 1520px; }
#dataTable th { position: sticky; top: 0; z-index: 1; text-align: left; vertical-align: middle; white-space: nowrap; background: #244866; color: #fff; font-size: 12px; letter-spacing: .015em; padding: 11px 9px; border-right: 1px solid #476681; }
#dataTable td { padding: 8px 9px; border-bottom: 1px solid #e7edf4; max-width: 310px; overflow: hidden; text-overflow: ellipsis; }
#dataTable tbody tr:nth-child(even) { background: #f8fbff; }
#dataTable tbody tr:hover { background: #eaf2f9; }
#dataTable tbody tr.internal { background: #e9f0fa; }
#dataTable tbody tr.marked { background: #ffe7b7; }
#dataTable .checkcol, #dataTable .selection-cell { width: 52px; text-align: center; }
#dataTable .numbercol, #dataTable .number-cell { width: 58px; color: #51708e; font-variant-numeric: tabular-nums; }
#dataTable .head-cve_colonia { width: 106px; }
#dataTable .head-nom_colonia { min-width: 205px; }
#dataTable .head-sub { width: 67px; }
#dataTable .head-cto { width: 82px; }
#dataTable .head-seccionador { width: 117px; }
#dataTable .head-nom_seccionador { min-width: 184px; }
#dataTable .head-ubicacion { min-width: 220px; }
#dataTable .row-action { text-align: right; }
#dataTable td button:not(.colonia-link) { min-height: 30px; padding: 4px 11px; font-size: 12px; }
.colonia-link { border: 0; background: none; box-shadow: none; color: #175d96; text-decoration: underline; padding: 0 2px; min-height: 0; font-weight: 700; cursor: pointer; }
.colonia-link:hover { background: #e7f4ff; }
input[type=checkbox] { accent-color: #147f68; width: 16px; height: 16px; cursor: pointer; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 15px; padding: 13px; }
.status { background: #172e49; color: #fff; padding: 13px 16px; border-radius: 11px; margin: 0 0 16px; line-height: 1.7; }
.status b { color: #d3f4e6; }
footer { padding: 15px; text-align: center; color: #6d7b89; }
dialog { border: 0; border-radius: 16px; padding: 24px; width: min(96vw,730px); box-shadow: 0 15px 50px #0b23445e; }
dialog::backdrop { background: #0b192a90; }
#confirmTxtDialog { width: min(94vw,520px); }
#confirmTxtDialog p { font-size: 14px; line-height: 1.65; margin: 11px 0; }
dialog h2 { margin: 0 0 13px; }
.formgrid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.formgrid label { display: flex; flex-direction: column; gap: 4px; font-weight: 650; font-size: 12px; }
.formgrid input, .formgrid select { padding: 10px; border: 1px solid #b8cbdc; border-radius: 8px; min-width: 0; background: #fff; color: var(--txt); }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
#noticeBody { max-height: 50vh; overflow: auto; white-space: pre-wrap; }
#progressRow { background: #fff; padding: 10px 14px; border-radius: 10px; margin: 10px 0; display: grid; gap: 5px; }
#progressRow[hidden] { display: none; }
progress { width: 100%; height: 15px; accent-color: #15876a; }
.form-new { grid-template-columns: repeat(2,minmax(0,1fr)); }
.form-new label { font-size: 13px; }
.form-new .contexto { grid-column: 1 / -1; }
.contexto { background: #eef4fa; padding: 10px 12px; border-left: 4px solid #3475a6; border-radius: 7px; margin: 4px 0 12px; color: #244665; }
.form-help { font-size: 13px; color: #9c3740; margin: 12px 0 0; min-height: 20px; }
.form-help.valid { color: #11624a; }
#newModal { width: min(95vw,610px); }
#newSubOtherField[hidden], #newSeccNumField[hidden], .toolbar button[hidden] { display: none!important; }
/* Per-column dropdown: the arrow stays on the title's line. */
#dataTable th[data-field] { white-space: nowrap; }
#dataTable .header-filter { display: inline-flex; align-items: center; justify-content: center; margin-left: 7px; padding: 0 3px; min-height: 25px; width: 23px; border: 1px solid #708aa1; border-radius: 5px; color: #fff; background: #2c5679; font-size: 14px; font-weight: 700; vertical-align: middle; }
#dataTable .header-filter.filter-active { background: #126f70; border-color: #8cf2d2; }
.mobile-filters { display: none; }
.filter-dialog { width: min(94vw,440px); }
.filter-label { display: flex; flex-direction: column; font-weight: 650; gap: 6px; margin: 12px 0; }
.filter-label input, .filter-label select { width: 100%; padding: 10px; border: 1px solid #b8cbdc; border-radius: 8px; background: white; color: var(--txt); }

@media (max-width:850px) {
  .header { padding: 110px 13px 14px; min-height: 170px; }
  .brand { left: 12px; top: 8px; width: 195px; max-height: 84px; }
  .about { right: 10px; top: 18px; }
  .header h1 { font-size: 16px; }
  .header p { font-size: 10px; letter-spacing: .04em; }
  .toolbar { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding: 9px; gap: 7px; }
  .toolbar button { min-width: 0; padding: 9px 6px; font-size: 12px; }
  #toggleMaster { grid-column: 2; justify-self: end; margin-left: 0; }
  .zonewrap { grid-column: 1 / -1; justify-content: space-between; }
  .zonewrap select { flex: 1; }
  .topline { display: block; }
  .topline input { width: 100%; }
  #resultText { display: block; padding: 6px; }
  .status { font-size: 12px; }
  .formgrid, .form-new { grid-template-columns: 1fr; }
  .pagination { gap: 6px; }
  .pagination button { padding: 7px; }
  .mobile-filters { display: flex; gap: 6px; flex-wrap: wrap; padding: 9px 4px 11px; }
  .mobile-filter { min-height: 32px; padding: 6px 9px; background: #e5eff9; color: #244a6e; font-size: 11px; border-color: #b7cfe6; }
  .mobile-filter.filter-active { background: #d2f2e8; border-color: #14846c; }
  /* Both modes use native app-style cards on phones. No hidden desktop
     columns are accidentally exposed in Modo Zonas. */
  .tablewrap { max-height: 68vh; overflow: auto; border: 0; background: transparent; box-shadow: none; }
  #dataTable, #dataTable.mode-zones, #dataTable.mode-divisional { min-width: 0; width: 100%; border: 0; display: block; white-space: normal; }
  #dataTable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #dataTable tbody { display: grid; gap: 10px; }
  #dataTable tbody tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); border: 1px solid #dbe5ef; border-radius: 12px; padding: 8px; background: #fff; box-shadow: 0 2px 9px #12243a10; }
  #dataTable tbody tr:nth-child(even) { background: #fff; }
  #dataTable tbody tr.internal { background: #eff5ff; }
  #dataTable tbody tr.marked { background: #fff0d0; }
  #dataTable td { min-width: 0; max-width: none; border-bottom: 1px solid #edf0f4; display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 8px 9px; overflow-wrap: anywhere; white-space: normal; font-size: 13px; }
  #dataTable td::before { content: attr(data-label); font-size: 10px; line-height: 1.3; font-weight: 750; letter-spacing: .025em; color: #57728a; }
  #dataTable .selection-cell, #dataTable .number-cell { width: auto; flex-direction: row; justify-content: flex-start; align-items: center; text-align: left; }
  #dataTable .cell-cve_colonia { grid-column: 1; font-size: 15px; }
  #dataTable .cell-nom_colonia { grid-column: 2; }
  #dataTable .row-action { grid-column: 1 / -1; text-align: right; border-bottom: 0; align-items: flex-end; }
  #dataTable .row-action button { width: 100%; }
  #dataTable td.cell-ubicacion { grid-column: 1 / -1; }
}

