:root {
  color-scheme: light;
  --bg: #f2f7f9;
  --surface: #ffffff;
  --surface-strong: #eef7f8;
  --ink: #10263a;
  --muted: #627583;
  --line: #d5e3e8;
  --brand-blue: #0757a8;
  --brand-teal: #10afa6;
  --accent: var(--brand-teal);
  --accent-strong: var(--brand-blue);
  --accent-rgb: 16, 175, 166;
  --black: #0757a8;
  --warn: #c1533f;
  --blue: #0757a8;
  --shadow: 0 18px 45px rgba(16, 38, 58, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.10), rgba(242, 247, 249, 0) 330px),
    var(--bg);
  color: var(--ink);
  font-family: "Helvetica Neue", Arial, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar,
.section-head,
.chart-head,
.auth-panel,
.camera-panel,
.load-panel,
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  position: relative;
  overflow: hidden;
  margin-bottom: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--black);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.topbar::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 4px;
  background: var(--accent);
}

.brand-lockup {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  flex: 0 0 auto;
  width: 74px;
  height: 50px;
}

.brand-frame,
.brand-stripe {
  position: absolute;
  top: 5px;
  height: 40px;
  transform: skew(-31deg);
}

.brand-frame {
  width: 18px;
  border: 3px solid var(--black);
  background: #ffffff;
}

.brand-frame-one {
  left: 7px;
}

.brand-frame-two {
  left: 38px;
}

.brand-stripe {
  z-index: 2;
  top: -1px;
  left: 27px;
  width: 15px;
  height: 52px;
  background: var(--accent);
}

.brand-name {
  margin: 0 0 4px;
  color: var(--black);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  color: var(--black);
  font-size: clamp(1.95rem, 3.8vw, 3.35rem);
  font-weight: 900;
  line-height: 1.02;
}

h2 {
  font-size: 1.08rem;
}

.status-pill,
.inline-status {
  color: var(--muted);
  font-size: 0.92rem;
}

.status-pill {
  min-width: 180px;
  padding: 10px 14px;
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  border-radius: 8px;
  background: #f0fbfa;
  color: var(--accent-strong);
  font-weight: 850;
  text-align: center;
}

.setup-panel,
.auth-panel,
.camera-panel,
.load-panel,
.filter-bar,
.chart-block,
.manual-event-tools,
.event-range-panel,
.event-panel,
.change-control {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.setup-panel,
.auth-panel,
.camera-panel,
.load-panel {
  padding: 20px;
}

.auth-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

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

.auth-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

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

.camera-panel {
  margin-bottom: 14px;
}

.camera-panel-pro {
  display: block;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(var(--accent-rgb), 0.12), transparent 260px),
    var(--surface);
}

.camera-panel-pro::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--black), var(--accent));
}

.camera-panel-header,
.camera-body {
  position: relative;
  z-index: 1;
}

.camera-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.camera-body {
  display: grid;
  grid-template-columns: minmax(260px, 430px) 1fr;
  gap: 16px;
  margin-top: 18px;
}

.camera-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.camera-summary .message {
  grid-column: 1 / -1;
  margin: 0;
  padding: 14px;
  border: 1px dashed #b8c7cd;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.camera-summary-card {
  min-height: 76px;
  padding: 13px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 24px rgba(23, 33, 38, 0.06);
}

.camera-summary-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.camera-summary-value {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.camera-summary-value.accent-value {
  color: var(--accent-strong);
}

.camera-select-label {
  width: 100%;
}

.camera-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.camera-actions .primary-action {
  flex: 0 0 auto;
}

.camera-modal {
  width: min(620px, 100%);
}

.load-panel {
  margin-top: 14px;
}

.load-panel.is-disabled {
  opacity: 0.68;
}

.load-preview {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.load-preview-title {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.load-preview-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 12px;
  background: rgba(246, 251, 252, 0.92);
}

.load-preview-label {
  margin: 0;
  color: #66716c;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.load-preview-value {
  margin: 0;
  color: #121815;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.load-preview-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.load-preview-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  max-width: 100%;
  padding: 6px 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 999px;
  background: #ffffff;
  color: #075d8f;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: normal;
  text-align: center;
  overflow-wrap: anywhere;
}

.load-compact-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.load-compact-item {
  display: grid;
  gap: 5px;
  min-height: 0;
  padding: 12px 14px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 12px;
  background: rgba(246, 251, 252, 0.92);
}

.load-compact-label {
  color: #66716c;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.load-compact-value {
  color: #121815;
  font-size: 0.92rem;
  line-height: 1.25;
}

.loaded-logger-detail {
  display: grid;
  gap: 14px;
  margin-top: 0;
  padding: 18px;
}

.loaded-logger-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.loaded-logger-detail-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.65fr) repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.load-compact-summary[hidden],
.loaded-logger-detail[hidden] {
  display: none;
}

.loaded-logger-detail-grid > .message {
  grid-column: 1 / -1;
}

.camera-panel.is-disabled,
.setup-panel.is-disabled {
  opacity: 0.7;
}

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

.compact-grid {
  margin-top: 0;
}

fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

legend {
  padding: 0 6px;
  color: var(--ink);
  font-weight: 800;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.range-label-text {
  display: flex;
  align-items: flex-start;
  min-height: 2.6em;
  line-height: 1.25;
}

input,
select,
textarea {
  min-height: 42px;
  width: 100%;
  border: 1px solid #c9d4d9;
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.16);
}

.primary-action,
.secondary-action {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 9px 14px;
  font-weight: 800;
}

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

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

.danger-action {
  background: var(--warn);
  color: #ffffff;
}

.danger-action:hover {
  background: #9f3f30;
  color: #ffffff;
}

.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-color: #c9d4d9;
  color: var(--ink);
}

.secondary-action:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.primary-action:disabled,
.secondary-action:disabled,
.file-button.is-disabled {
  cursor: not-allowed;
  color: #91a0a8;
  border-color: #d9e1e5;
  background: #f3f6f7;
}

.compact {
  min-width: 132px;
}

.load-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-left: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.dashboard {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.filter-bar {
  padding: 16px;
  flex-wrap: wrap;
}

.filter-bar label {
  min-width: min(260px, 100%);
  flex: 1;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.summary-item {
  min-height: 88px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.08), rgba(255, 255, 255, 0) 42%),
    #ffffff;
}

.summary-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.summary-value {
  margin: 0;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 850;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.manual-event-tools,
.report-tools,
.event-range-panel {
  padding: 18px;
}

.manual-event-tools,
.report-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.report-tools-pro {
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.12), rgba(255, 255, 255, 0) 55%),
    var(--surface);
}

.report-tools-copy {
  margin: 8px 0 0;
  max-width: 680px;
  line-height: 1.45;
}

.report-action {
  min-width: 190px;
  box-shadow: 0 12px 24px rgba(var(--accent-rgb), 0.18);
}

.manual-event-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.event-range-panel {
  display: grid;
  gap: 12px;
}

.nested-chart {
  box-shadow: none;
}

.event-range-panel canvas {
  height: 300px;
}


.event-window-config,
.event-window-list {
  display: grid;
  gap: 12px;
}

.event-window-card,
.report-event-window-card {
  padding: 14px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 9px;
  background: rgba(238, 247, 248, 0.82);
}

.event-window-card h3,
.report-event-window-card h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 0.94rem;
}

.event-window-list .message {
  margin: 0;
  padding: 12px;
  border: 1px dashed #b8c7cd;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.report-event-window-card .range-grid {
  margin-top: 0;
}

.event-transition-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.event-transition-heading {
  margin: 0;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 850;
}

.event-transition-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.event-transition-item strong {
  color: var(--ink);
}

.chart-block {
  padding: 18px 18px 12px;
}

.chart-head {
  align-items: center;
  margin-bottom: 12px;
}

.chart-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #1d2c78;
  font-size: 1.08rem;
  font-weight: 850;
  line-height: 1.2;
}

.chart-title::before {
  content: "";
  width: 18px;
  height: 28px;
  flex: 0 0 18px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.chart-title--temperature::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 28' fill='none'%3E%3Cpath d='M8 3a3 3 0 116 0v11.4a6 6 0 11-6 0V3z' stroke='%235265d5' stroke-width='1.8'/%3E%3Cpath d='M11 8v9' stroke='%235265d5' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='11' cy='20' r='3' fill='%235265d5'/%3E%3C/svg%3E");
}

.chart-title--humidity::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 28' fill='none'%3E%3Cpath d='M9 3c2.5 4 6 7.4 6 12a6 6 0 11-12 0c0-4.6 3.5-8 6-12z' stroke='%2358c6c2' stroke-width='1.8'/%3E%3Cpath d='M12 18a3 3 0 01-3 3' stroke='%2358c6c2' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
}

.chart-title-unit {
  color: #6f7ec4;
  font-weight: 700;
}

.chart-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px 18px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 22px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #5a6ea8;
  font-size: 0.8rem;
  font-weight: 760;
  background: transparent;
}

.legend-swatch {
  position: relative;
  width: 18px;
  height: 0;
  border-top: 3px solid var(--swatch-color, #62717a);
  border-radius: 999px;
}

.legend-swatch[data-stroke-style="dashed"] {
  border-top-style: dashed;
}

.legend-swatch[data-stroke-style="dotted"] {
  border-top-style: dotted;
}

canvas {
  display: block;
  width: 100%;
  height: 360px;
}

@media (max-width: 900px) {
  .chart-head {
    align-items: flex-start;
  }

  .chart-tools,
  .legend {
    justify-content: flex-start;
  }
}

.event-panel {
  padding: 18px;
}

.change-control {
  margin-top: 14px;
  padding: 18px;
}

.change-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.change-item {
  position: relative;
  padding: 14px 14px 14px 17px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #ffffff;
}

.change-item::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 0;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: var(--accent);
}

.change-item h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
}

.change-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.change-item strong {
  color: var(--ink);
}

.event-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.event-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.event-card h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.event-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.event-meta-item {
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-strong);
}

.event-meta-item span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.event-meta-item strong {
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.25;
}

.event-card canvas {
  height: 260px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 38, 58, 0.46);
}

.event-modal {
  display: grid;
  gap: 16px;
  width: min(440px, 100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 55px rgba(16, 38, 58, 0.22);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.tooltip {
  position: fixed;
  z-index: 20;
  max-width: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 30px rgba(16, 38, 58, 0.14);
  color: var(--ink);
  font-size: 0.86rem;
  pointer-events: none;
}

.tooltip strong {
  display: block;
  margin-bottom: 5px;
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.message {
  color: var(--muted);
}

.error {
  color: var(--warn);
}


.report-modal {
  width: min(620px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  overscroll-behavior: contain;
  align-content: start;
}

.report-modal .modal-actions {
  position: sticky;
  bottom: -20px;
  z-index: 2;
  margin: 4px -20px -20px;
  padding: 14px 20px 20px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), #ffffff 34%);
}

.report-modal select[multiple] {
  min-height: 132px;
  padding: 8px;
}

.report-modal option {
  padding: 6px 8px;
}

.report-tools #openReportModal {
  min-width: 180px;
}

@media (max-width: 780px) {
  .app-shell {
    width: min(100% - 22px, 1180px);
    padding-top: 18px;
  }

  .topbar,
  .section-head,
  .auth-panel,
  .auth-actions,
  .camera-panel,
  .manual-event-tools,
  .report-tools,
  .manual-event-actions,
  .load-panel,
  .chart-head {
    align-items: stretch;
    flex-direction: column;
  }

  .status-pill {
    min-width: 0;
    text-align: left;
  }

  .brand-lockup,
  .topbar-actions {
    width: 100%;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .topbar-actions > * {
    flex: 1 1 180px;
  }

  .range-grid,
  .auth-grid,
  fieldset,
  .summary-grid,
  .camera-body,
  .camera-summary {
    grid-template-columns: 1fr;
  }

  .camera-panel-header {
    flex-direction: column;
  }

  .camera-actions,
  .load-actions {
    width: 100%;
    margin-left: 0;
  }

  .camera-actions > *,
  .load-actions > * {
    flex: 1 1 180px;
  }

  .auth-actions > * {
    flex: 1 1 160px;
  }

  .manual-event-actions > *,
  .report-tools > button {
    flex: 1 1 220px;
  }

  .chart-tools,
  .legend {
    justify-content: flex-start;
  }

  .event-meta {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  canvas {
    height: 320px;
  }

  .event-card canvas {
    height: 260px;
  }
}


.event-range-charts {
  display: grid;
  gap: 18px;
}

.event-range-event {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #f6fbfc);
}

.event-range-event-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.event-range-event-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.event-range-event-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.event-range-event-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.event-range-event-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.event-range-event .nested-chart {
  background: #ffffff;
}

@media (max-width: 780px) {
  .event-range-event {
    padding: 12px;
  }
}


.event-log-summary {
  display: grid;
  gap: 12px;
  margin-top: 6px;
  padding-top: 4px;
}

.event-log-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.event-log-summary-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.06rem;
}

.event-log-summary-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.event-log-summary-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(41, 167, 120, 0.10);
  border: 1px solid rgba(41, 167, 120, 0.18);
  color: #1b8a60;
  font-size: 0.82rem;
  font-weight: 800;
}

.event-log-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.event-log-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: #4b6188;
  font-size: 0.96rem;
  font-weight: 700;
}

.event-log-tab.is-active {
  border-color: rgba(11, 99, 229, 0.42);
  box-shadow: inset 0 0 0 1px rgba(11, 99, 229, 0.18);
  color: #0b63e5;
}

.event-log-tab-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #b8c3d0;
  flex: 0 0 12px;
}

.event-log-tab[data-status="ok"] .event-log-tab-dot {
  background: #45c15a;
}

.event-log-tab[data-status="alert"] .event-log-tab-dot {
  background: #e15656;
}

.event-log-tab[data-status="empty"] .event-log-tab-dot {
  background: #aeb8c4;
}

.event-log-detail {
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 16px;
  overflow: hidden;
  background: #ffffff;
}

.event-log-detail-status {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.14);
  background: linear-gradient(180deg, rgba(16, 175, 166, 0.08), rgba(16, 175, 166, 0.04));
}

.event-log-detail.is-alert .event-log-detail-status {
  background: linear-gradient(180deg, rgba(225, 86, 86, 0.10), rgba(225, 86, 86, 0.04));
}

.event-log-detail.is-empty .event-log-detail-status {
  background: linear-gradient(180deg, rgba(122, 135, 153, 0.10), rgba(122, 135, 153, 0.04));
}

.event-log-detail-status-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #1b8a60;
  font-size: 1.4rem;
  font-weight: 900;
  flex: 0 0 44px;
}

.event-log-detail.is-alert .event-log-detail-status-icon {
  color: #c94d4d;
}

.event-log-detail.is-empty .event-log-detail-status-icon {
  color: #6f7e91;
}

.event-log-detail-status-text {
  display: grid;
  gap: 6px;
}

.event-log-detail-status-text strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.event-log-detail-status-text span {
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 700;
}

.event-log-detail-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0;
}

.event-log-metric {
  display: grid;
  gap: 8px;
  padding: 18px 20px;
}

.event-log-metric + .event-log-metric {
  border-left: 1px solid rgba(var(--accent-rgb), 0.14);
}

.event-log-metric-label {
  color: #5d6d83;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.event-log-metric strong {
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.35;
}

.event-log-metric small {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .event-log-detail-metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .event-log-metric + .event-log-metric {
    border-left: 0;
    border-top: 1px solid rgba(var(--accent-rgb), 0.14);
  }
}

.field-block {
  display: grid;
  gap: 8px;
}

.field-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.check-list {
  display: grid;
  gap: 8px;
  max-height: 210px;
  overflow: auto;
  padding: 8px;
  border: 1px solid #c9d4d9;
  border-radius: 9px;
  background: #f6fbfc;
}

.check-option {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
}

.check-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.check-tick {
  position: relative;
  width: 22px;
  height: 22px;
  border: 2px solid #b9c7cd;
  border-radius: 6px;
  background: #ffffff;
}

.check-option input:checked + .check-tick {
  border-color: var(--accent);
  background: var(--accent);
}

.check-option input:checked + .check-tick::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 12px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.check-option:has(input:checked) {
  border-color: rgba(var(--accent-rgb), 0.42);
  background: rgba(var(--accent-rgb), 0.06);
}

.check-text {
  overflow-wrap: anywhere;
}

.check-list-empty {
  margin: 0;
  padding: 10px;
}

.alias-modal {
  width: min(720px, 100%);
}

.alias-list {
  display: grid;
  gap: 10px;
  max-height: min(54vh, 460px);
  overflow: auto;
  padding-right: 4px;
}

.alias-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.9fr);
  gap: 14px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f6fbfc;
}

.alias-log-name {
  margin: 0 0 4px;
  color: var(--ink);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.alias-hint {
  margin: 0;
  font-size: 0.78rem;
}

@media (max-width: 780px) {
  .alias-row {
    grid-template-columns: 1fr;
  }
}


/* Pantalla inicial de login: bloquea visualmente toda la aplicación hasta iniciar sesión. */
body.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 8%, rgba(var(--accent-rgb), 0.18), transparent 290px),
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.10), rgba(242, 247, 249, 0) 380px),
    var(--bg);
}

body.auth-screen .app-shell {
  width: min(480px, 100%);
  margin: 0;
  padding: 0;
}

body.auth-screen .app-shell > :not(#authPanel) {
  display: none !important;
}

.auth-panel-lock {
  display: grid;
  gap: 18px;
}

body.auth-screen #authPanel {
  width: 100%;
  margin: 0;
  padding: 26px;
  border-top: 5px solid var(--black);
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.12), rgba(255, 255, 255, 0) 58%),
    var(--surface);
}

.auth-card-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.auth-card-brand .brand-mark {
  width: 64px;
  height: 44px;
}

.auth-card-brand .brand-frame {
  height: 34px;
}

.auth-card-brand .brand-stripe {
  height: 46px;
}

.auth-card-brand h1 {
  font-size: clamp(1.85rem, 8vw, 2.65rem);
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-heading {
  display: grid;
  gap: 5px;
}

.auth-heading .message {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

body.auth-screen .auth-grid {
  grid-template-columns: 1fr;
  margin-top: 0;
}

body.auth-screen .auth-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

body.auth-screen .auth-actions .primary-action,
body.auth-screen .auth-actions .secondary-action {
  width: 100%;
}

body.auth-screen .auth-footer {
  justify-content: center;
  text-align: center;
}

body.is-authenticated {
  display: block;
  padding: 0;
}

@media (max-width: 620px) {
  body.auth-screen {
    padding: 14px;
  }

  body.auth-screen #authPanel {
    padding: 22px;
  }

  .auth-card-brand {
    align-items: flex-start;
  }
}

/* Paso 5: certificados de calibración */
.certificate-panel {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.10), rgba(255, 255, 255, 0) 58%),
    var(--surface);
  box-shadow: var(--shadow);
}

.certificate-panel.is-disabled {
  opacity: 0.68;
}

.certificate-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.certificate-copy {
  max-width: 720px;
  margin: 8px 0 0;
  line-height: 1.45;
}

.certificate-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

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

.certificate-list .message {
  margin: 0;
  padding: 14px;
  border: 1px dashed #b8c7cd;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.certificate-card {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(180px, 0.75fr) minmax(150px, 0.55fr);
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 24px rgba(23, 33, 38, 0.06);
}

.certificate-name {
  margin: 0 0 4px;
  color: var(--ink);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.certificate-meta,
.certificate-match,
.certificate-hash {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.certificate-match strong {
  display: block;
  margin-bottom: 3px;
  color: var(--accent-strong);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}


.certificate-validity span {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 900;
}

.certificate-validity-valid span {
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent-strong);
}

.certificate-validity-expired span {
  border: 1px solid rgba(193, 83, 63, 0.32);
  background: rgba(193, 83, 63, 0.12);
  color: #9f3f30;
}

.certificate-validity-unknown span {
  border: 1px solid #d9e1e5;
  background: #f3f6f7;
  color: var(--muted);
}

.certificate-hash {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.certificate-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.certificate-discard {
  min-height: 28px;
  border: 1px solid rgba(193, 83, 63, 0.32);
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(193, 83, 63, 0.08);
  color: #9f3f30;
  font-size: 0.74rem;
  font-weight: 900;
}

.certificate-discard:hover {
  background: #9f3f30;
  color: #ffffff;
}

@media (max-width: 780px) {
  .certificate-head {
    flex-direction: column;
  }

  .certificate-actions {
    width: 100%;
    margin-left: 0;
  }

  .certificate-actions > * {
    flex: 1 1 220px;
  }

  .certificate-card {
    grid-template-columns: 1fr;
  }
}


.test-conclusion-box {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(var(--accent-rgb), 0.26);
  border-radius: 9px;
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.10), rgba(255,255,255,0) 58%),
    #ffffff;
}

.test-conclusion-box h3 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
}

.test-conclusion-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.test-conclusion-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(238, 247, 248, 0.82);
}

.test-conclusion-item h4 {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 900;
}

.test-conclusion-item p {
  margin: 0;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.42;
}


/* Anticipo conclusiones en tabla compacta */
.test-conclusion-box {
  margin-top: 10px;
  padding: 12px;
}

.test-conclusion-box h3 {
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.test-conclusion-list {
  display: block;
  overflow-x: auto;
}

.test-conclusion-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.test-conclusion-table th,
.test-conclusion-table td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.84rem;
  line-height: 1.2;
  white-space: nowrap;
}

.test-conclusion-table thead th {
  background: var(--black);
  color: #ffffff;
  font-weight: 900;
}

.test-conclusion-table tbody th {
  color: var(--accent-strong);
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
}

.test-conclusion-table tbody tr:last-child th,
.test-conclusion-table tbody tr:last-child td {
  border-bottom: 0;
}

.test-conclusion-table td {
  text-align: center;
  font-variant-numeric: tabular-nums;
}


/* Alineación columnas anticipo conclusiones */
.test-conclusion-table thead th:first-child,
.test-conclusion-table tbody th {
  text-align: left;
}

.test-conclusion-table thead th:not(:first-child),
.test-conclusion-table tbody td {
  text-align: center;
}

.test-conclusion-table th,
.test-conclusion-table td {
  vertical-align: middle;
}


.report-conclusions-block {
  display: grid;
  gap: 8px;
}

.report-conclusions-block textarea {
  min-height: 92px;
  line-height: 1.45;
}


/* Acordeón seguro para certificados: no modifica la lógica de login ni de carga */
.certificate-safe-accordion {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(16, 38, 58, 0.06);
  overflow: hidden;
}

.certificate-safe-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 14px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 900;
  list-style: none;
  user-select: none;
}

.certificate-safe-summary::-webkit-details-marker {
  display: none;
}

.certificate-safe-plus {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--black);
  color: #ffffff;
  font-weight: 900;
}

.certificate-safe-plus::before {
  content: "+";
  font-size: 1.2rem;
  line-height: 1;
}

.certificate-safe-accordion[open] .certificate-safe-plus {
  background: var(--accent-strong);
}

.certificate-safe-accordion[open] .certificate-safe-plus::before {
  content: "−";
}

.certificate-safe-accordion #certList {
  padding: 0 14px 14px;
  background: rgba(238, 247, 248, 0.55);
}

.certificate-safe-accordion #certList > .message {
  margin-top: 12px;
}


/* Resumen superior más compacto */
.summary-grid {
  gap: 9px;
}

.summary-item {
  min-height: 68px;
  padding: 11px 13px;
}

.summary-label {
  margin-bottom: 5px;
  font-size: 0.68rem;
  line-height: 1.1;
}

.summary-value {
  font-size: clamp(0.82rem, 1.15vw, 0.98rem);
  line-height: 1.22;
  font-weight: 850;
}

@media (min-width: 900px) {
  .summary-item {
    min-height: 72px;
  }
}


/* Resumen superior ultracompacto */
.summary-grid {
  gap: 8px;
}

.summary-item {
  min-height: 52px;
  padding: 8px 10px;
}

.summary-label {
  margin-bottom: 4px;
  font-size: 0.58rem;
  line-height: 1;
  letter-spacing: 0.01em;
}

.summary-value {
  font-size: clamp(0.66rem, 0.86vw, 0.78rem);
  line-height: 1.16;
  font-weight: 800;
}

@media (min-width: 900px) {
  .summary-item {
    min-height: 56px;
  }
}


/* Página completa para generar informe */
#reportModal.modal-backdrop:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: block;
  overflow-y: auto;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.10), rgba(242, 247, 249, 0) 330px),
    var(--bg);
}

#reportModal .event-modal {
  width: min(1120px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  padding: 24px;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

#reportModal .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 18px -24px -24px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

#reportModal .field-block,
#reportModal .event-window-list,
#reportModal .check-list {
  max-width: none;
}

#reportModal textarea {
  min-height: 120px;
}

@media (max-width: 720px) {
  #reportModal .event-modal {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  #reportModal .modal-actions {
    margin-left: -24px;
    margin-right: -24px;
  }
}


/* Ocultar botón auxiliar de evento de humedad: se conserva en DOM para no tocar la lógica */
#humCreateEvent[hidden] {
  display: none !important;
}


#tempChart {
  cursor: crosshair;
}

#tempChart.is-selecting-event {
  cursor: grabbing;
}


.report-images-block {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-strong);
}

.report-images-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.report-images-help {
  margin: 6px 0 0;
  font-size: 0.86rem;
}

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

.report-image-list {
  display: grid;
  gap: 8px;
}

.report-image-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.report-image-item img {
  width: 54px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.report-image-text {
  min-width: 0;
}

.report-image-text h3 {
  margin: 0 0 3px;
  font-size: 0.92rem;
  line-height: 1.18;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-image-text p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

@media (max-width: 640px) {
  .report-images-head {
    display: grid;
  }

  .report-image-item {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .report-image-item button {
    grid-column: 1 / -1;
  }
}


/* Modal de nombre de imagen por encima de la página de informe */
#reportImageNameModal.modal-backdrop {
  z-index: 120;
}


/* Logo ClimaValid */
.brand-logo {
  width: 162px;
  max-width: 38vw;
  height: auto;
  display: block;
  flex: 0 0 auto;
}

.auth-card-brand .brand-logo {
  width: 150px;
  max-width: 48vw;
}

.brand-lockup {
  align-items: center;
}

@media (max-width: 640px) {
  .brand-logo {
    width: 132px;
  }

  .auth-card-brand .brand-logo {
    width: 132px;
  }
}


/* Título principal más profesional */
.product-title,
.product-title-inline {
  display: inline-grid;
  gap: 0.02em;
}

.product-title span,
.product-title-inline span {
  display: block;
}

.product-title {
  max-width: 8.4em;
  font-size: clamp(2.3rem, 5vw, 4.35rem);
  line-height: 0.94;
  letter-spacing: 0;
  font-weight: 800;
  text-wrap: balance;
  margin: 0;
}

.brand-copy .product-title,
.auth-copy .product-title {
  margin-top: 0.04em;
}

.brand-copy h1.product-title,
.auth-copy h1.product-title {
  text-wrap: balance;
}

.brand-copy {
  align-self: center;
}

.auth-card .product-title {
  font-size: clamp(2.1rem, 4.7vw, 4.15rem);
  max-width: 8.1em;
}

.page-header .product-title,
.app-header .product-title,
.hero .product-title {
  max-width: 8.8em;
  font-size: clamp(2rem, 4.3vw, 3.65rem);
  line-height: 0.96;
}

@media (max-width: 900px) {
  .product-title,
  .auth-card .product-title,
  .page-header .product-title,
  .app-header .product-title,
  .hero .product-title {
    max-width: 8.9em;
    font-size: clamp(2rem, 6vw, 3.2rem);
  }
}

@media (max-width: 640px) {
  .product-title,
  .auth-card .product-title,
  .page-header .product-title,
  .app-header .product-title,
  .hero .product-title {
    max-width: 9.2em;
    font-size: clamp(1.8rem, 8vw, 2.55rem);
    line-height: 0.98;
    letter-spacing: 0;
  }
}


/* Ajuste elegante del título principal: una sola línea */
.product-title,
.product-title-inline {
  display: block;
  max-width: none;
  white-space: nowrap;
  letter-spacing: 0;
}

.product-title span,
.product-title-inline span {
  display: inline;
}

.product-title span + span,
.product-title-inline span + span {
  margin-left: 0.22em;
}

.product-title {
  font-size: clamp(1.75rem, 3vw, 3rem);
  line-height: 0.98;
  font-weight: 800;
  margin: 0;
}

.auth-card .product-title {
  font-size: clamp(1.7rem, 2.8vw, 2.85rem);
}

.page-header .product-title,
.app-header .product-title,
.hero .product-title,
.brand-copy .product-title,
.auth-copy .product-title {
  font-size: clamp(1.65rem, 2.5vw, 2.65rem);
  line-height: 1;
}

@media (max-width: 1200px) {
  .product-title,
  .auth-card .product-title,
  .page-header .product-title,
  .app-header .product-title,
  .hero .product-title,
  .brand-copy .product-title,
  .auth-copy .product-title {
    font-size: clamp(1.4rem, 2.8vw, 2.2rem);
  }
}

@media (max-width: 900px) {
  .product-title,
  .auth-card .product-title,
  .page-header .product-title,
  .app-header .product-title,
  .hero .product-title,
  .brand-copy .product-title,
  .auth-copy .product-title {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
  }
}


/* Corrección final de marca y título: compacto, contenido y elegante */
.brand-lockup,
.auth-card-brand {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(14px, 2vw, 28px);
}

.auth-card-brand {
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
}

.brand-logo {
  width: clamp(112px, 13vw, 164px);
  max-width: 100%;
}

.auth-card-brand .brand-logo {
  width: clamp(116px, 15vw, 172px);
}

.brand-lockup > div,
.auth-card-brand > div {
  min-width: 0;
}

.brand-name {
  font-size: clamp(0.64rem, 1vw, 0.82rem);
  letter-spacing: 0.14em;
  margin-bottom: 6px;
}

.product-title,
.product-title-inline {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0;
}

.product-title span,
.product-title-inline span {
  display: inline;
}

.product-title span + span,
.product-title-inline span + span {
  margin-left: 0.2em;
}

.product-title,
.auth-card .product-title,
.page-header .product-title,
.app-header .product-title,
.hero .product-title,
.brand-copy .product-title,
.auth-copy .product-title {
  font-size: clamp(1.45rem, 2.15vw, 2.18rem);
  line-height: 1.02;
  font-weight: 850;
  margin: 0;
}

.auth-card,
.auth-panel-lock {
  max-width: min(980px, calc(100vw - 42px));
}

.auth-panel-lock .auth-card {
  width: min(920px, calc(100vw - 42px));
}

@media (max-width: 760px) {
  .brand-lockup,
  .auth-card-brand {
    grid-template-columns: 1fr;
    text-align: left;
    gap: 12px;
  }

  .product-title,
  .auth-card .product-title,
  .page-header .product-title,
  .app-header .product-title,
  .hero .product-title,
  .brand-copy .product-title,
  .auth-copy .product-title {
    white-space: normal;
    font-size: clamp(1.35rem, 5vw, 2rem);
    line-height: 1.03;
  }

  .brand-logo,
  .auth-card-brand .brand-logo {
    width: 142px;
  }
}


/* Corrección: título sin cortar, una línea real en escritorio */
.auth-card-brand,
.brand-lockup {
  grid-template-columns: auto minmax(0, 1fr);
}

.auth-card-brand {
  gap: clamp(12px, 1.6vw, 20px);
}

.auth-card-brand .brand-logo {
  width: clamp(120px, 13vw, 168px);
}

.brand-logo {
  width: clamp(118px, 10vw, 162px);
}

.product-title,
.product-title-inline,
.auth-card .product-title,
.page-header .product-title,
.app-header .product-title,
.hero .product-title,
.brand-copy .product-title,
.auth-copy .product-title {
  display: block;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  max-width: none;
  font-size: clamp(1.08rem, 1.55vw, 1.72rem);
  line-height: 1.05;
  letter-spacing: 0;
  font-weight: 850;
}

.auth-card .product-title,
.auth-card-brand .product-title {
  font-size: clamp(1.02rem, 1.38vw, 1.55rem);
}

.topbar .product-title,
.topbar .product-title-inline,
.brand-lockup .product-title,
.brand-lockup .product-title-inline {
  font-size: clamp(1.05rem, 1.35vw, 1.58rem);
}

.auth-card,
.auth-panel-lock {
  max-width: min(1060px, calc(100vw - 42px));
}

.auth-panel-lock .auth-card {
  width: min(1040px, calc(100vw - 42px));
}

/* En pantallas pequeñas se permite partir para no desbordar */
@media (max-width: 760px) {
  .product-title,
  .product-title-inline,
  .auth-card .product-title,
  .page-header .product-title,
  .app-header .product-title,
  .hero .product-title,
  .brand-copy .product-title,
  .auth-copy .product-title {
    white-space: normal;
    overflow: visible;
    font-size: clamp(1.25rem, 5vw, 1.85rem);
    line-height: 1.04;
  }
}


/* Cabecera final: logo protagonista y título técnico más sobrio */
.auth-card-brand {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  text-align: center;
  justify-items: center;
  padding-bottom: 18px;
}

.auth-card-brand .brand-logo {
  width: clamp(178px, 24vw, 260px);
  max-width: 82%;
}

.auth-card-brand > div {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
}

.auth-card-brand .brand-name {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1;
  letter-spacing: 0.18em;
  font-weight: 900;
}

.auth-card-brand .product-title {
  display: block;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  max-width: 100%;
  font-size: clamp(1.1rem, 1.55vw, 1.45rem);
  line-height: 1.08;
  letter-spacing: 0;
  font-weight: 850;
}

.auth-card-brand .product-title span,
.auth-card-brand .product-title-inline span {
  display: inline;
}

.auth-card-brand .product-title span + span,
.auth-card-brand .product-title-inline span + span {
  margin-left: 0.18em;
}

/* Web principal: título en una línea, discreto y sin cortar */
.topbar .brand-lockup,
header.topbar .brand-lockup {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.topbar .brand-logo,
header.topbar .brand-logo {
  width: clamp(140px, 11vw, 190px);
}

.topbar .product-title,
header.topbar .product-title,
.brand-lockup .product-title {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  font-size: clamp(1.15rem, 1.55vw, 1.8rem);
  line-height: 1.05;
  letter-spacing: 0;
  max-width: none;
}

@media (max-width: 760px) {
  .auth-card-brand .product-title,
  .topbar .product-title,
  header.topbar .product-title,
  .brand-lockup .product-title {
    white-space: normal;
    font-size: clamp(1.2rem, 4.8vw, 1.65rem);
  }

  .auth-card-brand .brand-logo {
    width: 190px;
  }
}


/* Zoom y scroll en gráficas */
canvas.interactive-chart {
  cursor: grab;
  touch-action: none;
}

canvas.interactive-chart.is-panning-chart {
  cursor: grabbing;
}

canvas.interactive-chart:focus {
  outline: 2px solid rgba(var(--accent-rgb), 0.55);
  outline-offset: 3px;
}


/* Compatibilidad zoom/eventos */
#tempChart.interactive-chart {
  cursor: crosshair;
}

#tempChart.interactive-chart.is-panning-chart {
  cursor: grabbing;
}


/* ===== Login rediseñado estilo premium ClimaValid ===== */
body.auth-screen {
  position: relative;
  overflow-x: hidden;
  padding: 28px;
  background:
    radial-gradient(circle at 14% 88%, rgba(var(--accent-rgb), 0.10), transparent 240px),
    radial-gradient(circle at 88% 90%, rgba(var(--accent-rgb), 0.12), transparent 320px),
    radial-gradient(circle at 50% 0%, rgba(255,255,255,0.96), rgba(240,247,249,0.92) 44%, rgba(231,241,244,0.90) 100%);
}

body.auth-screen::before,
body.auth-screen::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}

body.auth-screen::before {
  left: -80px;
  bottom: 28px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  filter: blur(1px);
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.85) 0 26%, rgba(214,228,232,0.22) 27% 44%, transparent 45%),
    linear-gradient(120deg, transparent 47%, rgba(204,221,226,0.65) 47.5% 52.5%, transparent 53%);
  transform: rotate(-14deg);
}

body.auth-screen::after {
  right: -40px;
  bottom: 0;
  width: min(38vw, 520px);
  height: min(34vw, 420px);
  background:
    repeating-linear-gradient(165deg, rgba(218,231,235,0.00) 0 8px, rgba(218,231,235,0.45) 8px 10px, rgba(218,231,235,0.00) 10px 18px);
  mask-image: linear-gradient(180deg, transparent, black 18%, black 100%);
}

body.auth-screen .app-shell {
  position: relative;
  z-index: 1;
  width: min(1080px, 100%);
  max-width: 1080px;
  margin: 0 auto;
  padding: 0;
}

body.auth-screen .topbar,
body.auth-screen .app-shell > :not(#authPanel) {
  display: none !important;
}

.auth-login-showcase {
  margin: 0;
}

.auth-split-card {
  display: grid;
  grid-template-columns: 0.92fr 1.68fr;
  min-height: 740px;
  border: 1px solid rgba(190, 201, 196, 0.7);
  border-radius: 28px;
  overflow: hidden;
  background: rgba(255,255,255,0.78);
  box-shadow:
    0 28px 70px rgba(16, 38, 58, 0.08),
    0 2px 0 rgba(255,255,255,0.72) inset;
  backdrop-filter: blur(8px);
}

.auth-visual-panel {
  position: relative;
  padding: 56px 36px 34px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.76), rgba(239,247,249,0.96)),
    radial-gradient(circle at 30% 80%, rgba(var(--accent-rgb), 0.09), transparent 280px);
  overflow: hidden;
}

.auth-visual-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.0) 0%, rgba(242,248,250,0.0) 45%, rgba(229,241,244,0.75) 100%);
  pointer-events: none;
}

.auth-visual-brand {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: start;
  gap: 30px;
}

.auth-visual-logo {
  width: 256px;
  max-width: 100%;
}

.auth-visual-name {
  margin: 0;
  font-size: 0.92rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: #3e4742;
}

.auth-visual-divider {
  width: 46px;
  height: 3px;
  border-radius: 999px;
  background: rgb(var(--accent-rgb));
}

.auth-molecule,
.auth-molecule::before,
.auth-molecule::after {
  position: absolute;
  border-radius: 50%;
}

.auth-molecule {
  z-index: 1;
  border: 8px solid rgba(255,255,255,0.78);
  box-shadow: 0 20px 28px rgba(142, 166, 178, 0.18);
}

.auth-molecule::before,
.auth-molecule::after {
  content: "";
  background: rgba(255,255,255,0.85);
  box-shadow: 0 12px 24px rgba(142, 166, 178, 0.14);
}

.auth-molecule-main {
  left: 54px;
  bottom: 84px;
  width: 88px;
  height: 88px;
  background: rgba(255,255,255,0.50);
}

.auth-molecule-main::before {
  width: 72px;
  height: 72px;
  left: 118px;
  top: -72px;
}

.auth-molecule-main::after {
  width: 62px;
  height: 62px;
  left: 154px;
  top: 68px;
}

.auth-molecule-main {
  box-shadow:
    130px -56px 0 -8px rgba(255,255,255,0.78),
    164px 96px 0 -8px rgba(255,255,255,0.78),
    0 22px 34px rgba(142, 166, 178, 0.18);
}

.auth-molecule-top,
.auth-molecule-bottom {
  border-width: 6px;
  filter: blur(1px);
  opacity: 0.65;
}

.auth-molecule-top {
  left: -32px;
  top: 278px;
  width: 82px;
  height: 82px;
}

.auth-molecule-bottom {
  left: 26px;
  bottom: -18px;
  width: 64px;
  height: 64px;
}

.auth-form-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  padding: 52px 74px;
  background: rgba(255,255,255,0.82);
}

.auth-heading-pro {
  gap: 0;
  margin-bottom: 4px;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  margin: 0 0 26px;
  padding: 11px 15px;
  border-radius: 12px;
  background: rgba(var(--accent-rgb), 0.08);
  color: #0757a8;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-badge-icon,
.auth-inline-status::before,
.auth-btn-userplus,
.auth-btn-arrow,
.password-toggle::before,
.auth-input-shell.icon-user::before,
.auth-input-shell.icon-lock::before {
  content: "";
  display: inline-block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  flex: 0 0 auto;
}

.auth-badge-icon {
  width: 14px;
  height: 14px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%230757a8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 10V7a5 5 0 0 1 10 0v3"/><rect x="4" y="10" width="16" height="11" rx="2"/><path d="M12 14v3"/></svg>');
}

.auth-kicker {
  margin: 0;
  color: #0757a8;
  font-size: 1.08rem;
  font-weight: 700;
}

.auth-kicker-line {
  width: 44px;
  height: 3px;
  margin: 16px 0 28px;
  border-radius: 999px;
  background: rgb(var(--accent-rgb));
}

.auth-form-panel #authTitle {
  margin: 0 0 12px;
  font-size: clamp(2.25rem, 3vw, 3.15rem);
  line-height: 1.02;
  letter-spacing: 0;
  color: #10263a;
}

.auth-form-panel .message {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.6;
  color: #5a655f;
}

.auth-form-pro {
  display: grid;
  gap: 20px;
}

.auth-grid-pro {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin: 0;
}

.auth-field {
  display: grid;
  gap: 10px;
  color: #1f2522;
  font-size: 0.98rem;
  font-weight: 700;
}

.auth-field-label {
  display: block;
}

.auth-input-shell {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 66px;
  border: 1px solid #d2d8d6;
  border-radius: 14px;
  background: rgba(255,255,255,0.88);
  box-shadow: 0 1px 0 rgba(255,255,255,0.92) inset;
}

.auth-input-shell::before {
  position: absolute;
  left: 18px;
  width: 22px;
  height: 22px;
  opacity: 0.68;
}

.auth-input-shell.icon-user::before {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23828b88" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M20 21a8 8 0 0 0-16 0"/><circle cx="12" cy="8" r="4"/></svg>');
}

.auth-input-shell.icon-lock::before {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23828b88" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="10" width="16" height="10" rx="2"/><path d="M8 10V7a4 4 0 1 1 8 0v3"/></svg>');
}

.auth-input-shell input {
  width: 100%;
  min-height: 64px;
  padding: 0 56px 0 54px;
  border: 0;
  background: transparent;
  color: #171c19;
  font-size: 1rem;
  font-weight: 500;
  outline: none;
  box-shadow: none;
}

.auth-input-shell input::placeholder {
  color: #a0a8a5;
}

.auth-input-shell:focus-within {
  border-color: rgba(var(--accent-rgb), 0.65);
  box-shadow:
    0 0 0 4px rgba(var(--accent-rgb), 0.12),
    0 1px 0 rgba(255,255,255,0.92) inset;
}

.password-toggle {
  position: absolute;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
}

.password-toggle::before {
  width: 22px;
  height: 22px;
  opacity: 0.72;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23828b88" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3.8-6 10-6 10 6 10 6-3.8 6-10 6-10-6-10-6z"/><circle cx="12" cy="12" r="3"/></svg>');
}

.password-toggle.is-visible::before {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23828b88" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.93 10.93 0 0 1 12 19c-6.2 0-10-7-10-7a21.77 21.77 0 0 1 5.06-5.94"/><path d="M9.9 4.24A10.73 10.73 0 0 1 12 4c6.2 0 10 8 10 8a21.17 21.17 0 0 1-2.6 3.84"/><path d="M14.12 14.12A3 3 0 0 1 9.88 9.88"/><path d="M1 1l22 22"/></svg>');
}

.auth-actions-pro {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 4px;
}

.auth-primary-btn,
.auth-secondary-btn {
  min-height: 60px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 800;
  justify-content: center;
}

.auth-primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(180deg, #10263a, #061a2d);
  box-shadow: 0 10px 20px rgba(16, 38, 58, 0.14);
}

.auth-btn-arrow {
  width: 21px;
  height: 21px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23ffffff" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg>');
}

.auth-secondary-btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  border: 1px solid #d2d8d6;
  background: rgba(255,255,255,0.72);
}

.auth-btn-userplus {
  width: 21px;
  height: 21px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%2310263a" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 19a6 6 0 0 0-12 0"/><circle cx="9" cy="8" r="4"/><path d="M19 8v6"/><path d="M16 11h6"/></svg>');
}

.auth-footer-pro {
  justify-content: flex-start;
  text-align: left;
}

.auth-inline-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.98rem;
  color: #4f5a55;
}

.auth-inline-status::before {
  width: 20px;
  height: 20px;
  opacity: 0.9;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%230757a8" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/><path d="m9 12 2 2 4-4"/></svg>');
}

@media (max-width: 980px) {
  body.auth-screen .app-shell {
    width: min(760px, 100%);
    max-width: 760px;
  }

  .auth-split-card {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .auth-visual-panel {
    min-height: 270px;
    padding-bottom: 20px;
  }

  .auth-form-panel {
    padding: 40px 32px;
  }

  .auth-visual-logo {
    width: 220px;
  }

  .auth-molecule-main {
    left: auto;
    right: 88px;
    bottom: 34px;
  }
}

@media (max-width: 640px) {
  body.auth-screen {
    padding: 14px;
  }

  .auth-split-card {
    border-radius: 22px;
  }

  .auth-form-panel {
    padding: 30px 20px 24px;
  }

  .auth-visual-panel {
    padding: 34px 20px 14px;
    min-height: 220px;
  }

  .auth-visual-logo {
    width: 188px;
  }

  .auth-visual-name {
    font-size: 0.80rem;
    letter-spacing: 0.20em;
  }

  .auth-form-panel #authTitle {
    font-size: clamp(1.95rem, 8vw, 2.5rem);
  }

  .auth-kicker {
    font-size: 1rem;
  }

  .auth-molecule-main {
    transform: scale(0.82);
    right: 26px;
    bottom: 4px;
  }

  .auth-molecule-top,
  .auth-molecule-bottom {
    display: none;
  }
}


/* ===== Pantalla de login fiel a referencia aportada ===== */
body.auth-screen {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  padding: 32px 20px;
  background:
    radial-gradient(ellipse at 91% 94%, rgba(188, 235, 232, 0.48), rgba(222, 244, 245, 0.28) 24%, rgba(255,255,255,0) 48%),
    radial-gradient(circle at 16% 76%, rgba(255,255,255,0.98), rgba(238,242,240,0.84) 44%, rgba(230,236,233,0.90) 100%);
}

body.auth-screen::before {
  content: "";
  position: fixed;
  left: 0;
  bottom: 0;
  width: 289px;
  height: 384px;
  background: url("assets/login-bg-left-reference.png") left bottom / 100% 100% no-repeat;
  opacity: 1;
  filter: none;
  pointer-events: none;
  z-index: 0;
}

body.auth-screen::after {
  content: "";
  position: fixed;
  right: 0;
  top: 0;
  width: 290px;
  height: 100vh;
  background: url("assets/login-bg-right-reference.png") right top / 100% 100% no-repeat;
  opacity: 1;
  pointer-events: none;
  z-index: 0;
}

body.auth-screen .app-shell {
  position: relative;
  z-index: 1;
  width: min(1094px, 100%);
  max-width: 1094px;
  margin: 0 auto;
  padding: 0;
}

body.auth-screen .topbar,
body.auth-screen .app-shell > :not(#authPanel) {
  display: none !important;
}

body.auth-screen #authPanel.auth-login-showcase {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.auth-reference-card {
  display: grid;
  grid-template-columns: 386px minmax(0, 1fr);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: min(756px, calc(100svh - 64px));
  min-height: 620px;
  border: 1px solid rgba(197, 205, 201, 0.92);
  border-radius: 26px;
  overflow: hidden;
  background: rgba(255,255,255,0.88);
  box-shadow:
    0 30px 80px rgba(16, 38, 58, 0.08),
    0 1px 0 rgba(255,255,255,0.95) inset;
  backdrop-filter: blur(10px);
}

.auth-reference-left {
  position: relative;
  padding: 58px 34px 32px 42px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.94), rgba(239,249,250,0.80) 42%, rgba(222,244,245,0.82) 100%),
    url("assets/login-left-reference.png") center / cover no-repeat;
  overflow: hidden;
}

.auth-reference-left::after {
  content: none;
}

.auth-reference-brand {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: start;
  gap: 22px;
}

.auth-reference-logo {
  width: 278px;
  max-width: 100%;
  display: block;
}

.auth-reference-brandname {
  display: none;
  margin: 0;
  font-size: 0.90rem;
  letter-spacing: 0.28em;
  color: #25384a;
}

.auth-reference-accent {
  width: 52px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-teal));
}

.auth-structure {
  display: none;
}

.auth-node,
.auth-link {
  position: absolute;
  display: block;
}

.auth-node {
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, rgba(255,255,255,0.96), rgba(255,255,255,0.74) 58%, rgba(214,224,220,0.22) 100%);
  border: 1px solid rgba(224,230,227,0.9);
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,0.86),
    0 14px 24px rgba(154, 177, 188, 0.16);
  backdrop-filter: blur(4px);
}

.auth-link {
  transform-origin: left center;
  background: linear-gradient(180deg, rgba(255,255,255,0.82), rgba(214,228,232,0.62));
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.68);
}

.auth-structure-main {
  left: -18px;
  bottom: 44px;
  width: 330px;
  height: 320px;
}

.auth-structure-main .node-a {
  left: 34px;
  top: 148px;
  width: 80px;
  height: 80px;
}

.auth-structure-main .node-b {
  left: 126px;
  top: 52px;
  width: 62px;
  height: 62px;
}

.auth-structure-main .node-c {
  left: 194px;
  top: 188px;
  width: 76px;
  height: 76px;
}

.auth-structure-main .link-ab {
  left: 92px;
  top: 150px;
  width: 128px;
  height: 14px;
  transform: rotate(-46deg);
}

.auth-structure-main .link-ac {
  left: 92px;
  top: 198px;
  width: 134px;
  height: 14px;
  transform: rotate(12deg);
}

.auth-structure-main .link-bc {
  left: 168px;
  top: 112px;
  width: 116px;
  height: 14px;
  transform: rotate(58deg);
}

.auth-structure-soft {
  left: -54px;
  bottom: 196px;
  width: 120px;
  height: 120px;
  filter: blur(1.1px);
  opacity: 0.68;
}

.auth-structure-soft .node-a {
  left: 0;
  top: 48px;
  width: 42px;
  height: 42px;
}

.auth-structure-soft .node-b {
  left: 54px;
  top: 0;
  width: 34px;
  height: 34px;
}

.auth-structure-soft .link-ab {
  left: 20px;
  top: 40px;
  width: 66px;
  height: 10px;
  transform: rotate(-42deg);
}

.auth-reference-right {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 0;
  padding: 53px 74px 53px 72px;
  background: rgba(255,255,255,0.80);
}

.auth-reference-heading {
  width: min(512px, 100%);
  min-width: 0;
  margin-bottom: 39px;
}

.auth-reference-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 24px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(var(--accent-rgb), 0.08);
  color: #0757a8;
  font-size: 0.91rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.icon-lock-mini,
.auth-reference-status::before,
.auth-reference-arrow,
.auth-reference-userplus,
.password-toggle::before,
.auth-reference-input::before {
  content: "";
  display: inline-block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  flex: 0 0 auto;
}

.icon-lock-mini {
  width: 16px;
  height: 16px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%230757a8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 10V7a5 5 0 0 1 10 0v3"/><rect x="4" y="10" width="16" height="10" rx="2"/><path d="M12 14v2.8"/></svg>');
}

.auth-reference-kicker {
  margin: 0;
  color: #0757a8;
  font-size: 1.08rem;
  font-weight: 700;
}

.auth-reference-kicker-line {
  display: block;
  width: 42px;
  height: 3px;
  margin: 16px 0 28px;
  border-radius: 999px;
  background: rgb(var(--accent-rgb));
}

.auth-reference-right #authTitle {
  margin: 0 0 12px;
  font-size: 2.05rem;
  line-height: 1.12;
  letter-spacing: 0;
  color: #10263a;
}

.auth-reference-message {
  margin: 0;
  font-size: 1.03rem;
  color: #59645f;
  line-height: 1.58;
  overflow-wrap: anywhere;
}

.auth-reference-form {
  display: grid;
  width: min(512px, 100%);
  min-width: 0;
  gap: 22px;
}

.auth-reference-field {
  display: grid;
  gap: 10px;
}

.auth-reference-label {
  color: #1f2522;
  font-size: 0.98rem;
  font-weight: 700;
}

.auth-reference-input {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 64px;
  border: 1px solid #d7dcda;
  border-radius: 13px;
  background: rgba(255,255,255,0.96);
  box-shadow: 0 1px 0 rgba(255,255,255,0.9) inset;
}

.auth-reference-input::before {
  position: absolute;
  left: 16px;
  width: 22px;
  height: 22px;
  opacity: 0.65;
}

.auth-reference-input.input-user::before {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23818b88" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M20 21a8 8 0 0 0-16 0"/><circle cx="12" cy="8" r="4"/></svg>');
}

.auth-reference-input.input-lock::before {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23818b88" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="10" width="16" height="10" rx="2"/><path d="M8 10V7a4 4 0 1 1 8 0v3"/></svg>');
}

.auth-reference-input input {
  width: 100%;
  min-height: 62px;
  padding: 0 54px 0 52px;
  border: 0;
  outline: none;
  box-shadow: none;
  background: transparent;
  color: #191f1c;
  font-size: 1rem;
}

.auth-reference-input input::placeholder {
  color: #adb4b2;
}

.auth-reference-input:focus-within {
  border-color: rgba(var(--accent-rgb), 0.56);
  box-shadow:
    0 0 0 4px rgba(var(--accent-rgb), 0.10),
    0 1px 0 rgba(255,255,255,0.9) inset;
}

.password-toggle {
  position: absolute;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.password-toggle::before {
  width: 22px;
  height: 22px;
  opacity: 0.72;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23818b88" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3.8-6 10-6 10 6 10 6-3.8 6-10 6-10-6-10-6z"/><circle cx="12" cy="12" r="3"/></svg>');
}

.password-toggle.is-visible::before {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23818b88" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.93 10.93 0 0 1 12 19c-6.2 0-10-7-10-7a21.77 21.77 0 0 1 5.06-5.94"/><path d="M9.9 4.24A10.73 10.73 0 0 1 12 4c6.2 0 10 8 10 8a21.17 21.17 0 0 1-2.6 3.84"/><path d="M14.12 14.12A3 3 0 0 1 9.88 9.88"/><path d="M1 1l22 22"/></svg>');
}

.auth-reference-actions {
  display: grid;
  gap: 16px;
  margin-top: 2px;
}

.auth-reference-primary,
.auth-reference-secondary {
  min-height: 58px;
  border-radius: 13px;
  font-size: 1rem;
  font-weight: 800;
  justify-content: center;
}

.auth-reference-primary {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(180deg, #10263a 0%, #061a2d 100%);
  box-shadow: 0 12px 24px rgba(16,38,58,0.12);
}

.auth-reference-arrow {
  width: 22px;
  height: 22px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23ffffff" stroke-width="2.1" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg>');
}

.auth-reference-secondary {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  border: 1px solid #d7dcda;
  background: rgba(255,255,255,0.94);
}

.auth-reference-userplus {
  width: 21px;
  height: 21px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%2310263a" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 19a6 6 0 0 0-12 0"/><circle cx="9" cy="8" r="4"/><path d="M19 8v6"/><path d="M16 11h6"/></svg>');
}

.auth-reference-footer {
  justify-content: flex-start;
  width: min(512px, 100%);
  min-width: 0;
  margin-top: 34px;
  text-align: left;
}

.auth-reference-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #4f5a55;
  font-size: 0.98rem;
}

.auth-reference-status::before {
  width: 20px;
  height: 20px;
  opacity: 0.9;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%230757a8" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/><path d="m9 12 2 2 4-4"/></svg>');
}

@media (max-width: 1060px) {
  body.auth-screen .app-shell {
    width: min(920px, 100%);
    max-width: 920px;
  }

  .auth-reference-card {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .auth-reference-right {
    padding: 46px 38px;
  }

  .auth-reference-left {
    padding: 62px 30px 30px 42px;
  }

  .auth-reference-logo {
    width: 220px;
  }
}

@media (max-width: 880px) {
  body.auth-screen {
    padding: 12px;
  }

  body.auth-screen::after {
    width: 62vw;
  }

  body.auth-screen .app-shell {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    min-width: 0;
  }

  .auth-reference-card {
    grid-template-columns: 1fr;
    height: min(680px, calc(100svh - 24px));
    min-height: 0;
  }

  .auth-reference-left {
    display: none;
  }

  .auth-reference-right {
    justify-content: center;
    padding: 24px;
  }

  .auth-reference-heading {
    margin-bottom: 18px;
  }

  .auth-reference-badge {
    margin-bottom: 14px;
    padding: 8px 13px;
  }

  .auth-reference-kicker-line {
    margin: 8px 0 12px;
  }

  .auth-reference-right #authTitle {
    margin-bottom: 8px;
    font-size: 1.9rem;
    line-height: 1.08;
  }

  .auth-reference-message {
    font-size: 0.98rem;
    line-height: 1.42;
  }

  .auth-reference-form {
    gap: 14px;
  }

  .auth-reference-field {
    gap: 8px;
  }

  .auth-reference-input,
  .auth-reference-input input {
    min-height: 52px;
  }

  .auth-reference-actions {
    gap: 10px;
    margin-top: 0;
  }

  .auth-reference-primary,
  .auth-reference-secondary {
    min-height: 50px;
  }

  .auth-reference-footer {
    margin-top: 16px;
  }

  .auth-structure-main {
    right: 18px;
    left: auto;
    bottom: 16px;
    transform: scale(0.86);
    transform-origin: right bottom;
  }
}

@media (min-width: 881px) and (max-height: 780px) {
  body.auth-screen {
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .auth-reference-card {
    height: calc(100svh - 32px);
    min-height: 0;
  }

  .auth-reference-right {
    padding-top: 34px;
    padding-bottom: 34px;
  }

  .auth-reference-heading {
    margin-bottom: 20px;
  }

  .auth-reference-badge {
    margin-bottom: 16px;
    padding: 8px 13px;
  }

  .auth-reference-kicker-line {
    margin: 10px 0 18px;
  }

  .auth-reference-right #authTitle {
    margin-bottom: 8px;
    font-size: 1.95rem;
    line-height: 1.08;
  }

  .auth-reference-form {
    gap: 16px;
  }

  .auth-reference-field {
    gap: 8px;
  }

  .auth-reference-input {
    min-height: 56px;
  }

  .auth-reference-input input {
    min-height: 54px;
  }

  .auth-reference-actions {
    gap: 12px;
    margin-top: 0;
  }

  .auth-reference-primary,
  .auth-reference-secondary {
    min-height: 52px;
  }

  .auth-reference-footer {
    margin-top: 18px;
  }
}

@media (max-width: 560px) {
  body.auth-screen {
    padding: 14px;
  }

  body.auth-screen .app-shell {
    width: calc(100vw - 28px);
    max-width: calc(100vw - 28px);
  }

  .auth-reference-card {
    border-radius: 22px;
  }

  .auth-reference-left {
    display: none;
  }

  .auth-reference-right {
    padding: 20px 18px;
  }

  .auth-reference-logo {
    width: 184px;
  }

  .auth-reference-brandname {
    font-size: 0.80rem;
    letter-spacing: 0.20em;
  }

  .auth-reference-right #authTitle {
    font-size: clamp(1.7rem, 7vw, 1.9rem);
  }

  .auth-reference-kicker {
    font-size: 0.95rem;
  }

  .auth-reference-input,
  .auth-reference-input input,
  .auth-reference-primary,
  .auth-reference-secondary {
    min-height: 50px;
  }

  .auth-structure-soft {
    display: none;
  }

  .auth-structure-main {
    transform: scale(0.68);
    right: -4px;
    bottom: -20px;
  }
}


/* Campo de título editable del documento PDF */
.report-title-block {
  padding: 14px;
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.08), rgba(255,255,255,0.84) 64%),
    #ffffff;
}

.report-title-block label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 850;
}

.report-title-block input {
  min-height: 46px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
}


/* =====================================================================
   Reestructuración PRO 2: full-width, sin paneles laterales.
   La acción permanece en el centro. No añade campos ni datos nuevos.
   ===================================================================== */

body.is-authenticated {
  background:
    radial-gradient(circle at 8% 0%, rgba(var(--accent-rgb), 0.13), transparent 320px),
    radial-gradient(circle at 96% 12%, rgba(16, 38, 58, 0.06), transparent 330px),
    linear-gradient(180deg, #eef7fa 0%, #f6fbfc 38%, #eef6f8 100%);
}

body.is-authenticated::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(16,38,58,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16,38,58,0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(180deg, black, transparent 62%);
}

body.is-authenticated .app-shell {
  width: min(1680px, calc(100% - 28px));
  margin: 0 auto;
  padding: 14px 0 52px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

body.is-authenticated .topbar,
body.is-authenticated .report-tools,
body.is-authenticated .camera-panel,
body.is-authenticated .setup-panel,
body.is-authenticated .load-panel,
body.is-authenticated .loaded-logger-detail,
body.is-authenticated .certificate-panel,
body.is-authenticated #dashboard,
body.is-authenticated .change-control {
  grid-column: 1 / -1;
}

body.is-authenticated .topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  margin: 0;
  min-height: 74px;
  padding: 12px 16px;
  border: 1px solid rgba(210, 220, 216, 0.82);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 50px rgba(16, 38, 58, 0.08);
  backdrop-filter: blur(18px);
}

body.is-authenticated .topbar::before {
  inset: auto 18px 0;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(90deg, var(--black), var(--accent), rgba(var(--accent-rgb), 0.18));
}

body.is-authenticated .topbar .brand-logo {
  width: clamp(126px, 8vw, 160px);
}

body.is-authenticated .topbar .brand-name {
  margin-bottom: 2px;
  color: #3d4842;
  font-size: 0.64rem;
  letter-spacing: 0.18em;
}

body.is-authenticated .topbar .product-title {
  font-size: clamp(1.05rem, 1.15vw, 1.44rem);
  letter-spacing: 0;
}

body.is-authenticated .status-pill {
  min-width: 0;
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.08);
  border-color: rgba(var(--accent-rgb), 0.22);
  font-size: 0.78rem;
  white-space: nowrap;
}

body.is-authenticated .topbar-logout {
  min-height: 34px;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
}

/* Banda de mando global: central, compacta y útil */
body.is-authenticated .report-tools {
  position: relative;
  top: auto;
  z-index: auto;
  margin: 0;
  padding: 16px 18px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(243,248,251,0.92));
  color: #10263a;
  box-shadow: 0 18px 44px rgba(16, 38, 58, 0.075);
  overflow: hidden;
}

body.is-authenticated .report-tools::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent), rgba(var(--accent-rgb), 0.16));
  pointer-events: none;
}

body.is-authenticated .report-tools .eyebrow,
body.is-authenticated .report-tools h2 {
  color: #10263a;
}

body.is-authenticated .report-tools .eyebrow {
  opacity: 1;
}

body.is-authenticated .report-tools h2 {
  font-size: clamp(1rem, 1.1vw, 1.22rem);
  letter-spacing: 0;
}

body.is-authenticated .report-action {
  min-width: 190px;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(16,38,58,0.12);
}

body.is-authenticated .report-action:not(:disabled):hover {
  box-shadow: 0 16px 30px rgba(16,38,58,0.14);
}

/* Módulos centrales: la app se lee como cockpit, no como formulario largo */
body.is-authenticated .camera-panel,
body.is-authenticated .setup-panel,
body.is-authenticated .load-panel,
body.is-authenticated .loaded-logger-detail,
body.is-authenticated .certificate-panel,
body.is-authenticated .chart-block,
body.is-authenticated .manual-event-tools,
body.is-authenticated .filter-bar,
body.is-authenticated .event-range-panel,
body.is-authenticated .event-panel,
body.is-authenticated .change-control {
  border: 1px solid rgba(207, 218, 213, 0.82);
  border-radius: 18px;
  background: rgba(255,255,255,0.88);
  box-shadow: 0 18px 44px rgba(16, 38, 58, 0.075);
  backdrop-filter: blur(10px);
}

body.is-authenticated .camera-panel {
  grid-column: span 5;
  min-height: 286px;
}

body.is-authenticated .setup-panel {
  grid-column: span 4;
  min-height: 286px;
}

body.is-authenticated .load-panel {
  grid-column: span 3;
  min-height: 286px;
  height: 286px;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 10px;
  align-content: start;
  align-items: stretch;
}

body.is-authenticated .load-panel .load-actions {
  justify-content: center;
}

body.is-authenticated .load-panel .secondary-action {
  min-height: 36px;
  padding: 8px 14px;
  margin-inline: auto;
}

body.is-authenticated .load-panel .inline-status {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.22;
}

body.is-authenticated .load-panel .load-compact-summary {
  align-self: end;
  margin-top: 0;
}

body.is-authenticated .load-panel .load-compact-item {
  padding: 10px 12px;
}

body.is-authenticated .load-panel .load-compact-value {
  font-size: 0.82rem;
  line-height: 1.18;
}

body.is-authenticated .loaded-logger-detail {
  grid-column: 1 / -1;
  margin: 0;
  min-height: auto;
}

body.is-authenticated .loaded-logger-detail[hidden] {
  display: none;
}

body.is-authenticated .load-compact-item,
body.is-authenticated .load-preview-item {
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(243,248,251,0.88));
  box-shadow: 0 8px 22px rgba(16,38,58,0.045);
}

body.is-authenticated .load-compact-label,
body.is-authenticated .load-preview-label {
  color: #66716c;
}

body.is-authenticated .load-preview-chip {
  background: #ffffff;
}

body.is-authenticated .camera-panel,
body.is-authenticated .setup-panel,
body.is-authenticated .load-panel,
body.is-authenticated .certificate-panel {
  margin: 0;
  padding: 18px;
}

body.is-authenticated .camera-panel-pro {
  background:
    radial-gradient(circle at 100% 0%, rgba(var(--accent-rgb), 0.12), transparent 260px),
    linear-gradient(180deg, rgba(255,255,255,0.90), rgba(250,252,251,0.86));
}

body.is-authenticated .camera-panel-pro::before {
  width: 4px;
  background: linear-gradient(180deg, var(--accent), rgba(var(--accent-rgb), 0.10));
}

body.is-authenticated .section-head,
body.is-authenticated .camera-panel-header,
body.is-authenticated .certificate-head,
body.is-authenticated .chart-head {
  gap: 14px;
}

body.is-authenticated .eyebrow {
  margin-bottom: 4px;
  color: var(--accent-strong);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
}

body.is-authenticated h2 {
  color: #10263a;
  font-size: clamp(1.02rem, 1.08vw, 1.24rem);
  letter-spacing: 0;
}

body.is-authenticated .camera-body {
  grid-template-columns: 1fr;
  gap: 13px;
  margin-top: 16px;
}

body.is-authenticated .camera-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.is-authenticated .camera-summary-card,
body.is-authenticated .summary-item,
body.is-authenticated .event-meta-item,
body.is-authenticated .test-conclusion-item {
  border-radius: 14px;
  border-color: rgba(var(--accent-rgb), 0.16);
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(243,248,251,0.88));
  box-shadow: 0 8px 22px rgba(16,38,58,0.045);
}

body.is-authenticated .camera-summary-card {
  min-height: 74px;
  padding: 12px;
}

body.is-authenticated .camera-summary-label,
body.is-authenticated .summary-label {
  color: #66716c;
  letter-spacing: 0.10em;
}

body.is-authenticated .camera-summary-value,
body.is-authenticated .summary-value {
  color: #121815;
}

body.is-authenticated .range-grid {
  gap: 12px;
  margin-top: 14px;
}

body.is-authenticated .setup-panel form {
  display: flex;
  flex-direction: column;
  height: 100%;
}

body.is-authenticated .setup-panel .range-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: auto;
  padding-top: 14px;
}

body.is-authenticated .setup-panel fieldset {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: end;
}

body.is-authenticated fieldset {
  padding: 14px;
  border-radius: 15px;
  border-color: rgba(207, 218, 213, 0.86);
  background: #f8fbf9;
}

body.is-authenticated .range-label-text {
  min-height: 2.8em;
}

body.is-authenticated legend {
  padding: 0 8px;
  color: var(--accent-strong);
}

body.is-authenticated label {
  color: #59645f;
}

body.is-authenticated input,
body.is-authenticated select,
body.is-authenticated textarea {
  min-height: 44px;
  border-radius: 12px;
  border-color: #d5dfda;
  background: rgba(255,255,255,0.96);
}

body.is-authenticated .primary-action,
body.is-authenticated .secondary-action {
  min-height: 40px;
  border-radius: 999px;
  padding: 9px 15px;
}

body.is-authenticated .primary-action {
  background: linear-gradient(180deg, #10263a, #061a2d);
  box-shadow: 0 12px 22px rgba(16,38,58,0.12);
}

body.is-authenticated .primary-action:hover {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
}

body.is-authenticated .secondary-action {
  border-color: rgba(189, 202, 196, 0.96);
  background: rgba(255,255,255,0.86);
}

body.is-authenticated .danger-action,
body.is-authenticated #openDeleteCamera,
body.is-authenticated #clearCertsButton,
body.is-authenticated #openDeleteEvent {
  border-color: rgba(193,83,63,0.22);
  color: #9f3f30;
  background: rgba(193,83,63,0.06);
}

body.is-authenticated .danger-action:hover,
body.is-authenticated #openDeleteCamera:hover,
body.is-authenticated #clearCertsButton:hover,
body.is-authenticated #openDeleteEvent:hover {
  background: #9f3f30;
  color: #ffffff;
}

body.is-authenticated .load-actions,
body.is-authenticated .camera-actions,
body.is-authenticated .certificate-actions,
body.is-authenticated .manual-event-actions {
  gap: 8px;
}

body.is-authenticated .inline-status,
body.is-authenticated .message {
  color: #62706a;
}

/* Certificados: mismo contenido, más denso y vendible */
body.is-authenticated .certificate-panel {
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.06), rgba(255,255,255,0) 44%),
    rgba(255,255,255,0.90);
}

body.is-authenticated .certificate-safe-accordion {
  border-radius: 16px;
  box-shadow: none;
}

body.is-authenticated .certificate-safe-summary {
  min-height: 54px;
  padding: 12px 16px;
  background: #f8fbf9;
}

body.is-authenticated .certificate-safe-plus {
  width: 26px;
  height: 26px;
}

body.is-authenticated .certificate-safe-accordion #certList {
  padding: 12px 14px 14px;
  background: #ffffff;
}

body.is-authenticated .certificate-list {
  gap: 8px;
}

body.is-authenticated .certificate-card {
  grid-template-columns: minmax(260px, 1.45fr) minmax(190px, .75fr) minmax(240px, .9fr);
  gap: 14px;
  padding: 12px 14px;
  border-radius: 13px;
  border-color: rgba(207,218,213,0.92);
  box-shadow: none;
  background: linear-gradient(90deg, rgba(var(--accent-rgb),0.045), rgba(255,255,255,0.96) 18%);
}

body.is-authenticated .certificate-name {
  font-size: 0.94rem;
}

body.is-authenticated .certificate-meta,
body.is-authenticated .certificate-match,
body.is-authenticated .certificate-hash {
  font-size: 0.78rem;
}

/* Dashboard central a pantalla completa */
body.is-authenticated #dashboard {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  margin-top: 0;
}

body.is-authenticated #dashboard[hidden] {
  display: none !important;
}

body.is-authenticated .summary-grid {
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

body.is-authenticated .summary-item {
  min-height: 64px;
  padding: 11px 12px;
}

body.is-authenticated .summary-label {
  font-size: 0.62rem;
}

body.is-authenticated .summary-value {
  font-size: clamp(0.76rem, 0.9vw, 0.96rem);
}

body.is-authenticated .filter-bar {
  grid-column: 1 / span 7;
  margin: 0;
  padding: 14px;
  align-items: end;
}

body.is-authenticated .manual-event-tools {
  grid-column: span 5;
  margin: 0;
  padding: 14px;
}

body.is-authenticated .chart-block,
body.is-authenticated .event-range-panel,
body.is-authenticated .event-panel {
  grid-column: 1 / -1;
  margin: 0;
}

body.is-authenticated .chart-block {
  padding: 18px;
  overflow: hidden;
}

body.is-authenticated .chart-head {
  margin-bottom: 12px;
}

body.is-authenticated .legend {
  gap: 10px 16px;
}

body.is-authenticated .legend-item {
  min-height: 22px;
  font-size: 0.77rem;
  background: transparent;
}

body.is-authenticated canvas {
  height: 430px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(250,252,251,0.72), rgba(255,255,255,0.92));
}

body.is-authenticated .event-card canvas,
body.is-authenticated .event-range-panel canvas {
  height: 340px;
}

body.is-authenticated .test-conclusion-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: 15px;
  background: #f8fbf9;
}

body.is-authenticated .test-conclusion-table {
  border-radius: 12px;
}

body.is-authenticated .test-conclusion-table thead th {
  background: #10263a;
}

body.is-authenticated .event-grid,
body.is-authenticated .event-range-charts {
  gap: 12px;
}

body.is-authenticated .event-card,
body.is-authenticated .event-range-event {
  border-radius: 16px;
  background: #ffffff;
  border-color: rgba(207,218,213,0.92);
  box-shadow: 0 12px 28px rgba(16,38,58,0.06);
}

body.is-authenticated .event-range-event-head,
body.is-authenticated .event-meta {
  gap: 10px;
}

/* Auditoría como bloque institucional, sin ocupar espacio inútil */
body.is-authenticated .change-control {
  margin-top: 0;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(16,38,58,0.035), rgba(var(--accent-rgb),0.055)),
    rgba(255,255,255,0.90);
}

body.is-authenticated .change-item {
  border-radius: 14px;
}

/* Modal de informe: más sensación de producto enterprise */
body.is-authenticated #reportModal .event-modal {
  width: min(1280px, calc(100% - 28px));
  border-radius: 20px;
  border-color: rgba(207,218,213,0.95);
  background: rgba(255,255,255,0.96);
}

body.is-authenticated #reportModal .field-block,
body.is-authenticated #reportModal .report-images-block,
body.is-authenticated #reportModal .report-title-block {
  border-radius: 16px;
}

body.is-authenticated .modal-backdrop {
  backdrop-filter: blur(6px);
}

body.is-authenticated .event-modal {
  border-radius: 18px;
}

@media (min-width: 1260px) {
  body.is-authenticated .certificate-head,
  body.is-authenticated .manual-event-tools,
  body.is-authenticated .report-tools {
    align-items: center;
  }
}

@media (max-width: 1180px) {
  body.is-authenticated .camera-panel,
  body.is-authenticated .setup-panel,
  body.is-authenticated .load-panel,
  body.is-authenticated .loaded-logger-detail,
  body.is-authenticated .filter-bar,
  body.is-authenticated .manual-event-tools {
    grid-column: 1 / -1;
    min-height: auto;
  }

  body.is-authenticated .setup-panel .range-grid,
  body.is-authenticated .setup-panel fieldset {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.is-authenticated .loaded-logger-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  body.is-authenticated .app-shell {
    width: min(100% - 18px, 1680px);
    grid-template-columns: 1fr;
    padding-top: 9px;
  }

  body.is-authenticated .topbar,
  body.is-authenticated .report-tools,
  body.is-authenticated .camera-panel,
  body.is-authenticated .setup-panel,
  body.is-authenticated .load-panel,
  body.is-authenticated .loaded-logger-detail,
  body.is-authenticated .certificate-panel,
  body.is-authenticated #dashboard,
  body.is-authenticated .change-control,
  body.is-authenticated .filter-bar,
  body.is-authenticated .manual-event-tools,
  body.is-authenticated .chart-block,
  body.is-authenticated .event-range-panel,
  body.is-authenticated .event-panel {
    grid-column: 1 / -1;
  }

  body.is-authenticated .topbar,
  body.is-authenticated .report-tools,
  body.is-authenticated .section-head,
  body.is-authenticated .camera-panel-header,
  body.is-authenticated .certificate-head,
  body.is-authenticated .manual-event-tools,
  body.is-authenticated .chart-head,
  body.is-authenticated .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  body.is-authenticated .report-tools {
    position: relative;
    top: auto;
  }

  body.is-authenticated .camera-summary,
  body.is-authenticated .summary-grid,
  body.is-authenticated .range-grid,
  body.is-authenticated .setup-panel .range-grid,
  body.is-authenticated .setup-panel fieldset,
  body.is-authenticated .event-meta,
  body.is-authenticated .loaded-logger-detail-grid,
  body.is-authenticated .load-compact-summary {
    grid-template-columns: 1fr;
  }

  body.is-authenticated .certificate-card {
    grid-template-columns: 1fr;
  }

  body.is-authenticated canvas {
    height: 330px;
  }
}


/* Ajuste fino solicitado: posición intermedia de los recuadros del Paso 3 */
body.is-authenticated .setup-panel .range-grid {
  padding-top: 24px;
}

body.is-authenticated .setup-panel fieldset {
  transform: translateY(7px);
}


#eventRangeModal .event-modal {
  width: min(980px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.event-window-card-meta {
  margin: -2px 0 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

@media (max-width: 720px) {
  #eventRangeModal .event-modal {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
}
