/* =====================================================================
   CRM Energía — hoja de estilos
   Traslado fiel del diseño de referencia "CRM Energia.html":
   tokens oklch, Inter + Plus Jakarta Sans, sidebar navy de 248px,
   tarjetas de 12px de radio, tablas en rejilla, píldoras de estado,
   pestañas con subrayado teal.
   ===================================================================== */

@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('../fonts/inter-latin-ext.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('../fonts/inter-latin.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: 'Plus Jakarta Sans'; font-style: normal; font-weight: 600 800; font-display: swap;
  src: url('../fonts/jakarta-latin-ext.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 600 800; font-display: swap;
  src: url('../fonts/jakarta-latin.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; }

:root {
  --ink: oklch(0.2 0.03 250);
  --ink-2: oklch(0.3 0.03 250);
  --muted: oklch(0.5 0.02 250);
  --line: oklch(0.92 0.01 240);
  --bg: oklch(0.985 0.005 240);
  --surface: #fff;
  --surface-2: oklch(0.96 0.008 240);
  --navy: oklch(0.22 0.05 260);
  --teal: oklch(0.72 0.13 175);
  --teal-ink: oklch(0.3 0.08 190);
  --teal-soft: oklch(0.94 0.03 175);
  --teal-tint: oklch(0.97 0.02 175);
  --teal-link: oklch(0.55 0.12 175);
  --teal-link-hover: oklch(0.4 0.1 190);
  --row-hover: oklch(0.97 0.01 175);
  --ok: oklch(0.45 0.13 155);
  --bad: oklch(0.45 0.17 27);
  --bad-dot: oklch(0.62 0.22 27);
  --warn-dot: oklch(0.78 0.15 75);
  --info-dot: oklch(0.65 0.14 245);

  --pill-gray-bg: oklch(0.95 0.008 240);  --pill-gray-fg: oklch(0.4 0.02 250);
  --pill-warn-bg: oklch(0.95 0.06 85);    --pill-warn-fg: oklch(0.4 0.09 70);
  --pill-info-bg: oklch(0.94 0.04 245);   --pill-info-fg: oklch(0.4 0.12 250);
  --pill-ok-bg:   oklch(0.94 0.06 155);   --pill-ok-fg:   oklch(0.35 0.1 155);
  --pill-bad-bg:  oklch(0.95 0.04 27);    --pill-bad-fg:  oklch(0.45 0.17 27);
  --pill-teal-bg: oklch(0.94 0.03 175);   --pill-teal-fg: oklch(0.3 0.08 190);

  --note-warn-bg: oklch(0.97 0.05 85);    --note-warn-fg: oklch(0.35 0.08 70);
  --note-info-bg: oklch(0.95 0.03 245);   --note-info-fg: oklch(0.35 0.1 250);

  --font: Inter, system-ui, sans-serif;
  --font-head: 'Plus Jakarta Sans', Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 13px; }
a { color: var(--teal-link); text-decoration: none; }
a:hover { color: var(--teal-link-hover); }
input, select, textarea, button { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; }
b, strong { font-weight: 600; }
code { font-size: 12px; background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.small { font-size: 12px; }
.tiny { font-size: 11px; }

/* ---------------------------------------------------------------- layout */
.app { display: flex; min-height: 100vh; }
.side {
  width: 248px; flex: none; background: var(--navy); color: oklch(0.98 0.005 240);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.06); }
.side-brand .mark {
  width: 36px; height: 36px; border-radius: 9px; background: var(--teal); display: grid; place-items: center;
  font-weight: 700; color: var(--on-accent, #fff); font-family: var(--font-head);
}
.side-brand .t1 { font-family: var(--font-head); font-weight: 700; font-size: 15px; line-height: 1.2; color: #fff; }
.side-brand .t2 { font-size: 11px; color: rgba(255,255,255,.5); }

/* Logo de la empresa: se adapta a cualquier proporción (horizontal, cuadrado 1:1 o vertical) sin deformarse ni
   recortarse. La caja crece con el logo; la altura máxima (--logo-alto) y el fondo (--logo-placa) los fija el
   Superadministrador en Administración → Apariencia. Un logo cuadrado queda centrado y a esa altura; uno horizontal
   ocupa el ancho disponible hasta donde permita esa altura. */
.brand-logo {
  display: flex; align-items: center; justify-content: center; box-sizing: border-box;
  width: 100%; padding: var(--logo-pad, 10px 12px); background: var(--logo-placa, #fff); border-radius: 10px;
}
.brand-logo img { display: block; max-width: 100%; max-height: var(--logo-alto, 72px); width: auto; height: auto; object-fit: contain; }
.login-card .brand .brand-logo { width: auto; max-width: 100%; padding: 0; background: transparent; justify-content: flex-start; }
.login-card .brand .brand-logo img { max-width: min(100%, 280px); max-height: calc(var(--logo-alto, 72px) * 1.2); object-position: left center; }
.side-nav { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer;
  font-size: 13.5px; color: rgba(255,255,255,.65); font-weight: 400;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.25); }
.nav-item .lbl { flex: 1; }
.nav-item .note { font-size: 10px; color: rgba(255,255,255,.4); background: transparent; padding: 0; border-radius: 0; }
.nav-item.on { background: rgba(255,255,255,.1); color: #fff; font-weight: 600; }
.nav-item.on .dot { background: var(--teal); }
.side-user { border-top: 1px solid rgba(255,255,255,.06); padding: 12px; display: flex; align-items: center; gap: 10px; }
.side-user .av {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, oklch(0.72 0.13 175), oklch(0.65 0.14 245));
  display: grid; place-items: center; font-weight: 600; color: #fff;
}
.side-user .nm { font-weight: 500; }
.side-user .rl { font-size: 11px; color: rgba(255,255,255,.5); }
.side-user form { margin-left: auto; }
.side-user .out {
  background: transparent; border: 1px solid rgba(255,255,255,.18); color: rgba(255,255,255,.75);
  border-radius: 6px; padding: 4px 8px; font-size: 11px; cursor: pointer;
}
.side-user .out:hover { color: #fff; border-color: rgba(255,255,255,.4); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; background: rgba(250,251,253,.9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-row { display: flex; align-items: center; gap: 12px; padding: 12px 24px 0; }
.search {
  flex: 1; max-width: 460px; height: 36px; border: 1px solid var(--line); background: #fff; border-radius: 8px;
  display: flex; align-items: center; padding: 0 12px; color: var(--muted); gap: 8px;
}
.search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; height: 100%; color: var(--ink); }
.search input::placeholder { color: var(--muted); }
.search kbd { margin-left: auto; font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; font-family: inherit; }
.chip-btn {
  height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; display: flex; align-items: center;
  gap: 6px; background: #fff; font-size: 12px; font-weight: 500; color: var(--ink);
}
.chip-btn input[type=month] { border: 0; outline: 0; background: transparent; font-size: 12px; font-weight: 500; }
.bell {
  width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  display: grid; place-items: center; position: relative; font-size: 15px; color: var(--ink);
}
.bell .badge { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad-dot); border: 2px solid #fff; }
.page-title { padding: 12px 24px 16px; }
.page-title h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.page-title p { margin: 2px 0 0; color: var(--muted); }
.content { padding: 24px; display: flex; flex-direction: column; gap: 16px; }

/* ------------------------------------------------------------ componentes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card.tight { padding: 16px; }
.card h3 { font-size: 15px; margin: 0 0 14px; }
.card-head { padding: 14px 18px; display: flex; align-items: center; gap: 8px; }
.card-head h3, .card-head b.t { font-family: var(--font-head); font-size: 15px; margin: 0; font-weight: 700; }
.card-head .sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.card.navy { background: var(--navy); color: #fff; border-color: transparent; }
.card.navy h3 { color: #fff; }
.card.tone-warn { background: oklch(0.98 0.03 85); border-color: oklch(0.9 0.06 85); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.grid-eq { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.grid-2e { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.grid-aside { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-aside.wide { grid-template-columns: 250px minmax(0, 1fr); }
.grid-main-side { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-s { display: flex; flex-direction: column; gap: 8px; }
.stack-xs { display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-nw { display: flex; align-items: center; gap: 8px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.kpis.s { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: block; color: inherit; }
a.kpi:hover { border-color: var(--teal); color: inherit; }
.kpi .l { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 500; color: var(--muted); }
.kpi .v { font-family: var(--font-head); font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpis.s .kpi .v { font-size: 24px; }
.kpi .n { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.k-info { background: oklch(0.97 0.02 245); border-color: oklch(0.9 0.04 245); }
.kpi.k-teal { background: oklch(0.97 0.02 175); border-color: oklch(0.9 0.05 175); }
.kpi.k-bad  { background: oklch(0.98 0.015 27); border-color: oklch(0.9 0.05 27); }
.kpi.k-warn { background: oklch(0.98 0.03 85); border-color: oklch(0.9 0.06 85); }

/* Botones */
.btn {
  height: 36px; border: 1px solid var(--line); background: #fff; border-radius: 8px; display: inline-flex; align-items: center;
  justify-content: center; padding: 0 12px; font-weight: 500; cursor: pointer; color: var(--ink); gap: 6px; white-space: nowrap;
}
.btn:hover { border-color: oklch(0.8 0.02 240); color: var(--ink); }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); padding: 0 14px; }
.btn.primary:hover { color: #fff; filter: brightness(1.15); }
.btn.accent { background: var(--teal); color: var(--on-accent, #fff); border-color: var(--teal); font-weight: 600; }
.btn.accent:hover { color: var(--on-accent, #fff); filter: brightness(.95); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.lg { height: 40px; padding: 0 16px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.link { color: var(--teal-link); font-weight: 600; cursor: pointer; background: none; border: 0; padding: 0; }
.link:hover { color: var(--teal-link-hover); }
.link.sm { font-size: 12px; }
form.inline { display: inline; margin: 0; }

/* Formularios */
.f { display: flex; flex-direction: column; min-width: 0; }
.f > label, .lbl-s { font-size: 11px; font-weight: 500; color: var(--muted); margin-bottom: 4px; display: block; }
.f > label .req { color: var(--bad-dot); }
.input, .select, .textarea {
  height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; background: #fff; width: 100%; outline: none;
}
.textarea { height: auto; min-height: 72px; padding: 8px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px oklch(0.94 0.03 175); }
.input[disabled], .select[disabled], .input[readonly] { background: var(--surface-2); color: var(--muted); }
.input.sm, .select.sm { height: 34px; }
.field-error, .text-danger, .field-validation-error { color: var(--bad); font-size: 11px; margin-top: 3px; }
.input-validation-error { border-color: var(--bad-dot); }
.validation-summary-errors, .alert-err { padding: 10px 14px; border-radius: 10px; background: var(--pill-bad-bg); color: var(--pill-bad-fg); }
.validation-summary-errors ul { margin: 0; padding-left: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.form-grid.c3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.c2 { grid-template-columns: repeat(2, 1fr); }
.form-grid .span2 { grid-column: span 2; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters .input, .filters .select { width: auto; min-width: 150px; }
.filters .input.q { width: 280px; }
.check { display: inline-flex; align-items: center; gap: 6px; }
.check input { accent-color: var(--teal); width: 15px; height: 15px; }

/* Interruptor (toggle) */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .tr { width: 34px; height: 20px; border-radius: 99px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.switch .tr::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch input:checked + .tr { background: var(--teal); }
.switch input:checked + .tr::after { left: 16px; }

/* Píldoras */
.pill {
  display: inline-block; border-radius: 99px; padding: 2px 10px; font-size: 11px; font-weight: 600; white-space: nowrap; justify-self: start;
  background: var(--pill-gray-bg); color: var(--pill-gray-fg);
}
.pill.warn { background: var(--pill-warn-bg); color: var(--pill-warn-fg); }
.pill.info { background: var(--pill-info-bg); color: var(--pill-info-fg); }
.pill.ok   { background: var(--pill-ok-bg);   color: var(--pill-ok-fg); }
.pill.bad  { background: var(--pill-bad-bg);  color: var(--pill-bad-fg); }
.pill.teal { background: var(--pill-teal-bg); color: var(--pill-teal-fg); }
.pill.lg { font-size: 12px; padding: 4px 12px; }
.tag { display: inline-block; border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; font-size: 11px; font-weight: 500; }
.tag.btnish { cursor: pointer; }
.chip-opt {
  display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); padding: 6px 12px; border-radius: 99px; color: var(--muted); cursor: pointer;
}
.chip-opt input { display: none; }
.chip-opt.on, .chip-opt:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-ink); font-weight: 500; }

/* Tablas en rejilla (div-grid del diseño) */
.tbl { width: 100%; overflow-x: auto; }
.tbl-inner { min-width: 640px; }
.tbl-head, .tbl-row { display: grid; grid-template-columns: var(--cols, 1fr); gap: 8px; align-items: center; padding: 10px 18px; }
.tbl-head { background: var(--surface-2); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tbl-head.sm { font-size: 10px; letter-spacing: .05em; gap: 6px; }
.tbl-row { padding: 12px 18px; border-top: 1px solid var(--line); }
a.tbl-row, .tbl-row.click { cursor: pointer; color: inherit; }
a.tbl-row:hover, .tbl-row.click:hover { background: var(--row-hover); color: inherit; }
.tbl-row.dim { opacity: .65; }
.tbl-foot { padding: 12px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.tbl-empty { padding: 28px 18px; text-align: center; color: var(--muted); border-top: 1px solid var(--line); }
.tbl-title { padding: 10px 18px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-top: 1px solid var(--line); }
.tbl-head > *, .tbl-row > * { min-width: 0; }
.tbl-row .pill { white-space: normal; line-height: 1.25; }
.tbl-row .sub { font-size: 11px; color: var(--muted); }
.tbl-row b { font-weight: 600; }
.tbl-row b.m { font-weight: 500; }

/* Pestañas y listas laterales */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  padding: 10px 16px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--teal-ink); border-bottom-color: var(--teal); }
.sidelist { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.sl-item { padding: 9px 12px; border-radius: 8px; cursor: pointer; font-weight: 500; display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.sl-item:hover { background: var(--surface-2); color: var(--ink-2); }
.sl-item.on { background: var(--teal-soft); color: var(--teal-ink); font-weight: 600; }
.sl-item .n { margin-left: auto; font-size: 11px; opacity: .6; font-weight: 400; }

/* Migas, cabeceras de ficha */
.crumb { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.crumb a { color: var(--teal-link); font-weight: 600; }
.ficha-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ficha-head .mark {
  width: 56px; height: 56px; border-radius: 14px; background: var(--teal-soft); color: var(--teal-ink); display: grid; place-items: center;
  font-weight: 700; font-size: 18px; font-family: var(--font-head); flex: none;
}
.ficha-head .tt { font-family: var(--font-head); font-size: 20px; font-weight: 700; }
.ficha-head .info { flex: 1; min-width: 240px; }
.avatar-s {
  width: 30px; height: 30px; border-radius: 50%; background: var(--teal-soft); color: var(--teal-ink); display: grid; place-items: center;
  font-weight: 700; font-size: 11px; flex: none;
}
.logo-tile {
  width: 40px; height: 40px; border-radius: 10px; color: #fff; display: grid; place-items: center; font-weight: 700;
  font-family: var(--font-head); flex: none;
}
.logo-tile.lg { width: 56px; height: 56px; border-radius: 14px; font-size: 20px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px 12px; }
.kv > span:nth-child(odd) { color: var(--muted); }
.kv > span:nth-child(even) { font-weight: 500; }
.kv-line { display: flex; justify-content: space-between; gap: 8px; }
.kv-line > span:first-child { color: var(--muted); }
.divider-top { border-top: 1px solid var(--line); padding-top: 8px; }
.divider-dash { border-top: 1px dashed var(--line); padding-top: 8px; }

/* Avisos */
.note { padding: 12px 16px; border-radius: 10px; background: var(--note-warn-bg); color: var(--note-warn-fg); font-size: 12px; }
.note.info { background: var(--note-info-bg); color: var(--note-info-fg); }
.note.teal { background: var(--teal-soft); color: var(--teal-ink); }
.note.bad { background: var(--pill-bad-bg); color: var(--pill-bad-fg); }
.note.ok { background: var(--pill-ok-bg); color: var(--pill-ok-fg); }
.flash { padding: 10px 14px; border-radius: 10px; font-weight: 500; }
.flash.ok { background: var(--pill-ok-bg); color: var(--pill-ok-fg); }
.flash.warn { background: var(--note-warn-bg); color: var(--note-warn-fg); }
.flash.err { background: var(--pill-bad-bg); color: var(--pill-bad-fg); }
.selection-bar { display: flex; gap: 8px; align-items: center; padding: 10px 14px; background: var(--teal-soft); border-radius: 10px; color: var(--teal-ink); flex-wrap: wrap; }

/* Barras (Home) */
.bar-row { display: grid; grid-template-columns: 140px 1fr 40px; align-items: center; gap: 12px; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 99px; }
.bar-fill { height: 100%; border-radius: 99px; }
.alert-row { display: flex; gap: 10px; }
.alert-row .d { width: 6px; height: 6px; border-radius: 50%; margin-top: 6px; flex: none; }
.news-date { font-size: 11px; color: var(--teal); font-weight: 600; }
.news-txt { margin-top: 2px; color: rgba(255,255,255,.85); }

/* Stepper (estados) */
.stepper { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; font-weight: 500; color: var(--muted); }
.step .dt { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.step.on { background: var(--teal-soft); color: var(--teal-ink); font-weight: 600; }
.step.on .dt { background: var(--teal); }
.step.done .dt { background: var(--teal); }

/* Potencias P1-P6 */
.pot-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.pot-cell { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: #fff; }
.pot-cell .k { font-size: 10px; color: var(--muted); }
.pot-cell .input { height: 28px; padding: 0 6px; border: 0; background: transparent; font-weight: 600; box-shadow: none; }
.pot-cell.off { background: var(--surface-2); color: var(--muted); }
.price-grid { display: grid; grid-template-columns: 150px repeat(6, 1fr); gap: 6px; align-items: center; margin-bottom: 6px; }
.price-grid .hd { text-align: center; font-weight: 600; font-size: 11px; color: var(--muted); }
.price-cell { height: 32px; border: 1px solid var(--line); border-radius: 6px; display: grid; place-items: center; font-size: 12px; background: #fff; font-variant-numeric: tabular-nums; }
.price-cell.off { background: var(--surface-2); color: var(--muted); }
input.price-cell { width: 100%; text-align: center; padding: 0 4px; }

/* Selector de oferta (comparador) */
.opt-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--line); cursor: pointer; background: #fff; color: inherit; }
.opt-row:hover { background: var(--row-hover); color: inherit; }
.opt-row.sel { background: var(--teal-tint); }
.radio-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--teal); display: grid; place-items: center; flex: none; }
.radio-dot i { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); opacity: 0; }
.opt-row.sel .radio-dot i { opacity: 1; }
.save-pos { color: var(--ok); }

/* Línea de tiempo */
.timeline { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; border-left: 2px solid var(--line); margin-left: 5px; padding-left: 16px; }
.timeline > div { position: relative; }
.timeline > div::before { content: ''; position: absolute; left: -23px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--teal); border: 2px solid #fff; }
.timeline .d { font-size: 11px; color: var(--muted); }

/* Gráfico de barras sencillo (informes) */
.chart { display: flex; gap: 18px; align-items: flex-end; height: 200px; border-bottom: 1px solid var(--line); }
.chart-col { flex: 1; display: flex; gap: 4px; align-items: flex-end; height: 100%; justify-content: center; }
.chart-col i { width: 18px; border-radius: 4px 4px 0 0; display: block; }
.chart-labels { display: flex; gap: 18px; margin-top: 6px; }
.chart-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.legend span { display: flex; gap: 6px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* Importación */
.dropzone { border: 1px dashed var(--teal); background: var(--teal-tint); border-radius: 10px; padding: 10px 14px; font-weight: 500; }
.imp-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.imp-sum > div { border-radius: 10px; padding: 16px; border: 1px solid var(--line); }
.imp-sum .n { font-family: var(--font-head); font-size: 28px; font-weight: 700; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-back.open { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; padding: 22px; }
.modal h3 { font-size: 17px; margin-bottom: 14px; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px; box-shadow: 0 10px 30px rgba(15,23,42,.06); }
.login-card .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-card .brand .mark { width: 40px; height: 40px; border-radius: 10px; background: var(--teal); color: var(--on-accent, #fff); display: grid; place-items: center; font-weight: 700; font-family: var(--font-head); }
.login-card h1 { font-size: 22px; letter-spacing: -.02em; }
.login-card .sub { color: var(--muted); margin: 2px 0 18px; }

/* Menú móvil */
.menu-toggle { display: none; }

@media (max-width: 1000px) {
  .grid-2, .grid-main-side, .grid-aside, .grid-aside.wide, .grid-2e { grid-template-columns: minmax(0, 1fr); }
  .form-grid.c3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  body.menu-open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .menu-toggle { display: grid; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: #fff; place-items: center; cursor: pointer; }
  .topbar-row { padding: 12px 16px 0; }
  .page-title { padding: 12px 16px 16px; }
  .content { padding: 16px; }
  .pot-grid { grid-template-columns: repeat(3, 1fr); }
  .imp-sum { grid-template-columns: 1fr; }
  .search kbd { display: none; }
}
@media print {
  .side, .topbar, .no-print { display: none !important; }
  .content { padding: 0; }
}

/* Marca sin logo: iniciales + nombre en la barra lateral. */
.side-brand-txt { display: flex; align-items: center; gap: 10px; }

/* Campana de alertas (desplegable) */
.bell-menu { position: relative; }
.bell-menu > summary { list-style: none; cursor: pointer; }
.bell-menu > summary::-webkit-details-marker { display: none; }
.bell-panel {
  position: absolute; right: 0; top: 44px; z-index: 40; width: 340px; max-width: calc(100vw - 32px);
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15,23,42,.14); overflow: hidden;
}
.bell-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 600; border-bottom: 1px solid var(--line); }
.bell-empty { padding: 16px 14px; color: var(--muted); font-size: 13px; }
.bell-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; color: var(--ink); font-size: 13px; border-bottom: 1px solid var(--line); }
.bell-item:hover { background: var(--surface-2, #f8fafc); }
.bell-item .d { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; }
.bell-foot { display: block; padding: 10px 14px; text-align: center; font-size: 12.5px; font-weight: 500; color: var(--teal-ink, var(--ink)); }
