/* =========================================================
   Solución Solar — shared chrome for the Pro apps
   (CalcEléctrica Pro, TableroRIC Pro). Loaded AFTER styles.css,
   reuses its tokens (--bg, --surface, --sun, --ink…) and
   components (.btn, .icon-btn, .seg, .num, .res, .toast).
   ========================================================= */

body.app { min-height: 100svh; display: flex; flex-direction: column; }
.app-main { flex: 1; padding: calc(var(--nav-h) + 20px) 0 60px; }
.app-container { width: min(1360px, 100% - 32px); margin-inline: auto; }

/* ---------- top bar ---------- */
.appbar { position: fixed; inset: 0 0 auto; z-index: 50; padding: 10px 0; }
.appbar__inner {
  width: min(1380px, 100% - 24px); margin-inline: auto; height: 58px; padding: 0 10px 0 14px;
  display: flex; align-items: center; gap: 14px; border-radius: 18px;
  background: var(--glass); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: inset 0 0 0 1px var(--line), 0 20px 40px -24px var(--shadow);
}
.appbar .brand { margin-right: 0; }
.appbar__nav { display: flex; gap: 2px; margin-left: auto; }
.appbar__nav a { padding: 8px 12px; border-radius: 10px; font-size: 14px; font-weight: 700; color: var(--muted); transition: color 200ms ease, background-color 200ms ease; }
.appbar__nav a[aria-current="page"] { color: var(--text); background: var(--hover); box-shadow: inset 0 0 0 1px var(--line); }
@media (hover: hover) and (pointer: fine) { .appbar__nav a:hover { color: var(--text); } }
.appbar__actions { display: flex; align-items: center; gap: 8px; }
.appbar__back { display: none; }
@media (max-width: 860px) {
  .appbar__nav { display: none; }
  .appbar__back { display: grid; }
  .appbar__actions { margin-left: auto; }
  .appbar .brand__text small { display: none; }
}
@media (max-width: 420px) {
  .appbar__actions .btn--sun { display: none; } /* "Cotizar" stays reachable from the home page; keeps the bar inside the screen */
  .appbar .brand__text b { font-size: 15px; }
}

/* ---------- app hero (title strip) ---------- */
.app-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin: 10px 0 22px; }
.app-head h1 { font-size: clamp(28px, 4vw, 44px); font-weight: 800; letter-spacing: -0.03em; }
.app-head h1 .pro { display: inline-grid; place-items: center; vertical-align: middle; margin-left: 8px; padding: 3px 9px; border-radius: 8px; font: 800 13px/1 var(--font-mono); letter-spacing: 0.06em; background: var(--sun); color: var(--ink); transform: translateY(-4px); }
.app-head p { color: var(--muted); max-width: 70ch; margin-top: 6px; }
.app-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- panels ---------- */
.panel { border-radius: 22px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line), 0 24px 48px -36px var(--shadow); }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel__head h2, .panel__head h3 { font-size: 17px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.panel__head h2 .i, .panel__head h3 .i { color: var(--sun-ink); }
.panel__body { padding: 18px; }
.step-n { width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; background: var(--sun); color: var(--ink); font: 800 13px var(--font-mono); flex: none; }

/* ---------- tooltip (?) ---------- */
.tip {
  width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font: 800 11px/1 var(--font-body); color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line-2);
  cursor: help; vertical-align: middle; transition: color 150ms ease, background-color 150ms ease;
}
.tip:hover, .tip:focus-visible, .tip[aria-expanded="true"] { color: var(--ink); background: var(--sun); box-shadow: none; }
.tooltip {
  position: fixed; z-index: 120; max-width: 300px; padding: 10px 12px; border-radius: 12px;
  background: var(--ink); color: #eef1f6; font-size: 13px; line-height: 1.5; pointer-events: none;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.5);
  opacity: 0; transform: scale(0.97); transform-origin: var(--tip-origin, 50% 100%);
  transition: opacity 140ms var(--ease-out), transform 160ms var(--ease-out);
}
:root[data-theme="dark"] .tooltip { background: #f4f2ec; color: var(--ink); }
.tooltip.is-on { opacity: 1; transform: none; }
.tooltip.instant { transition-duration: 0ms; }
.tooltip b { color: var(--sun); }
:root[data-theme="dark"] .tooltip b { color: #9a7300; }

/* ---------- small helpers ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: 0.02em; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--ok { background: rgba(16, 185, 129, 0.14); color: var(--green); }
.badge--warn { background: rgba(245, 158, 11, 0.16); color: #b45309; }
:root[data-theme="dark"] .badge--warn { color: #fbbf24; }
.badge--bad { background: rgba(229, 72, 77, 0.14); color: var(--red); }
.badge--info { background: rgba(59, 91, 255, 0.12); color: var(--sky); }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.disclaimer { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; font-size: 13px; color: var(--muted); background: var(--tint); box-shadow: inset 0 0 0 1px var(--line); }
.disclaimer .i { width: 18px; height: 18px; color: var(--sun-ink); flex: none; margin-top: 1px; }

/* ---------- app footer ---------- */
.app-foot { border-top: 1px solid var(--line); padding: 22px 0 calc(22px + env(safe-area-inset-bottom)); font-size: 13px; color: var(--muted); }
.app-foot .app-container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.app-foot a { color: var(--text); font-weight: 700; }

/* ---------- print: only the report ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #f3f3f3; --text: #000; --muted: #444; --line: #ccc; --line-2: #999; --sun-ink: #000; color-scheme: light; }
  body.app { background: #fff !important; }
  .appbar, .app-foot, .no-print, .toaster, .tooltip { display: none !important; }
  .app-main { padding: 0; }
  .panel { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}
