
:root {
  --bg: #06111e;
  --panel: #101d30;
  --panel2: #13243a;
  --text: #f4f7fb;
  --muted: #a9bdd6;
  --line: rgba(255,255,255,.13);
  --blue: #38bdf8;
  --green: #22c55e;
  --yellow: #facc15;
  --red: #ef4444;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(135deg,#06111e,#0b1a2d 55%,#07111f);
  color: var(--text);
}
.topbar, .container { max-width: 1380px; margin: 0 auto; }
.topbar {
  padding: 28px 22px 14px;
  display:flex; align-items:center; justify-content:space-between; gap:18px;
}
.eyebrow { color: var(--blue); font-weight:900; letter-spacing:.16em; font-size:12px; text-transform:uppercase; }
h1 { margin: 8px 0 6px; font-size: clamp(30px,4vw,48px); line-height:1; }
h2 { margin: 0 0 4px; }
p { margin: 0; color: var(--muted); }
.badge {
  border:1px solid var(--line); border-radius:999px; padding:12px 18px;
  background:rgba(255,255,255,.08); color:var(--blue); font-weight:900; white-space:nowrap;
}
.container { padding: 16px 22px 50px; }
.panel, .group-card {
  background: rgba(16,29,48,.92);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 24px 80px rgba(0,0,0,.24);
}
.panel { padding: 18px; margin-bottom: 14px; }
.toolbar, .panel-head { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; }
.actions { display:flex; gap:9px; flex-wrap:wrap; justify-content:flex-end; }
button {
  border:0; border-radius:14px; padding:12px 14px;
  font-weight:900; cursor:pointer;
  color:#041523; background:linear-gradient(180deg,#38bdf8,#0ea5e9);
  box-shadow:0 12px 24px rgba(14,165,233,.22);
}
button.ghost { background:#e8eef7; color:#0b1626; box-shadow:none; }
.filters { display:grid; grid-template-columns: 2fr 1fr; gap:12px; align-items:end; }
.filters.one { grid-template-columns: 1fr; }
.hint { font-size:13px; color:var(--muted); }
.settings-grid, .form-grid { display:grid; grid-template-columns: repeat(2,1fr); gap:12px; margin-top:12px; }
label { color:var(--muted); font-size:12px; font-weight:900; text-transform:uppercase; letter-spacing:.04em; }
input, select {
  width:100%; margin-top:6px; padding:12px;
  border-radius:12px; border:1px solid var(--line);
  background:rgba(255,255,255,.08); color:var(--text); outline:none;
}
select option { background:#0b1626; color:#fff; }
.groups { display:flex; flex-direction:column; gap:14px; margin-bottom:16px; }
.group-card { overflow:hidden; }
.group-card > summary {
  list-style:none;
  cursor:pointer;
  padding:18px;
  display:flex; justify-content:space-between; align-items:center; gap:14px;
  background:linear-gradient(90deg,rgba(56,189,248,.16),rgba(255,255,255,.03));
}
.group-card > summary::-webkit-details-marker { display:none; }
.group-title { display:flex; flex-direction:column; gap:4px; }
.group-title strong { font-size:24px; letter-spacing:.02em; }
.group-title span { color:var(--muted); font-size:13px; }
.group-badges { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.pill {
  border-radius:999px; padding:7px 10px; font-weight:900; font-size:12px;
  border:1px solid var(--line); background:rgba(255,255,255,.08);
}
.pill.red { color:#fecaca; background:rgba(239,68,68,.18); }
.pill.yellow { color:#fde68a; background:rgba(250,204,21,.18); }
.pill.green { color:#bbf7d0; background:rgba(34,197,94,.18); }
.subgroups { padding: 14px 18px 18px; display:flex; flex-direction:column; gap:12px; }
.subgroup {
  border:1px solid var(--line);
  border-radius:16px;
  overflow:hidden;
  background: rgba(255,255,255,.035);
}
.subgroup summary {
  list-style:none; cursor:pointer;
  padding:12px 14px; background:rgba(255,255,255,.06);
  display:flex; align-items:center; justify-content:space-between; gap:10px;
}
.subgroup summary::-webkit-details-marker { display:none; }
.subgroup-name { font-weight:900; color:#d9e8fb; }
.table-wrap { overflow:auto; }
table { width:100%; min-width:940px; border-collapse:collapse; }
th, td { padding:10px 12px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; }
th { font-size:12px; text-transform:uppercase; letter-spacing:.04em; color:#c9daf0; background:#14253d; position:sticky; top:0; z-index:1; }
td { font-size:14px; }
.tag { border-radius:999px; padding:5px 9px; font-weight:900; font-size:12px; display:inline-block; }
.tag.VIGENTE { background:rgba(34,197,94,.18); color:#86efac; }
.tag.POR\ VENCER, .tag.POR_VENCER { background:rgba(250,204,21,.18); color:#fde68a; }
.tag.VENCIDO { background:rgba(239,68,68,.18); color:#fecaca; }
.row-actions button { padding:8px 10px; border-radius:10px; font-size:12px; }
.modal {
  position:fixed; inset:0; background:rgba(0,0,0,.68);
  display:grid; place-items:center; padding:18px; z-index:50;
}
.modal[hidden] { display:none; }
.modal-card {
  width:min(760px,100%); background:#0e1b2d; border:1px solid var(--line);
  border-radius:24px; padding:22px; position:relative; box-shadow:0 30px 90px rgba(0,0,0,.5);
}
.modal-card.wide { width:min(940px,100%); }
.x {
  position:absolute; right:14px; top:14px; width:36px; height:36px; padding:0;
  background:rgba(255,255,255,.1); color:white; box-shadow:none; border-radius:50%; font-size:24px;
}
.checks { display:flex; gap:18px; flex-wrap:wrap; margin:14px 0; }
.checks label { text-transform:none; letter-spacing:0; color:var(--text); font-size:14px; }
.checks input { width:auto; margin-right:6px; }
.modal-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:14px; }
@media(max-width:860px) {
  .toolbar,.panel-head,.topbar { flex-direction:column; align-items:flex-start; }
  .filters,.settings-grid,.form-grid { grid-template-columns:1fr; }
  .group-card > summary { flex-direction:column; align-items:flex-start; }
}

.status-pill {
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 900;
  font-size: 12px;
  border: 1px solid var(--line);
  box-shadow: none;
  cursor: pointer;
}
.status-pill.red { color:#fecaca; background:rgba(239,68,68,.18); }
.status-pill.yellow { color:#fde68a; background:rgba(250,204,21,.18); }
.status-pill.green { color:#bbf7d0; background:rgba(34,197,94,.18); }
.status-pill.disabled {
  opacity: .55;
  cursor: not-allowed;
  filter: grayscale(.25);
}
.status-pill.active {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.direct-table {
  padding: 14px 18px 18px;
}

.modal-note {
  margin: 6px 0 14px;
  color: var(--muted);
  font-weight: 700;
}
.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.row-actions button {
  white-space: nowrap;
}


/* V9 - Temas visuales corregidos */
.right-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}
.theme-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.theme-btn {
  padding: 9px 12px;
  border-radius: 999px;
  font-size: 12px;
  box-shadow: none;
  border: 1px solid rgba(255,255,255,.32);
  background: #172033;
  color: #f8fafc;
}
.theme-btn.vivid {
  background: linear-gradient(180deg, #22d3ee, #2563eb);
  color: #ffffff;
}
.theme-btn.night {
  background: linear-gradient(180deg, #92400e, #451a03);
  color: #ffedd5;
}

/* Colores vivos: más vivos, pero NO claros */
body.theme-vivid {
  --bg: #06111f;
  --panel: #0b1f3a;
  --panel2: #102a4a;
  --text: #f8fbff;
  --muted: #b9d7f5;
  --line: rgba(125, 211, 252, .24);
  --blue: #22d3ee;
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #fb7185;
  background:
    radial-gradient(circle at 15% 0%, rgba(34,211,238,.28), transparent 32%),
    radial-gradient(circle at 85% 10%, rgba(168,85,247,.22), transparent 30%),
    linear-gradient(135deg, #06111f, #08203b 55%, #111827);
}
body.theme-vivid .panel,
body.theme-vivid .group-card,
body.theme-vivid .modal-card {
  background: rgba(11,31,58,.96);
  color: var(--text);
}
body.theme-vivid .group-card > summary {
  background: linear-gradient(90deg, rgba(34,211,238,.20), rgba(168,85,247,.14));
}
body.theme-vivid .subgroup,
body.theme-vivid .table-wrap {
  background: rgba(16,42,74,.72);
}
body.theme-vivid .subgroup summary {
  background: rgba(34,211,238,.08);
}
body.theme-vivid th {
  background: #0e3058;
  color: #e0f2fe;
}
body.theme-vivid td {
  color: #f8fbff;
}
body.theme-vivid input,
body.theme-vivid select {
  background: rgba(255,255,255,.08);
  color: #f8fbff;
  border-color: rgba(125,211,252,.28);
}
body.theme-vivid select option {
  background: #0b1f3a;
  color: #f8fbff;
}
body.theme-vivid button:not(.theme-btn):not(.ghost):not(.status-pill) {
  background: linear-gradient(180deg, #22d3ee, #2563eb);
  color: #ffffff;
}
body.theme-vivid button.ghost {
  background: #e0f2fe;
  color: #082f49;
}
body.theme-vivid .status-pill.red,
body.theme-vivid .pill.red {
  color: #ffe4e6;
  background: rgba(244,63,94,.26);
}
body.theme-vivid .status-pill.yellow,
body.theme-vivid .pill.yellow {
  color: #fef3c7;
  background: rgba(245,158,11,.25);
}
body.theme-vivid .status-pill.green,
body.theme-vivid .pill.green {
  color: #dcfce7;
  background: rgba(34,197,94,.25);
}

/* Protección noche: oscuro, cálido, baja luz azul, menos brillo */
body.theme-night {
  --bg: #070604;
  --panel: #0e0b08;
  --panel2: #15100b;
  --text: #eadfc8;
  --muted: #b9a98a;
  --line: rgba(245, 158, 11, .16);
  --blue: #d97706;
  --green: #84cc16;
  --yellow: #ca8a04;
  --red: #dc2626;
  background:
    radial-gradient(circle at 20% 0%, rgba(120,53,15,.16), transparent 35%),
    linear-gradient(135deg, #050403, #0b0705 55%, #100906);
}
body.theme-night .panel,
body.theme-night .group-card,
body.theme-night .modal-card {
  background: rgba(14,11,8,.96);
  color: var(--text);
  box-shadow: 0 18px 54px rgba(0,0,0,.45);
}
body.theme-night .group-card > summary {
  background: linear-gradient(90deg, rgba(120,53,15,.20), rgba(22,15,10,.45));
}
body.theme-night .subgroup,
body.theme-night .table-wrap {
  background: rgba(21,16,11,.78);
}
body.theme-night .subgroup summary {
  background: rgba(245,158,11,.08);
}
body.theme-night th {
  background: #17100a;
  color: #f3d6a3;
}
body.theme-night td {
  color: #eadfc8;
}
body.theme-night input,
body.theme-night select {
  background: rgba(0,0,0,.32);
  color: #eadfc8;
  border-color: rgba(245,158,11,.18);
}
body.theme-night select option {
  background: #0e0b08;
  color: #eadfc8;
}
body.theme-night button:not(.theme-btn):not(.ghost):not(.status-pill) {
  background: linear-gradient(180deg, #b45309, #78350f);
  color: #fff7ed;
  box-shadow: 0 8px 18px rgba(0,0,0,.24);
}
body.theme-night button.ghost {
  background: #2b2118;
  color: #ffedd5;
  border: 1px solid rgba(245,158,11,.20);
}
body.theme-night .tag.VIGENTE,
body.theme-night .status-pill.green,
body.theme-night .pill.green {
  background: rgba(77,124,15,.28);
  color: #d9f99d;
}
body.theme-night .tag.VENCIDO,
body.theme-night .status-pill.red,
body.theme-night .pill.red {
  background: rgba(153,27,27,.32);
  color: #fecaca;
}
body.theme-night .tag.POR\ VENCER,
body.theme-night .tag.POR_VENCER,
body.theme-night .status-pill.yellow,
body.theme-night .pill.yellow {
  background: rgba(146,64,14,.34);
  color: #fed7aa;
}
body.theme-night .status-pill.active {
  outline-color: #fbbf24;
}
@media(max-width:860px) {
  .right-head { align-items:flex-start; }
  .theme-controls { justify-content:flex-start; }
}

/* V10 - colores fijos y distintos para estados en TODOS los temas */
.status-pill.red,
.pill.red,
body.theme-vivid .status-pill.red,
body.theme-vivid .pill.red,
body.theme-night .status-pill.red,
body.theme-night .pill.red {
  background: rgba(220, 38, 38, .30) !important;
  color: #fecaca !important;
  border-color: rgba(248, 113, 113, .45) !important;
}

.status-pill.yellow,
.pill.yellow,
body.theme-vivid .status-pill.yellow,
body.theme-vivid .pill.yellow,
body.theme-night .status-pill.yellow,
body.theme-night .pill.yellow {
  background: rgba(202, 138, 4, .32) !important;
  color: #fde68a !important;
  border-color: rgba(250, 204, 21, .45) !important;
}

.status-pill.green,
.pill.green,
body.theme-vivid .status-pill.green,
body.theme-vivid .pill.green,
body.theme-night .status-pill.green,
body.theme-night .pill.green {
  background: rgba(22, 163, 74, .30) !important;
  color: #bbf7d0 !important;
  border-color: rgba(74, 222, 128, .45) !important;
}

.status-pill.disabled {
  opacity: .70 !important;
  cursor: not-allowed !important;
  filter: saturate(.75) brightness(.82) !important;
}

.status-pill.active {
  outline: 2px solid #ffffff !important;
  outline-offset: 2px !important;
}
body.theme-night .status-pill.active {
  outline-color: #fbbf24 !important;
}

/* Protección noche más cercana a pantallas: bajo azul, cálido y poco brillo */
body.theme-night {
  --text: #eadfc8;
  --muted: #bcae90;
  background:
    radial-gradient(circle at 20% 0%, rgba(92, 39, 9, .14), transparent 35%),
    linear-gradient(135deg, #030201, #090604 55%, #0d0704) !important;
}
body.theme-night .group-card,
body.theme-night .panel,
body.theme-night .modal-card {
  background: rgba(10, 7, 5, .96) !important;
}
body.theme-night .group-card > summary {
  background: linear-gradient(90deg, rgba(73, 32, 9, .25), rgba(10, 7, 5, .50)) !important;
}
body.theme-night .theme-btn.night {
  background: linear-gradient(180deg, #78350f, #3b1607) !important;
}

/* V11 - Una sola acción por fila */
.action-select {
  min-width: 118px;
  padding: 8px 10px;
  margin: 0;
  border-radius: 12px;
  font-weight: 900;
  cursor: pointer;
}
.row-actions {
  display: table-cell;
}

/* V12 - diferenciar grupo principal vs sub-cuadros */
.subgroup {
  border-left: 5px solid rgba(56, 189, 248, .65);
}
.subgroup summary {
  padding-top: 14px;
  padding-bottom: 14px;
}
.subgroup-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.subgroup-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  font-weight: 900;
}
.subgroup-name {
  font-size: 17px;
}
body.theme-night .subgroup {
  border-left-color: rgba(245, 158, 11, .65);
}
body.theme-vivid .subgroup {
  border-left-color: rgba(34, 211, 238, .85);
}


/* V14 - logo en encabezado y subgrupos más diferenciados */
.hero-block{flex:1;min-width:0}
.title-row{display:flex;align-items:center;gap:20px;justify-content:space-between;flex-wrap:wrap}
.title-text{min-width:280px;flex:1}
.header-logo{width:155px;height:auto;max-width:100%;object-fit:contain;object-position:center;background:transparent;padding:0;border:0;border-radius:0;box-shadow:none;display:block;filter:none;}
.subgroups{padding-top:16px}
.subgroup{
  border:1px solid rgba(255,255,255,.14);
  border-left:6px solid rgba(56,189,248,.9);
  border-radius:18px;
  background:linear-gradient(180deg, rgba(25,42,66,.95), rgba(17,31,49,.95));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05), 0 14px 28px rgba(0,0,0,.18);
}
.subgroup summary{
  background:linear-gradient(90deg, rgba(78,163,255,.18), rgba(255,255,255,.06));
  padding:14px 16px;
}
.subgroup-name{font-size:18px;color:#f3f8ff;letter-spacing:.02em}
.subgroup table th{background:#19324d}
.subgroup .table-wrap{background:rgba(9,18,31,.18)}
body.theme-vivid .subgroup{
  border-color: rgba(125,211,252,.20);
  border-left-color: rgba(34,211,238,.95);
  background: linear-gradient(180deg, rgba(12,42,78,.96), rgba(11,31,58,.96));
}
body.theme-vivid .subgroup summary{
  background: linear-gradient(90deg, rgba(34,211,238,.18), rgba(168,85,247,.12));
}
body.theme-vivid .subgroup table th{background:#11406d}
body.theme-night .subgroup{
  border-color: rgba(245,158,11,.18);
  border-left-color: rgba(245,158,11,.88);
  background: linear-gradient(180deg, rgba(30,16,7,.96), rgba(18,10,5,.96));
}
body.theme-night .subgroup summary{
  background: linear-gradient(90deg, rgba(180,83,9,.22), rgba(33,18,8,.42));
}
body.theme-night .subgroup-name{color:#fff1d6}
body.theme-night .subgroup table th{background:#24150b}
@media(max-width:860px){
  .header-logo{width:118px;height:auto;padding:0;border:0;border-radius:0;box-shadow:none;background:transparent;filter:none;}
  .title-row{align-items:flex-start}
}


/* V15 - versión más clara, fina y uniforme */
body:not(.theme-vivid):not(.theme-night) {
  --bg: #123052;
  --panel: #183a5d;
  --panel2: #214870;
  --text: #f7fbff;
  --muted: #d6e4f4;
  --line: rgba(255,255,255,.18);
  --blue: #46c7ff;
  --green: #22c55e;
  --yellow: #fbbf24;
  --red: #ef4444;
  background:
    radial-gradient(circle at 14% 0%, rgba(103, 214, 255, .16), transparent 32%),
    radial-gradient(circle at 92% 10%, rgba(59, 130, 246, .14), transparent 26%),
    linear-gradient(135deg, #0d2947, #163a62 54%, #173556 100%) !important;
}
body:not(.theme-vivid):not(.theme-night) .eyebrow { color: #63d3ff; }
body:not(.theme-vivid):not(.theme-night) p,
body:not(.theme-vivid):not(.theme-night) .hint,
body:not(.theme-vivid):not(.theme-night) .modal-note,
body:not(.theme-vivid):not(.theme-night) .group-title span,
body:not(.theme-vivid):not(.theme-night) .subgroup-label,
body:not(.theme-vivid):not(.theme-night) label {
  color: #d5e3f2;
}
body:not(.theme-vivid):not(.theme-night) .badge {
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.05));
  border-color: rgba(147,197,253,.24);
  color: #46c7ff;
  box-shadow: 0 10px 24px rgba(5, 17, 32, .18);
}
body:not(.theme-vivid):not(.theme-night) .panel,
body:not(.theme-vivid):not(.theme-night) .group-card,
body:not(.theme-vivid):not(.theme-night) .modal-card {
  background: linear-gradient(180deg, rgba(22,48,76,.92), rgba(18,41,66,.92)) !important;
  border-color: rgba(255,255,255,.16) !important;
  box-shadow: 0 18px 44px rgba(7, 20, 37, .18) !important;
}
body:not(.theme-vivid):not(.theme-night) .group-card > summary {
  background: linear-gradient(90deg, rgba(70,199,255,.20), rgba(255,255,255,.07)) !important;
}
body:not(.theme-vivid):not(.theme-night) .subgroup {
  border-color: rgba(255,255,255,.16) !important;
  border-left-color: rgba(70,199,255,.92) !important;
  background: linear-gradient(180deg, rgba(31,63,97,.92), rgba(23,49,79,.92)) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 10px 24px rgba(7, 20, 37, .16) !important;
}
body:not(.theme-vivid):not(.theme-night) .subgroup summary {
  background: linear-gradient(90deg, rgba(99,211,255,.16), rgba(255,255,255,.07)) !important;
}
body:not(.theme-vivid):not(.theme-night) .table-wrap,
body:not(.theme-vivid):not(.theme-night) .subgroup .table-wrap {
  background: rgba(255,255,255,.02) !important;
}
body:not(.theme-vivid):not(.theme-night) th {
  background: #28507b !important;
  color: #eef8ff !important;
}
body:not(.theme-vivid):not(.theme-night) td,
body:not(.theme-vivid):not(.theme-night) .checks label {
  color: #f4f9ff !important;
}
body:not(.theme-vivid):not(.theme-night) input,
body:not(.theme-vivid):not(.theme-night) select {
  background: rgba(255,255,255,.11) !important;
  color: #f7fbff !important;
  border-color: rgba(255,255,255,.16) !important;
}
body:not(.theme-vivid):not(.theme-night) input::placeholder {
  color: #b9cee2;
}
body:not(.theme-vivid):not(.theme-night) select option {
  background: #173556;
  color: #f7fbff;
}
body:not(.theme-vivid):not(.theme-night) button:not(.theme-btn):not(.ghost):not(.status-pill) {
  background: linear-gradient(180deg, #4fd2ff, #1fa8ec) !important;
  color: #08304f !important;
  box-shadow: 0 10px 22px rgba(31, 168, 236, .22) !important;
}
body:not(.theme-vivid):not(.theme-night) button.ghost {
  background: linear-gradient(180deg, #f8fbff, #dde8f4) !important;
  color: #123a5d !important;
  border: 1px solid rgba(16, 58, 93, .10) !important;
  box-shadow: 0 8px 18px rgba(7, 20, 37, .08) !important;
}
body:not(.theme-vivid):not(.theme-night) .theme-btn {
  background: rgba(26, 49, 79, .82);
  color: #f8fbff;
  border-color: rgba(255,255,255,.18);
}
body:not(.theme-vivid):not(.theme-night) .theme-btn.vivid {
  background: linear-gradient(180deg, #49d8ff, #2b7df4);
}
body:not(.theme-vivid):not(.theme-night) .theme-btn.night {
  background: linear-gradient(180deg, #b7651e, #7d3409);
}
body:not(.theme-vivid):not(.theme-night) .x {
  background: rgba(255,255,255,.12) !important;
  color: #ffffff !important;
}
body:not(.theme-vivid):not(.theme-night) .subgroup-name,
body:not(.theme-vivid):not(.theme-night) .group-title strong,
body:not(.theme-vivid):not(.theme-night) h2 {
  color: #ffffff;
}
/* Logo: más pequeño y más delicado */
.header-logo {
  width: 136px !important;
}
@media(max-width:860px){
  .header-logo {
    width: 104px !important;
  }
}
