/* WAAT Partners · Demo de dashboard (flota, planta, informe mensual sin dependencias)
   Paleta oficial: RAG_CREACION_CAMPANAS_MARKETING_WAAT v1.1 §2.2 */

:root {
  --bg: #0B1016; --panel: #141B24; --panel-2: #0F141A; --card: #1A232E;
  --line: #1F2A36; --line-2: #263240; --axis: #33414F; --text: #E8EDF3;
  --text-2: #C9D3DF; --muted: #A0AFC3; --orange: #F26E22; --orange-2: #FF8A47;
  --slate: #6D86A6; --blue: #8FA6C4; --bar: #4E6683; --green: #10B981;
  --yellow: #F5B841; --red: #EF4444; --radius: 12px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font);
  font-variant-numeric: tabular-nums; line-height: 1.4;
}
a { color: var(--orange); text-decoration: none; }
a:hover { color: var(--orange-2); }
h1, h2 { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 4px; }

/* ---------- Estructura ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex: 0 0 248px;
  background: var(--panel-2); border-right: 1px solid var(--line);
  padding: 24px 16px; display: flex; flex-direction: column; gap: 28px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: var(--text); }
.brand-mark, .brand-logo { width: 34px; height: 34px; border-radius: 8px; flex: 0 0 34px; }
.brand-mark {
  background: var(--orange); display: flex; align-items: center; justify-content: center;
  color: var(--panel-2); font-weight: 800; font-size: 15px;
}
.brand-name { display: flex; flex-direction: column; }
.brand-name b { font-size: 17px; letter-spacing: .5px; }
.brand-name span { font-size: 12px; color: var(--muted); letter-spacing: 1px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  border-radius: 8px; color: var(--muted); font-size: 14px; min-height: 44px;
}
.nav a:hover { background: var(--card); color: var(--text); }
.nav a[aria-current="page"] { background: var(--card); color: var(--text); font-weight: 600; }
.nav a[aria-current="page"] svg { stroke: var(--orange); }
.nav svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.nav .badge { margin-left: auto; background: var(--orange); color: var(--panel-2); font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 10px; }
.nav .nav-return { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 14px; color: var(--slate); font-size: 13px; }
.nav .nav-return:hover { color: var(--orange); }
.whitelabel {
  margin-top: auto; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 6px;
}
.whitelabel small { font-size: 12px; color: var(--muted); }
.whitelabel .logo-slot {
  height: 40px; border: 1px dashed #3A4858; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted);
}
.whitelabel .logo-slot img { max-height: 34px; max-width: 100%; }

.main { flex: 1; min-width: 0; padding: 28px 36px 48px; display: flex; flex-direction: column; gap: 20px; }

/* ---------- Encabezados ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-head .title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; }
.page-head p { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.crumbs { font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tag-demo { font-size: 12px; font-weight: 700; letter-spacing: 1px; color: var(--orange); border: 1px solid var(--orange); border-radius: 12px; padding: 3px 9px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { font-size: 12px; color: var(--text-2); background: var(--panel); border: 1px solid var(--line-2); padding: 5px 10px; border-radius: 6px; }

/* ---------- Botones e inputs ---------- */
.btn {
  height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--text); font: 600 14px var(--font);
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
}
.btn:hover { border-color: var(--slate); color: var(--text); }
.btn-primary { background: var(--orange); border-color: var(--orange); color: var(--panel-2); font-weight: 700; }
.btn-primary:hover { background: var(--orange-2); border-color: var(--orange-2); color: var(--panel-2); }
.btn-sm { height: 40px; font-size: 13px; padding: 0 14px; }
.search {
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px;
}
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; }
.search input { background: transparent; border: 0; outline: none; color: var(--text); font: 14px var(--font); width: 240px; max-width: 50vw; min-height: 40px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line-2);
  background: transparent; color: var(--muted); font: 13px var(--font); cursor: pointer;
}
.pill[aria-pressed="true"] { border-color: var(--orange); background: rgba(242,110,34,.12); color: var(--orange); font-weight: 600; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 12px 14px; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a[aria-current="true"] { color: var(--text); font-weight: 600; border-bottom-color: var(--orange); }

/* ---------- Tarjetas ---------- */
.grid-kpi { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.kpi .lbl { font-size: 12px; color: var(--muted); letter-spacing: .7px; text-transform: uppercase; }
.kpi .val { font-size: 28px; font-weight: 800; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.col-2 { flex: 2 1 640px; min-width: 0; }
.col-1 { flex: 1 1 340px; min-width: 0; }
.col-half { flex: 1 1 480px; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; }
.panel-head h2 { font-size: 16px; font-weight: 700; }
.panel-head .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); align-items: center; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 16px; height: 0; border-top: 3px solid; }
.legend i.dash { border-top-style: dashed; border-top-width: 2px; }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stat { background: var(--panel-2); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.stat .lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.stat .val { font-size: 18px; font-weight: 700; }
.stat .sub { font-size: 12px; color: var(--muted); }
.note { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.6; }
.callout { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; background: var(--panel-2); border-radius: 8px; padding: 12px 14px; font-size: 13px; color: var(--text-2); }

/* Tonos (texto) */
.t-solar { color: var(--orange); } .t-ok { color: var(--green); } .t-red { color: var(--blue); }
.t-critica { color: var(--red); } .t-aviso { color: var(--yellow); } .t-info { color: var(--slate); } .t-neutro { color: var(--text); }

/* Estados (píldora) */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 12px; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 4px; background: currentColor; }
.status.plain::before { display: none; }
.s-ok { color: var(--green); background: rgba(16,185,129,.12); }
.s-info { color: var(--slate); background: rgba(109,134,166,.15); }
.s-solar { color: var(--orange); background: rgba(242,110,34,.12); }
.s-aviso { color: var(--yellow); background: rgba(245,184,65,.12); }
.s-critica { color: var(--red); background: rgba(239,68,68,.12); }
.dot { width: 9px; height: 9px; border-radius: 5px; flex: 0 0 9px; background: currentColor; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; position: relative; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; padding: 12px; }
td { padding: 14px 12px; border-top: 1px solid var(--line); }
td.num, th.num { text-align: right; }
.plantas-table { min-width: 980px; }
.plantas-table td:first-child, .plantas-table th:first-child { padding-left: 20px; }
.cell-title { display: flex; flex-direction: column; gap: 3px; }
.cell-title b { font-weight: 600; }
.cell-title small { font-size: 12px; color: var(--muted); }
.meter { display: flex; align-items: center; gap: 10px; }
.meter .track { width: 90px; height: 6px; border-radius: 3px; background: var(--line-2); }
.meter .fill { height: 6px; border-radius: 3px; background: var(--orange); }

/* ---------- Listas ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 8px; background: var(--panel-2); }
.item .dot { margin-top: 5px; }
.item .body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.item b { font-size: 14px; font-weight: 600; }
.item small { font-size: 12px; color: var(--muted); line-height: 1.5; }
.item time, .item .when { font-size: 12px; color: var(--muted); white-space: nowrap; }
.sigla { width: 40px; height: 40px; border-radius: 8px; background: var(--card); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--slate); flex: 0 0 40px; }
.timeline { display: flex; flex-direction: column; }
.tl { display: flex; gap: 12px; }
.tl .rail { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 4px; }
.tl .rail .dot { width: 10px; height: 10px; }
.tl .rail .line { width: 2px; flex: 1; background: var(--line); }
.tl .body { flex: 1; display: flex; flex-direction: column; gap: 3px; padding-bottom: 14px; }
.tl .top { display: flex; justify-content: space-between; gap: 8px; }
.tl b { font-size: 14px; }
.tl small { font-size: 12px; color: var(--muted); line-height: 1.5; }
.equipo { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.equipo .body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.equipo b { font-size: 14px; }
.equipo small { font-size: 12px; color: var(--muted); }
.equipo .estado { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.inv { background: var(--panel-2); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.inv .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.inv .head b { font-size: 15px; }
.inv .head small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.inv .vals { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.inv .vals span { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.inv .vals strong { font-size: 16px; color: var(--text); }

/* ---------- Gráficos ---------- */
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid line { stroke: var(--line); }
.chart .axis { stroke: var(--axis); }
.chart text { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.bars-wrap { display: flex; flex-direction: column; gap: 8px; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 190px; border-bottom: 1px solid var(--axis); padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.bars .b span { font-size: 11px; color: var(--text-2); }
.bars .b i { display: block; width: 100%; max-width: 34px; border-radius: 4px 4px 0 0; background: var(--bar); }
.bars .b.last i { background: var(--orange); }
.bars-labels { display: flex; gap: 8px; }
.bars-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); }

/* Impacto solar */
.hero-num { font-size: 40px; font-weight: 800; color: var(--green); }
.cmp { display: flex; flex-direction: column; gap: 6px; }
.cmp .top { display: flex; justify-content: space-between; font-size: 13px; }
.cmp .top span:first-child { color: var(--muted); }
.cmp i { display: block; height: 10px; border-radius: 5px; }

/* Informe (tarjeta) */
.report-card { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 20px; }
.report-thumb { width: 96px; height: 124px; border-radius: 6px; background: #F4F6F9; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.report-thumb i { display: block; border-radius: 2px; background: #C6CFDA; height: 5px; }
.report-thumb i.a { background: var(--orange); height: 8px; width: 40px; }
.report-thumb i.box { background: #E3E8EF; height: 26px; }

/* ---------- Estado de carga / error ---------- */
.loading { color: var(--muted); font-size: 14px; padding: 40px 0; }
.error { color: var(--red); }

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { position: static; width: 100%; height: auto; flex: none; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; }
  .nav { flex-direction: row; flex-wrap: wrap; gap: 2px; }
  .nav a { padding: 8px 10px; }
  .whitelabel { display: none; }
  .main { padding: 20px 16px 40px; }
  .search input { width: 160px; }
}

/* Informe mensual (claro, A4, imprimible) */
body.informe { background: #E9EDF2; color: #141921; }
.informe-toolbar { max-width: 794px; margin: 20px auto 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 0 8px; }
.informe-toolbar a { color: #5D6B7D; font-size: 14px; }
.informe-toolbar .btn-primary { color: #0F141A; }
.sheet {
  width: 794px; min-height: 1123px; max-width: 100%; margin: 16px auto 40px; background: #fff;
  padding: 44px 52px; display: flex; flex-direction: column; gap: 22px;
  box-shadow: 0 2px 12px rgba(20,25,33,.12);
}
.sheet .r-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 2px solid var(--orange); padding-bottom: 16px; }
.sheet .r-logo { width: 170px; height: 52px; border: 1.5px dashed #9AA8B8; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #5D6B7D; }
.sheet .r-logo img { max-width: 160px; max-height: 46px; }
.sheet .r-title { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; }
.sheet .r-title b { font-size: 20px; font-weight: 800; }
.sheet .r-title span, .sheet .muted { font-size: 12px; color: #5D6B7D; }
.sheet .r-meta { display: flex; justify-content: space-between; gap: 16px; font-size: 13px; }
.sheet .r-meta div { display: flex; flex-direction: column; gap: 3px; }
.sheet .r-meta div:last-child { text-align: right; }
.sheet .r-meta small { font-size: 12px; color: #5D6B7D; letter-spacing: .6px; }
.sheet .r-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.sheet .r-kpi { background: #F4F6F9; border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.sheet .r-kpi small { font-size: 12px; color: #5D6B7D; }
.sheet .r-kpi b { font-size: 22px; font-weight: 800; }
.sheet .r-kpi.hl { background: #FDEEE5; }
.sheet .r-kpi.hl small, .sheet .r-kpi.hl b { color: #8A3A10; }
.sheet h3 { margin: 0; font-size: 14px; font-weight: 700; }
.sheet .bars { height: 150px; gap: 18px; border-bottom-color: #C6CFDA; padding: 0 8px; }
.sheet .bars .b span { color: #3A4756; font-size: 11px; }
.sheet .bars .b i { max-width: 54px; background: var(--blue); }
.sheet .bars .b.last i { background: var(--orange); }
.sheet .bars-labels { gap: 18px; padding: 0 8px; }
.sheet .bars-labels span { color: #5D6B7D; font-size: 11px; }
.sheet .r-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.sheet .box { border: 1px solid #D7E1EE; border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.sheet .line { display: flex; justify-content: space-between; font-size: 12px; }
.sheet .line span:first-child { color: #5D6B7D; }
.sheet .line.total { border-top: 1px solid #D7E1EE; padding-top: 8px; font-weight: 700; }
.sheet .line.total span:first-child { color: #141921; }
.sheet .warn { color: #C2551A; font-weight: 600; }
.sheet .okline { font-size: 12px; color: #1F7A57; font-weight: 600; }
.sheet .ev { display: flex; gap: 10px; align-items: flex-start; font-size: 12px; line-height: 1.45; color: #3A4756; }
.sheet .ev .dot { margin-top: 4px; width: 8px; height: 8px; flex-basis: 8px; }
.sheet .ev .t-critica { color: #D9363E; } .sheet .ev .t-aviso { color: #C98A0B; } .sheet .ev .t-ok { color: #1F7A57; }
.sheet .reco { background: #F4F6F9; border-radius: 8px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.sheet .reco ol { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.5; color: #3A4756; display: flex; flex-direction: column; gap: 4px; }
.sheet .r-foot { margin-top: auto; display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid #D7E1EE; padding-top: 12px; font-size: 12px; color: #5D6B7D; }
@media (max-width: 420px) {
  .bars, .bars-labels { gap: 3px; }
  .bars .b { min-width: 0; }
}
@media (max-width: 820px) {
  .sheet { padding: 24px 18px; min-height: 0; }
  .sheet .r-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet .r-two { grid-template-columns: 1fr; }
}
@page { size: A4; margin: 0; }
@media print {
  body.informe { background: #fff; }
  .informe-toolbar { display: none; }
  .sheet { margin: 0; box-shadow: none; width: 210mm; min-height: 297mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
