/* ================================================================
   LIXAI.CSS — Sistema de diseño lixAI
   Basado en el sistema Localeo. Dark mode via [data-theme="dark"].
   ================================================================

   ÍNDICE
   ─────────────────────────────────────────────
   1.  TOKENS (light + dark)
   2.  BASE
   3.  ANIMACIONES
   4.  SIDEBAR
   5.  HEADER / TOPBAR
   6.  LAYOUT
   7.  BOTONES
   8.  BADGES / CHIPS
   9.  TARJETAS (card)
   10. TABLA
   11. FILTROS Y FORMULARIOS
   12. TABS
   13. STATS ROW
   14. PAGINACIÓN
   15. MODALES
   16. TOAST
   17. LOADING / EMPTY
   18. KANBAN CRM
   19. UTILIDADES
   ─────────────────────────────────────────────
   ================================================================ */


/* ================================================================
   1. TOKENS
   ================================================================ */
:root {
  /* Fondos */
  --bg:       #F7F6F2;
  --surface:  #FFFFFF;
  --surface2: #FAF9F6;
  --surface3: #F2F0EB;

  /* Textos */
  --tx:   #18160F;
  --tx2:  #6B6760;
  --tx3:  #B5B0A3;

  /* Bordes */
  --brd:    #E8E5DE;
  --brd-md: #D6D2C9;

  /* Sombras */
  --sh-xs: 0 1px 4px  rgba(0,0,0,.04);
  --sh-sm: 0 3px 10px rgba(0,0,0,.06);
  --sh-md: 0 8px 24px rgba(0,0,0,.08);
  --sh-lg: 0 16px 48px rgba(0,0,0,.10);

  /* Marca */
  --red:     #E00B41;
  --red-dk:  #C00A38;
  --red-lt:  #FEF2F5;
  --red-mid: #F8C9D5;

  /* Semáforo */
  --green:   #16A34A;
  --green-lt:#F0FDF4;
  --amber:   #D97706;
  --amber-lt:#FFFBEB;
  --blue:    #2563EB;
  --blue-lt: #EFF6FF;

  /* Radios */
  --r:      10px;
  --r-lg:   14px;
  --r-xl:   18px;
  --r-2xl:  24px;
  --r-pill: 100px;

  /* Layout */
  --sidebar-w: 210px;
  --topbar-h:  56px;
}

/* DARK MODE */
[data-theme="dark"] {
  --bg:       #111009;
  --surface:  #1A1814;
  --surface2: #211F19;
  --surface3: #282520;
  --tx:   #F0EDE6;
  --tx2:  #9B9690;
  --tx3:  #5A5650;
  --brd:    #2E2B24;
  --brd-md: #3A3730;
  --sh-xs: 0 1px 4px  rgba(0,0,0,.2);
  --sh-sm: 0 3px 10px rgba(0,0,0,.3);
  --sh-md: 0 8px 24px rgba(0,0,0,.4);
  --sh-lg: 0 16px 48px rgba(0,0,0,.5);
  --red-lt:  #2A0A12;
  --red-mid: #5A1525;
  --green-lt:#0A1F0E;
  --amber-lt:#1F1500;
  --blue-lt: #0A1020;
}


/* ================================================================
   2. BASE
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--tx);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .2s, color .2s;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* Fraunces para números y títulos grandes */
.font-display {
  font-family: 'Fraunces', serif;
  font-weight: 800;
  letter-spacing: -.03em;
}


/* ================================================================
   3. ANIMACIONES
   ================================================================ */
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.3} }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
@keyframes slideIn { from { transform:translateX(-8px); opacity:0; } to { transform:none; opacity:1; } }


/* ================================================================
   4. SIDEBAR — mobile first
   ================================================================ */

/* Sidebar — oculto en móvil, siempre visible en desktop */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--brd);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  /* Mobile: oculto por defecto */
  transform: translateX(-100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1), background .2s;
}
.sidebar.open { transform: translateX(0); }

@media (min-width: 768px) {
  .sidebar { transform: translateX(0) !important; }
}

/* Overlay — solo móvil */
.sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 199;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sb-overlay.open { display: block; }
@media (min-width: 768px) {
  .sb-overlay { display: none !important; }
}

/* Logo */
.sb-logo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--brd);
  flex-shrink: 0;
}

.sb-logo-mark {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 1.25rem;
  letter-spacing: -.02em;
  color: var(--tx);
  display: flex;
  align-items: center;
  gap: 2px;
}
.sb-logo-mark em { font-style: normal; color: var(--red); }

.logo-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--red);
  display: inline-block;
  margin-right: 5px;
  animation: pulse-dot 2s infinite;
  vertical-align: middle;
  flex-shrink: 0;
}

.sb-logo-label {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--tx3);
  margin-top: 2px;
}

/* Botón cerrar — solo móvil */
.sb-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  background: var(--surface3);
  border: 1px solid var(--brd);
  border-radius: var(--r);
  cursor: pointer;
  font-size: .8rem;
  color: var(--tx2);
  font-family: inherit;
  transition: all .15s;
}
.sb-close-btn:hover { background: var(--red-lt); color: var(--red); border-color: var(--red-mid); }
@media (min-width: 768px) {
  .sb-close-btn { display: none; }
}

/* Nav */
.sb-nav { flex: 1; padding: 10px 0; display: flex; flex-direction: column; }

.sb-section {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--tx3);
  padding: 12px 18px 4px;
  margin-top: 4px;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  font-size: .84rem;
  font-weight: 500;
  color: var(--tx2);
  cursor: pointer;
  transition: background .12s, color .12s;
  position: relative;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}
.sb-item:hover { background: var(--surface3); color: var(--tx); }
.sb-item.active { background: var(--red-lt); color: var(--red); font-weight: 600; }
.sb-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--red);
  border-radius: 0 3px 3px 0;
}

.sb-icon { font-size: .95rem; width: 20px; text-align: center; flex-shrink: 0; }
.sb-label { flex: 1; }

.sb-badge {
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--red-lt);
  color: var(--red);
  border: 1px solid var(--red-mid);
  border-radius: var(--r-pill);
  padding: 2px 7px;
}

/* Footer usuario */
.sb-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--brd);
  flex-shrink: 0;
}

.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r);
  cursor: pointer;
  transition: background .12s;
}
.sb-user:hover { background: var(--surface3); }

.sb-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--red);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .8rem; color: #fff;
  flex-shrink: 0;
  font-family: 'Fraunces', serif;
}

.sb-user-info { flex: 1; overflow: hidden; min-width: 0; }
.sb-user-name { font-size: .82rem; font-weight: 600; color: var(--tx); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-plan { font-size: .68rem; color: var(--tx3); margin-top: 1px; }

.sb-logout {
  background: none; border: none; cursor: pointer;
  color: var(--tx3); font-size: .9rem; padding: 4px;
  border-radius: 6px; transition: color .12s, background .12s;
}
.sb-logout:hover { color: var(--red); background: var(--red-lt); }


/* ================================================================
   5. HEADER / TOPBAR — mobile first
   ================================================================ */
.topbar {
  position: sticky;
  top: 0; z-index: 100;
  height: var(--topbar-h);
  background: rgba(247,246,242,.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--brd);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  transition: background .2s;
}
[data-theme="dark"] .topbar { background: rgba(17,16,9,.95); }

/* Hamburguesa */
.btn-hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none; border: none;
  cursor: pointer; padding: 6px;
  border-radius: var(--r);
  transition: background .12s;
  flex-shrink: 0;
}
.btn-hamburger:hover { background: var(--surface3); }
.btn-hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--tx); border-radius: 2px;
}
@media (min-width: 768px) {
  .btn-hamburger { display: none; }
}

/* Search */
.topbar-search {
  flex: 1;
  max-width: 440px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1.5px solid var(--brd);
  border-radius: var(--r-pill);
  padding: 7px 14px;
  transition: border-color .15s;
}
.topbar-search:focus-within { border-color: var(--red); }
.topbar-search input {
  border: none; background: none;
  font-size: .86rem; color: var(--tx);
  outline: none; width: 100%; font-family: inherit;
}
.topbar-search input::placeholder { color: var(--tx3); }

/* Dark mode button */
.topbar-right { margin-left: auto; display: flex; align-items: center; }

.btn-darkmode {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface2);
  border: 1.5px solid var(--brd);
  border-radius: var(--r-pill);
  padding: 6px 12px;
  font-size: .78rem; font-weight: 500;
  color: var(--tx2); cursor: pointer;
  transition: all .12s; font-family: inherit;
}
.btn-darkmode:hover { border-color: var(--brd-md); color: var(--tx); }

.dm-label { display: none; }
@media (min-width: 900px) { .dm-label { display: inline; } }


/* ================================================================
   6. LAYOUT — mobile first
   ================================================================ */
.app-layout { display: flex; min-height: 100vh; }

.main-content {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0;
  margin-left: 0; /* Mobile: sin margen */
}
@media (min-width: 768px) {
  .main-content { margin-left: var(--sidebar-w); }
}

.page-body { padding: 14px; flex: 1; }
@media (min-width: 768px) { .page-body { padding: 24px; } }


/* Tabs */
.tabs-bar {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--brd);
  padding: 0 14px;
  overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tabs-bar::-webkit-scrollbar { display: none; }
@media (min-width: 768px) { .tabs-bar { padding: 0 24px; } }

.tab-btn {
  padding: 13px 14px;
  font-size: .82rem; font-weight: 500;
  color: var(--tx2); cursor: pointer;
  border-bottom: 2px solid transparent;
  border-top: none; border-left: none; border-right: none;
  background: none; white-space: nowrap;
  transition: all .12s; font-family: inherit;
}
.tab-btn:hover { color: var(--tx); }
.tab-btn.active { color: var(--red); border-bottom-color: var(--red); font-weight: 600; }

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn .15s ease; }


/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px; margin-bottom: 14px;
}
@media (min-width: 640px) {
  .stats-row { grid-template-columns: repeat(4, 1fr); }
}

/* Filters */
.filters-bar {
  background: var(--surface);
  border: 1px solid var(--brd);
  border-radius: var(--r-lg);
  padding: 12px 14px;
  display: flex; gap: 8px;
  align-items: center; flex-wrap: wrap;
  margin-bottom: 14px;
}

.filter-label {
  font-size: .68rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--tx3); white-space: nowrap;
}

.f-select, .f-input {
  padding: 7px 10px;
  border: 1.5px solid var(--brd);
  border-radius: var(--r);
  font-size: .82rem; color: var(--tx);
  background: var(--surface2);
  outline: none; transition: border-color .12s;
  font-family: inherit; min-width: 0;
}
.f-select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23B5B0A3' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  padding-right: 26px; cursor: pointer;
}
.f-select:focus, .f-input:focus { border-color: var(--red); }

/* Table */
.table-wrap { background: var(--surface); border: 1px solid var(--brd); border-radius: var(--r-lg); overflow: hidden; }
.table-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--brd); gap: 10px; }
.table-title { font-weight: 700; font-size: .88rem; color: var(--tx); }
.table-count { font-size: .76rem; color: var(--tx3); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 620px; }
/* Prevent JS text from leaking into page */
#tabla-body, #venc-body, #des-body { overflow: hidden; }
thead th { padding: 9px 12px; text-align: left; font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--tx3); background: var(--surface2); border-bottom: 1px solid var(--brd); white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--brd); cursor: pointer; transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
td { padding: 10px 12px; font-size: .83rem; vertical-align: middle; color: var(--tx); }
.td-main { font-weight: 500; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-sub { font-size: .72rem; color: var(--tx2); margin-top: 2px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-num { font-family: 'Fraunces', serif; font-weight: 700; color: var(--tx); white-space: nowrap; }
.td-fecha { font-size: .76rem; color: var(--tx2); white-space: nowrap; }
.td-fecha.urgente { color: var(--red); font-weight: 600; }
.td-fecha.pronto  { color: var(--amber); font-weight: 600; }

/* Pagination */
.pagination { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--brd); flex-wrap: wrap; gap: 8px; }
.pag-info { font-size: .76rem; color: var(--tx3); }
.pag-btns { display: flex; gap: 4px; }
.pag-btn { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: var(--r); border: 1px solid var(--brd); background: var(--surface); cursor: pointer; font-size: .8rem; color: var(--tx2); transition: all .12s; }
.pag-btn:hover { border-color: var(--red); color: var(--red); }
.pag-btn.active { background: var(--red); color: #fff; border-color: var(--red); }
.pag-btn:disabled { opacity: .35; cursor: not-allowed; }

/* Kanban */
.kanban-board { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
@media (min-width: 640px)  { .kanban-board { grid-template-columns: repeat(3,1fr); } }
@media (min-width: 1100px) { .kanban-board { grid-template-columns: repeat(6,1fr); } }

/* Venc pills */
.venc-pills { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 14px; }


/* ================================================================
   7. BOTONES
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 14px rgba(224,11,65,.25);
}
.btn-primary:hover {
  background: var(--red-dk);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(224,11,65,.35);
}
.btn-primary:active { transform: scale(.98); }

.btn-secondary {
  background: var(--surface);
  color: var(--tx2);
  border: 1.5px solid var(--brd-md);
}
.btn-secondary:hover {
  border-color: var(--tx3);
  color: var(--tx);
}

.btn-ghost {
  background: transparent;
  color: var(--tx2);
  border: 1.5px solid var(--brd);
}
.btn-ghost:hover { background: var(--surface3); color: var(--tx); }

.btn-danger {
  background: var(--red-lt);
  color: var(--red);
  border: 1.5px solid var(--red-mid);
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-sm { padding: 5px 12px; font-size: .78rem; }
.btn-lg { padding: 12px 24px; font-size: .95rem; }

.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }


/* ================================================================
   8. BADGES / CHIPS
   ================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .03em;
  white-space: nowrap;
}

/* Estados licitación */
.badge-EV   { background: var(--green-lt); color: var(--green); }
.badge-PUB  { background: var(--blue-lt);  color: var(--blue);  }
.badge-ADJ  { background: var(--amber-lt); color: var(--amber); }
.badge-RES  { background: #EDE9FE;         color: #6D28D9;      }
.badge-PADJ { background: #FDF4FF;         color: #9333EA;      }
.badge-ANUL { background: var(--red-lt);   color: var(--red);   }
.badge-DES  { background: var(--surface3); color: var(--tx3);   }
.badge-PRE  { background: var(--green-lt); color: var(--green); }
.badge-SUS  { background: var(--amber-lt); color: var(--amber); }

/* Financiación */
.badge-EU    { background: var(--blue-lt);  color: var(--blue); }
.badge-FEDER { background: #EDE9FE;         color: #6D28D9;     }
.badge-PRTR  { background: var(--amber-lt); color: var(--amber);}

/* Plan */
.badge-pro  { background: var(--red-lt); color: var(--red); border: 1px solid var(--red-mid); }
.badge-free { background: var(--surface3); color: var(--tx3); }


/* ================================================================
   9. TARJETAS (card)
   ================================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--brd);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: background .2s, border-color .2s;
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--brd);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: .88rem;
  color: var(--tx);
}

.card-body { padding: 18px; }

/* Info rows dentro de cards */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--brd);
}
.info-row:last-child { border-bottom: none; }
.info-label { font-size: .8rem; color: var(--tx2); flex-shrink: 0; }
.info-value { font-size: .84rem; color: var(--tx); font-weight: 500; text-align: right; }

/* Stat card */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--brd);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow .15s;
}
.stat-card:hover { box-shadow: var(--sh-sm); }

.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.stat-num {
  font-family: 'Fraunces', serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--tx);
  line-height: 1;
  letter-spacing: -.03em;
}

.stat-lbl {
  font-size: .72rem;
  color: var(--tx3);
  margin-top: 3px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .stats-row { grid-template-columns: repeat(2,1fr); } }


/* ================================================================
   10. TABLA
   ================================================================ */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--brd);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--brd);
  gap: 12px;
}

.table-title {
  font-weight: 700;
  font-size: .9rem;
  color: var(--tx);
}

.table-count {
  font-size: .78rem;
  color: var(--tx3);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tx3);
  background: var(--surface2);
  border-bottom: 1px solid var(--brd);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--brd);
  cursor: pointer;
  transition: background .12s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }

td {
  padding: 11px 14px;
  font-size: .84rem;
  vertical-align: middle;
  color: var(--tx);
}

.td-main {
  font-weight: 500;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.td-sub {
  font-size: .74rem;
  color: var(--tx2);
  margin-top: 2px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.td-num {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  color: var(--tx);
  white-space: nowrap;
}

.td-fecha {
  font-size: .78rem;
  color: var(--tx2);
  white-space: nowrap;
}
.td-fecha.urgente { color: var(--red); font-weight: 600; }
.td-fecha.pronto  { color: var(--amber); font-weight: 600; }


/* ================================================================
   11. FILTROS Y FORMULARIOS
   ================================================================ */
.filters-bar {
  background: var(--surface);
  border: 1px solid var(--brd);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--tx3);
  white-space: nowrap;
}

.f-select, .f-input {
  padding: 7px 12px;
  border: 1.5px solid var(--brd);
  border-radius: var(--r);
  font-size: .83rem;
  color: var(--tx);
  background: var(--surface2);
  outline: none;
  transition: border-color .15s;
  appearance: none;
  -webkit-appearance: none;
}
.f-select:focus, .f-input:focus { border-color: var(--red); }

.f-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23B5B0A3' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

/* Form genérico */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--tx2);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--brd-md);
  border-radius: var(--r);
  font-size: .88rem;
  color: var(--tx);
  background: var(--surface);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(224,11,65,.08);
}
.form-input::placeholder { color: var(--tx3); }
.form-textarea { resize: vertical; min-height: 80px; }

.form-error {
  background: var(--red-lt);
  border: 1px solid var(--red-mid);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--r);
  font-size: .82rem;
  margin-bottom: 14px;
  display: none;
}
.form-error.show { display: block; }

.form-success {
  background: var(--green-lt);
  border: 1px solid rgba(22,163,74,.2);
  color: var(--green);
  padding: 10px 14px;
  border-radius: var(--r);
  font-size: .82rem;
  margin-bottom: 14px;
  display: none;
}
.form-success.show { display: block; }


/* ================================================================
   12. TABS
   ================================================================ */
.tabs-bar {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--brd);
  padding: 0 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 14px 16px;
  font-size: .83rem;
  font-weight: 500;
  color: var(--tx2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .15s;
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.tab-btn:hover { color: var(--tx); }
.tab-btn.active { color: var(--red); border-bottom-color: var(--red); font-weight: 600; }

.tab-content { display: none; animation: fadeIn .15s ease; }
.tab-content.active { display: block; }


/* ================================================================
   13. STATS ROW — ya definido en sección 9 ================================================================ */


/* ================================================================
   14. PAGINACIÓN
   ================================================================ */
.pagination {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--brd);
  flex-wrap: wrap;
  gap: 8px;
}

.pag-info { font-size: .78rem; color: var(--tx3); }

.pag-btns { display: flex; gap: 4px; }

.pag-btn {
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r);
  border: 1px solid var(--brd);
  background: var(--surface);
  cursor: pointer;
  font-size: .82rem;
  color: var(--tx2);
  transition: all .15s;
}
.pag-btn:hover { border-color: var(--red); color: var(--red); }
.pag-btn.active { background: var(--red); color: #fff; border-color: var(--red); }
.pag-btn:disabled { opacity: .35; cursor: not-allowed; }


/* ================================================================
   15. MODALES
   ================================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--brd);
  border-radius: var(--r-2xl);
  padding: 28px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--sh-lg);
  animation: fadeIn .18s ease;
}

.modal-title {
  font-family: 'Fraunces', serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--tx);
  letter-spacing: -.02em;
  margin-bottom: 18px;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--brd);
}


/* ================================================================
   16. TOAST
   ================================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--tx);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: var(--r-pill);
  font-size: .84rem;
  font-weight: 500;
  box-shadow: var(--sh-md);
  opacity: 0;
  transform: translateY(8px);
  transition: all .2s;
  z-index: 999;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }


/* ================================================================
   17. LOADING / EMPTY
   ================================================================ */
.spinner {
  width: 24px; height: 24px;
  border: 2.5px solid var(--brd-md);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 12px;
}

.loading-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--tx3);
  font-size: .85rem;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--tx3);
}
.empty-state-icon { font-size: 2.2rem; margin-bottom: 12px; opacity: .5; }
.empty-state-title { font-size: .95rem; font-weight: 600; color: var(--tx2); margin-bottom: 6px; }
.empty-state-sub { font-size: .82rem; line-height: 1.6; }


/* ================================================================
   18. KANBAN CRM
   ================================================================ */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 12px;
}
@media (max-width: 1100px) { .kanban-board { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 600px)  { .kanban-board { grid-template-columns: repeat(2,1fr); } }

.kanban-col {
  background: var(--surface2);
  border: 1px solid var(--brd);
  border-radius: var(--r-lg);
  padding: 12px;
  min-height: 180px;
}

.kanban-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.kanban-col-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tx2);
}

.kanban-col-count {
  font-size: .68rem;
  font-family: monospace;
  background: var(--surface);
  border: 1px solid var(--brd);
  border-radius: var(--r-pill);
  padding: 1px 7px;
  color: var(--tx3);
}

/* Colores por estado */
.kanban-col[data-estado="prospectando"] .kanban-col-title { color: #6366F1; }
.kanban-col[data-estado="preparando"]   .kanban-col-title { color: var(--amber); }
.kanban-col[data-estado="presentado"]   .kanban-col-title { color: var(--blue); }
.kanban-col[data-estado="ganado"]       .kanban-col-title { color: var(--green); }
.kanban-col[data-estado="perdido"]      .kanban-col-title { color: var(--red); }
.kanban-col[data-estado="descartado"]   .kanban-col-title { color: var(--tx3); }

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--brd);
  border-radius: var(--r);
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  position: relative;
  transition: box-shadow .15s, transform .15s;
}
.kanban-card:hover { box-shadow: var(--sh-sm); transform: translateY(-1px); }

.kanban-col[data-estado="ganado"]     .kanban-card { border-left: 3px solid var(--green); }
.kanban-col[data-estado="perdido"]    .kanban-card { border-left: 3px solid var(--red); }
.kanban-col[data-estado="presentado"] .kanban-card { border-left: 3px solid var(--blue); }

.kanban-card-title {
  font-size: .8rem;
  font-weight: 600;
  color: var(--tx);
  margin-bottom: 4px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kanban-card-org {
  font-size: .72rem;
  color: var(--tx2);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.kanban-card-amount {
  font-family: 'Fraunces', serif;
  font-size: .82rem;
  font-weight: 700;
  color: var(--tx);
}

.kanban-card-days {
  font-size: .7rem;
  color: var(--tx3);
}
.kanban-card-days.urgent { color: var(--red); font-weight: 600; }

.kanban-card-actions {
  position: absolute;
  top: 8px; right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s;
}
.kanban-card:hover .kanban-card-actions { opacity: 1; }

.kbtn {
  background: var(--surface2);
  border: 1px solid var(--brd);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: .68rem;
  cursor: pointer;
  color: var(--tx2);
  transition: all .15s;
}
.kbtn:hover { border-color: var(--red); color: var(--red); }


/* ================================================================
   19. UTILIDADES
   ================================================================ */
.text-red   { color: var(--red); }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-blue  { color: var(--blue); }
.text-muted { color: var(--tx3); }
.text-dim   { color: var(--tx2); }

.font-mono { font-family: 'ui-monospace', 'Fira Code', monospace; }
.font-num  { font-family: 'Fraunces', serif; font-weight: 800; letter-spacing: -.03em; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dias-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: .68rem;
  font-weight: 700;
}
.dias-critico { background: var(--red-lt);   color: var(--red);   }
.dias-pronto  { background: var(--amber-lt); color: var(--amber); }
.dias-ok      { background: var(--green-lt); color: var(--green); }

/* Criterio adjudicación */
.criterio-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--brd);
}
.criterio-item:last-child { border-bottom: none; }
.criterio-tipo {
  font-size: .62rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  letter-spacing: .04em;
  flex-shrink: 0;
}
.tipo-OBJ  { background: var(--blue-lt);  color: var(--blue); }
.tipo-SUBJ { background: var(--amber-lt); color: var(--amber); }
.criterio-desc { flex: 1; font-size: .82rem; color: var(--tx); }
.criterio-bar-bg { width: 60px; height: 4px; background: var(--brd-md); border-radius: 2px; flex-shrink: 0; }
.criterio-bar { height: 100%; background: var(--red); border-radius: 2px; }
.criterio-peso { font-size: .78rem; font-weight: 700; color: var(--tx); width: 32px; text-align: right; flex-shrink: 0; }

/* Importe destacado */
.importe-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 12px;
  padding: 16px;
  background: var(--surface2);
  border-radius: var(--r-lg);
  margin-bottom: 16px;
}
.importe-item { text-align: center; }
.importe-num {
  font-family: 'Fraunces', serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--tx);
  letter-spacing: -.03em;
  line-height: 1;
}
.importe-lbl {
  font-size: .68rem;
  color: var(--tx3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 4px;
}

/* Alert cards (desierta, anulada) */
.alert-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--r-lg);
  margin-bottom: 16px;
  border: 1px solid;
}
.alert-desierta { background: var(--surface2); border-color: var(--brd-md); }
.alert-anulada  { background: var(--red-lt);   border-color: var(--red-mid); }

/* Página de sección */
.page-header {
  margin-bottom: 20px;
}
.page-eyebrow {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--tx3);
  margin-bottom: 4px;
}
.page-title {
  font-family: 'Fraunces', serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--tx);
  letter-spacing: -.03em;
  line-height: 1.1;
}
.page-sub {
  font-size: .85rem;
  color: var(--tx2);
  margin-top: 4px;
  line-height: 1.6;
}

/* ── KANBAN DRAG & DROP ── */
.kanban-card[draggable="true"] { cursor: grab; }
.kanban-card[draggable="true"]:active { cursor: grabbing; }

.kanban-col.drag-over {
  background: var(--red-lt);
  border-color: var(--red-mid);
  outline: 2px dashed var(--red);
  outline-offset: -4px;
}

.kanban-drop-hint {
  text-align: center;
  padding: 20px 8px;
  color: var(--tx3);
  font-size: .74rem;
  border: 1.5px dashed var(--brd);
  border-radius: var(--r);
  transition: all .15s;
}
.kanban-col.drag-over .kanban-drop-hint {
  border-color: var(--red);
  color: var(--red);
  background: rgba(224,11,65,.04);
}


/* ================================================================
   20. NAV PÚBLICO + FOOTER (public.js)
   ================================================================ */

.pub-nav {
  position: sticky; top: 0; z-index: 100;
  height: 60px;
  background: rgba(247,246,242,.96);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--brd);
  display: flex; align-items: center;
  padding: 0 20px; gap: 12px;
  box-sizing: border-box;
}
.pub-nav-logo {
  font-family: 'Fraunces', serif; font-weight: 900; font-size: 1.15rem;
  color: var(--tx); display: flex; align-items: center; gap: 3px;
  text-decoration: none; flex-shrink: 0;
}
.pub-nav-logo em { font-style: normal; color: var(--red); }
.pub-logo-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--red);
  display: inline-block; margin-right: 3px; animation: pulse-dot 2s infinite;
}
.pub-nav-links { display: flex; gap: 2px; margin-left: 12px; flex-shrink: 0; }
.pub-nav-link {
  font-size: .81rem; font-weight: 500; color: var(--tx2);
  padding: 6px 11px; border-radius: var(--r); text-decoration: none;
  transition: background .12s, color .12s; white-space: nowrap;
}
.pub-nav-link:hover { background: var(--surface3); color: var(--tx); }
.pub-nav-link.active { background: var(--red-lt); color: var(--red); font-weight: 600; }
.pub-nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pub-hamburger {
  display: none; width: 34px; height: 34px;
  background: var(--surface2); border: 1px solid var(--brd);
  border-radius: var(--r); cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  flex-shrink: 0;
}
.pub-hamburger span { display: block; width: 16px; height: 2px; background: var(--tx); border-radius: 1px; }

@media (max-width: 860px) { .pub-nav-links { display: none; } }
@media (max-width: 640px) {
  .pub-nav-right .btn { display: none; }
  .pub-hamburger { display: flex; }
}

/* Mobile menu */
.pub-menu-overlay {
  display: none; position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.45);
}
.pub-mobile-menu {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 201;
  width: min(300px, 85vw);
  background: var(--surface); border-left: 1px solid var(--brd);
  display: flex; flex-direction: column;
  box-shadow: -8px 0 32px rgba(0,0,0,.15);
  transform: translateX(100%); transition: transform .25s ease;
}
.pub-menu-overlay.open { display: block; }
.pub-mobile-menu.open { transform: translateX(0); }
.pub-mobile-menu-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--brd); flex-shrink: 0;
}
.pub-mobile-menu-links { display: flex; flex-direction: column; padding: 10px; gap: 2px; overflow-y: auto; flex: 1; }
.pub-mobile-link {
  font-size: .88rem; font-weight: 500; color: var(--tx2);
  padding: 11px 12px; border-radius: var(--r); text-decoration: none;
  transition: background .12s, color .12s;
}
.pub-mobile-link:hover { background: var(--surface2); color: var(--tx); }
.pub-mobile-link.active { color: var(--red); font-weight: 700; background: var(--red-lt); }

/* Footer público */
.pub-footer { background: var(--tx); margin-top: 60px; }
.pub-footer-inner {
  max-width: 1100px; margin: 0 auto; padding: 48px 24px 36px;
  display: grid; grid-template-columns: 220px 1fr; gap: 40px;
}
@media (max-width: 860px) { .pub-footer-inner { grid-template-columns: 1fr; gap: 28px; } }
.pub-footer-desc { font-size: .77rem; color: rgba(247,246,242,.45); line-height: 1.7; margin: 10px 0 14px; max-width: 200px; }
.pub-footer-badges { display: flex; flex-direction: column; gap: 5px; }
.pub-footer-badge { font-size: .67rem; color: rgba(247,246,242,.3); font-weight: 600; }
.pub-footer-cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 640px) { .pub-footer-cols { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 360px) { .pub-footer-cols { grid-template-columns: 1fr; } }
.pub-footer-col-title { font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: rgba(247,246,242,.3); margin-bottom: 10px; }
.pub-footer-link { display: block; font-size: .77rem; color: rgba(247,246,242,.5); text-decoration: none; padding: 3px 0; transition: color .12s; line-height: 1.4; }
.pub-footer-link:hover { color: var(--red); }
.pub-footer-bottom { border-top: 1px solid rgba(247,246,242,.08); }
.pub-footer-bottom-inner {
  max-width: 1100px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; font-size: .71rem; color: rgba(247,246,242,.22);
}
.pub-footer-bottom-links { display: flex; gap: 14px; flex-wrap: wrap; }
.pub-footer-bottom-links a { color: rgba(247,246,242,.22); text-decoration: none; transition: color .12s; }
.pub-footer-bottom-links a:hover { color: rgba(247,246,242,.6); }

/* Utilidades públicas */
.pub-container { max-width: 1100px; margin: 0 auto; padding: 0 20px 80px; }
.breadcrumb { display: flex; align-items: center; gap: 5px; font-size: .75rem; color: var(--tx3); padding: 14px 0 0; flex-wrap: wrap; }
.breadcrumb a { color: var(--tx3); text-decoration: none; }
.breadcrumb a:hover { color: var(--red); }
.bc-sep { font-size: .7rem; }
