/* Centro de control (ADMIN) */
.eyebrow { margin: 0 0 4px; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--success); }
.ad-title { font-size: 34px; letter-spacing: -.02em; margin: 0 0 6px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 16px 0; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .t { font-size: 14px; color: var(--text); }
.kpi .v { font-size: 24px; font-weight: 800; margin: 10px 0 4px; }
.kpi .s { font-size: 12px; color: var(--muted); }
.kpi.danger { background: #fff6f6; border-color: #f3b4b7; }
.kpi.ok { background: #effaf4; border-color: #a6e3c3; }
.ov-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.ov-map { padding: 0; overflow: hidden; height: 460px; position: relative; }
#ovMap { position: absolute; inset: 0; }
.ov-store { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.ov-store:last-child { border-bottom: none; }
.ov-store .ico { font-size: 22px; width: 34px; text-align: center; }

.seg-tabs { display: inline-flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 12px; margin: 6px 0 10px; flex-wrap: wrap; }
.seg-tabs button { border: none; background: none; padding: 8px 14px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--muted); font-size: 13px; }
.seg-tabs button.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }

.tariff-grid { display: grid; grid-template-columns: minmax(300px, 520px) 1fr; gap: 22px; align-items: start; margin-top: 10px; }
.tariff-grid h2 { font-size: 24px; }
.tariff-grid label { color: var(--text); font-size: 13px; }
.th-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.th-item:last-child { border-bottom: none; }
.th-item .th-l { flex: 1; min-width: 0; }
.th-item .th-r { font-weight: 800; text-align: right; max-width: 160px; }
.th-item.active { background: #effaf4; margin: 0 -14px; padding: 14px; border-radius: 10px; }
.sim { margin-top: 14px; background: var(--bg); box-shadow: none; }

.cm-config { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 22px; border-radius: 18px; margin-top: 4px; }
.cm-config-text { flex: 1; min-width: 240px; }
.pct-input { position: relative; width: 170px; }
.pct-input input { font-size: 18px; font-weight: 800; padding-right: 34px; }
.pct-input span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }
.cm-recalc { display: flex; gap: 10px; align-items: flex-start; max-width: 300px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin: 0; color: var(--text); font-weight: 600; }
.cm-recalc input { width: auto; margin-top: 3px; }
.cm-filter { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; border-radius: 18px; padding: 18px; }
.cm-btn-soft { background: #dcf5e9; border-color: #dcf5e9; color: #0f7d4d; }
.cm-grid { display: grid; grid-template-columns: minmax(380px, 1fr) 2fr; gap: 14px; margin-top: 14px; }
.cm-grid .table th, .cm-grid .table td { padding: 9px 10px; }
.cm-grid h3 { margin-bottom: 10px; }
.st-paid { background: #dcf5e9; color: #0f7d4d; }
.st-exempt { background: #eef0f4; color: var(--muted); }

/* Envíos de paquetes */
.nav { position: relative; }
.nav-badge {
  position: absolute; top: 6px; right: 10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; font-style: normal; font-weight: 800; line-height: 18px; text-align: center;
}
.pk-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 14px; align-items: start; }
.pk-grid .ov-map { position: sticky; top: 14px; }
#pkgMap { position: absolute; inset: 0; }
#pkList { display: flex; flex-direction: column; gap: 10px; }
.pk-card { padding: 14px; border-left: 4px solid var(--border); }
.pk-card.ready { border-left-color: var(--teal); }
.pk-card.urgent.ready { border-left-color: var(--danger); background: #fff8f8; }
.pk-card.assigned, .pk-card.picked_up { border-left-color: var(--warning); }
.pk-card.done { opacity: .6; }
.pk-route { display: grid; gap: 6px; margin: 10px 0 8px; font-size: 13px; }
.pk-route > div { position: relative; padding-left: 18px; }
.pk-route i { position: absolute; left: 0; top: 4px; width: 10px; height: 10px; border-radius: 50%; }
.pk-route .from { background: var(--purple); }
.pk-route .to { background: var(--danger); }
.pk-acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.pk-acts select { width: auto; flex: 1; min-width: 170px; }

@media (max-width: 1100px) { .ov-grid, .tariff-grid, .cm-grid, .pk-grid { grid-template-columns: 1fr; } .pk-grid .ov-map { position: relative; top: 0; height: 320px; } }

/* "Ver como" */
.va-list { display: flex; flex-direction: column; gap: 6px; }
.va-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: var(--text); }
.va-item:hover { border-color: var(--primary); background: #eef3ff; }
.va-item > span { font-size: 20px; width: 28px; text-align: center; }
.va-item b { flex: 1; }
.va-item small { color: var(--muted); }
.va-item i { font-style: normal; color: var(--primary); font-weight: 800; }
#noFood .oe, #noPkg .oe { margin-top: 6px; }
/* Aviso: base de datos desactualizada */
.db-warning {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 18px;
  background: #fff4dc; border-bottom: 1px solid #f2d394; color: #7a4d00; font-size: 14px;
}
.db-warning span { flex: 1; min-width: 260px; }

/* Solicitudes de registro (landing) */
.seg-count { font-style: normal; margin-left: 4px; padding: 1px 7px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; }
.seg-count:empty { display: none; }
.reg-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; margin-top: 6px; align-items: start; }
.reg-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 16px; border-left: 4px solid var(--warning); }
.reg-card.approved { border-left-color: var(--success); }
.reg-card.rejected { border-left-color: var(--danger); }
.reg-head { display: flex; align-items: center; gap: 12px; }
.reg-head b { font-size: 16px; }
.reg-ico { width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--bg); }
.reg-facts { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; margin: 0; font-size: 13px; }
.reg-facts dt { color: var(--muted); }
.reg-facts dd { margin: 0; overflow-wrap: anywhere; }
.reg-note { padding: 9px 11px; border-radius: 10px; background: var(--bg); font-size: 13px; overflow-wrap: anywhere; }
.reg-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reg-acts .btn.success { flex: 1; }
.reg-alert {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 0; padding: 12px 16px; border-radius: 14px;
  background: #fff4dc; border: 1px solid #f2d394; color: #7a4d00;
}
.reg-alert span { flex: 1; min-width: 220px; }

/* Eliminar locales, repartidores y pedidos */
.danger-box { padding: 12px 14px; border-radius: 12px; background: #fff4f4; border: 1px solid #f3c3c5; color: #7a1f23; font-size: 13px; line-height: 1.5; }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-solid:hover { background: #c93338; }
.table th.sel, .table td.sel { width: 34px; text-align: center; }
.table td.sel input, .table th.sel input { width: auto; margin: 0; cursor: pointer; }

/* Mensajes */
.msg-layout { display: grid; grid-template-columns: 340px 1fr; gap: 14px; height: 100%; padding: 14px; box-sizing: border-box; }
.msg-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.msg-side .seg-tabs { margin: 0; }
.msg-list { flex: 1; overflow: auto; margin: 0 -6px; display: flex; flex-direction: column; gap: 2px; }
.msg-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 8px; border: 0; border-radius: 10px; background: none; text-align: left; cursor: pointer; font: inherit; color: var(--text); }
.msg-item:hover { background: var(--bg); }
.msg-item.on { background: #e5edff; }
.msg-item.unread b { color: var(--primary); }
.msg-ico { position: relative; width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 19px; background: var(--bg); }
.msg-online { position: absolute; right: 0; bottom: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--success); border: 2px solid #fff; }
.msg-txt { flex: 1; min-width: 0; }
.msg-txt b, .msg-txt small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-txt small { color: var(--muted); font-size: 12px; }
.msg-side-info { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.msg-side-info small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.msg-unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; line-height: 20px; font-style: normal; text-align: center; }
.msg-main { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.msg-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); min-height: 62px; }
#msgChat { flex: 1; min-height: 0; }
#view-messages { overflow: hidden; }
@media (max-width: 900px) { .msg-layout { grid-template-columns: 1fr; height: auto; } .msg-main { min-height: 480px; } }

/* Ficha del repartidor: documentos, referencias y relaciones */
.doc-thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.doc-thumb { position: relative; display: block; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; background: var(--bg); border: 1px solid var(--border); text-decoration: none; color: var(--text); }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-thumb span { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 8px; font-size: 11.5px; font-weight: 700; background: rgba(255, 255, 255, .9); }
.doc-thumb.empty { display: grid; place-items: center; color: var(--muted); }
.doc-thumb.empty i { font-style: normal; font-size: 20px; }
.doc-thumb:hover { border-color: var(--primary); }
.doc-thumbs.one { grid-template-columns: 1fr; max-width: 420px; }
.refs { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; font-size: 13px; }
.ref { padding: 8px 10px; border-radius: 10px; background: var(--bg); }
.link-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.link-chip { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: #eef0f4; color: var(--text); }
.link-chip.driver { background: #e5edff; color: #1b4fc4; }
.link-chip.shared { background: #fff4dc; color: #8a5300; }
.link-chip.applicant { background: #efe7ff; color: #6a3fe0; }
.link-chip.referee { background: #dcf5e9; color: #0f7d4d; }
.wa-link { color: #128c4b; font-weight: 700; }

/* Ficha del repartidor: calificaciones */
.rating-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow: auto; }
.rating-item { padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; }
