/* Poppins (OFL), guardada en LICIX: los mismos pesos que TenderYou */
@font-face{font-family:'Poppins';font-style:normal;font-weight:400;font-display:swap;src:url(assets/fonts/poppins-latin-400.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:'Poppins';font-style:normal;font-weight:400;font-display:swap;src:url(assets/fonts/poppins-latin-ext-400.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:'Poppins';font-style:normal;font-weight:500;font-display:swap;src:url(assets/fonts/poppins-latin-500.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:'Poppins';font-style:normal;font-weight:500;font-display:swap;src:url(assets/fonts/poppins-latin-ext-500.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:'Poppins';font-style:normal;font-weight:600;font-display:swap;src:url(assets/fonts/poppins-latin-600.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:'Poppins';font-style:normal;font-weight:600;font-display:swap;src:url(assets/fonts/poppins-latin-ext-600.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:'Poppins';font-style:normal;font-weight:700;font-display:swap;src:url(assets/fonts/poppins-latin-700.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:'Poppins';font-style:normal;font-weight:700;font-display:swap;src:url(assets/fonts/poppins-latin-ext-700.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}

/* ==========================================================================
   Tokens. Claro por defecto (rojo y negro de Linzex); oscuro con data-theme.
   ========================================================================== */
:root {
  --bg: #faf9fb;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --surface-3: #edf0f3;
  --border: #dae0e7;
  --border-soft: #e8ecf0;
  --text: #353b41;
  --text-2: #4a525a;
  --muted: #6a7581;
  --ink: #0b0b0d;

  --primary: #e01e2b;
  --primary-600: #c21722;
  --primary-soft: #fdecee;
  --primary-ring: rgba(224, 30, 43, .22);

  --ok: #16a34a;   --ok-soft: #e9f7ee;
  --warn: #d97706; --warn-soft: #fdf3e2;
  --bad: #dc2626;  --bad-soft: #fdecec;
  --info: #2563eb; --info-soft: #eaf1fe;
  --violet: #7c3aed; --violet-soft: #f1ebfe;

  --shadow-sm: 0 1px 2px rgba(16, 16, 22, .05);
  --shadow: 0 1px 2px rgba(16, 16, 22, .04), 0 6px 20px rgba(16, 16, 22, .05);
  --shadow-lg: 0 24px 60px rgba(16, 16, 22, .18);
  --radius: 24px;
  --radius-sm: 6px;

  /* Nombres antiguos que aún usa el código de las tarjetas de análisis */
  --panel: var(--surface);
  --panel-2: var(--surface-2);
  --bg-2: var(--surface-2);
  --red: var(--primary);
  --red-bright: var(--primary);
  --red-dim: var(--primary-soft);
  --accent: var(--primary);

  --rail-w: 56px;
  --rail-open: 236px;
  color-scheme: light;
  font-synthesis: none;
}
:root[data-theme="dark"] {
  --bg: #08080a;
  --surface: #121215;
  --surface-2: #19191d;
  --surface-3: #232328;
  --border: #29292f;
  --border-soft: #1f1f24;
  --text: #f2f2f4;
  --text-2: #c8c8ce;
  --muted: #8a8a93;
  --ink: #000;
  --primary: #ff3341;
  --primary-600: #e01e2b;
  --primary-soft: rgba(255, 51, 65, .13);
  --primary-ring: rgba(255, 51, 65, .3);
  --ok: #35d07f;   --ok-soft: rgba(53, 208, 127, .12);
  --warn: #f5a623; --warn-soft: rgba(245, 166, 35, .12);
  --bad: #ff4d5e;  --bad-soft: rgba(255, 77, 94, .13);
  --info: #60a5fa; --info-soft: rgba(96, 165, 250, .12);
  --violet: #a78bfa; --violet-soft: rgba(167, 139, 250, .13);
  --shadow-sm: none;
  --shadow: 0 1px 0 rgba(255, 255, 255, .02);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; }
a { color: var(--primary); }
button { font-family: inherit; }
.ic { width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: middle; }
.ic.sm { width: 16px; height: 16px; }
.ic.xs { width: 12px; height: 12px; }
.ic.s14 { width: 14px; height: 14px; }
.ic.md { width: 20px; height: 20px; }
.ic.lg { width: 24px; height: 24px; }
.ic.xl { width: 48px; height: 48px; }
.mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* ==========================================================================
   Estructura: menú de iconos + barra superior + página
   ========================================================================== */
.app { min-height: 100vh; padding: 10px 10px 10px calc(var(--rail-w) + 20px); transition: padding .2s; }
.app.pinned { padding-left: calc(var(--rail-open) + 20px); }

.rail {
  position: fixed; left: 10px; top: 10px; bottom: 10px; z-index: 30;
  width: var(--rail-w); overflow: hidden;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; padding: 12px 10px;
  transition: width .18s ease, box-shadow .18s;
}
.rail:hover, .app.pinned .rail { width: var(--rail-open); }
.rail:hover:not(.pinned-rail) { box-shadow: var(--shadow-lg); }
.app.pinned .rail { box-shadow: var(--shadow-sm); }

.rail-top { display: flex; align-items: center; gap: 10px; height: 40px; margin-bottom: 14px; padding-left: 2px; }
.rail-logo { width: 36px; height: 36px; border-radius: 10px; background: var(--ink); display: flex; align-items: center; justify-content: center; flex: none; }
.rail-logo img { width: 24px; height: 24px; object-fit: contain; }
.rail-brand { min-width: 0; white-space: nowrap; opacity: 0; transition: opacity .12s; }
.rail-brand b { display: block; font-size: 15px; letter-spacing: .02em; }
.rail-brand span { display: block; font-size: 10.5px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.rail:hover .rail-brand, .app.pinned .rail-brand { opacity: 1; }
.rail-pin {
  margin-left: auto; flex: none; width: 30px; height: 30px; border-radius: 8px; border: none; background: none;
  color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0;
}
.rail:hover .rail-pin, .app.pinned .rail-pin { opacity: 1; }
.rail-pin:hover { background: var(--surface-2); color: var(--text); }
.app.pinned .rail-pin { color: var(--primary); }

.rail-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; overflow-x: hidden; }
.rail-sep { height: 1px; background: var(--border-soft); margin: 8px 6px; flex: none; }
.rail-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 6px 12px 4px; white-space: nowrap; opacity: 0; height: 22px; }
.rail:hover .rail-label, .app.pinned .rail-label { opacity: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 10px; border-radius: 6px;
  color: var(--text); text-decoration: none; white-space: nowrap; font-size: 14px; font-weight: 400;
  position: relative; flex: none;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.nav-item .nav-txt { opacity: 0; transition: opacity .12s; }
.rail:hover .nav-txt, .app.pinned .nav-txt { opacity: 1; }
.nav-count {
  margin-left: auto; background: var(--primary); color: #fff; font-size: 10.5px; font-weight: 700;
  border-radius: 999px; padding: 1px 7px; min-width: 20px; text-align: center;
}
/* Con el menú cerrado, el contador queda como punto sobre el icono */
.rail:not(:hover) .nav-count { position: absolute; top: 4px; left: 22px; padding: 0 4px; font-size: 9px; min-width: 15px; line-height: 15px; }
.app.pinned .rail .nav-count { position: static; padding: 1px 7px; font-size: 10.5px; min-width: 20px; line-height: 1.5; }
.rail-foot { font-size: 10.5px; color: var(--muted); white-space: nowrap; padding: 8px 4px 0; border-top: 1px solid var(--border-soft); opacity: 0; }
.rail:hover .rail-foot, .app.pinned .rail-foot { opacity: 1; }

/* Barra superior */
.topbar {
  display: flex; align-items: center; gap: 10px; height: 64px; padding: 0 14px 0 10px; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  position: sticky; top: 10px; z-index: 25;
}
.search-btn {
  display: flex; align-items: center; gap: 10px; width: min(448px, 34vw); height: 44px; padding: 0 10px 0 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px; color: var(--muted);
  font-size: 14px; font-weight: 500; cursor: pointer; text-align: left;
}
.search-btn:hover { border-color: #cfcfd6; }
.search-btn .kbd { margin-left: auto; }
.kbd { font-size: 10.5px; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
.topbar .spacer { flex: 1; }
.tb-sep { width: 1px; height: 26px; background: var(--border); margin: 0 4px; }
.icon-btn {
  position: relative; width: 36px; height: 36px; border-radius: 10px; border: none; background: none; color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .badge-dot {
  position: absolute; top: 3px; right: 2px; background: var(--primary); color: #fff; font-size: 9.5px; font-weight: 700;
  min-width: 16px; height: 16px; line-height: 16px; border-radius: 999px; padding: 0 4px; text-align: center; border: 2px solid var(--surface);
  box-sizing: content-box;
}
.icon-btn .state-dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--surface); background: var(--muted); }
.state-dot.green { background: var(--ok) !important; }
.state-dot.yellow { background: var(--warn) !important; }
.state-dot.red { background: var(--bad) !important; }

.work-badge {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 6px 13px; font-size: 12px;
  border: 1px solid var(--primary-ring); background: var(--primary-soft); color: var(--primary); max-width: 380px; font-weight: 550;
}
.work-badge.idle { display: none; }
.work-badge .work-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); flex: none; animation: pulse 1.1s infinite; }
.work-badge #work-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-btn {
  display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 12px; border: none; background: none;
  cursor: pointer; color: var(--text); text-align: left;
}
.user-btn:hover { background: var(--surface-2); }
.user-btn .ub-name { font-size: 14px; font-weight: 500; line-height: 1.25; }
.user-btn .ub-role { font-size: 12px; color: var(--muted); line-height: 1.25; }

/* Desplegables de la barra superior */
.tb-wrap { position: relative; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; overflow: hidden;
}
.dd-head { padding: 10px 10px 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.dd-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px;
  background: none; border: none; color: var(--text-2); font-size: 13px; cursor: pointer; text-decoration: none;
}
.dd-item:hover { background: var(--surface-2); color: var(--text); }
.dd-item.danger { color: var(--bad); }
.dd-item.danger:hover { background: var(--bad-soft); }
.dd-sep { height: 1px; background: var(--border-soft); margin: 6px 0; }
.dd-user { display: flex; align-items: center; gap: 10px; padding: 10px; }
.dd-user b { display: block; font-size: 13.5px; }
.dd-user span { font-size: 11.5px; color: var(--muted); }
.dd-empty { padding: 22px 12px; text-align: center; color: var(--muted); font-size: 12.5px; }
.notif { display: flex; gap: 10px; padding: 10px; border-radius: 8px; cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif .n-ic { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex: none; }
.notif .n-t { font-size: 13px; font-weight: 600; line-height: 1.35; }
.notif .n-s { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* Página */
.page {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: none;
  min-height: calc(100vh - 94px); padding: 24px 24px 48px;
}
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 20px; margin-bottom: 22px; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; }
.page-head h1 { font-size: 30px; font-weight: 700; line-height: 36px; letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); font-size: 16px; line-height: 1.6; margin-top: 2px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ==========================================================================
   Botones, campos y piezas comunes
   ========================================================================== */
.btn, .btn-sm {
  font-family: inherit; cursor: pointer; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s; white-space: nowrap; text-decoration: none;
}
.btn { height: 36px; padding: 0 16px; font-size: 14px; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 12px; }
.btn:hover, .btn-sm:hover { background: var(--primary-600); }
.btn:focus-visible, .btn-sm:focus-visible, .icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.btn:disabled, .btn-sm:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost, .btn-sm.ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.ghost:hover, .btn-sm.ghost:hover { background: var(--surface-2); border-color: #d4d4db; }
.btn.danger, .btn-sm.danger { background: var(--surface); color: var(--bad); border-color: var(--border); }
.btn.danger:hover, .btn-sm.danger:hover { background: var(--bad-soft); border-color: transparent; }
.btn.solid-danger { background: var(--bad); color: #fff; }
.btn-sm.with-logo, .btn.with-logo { gap: 7px; }
.logo-mini { width: 15px; height: 15px; object-fit: contain; display: block; }
.logo-modal { width: 24px; height: 24px; object-fit: contain; vertical-align: -5px; }

.field label { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); font-weight: 400; margin-bottom: 6px; }
.field label .ic { width: 16px; height: 16px; color: var(--muted); }
.field input, .field textarea, .field select, .input {
  width: 100%; height: 36px; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 12px; font-size: 14px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: auto; padding: 9px 11px; resize: vertical; min-height: 44px; line-height: 1.5; }
.field select, select.input {
  appearance: none; cursor: pointer; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.field input:focus, .field textarea:focus, .field select:focus, .input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.field input::placeholder, .input::placeholder, .field textarea::placeholder { color: #a1a1aa; }
.input-icon { position: relative; }
.input-icon .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; pointer-events: none; }
.input-icon .input { padding-left: 32px; }
.params-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 11.5px; }

/* Interruptor */
.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 999px; cursor: pointer; transition: background .15s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(16px); }

/* Casillas tipo tarjeta */
.esc-opt { display: inline-flex; align-items: flex-start; gap: 9px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px; cursor: pointer; font-size: 13px; }
.esc-opt:hover { border-color: #cfcfd6; }
.esc-opt input { margin-top: 3px; accent-color: var(--primary); }

/* Insignias */
.pill {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 6px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; line-height: 1.6;
}
.pill .ic { width: 12px; height: 12px; }
.pill.green { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.blue { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill.amber { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.red { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.violet { background: var(--violet-soft); color: var(--violet); border-color: transparent; }
.pill.brand { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.pill.gray { background: var(--surface-2); color: var(--muted); }
.badge { font-size: 10.5px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-weight: 600; }
.badge.admin { color: var(--primary); background: var(--primary-soft); border-color: transparent; }
.badge.tu { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.badge.analyzing { color: var(--primary); animation: pulse 1.4s infinite; }
.badge.analyzed { color: var(--ok); }
.badge.error { color: var(--bad); }
.tab-count { background: var(--surface-3); color: var(--text-2); font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 0 7px; min-width: 20px; text-align: center; line-height: 18px; }
.tab-dot { background: var(--primary); color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }

/* Avatar */
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.author { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }

/* Control segmentado (Abiertas / Archivadas, Tabla / Kanban…) */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: none; border-radius: 6px; background: none;
  color: var(--text); font-size: 12px; font-weight: 500; cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.seg button.active .tab-count { background: rgba(255,255,255,.25); color: #fff; }
.seg button .ic { width: 16px; height: 16px; }

/* Tarjeta genérica */
.box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.box-head { display: flex; align-items: center; gap: 12px; padding: 24px 24px 0; }
.box-head h3 { font-size: 18px; font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
.box-head .sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.box-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.box-ic { width: 36px; height: 36px; border-radius: 8px; background: #f3f4f6; display: flex; align-items: center; justify-content: center; color: var(--text); flex: none; }
.box-ic .ic { width: 20px; height: 20px; }
.box-body { padding: 16px 24px 24px; }
.empty-mini { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 34px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.empty-mini .ic { width: 48px; height: 48px; color: #8b95a1; }
.empty-mini b { color: var(--text-2); font-weight: 400; font-size: 16px; }

/* ==========================================================================
   Dashboard
   ========================================================================== */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.kpi {
  position: relative; border-radius: var(--radius); padding: 24px; border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow); overflow: hidden; cursor: default;
}
.kpi::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--k); }
.kpi { background: color-mix(in srgb, var(--k-soft) 55%, var(--surface)); }
.kpi.link { cursor: pointer; }
.kpi.link:hover { border-color: var(--k); }
.kpi .k-top { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); font-weight: 500; }
.kpi .k-top .ic { color: var(--k); width: 16px; height: 16px; }
.kpi .k-val { font-size: 24px; font-weight: 700; line-height: 32px; margin-top: 14px; }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi.blue { --k: #3b82f6; --k-soft: var(--info-soft); }
.kpi.green { --k: #22c55e; --k-soft: var(--ok-soft); }
.kpi.amber { --k: #f59e0b; --k-soft: var(--warn-soft); }
.kpi.red { --k: var(--primary); --k-soft: var(--primary-soft); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.dash-grid.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: 260px; overflow: visible; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 8px;
  transform: translate(-50%, -120%); white-space: nowrap; box-shadow: var(--shadow-lg);
}
.chart-stats { display: flex; justify-content: center; gap: 0; margin-top: 10px; border-top: 1px solid var(--border-soft); padding-top: 14px; }
.chart-stats div { text-align: center; padding: 0 28px; border-right: 1px solid var(--border); }
.chart-stats div:last-child { border-right: none; }
.chart-stats b { display: block; font-size: 24px; font-weight: 700; line-height: 32px; }
.chart-stats b.brand { color: var(--primary); }
.chart-stats span { font-size: 12px; color: var(--muted); }
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; width: 100%; }
.legend div { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.legend i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend b { margin-left: auto; font-weight: 650; color: var(--text); }
.mini-list { display: flex; flex-direction: column; }
.mini-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--border-soft); cursor: pointer; border-radius: 6px; }
.mini-row:last-child { border-bottom: none; }
.mini-row:hover { background: var(--surface-2); }
.mini-row .m-main { flex: 1; min-width: 0; }
.mini-row .m-t { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-row .m-s { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline { display: flex; flex-direction: column; }
.tl-row { display: flex; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--border-soft); }
.tl-row:last-child { border-bottom: none; }
.tl-row .tl-t { font-size: 13px; color: var(--text-2); line-height: 1.45; }
.tl-row .tl-t b { color: var(--text); font-weight: 600; }
.tl-row .tl-t a { color: var(--text); font-weight: 600; text-decoration: none; }
.tl-row .tl-t a:hover { color: var(--primary); }
.tl-row .tl-s { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.live-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--text); background: var(--surface-3); border-radius: 6px; padding: 4px 10px; }
.live-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

/* ==========================================================================
   Tablas de datos (buscador y mis licitaciones)
   ========================================================================== */
.filters { padding: 16px 18px; margin-bottom: 16px; }
.filters-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters-top .input-icon { flex: 1; min-width: 240px; }
.filters-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.filters-grid .range { display: flex; align-items: center; gap: 8px; }
.filters-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .count { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); font-weight: 500; }

.dt-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; background: var(--surface); box-shadow: var(--shadow); }
table.dt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
table.dt th {
  position: sticky; top: 0; z-index: 1; text-align: left; font-size: 14px; font-weight: 500; color: var(--text);
  background: var(--surface); padding: 12px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.dt td { padding: 12px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.dt tbody tr { cursor: pointer; transition: background .1s; }
table.dt tbody tr:hover td { background: var(--surface-2); }
table.dt tbody tr:last-child td { border-bottom: none; }
table.dt td:first-child { border-left: 4px solid transparent; }
table.dt tr.st-green td:first-child { border-left-color: #4ade80; }
table.dt tr.st-amber td:first-child { border-left-color: #fbbf24; }
table.dt tr.st-red td:first-child { border-left-color: var(--primary); }
table.dt tr.st-gray td:first-child { border-left-color: var(--surface-3); }
table.dt tr.st-green td { background: color-mix(in srgb, var(--ok-soft) 35%, transparent); }
.dt-title { font-weight: 500; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 400px; min-width: 220px; }
.dt-sub { font-size: 12px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 400px; }
.dt-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.dt-date { white-space: nowrap; }
.dt-date .d { font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 5px; }
.dt-date .d .ic { width: 14px; height: 14px; color: var(--muted); }
.dt-date .pill { margin-top: 4px; }
.dt-date .h { font-size: 12px; color: var(--muted); margin-top: 3px; }
.dt-actions { display: flex; gap: 4px; justify-content: flex-end; white-space: nowrap; }
.dt-actions .icon-btn { width: 32px; height: 32px; border: 1px solid transparent; }
.dt-actions .icon-btn:hover { border-color: var(--border); background: var(--surface); }
.dt-actions .icon-btn.on { color: var(--primary); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; max-width: 160px; }
.chip-k { font-size: 11px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px 0; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.pager .pg { display: flex; align-items: center; gap: 6px; }
.pager .pg select { height: 32px; width: auto; padding: 0 28px 0 10px; }
.pager .icon-btn { width: 32px; height: 32px; border: 1px solid var(--border); }
.pager .icon-btn:disabled { opacity: .4; cursor: default; }

/* Enlace a la plataforma (flecha) */
.t-link {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px;
  border: 1px solid transparent; color: var(--text-2); text-decoration: none; background: none;
}
.t-link:hover { color: var(--primary); border-color: var(--border); background: var(--surface); }
.t-link.grande { border-color: var(--border); background: var(--surface); }
.t-link.grande:hover { background: var(--surface-2); }

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kb-col { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 10px; min-height: 200px; transition: background .12s, border-color .12s; }
.kb-col.over { background: var(--primary-soft); border-color: var(--primary); }
.kb-col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-size: 13px; font-weight: 650; }
.kb-col-head i { width: 9px; height: 9px; border-radius: 50%; }
.kb-col-head .tab-count { margin-left: auto; background: var(--surface); border: 1px solid var(--border); }
.kb-cards { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.kb-card { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 11px 12px; cursor: grab; box-shadow: var(--shadow-sm); }
.kb-card:hover { border-color: #cfcfd6; }
.kb-card.dragging { opacity: .45; }
.kb-card .kc-t { font-size: 13px; font-weight: 600; line-height: 1.35; }
.kb-card .kc-s { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.kb-card .kc-f { display: flex; align-items: center; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.kb-card .kc-f .author { margin-left: auto; }

/* ==========================================================================
   Ficha de licitación (hoja grande sobre la página)
   ========================================================================== */
.sheet-overlay { position: fixed; inset: 0; z-index: 40; background: rgba(12, 12, 16, .42); backdrop-filter: blur(2px); display: flex; padding: 14px; }
.sheet {
  flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; max-width: 1480px; margin: 0 auto;
}
.sheet-head { background: var(--surface); border-bottom: 1px solid var(--border); padding: 16px 22px 0; flex: none; }
.sh-row { display: flex; align-items: flex-start; gap: 12px; }
.sh-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex: none; margin-top: 2px; }
.sh-main { flex: 1; min-width: 0; }
.title-input {
  font-size: 24px; font-weight: 700; background: transparent; border: none; color: var(--text); padding: 2px 0;
  width: 100%; letter-spacing: -.02em; font-family: inherit; border-bottom: 1px dashed transparent; text-overflow: ellipsis;
}
.title-input:hover, .title-input:focus { border-bottom-color: var(--border); outline: none; }
.sh-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.sh-actions { display: flex; align-items: center; gap: 6px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.sh-actions select.input { height: 32px; width: auto; font-size: 12.5px; font-weight: 600; }
.sh-close { margin-left: 4px; }
.sh-tabs { display: flex; align-items: center; gap: 4px; margin-top: 14px; overflow-x: auto; }
.tab-group { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--border); border-bottom: none; border-radius: 10px 10px 0 0; padding: 4px 4px 0; background: var(--surface-2); }
.tab-group .tg-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; color: var(--primary); padding: 0 8px 4px; }
.tab-group .tg-label::after { content: "›"; color: var(--muted); margin-left: 4px; }
.sh-tab {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: none; background: none; cursor: pointer;
  font-size: 12px; font-weight: 500; color: var(--text); border-radius: 8px 8px 0 0; white-space: nowrap; margin-bottom: -1px;
  border: 1px solid transparent; border-bottom: none;
}
.sh-tab:hover { color: var(--text); }
.sh-tab.active { background: var(--bg); color: var(--primary); border-color: var(--border); }
.sh-tab .ic { width: 14px; height: 14px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 20px 22px 40px; }
.sheet-body > .inner { max-width: 1180px; margin: 0 auto; }
.info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.info-grid .span2 { grid-column: span 2; }
.info-grid .span3 { grid-column: 1 / -1; }
.icard { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-sm); }
.icard-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-size: 16px; font-weight: 600; background: linear-gradient(90deg, var(--primary-soft), transparent 80%); border-bottom: 1px solid var(--border-soft); }
.icard-h .ic { color: var(--primary); width: 20px; height: 20px; }
.icard-b { padding: 14px 16px; font-size: 14px; color: var(--text); }
.icard-b .big { font-size: 22px; font-weight: 750; color: var(--text); letter-spacing: -.02em; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; border-bottom: 1px dashed var(--border-soft); }
.kv:last-child { border-bottom: none; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { text-align: right; font-weight: 550; color: var(--text); max-width: 68%; }

/* Medidor de coste y caja de trabajo en vivo */
.cost-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.cost-track { flex: 1; height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.cost-fill { height: 100%; background: var(--primary); transition: width .4s; }
.cost-fill.over { background: var(--bad); }
.cost-label { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cost-label.over { color: var(--bad); font-weight: 700; }
.live-box { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--primary-ring); border-radius: 12px; padding: 11px 14px; margin: 0 0 14px; }
.live-box .pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); animation: pulse 1.1s infinite; flex: none; }
.live-box .live-text { font-size: 13px; color: var(--text-2); }
.shimmer { background: linear-gradient(90deg, var(--muted) 0%, var(--text) 50%, var(--muted) 100%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.8s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 50% { opacity: .45; } }

/* Tarjetas de análisis */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.card > h3 { font-size: 18px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--border-soft); color: var(--text); }
.card > h3::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--primary); display: inline-block; flex: none; }
.card h4 { font-size: 13px; color: var(--text); font-weight: 650; margin: 18px 0 8px; }
.md-h { font-size: 13.5px; font-weight: 700; color: var(--text); margin: 14px 0 6px; }
.card p, .md p { color: var(--text-2); margin: 0 0 11px; font-size: 13.5px; line-height: 1.65; }
.md strong, .card strong { color: var(--text); font-weight: 650; }
.md em { color: var(--text); font-style: italic; }
.md ul, .md ol { margin: 0 0 12px 20px; padding: 0; }
.md li { margin: 4px 0; color: var(--text-2); font-size: 13.5px; line-height: 1.55; }
.md li::marker { color: var(--muted); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.fundamento { margin-top: 16px; background: var(--surface-2); border: 1px dashed var(--border); border-left: 3px solid var(--primary); border-radius: 10px; padding: 11px 14px; }
.fundamento .f-title { font-size: 12px; color: var(--muted); font-weight: 650; margin-bottom: 4px; }
.fundamento .f-text { font-size: 12.5px; color: var(--muted); }
.stat { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 10px; padding: 11px 13px; }
.stat .s-label { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.stat .s-val { font-size: 15px; font-weight: 700; margin-top: 2px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 11px; font-size: 12px; margin: 3px 6px 3px 0; }
.file-chip.warn { border-color: rgba(217,119,6,.45); background: var(--warn-soft); }
a.file-chip { color: var(--text); text-decoration: none; }
a.file-chip:hover { border-color: var(--primary); color: var(--primary); }
.dropzone { border: 1.5px dashed var(--border); border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; }
.dropzone .ic { width: 24px; height: 24px; color: #8b95a1; }
.dropzone:hover { border-color: #c4c4cc; background: var(--surface-2); }
.dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
table.req { width: 100%; border-collapse: collapse; font-size: 13px; }
table.req th, table.req td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
table.req th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--surface-2); }
table.req tr:hover td { background: var(--surface-2); }
table.req td.na { color: var(--muted); }
table.req td.dif, .dif { color: var(--warn); }
table.req input.m-val { width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 7px; padding: 6px 8px; font-size: 12.5px; font-family: inherit; }
table.req input.m-val:focus { outline: none; border-color: var(--primary); }
.chip { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.chip.SI { color: var(--ok); background: var(--ok-soft); }
.chip.NO { color: var(--bad); background: var(--bad-soft); }
.chip.PARCIAL { color: var(--warn); background: var(--warn-soft); }
.chip.DESCONOCIDO { color: var(--muted); background: var(--surface-2); }
.verdict { display: inline-block; padding: 7px 15px; border-radius: 9px; font-weight: 800; margin-bottom: 10px; letter-spacing: .02em; }
.verdict.APTO { color: var(--ok); background: var(--ok-soft); }
.verdict.APTO_CON_RIESGOS { color: var(--warn); background: var(--warn-soft); }
.verdict.NO_APTO { color: var(--bad); background: var(--bad-soft); }
.verdict.INSUFICIENTE_INFO { color: var(--muted); background: var(--surface-2); }
.scenarios { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 14px; }
.scenario { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.scenario:nth-child(2) { border-color: var(--primary-ring); background: var(--surface); box-shadow: 0 0 0 3px var(--primary-soft); }
.scenario h4 { margin: 0 0 10px; font-size: 13px; color: var(--text); }
.scenario .big { font-size: 24px; font-weight: 800; color: var(--primary); letter-spacing: -.02em; }
.scenario .row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 12px; border-bottom: 1px dashed var(--border); }
.scenario .row span:first-child { color: var(--muted); }
.scenario .comment { font-size: 12px; color: var(--muted); margin-top: 8px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.tag-list li { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 11px; font-size: 12px; color: var(--text-2); }
.sources a { color: var(--primary); font-size: 12px; display: block; margin: 3px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.banner { padding: 11px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; color: var(--text-2); }
.banner.warn { background: var(--warn-soft); border: 1px solid rgba(217,119,6,.25); color: var(--text-2); }
.banner.info { background: var(--primary-soft); border: 1px solid var(--primary-ring); }
.pt-flag { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; background: var(--ok-soft); color: var(--ok); border: 1px solid rgba(22,163,74,.3); border-radius: 10px; padding: 9px 14px; font-weight: 700; font-size: 13px; }
.pt-flag.no { background: var(--surface-2); color: var(--muted); border-color: var(--border); cursor: default; }
.pt-flag .arrow { opacity: .7; }
.autosave { font-size: 11.5px; color: var(--muted); align-self: center; margin-right: auto; }

/* Fases */
.phase-card > h3 { margin-bottom: 0; border: none; padding-bottom: 0; }
.phase-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); margin-bottom: 6px; border: 1px solid transparent; }
.phase-row.done { background: var(--ok-soft); }
.phase-row.err { background: var(--bad-soft); border-color: rgba(220,38,38,.25); }
.phase-row.running { background: var(--primary-soft); border-color: var(--primary-ring); }
.phase-name { font-size: 13px; font-weight: 650; }
.phase-icon { display: inline-block; min-width: 16px; }
.phase-desc { font-size: 11.5px; color: var(--muted); }
.phase-err { font-size: 11.5px; color: var(--bad); margin-top: 3px; }
.phase-model { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; height: 32px; padding: 0 6px; font-size: 12px; font-family: inherit; max-width: 160px; }
.phase-run { min-width: 36px; }

/* Seguimiento PCSP */
.pub-list { display: flex; flex-direction: column; gap: 8px; }
.pub-row { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.pub-row.nueva { border-color: var(--primary-ring); background: var(--surface); box-shadow: 0 0 0 3px var(--primary-soft); }
.pub-top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.pub-tipo { font-weight: 650; font-size: 13.5px; }
.pub-fecha { font-size: 11.5px; color: var(--muted); }
.pub-pdf { margin-left: auto; font-size: 11px; color: var(--primary); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; text-decoration: none; background: var(--surface); }
.pub-ia { margin-top: 8px; }
.pub-titular { font-size: 13.5px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }
.pub-res { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.pub-linzex { font-size: 12.5px; color: var(--text-2); margin-top: 5px; }

/* Chat (pestaña de la ficha) */
.chat-shell { display: flex; flex-direction: column; height: calc(100vh - 250px); min-height: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.chat-shell #chat-col { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-card { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border-soft); }
.chat-head h3 { font-size: 15px; }
.chat-engine { font-size: 11px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; margin-left: auto; }
.chat-log { display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; overflow-y: auto; padding: 18px; }
.chat-msg { max-width: 78%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.55; }
.chat-msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.ai { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border-soft); border-bottom-left-radius: 4px; }
.chat-msg.ai p:last-child, .chat-msg.ai ul:last-child { margin-bottom: 0; }
.chat-msg.ai .did { font-size: 11px; color: var(--ok); margin-top: 6px; }
.chat-input-row { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border-soft); align-items: flex-end; }
.chat-input-row textarea { flex: 1; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; font-size: 13.5px; font-family: inherit; resize: none; min-height: 44px; max-height: 180px; }
.chat-input-row textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.chat-empty { margin: auto; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.chat-empty .ic { width: 48px; height: 48px; color: #8b95a1; }

/* ==========================================================================
   Modales, paleta de búsqueda, avisos
   ========================================================================== */
.modal-overlay { position: fixed; inset: 0; background: rgba(12, 12, 16, .45); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 24px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; max-width: 720px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 24px 26px; box-shadow: var(--shadow-lg); }
.modal h2 { font-size: 19px; margin-bottom: 6px; display: flex; align-items: center; gap: 10px; padding-right: 30px; }
.modal .modal-close { float: right; cursor: pointer; color: var(--muted); background: none; border: none; width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; margin: -6px -8px 0 0; }
.modal .modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.modal-actions .spacer { margin-right: auto; }
.modal-sub { font-size: 13px; color: var(--muted); margin: 0 0 18px; }
.modal-msg { font-size: 13.5px; color: var(--text-2); line-height: 1.55; margin: 0 0 4px; }
.modal-msg b { color: var(--text); }
.panel-block { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 12px; padding: 16px 18px; }
.panel-block h4 { margin: 0 0 4px; font-size: 13.5px; font-weight: 650; }

.cmdk-overlay { position: fixed; inset: 0; z-index: 70; background: rgba(12, 12, 16, .4); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.cmdk { width: 100%; max-width: 620px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; }
.cmdk-in { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border-soft); }
.cmdk-in .ic { color: var(--muted); }
.cmdk-in input { flex: 1; height: 54px; border: none; outline: none; background: none; font-size: 15px; font-family: inherit; color: var(--text); }
.cmdk-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.cmdk-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 10px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.cmdk-item .ic { color: var(--muted); }
.cmdk-item.sel { background: var(--primary-soft); }
.cmdk-item.sel .ic { color: var(--primary); }
.cmdk-item .c-t { font-size: 13.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item .c-s { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item .c-main { min-width: 0; flex: 1; }
.cmdk-foot { display: flex; gap: 14px; padding: 9px 14px; border-top: 1px solid var(--border-soft); font-size: 11.5px; color: var(--muted); }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 11px; z-index: 80; box-shadow: var(--shadow-lg); max-width: 90vw; font-size: 13px; }
.toast.bad { background: var(--bad); }

.loading { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.spinner { width: 15px; height: 15px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
.spinner-sm { display: inline-block; width: 11px; height: 11px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-box { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--primary-soft); color: var(--text-2); font-size: 13px; margin-bottom: 14px; border: 1px solid var(--primary-ring); }

/* Listas en modales y configuración */
.trash-list, .user-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.trash-row, .user-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 11px 14px; }
.trash-info, .user-row .user-info { flex: 1; min-width: 0; }
.trash-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash-meta, .user-row .user-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.trash-actions { display: flex; gap: 8px; flex: none; }
.user-row .user-name { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.user-row .btn-sm { flex: none; }
.pass-out { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--ok-soft); border: 1px solid rgba(22,163,74,.25); border-radius: 10px; padding: 12px 14px; margin-top: 14px; font-size: 13px; }
.pass-out code { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; font-size: 13.5px; user-select: all; }
.file-pick { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.file-pick-btn { flex: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; font-size: 12.5px; color: var(--text); }
.file-pick:hover .file-pick-btn { border-color: var(--primary); }
.file-pick-txt { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-msg { margin-top: 14px; font-size: 13px; padding: 10px 12px; border-radius: 9px; }
.login-msg.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid rgba(22,163,74,.25); }
.login-msg.bad { background: var(--bad-soft); color: var(--bad); border: 1px solid rgba(220,38,38,.25); }

/* Configuración y alertas */
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 90px; }
.settings-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--text-2); text-decoration: none; font-size: 13.5px; font-weight: 550; }
.settings-nav a:hover { background: var(--surface-2); color: var(--text); }
.settings-nav a.active { background: var(--primary-soft); color: var(--primary); }
.set-sec { margin-bottom: 18px; }
.set-sec .box-body > p.hint { margin-bottom: 14px; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.health-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px 4px; border-top: 1px solid var(--border-soft); }
.health-item:first-child { border-top: none; }
.health-item .hi-name { font-size: 13.5px; font-weight: 650; }
.health-item .hi-models { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.health-item .hi-state { margin-left: auto; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.hi-state.ok { color: var(--ok); background: var(--ok-soft); }
.hi-state.error { color: var(--bad); background: var(--bad-soft); }
.hi-state.missing { color: var(--muted); background: var(--surface-2); }
.hi-credit { font-size: 11.5px; color: var(--text-2); margin-top: 4px; }
.hi-detail { font-size: 11.5px; color: var(--bad); margin-top: 3px; }
.hi-credit.real { color: var(--ok); }
.hi-credit.low { color: var(--bad); font-weight: 700; }
.hi-credit .hi-na, .hi-credit.hi-na { color: var(--muted); font-weight: 400; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.green { background: var(--ok); }
.dot.yellow { background: var(--warn); }
.dot.red { background: var(--bad); }
.alert-card { display: flex; gap: 16px; align-items: flex-start; }
.alert-card .a-ic { width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex: none; }
.summary-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* ==========================================================================
   Acceso (pantalla partida)
   ========================================================================== */
.login-body { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.login-hero {
  position: relative; overflow: hidden; color: #fff; padding: 44px 48px; display: flex; flex-direction: column;
  background: radial-gradient(900px 600px at 85% 110%, rgba(224,30,43,.75), transparent 60%), radial-gradient(700px 500px at 0% 0%, #26262c, transparent 60%), #0b0b0d;
}
.login-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
}
.login-hero .lh-brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.login-hero .lh-brand .rail-logo { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); }
.login-hero .lh-brand b { font-size: 17px; letter-spacing: .03em; display: block; }
.login-hero .lh-brand span { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
.login-hero h1 { font-size: clamp(34px, 4.2vw, 56px); line-height: 1.05; font-weight: 800; letter-spacing: -.035em; margin: auto 0 18px; position: relative; z-index: 1; max-width: 620px; text-wrap: balance; }
.login-hero h1 em { font-style: normal; color: #ff4d59; }
.login-hero p { max-width: 460px; opacity: .78; font-size: 15px; position: relative; z-index: 1; margin: 0 0 26px; }
.lh-feats { display: flex; flex-direction: column; gap: 10px; position: relative; z-index: 1; }
.lh-feats div { display: flex; align-items: center; gap: 10px; font-size: 13.5px; opacity: .88; }
.lh-feats .ic { color: #ff4d59; }
.login-side { display: flex; align-items: center; justify-content: center; padding: 32px 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 34px 32px; box-shadow: var(--shadow); }
.login-card h2 { font-size: 23px; font-weight: 750; text-align: center; }
.login-card .lc-sub { text-align: center; color: var(--muted); font-size: 13.5px; margin: 6px 0 24px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn { width: 100%; height: 42px; margin-top: 6px; }
.llave-pasos { margin-top: 18px; display: grid; gap: 10px; }
.llave-pasos > div { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); line-height: 1.45; }
.llave-pasos svg { flex: none; margin-top: 2px; color: var(--primary); }
.login-card .btn svg { margin-right: 4px; }
.login-foot { font-size: 12px; color: var(--muted); text-align: center; margin-top: 20px; }
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 40px; }
.pass-wrap button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: none; background: none; color: var(--muted); cursor: pointer; border-radius: 7px; display: flex; align-items: center; justify-content: center; }
.pass-wrap button:hover { color: var(--text); background: var(--surface-2); }

/* ==========================================================================
   Pantallas estrechas
   ========================================================================== */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid, .dash-grid.even { grid-template-columns: 1fr; }
  .filters-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .login-body { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .settings { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
}
@media (max-width: 720px) {
  :root { --rail-w: 0px; }
  .app, .app.pinned { padding: 8px 8px 72px; }
  .rail { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto !important; height: 58px; flex-direction: row; padding: 6px; }
  .rail-top, .rail-label, .rail-sep, .rail-foot { display: none; }
  .rail-nav { flex-direction: row; justify-content: space-around; overflow-x: auto; }
  .nav-item { padding: 0 12px; }
  .nav-item .nav-txt { display: none; }
  .topbar { top: 8px; padding: 0 8px; }
  .search-btn { width: auto; flex: 1; }
  .search-btn .kbd, .user-btn .ub-text, .work-badge { display: none; }
  .page { padding: 20px 16px 40px; }
  .page-head h1 { font-size: 23px; }
  .kpis { grid-template-columns: 1fr; }
  .filters-grid, .info-grid { grid-template-columns: 1fr; }
  .info-grid .span2 { grid-column: auto; }
  .sheet-overlay { padding: 0; }
  .sheet { border-radius: 0; }
  .sh-row { flex-wrap: wrap; }
}

/* Las acciones de la tabla siempre a la vista, aunque la tabla no quepa a lo ancho */
table.dt th:last-child, table.dt td:last-child { position: sticky; right: 0; background: var(--surface); box-shadow: -8px 0 12px -10px rgba(16,16,22,.25); }
table.dt th:last-child { background: var(--surface); z-index: 2; }
table.dt tbody tr:hover td:last-child { background: var(--surface-2); }

/* Acceso: enlaces, barra de fuerza de la contraseña y pie */
.lk { color: var(--primary); text-decoration: none; font-weight: 550; font-size: 12.5px; }
.lk:hover { text-decoration: underline; }
.fuerza { height: 4px; background: var(--surface-3); border-radius: 999px; margin-top: 8px; overflow: hidden; }
.fuerza i { display: block; height: 100%; width: 0; border-radius: 999px; transition: width .2s, background .2s; }
.login-lock { font-size: 11.5px; color: var(--muted); text-align: center; margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.login-card .login-foot { margin-top: 16px; }

/* Lista de documentación de una licitación */
.doc-list { display: flex; flex-direction: column; }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border-soft); }
.doc-row:last-child { border-bottom: none; }
.doc-row .icon-btn { width: 28px; height: 28px; margin-left: auto; opacity: .5; }
.doc-row:hover .icon-btn { opacity: 1; }
.doc-check { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid #c4c4cc; background: var(--surface); cursor: pointer; display: flex; align-items: center; justify-content: center; color: #fff; flex: none; padding: 0; }
.doc-check.on { background: var(--ok); border-color: var(--ok); }
.doc-n { font-size: 13px; color: var(--text); }
.doc-n.hecho { color: var(--muted); text-decoration: line-through; }
.sh-actions #sh-resp { max-width: 160px; }

/* Ordenar columnas: icono 'selector' de Tabler, resaltado el activo */
table.dt th .ic.on { color: var(--primary); }
.tab-group .tg-label .ic { width: 16px; height: 16px; margin-right: 2px; }
.work-badge .ic { color: var(--primary); }
.work-badge .work-dot { display: none; }

/* Documentación de Linzex agrupada por categorías */
.kb-grupo { margin-bottom: 14px; }
.kb-grupo-h { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; padding: 8px 0 4px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.kb-grupo-h .muted { font-size: 12px; }
.kb-grupo .trash-row { flex-wrap: wrap; }
.kb-grupo .trash-info { flex: 1 1 220px; min-width: 0; }
.kb-grupo .trash-row select { flex: 0 1 220px; min-width: 150px; }
