@import url("https://fonts.googleapis.com/css2?family=Archivo:wght@700;800;900&family=Manrope:wght@400;500;600;700;800;900&display=swap");

:root {
  color-scheme: light;
  --bg: #f4f2ea;
  --panel: #ffffff;
  --ink: #1c1c1c;
  --charcoal: #2b2b2b;
  --muted: #66717a;
  --line: #d8ded6;
  --brand: #ffc107;
  --brand-dark: #f5b400;
  --accent: #78b833;
  --accent-dark: #4d8c20;
  --danger: #b42318;
  --paper: #fffdf7;
  --surface: #f9faf3;
  --steel: #eef1ec;
  --shadow: 0 24px 70px rgba(28, 28, 28, 0.12);
  --shadow-soft: 0 14px 34px rgba(28, 28, 28, 0.09);
  --focus-ring: 0 0 0 4px rgba(255, 193, 7, 0.24);
  font-family: Manrope, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}


* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(118deg, rgba(255, 193, 7, 0.14) 0 13%, transparent 13% 100%),
    linear-gradient(102deg, transparent 0 56%, rgba(120, 184, 51, 0.08) 56% 72%, transparent 72%),
    radial-gradient(1100px 500px at 84% -16%, rgba(255, 193, 7, 0.16), transparent 56%),
    var(--bg);
  background-attachment: fixed;
}

body.booting .app-shell {
  visibility: hidden;
}

body.login-only .app-shell {
  min-height: 100vh;
  display: grid;
  align-items: center;
}

body.login-only .workspace {
  grid-template-columns: minmax(0, 660px);
  justify-content: center;
}

body.login-only .summary-panel {
  display: none;
}

body.login-only .form-panel {
  padding: 36px 40px;
}

body.login-only .auth-panel {
  margin: 0;
  padding: 0;
  border-bottom: 0;
}

body.login-only .section-heading.compact {
  display: grid;
  gap: 6px;
  justify-content: start;
}

body.login-only .auth-grid {
  grid-template-columns: minmax(0, 1fr);
  max-width: none;
}

body.login-only .auth-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  width: min(100%, 450px);
  margin: 28px auto 0;
}

body.login-only #loginButton {
  width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.summary-panel,
.form-panel,
.report-sheet {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.summary-panel {
  position: sticky;
  top: 24px;
  min-height: calc(100vh - 48px);
  padding: 24px;
  display: flex;
  flex-direction: column;
  animation: panel-rise 0.48s ease both;
}

.brand-mark {
  position: relative;
  width: 82px;
  height: 82px;
  margin-bottom: 22px;
}

.sun-core,
.ray {
  position: absolute;
  display: block;
}

.sun-core {
  width: 44px;
  height: 44px;
  left: 19px;
  top: 19px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: inset -8px -8px 0 rgba(167, 100, 16, 0.16);
}

.ray {
  width: 14px;
  height: 76px;
  left: 34px;
  top: 3px;
  border-radius: 999px;
  background: rgba(247, 183, 51, 0.58);
}

.ray-a {
  transform: rotate(0deg);
}

.ray-b {
  transform: rotate(45deg);
}

.ray-c {
  transform: rotate(90deg);
}

.ray-d {
  transform: rotate(135deg);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3,
.menu-button span,
.report-cover-brand strong,
.report-badge strong,
.report-kpis dd,
.primary,
.secondary {
  font-family: Archivo, Manrope, ui-sans-serif, system-ui, sans-serif;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  max-width: 100%;
  text-wrap: balance;
}

.subtitle {
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.live-summary {
  margin: 18px 0 0;
  display: grid;
  gap: 12px;
}

.connection-card {
  margin-top: 20px;
  margin-bottom: 2px;
  padding: 18px;
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  background: #f9faf7;
}

.connection-card > div:first-child {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.connection-card span {
  font-weight: 900;
}

.connection-card small,
.panel-hint,
.history-meta,
.history-empty {
  color: var(--muted);
}

.connection-card small {
  overflow-wrap: anywhere;
}

.mini-button {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.connection-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 2px;
}

.live-summary div {
  min-height: 86px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  background: #f9faf7;
}

dt {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

dd {
  margin: 4px 0 0;
  font-weight: 800;
  font-size: 1.35rem;
}

.form-panel {
  padding: 26px;
  animation: panel-rise 0.58s ease 0.04s both;
}

@keyframes panel-rise {
  from {
    transform: translateY(12px);
  }

  to {
    transform: translateY(0);
  }
}

.setup-panel,
.auth-panel,
.admin-panel {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.panel-hint {
  margin: -8px 0 14px;
  line-height: 1.5;
}

.subsection-heading {
  margin: 20px 0 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.subsection-heading:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.subsection-heading h3 {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
}

.subsection-heading h3::before {
  content: "";
  width: 8px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--brand), var(--accent));
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.auth-actions {
  margin-top: 14px;
}

.setup-help {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.setup-help a {
  color: var(--accent-dark);
  font-weight: 800;
}

.user-menu {
  margin-bottom: 24px;
  padding-bottom: 18px;
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.user-menu div:first-child {
  display: grid;
  gap: 4px;
}

.user-menu strong {
  font-size: 1.05rem;
}

.user-menu small {
  color: var(--muted);
}

.user-menu-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.menu-button {
  min-height: 74px;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  text-align: left;
  color: var(--ink);
  background: #fbfcfa;
  cursor: pointer;
}

.menu-button span {
  font-weight: 900;
}

.menu-button small {
  color: var(--muted);
}

.menu-button.is-active {
  border-color: var(--accent);
  background: #eaf4ef;
  box-shadow: inset 4px 0 0 var(--accent);
}

.admin-submenu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 22px;
}

.admin-submenu-button {
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #fffdf7);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.admin-submenu-button:hover {
  transform: translateY(-1px);
  border-color: rgba(245, 180, 0, 0.65);
  box-shadow: var(--shadow-soft);
}

.admin-submenu-button span {
  font-family: Archivo, Manrope, ui-sans-serif, system-ui, sans-serif;
  font-weight: 900;
}

.admin-submenu-button small {
  color: var(--muted);
  line-height: 1.35;
}

.admin-submenu-button.is-active {
  border-color: rgba(255, 193, 7, 0.78);
  background: linear-gradient(135deg, #fff7d8, #ffffff 64%);
  box-shadow: inset 4px 0 0 var(--brand), 0 18px 38px rgba(245, 180, 0, 0.16);
}

.admin-subpanel {
  padding-top: 2px;
}

.admin-user-form,
.admin-card-form {
  padding: 20px;
  border: 1px solid rgba(28, 28, 28, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 193, 7, 0.08), transparent 38%),
    linear-gradient(180deg, #ffffff, #fffdf7);
  box-shadow: 0 16px 36px rgba(28, 28, 28, 0.055);
}

.admin-franchise-field {
  padding-top: 2px;
}

.admin-franchise-field .franchise-choice-list {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.admin-user-actions {
  justify-content: end;
  padding-top: 2px;
}

.field-command {
  display: flex;
  gap: 10px;
  align-items: end;
}

.managed-users-list {
  display: grid;
  gap: 10px;
}

.managed-user-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px) auto;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fffdf7);
}

.franchise-card {
  align-items: center;
}

.user-role-card {
  grid-template-columns: minmax(220px, 0.85fr) minmax(0, 1.4fr);
  gap: 16px;
  padding: 16px;
}

.managed-user-controls {
  display: grid;
  gap: 8px;
}

.user-role-card .managed-user-controls {
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.user-role-card .managed-user-controls label {
  align-content: start;
}

.user-role-card .managed-user-actions {
  grid-column: 1 / -1;
  padding-top: 4px;
}

.managed-user-card strong {
  overflow-wrap: anywhere;
}

.managed-user-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.managed-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: end;
}

.section-heading {
  margin: 6px 0 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(28, 28, 28, 0.08);
}

.section-heading h2 {
  font-size: clamp(1.18rem, 1.7vw, 1.55rem);
  line-height: 1.05;
}

.section-heading.compact {
  margin-top: 0;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 30px;
  align-items: start;
}

label {
  min-width: 0;
  display: grid;
  gap: 7px;
  align-content: start;
}

.field-like {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 7px;
}

legend {
  padding: 0;
}

label span,
.signature-head span,
.field-like > span,
legend {
  color: #2d3832;
  font-size: 0.9rem;
  font-weight: 700;
}

.field-hint {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 46px;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfcfa;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input[type="date"],
input[type="time"] {
  inline-size: 100%;
  max-inline-size: 100%;
}

textarea {
  resize: vertical;
}

select[multiple] {
  min-height: 112px;
  padding: 8px;
}

select[multiple] option {
  border-radius: 6px;
  padding: 8px;
}

.franchise-choice-list {
  display: grid;
  gap: 8px;
}

.franchise-choice-list.compact {
  max-height: 176px;
  overflow: auto;
  padding-right: 2px;
}

.franchise-choice {
  position: relative;
  min-height: 42px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fffef9);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.franchise-choice:hover {
  border-color: var(--brand-dark);
  background: #fffaf0;
}

.franchise-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.franchise-choice-mark {
  width: 18px;
  height: 18px;
  border: 2px solid #9aa4ad;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: inset 0 0 0 4px #ffffff;
}

.franchise-choice input:checked + .franchise-choice-mark {
  border-color: var(--brand-dark);
  background: var(--brand);
}

.franchise-choice:has(input:checked) {
  border-color: rgba(245, 180, 0, 0.75);
  background:
    linear-gradient(135deg, rgba(255, 193, 7, 0.18), transparent 52%),
    #fffdf2;
  box-shadow: 0 8px 18px rgba(245, 180, 0, 0.12);
}

.franchise-choice span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-weight: 800;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-dark);
  background: #ffffff;
  box-shadow: var(--focus-ring);
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

.unit-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
}

.select-input select {
  border-radius: 8px;
}

.location-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.password-input-row {
  position: relative;
  display: block;
}

.password-input-row input {
  padding-right: 54px;
}

.inline-action {
  white-space: nowrap;
}

.unit-input input,
.unit-input select {
  min-width: 0;
  border-radius: 8px 0 0 8px;
}

.unit-input strong {
  min-width: 58px;
  min-height: 46px;
  height: 100%;
  margin-left: -1px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: #eef3ee;
  color: var(--accent-dark);
}

.dynamic-section {
  border-top: 1px solid var(--line);
  padding-top: 22px;
  margin-top: 6px;
}

.serial-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

#inverterSerials {
  grid-template-columns: 1fr;
}

.serial-list:empty::before {
  content: "Sin equipos cargados";
  display: block;
  grid-column: 1 / -1;
  padding: 14px;
  color: var(--muted);
  border: 1px dashed var(--line);
  background: #fbfcfa;
}

.serial-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fbfcfa;
  border-radius: 8px;
}

.battery-card {
  grid-template-columns: 42px repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
}

.inverter-card {
  grid-template-columns: 42px minmax(180px, 1.35fr) minmax(130px, 0.9fr) minmax(120px, 0.75fr);
  align-items: end;
}

.serial-card strong {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e8f2ed;
  color: var(--accent-dark);
}

.serial-card label {
  gap: 5px;
}

.serial-card span {
  font-size: 0.8rem;
}

.serial-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.scan-button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--accent-dark);
  font-weight: 900;
  cursor: pointer;
}

.scan-button:hover {
  background: #eef6f1;
}

.detail-list {
  display: grid;
  gap: 12px;
  margin-bottom: 28px;
}

.detail-list:empty::before {
  content: "Sin datos para completar";
  display: block;
  padding: 14px;
  color: var(--muted);
  border: 1px dashed var(--line);
  background: #fbfcfa;
}

.compact-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.detail-card-header {
  display: flex;
  gap: 12px;
  align-items: center;
}

.detail-card-header strong {
  width: 42px;
  height: 42px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: #e8f2ed;
  color: var(--accent-dark);
}

.detail-card-header span {
  font-weight: 900;
}

.signature-area {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  overflow: hidden;
}

.signature-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.signature-head div {
  display: grid;
  gap: 3px;
}

.signature-head small {
  color: var(--muted);
}

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef3ee;
  color: var(--accent-dark);
  cursor: pointer;
}

.icon-button:hover {
  background: #e1ece5;
}

#signaturePad {
  display: block;
  width: 100%;
  height: 190px;
  touch-action: none;
  user-select: none;
  cursor: crosshair;
}

.check-row {
  margin: 16px 0 22px;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.check-row span {
  line-height: 1.45;
}

.actions,
.report-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.primary,
.secondary {
  min-height: 46px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
}

.link-button {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.primary {
  background: var(--accent);
  color: #ffffff;
}

.primary:hover {
  background: var(--accent-dark);
}

.secondary {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.secondary:hover {
  background: #f6f8f4;
}

.report-view {
  margin-top: 18px;
}

.history-section {
  margin-top: 34px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.history-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.history-card h3 {
  font-size: 1rem;
  margin-bottom: 5px;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.86rem;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: end;
}

.history-empty {
  padding: 14px;
  border: 1px dashed var(--line);
  background: #fbfcfa;
}

.report-toolbar {
  margin-bottom: 14px;
}

.report-sheet {
  max-width: 980px;
  margin: 0 auto;
  padding: 38px;
  background:
    linear-gradient(90deg, var(--accent) 0 8px, transparent 8px),
    #ffffff;
}

.report-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  border-bottom: 2px solid #1f3028;
  padding: 0 0 20px 18px;
  margin-bottom: 24px;
}

.report-title-block {
  display: grid;
  gap: 6px;
}

.report-header h2 {
  font-size: 1.7rem;
}

.report-franchise {
  color: var(--muted);
  font-weight: 800;
}

.report-badge {
  min-width: 150px;
  border: 0;
  border-radius: 8px;
  padding: 14px;
  text-align: right;
  background: #eaf4ef;
  color: var(--accent-dark);
}

.report-badge span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.report-badge strong {
  display: block;
  margin-top: 3px;
  font-size: 1.2rem;
}

.report-block {
  margin-top: 22px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.report-block h3 {
  margin-bottom: 12px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
  color: var(--accent-dark);
  font-size: 1rem;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  margin: 0;
}

.report-grid div {
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.report-grid.stacked {
  grid-template-columns: 1fr;
}

#dcProtectionReport,
#acProtectionReport {
  gap: 10px;
}

#dcProtectionReport div,
#acProtectionReport div {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 11px 13px;
  background: #fbfcfa;
  box-shadow: 0 1px 0 rgba(31, 48, 40, 0.04);
  break-inside: avoid;
  page-break-inside: avoid;
}

#dcProtectionReport dt,
#acProtectionReport dt {
  color: var(--accent-dark);
  font-weight: 800;
}

#dcProtectionReport dd,
#acProtectionReport dd {
  margin-top: 6px;
}

.report-grid dd {
  font-size: 0.98rem;
  font-weight: 700;
}

.two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.report-list {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 6px;
  line-height: 1.45;
}

.declaration,
.notes-out {
  line-height: 1.55;
  font-size: 0.98rem;
}

.notes-out {
  margin-top: 10px;
  color: var(--muted);
}

.signature-report {
  margin-top: 42px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.signature-report div {
  min-height: 120px;
  display: grid;
  align-content: end;
  border-bottom: 1.5px solid var(--ink);
  padding-bottom: 9px;
}

.signature-report img {
  max-width: 100%;
  max-height: 100px;
  object-fit: contain;
  object-position: left bottom;
}

.signature-report span:first-child {
  font-weight: 800;
}

.signature-report span:last-child {
  color: var(--muted);
  font-size: 0.82rem;
}

.scanner-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(13, 22, 18, 0.72);
}

.scanner-panel {
  width: min(620px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.scanner-video {
  width: 100%;
  min-height: 320px;
  display: block;
  background: #101a15;
  object-fit: cover;
}

/* Premium solar engineering brand system */
.app-shell {
  width: min(1360px, 100%);
  padding: 28px;
}

.workspace {
  gap: 22px;
}

.summary-panel,
.form-panel,
.report-sheet {
  border-radius: 8px;
  border: 1px solid rgba(28, 28, 28, 0.09);
  box-shadow: var(--shadow);
}

.summary-panel {
  overflow: hidden;
  color: #ffffff;
  background:
    linear-gradient(152deg, rgba(255, 193, 7, 0.12) 0 18%, transparent 18% 100%),
    linear-gradient(145deg, #171717 0%, #2b2b2b 64%, #121212 100%);
  border-color: rgba(255, 193, 7, 0.24);
}

.summary-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  background: linear-gradient(90deg, var(--brand), #ffe58a 42%, var(--accent));
  box-shadow: 0 0 28px rgba(255, 193, 7, 0.34);
}

.summary-panel::after {
  content: "";
  position: absolute;
  right: -76px;
  top: 122px;
  width: 220px;
  height: 360px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 64%);
  transform: skewX(-13deg);
}

.summary-panel > * {
  position: relative;
  z-index: 1;
}

.summary-panel h1 {
  color: #ffffff;
  font-size: clamp(1.75rem, 2.15vw, 2.25rem);
  line-height: 1.08;
  font-weight: 900;
}

.summary-panel .subtitle {
  color: rgba(255, 255, 255, 0.72);
}

.brand-mark {
  width: 76px;
  height: 76px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22), inset 0 -14px 0 rgba(28, 28, 28, 0.12);
}

.brand-mark::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 26px;
  width: 42px;
  height: 28px;
  border: 3px solid var(--ink);
  border-radius: 3px;
  transform: skewX(-12deg);
}

.brand-mark::after {
  content: "";
  position: absolute;
  left: 25px;
  top: 34px;
  width: 28px;
  height: 1px;
  background: var(--ink);
  box-shadow: 0 8px 0 var(--ink), 10px -8px 0 var(--ink), 10px 0 0 var(--ink), 10px 8px 0 var(--ink);
  opacity: 0.86;
}

.sun-core {
  width: 16px;
  height: 16px;
  left: 12px;
  top: 12px;
  background: #ffffff;
  box-shadow: none;
}

.ray {
  display: none;
}

.connection-card,
.live-summary div {
  border-color: rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.045));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.connection-card {
  gap: 18px;
  padding: 20px;
  margin-bottom: 6px;
}

.connection-actions {
  gap: 10px;
  margin-top: 2px;
}

.live-summary {
  margin-top: 20px;
  gap: 16px;
}

.live-summary div {
  min-height: 86px;
  padding: 18px 20px;
}

.summary-panel dd {
  font-size: 1.22rem;
  line-height: 1.18;
}

.connection-card small,
.summary-panel dt {
  color: rgba(255, 255, 255, 0.62);
}

.summary-panel dd {
  color: #ffffff;
}

.mini-button {
  border-color: rgba(255, 255, 255, 0.18);
  background: var(--brand);
  color: var(--ink);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.mini-button:hover {
  transform: translateY(-1px);
  background: var(--brand-dark);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.22);
}

.form-panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 253, 247, 0.98)),
    var(--paper);
}

.form-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: linear-gradient(90deg, var(--brand), #ffe08a 35%, var(--accent));
}

.form-panel::after {
  content: "";
  position: absolute;
  right: -90px;
  top: 96px;
  width: 280px;
  height: 420px;
  border: 1px solid rgba(28, 28, 28, 0.04);
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.06), transparent 62%);
  transform: skewX(-12deg);
  pointer-events: none;
}

.form-panel > * {
  position: relative;
  z-index: 1;
}

.setup-panel,
.auth-panel,
.admin-panel,
.history-section,
.dynamic-section {
  border-color: var(--line);
}

.section-heading h2,
.subsection-heading h3,
.user-menu strong,
.history-card h3 {
  color: var(--ink);
  font-weight: 900;
}

.eyebrow {
  color: var(--accent-dark);
  font-weight: 900;
}

.user-menu {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #fff9e6 100%);
  box-shadow: var(--shadow-soft);
}

.menu-button {
  position: relative;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(28, 28, 28, 0.04);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.menu-button::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--line);
}

.menu-button:hover,
.managed-user-card:hover,
.history-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.menu-button.is-active {
  border-color: rgba(255, 193, 7, 0.75);
  background: #fff9e6;
  box-shadow: 0 10px 24px rgba(245, 180, 0, 0.18);
}

.menu-button.is-active::before {
  background: var(--brand);
}

.managed-user-card,
.history-card,
.detail-card,
.serial-card,
.signature-area,
.history-empty,
.serial-list:empty::before,
.detail-list:empty::before {
  border-color: var(--line);
  background: linear-gradient(180deg, #ffffff, #fffdf7);
  box-shadow: 0 1px 0 rgba(28, 28, 28, 0.04), 0 14px 32px rgba(28, 28, 28, 0.045);
}

.serial-card strong,
.detail-card-header strong {
  background: #fff4cc;
  color: var(--ink);
  border: 1px solid rgba(245, 180, 0, 0.42);
}

label span,
.signature-head span {
  color: var(--ink);
  font-weight: 800;
}

input,
select,
textarea {
  border-color: #d7dde2;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(28, 28, 28, 0.02);
}

input:hover,
select:hover,
textarea:hover {
  border-color: #bcc5ce;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-dark);
  background: #ffffff;
  box-shadow: var(--focus-ring);
}

.unit-input strong {
  background: #fff4cc;
  color: var(--ink);
  border-color: #d7dde2;
}

.primary,
.secondary,
.scan-button,
.icon-button {
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.primary {
  background: linear-gradient(180deg, var(--brand), var(--brand-dark));
  color: var(--ink);
  box-shadow: 0 10px 18px rgba(245, 180, 0, 0.24);
}

.primary:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #ffd24a, var(--brand-dark));
  box-shadow: 0 14px 24px rgba(245, 180, 0, 0.3);
}

.secondary {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}

.secondary:hover {
  transform: translateY(-1px);
  background: var(--charcoal);
  border-color: var(--charcoal);
  box-shadow: 0 10px 18px rgba(28, 28, 28, 0.18);
}

.scan-button,
.icon-button {
  border-color: var(--ink);
  background: #ffffff;
  color: var(--ink);
}

.scan-button:hover,
.icon-button:hover {
  background: #fff4cc;
  border-color: var(--brand-dark);
}

.password-input-row .inline-action {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 42px;
  min-height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: none;
}

.password-input-row .inline-action:hover {
  transform: none;
  background: #fff4cc;
  border-color: rgba(245, 180, 0, 0.55);
  box-shadow: none;
}

.eye-icon {
  position: relative;
  width: 24px;
  height: 16px;
  display: inline-block;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: #ffffff;
}

.eye-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.eye-icon::after {
  content: "";
  position: absolute;
  left: -4px;
  top: 6px;
  width: 30px;
  height: 3px;
  border-radius: 999px;
  background: #b42318;
  opacity: 1;
  transform: rotate(-35deg);
  box-shadow: 0 0 0 1px #ffffff;
}

.inline-action:not(.is-hidden) .eye-icon::after {
  opacity: 0;
}

button:disabled,
input:disabled {
  cursor: progress;
  opacity: 0.68;
}

select:disabled {
  cursor: not-allowed;
  opacity: 1;
  color: var(--ink);
  background: #fff9e6;
}

.signature-head {
  background: #fafafa;
}

.check-row input {
  accent-color: var(--brand-dark);
}

.scanner-overlay {
  background: rgba(28, 28, 28, 0.76);
}

.scanner-panel {
  border: 1px solid rgba(255, 193, 7, 0.25);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
}

.scanner-video {
  background: #101010;
}

.login-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(245, 245, 245, 0.72);
  backdrop-filter: blur(8px);
}

.login-spinner {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 5px solid rgba(28, 28, 28, 0.12);
  border-top-color: var(--brand);
  border-right-color: var(--ink);
  animation: solar-spin 0.78s linear infinite;
  box-shadow: 0 12px 28px rgba(28, 28, 28, 0.16);
}

@keyframes solar-spin {
  to {
    transform: rotate(360deg);
  }
}

.report-view {
  margin-top: 24px;
}

.report-toolbar {
  max-width: 980px;
  margin: 0 auto 14px;
}

.report-sheet {
  max-width: 980px;
  padding: 0;
  overflow: hidden;
  background: #ffffff;
}

.report-cover {
  position: relative;
  min-height: 720px;
  padding: 48px;
  overflow: hidden;
  color: #ffffff;
  background:
    linear-gradient(135deg, #1c1c1c 0%, #2b2b2b 70%, #111111 100%);
  page-break-after: always;
  break-after: page;
}

.report-cover::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 8px;
  background: linear-gradient(90deg, var(--brand), var(--brand-dark), var(--accent));
}

.report-cover::after {
  content: "";
  position: absolute;
  right: 48px;
  bottom: 48px;
  width: 240px;
  height: 150px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.18), rgba(255, 255, 255, 0.05));
  transform: skewX(-10deg);
}

.report-cover-brand,
.report-cover-content,
.report-cover-meta {
  position: relative;
  z-index: 1;
}

.report-cover-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.report-logo-mark {
  position: relative;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: inline-block;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: inset 0 -10px 0 rgba(28, 28, 28, 0.14);
}

.report-logo-mark::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 15px;
  width: 24px;
  height: 16px;
  border: 2px solid var(--ink);
  border-radius: 2px;
  transform: skewX(-12deg);
}

.report-cover-brand strong {
  display: block;
  font-size: 1.18rem;
  font-weight: 900;
}

.report-cover-brand span {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.82rem;
}

.report-cover-content {
  max-width: 640px;
  margin-top: 120px;
}

.report-cover-content .eyebrow {
  color: var(--brand);
}

.report-cover-content h2 {
  margin-top: 10px;
  color: #ffffff;
  font-size: clamp(2.5rem, 7vw, 4.8rem);
  line-height: 0.98;
}

.report-cover-content p:last-child {
  margin-top: 18px;
  max-width: 62ch;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.6;
}

.report-cover-meta {
  margin: 104px 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 680px;
}

.report-cover-meta div {
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.report-cover-meta dt {
  color: var(--brand);
}

.report-cover-meta dd {
  color: #ffffff;
  font-size: 1rem;
}

.report-header,
.report-block,
.signature-report,
.report-document-footer {
  margin-left: 38px;
  margin-right: 38px;
}

.report-header {
  padding: 34px 0 22px;
  border-bottom: 2px solid var(--ink);
}

.report-header h2 {
  font-size: 1.9rem;
  color: var(--ink);
}

.report-badge {
  background: linear-gradient(180deg, var(--brand), var(--brand-dark));
  color: var(--ink);
  box-shadow: 0 10px 20px rgba(245, 180, 0, 0.18);
}

.report-badge span {
  color: rgba(28, 28, 28, 0.72);
  font-weight: 900;
}

.report-block {
  margin-top: 24px;
}

.report-block h3 {
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  font-size: 1.06rem;
}

.executive-summary,
.recommendations-block {
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand);
  border-radius: 8px;
  background: #fafafa;
}

.recommendations-block {
  border-left-color: var(--accent);
}

.executive-summary p,
.recommendations-block p,
.recommendations-list,
.declaration {
  line-height: 1.6;
}

.report-kpis {
  margin: 16px 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.report-kpis div,
.report-grid div {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 12px 14px;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(28, 28, 28, 0.04);
}

.report-kpis dd {
  color: var(--ink);
  font-size: 1.2rem;
}

#dcProtectionReport div,
#acProtectionReport div {
  border-left-color: var(--brand);
  background: #fffdf6;
}

.recommendations-list {
  margin: 12px 0 0;
  padding-left: 20px;
}

.signature-report {
  padding-top: 8px;
}

.report-document-footer {
  margin-top: 26px;
  padding: 14px 0 26px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 900px) {
  .app-shell {
    padding: 12px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    position: static;
    min-height: auto;
  }

  .live-summary {
    margin-top: 20px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .form-panel,
  .report-sheet,
  .summary-panel {
    padding: 18px;
  }

  .section-heading {
    display: grid;
    justify-content: start;
    align-items: start;
    gap: 4px;
  }

  .field-grid,
  .auth-grid,
  .history-controls,
  .managed-user-card,
  .managed-user-controls,
  .serial-list,
  .compact-list,
  .location-input-row,
  .password-input-row,
  .report-cover-meta,
  .report-kpis,
  .report-grid,
  .two-columns,
  .signature-report {
    grid-template-columns: 1fr;
  }

  .serial-input-row {
    grid-template-columns: 1fr;
  }

  input[type="date"],
  input[type="time"] {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    -webkit-appearance: none;
    appearance: none;
  }

  input[type="date"]::-webkit-date-and-time-value,
  input[type="time"]::-webkit-date-and-time-value {
    min-width: 0;
    text-align: left;
  }

  input[type="date"]::-webkit-calendar-picker-indicator,
  input[type="time"]::-webkit-calendar-picker-indicator {
    margin-left: auto;
  }

  .battery-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .inverter-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .battery-card label,
  .inverter-card label {
    grid-column: 2;
  }

  .live-summary {
    grid-template-columns: 1fr;
  }

  .actions,
  .report-toolbar,
  .admin-submenu,
  .connection-actions,
  .field-command,
  .user-menu,
  .user-menu-actions,
  .managed-user-actions,
  .history-actions,
  .history-card {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary,
  .secondary {
    width: 100%;
  }

  .report-header {
    display: grid;
  }

  .report-badge {
    text-align: left;
  }

  .report-cover {
    min-height: auto;
    padding: 34px 22px;
  }

  .report-cover-content {
    margin-top: 70px;
  }

  .report-cover-meta {
    margin-top: 54px;
  }

  .report-cover::after {
    width: 160px;
    height: 100px;
    right: 22px;
    bottom: 28px;
  }

  .report-header,
  .report-block,
  .signature-report,
  .report-document-footer {
    margin-left: 18px;
    margin-right: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  @page {
    margin: 14mm;
    @bottom-left {
      content: "Conforme de instalación solar";
    }
    @bottom-right {
      content: "Página " counter(page);
    }
  }

  body {
    background: #ffffff;
  }

  .workspace,
  .report-toolbar {
    display: none !important;
  }

  .app-shell,
  .report-view {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  #reportView {
    display: block !important;
  }

  .report-sheet {
    box-shadow: none;
    border: 0;
    border-radius: 0;
    max-width: none;
    padding: 0;
    overflow: visible;
    background: #ffffff;
  }

  .report-cover {
    min-height: 250mm;
    padding: 24mm 18mm;
  }

  .report-header {
    padding-left: 0;
  }

  .report-header,
  .report-block,
  .signature-report,
  .report-document-footer {
    margin-left: 0;
    margin-right: 0;
  }
}
