/* ===== componentes reutilizables ===== */

/* --- cabecera de página --- */
.phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 10px 0 22px; }
.phead__eyebrow { font-size: 13.5px; color: var(--text-2); margin-bottom: 2px; }
.phead h1 { font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -.02em; }
.phead__sub { margin-top: 6px; color: var(--text-2); font-size: 14px; max-width: 760px; }
.phead__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* --- tarjetas --- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow);
  transition: transform .25s var(--ease), border-color .25s, box-shadow .25s; min-width: 0;
}
.card--flush { padding: 0; overflow: hidden; }
.card--hover:hover, a.card:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: var(--shadow-lg); }
.card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.card--flush .card__head { padding: 20px 20px 0; }
.card__title { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.card__sub { color: var(--text-3); font-size: 12.5px; margin-top: 3px; }
.card__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* --- KPI --- */
.kpi {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 18px 18px 16px; border-radius: var(--r-lg); min-height: 150px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden;
  transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
}
.kpi:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--shadow-lg); }
.kpi__top { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.kpi__value { font-size: 32px; line-height: 1.1; font-weight: 600; letter-spacing: -.02em; }
.kpi__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.kpi__hint { font-size: 12px; color: var(--text-3); }
.kpi__meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; margin-top: auto; opacity: .95; }
.kpi__bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .28); overflow: hidden; }
.kpi__bar i { display: block; height: 100%; width: var(--w); background: #fff; border-radius: 6px; animation: fillW 1.1s var(--ease) .3s both; }
@keyframes fillW { from { width: 0; } }
.kpi--feat { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, .25); }
.kpi--feat::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(120% 90% at 100% 0, rgba(255, 255, 255, .22), transparent 55%); }
.kpi--feat .kpi__top { color: rgba(255, 255, 255, .88); }
.kpi--feat:hover { box-shadow: 0 16px 44px -10px rgba(255, 122, 0, .6); border-color: transparent; }
.delta { display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.delta--up { background: var(--ok-bg); color: var(--ok-t); }
.delta--down { background: var(--danger-bg); color: var(--danger-t); }
.delta--glass { background: rgba(0, 0, 0, .2); color: #fff; }
.spark { display: block; overflow: visible; }
.spark__line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.2s var(--ease) .3s forwards; }
.spark__area { opacity: .12; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* --- insignias --- */
.badge { display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.bdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--muted { background: var(--surface-3); color: var(--text-2); }
.badge--ok { background: var(--ok-bg); color: var(--ok-t); }
.badge--warn { background: var(--warn-bg); color: var(--warn-t); }
.badge--danger { background: var(--danger-bg); color: var(--danger-t); }
.badge--info { background: var(--info-bg); color: var(--info-t); }
.badge--accent { background: var(--accent-bg); color: var(--accent-t); }

/* --- botones --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px;
  font-weight: 600; font-size: 13.5px; white-space: nowrap; border: 1px solid transparent; transition: transform .18s var(--ease), box-shadow .2s, background .2s, border-color .2s, opacity .2s;
  position: relative;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .5; }
.btn--sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; }
.btn--lg { height: 48px; padding: 0 22px; font-size: 14.5px; border-radius: 14px; }
.btn--primary { background: var(--grad); color: #fff; box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, .28); }
.btn--primary:hover:not(:disabled) { box-shadow: 0 12px 34px -8px rgba(255, 122, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .28); transform: translateY(-1px); filter: brightness(1.05); }
.btn--secondary { background: var(--surface-2); border-color: var(--line-2); color: var(--text); }
.btn--secondary:hover:not(:disabled) { background: var(--surface-3); }
.btn--ghost { color: var(--text-2); }
.btn--ghost:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.btn--danger { background: var(--danger-bg); color: var(--danger-t); border-color: rgba(239, 68, 68, .3); }
.btn--danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn kbd { background: rgba(0, 0, 0, .22); border-color: transparent; color: inherit; }
.btn__t { display: inline-flex; align-items: center; gap: 6px; }
.spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }

/* --- pestañas, segmentado, chips --- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 12px 12px; color: var(--text-2); font-weight: 500; white-space: nowrap; transition: color .2s; }
.tab:hover { color: var(--text); }
.tab::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--grad); transform: scaleX(0); transition: transform .3s var(--ease); }
.tab.is-active { color: var(--text); font-weight: 600; }
.tab.is-active::after { transform: scaleX(1); }
.count { font-size: 11px; font-weight: 700; min-width: 22px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.tab.is-active .count { background: var(--accent-bg); color: var(--accent-t); }
.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.seg__b { height: 30px; padding: 0 14px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--text-2); transition: .2s var(--ease); }
.seg__b:hover { color: var(--text); }
.seg__b.is-active { background: #F5F5F4; color: #0B0B0C; font-weight: 600; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
:root[data-theme="light"] .seg__b.is-active, .force-light .seg__b.is-active { background: #0B0B0C; color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 11px; font-size: 13px; font-weight: 500; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); transition: .2s var(--ease); }
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip.is-active { background: var(--grad); color: #fff; border-color: transparent; font-weight: 600; box-shadow: var(--glow); }
.chip.is-active .chip__dot { background: #fff !important; }
.chip__dot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; flex: none; }

/* --- formularios --- */
input, select, textarea { font: inherit; color: inherit; }
.inp, .field input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), .field select, .field textarea, .filters input, .filters select, .inp-box {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 11px; background: var(--input); border: 1px solid var(--line-2); color: var(--text);
  transition: border-color .2s, box-shadow .2s; outline: none;
}
.field textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.inp:focus, .field input:focus, .field select:focus, .field textarea:focus, .filters input:focus, .filters select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 122, 0, .18); }
.field input:disabled, .field select:disabled { opacity: .55; }
input[type=color] { width: 44px; height: 40px; padding: 3px; border-radius: 11px; background: var(--input); border: 1px solid var(--line-2); cursor: pointer; }
input[type=checkbox] { accent-color: var(--accent); width: 17px; height: 17px; }
input[type=range] { accent-color: var(--accent); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239B9BA4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px !important; }
select option { background: var(--surface-2); color: var(--text); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field__hint { color: var(--text-3); font-size: 11.5px; }
.field--flag > .inp, .field--flag input, .field--flag select { border-color: rgba(239, 68, 68, .55) !important; background: var(--danger-bg) !important; }
.flag { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.flag--bad { background: var(--danger-bg); color: var(--danger-t); }
.flag--warn { background: var(--warn-bg); color: var(--warn-t); }
.num { position: relative; display: block; }
.num em { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 12px; color: var(--text-3); pointer-events: none; }
.num .inp { padding-right: 56px; }
.num input::-webkit-outer-spin-button, .num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num input { -moz-appearance: textfield; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-sec { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin: 22px 0 12px; display: flex; align-items: center; gap: 10px; }
.form-sec:first-child { margin-top: 0; }
.form-sec::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.toggle { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-2); transition: .25s var(--ease); flex: none; }
.toggle i { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); transition: transform .25s var(--ease); }
.toggle.is-on { background: var(--grad); border-color: transparent; }
.toggle.is-on i { transform: translateX(18px); }
.toggle:disabled { opacity: .5; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: 0; }
.switch-row strong { display: block; font-size: 13.5px; font-weight: 600; }
.switch-row small { color: var(--text-3); font-size: 12px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 18px 0 14px; }
.filters .field-search { position: relative; flex: 1 1 260px; max-width: 380px; }
.filters .field-search .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.filters .field-search input { padding-left: 38px; }
.filters select { width: auto; min-width: 150px; }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check-row--box { align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.check-row--box input { margin-top: 2px; }

/* --- tablas --- */
.tbl-wrap { overflow: auto; max-width: 100%; border-radius: var(--r-md); }
.card--flush .tbl-wrap { border-radius: 0; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th {
  position: sticky; top: 0; z-index: 1; text-align: left; padding: 12px 16px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3); background: var(--surface); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr { transition: background .15s; animation: fadeIn .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 25ms); }
.tbl tbody tr:hover { background: var(--hover); }
.tbl tbody tr.is-click { cursor: pointer; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl .nowrap { white-space: nowrap; }
.tbl .muted, .muted { color: var(--text-3); }
.tbl .strong { font-weight: 600; }
.tbl .code { font-weight: 700; letter-spacing: .02em; }
.tbl .sub { display: block; font-size: 12px; color: var(--text-3); }
.cell-user { display: flex; align-items: center; gap: 10px; }
.save { color: var(--ok-t); font-weight: 700; }
.save small { font-weight: 600; opacity: .85; margin-left: 4px; }
.row--nueva td:first-child { box-shadow: inset 3px 0 0 var(--ok); } .row--nueva { background: var(--ok-bg); }
.row--version td:first-child { box-shadow: inset 3px 0 0 var(--info); } .row--version { background: var(--info-bg); }
.row--error td:first-child { box-shadow: inset 3px 0 0 var(--danger); } .row--error { background: var(--danger-bg); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 13px; }
.pager__ctl { display: flex; align-items: center; gap: 8px; }
.pager__pg { min-width: 56px; text-align: center; color: var(--text-2); font-weight: 600; }

/* --- modal y cajón --- */
.overlay { position: fixed; inset: 0; z-index: 120; background: var(--overlay); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; animation: fadeIn .2s ease both; }
.overlay--drawer { place-items: stretch end; padding: 0; }
.overlay--top { place-items: start center; padding-top: 12vh; }
.modal {
  width: min(var(--w, 560px), 100%); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; background: var(--surface-2);
  border: 1px solid var(--line-2); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); animation: modalIn .32s var(--ease) both; outline: none;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
.modal__head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 4px; }
.modal__head h3 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.modal__body { padding: 12px 20px 20px; overflow: auto; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
.modal--welcome .modal__head { padding: 8px 12px 0; justify-content: flex-end; }
.modal--wide { }
.drawer {
  width: min(var(--w, 480px), 100%); height: 100dvh; display: flex; flex-direction: column; background: var(--surface-2); border-left: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg); animation: drawerIn .36s var(--ease) both; outline: none;
}
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 22px 22px 14px; border-bottom: 1px solid var(--line); }
.drawer__head h3 { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.drawer__head p { color: var(--text-3); font-size: 13px; margin-top: 3px; }
.drawer__body { padding: 20px 22px; overflow: auto; flex: 1; }
.drawer__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); }

/* --- estados vacíos, esqueletos, avatar --- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 44px 20px; color: var(--text-2); }
.empty h4 { font-size: 16px; color: var(--text); }
.empty p { max-width: 420px; font-size: 13.5px; }
.empty__ico { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--accent-t); margin-bottom: 6px; }
.empty--sm { padding: 24px 10px; }
.empty--page { margin: 12vh auto 0; }
.skel { border-radius: 10px; margin-bottom: 10px; background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 50%, var(--surface-2) 70%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.avatar {
  width: var(--sz, 32px); height: var(--sz, 32px); flex: none; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700;
  font-size: calc(var(--sz, 32px) * .38); color: #1a1208; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 82%, #fff), var(--c)); letter-spacing: -.02em;
}

/* --- confianza, pasos, tooltips --- */
.conf { display: flex; align-items: center; gap: 8px; }
.conf__bar { flex: 1; height: 5px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.conf__bar i { display: block; height: 100%; border-radius: 5px; animation: fillConf .9s var(--ease) both; }
@keyframes fillConf { from { width: 0 !important; } }
.conf__v { font-size: 11.5px; font-weight: 700; min-width: 38px; text-align: right; }
.conf--ok .conf__bar i { background: var(--ok); } .conf--ok .conf__v { color: var(--ok-t); }
.conf--warn .conf__bar i { background: var(--warn); } .conf--warn .conf__v { color: var(--warn-t); }
.conf--bad .conf__bar i { background: var(--danger); } .conf--bad .conf__v { color: var(--danger-t); }
.stepper { display: flex; align-items: center; gap: 0; margin: 4px 0 24px; overflow-x: auto; }
.step { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-weight: 500; white-space: nowrap; flex: 1; min-width: max-content; }
.step:last-child { flex: none; }
.step::after { content: ""; flex: 1; height: 2px; margin: 0 14px; border-radius: 2px; background: var(--line-2); min-width: 28px; }
.step:last-child::after { display: none; }
.step__n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line-2); transition: .3s var(--ease); }
.step--now { color: var(--text); font-weight: 600; }
.step--now .step__n { background: var(--grad); color: #fff; border-color: transparent; box-shadow: var(--glow); }
.step--done { color: var(--text-2); }
.step--done .step__n { background: var(--ok-bg); color: var(--ok-t); border-color: rgba(34, 197, 94, .35); }
.step--done::after { background: var(--ok); opacity: .6; }
.tip { position: relative; display: inline-flex; }
.tip::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translate(-50%, 4px); white-space: nowrap; pointer-events: none; z-index: 60;
  padding: 6px 10px; border-radius: 9px; background: var(--surface-3); border: 1px solid var(--line-2); font-size: 12px; font-weight: 500; opacity: 0; transition: .18s var(--ease); box-shadow: var(--shadow-lg);
}
.tip:hover::after { opacity: 1; transform: translate(-50%, 0); }

/* --- timeline --- */
.timeline { position: relative; display: flex; flex-direction: column; gap: 4px; }
.timeline li { position: relative; display: flex; gap: 14px; padding: 8px 0; }
.timeline li::before { content: ""; position: absolute; left: 15px; top: 36px; bottom: -8px; width: 1px; background: var(--line-2); }
.timeline li:last-child::before { display: none; }
.timeline__ico { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--accent-t); }
.timeline__t strong { font-size: 13.5px; font-weight: 600; display: block; }
.timeline__t p { font-size: 12.5px; color: var(--text-2); }
.timeline__t small { font-size: 11.5px; color: var(--text-3); }

/* --- gráficos --- */
.lolli { width: 100%; overflow-x: auto; }
.lolli__svg { width: 100%; min-width: 640px; height: auto; display: block; overflow: visible; }
.lolli__grid { stroke: var(--line); stroke-width: 1; }
.lolli__axis { fill: var(--text-3); font-size: 11.5px; font-family: var(--font); }
.lolli__x { fill: var(--text-3); font-size: 11.5px; font-family: var(--font); }
.lolli__x.is-last { fill: var(--accent-t); font-weight: 700; }
.lolli__target { stroke: #FF4D1A; stroke-width: 1.3; stroke-dasharray: 5 5; opacity: .85; }
.lolli__tag rect { fill: #FF4D1A; } .lolli__tag text { fill: #fff; font-size: 11px; font-weight: 700; font-family: var(--font); }
.lp__hit { fill: transparent; }
.lp__stem { transform-box: fill-box; transform-origin: 50% 100%; animation: stemUp .75s var(--ease) both; animation-delay: var(--d); }
@keyframes stemUp { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.lp__dot { animation: pop .4s var(--ease) both; animation-delay: calc(var(--d) + 420ms); transform-box: fill-box; transform-origin: center; }
.lp--beat .lp__dot { fill: #FF6B00; filter: drop-shadow(0 0 7px rgba(255, 107, 0, .8)); }
.lp--miss .lp__dot { fill: #3a3a42; stroke: #9CA3AF; stroke-width: 2; }
.lp--last .lp__dot { fill: #fff; stroke: none; filter: drop-shadow(0 0 7px rgba(255, 255, 255, .6)); }
:root[data-theme="light"] .lp--miss .lp__dot { fill: #fff; }
.lp__tip { opacity: 0; pointer-events: none; transition: opacity .15s; }
.lp__tip rect { fill: var(--surface-3); stroke: var(--line-2); }
.lp__tip .t1 { fill: var(--text-3); font-size: 11px; font-family: var(--font); } .lp__tip .t2 { fill: var(--text); font-size: 12.5px; font-weight: 700; font-family: var(--font); }
.lp:hover .lp__tip { opacity: 1; }
.lp:hover .lp__dot { transform: scale(1.25); }

.gauge { position: relative; width: var(--size, 200px); height: var(--size, 200px); margin: 0 auto; flex: none; }
.gauge svg { width: 100%; height: 100%; }
.gauge__t { stroke: var(--line-2); stroke-width: 2.6; stroke-linecap: round; }
.gauge__t.is-on { stroke: #FF6B00; animation: tickOn .4s var(--ease) both; animation-delay: var(--d); filter: drop-shadow(0 0 3px rgba(255, 107, 0, .7)); }
@keyframes tickOn { from { opacity: 0; transform: scale(.6); } to { opacity: 1; } }
.gauge__c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.gauge__v { font-size: 38px; font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.gauge__s { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.ring { position: relative; width: var(--sz, 48px); height: var(--sz, 48px); display: inline-grid; place-items: center; flex: none; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring__bg { fill: none; stroke: var(--surface-3); }
.ring__fg { fill: none; stroke: url(#ringGrad); stroke: #FF7A00; stroke-linecap: round; stroke-dasharray: var(--c); stroke-dashoffset: var(--o); animation: ringDraw 1.2s var(--ease) .2s both; filter: drop-shadow(0 0 4px rgba(255, 122, 0, .55)); }
@keyframes ringDraw { from { stroke-dashoffset: var(--c); } }
.ring__t { position: relative; font-size: 12px; font-weight: 700; } .ring__t small { font-size: 8px; opacity: .7; }

.barlist { display: flex; flex-direction: column; gap: 14px; }
.barlist li { animation: rise .45s var(--ease) both; animation-delay: var(--d); }
.barlist__row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 13px; }
.barlist__l { display: flex; align-items: center; gap: 8px; color: var(--text-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barlist__v { font-weight: 700; }
.barlist__track { height: 7px; border-radius: 7px; background: var(--surface-3); overflow: hidden; }
.barlist__track i { display: block; height: 100%; width: var(--w); border-radius: 7px; background: var(--bc, #FF7A00); background-image: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.22)); animation: growW 1s var(--ease) both; }
@keyframes growW { from { width: 0; } }
.hbar { display: flex; flex-direction: column; gap: 14px; }
.hbar__row { display: grid; grid-template-columns: 82px minmax(0, 1fr) 96px; align-items: center; gap: 14px; }
.hbar__l { color: var(--text-2); font-size: 13px; font-weight: 500; }
.hbar__track { height: 26px; border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.hbar__track i { display: block; height: 100%; width: var(--w); border-radius: 9px; animation: growW 1.1s var(--ease) both; }
.hbar__a { background: linear-gradient(90deg, #4b4b54, #7b7b86); }
.hbar__b { background: var(--grad); box-shadow: var(--glow); animation-delay: .25s !important; }
.hbar__v { font-weight: 700; text-align: right; } .hbar__v--hot { color: var(--accent-t); }
.hbar__note { display: flex; align-items: center; gap: 8px; color: var(--ok-t); font-size: 13px; font-weight: 600; }
.stack__head { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; color: var(--text-2); } .stack__head strong { color: var(--text); }
.stack__bar { display: flex; gap: 3px; height: 22px; }
.stack__bar i { display: block; height: 100%; border-radius: 6px; animation: growW .9s var(--ease) both; animation-delay: var(--d); }
.stack__legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px 16px; margin-top: 12px; }
.stack__legend li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.stack__legend li i { width: 8px; height: 8px; border-radius: 3px; flex: none; } .stack__legend li span { flex: 1; } .stack__legend b { color: var(--text); font-weight: 600; }
.donut { position: relative; display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 18px; align-items: center; }
.donut svg { width: 150px; height: 150px; }
.donut__seg { animation: donutIn .9s var(--ease) both; animation-delay: var(--d); }
@keyframes donutIn { from { opacity: 0; } }
.donut__c { position: absolute; left: 0; top: 0; width: 150px; height: 150px; display: grid; place-content: center; text-align: center; }
.donut__c strong { font-size: 20px; } .donut__c span { font-size: 11px; color: var(--text-3); }
.donut__legend { display: flex; flex-direction: column; gap: 8px; }
.donut__legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.donut__legend li i { width: 9px; height: 9px; border-radius: 3px; } .donut__legend li span { flex: 1; } .donut__legend b { color: var(--text); }

/* --- paleta de comandos --- */
.palette { width: min(640px, 100%); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 22px; box-shadow: var(--shadow-lg); overflow: hidden; animation: modalIn .25s var(--ease) both; }
.palette__in { display: flex; align-items: center; gap: 12px; padding: 0 18px; height: 60px; border-bottom: 1px solid var(--line); color: var(--text-3); }
.palette__input { flex: 1; height: 100%; background: none; border: 0; outline: none; color: var(--text); font-size: 15.5px; }
.palette__list { max-height: 52vh; overflow: auto; padding: 8px; }
.palette__grp { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); padding: 10px 12px 4px; }
.palette__row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 12px; text-align: left; }
.palette__row.is-active { background: var(--accent-bg); }
.palette__ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--accent-t); flex: none; }
.palette__t { flex: 1; display: flex; flex-direction: column; min-width: 0; } .palette__t small { color: var(--text-3); font-size: 12px; }
.palette__empty { padding: 20px; text-align: center; color: var(--text-3); }

/* --- visita guiada --- */
.tour { position: fixed; inset: 0; z-index: 500; }
.tour__shield { position: absolute; inset: 0; }
.tour__hole { position: fixed; border-radius: 18px; box-shadow: 0 0 0 9999px rgba(3, 3, 6, .74), 0 0 0 2px rgba(255, 122, 0, .9), 0 0 32px 4px rgba(255, 122, 0, .4); transition: all .45s var(--ease); pointer-events: none; opacity: 0; }
.tour__card {
  position: fixed; z-index: 2; width: 348px; max-width: calc(100vw - 24px); padding: 18px 18px 16px; border-radius: 20px; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); transition: left .45s var(--ease), top .45s var(--ease); animation: rise .35s var(--ease) both;
}
.tour__meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 600; color: var(--accent-t); }
.tour__x { font-size: 12px; color: var(--text-3); } .tour__x:hover { color: var(--text); }
.tour__dots { display: flex; gap: 4px; margin: 10px 0 12px; }
.tour__dots i { height: 3px; flex: 1; border-radius: 3px; background: var(--surface-3); } .tour__dots i.on { background: var(--grad); } .tour__dots i.done { background: rgba(255, 122, 0, .45); }
.tour__card h4 { font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 6px; }
.tour__card p { font-size: 13.5px; color: var(--text-2); line-height: 1.55; }
.tour__wait { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 12.5px; color: var(--text-3); }
.tour__act { display: flex; justify-content: space-between; margin-top: 16px; }
.welcome { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 0 8px 8px; }
.welcome .sun-hero { margin: 14px 0 10px; }
.welcome h2 { font-size: 23px; letter-spacing: -.02em; line-height: 1.2; }
.welcome p { color: var(--text-2); max-width: 400px; }
.welcome small { color: var(--text-3); }
.welcome__act { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

/* --- confeti --- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 600; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: confFall 2s ease-in forwards; }
@keyframes confFall { to { transform: translate(var(--dx), 105vh) rotate(var(--r)); opacity: .9; } }

/* --- iframes y varios --- */
.pdf-frame { width: 100%; height: 100%; border: 0; background: #fff; border-radius: 12px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.row--wrap { flex-wrap: wrap; }
.stack-v { display: flex; flex-direction: column; gap: 12px; }
.dot-retailer { width: 10px; height: 10px; border-radius: 4px; display: inline-block; flex: none; }
.pill-note { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; font-size: 13px; }
.pill-note--warn { background: var(--warn-bg); color: var(--warn-t); }
.pill-note--info { background: var(--info-bg); color: var(--info-t); }
.pill-note--ok { background: var(--ok-bg); color: var(--ok-t); }
.pill-note--danger { background: var(--danger-bg); color: var(--danger-t); }

@media (max-width: 1023px) {
  .form-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 639px) {
  .phead h1 { font-size: 28px; }
  .form-grid, .form-grid--3, .form-grid--4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .hbar__row { grid-template-columns: 64px minmax(0, 1fr) 80px; gap: 8px; }
  .donut { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .donut__c { left: 50%; transform: translateX(-50%); }
  .donut__c { position: absolute; }
  .overlay { padding: 12px; }
  .overlay--top { padding-top: 8vh; }
  .tbl th, .tbl td { padding-inline: 12px; }
}
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; inset: 0; background: #fff; color: #000; padding: 24px; }
}
.tbl th, .tbl td { padding-left: 12px; padding-right: 12px; }
.tbl th:first-child, .tbl td:first-child { padding-left: 18px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 18px; }
@media (max-width: 1500px) { .hide-xl { display: none; } }
