/* AquaControl V77 · Fase 5
 * Capa visual y accesible. No modifica menú, permisos ni reglas de negocio.
 */
:root {
  --a11y-focus: #ffbf47;
  --a11y-focus-dark: #7a4b00;
  --surface-raised: #ffffff;
  --surface-subtle: #f6f8fb;
  --text-strong: #10243e;
  --text-muted-accessible: #53657c;
}

.skip-link {
  position: fixed;
  z-index: 100000;
  top: 10px;
  left: 12px;
  padding: 11px 16px;
  border: 3px solid var(--a11y-focus-dark);
  border-radius: 8px;
  color: #071d37;
  background: #fff4c2;
  font-weight: 800;
  transform: translateY(-160%);
  transition: transform .16s ease;
}
.skip-link:focus { transform: translateY(0); }

body.corporate-theme { line-height: 1.45; }
.corporate-theme .content { max-width: 1780px; width: 100%; margin-inline: auto; }
.corporate-theme .view > .view-header { margin-bottom: 18px; }
.corporate-theme .view-header h3 { color: var(--text-strong); line-height: 1.2; }
.corporate-theme .muted,
.corporate-theme .hint { color: var(--text-muted-accessible); }

.corporate-theme button,
.corporate-theme input,
.corporate-theme select,
.corporate-theme textarea,
.corporate-theme [tabindex]:not([tabindex="-1"]) { min-height: 40px; }

.corporate-theme :where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--a11y-focus) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 2px var(--a11y-focus-dark) !important;
}

.corporate-theme input:invalid:not(:placeholder-shown),
.corporate-theme select:invalid,
.corporate-theme textarea:invalid:not(:placeholder-shown) {
  border-color: #b42318;
  background: #fff7f6;
}

.corporate-theme .panel,
.corporate-theme .stat-card {
  border-color: #d5dfeb;
  box-shadow: 0 5px 18px rgba(15, 42, 72, .07);
}

.corporate-theme table { background: var(--surface-raised); }
.corporate-theme thead th {
  color: #fff;
  background: #173f69;
  border-color: #2a527c;
}
.corporate-theme tbody tr:nth-child(even) { background: #f7f9fc; }
.corporate-theme tbody tr:hover { background: #eaf3fc; }
.corporate-theme td,
.corporate-theme th { line-height: 1.35; }

.operation-status-banner {
  position: sticky;
  z-index: 80;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 46px;
  padding: 9px 18px;
  color: #5c3600;
  background: #fff0c2;
  border-bottom: 2px solid #d88b00;
}
.operation-status-banner.hidden { display: none; }

.accessible-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 150px;
  padding: 28px;
  border: 1px dashed #9fb1c5;
  border-radius: 12px;
  text-align: center;
  background: var(--surface-subtle);
}
.accessible-state strong { color: var(--text-strong); font-size: 1.05rem; }
.accessible-state.error { color: #8a1c13; background: #fff4f2; border-color: #df9b94; }
.accessible-state.offline { color: #694000; background: #fff8df; border-color: #d9a441; }
.accessible-state.loading::before {
  content: '';
  width: 28px;
  height: 28px;
  border: 4px solid #c5d6e8;
  border-top-color: #1473e6;
  border-radius: 50%;
  animation: accessible-spin .8s linear infinite;
}
@keyframes accessible-spin { to { transform: rotate(360deg); } }

.a11y-live-region {
  position: fixed !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 1366px) {
  .corporate-theme .layout { grid-template-columns: 248px minmax(0, 1fr); }
  .corporate-theme .content { padding: 18px; }
  .corporate-theme .view-header { gap: 14px; }
  .corporate-theme .panel { padding: 16px; }
}

@media (max-width: 900px) {
  .operation-status-banner { align-items: flex-start; flex-direction: column; gap: 2px; }
  .corporate-theme .view-header,
  .corporate-theme .header-actions { align-items: stretch; }
  .corporate-theme .header-actions { flex-wrap: wrap; }
}

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

@media (prefers-contrast: more) {
  :root { --line: #718096; }
  .corporate-theme .panel { border-width: 2px; }
  .corporate-theme .muted, .corporate-theme .hint { color: #334155; }
}
