/* =====================================================================
   Cuadro general — bandeja de pendientes.
   Usa los colores y tipografías definidos en styles.css.
   ===================================================================== */

/* ---------- barra superior ---------- */
.top { background: var(--navy-dk); color: var(--on-navy); }
.top-in { max-width: 1520px; margin: 0 auto; padding: 0 20px; min-height: 46px; display: flex; align-items: stretch; gap: 24px; }
.top .brand { color: #fff; font-weight: 700; font-size: 14px; text-decoration: none; display: flex; align-items: center; white-space: nowrap; }
.dash-nav-links { list-style: none; display: flex; gap: 2px; margin: 0; padding: 0; }
.dash-nav-links a { display: flex; align-items: center; height: 100%; padding: 0 12px; color: var(--on-navy-2); text-decoration: none; font-size: 13px; border-bottom: 3px solid transparent; padding-top: 3px; }
.dash-nav-links a:hover { color: #fff; }
.dash-nav-links a[aria-current] { color: #fff; font-weight: 500; border-bottom-color: var(--red); }
.sync { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--on-navy-2); white-space: nowrap; }
.sync b { color: #fff; font-weight: 500; }
.sync button, .user a { background: transparent; border: 1px solid var(--navy-line); color: var(--on-navy); border-radius: 3px; padding: 3px 9px; font-size: 12px; text-decoration: none; }
.sync button:hover, .user a:hover { background: var(--navy); color: #fff; }
.user { display: flex; align-items: center; padding-left: 14px; border-left: 1px solid var(--navy-line); }

/* ---------- franja ---------- */
.wrap { max-width: 1520px; margin: 0 auto; padding: 0 20px; width: 100%; }
.strip { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 24px; padding: 12px 0 11px; color: var(--ink-2); font-size: 12.5px; }
.strip h1 { font-size: 15px; font-weight: 600; color: var(--ink); margin: 0 8px 0 0; letter-spacing: -0.01em; }
.strip h1 span { font-weight: 400; color: var(--ink-3); margin-left: 6px; }
.strip .n { font-family: var(--mono); font-weight: 600; color: var(--ink); font-size: 13.5px; margin-right: 4px; }
.strip .acts { margin-left: auto; display: flex; gap: 6px; }
.btn-t { display: inline-block; border: 1px solid var(--rule); background: var(--paper); border-radius: 3px; padding: 5px 11px; font-size: 12.5px; font-weight: 500; color: var(--ink); white-space: nowrap; text-decoration: none; cursor: pointer; }
.btn-t:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-t.solid { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-t.solid:hover { background: var(--navy-dk); color: #fff; }
.btn-t:disabled { opacity: .45; cursor: not-allowed; }
#alert-container:not(:empty) { padding-top: 12px; }

/* ---------- rejilla ---------- */
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
@media (max-width: 1150px) { .grid { grid-template-columns: 1fr; } }

/* ---------- bandeja ---------- */
.tray { background: var(--paper); border-radius: 2px; box-shadow: 0 0 0 1px var(--rule-soft); min-width: 0; }
.tray-head { display: flex; align-items: flex-end; flex-wrap: wrap; padding: 14px 18px 0; border-bottom: 1px solid var(--rule); }
.tray-head h2 { font-size: 20px; font-weight: 600; margin: 0 34px 14px 0; letter-spacing: -0.02em; line-height: 1.1; }
.tray-head h2 small { display: block; font-size: 12px; font-weight: 400; color: var(--ink-3); letter-spacing: 0; margin-top: 3px; }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 0 22px 9px 0; margin-right: 22px; text-align: left; color: var(--ink-2); cursor: pointer; }
.tab .big { display: block; font-family: var(--mono); font-weight: 600; font-size: 34px; line-height: 1; letter-spacing: -0.04em; }
.tab .lbl { display: block; font-size: 12px; margin-top: 4px; }
.tab .split { display: block; font-size: 11.5px; margin-top: 2px; min-height: 16px; }
.tab .split em { font-style: normal; font-weight: 600; margin-right: 6px; }
.tab .split em.r { color: var(--red); }
.tab .split em.o { color: var(--orange); }
.tab .split em.y { color: #9A7A00; }
.tab.red .big { color: var(--red); }
.tab.orange .big { color: var(--orange); }
.tab.plain .big { color: var(--ink); font-size: 26px; }
.tab[aria-selected="true"] { color: var(--ink); }
.tab.red[aria-selected="true"] { border-bottom-color: var(--red); }
.tab.orange[aria-selected="true"] { border-bottom-color: var(--orange); }
.tab.plain[aria-selected="true"] { border-bottom-color: var(--ink); }
.tab:hover .lbl { color: var(--ink); }
.tray-head .units { margin-left: auto; text-align: right; padding-bottom: 12px; color: var(--ink-3); font-size: 12px; }
.tray-head .units b { display: block; font-family: var(--mono); color: var(--ink); font-size: 15px; font-weight: 600; }

/* franja de vencidas */
.late { border-bottom: 1px solid var(--rule); background: #FBEDEB; }
.late-h { display: flex; align-items: baseline; gap: 10px; padding: 9px 18px 0; }
.late-h b { color: var(--red); font-size: 13px; }
.late-h span { color: var(--ink-3); font-size: 12px; }
.late-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); padding: 6px 0 12px; }
.late-i { padding: 6px 18px 4px; border-left: 1px solid #EBC9C4; cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.late-i:first-child { border-left: 0; }
.late-i:hover { background: #F8E2DF; }
.late-top { display: flex; align-items: baseline; gap: 8px; }
.late-d { font-family: var(--mono); font-size: 24px; font-weight: 600; color: var(--red); letter-spacing: -0.04em; line-height: 1.05; }
.late-when { font-size: 11.5px; color: var(--ink-3); }
.late-r { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.late-r.t { color: var(--ink-2); font-size: 12px; }
.late-r .mono { color: var(--ink-3); font-size: 11.5px; }
.late .obs { max-width: none; }
.late-a { margin-top: 4px; }
.late-foot { padding: 0 18px 8px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.late-more { padding: 0 18px 10px; font-size: 12px; }

.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 9px 18px; border-bottom: 1px solid var(--rule-soft); min-height: 48px; }
.tools[hidden] { display: none; }
.tools.marking { background: var(--navy-tint); }
.search { position: relative; width: 300px; max-width: 100%; }
.search svg { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.field { height: 29px; border: 1px solid var(--rule); background: #fff; border-radius: 3px; padding: 0 8px; font: inherit; font-size: 12.5px; width: 100%; color: var(--ink); }
textarea.field { height: auto; padding: 6px 8px; }
.field:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 2px var(--navy-tint); }
.search .field { padding-left: 28px; }
.sel { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 12px; margin: 0; }
.sel select { height: 29px; border: 1px solid var(--rule); background: #fff; border-radius: 3px; padding: 0 6px; font: inherit; font-size: 12.5px; max-width: 200px; color: var(--ink); }
.linkbtn { background: none; border: 0; color: var(--navy); font-size: 12.5px; padding: 4px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.tools .end { margin-left: auto; }
.marked-count { font-weight: 600; margin-right: 6px; }

.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t thead th { text-align: left; font-weight: 500; font-size: 11.5px; color: var(--ink-3); padding: 7px 8px; border-bottom: 1px solid var(--rule); white-space: nowrap; background: var(--paper); }
table.t thead th.r { text-align: right; }
th .sort { background: none; border: 0; padding: 0; color: inherit; font: inherit; display: inline-flex; align-items: center; gap: 3px; cursor: pointer; }
th .sort:hover, th .sort[data-on] { color: var(--ink); }
th .sort i { opacity: 0; font-style: normal; font-size: 10px; }
th .sort:hover i { opacity: .55; }
th .sort[data-on] i { opacity: 1; }
table.t tbody td { padding: 6px 8px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
table.t tbody tr { cursor: pointer; }
table.t tbody tr:hover td { background: var(--paper-2); }
table.t tbody tr.on td { background: #E3E9F3; }
table.t td.r { text-align: right; }
.cb { width: 30px; padding-left: 18px !important; }
input[type=checkbox] { width: 14px; height: 14px; accent-color: var(--navy); cursor: pointer; margin: 0; vertical-align: middle; }
.oc { font-family: var(--mono); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.route .p, .route .t2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 250px; }
.route .t2 { color: var(--ink-2); font-size: 12px; }
.route .t2 .mono { color: var(--ink-3); font-size: 11.5px; }
.when { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.when.late-txt { color: var(--red); font-weight: 600; }
.qty { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.obs { font-size: 11.5px; line-height: 1.3; color: var(--ink-3); max-width: 270px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }

.acts-row { display: inline-flex; white-space: nowrap; }
.acts-row .go { border: 1px solid var(--navy); color: var(--navy); background: transparent; border-radius: 3px 0 0 3px; padding: 3px 10px; font-size: 12px; font-weight: 600; min-width: 70px; cursor: pointer; }
.acts-row .go:hover { background: var(--navy); color: #fff; }
.acts-row .go.quiet { border-color: var(--rule); color: var(--ink-2); font-weight: 500; }
.acts-row .go.quiet:hover { background: var(--paper-2); color: var(--ink); }
.acts-row .more { border: 1px solid var(--rule); border-left: 0; background: transparent; border-radius: 0 3px 3px 0; width: 28px; color: var(--ink-2); font-weight: 700; letter-spacing: 1px; cursor: pointer; }
.acts-row .more:hover, .acts-row .more[aria-expanded="true"] { background: var(--paper-2); color: var(--ink); }

.foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; padding: 8px 18px; color: var(--ink-3); font-size: 12px; }
.foot .mono { color: var(--ink-2); }
.pages { margin-left: auto; display: flex; gap: 3px; align-items: center; }
.pages button { min-width: 28px; height: 26px; border: 1px solid transparent; background: none; border-radius: 3px; font-family: var(--mono); font-size: 12px; color: var(--ink-2); cursor: pointer; }
.pages button:hover:not(:disabled) { border-color: var(--rule); }
.pages button[aria-current] { background: var(--ink); color: #fff; }
.pages button:disabled { opacity: .35; cursor: default; }
.empty { padding: 30px 18px; color: var(--ink-2); }
.empty b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 4px; }

.menu { position: fixed; z-index: 60; background: #fff; border: 1px solid var(--rule); border-radius: 3px; box-shadow: 0 6px 18px -8px rgba(40, 32, 20, .35); padding: 4px 0; min-width: 200px; }
.menu button, .menu a { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 12px; font-size: 12.5px; color: var(--ink); text-decoration: none; cursor: pointer; }
.menu button:hover:not(:disabled), .menu a:hover { background: var(--paper-2); }
.menu button:disabled { color: #B9B3A8; cursor: not-allowed; }
.menu hr { border: 0; border-top: 1px solid var(--rule-soft); margin: 4px 0; opacity: 1; }

/* ---------- lateral ---------- */
.side { display: flex; flex-direction: column; gap: 14px; }
.move { background: var(--navy); color: var(--on-navy); border-radius: 6px; padding: 16px 16px 8px; }
.move h3 { margin: 0 0 2px; font-size: 16px; font-weight: 600; color: #fff; }
.move > p { margin: 0 0 10px; font-size: 12px; color: var(--on-navy-2); }
.move ol { list-style: none; margin: 0; padding: 0; counter-reset: m; }
.move li { border-top: 1px solid var(--navy-line); }
.move li button { display: grid; grid-template-columns: 22px 1fr; gap: 0 6px; width: 100%; background: none; border: 0; text-align: left; padding: 10px 0; color: inherit; cursor: pointer; }
.move li button::before { counter-increment: m; content: counter(m); font-family: var(--mono); font-size: 12px; color: #FF8F87; padding-top: 1px; grid-row: span 2; }
.move li b { font-weight: 600; color: #fff; font-size: 13px; }
.move li span { font-size: 12px; color: var(--on-navy-2); grid-column: 2; }
.move li button:hover b { text-decoration: underline; text-underline-offset: 2px; }
.move .none { padding: 10px 0 12px; font-size: 12.5px; border-top: 1px solid var(--navy-line); }

.sites { background: var(--paper); border-radius: 2px; padding: 12px 14px 10px; box-shadow: 0 0 0 1px var(--rule-soft); }
.sites h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.sites h3 span { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.site { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; width: 100%; background: none; border: 0; text-align: left; padding: 6px 0; border-top: 1px solid var(--rule-soft); cursor: pointer; color: var(--ink); }
.site:hover .nm { text-decoration: underline; text-underline-offset: 2px; }
.site[aria-pressed="true"] .nm { color: var(--navy); font-weight: 600; }
.site .nm { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site .nm .mono { color: var(--ink-3); font-size: 11.5px; margin-right: 4px; }
.site .ct { font-family: var(--mono); font-size: 12px; text-align: right; color: var(--ink-2); }
.site .ct em { font-style: normal; color: var(--red); font-weight: 600; margin-right: 6px; }
.site .bar { grid-column: 1 / -1; display: flex; height: 4px; gap: 1px; }
.site .bar b { display: block; height: 100%; }
.bar .r { background: var(--red); } .bar .o { background: var(--orange); } .bar .y { background: var(--yellow); } .bar .p { background: #A3B3CD; }
.sites .vacio { font-size: 12px; color: var(--ink-3); padding: 4px 0; }

/* ---------- flujo ---------- */
.flow-wrap { margin: 18px 0 8px; }
.flow-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 8px; }
.flow-title h3 { margin: 0; font-size: 13px; font-weight: 600; }
.flow-title p { margin: 0; color: var(--ink-3); font-size: 12px; }
.flow { display: flex; align-items: stretch; }
.stage { flex: 1 1 0; position: relative; background: var(--paper-2); border: 0; text-align: left; padding: 10px 12px 10px 22px; margin-right: 3px; cursor: pointer; color: var(--ink);
         clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%); min-width: 0; }
.stage:first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); padding-left: 14px; }
.stage:last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%); margin-right: 0; }
.stage:hover:not(:disabled) { background: #E9E7E1; }
.stage:disabled { cursor: default; }
.stage[aria-pressed="true"] { background: var(--navy); color: #fff; }
.stage[aria-pressed="true"] .sl, .stage[aria-pressed="true"] .sx { color: var(--on-navy-2); }
.stage .sn { font-family: var(--mono); font-size: 26px; font-weight: 600; line-height: 1; letter-spacing: -0.04em; }
.stage .sl { font-size: 12px; color: var(--ink-2); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage .sx { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; white-space: nowrap; }
.stage .sx em { font-style: normal; color: var(--red); font-weight: 600; }
.stage[aria-pressed="true"] .sx em { color: #FF9C94; }
.stage.done .sn { color: var(--green); }
.stage.hot { box-shadow: inset 0 3px 0 var(--orange); }

/* ---------- agrupaciones ---------- */
.groups { margin: 18px 0 26px; }
.groups .tbl-wrap { background: var(--paper); box-shadow: 0 0 0 1px var(--rule-soft); border-radius: 2px; }
.groups table.t tbody tr { cursor: default; }
.groups .vacio { background: var(--paper); padding: 16px 18px; color: var(--ink-2); border-radius: 2px; }

/* ---------- modales y panel ---------- */
.scrim { position: fixed; inset: 0; background: rgba(29, 28, 25, .32); z-index: 50; }
.scrim[hidden], .modal[hidden], .drawer[hidden], .toast[hidden] { display: none; }
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: min(520px, 100%); background: var(--paper); z-index: 51; display: flex; flex-direction: column; border-left: 4px solid var(--navy); }
.drawer > header, .modal > header { padding: 16px 20px 12px; display: flex; gap: 12px; align-items: flex-start; }
.drawer > header { border-bottom: 1px solid var(--rule); }
.drawer > header .x, .modal > header .x { margin-left: auto; }
.x { background: none; border: 1px solid var(--rule); border-radius: 3px; width: 28px; height: 28px; font-size: 15px; line-height: 1; color: var(--ink-2); cursor: pointer; }
.x:hover { border-color: var(--ink-3); color: var(--ink); }
.d-oc { font-family: var(--mono); font-size: 22px; font-weight: 600; letter-spacing: -0.03em; }
.d-sub { color: var(--ink-2); font-size: 12.5px; margin-top: 2px; }
.drawer .body { padding: 14px 20px; overflow-y: auto; flex: 1; }
.drawer > footer, .modal > footer { padding: 10px 20px; border-top: 1px solid var(--rule); display: flex; justify-content: flex-end; gap: 8px; background: var(--paper-2); }
.note { border-left: 3px solid var(--block); background: #FBF4DE; padding: 7px 10px; font-size: 12.5px; margin: 10px 0; }
.note.red { border-left-color: var(--red); background: #F8E3E0; }
dl.kv { display: grid; grid-template-columns: 130px 1fr; gap: 5px 12px; margin: 12px 0; font-size: 12.5px; }
dl.kv dt { color: var(--ink-3); font-weight: 400; }
dl.kv dd { margin: 0; }
.tl { list-style: none; padding: 0; margin: 14px 0 0; }
.tl li { display: grid; grid-template-columns: 18px 1fr auto; gap: 0 10px; position: relative; padding-bottom: 12px; }
.tl li::before { content: ''; position: absolute; left: 6px; top: 14px; bottom: 0; width: 1.5px; background: var(--rule); }
.tl li:last-child::before { display: none; }
.tl li.done::before { background: var(--ink-2); }
.tl .dot { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid #B4AEA2; background: var(--paper); margin-top: 2px; position: relative; z-index: 1; }
.tl li.done .dot { background: var(--ink-2); border-color: var(--ink-2); }
.tl li.now .dot { border: 0; background: var(--navy); box-shadow: 0 0 0 3px var(--navy-tint); }
.tl li.now.vencida .dot { background: var(--red); box-shadow: 0 0 0 3px #F3D3CF; }
.tl li.now.urgente .dot { background: var(--orange); box-shadow: 0 0 0 3px #FBD9C6; }
.tl li.now.proxima .dot { background: #E2B93B; box-shadow: 0 0 0 3px #FBEFC4; }
.tl li.now.entregada .dot { background: var(--green); box-shadow: 0 0 0 3px #D3E6D4; }
.tl .nm { font-weight: 500; }
.tl li.todo .nm { color: var(--ink-3); font-weight: 400; }
.tl .ds { font-size: 12px; color: var(--ink-2); }
.tl .dt { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }

.modal { position: fixed; z-index: 51; left: 50%; top: 12vh; transform: translateX(-50%); width: min(480px, calc(100% - 32px)); background: var(--paper); border-radius: 4px; border-top: 4px solid var(--navy); box-shadow: 0 18px 40px -20px rgba(29, 28, 25, .55); }
.modal > header h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal > header p { margin: 2px 0 0; color: var(--ink-3); font-size: 12px; }
.modal .body { padding: 4px 20px 16px; }
.modal .body > label:not(.drop) { display: block; font-size: 12px; color: var(--ink-2); margin: 8px 0 4px; font-weight: 500; }
.list-mini { border: 1px solid var(--rule-soft); max-height: 130px; overflow-y: auto; margin-top: 12px; background: #fff; }
.list-mini[hidden] { display: none; }
.list-mini div { display: flex; justify-content: space-between; padding: 4px 8px; font-size: 12px; border-bottom: 1px solid var(--rule-soft); }
.drop { display: block; border: 1.5px dashed var(--ink-3); border-radius: 3px; padding: 26px 16px; text-align: center; background: #fff; cursor: pointer; margin-top: 8px; }
.drop:hover { border-color: var(--navy); }
.drop b { display: block; }
.drop span { font-size: 12px; color: var(--ink-3); }
.carga-res:not(:empty) { margin-top: 12px; font-size: 12.5px; }
.carga-res .ok { font-family: var(--mono); font-size: 22px; font-weight: 600; color: var(--green); margin-right: 6px; }
.carga-res ul { margin: 6px 0 0 18px; padding: 0; color: #7A5300; max-height: 140px; overflow-y: auto; }

.dash-alert { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 9px 12px; border-left: 4px solid; border-radius: 2px; font-size: 13px; }
.dash-alert-ok { background: #E6EFE5; border-color: var(--green); color: #1F4A23; }
.dash-alert-err { background: #F8E3E0; border-color: var(--red); color: #7E1712; }
.dash-alert-warn { background: #FBF0D4; border-color: var(--block); color: #5C4300; }
.dash-alert-close { background: none; border: 0; font-size: 16px; line-height: 1; cursor: pointer; color: inherit; }

.toast { position: fixed; left: 20px; bottom: 18px; z-index: 70; background: var(--ink); color: #F2EFE8; padding: 9px 14px; border-radius: 3px; font-size: 12.5px; border-left: 4px solid var(--red); }

@media (max-width: 760px) {
    .top-in { gap: 12px; overflow-x: auto; }
    .sync { display: none; }
    .tray-head .units { display: none; }
    .search { width: 100%; }
    .flow { overflow-x: auto; }
    .stage { min-width: 130px; }
}
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
