/* ============================================================
   CRM Party Events — Panel profesional
   Marca: negro + naranja (#f97316) · Tipografía: Inter
   ============================================================ */
:root {
  --naranja: #f97316;
  --naranja-oscuro: #ea580c;
  --naranja-suave: rgba(249, 115, 22, .15);
  --fondo: #f4f5f7;
  --tarjeta: #ffffff;
  --texto: #111827;
  --texto-2: #374151;
  --muted: #6b7280;
  --borde: #e6e7eb;
  --borde-input: #d3d6dc;
  --sidebar: #101014;
  --verde: #15803d;
  --verde-wa: #25d366;
  --rojo: #dc2626;
  --sombra: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .03);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--naranja-oscuro); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--naranja-suave); }

/* ---------- Layout con barra lateral ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex: 0 0 248px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 16px 18px;
  background: var(--sidebar);
  color: #e5e7eb;
  overflow: hidden;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 30px 44px;
  flex: 1;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 18px;
  border-top: 1px solid var(--borde);
}

/* ---------- Marca ---------- */
.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 2px 8px;
  color: #ffffff;
}
.brand:hover { text-decoration: none; }
.brand-logo { height: 66px; width: auto; display: block; }
.brand-text {
  font-weight: 800;
  font-size: 21px;
  letter-spacing: .4px;
  color: #ffffff;
  white-space: nowrap;
}
.brand-text em {
  color: var(--naranja);
  font-style: italic;
  font-weight: 600;
}
.brand-crm {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--naranja);
  border: 1px solid rgba(249, 115, 22, .55);
  padding: 3px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

/* ---------- Navegación lateral ---------- */
.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: #33343c transparent;
}
.nav::-webkit-scrollbar { width: 5px; }
.nav::-webkit-scrollbar-thumb { background: #33343c; border-radius: 99px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #c3c7cf;
  font-size: 14.5px;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.nav a svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  opacity: .8;
}
.nav a:hover {
  background: rgba(255, 255, 255, .06);
  color: #ffffff;
  text-decoration: none;
}
.nav a.active {
  background: var(--naranja-suave);
  color: #ffffff;
}
.nav a.active svg { color: var(--naranja); opacity: 1; }

.sidebar-foot {
  margin-top: auto;
  padding: 0 8px;
  font-size: 12px;
  color: #6d7280;
  letter-spacing: .02em;
}

/* ---------- Encabezados ---------- */
h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--texto);
  margin: 2px 0 18px;
}
h2 {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--texto);
  margin: 0 0 12px;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.page-head h1 { margin-bottom: 12px; }
.page-sub {
  color: var(--muted);
  font-size: 14.5px;
  margin: -12px 0 22px;
}

/* ---------- Tarjetas ---------- */
.card {
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--sombra);
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.cards .card { margin-bottom: 0; }

.stat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 22px;
  width: 34px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--naranja);
}
.stat-num {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--texto);
  line-height: 1.15;
}
.stat-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.card-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--naranja-oscuro);
  margin-top: 8px;
  display: inline-block;
}

.alert { border-color: #fecaca; background: #fffafa; }
.alert h2 { color: var(--rojo); }
.alert-list { margin: 0 0 8px; padding-left: 18px; }
.alert-list li { margin-bottom: 6px; }

/* ---------- Tablas ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th, .table td {
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid #eef0f3;
}
.table thead th {
  background: #f8f9fb;
  color: #667085;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--borde);
}
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: #fafbfc; }
.table tr:last-child td { border-bottom: none; }
.table .num { text-align: right; white-space: nowrap; }
.table td.num { font-variant-numeric: tabular-nums; }
.row-low { background: #fff7ed; }
.table tbody tr.row-low:hover { background: #ffedd5; }
.actions { white-space: nowrap; text-align: right; }
.actions form { display: inline; }
.actions .btn { padding: 6px 11px; font-size: 13px; }

/* Contenedor de tablas: nunca se salen de su tarjeta; si la pantalla es
   angosta, la tabla se desplaza dentro de su propio recuadro */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #c9ccd4 transparent;
}
.table-wrap::-webkit-scrollbar { height: 6px; }
.table-wrap::-webkit-scrollbar-thumb { background: #c9ccd4; border-radius: 999px; }
.table-wrap .table { min-width: 680px; }
.table-wrap .table-wide { min-width: 920px; }
.table td.fecha, .table th.fecha { white-space: nowrap; }

/* ---------- Insignias ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
  text-transform: capitalize;
  background: #f3f4f6;
  color: #374151;
  white-space: nowrap;
}
.badge-borrador { background: #e5e7eb; color: #374151; }
.badge-enviada { background: #dbeafe; color: #1d4ed8; }
.badge-aceptada { background: #dcfce7; color: #15803d; }
.badge-rechazada { background: #fee2e2; color: #b91c1c; }
.badge-ok { background: #dcfce7; color: #15803d; text-transform: none; }
.badge-warn { background: #fef3c7; color: #92400e; text-transform: none; }
.badge-low { background: #fee2e2; color: #b91c1c; text-transform: none; }
.badge-neutral { background: #f3f4f6; color: #4b5563; text-transform: none; }
.badge-pago-sin-pagos { background: #fee2e2; color: #b91c1c; }
.badge-pago-parcial { background: #fef3c7; color: #b45309; }
.badge-pago-pagada { background: #dcfce7; color: #15803d; }
.badge-pago-anulada { background: #e5e7eb; color: #6b7280; }
.badge-fac-emitida { background: #dbeafe; color: #1d4ed8; }
.badge-fac-anulada { background: #e5e7eb; color: #6b7280; }
.badge-ev-cotizado { background: #e5e7eb; color: #374151; }
.badge-ev-confirmado { background: #dbeafe; color: #1d4ed8; }
.badge-ev-en-produccion { background: #fef3c7; color: #b45309; }
.badge-ev-realizado { background: #ede9fe; color: #6d28d9; }
.badge-ev-cobrado { background: #dcfce7; color: #15803d; }
.badge-ev-cancelado { background: #fee2e2; color: #b91c1c; }

.saldo { font-weight: 800; color: var(--naranja-oscuro); font-size: 17px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: 9px;
  border: 1px solid #d8dae0;
  background: #ffffff;
  color: #1f2937;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  transition: background .15s ease, border-color .15s ease,
    color .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn:hover {
  text-decoration: none;
  background: #f9fafb;
  border-color: #b9bdc7;
  color: var(--texto);
}
.btn-primary {
  background: var(--naranja);
  border-color: var(--naranja);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(249, 115, 22, .35);
}
.btn-primary:hover {
  background: var(--naranja-oscuro);
  border-color: var(--naranja-oscuro);
  color: #ffffff;
}
.btn-wa { background: var(--verde-wa); border-color: var(--verde-wa); color: #ffffff; }
.btn-wa:hover { background: #1eb856; border-color: #1eb856; color: #ffffff; }
.btn-danger { color: var(--rojo); }
.btn-danger:hover { border-color: var(--rojo); color: var(--rojo); background: #fff5f5; }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-ghost:hover { background: #f3f4f6; border-color: transparent; }

/* ---------- Formularios ---------- */
.form label {
  display: block;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #14151a;
  margin-bottom: 14px;
}
.form input, .form select, .form textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 13px;
  border: 1px solid #ccd1da;
  border-radius: 9px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  background: #fafbfc;
  color: var(--texto);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none;
  border-color: var(--naranja);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--naranja-suave);
}
/* Secciones dentro de un formulario: título fuerte con filete naranja */
.form-sec { margin-bottom: 28px; }
.form-sec:last-of-type { margin-bottom: 8px; }
.form-sec-titulo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #14151a;
  margin: 0 0 16px;
}
.form-sec-titulo::before {
  content: "";
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: var(--naranja);
  flex: none;
}
.form-sec-titulo::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e7e9ee;
}
.card p strong { color: #14151a; }
.form .check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: var(--texto);
}
.form .check input { width: auto; margin: 0; accent-color: var(--naranja); }
.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}
.check-inline input { accent-color: var(--naranja); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }

.search { display: flex; gap: 8px; margin-bottom: 14px; }
.search input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--borde-input);
  border-radius: 9px;
  font: inherit;
  font-size: 14.5px;
  background: #ffffff;
  color: var(--texto);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search input:focus {
  outline: none;
  border-color: var(--naranja);
  box-shadow: 0 0 0 3px var(--naranja-suave);
}

/* ---------- Partidas (cotizaciones / facturas) ---------- */
.item-row {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
  grid-template-columns: 1.2fr 1.6fr .5fr .7fr auto;
  align-items: center;
}
.item-row select, .item-row input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--borde-input);
  border-radius: 9px;
  font: inherit;
  font-size: 14px;
  background: #ffffff;
  color: var(--texto);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.item-row select:focus, .item-row input:focus {
  outline: none;
  border-color: var(--naranja);
  box-shadow: 0 0 0 3px var(--naranja-suave);
}
.item-row-simple { grid-template-columns: 1.8fr .5fr .7fr auto; }
.item-del { color: var(--rojo); padding: 7px 9px; }
#item-add { margin-bottom: 16px; }

/* ---------- Mensajes ---------- */
.muted { color: var(--muted); font-size: 14px; }
.flash {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  font-weight: 500;
  font-size: 14.5px;
}
.flash.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

/* ---------- Eventos: tablero, avance y utilidad ---------- */
.board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  align-items: start;
}
.board-col { margin-bottom: 0; }
.board-col h2 { display: flex; justify-content: space-between; align-items: center; }
.evt-grid { display: grid; gap: 10px; }
.evt-card {
  border: 1px solid var(--borde);
  border-radius: 12px;
  padding: 14px;
  background: #ffffff;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.evt-card:hover { box-shadow: var(--sombra); border-color: #d8dae0; }
.evt-card h3 { margin: 0 0 6px; font-size: 15.5px; font-weight: 700; }
.evt-meta { font-size: 13px; color: var(--muted); margin: 2px 0; }
.progress {
  background: #eef0f3;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin: 8px 0 4px;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--naranja), #fb923c);
  border-radius: 999px;
}
.util-pos { color: var(--verde) !important; }
.util-neg { color: var(--rojo) !important; }
.task-row, .compra-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid #eef0f3;
}
.task-row:last-of-type, .compra-row:last-of-type { border-bottom: none; }
.task-row form, .compra-row form { display: inline-flex; margin: 0; }
.task-done { text-decoration: line-through; color: var(--muted); }

/* ---------- Formularios en línea ---------- */
.inline-form { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
form.inline-form { display: flex; margin-bottom: 18px; }
.inline-form input, .inline-form select {
  padding: 8px 10px;
  border: 1px solid var(--borde-input);
  border-radius: 9px;
  font: inherit;
  font-size: 14px;
  background: #ffffff;
  color: var(--texto);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.inline-form input:focus, .inline-form select:focus {
  outline: none;
  border-color: var(--naranja);
  box-shadow: 0 0 0 3px var(--naranja-suave);
}

/* ---------- Bloques de resumen / finanzas ---------- */
.resumen, .finanzas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

/* ---------- Notas por categoría ---------- */
.notas-cats { margin-top: 4px; }
.notas-cats-titulo { font-weight: 600; font-size: 14px; margin: 12px 0 8px; }
.nota-cat {
  border: 1px solid var(--borde);
  border-radius: 10px;
  margin-bottom: 8px;
  background: #fff;
  overflow: hidden;
}
.nota-cat summary {
  cursor: pointer;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 14px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nota-cat summary::-webkit-details-marker { display: none; }
.nota-cat summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--naranja);
  transition: transform .15s ease;
}
.nota-cat[open] summary::after { transform: rotate(180deg); }
.nota-cat summary:hover { background: #fff7ed; }
.nota-cat textarea { margin: 0 14px 12px; width: calc(100% - 28px); }
.nota-ver { padding: 10px 0; border-bottom: 1px solid #eef0f3; }
.nota-ver:last-child { border-bottom: none; }
.nota-ver h3 {
  margin: 0 0 4px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--naranja-oscuro, #c2410c);
}
.nota-ver p { margin: 0; white-space: pre-wrap; }

/* Barra de acciones fija: Guardar siempre visible al llenar formularios */
.form .form-actions {
  position: sticky;
  bottom: 0;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(4px);
  padding: 14px 4px 6px;
  margin-top: 10px;
  border-top: 1px solid #eef0f3;
  z-index: 5;
}

/* ---------- Panel Principal ---------- */
.dash-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.dash-head h1 { margin: 0; }
.dash-head .page-sub { margin: 4px 0 0; }
.dash-actions { display: flex; gap: 10px; }
.dash-stats .stat { display: flex; gap: 14px; align-items: flex-start; }
.stat-ico {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.stat-ico svg { width: 23px; height: 23px; }
.ico-azul { background: #dbeafe; color: #1d4ed8; }
.ico-verde { background: #dcfce7; color: #15803d; }
.ico-naranja { background: #ffedd5; color: #c2410c; }
.ico-morado { background: #ede9fe; color: #6d28d9; }
.stat-body { display: flex; flex-direction: column; min-width: 0; }
.pipe-card {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-top: 14px; padding-bottom: 14px;
}
.pipe-titulo {
  font-size: 12px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: #14151a; margin-right: 4px;
}
.pipe-item {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border: 1px solid var(--borde); border-radius: 999px;
  color: var(--texto); text-decoration: none; background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.pipe-item:hover { border-color: var(--naranja); box-shadow: 0 2px 8px rgba(16,16,20,.07); }
.pipe-item strong { font-size: 15px; }
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.dash-card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.dash-card-head h2 { margin: 0; }
.ev-list { display: flex; flex-direction: column; }
.ev-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid #eef0f3;
}
.ev-row:last-child { border-bottom: none; }
.date-chip {
  width: 54px; flex: none;
  background: #101014; color: #fff;
  border-radius: 12px; text-align: center;
  padding: 7px 0 6px;
  display: flex; flex-direction: column; line-height: 1.1;
}
.date-chip .dc-dia { font-size: 20px; font-weight: 800; }
.date-chip .dc-mes { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; color: #fdba74; }
.ev-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.prog-row { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
.prog {
  flex: 1; max-width: 240px; height: 7px;
  background: #eef0f3; border-radius: 999px; overflow: hidden;
}
.prog span {
  display: block; height: 100%;
  background: linear-gradient(90deg, #fb923c, var(--naranja));
  border-radius: 999px;
}
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 0; border-bottom: 1px solid #eef0f3;
}
.side-list li:last-child { border-bottom: none; }
.side-list li div { display: flex; flex-direction: column; min-width: 0; }
.side-list .badge { flex: none; margin-top: 2px; }
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 0; border-bottom: 1px solid #eef0f3;
}
.post-list li:last-child { border-bottom: none; }
.post-info { flex: 1; min-width: 220px; }
@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
}

/* ---------- Pulido general ---------- */
::selection { background: rgba(249, 115, 22, .25); }
.btn { transition: background .15s ease, border-color .15s ease, color .15s ease, transform .05s ease; }
.btn:active { transform: scale(.98); }
a:focus-visible, .btn:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid rgba(249, 115, 22, .65);
  outline-offset: 1px;
}
.cards .card { transition: transform .15s ease, box-shadow .15s ease; }
.cards .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(16, 16, 20, .08);
}
.nav a.active { box-shadow: inset 3px 0 0 var(--naranja); }
.table tbody tr { transition: background .12s ease; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: auto;
    flex: none;
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    padding: 12px 16px;
    overflow: visible;
  }
  .brand { padding: 0; flex-direction: row; align-items: center; gap: 10px; }
  .brand-logo { height: 44px; }
  .brand-text { font-size: 19px; }
  .search-global { order: 3; flex: 1 1 100%; padding: 2px 0 0; }
  .nav {
    order: 4;
    flex: 1 1 100%;
    min-height: 0;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 4px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; padding: 8px 11px; }
  .nav a svg { width: 18px; height: 18px; flex-basis: 18px; }
  .sidebar-foot { display: none; }
  .container { padding: 22px 18px 36px; }
}

@media (max-width: 760px) {
  .grid-2 { grid-template-columns: 1fr; }
  .item-row { grid-template-columns: 1fr 1fr; }
  .table { font-size: 13px; }
  .table th, .table td { padding: 9px 8px; }
  .actions { white-space: normal; }
  .actions .btn { margin: 2px 0; }
  .container { padding: 18px 12px 32px; }
  .card { padding: 16px; }
  h1 { font-size: 22px; }
}

/* ---------- Línea de tiempo (seguimiento) ---------- */
.timeline { margin-top: 14px; }
.tl-item {
  border-left: 3px solid #ffedd5;
  padding: 10px 0 10px 14px;
  margin-left: 4px;
  border-bottom: 1px solid #f3f4f6;
}
.tl-item:last-child { border-bottom: none; }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-item p { margin: 5px 0 0; }

/* ---------- Chips de vistas y filtros ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid #e2e2e8; background: #fff;
  font-size: 13px; font-weight: 600; color: #44464e;
}
.chip:hover { border-color: #f97316; color: #14151a; text-decoration: none; }
.chip-on { background: #14151a; color: #fff; border-color: #14151a; }
.chip-on:hover { color: #fff; }
.chip-saved { background: #fff7ed; border-color: #fed7aa; }
.chip-saved a { color: #9a3412; }
.chip-x { background: none; border: none; cursor: pointer; color: #9a3412; font-size: 12px; padding: 0; }
.check-grid { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 6px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13.5px; text-transform: none; letter-spacing: 0; color: #14151a; }
.check input { width: 17px; height: 17px; accent-color: #f97316; }

/* ---------- Barras de reportes ---------- */
.bar-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.bar-label { flex: 0 0 150px; font-size: 13.5px; font-weight: 600; }
.bar-track { flex: 1; height: 10px; background: #f1f1f4; border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: #f97316; border-radius: 999px; }
.bar-num { flex: 0 0 auto; font-size: 13px; color: #55565e; font-variant-numeric: tabular-nums; }

/* ---------- Pantalla de acceso ---------- */
.login-body {
  background: #101014;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  margin: 0; padding: 20px;
}
.login-card {
  background: #17171c;
  border: 1px solid #26262e;
  border-radius: 18px;
  padding: 34px 30px;
  width: 100%; max-width: 380px;
  color: #ececf0;
}
.login-logo { width: 170px; display: block; margin: 0 auto 10px; }
.login-title { text-align: center; font-size: 20px; margin: 6px 0 10px; color: #fff; }
.login-card .muted { color: #9c9da6; }
.login-card label { color: #ececf0; }
.login-card input {
  background: #101014; border-color: #33343c; color: #fff;
}

/* ---------- Campos extra de cada partida ---------- */
.item-extra {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; gap: 6px;
  padding-top: 2px;
}
.item-extra select, .item-extra input {
  font-size: 12.5px; padding: 6px 8px;
  border: 1px solid #e2e2e8; border-radius: 8px;
  background: #fafbfc; color: #14151a;
}
.item-extra input[type="number"] { width: 130px; }
.item-extra input[type="text"] { width: 150px; }

/* ---------- Indicadores del portal y paginación ---------- */
.stat-strip {
  display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px;
}
.mini-stat {
  background: #fff; border: 1px solid #ececf0; border-radius: 12px;
  padding: 10px 14px; display: flex; flex-direction: column; gap: 1px;
  min-width: 104px;
}
.mini-num { font-size: 19px; font-weight: 800; color: #101014; }
.mini-label { font-size: 11.5px; color: #6d6d76; font-weight: 600; }
.pager {
  display: flex; align-items: center; gap: 14px; margin-top: 14px;
}
.search-global { padding: 0 18px 12px; }
.search-global input {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 0;
  background: #26262e; color: #f5f5f7; font-size: 13.5px;
}
.search-global input::placeholder { color: #8b8b96; }

/* ---------- Expedientes con pestañas ---------- */
.expediente { display: flex; flex-direction: column; }
.exp-tabs {
  display: flex; flex-wrap: wrap; gap: 4px;
  background: #fff; border: 1px solid #ececf0; border-radius: 999px;
  padding: 6px; margin-bottom: 18px;
  position: sticky; top: 10px; z-index: 20;
  box-shadow: 0 6px 20px rgba(16, 16, 20, .06);
}
.exp-tab {
  border: 0; background: transparent; cursor: pointer;
  padding: 8px 14px; border-radius: 999px;
  font: 600 13.5px Inter, system-ui, sans-serif; color: #55555f;
  display: inline-flex; align-items: center; gap: 2px;
}
.exp-tab:hover { background: #f4f4f6; }
.exp-tab.active { background: #101014; color: #fff; }
.tab-count {
  background: #f97316; color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; padding: 1px 7px; margin-left: 4px;
}
.tab-panel { min-width: 0; }
.tab-panel > section { margin-bottom: 18px; }
