/* =========================================================
   METSO OPERACIONES — Sistema de diseño v2 (2026)
   Industrial operations console aesthetic
   ========================================================= */

:root {
  /* Brand */
  --brand-orange: #ff6a13;
  --brand-orange-strong: #e55610;
  --brand-orange-soft: #fff1e6;
  --brand-navy: #0b1f33;
  --brand-navy-2: #112a44;
  --brand-blue: #0077b7;
  --brand-blue-dark: #004f7c;
  --brand-blue-deep: #002b46;

  /* Legacy aliases (compat) */
  --orange: var(--brand-orange);
  --orange-dark: var(--brand-orange-strong);
  --navy: var(--brand-navy);
  --navy-2: var(--brand-navy-2);
  --metso-blue: var(--brand-blue);
  --metso-blue-dark: var(--brand-blue-dark);
  --metso-blue-deep: var(--brand-blue-deep);

  /* Neutrals */
  --ink: #0e1726;
  --ink-2: #1f2a3a;
  --muted: #5b6b80;
  --muted-2: #8794a8;
  --line: #e3e8ef;
  --line-soft: #eef1f6;
  --line-strong: #cfd6e0;
  --bg: #f4f6fa;
  --bg-2: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --surface-3: #f1f5fa;

  /* Status */
  --success: #15803d;
  --success-soft: #e6f4ec;
  --danger: #b91c1c;
  --danger-soft: #fdecec;
  --warning: #b45309;
  --warning-soft: #fdf2dd;
  --info: #0369a1;
  --info-soft: #e2f1fa;

  /* Effects */
  --shadow-xs: 0 1px 2px rgba(11, 31, 51, 0.05);
  --shadow-sm: 0 2px 6px rgba(11, 31, 51, 0.06), 0 1px 2px rgba(11, 31, 51, 0.04);
  --shadow-md: 0 8px 22px rgba(11, 31, 51, 0.08);
  --shadow-lg: 0 22px 50px rgba(11, 31, 51, 0.14);
  --shadow-xl: 0 32px 72px rgba(0, 60, 100, 0.22);
  --ring: 0 0 0 3px rgba(0, 119, 183, 0.18);
  --ring-orange: 0 0 0 3px rgba(255, 106, 19, 0.22);
  --ring-danger: 0 0 0 3px rgba(185, 28, 28, 0.18);

  /* Radius */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  /* Type */
  --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Motion (emil-design-eng) */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-out-snap: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --d-press: 160ms;
  --d-hover: 200ms;
  --d-tab: 220ms;
  --d-modal: 320ms;
}



* { box-sizing: border-box; }

html, body { height: 100%; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 100% 0%, rgba(0,119,183,0.04) 0%, transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(255,106,19,0.03) 0%, transparent 50%),
    radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 28px 28px;
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: transparent; border: 0; color: inherit; }
img { max-width: 100%; display: block; }
a { color: var(--brand-blue-dark); }

button:disabled, input:disabled, select:disabled, textarea:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* =========================================================
   CUSTOM SCROLLBARS
   ========================================================= */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted-2);
}
.primary-button:disabled, .soft-button:disabled, .danger-button:disabled, .link-button:disabled {
  box-shadow: none;
  filter: grayscale(0.1);
}

.hidden { display: none !important; }

::selection { background: rgba(255, 106, 19, 0.22); color: var(--ink); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c8d2df; border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #a9b6c7; }

/* =========================================================
   TIPOGRAFIA
   ========================================================= */
h1, h2, h3, h4 { margin: 0; color: var(--ink); font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.04; letter-spacing: -0.035em; }
h2 { font-size: clamp(1.4rem, 2.4vw, 2rem); line-height: 1.15; }
h3 { font-size: 1.18rem; line-height: 1.25; }
h4 { font-size: 0.98rem; line-height: 1.3; }
p { margin: 0; }

.label-top {
  display: inline-block;
  margin: 0 0 6px;
  color: var(--brand-orange-strong);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

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

.error {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-weight: 600;
  font-size: 0.85rem;
}
.error:not(:empty) {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid rgba(185, 28, 28, 0.18);
}

/* =========================================================
   FORM PRIMITIVES
   ========================================================= */
label {
  display: grid;
  gap: 6px;
  color: var(--ink-2);
  font-size: 0.82rem;
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
  transition:
    border-color var(--d-hover) var(--ease-out),
    box-shadow var(--d-hover) var(--ease-out),
    background var(--d-hover) var(--ease-out);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
input:hover:not(:disabled):not(:focus),
select:hover:not(:disabled):not(:focus),
textarea:hover:not(:disabled):not(:focus) {
  border-color: var(--line-strong);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 4px rgba(0, 119, 183, 0.12);
  background: #fff;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%235b6b80' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 34px;
}

.input-affix {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.input-affix:focus-within {
  border-color: var(--brand-blue);
  box-shadow: var(--ring);
  background: #fff;
}
.input-affix > i {
  color: var(--muted);
  font-size: 0.9rem;
  flex: 0 0 auto;
  width: 16px;
  text-align: center;
}
.input-affix > input,
.input-affix > select,
.input-affix > textarea {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 11px 0;
  outline: none;
  width: 100%;
}
.input-affix > input:focus,
.input-affix > select:focus,
.input-affix > textarea:focus { box-shadow: none; }
.input-affix > select { background-image: none; padding-right: 0; }

.affix-btn {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: rgba(0, 119, 183, 0.08);
  color: var(--brand-blue-dark);
  cursor: pointer;
  transition:
    background var(--d-hover) var(--ease-out),
    transform var(--d-press) var(--ease-out),
    color var(--d-hover) var(--ease-out);
}
.affix-btn:hover { background: rgba(0, 119, 183, 0.16); }
.affix-btn:active { transform: scale(0.92); transition-duration: 80ms; }
.password-toggle {
  width: 34px;
  height: 34px;
  min-width: 34px;
  background: rgba(0, 119, 183, 0.1);
  color: var(--brand-blue-dark);
}
.password-toggle:hover,
.password-toggle[aria-pressed="true"] {
  background: rgba(0, 119, 183, 0.18);
  color: var(--brand-blue-dark);
}
.password-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

.user-list-status {
  display: block;
  margin-top: 5px;
  font-size: 0.76rem;
  font-weight: 600;
}
.user-list-status.pending { color: var(--warning); }
.user-list-status.ok { color: var(--success); }
.user-list-status.warn { color: var(--warning); }
.user-list-status.error { color: var(--danger); }
.user-list-status:empty { display: none; }

/* =========================================================
   BUTTONS
   ========================================================= */
.primary-button, .soft-button, .link-button, .danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: -0.005em;
  width: fit-content;
  max-width: max-content;
  transition:
    transform var(--d-press) var(--ease-out),
    background var(--d-hover) var(--ease-out),
    border-color var(--d-hover) var(--ease-out),
    color var(--d-hover) var(--ease-out);
  white-space: nowrap;
  will-change: transform;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-orange) 0%, var(--brand-orange-strong) 100%);
  box-shadow: 0 6px 16px rgba(255, 106, 19, 0.28);
}
.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(255, 106, 19, 0.36);
}
.primary-button:active { transform: translateY(0) scale(0.97); transition-duration: 80ms; }
.primary-button:focus-visible { box-shadow: 0 6px 16px rgba(255, 106, 19, 0.28), var(--ring-orange); outline: none; }

.soft-button {
  color: var(--brand-blue-dark);
  background: #fff;
  border-color: var(--line);
  box-shadow: var(--shadow-xs);
}
.soft-button:hover { background: var(--surface-3); border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.soft-button:active { transform: translateY(0) scale(0.97); transition-duration: 80ms; }
.soft-button:focus-visible { box-shadow: var(--shadow-xs), var(--ring); outline: none; }

.link-button {
  color: rgba(255, 255, 255, 0.94);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(6px);
  font-size: 0.82rem;
  padding: 8px 12px;
}
.link-button:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.26); }
.link-button:active { transform: scale(0.97); transition-duration: 80ms; }

.danger-button {
  color: #fff;
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  box-shadow: 0 6px 16px rgba(185, 28, 28, 0.24);
}
.danger-button:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(185, 28, 28, 0.34); }
.danger-button:active { transform: translateY(0) scale(0.97); transition-duration: 80ms; }
.danger-button:focus-visible { box-shadow: 0 6px 16px rgba(185, 28, 28, 0.24), var(--ring-danger); outline: none; }

.button-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.22);
  font-weight: 900;
  line-height: 1;
}
.button-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.primary-button.icon-button .button-icon { color: #fff; background: rgba(255, 255, 255, 0.2); }
.soft-button.icon-button .button-icon { background: var(--surface-3); color: var(--brand-blue); }
.danger-button.icon-button .button-icon { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* =========================================================
   LOGIN
   ========================================================= */
.login-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(800px 540px at 12% 18%, rgba(255, 106, 19, 0.18), transparent 55%),
    radial-gradient(1000px 700px at 88% 82%, rgba(0, 119, 183, 0.34), transparent 60%),
    linear-gradient(135deg, #04111e 0%, #082338 40%, #0d3e60 100%);
}
.login-screen::before,
.login-screen::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
.login-screen::before {
  width: 460px; height: 460px; top: -120px; left: -120px;
  background: radial-gradient(circle, rgba(255, 106, 19, 0.45), transparent 65%);
}
.login-screen::after {
  width: 560px; height: 560px; bottom: -180px; right: -180px;
  background: radial-gradient(circle, rgba(0, 119, 183, 0.55), transparent 65%);
}

.login-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  width: min(900px, 100%);
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  animation: panel-rise 0.6s var(--ease-out-snap) both;
}

@keyframes panel-rise {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 600px;
  padding: 48px 44px;
  color: #fff;
  overflow: hidden;
  background:
    radial-gradient(700px 500px at 100% 100%, rgba(255, 106, 19, 0.45), transparent 55%),
    linear-gradient(150deg, #061726 0%, var(--brand-blue-dark) 50%, var(--brand-blue) 100%);
}
.login-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
  opacity: 0.5;
}
.login-glow {
  position: absolute;
  top: -120px;
  right: -120px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 60%);
  pointer-events: none;
  filter: blur(20px);
}

.brand-logo {
  position: relative;
  z-index: 1;
  display: block;
  width: 134px;
  height: auto;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}
.brand-logo.compact {
  width: 72px;
  padding: 4px 8px;
  border-radius: 8px;
  box-shadow: none;
}

.logo {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 4px;
  color: #fff;
  background: var(--brand-orange);
  font-weight: 900;
  letter-spacing: 0.12em;
}
.logo.compact { min-height: 34px; padding-inline: 13px; font-size: 0.82rem; }

.login-visual h1 {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: auto 0 16px;
  font-size: clamp(2.3rem, 4.5vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 800;
  color: #fff;
}
.login-visual h1 em {
  display: block;
  background: linear-gradient(120deg, #ffd0b5, var(--brand-orange));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-style: normal;
  font-weight: 900;
}
.login-visual p {
  position: relative;
  z-index: 1;
  max-width: 460px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.6;
  font-size: 1rem;
}

.login-stats {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
}
.login-stats span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 8px 14px;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  font-size: 0.8rem;
  font-weight: 600;
}
.login-stats span i { color: var(--brand-orange); }

.login-form {
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 56px 50px;
  background: var(--surface);
}
.login-form .label-top { color: var(--brand-orange-strong); }
.login-form h2 {
  margin: 0 0 6px;
  font-weight: 800;
  color: var(--brand-navy);
  letter-spacing: -0.03em;
}
.login-submit {
  margin-top: 10px;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  color: #fff;
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-dark) 100%);
  border: 0;
  font-weight: 700;
  letter-spacing: -0.005em;
  box-shadow: 0 8px 20px rgba(0, 119, 183, 0.28);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.login-submit:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(0, 119, 183, 0.36); filter: brightness(1.04); }
.login-submit:active { transform: translateY(0) scale(0.98); transition-duration: 80ms; }

.link-register {
  justify-self: center;
  margin-top: -2px;
  border: 0;
  background: transparent;
  color: var(--brand-blue-dark);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.link-register:hover { color: var(--brand-orange-strong); text-decoration: underline; }

.login-footer {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.login-footer a {
  color: var(--brand-blue-soft);
  text-decoration: none;
}
.login-footer a:hover { text-decoration: underline; }

/* =========================================================
   WEEK CHOOSER
   ========================================================= */
.week-chooser-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
  overflow: hidden;
  background:
    radial-gradient(900px 600px at 12% 18%, rgba(255, 106, 19, 0.14), transparent 55%),
    radial-gradient(1000px 700px at 88% 82%, rgba(0, 119, 183, 0.28), transparent 60%),
    linear-gradient(135deg, #04111e 0%, #082338 40%, #0d3e60 100%);
}
.week-chooser-screen::before,
.week-chooser-screen::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
.week-chooser-screen::before {
  width: 460px; height: 460px; top: -100px; left: -120px;
  background: radial-gradient(circle, rgba(255, 106, 19, 0.36), transparent 65%);
}
.week-chooser-screen::after {
  width: 540px; height: 540px; bottom: -160px; right: -160px;
  background: radial-gradient(circle, rgba(0, 119, 183, 0.46), transparent 65%);
}

.week-chooser-card {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  padding: 36px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  animation: panel-rise 0.55s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}

.week-chooser-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line-soft);
}
.week-chooser-header .brand-logo.compact { width: 60px; padding: 4px 8px; }
.week-chooser-user h2 {
  margin: 4px 0 0;
  font-weight: 800;
  color: var(--brand-navy);
  letter-spacing: -0.025em;
  font-size: 1.6rem;
}
.week-chooser-header .link-button {
  color: var(--brand-blue-dark);
  background: var(--surface-3);
  border-color: var(--line);
  font-weight: 600;
}
.week-chooser-header .link-button:hover { background: #e2ecf3; }

.week-chooser-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 26px;
}
.week-chooser-option {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s ease, box-shadow 0.22s ease, border-color 0.18s ease;
}
.week-chooser-option:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(0, 119, 183, 0.28);
}
.week-chooser-option h3 {
  margin: 4px 0 0;
  font-weight: 800;
  color: var(--brand-navy);
  letter-spacing: -0.02em;
}
.week-chooser-option p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.94rem;
  flex: 1;
}
.week-chooser-option label { margin-top: 4px; color: var(--ink); font-size: 0.82rem; font-weight: 700; }
.week-chooser-option button { align-self: flex-start; margin-top: 4px; }

.week-chooser-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark));
  color: #fff;
  font-size: 1.4rem;
  box-shadow: 0 10px 22px rgba(0, 119, 183, 0.28);
}
.week-chooser-option.create .week-chooser-icon {
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-strong));
  box-shadow: 0 10px 22px rgba(255, 106, 19, 0.32);
}

.week-management-box {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(220, 38, 38, 0.18);
  background: linear-gradient(135deg, rgba(255, 245, 240, 0.95), rgba(255, 255, 255, 0.96));
}
.week-management-box h4 { margin: 0; color: var(--brand-navy); font-size: 0.95rem; font-weight: 800; }
.week-management-box p { flex: initial; font-size: 0.86rem; }

/* Work type selector in week chooser */
.work-type-selector {
  display: flex;
  gap: 18px;
  margin-top: 6px;
}
.work-type-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}
.work-type-option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}
.work-type-option input[type="radio"]:checked {
  border-color: var(--brand-blue);
  box-shadow: var(--ring);
}
.work-type-option input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand-blue);
}

/* Cameras screen (temporary page) */
.cameras-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
  overflow: hidden;
  background:
    radial-gradient(900px 600px at 12% 18%, rgba(255, 106, 19, 0.14), transparent 55%),
    radial-gradient(1000px 700px at 88% 82%, rgba(0, 119, 183, 0.28), transparent 60%),
    linear-gradient(135deg, #04111e 0%, #082338 40%, #0d3e60 100%);
}
.cameras-card {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  padding: 36px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  animation: panel-rise 0.55s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
.cameras-header {
  position: sticky;
  top: 12px;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0)),
    linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-blue-deep) 60%, var(--brand-blue-dark) 100%);
  box-shadow: 0 14px 32px rgba(0, 43, 70, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  margin-bottom: 20px;
}
.cameras-header .link-button { color: #fff; background: rgba(255, 255, 255, 0.1); font-weight: 600; border: 1px solid rgba(255,255,255,0.2); }
.cameras-header .link-button:hover { background: rgba(255, 255, 255, 0.2); }
.camera-availability-dual-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 16px;
}
.cameras-content { margin-top: 0; }
.cameras-content {
  margin-top: 26px;
}
.cameras-week-control {
  margin-top: 20px;
  margin-bottom: 16px;
}
.camera-chart-wrap {
  min-height: 280px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.cameras-availability-panel .camera-chart-wrap { min-height: 760px; }
.camera-availability-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.camera-availability-plant-card { display: grid; gap: 12px; margin-top: 16px; }
.camera-availability-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.camera-availability-head h4 { margin: 0; color: var(--brand-navy); font-size: 1rem; }
.camera-availability-table { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.camera-availability-row { display: grid; grid-template-columns: 90px minmax(180px, 1fr) 110px 92px; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); background: var(--surface); }
.camera-availability-row:last-child { border-bottom: 0; }
.camera-availability-row strong { color: var(--brand-navy); }
.camera-availability-row small { color: var(--muted); }
.camera-availability-row input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.camera-unavailability { text-align: right; color: var(--danger); font-weight: 800; }
.camera-report-actions { display: flex; gap: 8px; align-items: center; }
.camera-report-charts-grid { display: grid; grid-template-columns: repeat(2, minmax(280px, 1fr)); gap: 16px; margin: 8px 0 20px; align-items: stretch; }
.camera-chart-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-height: 290px; overflow: hidden; }
.camera-chart-box canvas { display: block; width: 100% !important; height: 230px !important; max-height: 230px; }
#cameraChartPendientes { height: 190px !important; max-height: 190px; }
#cameraChartDistribucion { height: 220px !important; max-height: 220px; }
.camera-chart-label { color: var(--muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px; }
.camera-report-grid { display: grid; gap: 16px; }
.camera-report-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.camera-report-metric { padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); text-align: center; }
.camera-report-metric .metric-icon { font-size: 1.6rem; margin-bottom: 6px; }
.camera-report-metric .metric-value { font-size: 2rem; font-weight: 900; color: var(--brand-navy); line-height: 1; }
.camera-report-metric .metric-label { color: var(--muted); font-size: 0.82rem; margin-top: 4px; font-weight: 600; }
.camera-report-metric.ok { border-color: var(--success); background: var(--success-soft); }
.camera-report-metric.warn { border-color: var(--warning); background: var(--warning-soft); }
.camera-report-dual { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.camera-report-plant { display: grid; gap: 10px; }
.camera-report-plant h4 { margin: 0; color: var(--brand-navy); font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.camera-report-plant-table { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.camera-report-row { display: grid; grid-template-columns: 80px minmax(0, 1fr) 80px 90px; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); background: var(--surface); font-size: 0.84rem; }
.camera-report-row:last-child { border-bottom: 0; }
.camera-report-row strong { color: var(--brand-navy); }
.camera-report-row .report-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.camera-report-row .report-dot.ok { background: var(--success); }
.camera-report-row .report-dot.warn { background: var(--warning); }
.camera-report-row .report-dot.none { background: var(--muted-2); }
/* Camera status table (ultimo dia) */
.camera-table-caption { font-size: 0.95rem; font-weight: 700; color: var(--brand-navy); margin: 4px 0 8px; letter-spacing: 0.02em; }
.camera-availability-table { --camera-status-grid: 90px 110px 150px 170px minmax(160px, 1fr) 110px 90px; }
.camera-status-header { display: grid; grid-template-columns: var(--camera-status-grid); gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 2px solid var(--brand-navy); background: var(--surface-2); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--brand-navy); position: sticky; top: 0; z-index: 10; }
.camera-status-row { display: grid; grid-template-columns: var(--camera-status-grid); gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); background: var(--surface); font-size: 0.82rem; }
.camera-status-row:last-child { border-bottom: 0; }
.status-hdr { display: block; min-width: 0; text-align: center; }
.status-hdr.tag-hdr, .status-hdr.ip-hdr, .status-hdr.obs-hdr { text-align: left; }
.status-col { min-width: 0; overflow: hidden; }
.status-col strong { color: var(--brand-navy); font-size: 0.82rem; display: block; }
.status-col small { color: var(--muted); font-size: 0.7rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ip-col { color: var(--muted); font-size: 0.78rem; }
.status-col select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 5px 6px; font-size: 0.78rem; background: var(--surface); }
.status-col input[type="text"] { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 5px 6px; font-size: 0.78rem; background: var(--surface); }
.tag-col { text-align: left; font-weight: 700; word-break: break-word; }
.toggle-col { text-align: center; }
.obs-col { text-align: left; }
/* Toggle switch for ACT and Estado Camara */
.camera-status-toggle { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.camera-status-toggle input { display: none; }
.toggle-slider { position: relative; width: 40px; height: 22px; background: #d1d5db; border-radius: 999px; transition: background 0.2s; flex-shrink: 0; }
.toggle-slider::before { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.camera-status-toggle input:checked + .toggle-slider { background: #10b981; }
.camera-status-toggle input:checked + .toggle-slider::before { transform: translateX(18px); }
/* Second toggle (Estado Camara) uses blue instead of green */
.camara-toggle input:checked + .toggle-slider { background: #3b82f6; }
.camera-status-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; align-items: stretch; }
.camera-status-chart-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; }
.camera-status-chart-box h5 { margin: 0 0 8px; font-size: 0.85rem; color: var(--brand-navy); text-align: center; width: 100%; }
.camera-status-chart-box canvas { max-height: 180px; width: 100% !important; }
@media (max-width: 1200px) { .camera-availability-table { --camera-status-grid: 80px 100px 130px 150px minmax(140px, 1fr) 100px 80px; } }
@media (max-width: 1000px) { .camera-availability-table { --camera-status-grid: 90px 110px minmax(130px, 1fr) minmax(130px, 1fr); } .toggle-col { grid-column: span 2; justify-self: start; } .camera-status-charts { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .camera-status-charts { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .camera-report-metrics { grid-template-columns: repeat(2, 1fr); } .camera-report-dual { grid-template-columns: 1fr; } .camera-report-charts-grid { grid-template-columns: 1fr; } }
@media (max-width: 500px) { .camera-report-row { grid-template-columns: 70px 1fr; } .camera-status-header, .camera-status-row { grid-template-columns: 1fr 1fr; } .status-col strong { grid-column: 1 / -1; } .status-col small { grid-column: 1 / -1; } }
.camera-print-page { position: absolute; left: -9999px; top: 0; width: 800px; }
/* Scalability screen */
.scalability-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.scalability-content { min-height: 300px; }
.scalability-section { margin-bottom: 24px; }
.scalability-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.scalability-head h3 { margin: 0; color: var(--brand-navy); }
.scalability-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.scalability-table th { background: var(--surface-2); color: var(--brand-navy); padding: 8px 10px; text-align: left; font-weight: 800; text-transform: uppercase; font-size: 0.72rem; border-bottom: 2px solid var(--brand-navy); }
.scalability-table td { padding: 6px 10px; border-bottom: 1px solid var(--line-soft); }
.scalability-table tr:hover td { background: var(--surface-2); }
.scalability-actions { display: flex; gap: 4px; }
.scalability-actions button { padding: 3px 8px; font-size: 0.75rem; }
.scalability-form { display: flex; flex-direction: column; gap: 10px; }
.scalability-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; font-weight: 600; color: var(--brand-navy); }
.scalability-form input, .scalability-form select { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 0.85rem; }
@media (max-width: 600px) { .scalability-table th:nth-child(1), .scalability-table td:nth-child(1) { display: none; } .scalability-head { flex-direction: column; gap: 8px; } }
@media print {
  body * { visibility: hidden; }
  #camerasScreen, #camerasScreen * { visibility: visible; }
  #camerasScreen .cameras-header,
  #camerasScreen .hero-card,
  #camerasScreen .cameras-week-control,
  #camerasScreen .plant-tabs,
  #camerasScreen .work-tabs,
  #camerasScreen .cameras-panel { display: none; }
  #camerasScreen .cameras-panel[data-camera-panel="informe"] { display: block; }
  #cameraReportMetrics, #cameraReportDual, .card-title { display: none; }
  .camera-print-page { position: static !important; left: auto; width: auto; padding: 20px; }
  .camera-report-print-header { display: flex; justify-content: space-between; border-bottom: 2px solid #0b1f33; padding-bottom: 12px; margin-bottom: 16px; }
  .card-title { display: none; }
  .camera-report-print-header { display: flex; justify-content: space-between; border-bottom: 2px solid #0b1f33; padding-bottom: 12px; margin-bottom: 16px; }
  .print-header-left .print-company { font-size: 14px; font-weight: 800; color: #0b1f33; margin: 0; }
  .print-header-left .print-subtitle { font-size: 11px; color: #5b6b80; margin: 2px 0; }
  .print-header-left .print-code { font-size: 10px; color: #8794a8; margin: 2px 0; }
  .print-header-right { text-align: right; font-size: 11px; }
  .print-header-right p { margin: 2px 0; }
  .print-title { text-align: center; font-size: 18px; font-weight: 900; color: #0b1f33; margin: 20px 0; line-height: 1.4; text-transform: uppercase; }
  .print-signatures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 20px 0; padding: 16px; border: 1px solid #cfd6e0; border-radius: 8px; }
  .print-sig { text-align: center; }
  .print-sig-label { font-size: 9px; font-weight: 700; color: #5b6b80; margin: 0 0 4px; }
  .print-sig-name { font-size: 12px; font-weight: 700; color: #0b1f33; margin: 0 0 2px; border-bottom: 1px solid #0b1f33; padding-bottom: 4px; }
  .print-sig-role { font-size: 9px; color: #8794a8; margin: 2px 0 0; }
  .print-footer-info { margin-top: 20px; padding-top: 12px; border-top: 2px solid #ff6a13; font-size: 11px; }
  .print-footer-info p { margin: 2px 0; }
  .print-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }
  .print-chart-box { border: 1px solid #cfd6e0; border-radius: 8px; padding: 12px; }
  @page { size: A4; margin: 15mm; }
}
.cameras-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 48px 28px;
  text-align: center;
}
.cameras-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-strong));
  color: #fff;
  font-size: 1.8rem;
  box-shadow: 0 10px 22px rgba(255, 106, 19, 0.32);
}
.cameras-placeholder h3 {
  margin: 8px 0 0;
  font-weight: 800;
  color: var(--brand-navy);
  letter-spacing: -0.02em;
  font-size: 1.25rem;
}
.cameras-placeholder p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.94rem;
  max-width: 480px;
}

@media (max-width: 760px) {
  .week-chooser-header { grid-template-columns: 1fr; text-align: center; }
  .week-chooser-header .link-button { justify-self: center; }
  .week-chooser-options { grid-template-columns: 1fr; }
  .cameras-header { flex-direction: column; text-align: center; gap: 12px; }
  .cameras-header .brand-line { flex-direction: column; }
  .cameras-header .link-button { align-self: center; }
  .camera-availability-row { grid-template-columns: 76px 1fr; }
  .camera-unavailability { text-align: left; }
}

/* =========================================================
   APP SHELL
   ========================================================= */
.app {
  min-height: 100vh;
  padding: 18px 32px 40px;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.app-header {
  position: sticky;
  top: 12px;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 13px 22px;
  border-radius: var(--radius-lg);
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0)),
    linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-blue-deep) 60%, var(--brand-blue-dark) 100%);
  box-shadow:
    0 16px 40px rgba(0, 43, 70, 0.32),
    0 2px 8px rgba(0, 43, 70, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: app-header-rise 0.5s var(--ease-out-snap) both;
}
@keyframes app-header-rise {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand-line { display: flex; gap: 12px; align-items: center; color: #fff; }
.brand-line .brand-logo.compact { width: 56px; padding: 3px 6px; }
.brand-line strong { display: block; font-weight: 700; letter-spacing: -0.01em; font-size: 0.96rem; color: #fff; }
.brand-line span { color: rgba(255, 255, 255, 0.6); font-size: 0.78rem; font-weight: 500; letter-spacing: 0.02em; }

.module-tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 14px;
  color: rgba(255, 255, 255, 0.7);
  background: transparent;
  font-weight: 600;
  font-size: 0.86rem;
  transition:
    background var(--d-tab) var(--ease-out),
    color var(--d-tab) var(--ease-out),
    transform var(--d-press) var(--ease-out);
  cursor: pointer;
  position: relative;
}
.tab:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.tab:active { transform: scale(0.96); transition-duration: 80ms; }
.tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-strong));
  box-shadow: 0 6px 16px rgba(255, 106, 19, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.tab i { font-size: 0.82rem; }

.header-actions { display: inline-flex; gap: 8px; align-items: center; }
.header-actions .link-button { padding: 8px 12px; font-size: 0.82rem; font-weight: 600; }

.escalad-section { border-top: 2px solid #e2e8f0; margin-top: 20px; padding-top: 16px; }
.escalad-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.escalad-header-left { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; font-weight: 700; color: #0b1f33; }
.escalad-header-left i { color: #0077b7; }
.escalad-back-btn { background: none; border: none; color: #64748b; font-size: 0.8rem; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.escalad-back-btn:hover { background: #f1f5f9; color: #0077b7; }
.escalad-login { text-align: center; }
.escalad-login-hint { color: #64748b; font-size: 0.82rem; margin-bottom: 12px; }
.escalad-login-fields { display: flex; gap: 8px; max-width: 380px; margin: 0 auto 10px; }
.escalad-login-fields .form-input { flex: 1; }
.escalad-login-error { color: #d32f2f; font-size: 0.8rem; margin-bottom: 8px; min-height: 18px; }
.escalad-tabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.escalad-tab { padding: 6px 14px; border: 1.5px solid #cbd5e1; border-radius: 8px; background: #f8fafc; color: #475569; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.escalad-tab:hover { border-color: #0077b7; color: #0077b7; }
.escalad-tab.active { background: #0077b7; border-color: #0077b7; color: #fff; }
.escalad-content { max-height: 340px; overflow-y: auto; }

.scal-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 10000; }
.scal-modal-card { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.scal-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.scal-modal-title { font-size: 1rem; font-weight: 700; color: #0b1f33; margin: 0; }
.scal-modal-close { background: none; border: none; color: #94a3b8; cursor: pointer; font-size: 1.1rem; padding: 4px; }
.scal-modal-close:hover { color: #475569; }
.scal-modal-card form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.scal-modal-card form label { font-size: 0.82rem; font-weight: 600; color: #334155; display: flex; flex-direction: column; gap: 4px; }
.scal-modal-card form input, .scal-modal-card form select { padding: 8px 10px; border: 1.5px solid #cbd5e1; border-radius: 8px; font-size: 0.85rem; }
.scal-modal-card form input:focus, .scal-modal-card form select:focus { border-color: #0077b7; outline: none; }

.bot-tab { position: relative; }
.bot-tab .bot-badge { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: #f87171; }
.bot-tab.running .bot-badge { background: #4ade80; box-shadow: 0 0 4px #4ade80; }

/* =========================================================
   HERO CARD (context)
   ========================================================= */
.hero-card {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
  padding: 28px 32px;
  border-radius: var(--radius-xl);
  color: #fff;
  overflow: hidden;
  background:
    radial-gradient(700px 400px at 100% 0%, rgba(255, 106, 19, 0.46), transparent 55%),
    linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-blue-deep) 60%, var(--brand-blue-dark) 100%);
  box-shadow: 0 18px 38px rgba(0, 43, 70, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: hero-fade-in 0.5s var(--ease-out-snap) 0.1s both;
}
@keyframes hero-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}
.hero-card > * { position: relative; z-index: 1; }
.hero-card h2 { font-weight: 800; color: #fff; }
.hero-card p:not(.label-top) {
  max-width: 720px;
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.55;
  font-size: 0.98rem;
}
.hero-card .label-top { color: #ffd0b5; }

.week-filter { min-width: 260px; align-self: end; }
.week-filter label { color: rgba(255, 255, 255, 0.78); }
.week-filter select { background: rgba(255, 255, 255, 0.96); }
.week-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* =========================================================
   WORK WEEK CONTROL
   ========================================================= */
.work-week-control {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 0.8fr) minmax(180px, 0.6fr) auto;
  gap: 14px;
  align-items: end;
  margin: 14px 0;
}
.work-week-control h3 { color: var(--brand-blue-dark); }
.work-week-control .affix-btn {
  justify-self: end;
  align-self: end;
  padding: 6px 10px;
  transition:
    background var(--d-hover) var(--ease-out),
    transform var(--d-press) var(--ease-out),
    color var(--d-hover) var(--ease-out);
}
.work-week-control .affix-btn.spinning i { animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   METRICS
   ========================================================= */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 16px 0;
}
.metrics article {
  position: relative;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition:
    transform var(--d-hover) var(--ease-out),
    border-color var(--d-hover) var(--ease-out);
  cursor: default;
}
.metrics article:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(0, 119, 183, 0.28);
}
.metrics article::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--brand-blue), var(--brand-orange));
  transition: width var(--d-hover) var(--ease-out);
}
.metrics article:hover::before { width: 6px; }
.metrics span {
  display: block;
  color: var(--brand-navy);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}
.metrics p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* =========================================================
   SECTIONS
   ========================================================= */
.section { display: none; }
.active-section {
  display: block;
  animation: section-enter 0.28s var(--ease-out-snap) both;
}
@keyframes section-enter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card, .placeholder-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.22s ease, border-color 0.22s ease, transform 0.22s var(--ease-out);
  position: relative;
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.card:hover::before {
  content: '';
  position: absolute;
  top: 0; left: 16px; right: 16px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--brand-orange), transparent);
  border-radius: 0 0 2px 2px;
  opacity: 0.5;
}
.card { padding: 22px; }
.card-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.card-title h3 { margin: 0; color: var(--brand-navy); }
.card-title > .affix-btn {
  margin-left: auto;
  order: 999;
  flex-shrink: 0;
}
.report-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.wide { grid-column: 1 / -1; }

.section-block { margin-top: 16px; }

.upload-box {
  border: 1px dashed #b9c2c9;
  border-radius: 12px;
  padding: 14px;
  background: var(--surface-2);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.upload-box:hover { border-color: var(--brand-blue); background: #f4faff; }
.upload-box span { color: var(--muted); font-weight: 500; font-size: 0.84rem; }

.placeholder-card { margin-top: 16px; min-height: 260px; padding: 30px; }
.placeholder-card p { max-width: 720px; color: var(--muted); line-height: 1.6; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.65fr); gap: 16px; }

/* =========================================================
   PLANT/WORK/PLAN TABS
   ========================================================= */
.plant-tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  width: fit-content;
  box-shadow: var(--shadow-xs);
}

.work-tabs,
.thermo-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 16px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.thermo-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 16px 0; }

.plant-tab,
.thermo-plant-tab,
.camera-plant-tab,
.plan-plant-tab,
.fs-plant-tab,
.work-tab,
.camera-work-tab,
.thermo-tab,
.plant-tab-link {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 16px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
  font-size: 0.86rem;
  transition:
    background var(--d-tab) var(--ease-out),
    color var(--d-tab) var(--ease-out),
    transform var(--d-press) var(--ease-out);
  cursor: pointer;
}
.plant-tab:hover,
.thermo-plant-tab:hover,
.camera-plant-tab:hover,
.plan-plant-tab:hover,
.fs-plant-tab:hover,
.work-tab:hover,
.camera-work-tab:hover,
.thermo-tab:hover,
.plant-tab-link:hover { color: var(--brand-blue-dark); background: var(--surface-3); }
.plant-tab:active,
.thermo-plant-tab:active,
.camera-plant-tab:active,
.fs-plant-tab:active,
.work-tab:active,
.camera-work-tab:active,
.thermo-tab:active { transform: scale(0.97); transition-duration: 80ms; }

.plant-tab.active,
.thermo-plant-tab.active,
.camera-plant-tab.active,
.plan-plant-tab.active,
.fs-plant-tab.active,
.work-tab.active,
.camera-work-tab.active,
.thermo-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark));
  box-shadow: 0 6px 14px rgba(0, 119, 183, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.work-tab,
.camera-work-tab,
.thermo-tab { border-radius: 10px; }
.plant-tab-link {
  color: var(--brand-orange-strong);
  background: var(--brand-orange-soft);
  border-color: rgba(255, 106, 19, 0.22);
}

.work-panel { display: none; }
.work-panel.active-work-panel { display: block; }
.cameras-work-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cameras-panel { display: none; }
.cameras-panel.active-camera-panel { display: block; }
.camera-emergency-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.camera-emergency-toolbar h3 { margin: 4px 0 0; color: var(--brand-navy); font-weight: 800; }
.camera-card-grid {
  display: grid;
  gap: 10px;
}
.camera-card-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.camera-card-item:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.camera-card-item.expanded { border-color: var(--brand-blue); box-shadow: var(--ring); }
.camera-card-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
}
.camera-card-header-left strong {
  display: block;
  color: var(--brand-navy);
  font-size: 0.95rem;
}
.camera-card-header-left small {
  color: var(--muted);
  font-size: 0.82rem;
}
.camera-card-status {
  display: flex;
  align-items: center;
  gap: 8px;
}
.camera-card-status .status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.camera-card-status .status-dot.ok { background: var(--success); box-shadow: 0 0 6px var(--success); }
.camera-card-status .status-dot.pending { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.camera-card-status .status-dot.none { background: var(--muted-2); box-shadow: 0 0 4px var(--muted-2); }
.camera-card-status .status-label { font-size: 0.8rem; font-weight: 700; }
.camera-card-status .status-label.ok { color: var(--success); }
.camera-card-status .status-label.pending { color: var(--warning); }
.camera-card-status .status-label.none { color: var(--muted); }
.camera-card-body {
  display: none;
  padding: 0 18px 18px;
  border-top: 1px solid var(--line-soft);
}
.camera-card-item.expanded .camera-card-body { display: block; }
.camera-card-body form {
  display: grid;
  gap: 12px;
  padding-top: 14px;
}
.camera-card-body .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 600px) {
  .camera-card-body .form-row { grid-template-columns: 1fr; }
  .camera-emergency-toolbar { flex-direction: column; align-items: flex-start; }
}
.camera-card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}
.camera-card-body .hint-save-state { font-size: 0.78rem; color: var(--muted); }
.camera-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.camera-empty-state i { font-size: 2.4rem; opacity: 0.3; margin-bottom: 10px; display: block; }

/* =========================================================
   TEMPLATE / RECORD CARDS
   ========================================================= */
.template-list,
.record-list {
  display: grid;
  gap: 12px;
}

.template-card,
.record-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.template-card:hover, .record-card:hover { border-color: rgba(0, 119, 183, 0.2); }

.record-card.activity-card-tone-a { background: var(--surface); }
.record-card.activity-card-tone-b { background: var(--surface-2); }

.record-card.activity-card-row { padding: 5px 14px; }
.record-card.activity-card-row.tone-b { background: var(--surface-2); }
.activity-row, .activity-header-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.activity-header-row { align-items: center; }
.activity-cell, .activity-hdr {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-hdr {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.activity-header-row {
  padding: 5px 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.activity-date { min-width: 88px; width: 88px; font-weight: 600; }
.activity-hdr.activity-date { color: var(--muted); font-weight: 800; }
.activity-cell.activity-date { color: var(--brand-navy); }
.activity-equip { min-width: 180px; width: 180px; }
.activity-cell.activity-equip strong { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 0.86rem; color: var(--brand-navy); line-height: 1.2; }
.activity-cell.activity-equip small { display: block; color: var(--muted); font-size: 0.7rem; line-height: 1.2; }
.activity-cell.activity-equip { white-space: normal; overflow: visible; }
.activity-cell.activity-equip.camera-equip-cell strong,
.activity-cell.activity-equip.camera-equip-cell small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
  color: var(--brand-navy);
  line-height: 1.15;
}
.activity-cell.activity-equip.camera-equip-cell strong { font-size: 0.84rem; }
.activity-cell.activity-equip.camera-equip-cell small { font-size: 0.76rem; }
.activity-desc {
  flex: 1.5;
  min-width: 120px;
  color: var(--ink-2);
  font-size: 0.84rem;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-word;
  line-height: 1.4;
}
.activity-ot,
.activity-ot2 {
  flex: 0 0 max-content;
  min-width: 72px;
  width: max-content;
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  font-weight: 700;
  color: var(--ink);
}
.activity-state { min-width: 80px; width: 80px; text-align: center; }
.activity-actions,
.activity-actions-hdr { min-width: 120px; width: 120px; text-align: right; white-space: nowrap; padding-top: 2px; }
.activity-state { padding-top: 2px; }
.activity-row .table-action { font-size: 0.75rem; padding: 3px 8px; white-space: nowrap; }
.activity-cell .status-pill.compact { font-size: 0.7rem; padding: 2px 8px; white-space: nowrap; width: auto; min-width: 64px; text-align: center; display: inline-block; }

.activity-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.selected-template {
  border-color: var(--brand-blue);
  background: linear-gradient(180deg, #fff, #f4faff);
  box-shadow: var(--ring);
}

.template-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.template-head strong { display: block; font-size: 1rem; color: var(--brand-navy); }
.template-head span:not(.badge) {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
}

.template-card p,
.record-card p {
  color: var(--ink-2);
  line-height: 1.55;
}

.activity-ot-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.activity-ot-summary span {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.86rem;
}
.activity-ot-summary strong {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
}

.maintenance-form,
.activity-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}
.maintenance-form { grid-template-columns: repeat(4, 1fr); }
.activity-form {
  grid-template-columns: minmax(132px, 0.75fr) minmax(180px, 1fr) minmax(260px, 1.6fr) minmax(96px, 0.48fr) minmax(118px, 0.56fr);
}
.activity-form .activity-tag-field,
.activity-form .activity-equipment-field { grid-column: span 1; }

.maintenance-form-actions {
  display: flex;
  gap: 10px;
  grid-column: 1 / -1;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-2);
}
.check-row input {
  width: auto;
  accent-color: var(--success);
}

.activity-grid { display: block; }

.radio-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}
.radio-row input {
  width: auto;
  accent-color: var(--success);
}

.reset-location-group .check-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.reset-location-group .radio-row {
  flex: 1;
  min-width: 120px;
}

/* =========================================================
   PHOTOS
   ========================================================= */
.photo-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 14px;
  overflow: visible;
}
.photo-grid img {
  width: 100%;
  aspect-ratio: 3 / 4;
  height: auto;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, z-index 0s 0.25s;
}
.photo-grid .photo-item {
  position: relative;
  margin: 0;
  z-index: 1;
}
.photo-grid .photo-item:hover {
  z-index: 2000;
}
.photo-grid .photo-item:hover img {
  position: relative;
  transform: scale(1.6);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  z-index: 2001;
  transition: transform 0.25s ease, box-shadow 0.25s ease, z-index 0s;
}
.photo-item img { display: block; }
.photo-item figcaption {
  position: absolute;
  left: 10px;
  bottom: 10px;
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(255, 106, 19, 0.94);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.photo-item.pending-photo img {
  outline: 3px solid rgba(255, 106, 19, 0.7);
  outline-offset: -3px;
}

.photo-item[draggable="true"] {
  cursor: grab;
}
.photo-item.drag-over {
  outline: 2px dashed var(--accent, #f97316);
  outline-offset: 2px;
  opacity: 0.6;
}
.photo-item.dragging {
  opacity: 0.25;
}

.photo-remove,
.delete-photo {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2010;
  border: 0;
  border-radius: 999px;
  padding: 6px 9px;
  color: #fff;
  background: rgba(185, 28, 28, 0.92);
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
}
.photo-remove:hover, .delete-photo:hover { background: var(--danger); }

.selected-photo-preview:empty { display: none; }
.selected-photo {
  overflow: hidden;
  border: 1px solid rgba(255, 106, 19, 0.32);
  border-radius: var(--radius);
  background: var(--brand-orange-soft);
}
.selected-photo figcaption {
  padding: 8px 10px;
  color: var(--brand-orange-strong);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* =========================================================
   STATUS PILLS
   ========================================================= */
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.status-pill.compact {
  min-height: 0;
  padding: 4px 9px;
  font-size: 0.72rem;
}

.status-pill.completed,
.equipment-status.completed strong,
.summary-ok { color: var(--success); }
.status-pill.completed { background: var(--success-soft); }
.status-pill.pending,
.equipment-status.pending strong,
.summary-pending { color: var(--danger); }
.status-pill.pending { background: var(--danger-soft); }

.maintenance-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.maintenance-summary span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--surface-2);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-2);
}

.maintenance-picker { display: grid; gap: 14px; }
.maintenance-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.equipment-status-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.equipment-status {
  display: grid;
  gap: 4px;
  min-height: 72px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}
.equipment-status:hover { box-shadow: var(--shadow-sm); }
.equipment-status.completed { border-left-color: var(--success); }
.equipment-status.pending { border-left-color: var(--danger); }
.equipment-status.active { border-color: var(--brand-blue); box-shadow: var(--ring); }
.equipment-status span { font-weight: 700; }
.equipment-status strong { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; }

.maintenance-save-state { margin-top: 6px; }

.badge { display: inline-block; border-radius: 999px; padding: 6px 10px; font-weight: 700; font-size: 0.78rem; background: #eef6fb; color: var(--brand-navy); }

/* =========================================================
   TAG TREE
   ========================================================= */
.tag-field { position: relative; }

.tag-tree-toggle {
  width: 100%;
  border: 1px solid var(--brand-blue-dark);
  border-radius: 10px;
  padding: 11px 14px;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark));
  color: #fff;
  text-align: left;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: filter 0.15s ease, transform 0.12s ease;
}
.tag-tree-toggle:hover { filter: brightness(1.06); }
.tag-tree-toggle::after { content: "+"; float: right; color: var(--brand-orange); font-weight: 900; }

.tag-tree-panel {
  position: absolute;
  z-index: 20;
  inset: calc(100% + 6px) 0 auto 0;
  width: min(760px, calc(100vw - 48px));
  min-width: 620px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid rgba(0, 119, 183, 0.28);
  border-radius: 12px;
  padding: 6px 8px 8px 2px;
  background: #f6fbfe;
  box-shadow: var(--shadow-lg);
  font-family: Tahoma, Verdana, sans-serif;
  font-size: 0.86rem;
}

.tag-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}
.tag-modal.hidden { display: none; }
.tag-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 21, 36, 0.62);
  backdrop-filter: blur(4px);
}
.tag-modal-card {
  position: relative;
  z-index: 1;
  width: min(1100px, calc(100vw - 32px));
  height: min(780px, calc(100vh - 32px));
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
  border: 1px solid rgba(0, 119, 183, 0.28);
  border-radius: 20px;
  padding: 20px;
  background: #f6fbfe;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}
.tag-modal-header,
.tag-modal-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tag-modal-header h3 { margin: 2px 0 0; color: var(--brand-navy); }
.tag-modal-close {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}
.tag-modal-close:hover { background: var(--surface-3); }
.tag-modal-tools input {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
}
.tag-picked {
  min-height: 22px;
  color: var(--muted);
  font-weight: 600;
  text-align: right;
}
.tag-tree-modal-panel {
  position: static;
  width: 100%;
  min-width: 0;
  max-height: none;
  padding: 12px 16px 16px 6px;
  box-shadow: inset 0 0 0 1px rgba(0, 119, 183, 0.12);
}

.tag-filter-hide { display: none !important; }

.tag-branch {
  position: relative;
  margin: 0 0 0 18px;
  padding-left: 12px;
  border-left: 1px dotted #8a8a8a;
}
.tag-branch summary {
  position: relative;
  cursor: pointer;
  color: #111;
  font-weight: 400;
  line-height: 1.25;
  list-style: none;
  white-space: nowrap;
}
.tag-branch summary::-webkit-details-marker { display: none; }
.tag-branch summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 13px;
  height: 13px;
  margin-right: 4px;
  border: 1px solid #777;
  border-radius: 0;
  background: #fff;
  color: #111;
  font-size: 0.72rem;
  line-height: 1;
}
.tag-branch[open] > summary::before { content: "-"; }
.tag-branch summary::after {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  width: 12px;
  border-top: 1px dotted #8a8a8a;
}

.tag-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.tag-label::before {
  content: "";
  width: 16px;
  height: 12px;
  flex: 0 0 auto;
  background: linear-gradient(180deg, var(--brand-blue), var(--brand-blue-dark));
  box-shadow: -2px -4px 0 -2px rgba(255, 106, 19, 0.55);
}
.tag-branch summary:hover .tag-label { background: rgba(0, 119, 183, 0.12); }
.tag-summary.selected { color: #111; text-shadow: none; }
.tag-summary.selected .tag-label { background: var(--brand-blue); color: #fff; }

.tag-node {
  position: relative;
  display: block;
  width: calc(100% - 8px);
  margin: 0 0 0 18px;
  border: 1px solid transparent;
  border-radius: 0;
  padding: 1px 8px 1px 24px;
  background: transparent;
  color: #111;
  text-align: left;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
  font-family: Tahoma, Verdana, sans-serif;
  font-size: 0.86rem;
}
.tag-node::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 50%;
  width: 18px;
  border-top: 1px dotted #8a8a8a;
}
.tag-node::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 16px;
  height: 12px;
  border-radius: 0;
  background: linear-gradient(180deg, var(--brand-blue), var(--brand-blue-dark));
  box-shadow: -2px -4px 0 -2px rgba(255, 106, 19, 0.55);
}
.tag-node:hover { border-color: transparent; background: rgba(0, 119, 183, 0.12); color: #111; }
.tag-node.selected { border-color: transparent; background: var(--brand-blue); color: #fff; }

/* =========================================================
   ACTIVITY TABLES
   ========================================================= */
.activity-table-wrap {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.activity-table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.activity-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  background: var(--surface);
}
.activity-table th,
.activity-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}
.activity-table th {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.activity-table tbody tr { cursor: pointer; transition: background 0.15s ease; }
.activity-table tbody tr:hover,
.activity-table .selected-row { background: #f0f8fd; }
.activity-table td:nth-child(2) {
  max-width: 520px;
  color: var(--ink-2);
  line-height: 1.5;
}
.activity-table td span:not(.status-pill) {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.table-action {
  padding: 7px 11px;
  font-size: 0.78rem;
}

/* =========================================================
   SAVE STATE PILL
   ========================================================= */
.aforo-save-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.78rem;
  background: var(--info-soft);
  color: var(--info);
  transition: background 0.2s ease, color 0.2s ease;
}
.aforo-save-state::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}
.aforo-save-state.pending { background: var(--warning-soft); color: var(--warning); }
.aforo-save-state.ok { background: var(--success-soft); color: var(--success); }
.aforo-save-state.error { background: var(--danger-soft); color: var(--danger); }

/* =========================================================
   THERMO MODULE
   ========================================================= */
.thermo-module {
  margin-top: 16px;
  padding: 18px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(0, 119, 183, 0.04), transparent 40%), var(--surface-2);
  box-shadow: inset 0 0 0 1px rgba(0, 119, 183, 0.08);
}

.thermo-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(420px, auto);
  gap: 20px;
  align-items: end;
  border: 0;
  border-radius: var(--radius-lg);
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0)),
    linear-gradient(135deg, var(--brand-navy), var(--brand-blue));
  box-shadow: 0 14px 28px rgba(0, 119, 183, 0.22);
}
.thermo-toolbar h3 { color: #fff; }
.thermo-toolbar .label-top { color: #ffd0b5; }
.thermo-toolbar .hint { color: rgba(255, 255, 255, 0.78); }
.thermo-toolbar label { color: rgba(255, 255, 255, 0.92); font-weight: 700; }
.thermo-toolbar select { background: #fff; color: var(--ink); }
.thermo-toolbar .primary-button { background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-strong)); }
.thermo-toolbar .soft-button { color: var(--brand-blue-dark); background: #fff; border-color: transparent; }
.thermo-toolbar .soft-button:hover { background: rgba(255, 255, 255, 0.88); }

.thermo-module .card:not(.thermo-toolbar) {
  border-color: var(--line);
  box-shadow: var(--shadow-xs);
}

.thermo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  justify-content: flex-end;
}
.thermo-actions label { min-width: 210px; }


.thermo-panel { display: none; }
.thermo-panel.active-thermo-panel { display: block; }

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

.thermo-table-wrap { display: grid; gap: 12px; }
.thermo-table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.thermo-table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
}
.thermo-table th,
.thermo-table td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}
.thermo-table th {
  color: #fff;
  background: var(--brand-navy);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
}
.thermo-table tr:nth-child(even) td { background: var(--surface-2); }
.thermo-table tr:hover td { background: #ecf6fc; }

.thermo-table input.thermo-temp {
  width: 90px;
  padding: 8px 10px;
  text-align: center;
  font-weight: 700;
  font-family: var(--font-mono);
}
.thermo-table input.thermo-temp:disabled {
  color: var(--muted);
  background: var(--surface-3);
}

.switch-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
}
.switch-row input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.switch-row span {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #c8d2dc;
  transition: 0.2s ease;
}
.switch-row span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  transition: 0.2s ease;
}
.switch-row input:checked + span { background: var(--danger); }
.switch-row input:checked + span::after { transform: translateX(20px); }

.thermo-save { margin-top: 16px; }

.maintenance-form .soft-button[type="submit"] {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark));
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(0, 119, 183, 0.22);
}
.maintenance-form .soft-button[type="submit"] .button-icon {
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
}

.thermo-stats-grid {
  display: grid;
  gap: 16px;
}
.thermo-stats-grid canvas {
  width: 100%;
  height: 320px !important;
  max-height: 360px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
}
.thermo-stats-status {
  min-height: 18px;
  margin: -6px 0 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}
.thermo-stats-status.ok { color: var(--success); }
.thermo-stats-status.pending { color: var(--warning); }
.thermo-stats-status.warn { color: var(--warning); }
.thermo-stats-status.error { color: var(--danger); }

/* =========================================================
   PLAN
   ========================================================= */
.plan-module { display: none; }
.plan-module.active-section { display: block; }

.plan-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-top: 16px;
}
.plan-header h3 { color: var(--brand-navy); }

.plan-status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.plan-pill {
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
}
.plan-pill.ok { color: var(--success); background: var(--success-soft); }
.plan-pill.pending { color: var(--muted); background: var(--surface-3); }
.plan-pill.process { color: var(--brand-orange-strong); background: var(--brand-orange-soft); }
.plan-pill.cancelled { color: var(--danger); background: var(--danger-soft); }
.plan-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.plan-plant-tabs { padding: 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); width: fit-content; box-shadow: var(--shadow-xs); }
.plan-date-filter {
  display: grid;
  gap: 6px;
  min-width: 210px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.plan-date-filter select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background-color: var(--surface);
  box-shadow: var(--shadow-xs);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: none;
}

.plan-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.plan-summary-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.plan-summary-card.total {
  border-color: rgba(0, 119, 183, 0.28);
  background: linear-gradient(135deg, #edf6fc, #ffffff);
}
.plan-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.plan-summary-head span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.plan-summary-head strong {
  color: var(--brand-navy);
  font-size: 1.4rem;
  line-height: 1;
  letter-spacing: -0.03em;
}
.plan-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}
.plan-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--success), #34d399);
}
.plan-summary-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}
.plan-summary-stats p {
  margin: 0;
  padding: 8px 6px;
  border-radius: 10px;
  background: var(--surface-2);
  text-align: center;
}
.plan-summary-stats strong { display: block; color: var(--ink); font-size: 1.02rem; }
.plan-summary-stats span { color: var(--muted); font-size: 0.68rem; font-weight: 700; }

.plan-table-wrap { margin-top: 16px; padding: 0; overflow: hidden; }
.plan-filter-summary {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(90deg, rgba(0,119,183,0.08), rgba(255,255,255,0));
  color: var(--brand-blue-dark);
  font-size: 0.84rem;
  font-weight: 800;
}
.plan-table-scroll { overflow-x: auto; }
.plan-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}
.plan-table th,
.plan-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}
.plan-table th {
  color: var(--brand-blue-dark);
  background: var(--surface-2);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}

/* =========================================================
   OT LOADER
   ========================================================= */
.ot-loader-module { margin-top: 16px; }
.ot-loader-modal {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
}
.ot-loader-hero {
  margin-top: 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-blue-dark));
}
.ot-loader-hero h3 { color: #fff; }
.ot-loader-hero .hint { color: rgba(255, 255, 255, 0.78); }
.ot-loader-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: end;
  margin-top: 16px;
}
.ot-loader-result { margin-top: 16px; }
.ot-loader-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.ot-loader-summary span {
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--info-soft);
  color: var(--info);
  font-weight: 700;
}
.ot-result-table { overflow-x: auto; }
.ot-result-table table {
  width: 100%;
  border-collapse: collapse;
}
.ot-result-table th,
.ot-result-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
}
.ot-result-table th {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}
.ot-unmatched-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.ot-unmatched-list span {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: var(--surface-2);
}
.plan-table td { font-size: 0.88rem; }
.plan-table tbody tr:hover { background: var(--surface-2); }

.plan-status-select {
  min-width: 128px;
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 700;
  font-size: 0.82rem;
}
.plan-status-select.ok { color: var(--success); border-color: rgba(21, 128, 61, 0.28); background: var(--success-soft); }
.plan-status-select.pending { color: var(--muted); border-color: rgba(91, 107, 128, 0.26); background: var(--surface-3); }
.plan-status-select.process { color: var(--brand-orange-strong); border-color: rgba(255, 106, 19, 0.32); background: var(--brand-orange-soft); }
.plan-status-select.cancelled { color: var(--danger); border-color: rgba(185, 28, 28, 0.28); background: var(--danger-soft); }

/* =========================================================
   EQUATIONS
   ========================================================= */
#control { display: none; }
#control.active-section { display: block; }

.equations-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-top: 16px;
  background:
    radial-gradient(circle at 85% 0, rgba(255, 106, 19, 0.1), transparent 30%),
    linear-gradient(135deg, #fff, #f5fbff);
}
.equations-header h3 { color: var(--brand-navy); }

.eq-version-mark {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--brand-orange);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  vertical-align: middle;
}

.equation-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
}
.equation-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 140px;
}
.equation-form select,
.equation-form input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.equation-form label:last-of-type { min-width: 0; }
.plant-readonly-field {
  background: var(--surface-3) !important;
  color: var(--muted);
  cursor: default;
  text-transform: capitalize;
  pointer-events: none;
  border-color: var(--line) !important;
}
.equation-form .eq-tag-field,
.equation-form .eq-flow-field { flex: 2 1 260px; min-width: 220px; }
.equation-form .eq-equipment-field { flex: 1.6 1 230px; min-width: 200px; }
.equation-form .eq-date-field { flex: 0 0 132px; }
.equation-form .eq-time-field { flex: 0 0 92px; }
.equation-form .eq-time-field input { text-align: center; }
.equation-form .eq-plant-field { flex: 0 0 118px; }
.equation-form .eq-offset-field { flex: 0 0 108px; }
.equation-form .eq-offset-field input { text-align: center; font-family: var(--font-mono); }

.eq-elements-offset-row {
  display: flex;
  align-items: end;
  gap: 10px;
  flex: 0 0 auto;
}

.equation-elements {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  flex: 1 1 auto;
  align-items: center;
  white-space: nowrap;
}

.eq-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 0 0 auto;
}
.eq-field-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
  text-transform: none;
  letter-spacing: normal;
  white-space: nowrap;
}

.eq-elements {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  box-sizing: border-box;
}
.eq-elements label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 0;
  padding: 0;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  color: var(--ink-2);
}
.eq-elements input {
  width: 13px;
  height: 13px;
  margin: 0;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  border: 1.5px solid var(--brand-blue);
  border-radius: 3px;
  background: #fff;
  display: inline-block;
  vertical-align: middle;
}
.eq-elements input:checked { background: var(--brand-blue); }

.equation-form-actions {
  display: flex;
  gap: 10px;
  align-items: end;
  justify-content: center;
  flex: 0 0 118px;
  align-self: end;
}
.equation-form-actions .primary-button { min-width: 112px; height: 42px; }

.equation-list { margin-top: 16px; padding: 0; overflow: hidden; }
.equation-table-scroll { overflow-x: auto; }
.equation-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}
.equation-table th,
.equation-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}
.equation-table th {
  color: var(--brand-blue-dark);
  background: var(--surface-2);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}
.equation-table tbody tr:hover { background: var(--surface-2); }
.equation-table td strong { display: block; color: var(--brand-navy); font-weight: 700; }
.equation-table td span { display: block; color: var(--muted); font-size: 0.8rem; }
.equation-badge.psi {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--brand-orange-strong);
  background: var(--brand-orange-soft);
  font-weight: 800;
  font-size: 0.78rem;
}

/* =========================================================
   AFOROS
   ========================================================= */
#aforos { display: none; }
#aforos.active-section { display: block; }

.aforo-hero,
.Afonso-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-top: 16px;
  background:
    radial-gradient(circle at 90% 10%, rgba(255, 106, 19, 0.1), transparent 26%),
    linear-gradient(135deg, #fff, #f5fbff);
}
.aforo-hero h3, .Afonso-hero h3 { color: var(--brand-navy); }
.aforo-actions { display: flex; align-items: center; gap: 10px; }

.aforo-summary {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}
.aforo-summary:empty { display: none; }

.aforo-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
}
.molino-summary-grid { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.aforo-summary-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.aforo-summary-card span {
  display: block;
  min-height: 34px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.aforo-summary-card strong {
  display: block;
  margin-top: 8px;
  color: var(--brand-blue-dark);
  font-size: 1.3rem;
  letter-spacing: -0.03em;
  font-family: var(--font-mono);
}

.aforo-chart-card {
  padding: 20px;
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-blue));
  color: #fff;
  border: 0;
}
.aforo-chart-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.aforo-chart-head h3 { margin: 0; color: #fff; }
.aforo-chart-head .label-top { color: rgba(255, 255, 255, 0.72); }
.aforo-chart-head span {
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
}
.aforo-chart { display: grid; gap: 10px; }
.aforo-chart-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 3fr) 80px;
  gap: 12px;
  align-items: center;
}
.aforo-chart-row span { color: rgba(255, 255, 255, 0.82); font-size: 0.84rem; font-weight: 700; }
.aforo-chart-row div { height: 10px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, 0.14); }
.aforo-chart-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-orange), #ffc99c);
  box-shadow: 0 0 18px rgba(255, 106, 19, 0.42);
}
.aforo-chart-row strong { text-align: right; font-size: 0.9rem; font-family: var(--font-mono); }

.aforo-content { display: grid; gap: 16px; }
.aforo-meta-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(360px, 1.3fr);
  gap: 16px;
  align-items: end;
}
.aforo-meta-card h3 { margin: 0; color: var(--brand-navy); }
.aforo-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.aforo-meta-grid input { padding: 10px 12px; }

.aforo-card { overflow: hidden; }
.aforo-card-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.aforo-card-title h3 { margin: 0; color: var(--brand-navy); }
.aforo-card-title span {
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--brand-orange-strong);
  background: var(--brand-orange-soft);
  font-weight: 700;
  font-size: 0.78rem;
}
.aforo-card-title strong {
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--brand-blue-dark);
  background: var(--info-soft);
  font-size: 0.84rem;
  font-weight: 700;
}

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

.molino-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.molino-card {
  display: grid;
  gap: 14px;
  background: radial-gradient(circle at 100% 0, rgba(255, 106, 19, 0.1), transparent 28%), var(--surface);
}
.molino-card .aforo-card-title { margin-bottom: 0; }
.molino-main-flow { background: var(--surface-2); }
.molino-main-flow dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.molino-main-flow dl div:last-child {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark));
}
.molino-main-flow dl div:last-child dt,
.molino-main-flow dl div:last-child dd { color: #fff; }

.molino-fields { margin-top: 0; }
.molino-field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}
.molino-field-grid input { padding: 10px 12px; }

.aforo-calculated-box {
  display: grid;
  align-content: center;
  min-height: 60px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark));
  color: #fff;
}
.aforo-calculated-box span { font-size: 0.74rem; font-weight: 800; text-transform: uppercase; opacity: 0.85; letter-spacing: 0.08em; }
.aforo-calculated-box strong { margin-top: 4px; font-size: 1.2rem; font-family: var(--font-mono); }

.relave-flow-note { padding: 0 12px 12px; }

.aforo-excel-summary {
  margin-top: 4px;
  border: 1px solid rgba(0, 119, 183, 0.22);
  background:
    linear-gradient(90deg, rgba(0, 119, 183, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(0, 119, 183, 0.05) 1px, transparent 1px),
    #fff;
  background-size: 44px 44px;
}
.aforo-excel-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.75fr) minmax(420px, 1.25fr);
  gap: 18px;
  align-items: stretch;
}
.aforo-excel-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
}
.aforo-excel-table th,
.aforo-excel-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
}
.aforo-excel-table th {
  color: #fff;
  background: var(--brand-blue);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
}
.aforo-excel-table td:last-child {
  color: var(--brand-blue-dark);
  font-weight: 800;
  text-align: right;
  font-family: var(--font-mono);
}

.aforo-excel-chart-full {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
}
.aforo-excel-bar-row {
  display: grid;
  grid-template-columns: 180px 1fr 80px;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(240, 246, 250, 0.7);
  border: 1px solid rgba(0, 119, 183, 0.08);
  transition: background 0.15s, transform 0.1s;
}
.aforo-excel-bar-row:hover { background: rgba(0, 119, 183, 0.06); transform: translateX(2px); }
.aforo-excel-bar-row span {
  color: var(--brand-navy);
  font-size: 0.8rem;
  font-weight: 700;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.aforo-ton {
  font-size: 0.72rem;
  color: var(--brand-orange);
  font-weight: 600;
}
.aforo-excel-bar-row strong {
  color: var(--brand-blue-dark);
  text-align: right;
  font-size: 0.9rem;
  font-family: var(--font-mono);
}
.aforo-excel-bar-track {
  height: 20px;
  border: 1px solid rgba(0, 119, 183, 0.12);
  border-radius: 999px;
  background: rgba(0, 119, 183, 0.05);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}
.aforo-excel-bar-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0d5f8a, var(--brand-blue), #4fb8e8);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.23,1,0.32,1);
  box-shadow: 0 2px 8px rgba(0,119,183,0.25);
}
.aforo-excel-total {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(0, 119, 183, 0.12), rgba(255, 106, 19, 0.08));
  border: 1px solid rgba(0, 119, 183, 0.2);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brand-navy);
}
.aforo-excel-total strong { color: var(--brand-blue-dark); font-family: var(--font-mono); }
.aforo-excel-total .aforo-ton { margin-left: auto; }

/* === Resumen aforo mejorado === */
.aforo-summary-wrap {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  background: rgba(255,255,255,0.95);
}
.aforo-summary-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0,119,183,0.15);
  background: #fff;
  font-size: 0.85rem;
}
.aforo-summary-table thead tr { background: linear-gradient(135deg, #0077b7, #005580); }
.aforo-summary-table th {
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}
.aforo-summary-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0,119,183,0.08);
  color: var(--brand-navy);
}
.aforo-summary-table tbody tr:last-child td { border-bottom: none; }
.aforo-summary-table tbody tr:hover td { background: rgba(0,119,183,0.04); }
.aforo-summary-table tfoot tr { background: rgba(0,119,183,0.08); }
.aforo-summary-table tfoot td {
  padding: 10px 14px;
  font-weight: 800;
  color: var(--brand-navy);
}
.af-row-name { font-weight: 700; color: var(--brand-navy); }
.af-row-liters { color: var(--brand-blue-dark); font-family: var(--font-mono); text-align: right; }
.af-row-liters strong { font-size: 1rem; }
.af-row-ton { font-family: var(--font-mono); font-weight: 700; text-align: center; color: var(--brand-orange); }
.af-row-pct { min-width: 100px; }
.af-pct-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(0,119,183,0.12);
  color: var(--brand-blue-dark);
  font-size: 0.75rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.af-mini-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(0,119,183,0.1);
  overflow: hidden;
  width: 80px;
}
.af-mini-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-orange));
  border-radius: 3px;
}
.af-ton-source {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 106, 19, 0.12);
  color: var(--brand-orange);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  vertical-align: middle;
  cursor: help;
}
.af-dash {
  color: var(--line-soft);
  font-size: 1.2rem;
  font-weight: 300;
}
.af-ton-note {
  display: block;
  color: var(--brand-orange);
  font-size: 0.65rem;
  font-weight: 700;
  margin-top: 2px;
}
.aforo-summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.aforo-stat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(0,119,183,0.12);
  box-shadow: 0 2px 8px rgba(0,119,183,0.06);
}
.aforo-stat-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--brand-blue-dark);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.aforo-stat-bar {
  height: 10px;
  border-radius: 5px;
  background: rgba(0,119,183,0.08);
  overflow: hidden;
}
.aforo-stat-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-orange));
  border-radius: 5px;
}
.aforo-stat-val {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brand-navy);
  font-family: var(--font-mono);
}

/* === Vertical Bar Chart (barras verticales modernas) === */
.aforo-vbar-chart {
  margin-top: 24px;
  padding: 24px 20px 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(240,248,255,0.7));
  border-radius: 16px;
  border: 1px solid rgba(0,119,183,0.1);
  box-shadow: 0 4px 16px rgba(0,119,183,0.06);
}
.aforo-vbar-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 16px;
  padding: 0 10px;
}
.aforo-vbar-col {
  display: grid;
  grid-template-rows: auto 200px 36px;
  justify-items: center;
  gap: 8px;
}
.aforo-vbar-track {
  width: 56px;
  height: 100%;
  background: rgba(0,119,183,0.05);
  border-radius: 10px 10px 4px 4px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  border: 1px solid rgba(0,119,183,0.08);
}
.aforo-vbar-fill {
  width: 100%;
  background: linear-gradient(180deg, #4fc3f7 0%, #0288d1 40%, #01579b 100%);
  border-radius: 8px 8px 0 0;
  transition: height 0.8s cubic-bezier(0.23, 1, 0.32, 1);
  box-shadow: inset 0 2px 6px rgba(255,255,255,0.35), 0 -3px 10px rgba(2,136,209,0.25);
  position: relative;
}
.aforo-vbar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, rgba(255,255,255,0.7), rgba(255,255,255,0.2));
  border-radius: 8px 8px 0 0;
}
.aforo-vbar-val {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--brand-navy);
  font-family: var(--font-mono);
  background: rgba(0,119,183,0.08);
  padding: 5px 12px;
  border-radius: 8px;
  white-space: nowrap;
  border: 1px solid rgba(0,119,183,0.1);
}
.aforo-vbar-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--brand-blue-dark);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.25;
  height: 36px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
}
.af-total-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0,119,183,0.15), rgba(255,106,19,0.1));
  border: 1px solid rgba(0,119,183,0.25);
  margin-top: 10px;
}
.af-total-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--brand-blue-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.af-total-value {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--brand-navy);
  font-family: var(--font-mono);
}
.af-total-sub {
  font-size: 0.72rem;
  color: rgba(0,119,183,0.6);
  font-weight: 600;
  margin-left: auto;
}

.aforo-flow {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.aforo-flow h4 { margin: 0 0 12px; color: var(--brand-blue-dark); }

.aforo-samples,
.aforo-mini-fields,
.aforo-side-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.aforo-flow label,
.aforo-side-fields label { font-size: 0.78rem; }
.aforo-flow input,
.aforo-side-fields input,
.aforo-note textarea { padding: 10px 12px; }

.aforo-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.68rem;
  color: var(--brand-blue-dark);
  opacity: 0.72;
  font-style: italic;
}

.aforo-section-hint {
  grid-column: 1 / -1;
  margin: 0 0 -2px;
  padding: 6px 12px;
  font-size: 0.72rem;
  color: var(--brand-orange-strong);
  background: var(--brand-orange-soft);
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
  width: max-content;
}

.aforo-section { padding: 22px; }
.aforo-sub {
  margin: 18px 0 8px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-blue-dark);
}

.aforo-excel-input-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 6px;
}
.aforo-excel-input {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.aforo-excel-input thead th {
  background: linear-gradient(180deg, var(--surface-2), var(--surface-3));
  color: var(--brand-blue-dark);
  text-align: left;
  padding: 10px 12px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
  border-bottom: 2px solid var(--line);
}
.aforo-excel-input tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.aforo-excel-input tbody tr:last-child td { border-bottom: 0; }
.aforo-excel-input tbody tr:nth-child(even) td { background: var(--surface-2); }

.aforo-label { font-weight: 700; color: var(--brand-navy); min-width: 220px; }

.aforo-in input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
  background: #fff;
  font-family: var(--font-mono);
}
.aforo-in input:focus {
  outline: 2px solid var(--brand-blue);
  outline-offset: -1px;
  border-color: var(--brand-blue);
}
.aforo-in input:disabled { background: var(--surface-3); color: var(--muted); }

.aforo-out {
  background: linear-gradient(180deg, var(--brand-orange-soft), #ffe3cc);
  text-align: center;
  font-family: var(--font-mono);
  color: var(--brand-orange-strong);
  font-weight: 800;
  border-left: 3px solid var(--brand-orange);
  border-right: 3px solid var(--brand-orange);
}
.aforo-out strong { font-size: 1rem; letter-spacing: 0.02em; }

.aforo-hint-cell { font-size: 0.7rem; color: var(--muted); font-style: italic; min-width: 200px; }
.aforo-hint-col { width: 220px; }

.aforo-excel-samples thead th {
  background: linear-gradient(180deg, var(--brand-orange-soft), #ffd9bd);
  color: var(--brand-orange-strong);
  border-bottom-color: #f0a878;
}
.aforo-excel-samples .aforo-label { color: var(--brand-orange-strong); }

.aforo-liters-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.aforo-liters-card {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-strong));
  color: #fff;
  box-shadow: 0 6px 18px rgba(240, 101, 67, 0.32);
}
.aforo-liters-card span {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.92;
  display: block;
  font-weight: 800;
}
.aforo-liters-card strong {
  display: block;
  font-size: 1.45rem;
  font-weight: 900;
  margin-top: 6px;
  font-family: var(--font-mono);
}

@media (max-width: 720px) {
  .aforo-section { padding: 16px; }
  .aforo-label { min-width: 150px; font-size: 0.8rem; }
  .aforo-hint-cell { display: none; }
}

.aforo-flow dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.aforo-flow dl div {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.aforo-flow dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.aforo-flow dd {
  margin: 4px 0 0;
  color: var(--brand-navy);
  font-size: 1.1rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.aforo-note { display: block; margin-top: 10px; }
.aforo-note textarea { min-height: 62px; resize: vertical; }

.aforo-manual-matrix {
  margin-top: 16px;
  border: 1px solid rgba(0, 119, 183, 0.2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #fff;
}
.aforo-matrix-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: var(--brand-blue-dark);
  background: var(--surface-2);
  font-weight: 700;
}
.aforo-matrix-title span { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.aforo-matrix-scroll { overflow-x: auto; }
.aforo-manual-matrix table { width: 100%; min-width: 680px; border-collapse: collapse; }
.aforo-manual-matrix th,
.aforo-manual-matrix td {
  padding: 10px 12px;
  border-top: 1px solid var(--line-soft);
  text-align: left;
}
.aforo-manual-matrix th {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: var(--surface-3);
  font-weight: 800;
}
.aforo-manual-matrix td:first-child { color: var(--brand-navy); font-weight: 700; }
.aforo-manual-matrix input,
.aforo-manual-matrix textarea { min-width: 110px; padding: 9px 12px; }
.aforo-manual-matrix textarea { width: 100%; min-height: 54px; resize: vertical; }
.compact-matrix table { min-width: 520px; }
.aforo-calculated-row td:last-child {
  color: var(--brand-blue-dark);
  font-weight: 800;
  font-size: 1.02rem;
  font-family: var(--font-mono);
}

.aforo-single-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) minmax(260px, 0.8fr);
  gap: 14px;
}
.aforo-side-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; }
.aforo-side-fields .aforo-note { grid-column: 1 / -1; margin-top: 0; }

/* =========================================================
   INFORMES
   ========================================================= */
.informes-module {
  padding: 0 0 42px;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 106, 19, 0.08), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(24, 115, 171, 0.06), transparent 50%),
    linear-gradient(180deg, #f4f8fc 0%, #eaf0f6 100%);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-top: 16px;
}

.informes-hero {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 22px;
  padding: 40px 36px 32px;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(135deg, #020d18 0%, #082a3d 30%, #114b66 60%, #c94d0a 100%);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  position: relative;
}
.informes-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 75% 20%, rgba(255,106,19,0.35), transparent 60%),
    radial-gradient(ellipse at 25% 80%, rgba(24,115,171,0.25), transparent 55%);
  animation: heroShimmer 6s ease-in-out infinite alternate;
}
@keyframes heroShimmer {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}
.informes-hero::after {
  content: "";
  position: absolute;
  inset: auto -80px -120px auto;
  width: 350px;
  height: 350px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  filter: blur(60px);
  animation: heroOrb 8s ease-in-out infinite alternate;
}
@keyframes heroOrb {
  0% { transform: translate(20px, 10px) scale(1); }
  100% { transform: translate(-20px, -10px) scale(1.15); }
}
.informes-hero-text { position: relative; z-index: 1; max-width: 720px; }
.informes-hero-text .label-top {
  color: #ffd0b5;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.informes-hero-text .label-top::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff6a13;
  box-shadow: 0 0 10px #ff6a13, 0 0 20px rgba(255,106,19,0.5);
  animation: pulseDot 2s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.8); }
}
.informes-hero-text h3 {
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  line-height: 1.04;
  margin: 0 0 12px;
  letter-spacing: -0.04em;
  color: #fff;
  font-weight: 800;
  text-shadow: 0 2px 20px rgba(0,0,0,0.2);
}
.informes-hero-text .hint { margin: 0; color: rgba(255,255,255,0.72); max-width: 660px; font-size: 0.92rem; line-height: 1.5; }
.informes-hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.report-week-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-weight: 800;
  border: 1px solid rgba(255,255,255,0.2);
  backdrop-filter: blur(16px);
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.report-week-pill::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74,222,128,0.6);
}

.report-command-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 20px 28px 0;
  padding: 14px 18px;
  border: 1px solid rgba(8,48,76,0.06);
  border-radius: 16px;
  background: rgba(255,255,255,0.9);
  box-shadow: 0 2px 16px rgba(0,0,0,0.04), 0 0 0 1px rgba(255,255,255,0.6) inset;
  backdrop-filter: blur(20px);
}

.report-plant-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: #e8edf2;
}
.report-plant-switch button {
  border: 0;
  border-radius: 999px;
  padding: 9px 18px;
  background: transparent;
  color: #5f7685;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.84rem;
  transition: all 0.25s;
}
.report-plant-switch button:hover:not(.active) {
  color: var(--brand-navy);
  background: rgba(255,255,255,0.5);
}
.report-plant-switch button.active {
  background: var(--brand-navy);
  color: #fff;
  box-shadow: 0 6px 20px rgba(11,31,51,0.25);
}
.report-type-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--brand-blue-dark);
  font-size: 0.84rem;
}
.report-type-filter select { min-width: 190px; }

.report-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 28px 0;
  animation: kpisSlideIn 0.5s ease-out;
}
@keyframes kpisSlideIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.report-kpi {
  position: relative;
  overflow: hidden;
  padding: 22px 24px 20px;
  min-height: 120px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(8,48,76,0.08);
  box-shadow: 0 2px 12px rgba(0,0,0,0.04), 0 0 0 1px rgba(255,255,255,0.8) inset;
  transition: all 0.3s ease;
  cursor: default;
}
.report-kpi:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.08), 0 0 0 1px rgba(255,255,255,0.8) inset;
  border-color: rgba(8,48,76,0.16);
}
.report-kpi::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--kpi-glow, rgba(255,106,19,0.08)), transparent 40%);
  pointer-events: none;
}
.report-kpi::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -50px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: var(--kpi-glow, rgba(255,106,19,0.08));
  filter: blur(8px);
  transition: all 0.4s ease;
}
.report-kpi:hover::after {
  transform: scale(1.2);
}
.report-kpi span {
  position: relative;
  z-index: 1;
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}
.report-kpi strong {
  position: relative;
  z-index: 1;
  display: block;
  color: var(--brand-navy);
  font-size: clamp(1.8rem, 2.4vw, 2.4rem);
  line-height: 1;
  letter-spacing: -0.05em;
  font-weight: 900;
  transition: color 0.3s;
}
.report-kpi small {
  position: relative;
  z-index: 1;
  display: block;
  color: var(--muted);
  margin-top: 10px;
  font-weight: 600;
  font-size: 0.78rem;
  line-height: 1.3;
}

.report-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  margin: 20px 28px 0;
  animation: gridFadeIn 0.6s ease-out;
}
@keyframes gridFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.report-panel {
  min-width: 0;
  padding: 22px 24px;
  border-radius: 18px;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(8,48,76,0.07);
  box-shadow: 0 2px 14px rgba(0,0,0,0.03), 0 0 0 1px rgba(255,255,255,0.7) inset;
  transition: all 0.3s ease;
  backdrop-filter: blur(12px);
}
.report-panel:hover {
  box-shadow: 0 8px 28px rgba(0,0,0,0.06), 0 0 0 1px rgba(255,255,255,0.7) inset;
}
.report-wide { grid-column: 1 / -1; }

.report-panel-main {
  position: relative;
  overflow: hidden;
}
.report-panel-main::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(46,125,50,0.08), transparent 60%);
  pointer-events: none;
}

.report-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.report-panel-title span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.report-panel-title strong {
  color: var(--brand-orange-strong);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.report-brief {
  background: linear-gradient(160deg, #041a28 0%, #0a2e42 40%, #0f3d5a 100%);
  color: #fff;
  border-color: transparent;
  position: relative;
  overflow: hidden;
}
.report-brief::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 85% 15%, rgba(255,106,19,0.12), transparent 50%),
    radial-gradient(ellipse at 15% 85%, rgba(24,115,171,0.1), transparent 45%);
  pointer-events: none;
}
.report-brief h4, .report-detail h4 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 800;
  position: relative;
  letter-spacing: -0.02em;
}
.report-brief p {
  margin: 0 0 14px;
  color: rgba(255,255,255,0.78);
  line-height: 1.6;
  font-size: 0.88rem;
  position: relative;
}
.report-brief ul,
.report-detail ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.report-brief li,
.report-detail li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.07);
  font-size: 0.87rem;
  line-height: 1.4;
  transition: background 0.2s;
}
.report-brief li:hover {
  background: rgba(255,255,255,0.12);
}
.report-detail { position: relative; }
.report-detail li {
  background: #f7fafc;
  color: var(--ink-2);
  border: 1px solid rgba(8,48,76,0.05);
  transition: all 0.2s;
}
.report-detail li:hover {
  background: #eef4f8;
  border-color: rgba(8,48,76,0.1);
  transform: translateX(3px);
}

.report-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--brand-orange);
  flex: 0 0 auto;
  box-shadow: 0 0 8px rgba(255,106,19,0.4);
}

.report-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(8,48,76,0.08);
  box-shadow: 0 1px 6px rgba(0,0,0,0.03);
}
.report-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 0.83rem;
}
.report-table th {
  text-align: left;
  padding: 11px 14px;
  background: var(--brand-navy);
  color: #fff;
  font-size: 0.69rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 800;
  border-bottom: 2px solid rgba(255,106,19,0.3);
}
.report-table td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(8,48,76,0.05);
  color: var(--ink-2);
  vertical-align: top;
  transition: background 0.15s;
}
.report-table tbody tr:hover td {
  background: rgba(255,106,19,0.03);
}
.report-table tr:nth-child(even) td {
  background: #f9fbfd;
}
.report-table tr:nth-child(even):hover td {
  background: rgba(255,106,19,0.05);
}

.report-section {
  margin-top: 28px;
  padding: 24px 28px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(8,48,76,0.07);
  border-radius: 18px;
  box-shadow: 0 2px 14px rgba(0,0,0,0.03);
  margin-left: 28px;
  margin-right: 28px;
  backdrop-filter: blur(12px);
}
.report-section-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--brand-navy);
  margin: 0 0 18px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.02em;
}
.report-section-empty { margin: 0; color: #8899a6; font-weight: 600; }
.report-mini-badge {
  display: inline-flex;
  padding: 4px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #e8f4fd, #d1eaf9);
  color: #0d4466;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  border: 1px solid rgba(24,115,171,0.15);
}
.report-mini-badge:has(+ td) {
  text-transform: uppercase;
}
.report-maint-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.report-maint-card {
  padding: 16px 14px;
  border-radius: 14px;
  background: #f7fafc;
  border: 1px solid rgba(8,48,76,0.06);
  transition: all 0.25s;
}
.report-maint-card:hover {
  background: #eef4f8;
  border-color: rgba(8,48,76,0.12);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}
.report-maint-card span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.report-maint-card strong {
  display: block;
  color: var(--brand-navy);
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.report-cause-bars { display: grid; gap: 10px; margin-top: 14px; }
.report-cause-row {
  display: grid;
  grid-template-columns: 170px 1fr 42px;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-2);
}
.report-cause-track {
  height: 10px;
  border-radius: 999px;
  background: #e8edf2;
  overflow: hidden;
}
.report-cause-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff6a13, #f0853f);
  transition: width 0.8s ease-out;
}

.report-aforo-classic { margin-top: 14px; }
.report-aforo-classic .aforo-excel-chart {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.report-aforo-classic .aforo-excel-bar-row {
  display: grid;
  grid-template-columns: 180px 1fr 70px;
  gap: 12px;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-2);
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.15s;
}
.report-aforo-classic .aforo-excel-bar-row:hover { background: rgba(0, 119, 183, 0.04); }
.report-aforo-classic .aforo-excel-bar-row span {
  min-width: 0;
  width: 180px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  color: var(--brand-navy);
  letter-spacing: -0.01em;
}
.report-aforo-classic .aforo-excel-bar-track {
  height: 18px;
  border-radius: 999px;
  background: #e8edf2;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}
.report-aforo-classic .aforo-excel-bar-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0d5f8a, #2e9dd4, #4fb8e8);
  transition: width 0.8s cubic-bezier(0.23,1,0.32,1);
  box-shadow: 0 2px 6px rgba(46,157,212,0.3);
}
.report-aforo-classic strong {
  text-align: right;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  color: var(--brand-blue-dark);
  letter-spacing: -0.02em;
}

@media (max-width: 1024px) {
  .report-maint-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-cause-row { grid-template-columns: 1fr; }
  .report-aforo-classic .aforo-excel-bar-row {
    grid-template-columns: 140px 1fr 60px;
  }
  .report-aforo-classic .aforo-excel-bar-row span { width: 140px; max-width: 140px; }
}
@media (max-width: 600px) {
  .report-aforo-classic .aforo-excel-bar-row {
    grid-template-columns: 1fr 60px;
    grid-template-rows: auto auto;
  }
  .report-aforo-classic .aforo-excel-bar-row span { grid-column: 1 / -1; width: auto; max-width: none; }
  .report-aforo-classic .aforo-excel-bar-track { grid-column: 1; }
}

.report-status {
  text-align: center;
  color: #8899a6;
  font-size: 0.82rem;
  font-weight: 700;
  margin-top: 18px;
  padding: 10px;
  border-radius: 10px;
}
.report-status.loading {
  color: var(--brand-blue-dark);
  background: rgba(24,115,171,0.06);
  animation: statusPulse 1.8s ease-in-out infinite;
}
@keyframes statusPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@media (max-width: 768px) {
  .report-kpis, .report-grid { grid-template-columns: 1fr; }
  .informes-hero { flex-direction: column; }
}

.informes-hero {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 22px;
  padding: 32px 32px 28px;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(116deg, rgba(5, 26, 43, 0.98), rgba(12, 58, 88, 0.94) 54%, rgba(255, 106, 19, 0.9)),
    url("logo.png") right 32px center / 130px auto no-repeat;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.informes-hero::after {
  content: "";
  position: absolute;
  inset: auto -70px -110px auto;
  width: 310px;
  height: 310px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  filter: blur(2px);
}
.informes-hero-text { position: relative; z-index: 1; max-width: 720px; }
.informes-hero-text .label-top {
  color: #ffd0b5;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 8px;
}
.informes-hero-text h3 {
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1.04;
  margin: 0 0 10px;
  letter-spacing: -0.035em;
  color: #fff;
}
.informes-hero-text .hint { margin: 0; color: rgba(255, 255, 255, 0.76); max-width: 660px; }
.informes-hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.report-week-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(10px);
  font-size: 0.84rem;
}

.report-command-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 18px 24px 0;
  padding: 12px;
  border: 1px solid rgba(8, 48, 76, 0.08);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.report-plant-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-3);
}
.report-plant-switch button {
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  font-size: 0.84rem;
}
.report-plant-switch button.active {
  background: var(--brand-navy);
  color: #fff;
  box-shadow: 0 8px 20px rgba(11, 31, 51, 0.24);
}
.report-type-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--brand-blue-dark);
  font-size: 0.84rem;
}
.report-type-filter select { min-width: 190px; }

.report-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 24px 0;
}
.report-kpi {
  position: relative;
  overflow: hidden;
  padding: 18px 20px;
  min-height: 116px;
  border-radius: var(--radius-xl);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.report-kpi::after {
  content: "";
  position: absolute;
  right: -36px;
  bottom: -44px;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: var(--kpi-glow, rgba(255, 106, 19, 0.12));
}
.report-kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.report-kpi strong {
  display: block;
  color: var(--brand-navy);
  font-size: 2.1rem;
  line-height: 1;
  margin-top: 10px;
  letter-spacing: -0.045em;
  font-weight: 800;
}
.report-kpi small {
  display: block;
  color: var(--muted);
  margin-top: 8px;
  font-weight: 600;
  font-size: 0.78rem;
}

.report-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  margin: 18px 24px 0;
}
.report-panel {
  min-width: 0;
  padding: 20px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.report-wide { grid-column: 1 / -1; }
.report-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.report-panel-title span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.report-panel-title strong { color: var(--brand-orange-strong); font-size: 1.1rem; font-weight: 800; }

.report-brief { background: var(--brand-navy); color: #fff; border-color: transparent; }
.report-brief h4, .report-detail h4 { margin: 0 0 12px; font-size: 1.02rem; }
.report-brief p { margin: 0 0 12px; color: rgba(255, 255, 255, 0.78); line-height: 1.55; }
.report-brief ul,
.report-detail ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 9px;
}
.report-brief li,
.report-detail li {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.88rem;
}
.report-detail li { background: var(--surface-2); color: var(--ink-2); }
.report-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--brand-orange);
  flex: 0 0 auto;
}

.report-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.report-table { width: 100%; border-collapse: collapse; min-width: 760px; font-size: 0.84rem; }
.report-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--brand-navy);
  color: #fff;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}
.report-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2);
  vertical-align: top;
}
.report-table tr:nth-child(even) td { background: var(--surface-2); }

.report-section {
  margin-top: 24px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.report-section-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--brand-navy);
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.report-section-empty { margin: 0; color: var(--muted); font-weight: 600; }
.report-mini-badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--info-soft);
  color: var(--brand-blue-dark);
  font-weight: 800;
  font-size: 0.74rem;
}
.report-maint-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.report-maint-card {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.report-maint-card span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.report-maint-card strong {
  display: block;
  color: var(--brand-navy);
  font-size: 1.6rem;
  line-height: 1;
  margin-top: 8px;
  font-weight: 800;
}
.report-cause-bars { display: grid; gap: 9px; margin-top: 12px; }
.report-cause-row {
  display: grid;
  grid-template-columns: 170px 1fr 44px;
  gap: 10px;
  align-items: center;
  color: var(--ink-2);
  font-size: 0.84rem;
  font-weight: 700;
}
.report-cause-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.report-cause-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-navy), var(--brand-orange));
}
.report-aforo-classic .aforo-excel-bar-row span { min-width: 0; }

@media (max-width: 780px) {
  .report-maint-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-cause-row { grid-template-columns: 1fr; }
}

.report-status {
  margin: 14px 24px 0;
  color: var(--muted);
  font-weight: 700;
}
.report-status.loading {
  padding: 12px 16px;
  background: var(--brand-orange-soft);
  border-radius: var(--radius);
  color: var(--brand-orange-strong);
}

@media (max-width: 980px) {
  .report-kpis, .report-grid { grid-template-columns: 1fr; }
  .informes-hero { flex-direction: column; }
}

/* =========================================================
   SEND REPORT MODAL
   ========================================================= */
.send-report-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.send-tab {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.send-tab.active {
  background: var(--brand-blue);
  color: #fff;
  border-color: var(--brand-blue);
}

.schedule-datetime.hidden { display: none; }

.recipient-selector { margin-top: 8px; }

.recipient-selector textarea {
  width: 100%;
  min-height: 130px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  resize: vertical;
}

.recipient-list {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.recipient-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background 0.15s;
}

.recipient-item:last-child { border-bottom: none; }
.recipient-item:hover { background: var(--surface-3); }
.recipient-item.selected { background: var(--info-soft); border-left: 3px solid var(--brand-blue); }

.recipient-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand-blue); }
.recipient-item .recipient-name { flex: 1; font-weight: 600; font-size: 0.88rem; }
.recipient-item .recipient-role { font-size: 0.72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; }

.recipient-custom { display: flex; gap: 8px; margin-top: 10px; }
.recipient-custom input { flex: 1; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); font-size: 0.85rem; font-family: var(--font-sans); background: var(--surface-2); }

.custom-recipient-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.custom-recipient-tag { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--brand-orange-soft); color: var(--brand-orange-strong); font-size: 0.78rem; font-weight: 700; }
.custom-recipient-tag .remove-mail-tag { background: none; border: none; color: inherit; cursor: pointer; font-size: 1rem; padding: 0; line-height: 1; opacity: 0.7; }
.custom-recipient-tag .remove-mail-tag:hover { opacity: 1; }

.details.extra-recipients { margin-top: 10px; }
.details.extra-recipients summary { cursor: pointer; font-size: 0.82rem; font-weight: 700; color: var(--brand-blue); margin-bottom: 6px; }
.details.extra-recipients textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font-family: var(--font-sans); font-size: 0.85rem; resize: vertical; }

.custom-message-box { margin-top: 14px; }
.custom-message-box textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font-family: var(--font-sans); font-size: 0.85rem; resize: vertical; }
.custom-recipient-tag button { background: none; border: none; color: inherit; cursor: pointer; font-size: 0.85rem; padding: 0; line-height: 1; }

/* =========================================================
   MODALS
   ========================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(11, 31, 51, 0.46);
  backdrop-filter: blur(4px);
  animation: overlay-fade 0.2s ease;
}
@keyframes overlay-fade { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(460px, 100%);
  padding: 32px 32px 28px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: modal-pop 0.22s cubic-bezier(0.2, 0.9, 0.25, 1);
}
.modal-card::before {
  content: "";
  width: calc(100% + 64px);
  height: 4px;
  margin: -32px -32px 14px;
  background: linear-gradient(90deg, var(--brand-blue-dark), var(--brand-blue), var(--brand-orange));
}
.modal-card h3 { font-weight: 800; letter-spacing: -0.02em; color: var(--brand-navy); }
.modal-card p { margin: 0; color: var(--ink-2); line-height: 1.55; }

.modal-subtitle { margin: -4px 0 4px; color: var(--muted); font-size: 0.9rem; }

.modal-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  color: var(--brand-blue);
  border: 3px solid currentColor;
  background: var(--info-soft);
  font-size: 1.8rem;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(0, 119, 183, 0.22);
}
.modal-icon i { font-size: 1.5rem; }

.modal-overlay.success .modal-icon { color: var(--success); background: var(--success-soft); }
.modal-overlay.error .modal-icon { color: var(--danger); background: var(--danger-soft); }
.modal-overlay.warning .modal-icon { color: var(--warning); background: var(--warning-soft); }
.modal-overlay.success .modal-card::before { background: var(--success); }
.modal-overlay.error .modal-card::before { background: var(--danger); }
.modal-overlay.warning .modal-card::before { background: var(--warning); }

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}

.modal-form { justify-items: stretch; text-align: left; gap: 12px; }
.modal-form .modal-icon,
.modal-form h3,
.modal-form .modal-subtitle { justify-self: center; text-align: center; }
.modal-form label { width: 100%; }
.modal-form .input-affix { width: 100%; }
.modal-form .modal-actions {
  justify-self: stretch;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}
.modal-form .modal-actions button { max-width: none; }

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* SweetAlert2 customizado */
.swal2-popup {
  border-radius: var(--radius-lg) !important;
  font-family: var(--font-sans) !important;
  padding: 1.6rem 1.4rem 1.4rem !important;
  box-shadow: var(--shadow-lg) !important;
}
.swal2-title {
  color: var(--brand-navy) !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
}
.swal2-html-container { color: var(--ink-2) !important; font-size: 0.96rem !important; }
.swal2-styled.swal2-confirm,
.swal2-styled.swal2-cancel {
  border-radius: var(--radius-sm) !important;
  font-weight: 700 !important;
  padding: 10px 20px !important;
  box-shadow: 0 6px 16px rgba(0, 119, 183, 0.2) !important;
}
.swal2-styled.swal2-confirm {
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark)) !important;
}
.swal2-styled.swal2-cancel { box-shadow: none !important; }
.swal2-icon { border-width: 3px !important; }
.swal2-timer-progress-bar { background: linear-gradient(90deg, var(--brand-blue), var(--brand-orange)) !important; }
.swal2-input, .swal2-textarea, .swal2-select {
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--line) !important;
  box-shadow: none !important;
  background: var(--surface-2) !important;
}
.swal2-input:focus, .swal2-textarea:focus, .swal2-select:focus {
  border-color: var(--brand-blue) !important;
  box-shadow: var(--ring) !important;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1100px) {
  .plan-summary-grid { grid-template-columns: 1fr; }
  .aforo-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .aforo-flow-grid, .molino-card-grid { grid-template-columns: 1fr; }
  .equation-form { flex-wrap: wrap; }
}

@media (max-width: 1050px) {
  .login-panel, .content-grid { grid-template-columns: 1fr; }
  .login-visual { min-height: auto; padding: 36px; }
  .login-visual h1 { margin-top: 40px; font-size: clamp(2rem, 7vw, 3rem); }
  .login-form { padding: 36px; }
  .app-header { grid-template-columns: 1fr; }
  .module-tabs { justify-content: flex-start; overflow-x: auto; padding-bottom: 4px; }
  .header-actions { justify-content: flex-end; }
  .hero-card { flex-direction: column; padding: 24px; }
  .report-form, .metrics, .activity-grid, .maintenance-form, .activity-form, .week-row, .maintenance-select-row { grid-template-columns: 1fr; }
  .work-week-control { grid-template-columns: 1fr; }
  .week-filter { min-width: 0; width: 100%; }
  .template-head { flex-direction: column; }
  .work-tabs { grid-template-columns: 1fr; }
  .thermo-toolbar, .thermo-actions, .thermo-tabs { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .equations-header { display: grid; }
  .equation-form { flex-wrap: wrap; }
  .plan-summary-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .aforo-hero, .Afonso-hero, .aforo-card-title { display: grid; }
  .aforo-meta-card, .aforo-meta-grid { grid-template-columns: 1fr; }
  .aforo-summary-grid { grid-template-columns: 1fr; }
  .aforo-chart-head, .aforo-chart-row { display: grid; grid-template-columns: 1fr; }
  .aforo-excel-grid, .aforo-excel-bar-row { grid-template-columns: 1fr; }
  .aforo-excel-bar-row strong { text-align: left; }
  .aforo-chart-row strong { text-align: left; }
  .aforo-single-grid, .aforo-samples, .aforo-mini-fields, .aforo-side-fields, .molino-field-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   FOCUS / A11Y
   ========================================================= */
button:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

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

/* =========================================================
   DASHBOARD KPIs
   ========================================================= */
.dashboard-module .dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.dashboard-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.dashboard-summary .kpi-card {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dashboard-summary .kpi-card.accent {
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-blue-dark));
  color: #fff;
  border-color: transparent;
}

.dashboard-summary .kpi-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.dashboard-summary .kpi-card.accent .kpi-value {
  color: var(--brand-orange);
}

.dashboard-summary .kpi-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.dashboard-summary .kpi-card.accent .kpi-label {
  color: rgba(255, 255, 255, 0.7);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
}

.dashboard-panel .card-title {
  margin-bottom: 14px;
}

.dashboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dashboard-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.88rem;
}

.dashboard-list-item.alert {
  background: var(--warning-soft);
  border-left: 3px solid var(--warning);
}

.dashboard-list-item .list-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand-navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
}

.dashboard-list-item .list-label {
  flex: 1;
  font-weight: 600;
}

.dashboard-list-item .list-value {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

/* =========================================================
   BUSQUEDA (eliminado)
   ========================================================= */

/* =========================================================
   AI SUGGESTIONS (CoPilot)
   ========================================================= */
.ai-suggestions {
  margin-top: 12px;
  padding: 14px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(0,119,183,0.06), rgba(255,106,19,0.04));
  border: 1px solid rgba(0,119,183,0.2);
}

.ai-suggestions-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand-blue);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ai-suggestions-header i {
  font-size: 1rem;
  color: var(--brand-orange);
}

.ai-suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 8px;
  border: 1px solid var(--line);
  transition: border-color 0.2s;
}

.ai-suggestion-item:hover {
  border-color: var(--brand-blue);
}

.ai-score {
  min-width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--brand-navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  flex-shrink: 0;
}

.ai-suggestion-content {
  flex: 1;
  min-width: 0;
}

.ai-suggestion-content strong {
  display: block;
  font-size: 0.9rem;
  color: var(--ink-2);
}

.ai-suggestion-content small {
  color: var(--muted);
  font-size: 0.78rem;
}

.ai-suggestion-content p {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--ink-2);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================
   PREDICTIVO
   ========================================================= */
.predictivo-module .predictivo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.predictivo-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.predictivo-stat {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.predictivo-stat.alert {
  background: var(--danger-soft);
  border-color: rgba(220,38,38,0.3);
}

.predictivo-stat.ok {
  background: var(--success-soft);
  border-color: rgba(34,197,94,0.3);
}

.predictivo-stat .stat-value {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.predictivo-stat.alert .stat-value {
  color: var(--danger);
}

.predictivo-stat.ok .stat-value {
  color: var(--success);
}

.predictivo-stat .stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.predictivo-all-clear {
  padding: 40px;
  text-align: center;
  border-radius: var(--radius);
  background: var(--success-soft);
  border: 1px solid rgba(34,197,94,0.2);
}

.predictivo-all-clear i {
  font-size: 3rem;
  color: var(--success);
  margin-bottom: 12px;
}

.predictivo-all-clear h4 {
  font-size: 1.2rem;
  color: var(--success);
  margin-bottom: 8px;
}

.predictivo-all-clear p {
  color: var(--muted);
}

.predictivo-alerts {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.predictivo-alert {
  display: flex;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

.predictivo-alert.risk-high {
  border-color: rgba(255,106,19,0.4);
  background: rgba(255,106,19,0.05);
}

.predictivo-alert.risk-medium {
  border-color: rgba(255,193,7,0.3);
  background: rgba(255,193,7,0.03);
}

.predictivo-alert .alert-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.predictivo-alert.risk-high .alert-icon {
  background: var(--warning-soft);
  color: var(--warning);
}

.predictivo-alert.risk-medium .alert-icon {
  background: var(--info-soft);
  color: var(--brand-blue);
}

.predictivo-alert .alert-content h4 {
  font-size: 1rem;
  color: var(--brand-navy);
  margin-bottom: 6px;
}

.predictivo-alert .alert-content p {
  font-size: 0.88rem;
  color: var(--ink-2);
  margin-bottom: 10px;
}

.predictivo-alert .alert-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--muted);
}

.predictivo-alert .alert-meta strong {
  color: var(--ink-2);
}

.predictivo-charts {
  margin-top: 20px;
}

.predictivo-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.predictivo-mini-chart {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

.predictivo-mini-chart h5 {
  font-size: 0.85rem;
  color: var(--brand-navy);
  margin-bottom: 10px;
  font-weight: 700;
}

@media (max-width: 760px) {
  .predictivo-summary { grid-template-columns: 1fr; }
  .predictivo-chart-grid { grid-template-columns: 1fr; }
}

/* Auditoria module */
.audit-module .audit-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
  padding: 16px 20px;
}
.audit-filters select {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  min-width: 160px;
}
.audit-table {
  overflow-x: auto;
}
.audit-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.audit-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 2px solid var(--line);
  font-weight: 600;
  color: var(--text-soft);
  white-space: nowrap;
}
.audit-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.audit-table tr:hover td {
  background: var(--surface);
}
.audit-date {
  white-space: nowrap;
  font-family: var(--mono, monospace);
  font-size: 0.8rem;
  color: var(--text-soft);
}
.audit-user {
  font-weight: 500;
  white-space: nowrap;
}
.audit-week {
  text-align: center;
  font-weight: 500;
}
.audit-detail {
  max-width: 400px;
  word-break: break-word;
}
.audit-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-login { background: #e3f2fd; color: #1565c0; }
.badge-plan_status_change { background: #fff3e0; color: #e65100; }
.badge-mark_day_ok { background: #e8f5e9; color: #2e7d32; }
.badge-activity_create { background: #f3e5f5; color: #7b1fa2; }
.badge-activity_update { background: #fce4ec; color: #c62828; }
.badge-activity_delete { background: #ffebee; color: #b71c1c; }
.badge-report_schedule { background: #e0f2f1; color: #00695c; }
.badge-report_schedule_cancel { background: #fbe9e7; color: #bf360c; }
.badge-report_send { background: #e8f5e9; color: #1b5e20; }
.badge-mailing_list_add { background: #e8eaf6; color: #283593; }
.badge-mailing_list_remove { background: #fce4ec; color: #880e4f; }
.audit-pagination {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}
.audit-pagination .pagination {
  display: flex;
  gap: 6px;
}
.audit-pagination .page-btn {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
}
.audit-pagination .page-btn.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.audit-pagination .page-btn:hover:not(.active) {
  background: var(--surface);
}

/* ===================== ESTADO DE FLUJOS ===================== */
.flow-states-module { padding: 0 0 32px; }
.flow-states-header {
  margin-bottom: 16px;
}
.flow-states-body { display: flex; flex-direction: column; gap: 20px; }
.fs-section-title {
  padding: 8px 14px;
  background: linear-gradient(135deg, #0b1f33, #0d2d4a);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  border-radius: 5px 5px 0 0;
  margin: 0;
}
.fs-section-title-bx { background: linear-gradient(135deg, #7a3b0f, #8B4513); margin-top: 20px; }
.fs-group-title {
  padding: 6px 12px;
  background: linear-gradient(135deg, #1a3a5c, #0d2d4a);
  color: #c8dff0;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-top: 14px;
}
.fs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin: 0 0 4px;
}
.fs-table thead th {
  background: #eaf1f8;
  color: #0b1f33;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 7px 10px;
  border: 1px solid #d0dce8;
  text-align: left;
}
.fs-table tbody tr:nth-child(even) td { background: #f7fafd; }
.fs-table td {
  padding: 5px 8px;
  border: 1px solid #d9e4ee;
  vertical-align: middle;
  background: #fff;
}
.fs-td-nombre { color: #0b1f33; }
.fs-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: #004f7c;
  background: #eaf3fa;
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}
.fs-tag2 { margin-top: 2px; }
.fs-select {
  width: 100%;
  min-width: 130px;
  padding: 5px 8px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  font-size: 0.81rem;
  background: #fff;
  color: #0b1f33;
}
.fs-select:focus { outline: none; border-color: var(--brand); }
.fs-input {
  width: 100%;
  padding: 5px 8px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  font-size: 0.81rem;
  background: #fff;
  color: #0b1f33;
  box-sizing: border-box;
}
.fs-input:focus { outline: none; border-color: var(--brand); }
.fs-lsh, .fs-lsl { min-width: 72px; }

/* ── Bot control panel ─────────────────────────────────────────────────────── */
.bot-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px;
  margin-bottom: 14px;
}
.bot-indicator-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bot-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}
.bot-dot--off  { background: #f87171; box-shadow: 0 0 6px rgba(248,113,113,0.5); }
.bot-dot--on   { background: #4ade80; box-shadow: 0 0 8px rgba(74,222,128,0.6); }
.bot-dot--warn { background: #fbbf24; box-shadow: 0 0 6px rgba(251,191,36,0.5); }
.bot-status-title {
  font-weight: 700;
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-primary, #e2e8f0);
}
.bot-status-sub {
  color: #888;
  margin: 3px 0 0;
  font-size: 0.8rem;
}
.bot-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bot-controls-primary,
.bot-controls-secondary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.bot-controls-secondary {
  padding-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.bot-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s, box-shadow 0.18s, opacity 0.18s;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.bot-btn:active  { transform: scale(0.96); transition-duration: 80ms; }
.bot-btn:disabled { opacity: 0.38; cursor: default; transform: none; }
.bot-btn i { font-size: 0.78rem; }
.bot-btn--start {
  background: #166534;
  color: #bbf7d0;
  border-color: #15803d;
}
.bot-btn--start:hover:not(:disabled) { background: #15803d; box-shadow: 0 4px 12px rgba(21,128,61,0.35); transform: translateY(-1px); }
.bot-btn--restart {
  background: rgba(255,255,255,0.07);
  color: #93c5fd;
  border-color: rgba(147,197,253,0.25);
}
.bot-btn--restart:hover:not(:disabled) { background: rgba(147,197,253,0.12); transform: translateY(-1px); }
.bot-btn--qr {
  background: rgba(255,255,255,0.07);
  color: #e2e8f0;
  border-color: rgba(255,255,255,0.12);
}
.bot-btn--qr:hover:not(:disabled) { background: rgba(255,255,255,0.11); transform: translateY(-1px); }
.bot-btn--reset {
  background: rgba(251,191,36,0.1);
  color: #fcd34d;
  border-color: rgba(251,191,36,0.25);
}
.bot-btn--reset:hover:not(:disabled) { background: rgba(251,191,36,0.18); transform: translateY(-1px); }
.bot-btn--stop {
  background: rgba(239,68,68,0.12);
  color: #fca5a5;
  border-color: rgba(239,68,68,0.3);
}
.bot-btn--stop:hover:not(:disabled) { background: rgba(239,68,68,0.2); box-shadow: 0 4px 12px rgba(239,68,68,0.2); transform: translateY(-1px); }

/* =========================================================
   SKELETON LOADERS
   ========================================================= */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  color: transparent !important;
}
.skeleton * { visibility: hidden; }
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.6) 50%, transparent 100%);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}
.skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}
.skeleton-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.5) 50%, transparent 100%);
  animation: shimmer 1.5s infinite;
}
.skeleton-line.wide { width: 80%; }
.skeleton-line.short { width: 45%; }
.skeleton-line.xs { height: 10px; width: 30%; }
.skeleton-block {
  height: 120px;
  border-radius: var(--radius);
  background: var(--surface-3);
  position: relative;
  overflow: hidden;
}
.skeleton-block::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.5) 50%, transparent 100%);
  animation: shimmer 1.5s infinite;
}

/* =========================================================
   TOAST NOTIFICATIONS
   ========================================================= */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  animation: toast-in 0.35s var(--ease-out-snap) both;
  max-width: 360px;
}
.toast.toast-out {
  animation: toast-out 0.25s var(--ease-out) forwards;
}
.toast-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  color: #fff;
}
.toast.toast-success .toast-icon { background: var(--success); }
.toast.toast-error .toast-icon { background: var(--danger); }
.toast.toast-info .toast-icon { background: var(--info); }
.toast.toast-warning .toast-icon { background: var(--warning); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px) scale(0.92); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(40px) scale(0.92); }
}

/* =========================================================
   SECTION TRANSITIONS (fade in)
   ========================================================= */
.section.fade-enter {
  animation: section-fade-in 0.3s var(--ease-out-snap) both;
}
@keyframes section-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   BOT STATUS WIDGET (clean component)
   ========================================================= */
.bot-status-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s;
}
.bot-status-widget:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}
.bot-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}
.bot-status-dot.offline { background: #f87171; box-shadow: 0 0 6px #f87171; }
.bot-status-dot.online { background: #4ade80; box-shadow: 0 0 8px rgba(74,222,128,0.5); animation: pulse-dot 2s ease-in-out infinite; }
.bot-status-dot.connecting { background: #fbbf24; box-shadow: 0 0 6px #fbbf24; animation: pulse-dot 1s ease-in-out infinite; }
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}
.bot-status-label {
  font-size: 0.78rem;
  font-weight: 600;
  transition: color 0.3s;
}
.bot-status-label.offline { color: #f87171; }
.bot-status-label.online { color: #4ade80; }
.bot-status-label.connecting { color: #fbbf24; }

/* Bot hero panel (status + action buttons inline) */
.bot-hero-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.bot-hero-actions {
  display: flex;
  gap: 4px;
}
.bot-hero-btn {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.8);
  font-size: 0.7rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
}
.bot-hero-btn:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-1px);
}
.bot-hero-btn:active { transform: scale(0.92); }
.bot-hero-btn--green { color: #4ade80; border-color: rgba(74,222,128,0.3); }
.bot-hero-btn--green:hover { background: rgba(74,222,128,0.15); }
.bot-hero-btn--red { color: #f87171; border-color: rgba(248,113,113,0.3); }
.bot-hero-btn--red:hover { background: rgba(248,113,113,0.15); }
.bot-hero-btn--amber { color: #fbbf24; border-color: rgba(251,191,36,0.3); }
.bot-hero-btn--amber:hover { background: rgba(251,191,36,0.15); }
.bot-pwa-link {
  flex-basis: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 30px;
  padding: 6px 12px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 9px;
  background: rgba(14, 165, 233, 0.1);
  color: #7dd3fc;
  font-size: 0.75rem;
  font-weight: 800;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
}
.bot-pwa-link:hover {
  background: rgba(14, 165, 233, 0.18);
  border-color: rgba(125, 211, 252, 0.45);
  transform: translateY(-1px);
}

/* =========================================================
   MOBILE NAV IMPROVEMENTS
   ========================================================= */
@media (max-width: 1100px) {
  .module-tabs {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding: 4px 8px;
    gap: 2px;
  }
  .module-tabs::-webkit-scrollbar { display: none; }
  .tab { flex-shrink: 0; padding: 7px 12px; font-size: 0.8rem; }
}
@media (max-width: 768px) {
  .app-header {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 10px 14px;
    padding: 10px 14px;
  }
  .module-tabs { grid-column: 1 / -1; order: 3; }
  .header-actions { justify-self: end; }
  .hero-card { flex-direction: column; padding: 22px; gap: 16px; }
  .work-week-control { grid-template-columns: 1fr 1fr; }
  .metrics { grid-template-columns: 1fr; gap: 10px; }
  .metrics article { padding: 14px 16px; }
}
@media (max-width: 480px) {
  .app { padding: 10px 12px 32px; }
  .app-header { top: 6px; padding: 8px 10px; border-radius: var(--radius); }
  .tab { padding: 6px 10px; font-size: 0.74rem; gap: 4px; }
  .tab i { font-size: 0.72rem; }
  .brand-line .brand-logo.compact { width: 40px; }
  .hero-card { padding: 18px 16px; border-radius: var(--radius-lg); }
  .card { padding: 16px; border-radius: var(--radius); }
  .work-week-control { grid-template-columns: 1fr; gap: 10px; }
  .plant-tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .plant-tabs::-webkit-scrollbar { display: none; }
  .plant-tab, .camera-plant-tab { flex-shrink: 0; font-size: 0.8rem; }
  .work-tabs { grid-template-columns: 1fr; gap: 4px; }
}
