/* ─────────────────────────────────────────────────────────────────────────
   Del Valle Gestión · capa de marca (se carga DESPUÉS del CSS compilado)
   Para volver atrás: quitar el <link> a /brand/brand.css del index.html
   ───────────────────────────────────────────────────────────────────────── */
:root {
  --dv-navy: #07142a;
  --dv-navy-2: #0c1f3d;
  --dv-blue: #1b4fd6;
  --dv-red: #d9252a;
  --bg: #eef2f7;
}

/* Fondo general: sin la foto lavada, un gris azulado limpio */
body {
  background: var(--bg) !important;
}

/* ── LOGIN ─────────────────────────────────────────────────────────────── */
.login-page:not(.public-incident) {
  background: var(--dv-navy) url(/brand/blueprint.svg) center / cover no-repeat;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  place-items: center stretch;
  gap: 48px;
  padding: 48px clamp(24px, 6vw, 96px);
}
.login-page:not(.public-incident) .login-overlay {
  background: linear-gradient(90deg, rgba(7, 20, 42, .92) 0%, rgba(7, 20, 42, .55) 55%, rgba(7, 20, 42, .2) 100%);
}

/* Columna izquierda: mensaje de marca (texto generado por CSS, no requiere tocar el código React) */
.login-page:not(.public-incident)::before {
  content: "Mecanizados de precisión\A y metalúrgica industrial";
  white-space: pre-line;
  position: relative;
  z-index: 1;
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  max-width: 680px;
  color: #fff;
  font-size: clamp(2rem, 3.4vw, 3.1rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
  padding-left: 22px;
  border-left: 5px solid var(--dv-red);
}
.login-page:not(.public-incident)::after {
  content: "Tornería · Fresado CNC · Soldadura · Fabricación a medida — San Juan, Argentina";
  position: absolute;
  z-index: 1;
  left: clamp(24px, 6vw, 96px);
  bottom: 32px;
  color: rgba(201, 216, 255, .7);
  font-size: .85rem;
  letter-spacing: .04em;
}

.login-page:not(.public-incident) .login-card {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  background: #fff;
  border: 0;
  border-top: 4px solid var(--dv-blue);
  border-radius: 14px;
  padding: 36px 34px 30px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .35);
}
.login-page:not(.public-incident) .login-logo {
  width: min(100%, 260px);
  margin-bottom: 22px;
}
.login-page:not(.public-incident) .login-card h1 {
  font-size: 1.45rem;
  letter-spacing: -.01em;
}
.login-page:not(.public-incident) .login-copy {
  font-size: .92rem;
  margin-bottom: 22px;
}
.login-page .operator-access-box {
  border-radius: 10px;
  padding: 14px;
  background: #f4f6fa;
}
.login-page .operator-access-actions > * {
  border-radius: 8px !important;
}
.login-page .login-form input {
  border-radius: 8px;
}
.login-page .login-form button {
  border-radius: 8px;
  background: var(--dv-navy-2);
}
.login-page .login-form button:hover {
  background: var(--dv-blue);
}

/* Ocultar el cartel que menciona credenciales de prueba */
.login-page .demo-box {
  display: none !important;
}

/* Página pública de incidentes/capacitación: mismo fondo nítido */
.login-page.public-incident,
.training-public-page {
  background: var(--dv-navy) url(/brand/blueprint.svg) center / cover no-repeat;
}

/* Login en celular/tablet: una sola columna */
@media (max-width: 900px) {
  .login-page:not(.public-incident) {
    grid-template-columns: 1fr;
    place-items: center;
    padding: 28px 16px 64px;
    gap: 22px;
  }
  .login-page:not(.public-incident)::before {
    grid-row: 1;
    font-size: 1.5rem;
    max-width: 520px;
    width: 100%;
    border-left-width: 4px;
    padding-left: 14px;
  }
  .login-page:not(.public-incident) .login-card {
    grid-column: 1;
    grid-row: 2;
    max-width: 520px;
    padding: 28px 22px 24px;
  }
  .login-page:not(.public-incident)::after {
    left: 16px;
    right: 16px;
    bottom: 20px;
    font-size: .75rem;
    text-align: center;
  }
}

/* ── MENÚ LATERAL ──────────────────────────────────────────────────────── */
.sidebar {
  background: var(--dv-navy) !important;
}
/* Logo con letras blancas: el original tiene texto gris oscuro que no se lee sobre azul */
.sidebar .brand-logo {
  content: url(/brand/logo-horizontal-white.png);
  width: 100%;
  max-width: 230px;
  height: auto;
}
.sidebar .brand-tag {
  color: rgba(201, 216, 255, .65);
  font-size: .78rem;
  letter-spacing: .03em;
}
.sidebar .menu-link {
  border-radius: 8px;
  border-left: 3px solid transparent;
}
.sidebar .menu-link.active {
  background: rgba(27, 79, 214, .22);
  border-left-color: var(--dv-red);
}
.sidebar .menu-link.dv-addon-link .dv-new {
  margin-left: 8px;
  font-size: .62rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--dv-red);
  color: #fff;
  vertical-align: middle;
  letter-spacing: .04em;
}

/* ═════════════════════════════════════════════════════════════════════════
   INTERIOR DE LA APP · estética técnica (v2)
   ═════════════════════════════════════════════════════════════════════════ */
:root {
  --dv-grid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cpath d='M24 0V120M48 0V120M72 0V120M96 0V120M0 24H120M0 48H120M0 72H120M0 96H120' stroke='%2311243b' stroke-opacity='.035'/%3E%3Cpath d='M120 0H0V120' fill='none' stroke='%2311243b' stroke-opacity='.07'/%3E%3C/svg%3E");
  --dv-grid-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cpath d='M20 0V100M40 0V100M60 0V100M80 0V100M0 20H100M0 40H100M0 60H100M0 80H100' stroke='%238fb3ff' stroke-opacity='.05'/%3E%3Cpath d='M100 0H0V100' fill='none' stroke='%238fb3ff' stroke-opacity='.09'/%3E%3C/svg%3E");
  --shadow: 0 1px 2px rgba(7, 22, 47, .06), 0 6px 18px rgba(7, 22, 47, .06);
  --line: #d6dee8;
}

/* Fondo: cuadrícula de plano muy suave */
body {
  background: var(--bg) var(--dv-grid) !important;
  background-attachment: fixed !important;
}

/* ── Menú lateral ── */
.sidebar {
  background: var(--dv-navy) var(--dv-grid-dark) !important;
  border-right: 1px solid rgba(143, 179, 255, .12) !important;
}
.sidebar .brand-block {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(143, 179, 255, .14);
}
.sidebar .menu-link {
  font-size: .93rem;
  padding: 10px 12px;
}
.sidebar-footer .btn.secondary,
.sidebar-footer button {
  background: rgba(255, 255, 255, .08) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, .14) !important;
}
.sidebar-footer .btn.secondary:hover,
.sidebar-footer button:hover {
  background: rgba(217, 37, 42, .85) !important;
  border-color: transparent !important;
}
.role-pill {
  border-radius: 6px;
  font-size: .72rem;
  letter-spacing: .08em;
  padding: 6px 10px;
}

/* ── Barra superior ── */
.topbar {
  background: rgba(255, 255, 255, .96);
  padding-top: 14px;
  padding-bottom: 14px;
}
.topbar .btn {
  border-radius: 8px;
}

/* ── Encabezados de página ── */
.page-header h1 {
  font-size: 1.75rem;
  letter-spacing: -.015em;
  padding-left: 14px;
  border-left: 4px solid var(--dv-red);
  line-height: 1.15;
}
.home-status {
  border-radius: 6px;
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 8px 12px;
  box-shadow: none;
}

/* ── Banners oscuros: plano técnico en vez de foto ── */
.home-pro-hero,
.hero-card,
.wo-summary-banner {
  background: var(--dv-navy) url(/brand/blueprint.svg) right center / cover no-repeat !important;
  border-radius: 12px !important;
  border: 1px solid rgba(143, 179, 255, .14);
  box-shadow: 0 10px 30px rgba(7, 20, 42, .18);
  position: relative;
}
.home-pro-hero::before,
.hero-card::before,
.wo-summary-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(7, 20, 42, .94) 0%, rgba(7, 20, 42, .75) 55%, rgba(7, 20, 42, .45) 100%);
  pointer-events: none;
  border-radius: inherit;
}
.home-pro-hero > *,
.hero-card > *,
.wo-summary-banner > * {
  position: relative;
}
.home-pro-hero h1, .home-pro-hero h2,
.hero-card h2 {
  letter-spacing: -.015em;
}
.eyebrow {
  color: #8fb3ff;
  letter-spacing: .16em;
  font-weight: 700;
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 2px;
  background: var(--dv-red);
  vertical-align: middle;
  margin-right: 8px;
}
.home-action-tile {
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(143, 179, 255, .22);
  font-weight: 700;
}
.home-action-tile:hover {
  transform: none;
  background: rgba(27, 79, 214, .35);
  border-color: rgba(143, 179, 255, .5);
}
.home-pro-panel {
  border-radius: 10px;
  background: rgba(7, 20, 42, .55);
  border: 1px solid rgba(143, 179, 255, .2);
}
.home-pro-panel img {
  content: url(/logo-icon.png);
  width: 72px;
}

/* ── Tarjetas de indicadores: fondo blanco con barra de color (estilo tablero) ── */
.stat {
  background: #fff !important;
  color: var(--text);
  border-radius: 10px;
  border: 1px solid var(--line);
  border-left: 5px solid #64748b;
  box-shadow: var(--shadow);
  gap: 4px;
  padding: 16px 18px;
  position: relative;
}
.stat::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 14px;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: currentColor;
  opacity: .9;
}
.stat-label {
  order: 0;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  opacity: 1;
}
.stat-value {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.stat-hint {
  color: var(--muted);
  opacity: 1;
  font-size: .8rem;
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px dashed var(--line);
}
.stat.blue  { border-left-color: var(--dv-blue); }
.stat.blue  .stat-value, .stat.blue::after  { color: var(--dv-blue); }
.stat.red   { border-left-color: var(--dv-red); }
.stat.red   .stat-value, .stat.red::after   { color: var(--dv-red); }
.stat.amber { border-left-color: #d97706; }
.stat.amber .stat-value, .stat.amber::after { color: #c26a05; }
.stat.green { border-left-color: #15803d; }
.stat.green .stat-value, .stat.green::after { color: #15803d; }
.stat.slate { border-left-color: var(--dv-navy-2); }
.stat.slate .stat-value, .stat.slate::after { color: var(--dv-navy-2); }

/* ── Tarjetas y paneles ── */
.card {
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.card-title,
.card h2, .card h3 {
  letter-spacing: -.01em;
}
.list-card, .wo-card, .plan-card, .control-card {
  border-radius: 10px;
}
.wo-card {
  background: #fff;
}
.wo-card:hover, .wo-card-active {
  border-color: var(--dv-blue);
}
.home-mini-list a {
  border-radius: 8px;
  background: #f5f7fa;
  border: 1px solid var(--line);
  font-weight: 700;
  position: relative;
  padding-right: 34px;
}
.home-mini-list a::after {
  content: "→";
  position: absolute;
  right: 14px;
  color: var(--muted);
}
.home-mini-list a:hover {
  border-color: var(--dv-blue);
  background: #fff;
}
.dark-card {
  background: var(--dv-navy) var(--dv-grid-dark);
  border-color: rgba(143, 179, 255, .14);
}
.indicator-card {
  border-radius: 12px;
}
.section-banner {
  border-radius: 8px;
  background: var(--dv-navy-2);
  border-left: 5px solid #f59e0b;
  text-align: left;
  font-size: .85rem;
  letter-spacing: .1em;
}
.modal-card {
  border-radius: 14px;
}
.info-box, .error-box, .upload-box, .asset-highlight-box, .asset-photo-box, .qr-box {
  border-radius: 8px;
}

/* ── Controles ── */
.btn {
  border-radius: 8px;
  font-weight: 600;
}
.btn:not(.secondary) {
  background: var(--dv-navy-2);
}
.btn:not(.secondary):hover {
  background: var(--dv-blue);
  opacity: 1;
}
.field,
.filter-bar input, .filter-bar select {
  border-radius: 8px;
}
.field:focus {
  outline: 2px solid rgba(27, 79, 214, .2);
  border-color: var(--dv-blue);
}
.badge {
  border-radius: 5px;
  padding: 5px 9px;
  font-size: .72rem;
  letter-spacing: .03em;
}
.quick-link {
  border-radius: 6px;
}
.days-badge, .quick-access-pill {
  border-radius: 6px;
}

/* ── Tablas ── */
.table-wrap {
  border-radius: 8px;
  background: #fff;
}
.table thead th {
  background: #f4f6fa;
  font-size: .72rem;
  letter-spacing: .07em;
}
.table tbody tr:hover td {
  background: #f8fafc;
}

/* Indicadores: alinear la línea divisoria aunque los textos tengan distinto largo */
.stat { display: flex; flex-direction: column; }
.stat-hint { margin-top: auto; }

/* Ficha de activo: en pantallas de notebook la ficha y el QR quedaban apretados */
.asset-detail-grid > div { border-radius: 8px; background: #f5f7fa; border: 1px solid #e6ebf1; }
.asset-qr-panel { border-radius: 10px; }
@media (max-width: 1600px) {
  .asset-detail-wrap { grid-template-columns: 1fr !important; }
}

/* ═════════════════════════════════════════════════════════════════════════
   v3 · Avisos de mensajes, OT por vencer y sección de finalizadas
   ═════════════════════════════════════════════════════════════════════════ */

/* Contador de mensajes sin leer en el menú */
.sidebar a[href="/messages"][data-dv-unread]::after {
  content: attr(data-dv-unread);
  margin-left: 8px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--dv-red);
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
  vertical-align: 1px;
  animation: dvPulse 1.8s ease-in-out infinite;
}
@keyframes dvPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 37, 42, .55); }
  50% { box-shadow: 0 0 0 6px rgba(217, 37, 42, 0); }
}

/* Aviso emergente de mensaje nuevo */
.dv-toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9999;
  width: min(380px, calc(100vw - 32px));
  display: flex;
  gap: 14px;
  padding: 16px 16px 14px;
  background: var(--dv-navy);
  color: #fff;
  border-radius: 10px;
  border-left: 5px solid var(--dv-red);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
  animation: dvToastIn .35s cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes dvToastIn { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
.dv-toast-ico {
  flex: 0 0 38px; height: 38px; border-radius: 8px;
  display: grid; place-items: center; font-size: 1.15rem;
  background: rgba(217, 37, 42, .2); color: #ffb3b5;
}
.dv-toast-body { min-width: 0; flex: 1; }
.dv-toast-title { font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #8fb3ff; }
.dv-toast-sub { margin-top: 3px; font-size: .98rem; overflow-wrap: anywhere; }
.dv-toast-from { margin-top: 2px; font-size: .82rem; color: rgba(201, 216, 255, .75); }
.dv-toast-actions { display: flex; gap: 8px; margin-top: 12px; }
.dv-toast-actions button {
  border: 0; border-radius: 7px; padding: 8px 12px; font-weight: 700; font-size: .85rem; cursor: pointer;
  background: rgba(255, 255, 255, .1); color: #fff;
}
.dv-toast-actions .dv-toast-go { background: var(--dv-red); }
.dv-toast-actions button:hover { filter: brightness(1.12); }

/* Monitor: tarjetas por vencer */
.dvmon-card[data-dv-soon] {
  border-color: #ffb020 !important;
  animation: dvSoonGlow 1.6s ease-in-out infinite !important;
}
@keyframes dvSoonGlow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255, 176, 32, .5), 0 0 18px rgba(255, 176, 32, .25); }
  50% { box-shadow: 0 0 0 2px rgba(255, 176, 32, .95), 0 0 34px rgba(255, 176, 32, .5); }
}
.dvmon-card[data-dv-soon] .dvmon-status-strip { background: linear-gradient(180deg, #f59e0b, #a85c00) !important; }
.dvmon-card[data-dv-soon] .dvmon-timer { color: #ffb020 !important; }
.dv-soon-tag {
  display: block; margin-top: 6px; font-size: .62rem; font-weight: 900; letter-spacing: .06em;
  color: #2b1600; background: #ffd27a; border-radius: 4px; padding: 3px 4px; text-align: center;
}

/* Monitor: barra fija permanente */
#dv-soon-bar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 54px;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 52px;
  padding: 8px 20px;
  border-radius: 9px;
  border: 2px solid #ffb020;
  background: linear-gradient(90deg, rgba(120, 66, 0, .96), rgba(40, 22, 0, .96));
  color: #ffe2a8;
  font-weight: 800;
  box-shadow: 0 0 30px rgba(255, 176, 32, .35);
  animation: dvSoonGlow 1.6s ease-in-out infinite;
}
.dv-soon-head { flex: 0 0 auto; font-size: 1.3rem; font-weight: 950; color: #ffb020; letter-spacing: .02em; white-space: nowrap; }
.dv-soon-list { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 1.05rem; min-width: 0; }
.dv-soon-item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dv-soon-item b { color: #fff; }
@media (max-width: 900px) {
  #dv-soon-bar { flex-direction: column; align-items: flex-start; bottom: 12px; left: 8px; right: 8px; gap: 4px; }
  .dv-soon-head { font-size: 1.05rem; }
  .dv-soon-list { font-size: .9rem; }
}

/* Órdenes de trabajo: pestañas En curso / Finalizadas */
.dv-wo-tabs {
  display: flex;
  gap: 4px;
  margin: 4px 0 12px;
  border-bottom: 1px solid var(--line);
}
.dv-wo-tabs button {
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  padding: 9px 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.dv-wo-tabs button.on { color: var(--text); border-bottom-color: var(--dv-red); }
.dv-wo-tabs button span {
  display: inline-block; min-width: 22px; margin-left: 6px; padding: 1px 7px; border-radius: 10px;
  background: #e7ecf3; color: var(--text); font-size: .75rem;
}
.dv-wo-tabs button[data-v="finalizadas"].on span { background: #e8f6ee; color: #15803d; }
.wo-list[data-dv-view="activas"] > .wo-card[data-dv-final],
.wo-list[data-dv-view="finalizadas"] > .wo-card:not([data-dv-final]) { display: none !important; }
.wo-list[data-dv-empty]::before {
  content: "No hay OT en curso con estos filtros.";
  display: block; padding: 18px; border-radius: 8px; background: #f5f7fa; color: var(--muted); text-align: center;
}
.wo-list[data-dv-empty="finalizadas"]::before { content: "Todavía no hay OT finalizadas con estos filtros."; }
.wo-list[data-dv-view="finalizadas"] > .wo-card { background: #fbfcfd; }

/* ═════════════════════════════════════════════════════════════════════════
   v4 · Avisos apilados, mantenimiento, edición de activos, vencidas en monitor
   ═════════════════════════════════════════════════════════════════════════ */
#dv-toasts {
  position: fixed; top: 18px; right: 18px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  width: min(390px, calc(100vw - 32px));
}
#dv-toasts .dv-toast { position: static; width: auto; }
.dv-toast-mant { border-left-color: #f59e0b; }
.dv-toast-mant .dv-toast-ico { background: rgba(245, 158, 11, .2); color: #ffd27a; }
.dv-toast-mant .dv-toast-go { background: #d97706 !important; }
.dv-toast-list { list-style: none; margin: 8px 0 0; padding: 0; font-size: .84rem; display: grid; gap: 4px; color: rgba(232, 241, 255, .85); }
.dv-toast-list li span { color: #ffd27a; font-weight: 700; }
.dv-toast-list li.vencido span { color: #ff9a9d; }

/* Menú: contador de mantenimientos por vencer en "Activos y planificación" */
.sidebar a[href="/assets"][data-dv-mant]::after {
  content: attr(data-dv-mant);
  margin-left: 8px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: #d97706; color: #fff; font-size: .72rem; font-weight: 800;
  display: inline-grid; place-items: center; vertical-align: 1px;
}
.sidebar a[href="/assets"][data-dv-mant-level="vencido"]::after { background: var(--dv-red); animation: dvPulse 1.8s ease-in-out infinite; }

/* Etiqueta de vencimiento en activos y planes */
.asset-row-meta[data-dv-mant]::after {
  content: attr(data-dv-mant);
  display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 5px;
  font-size: .72rem; font-weight: 800; letter-spacing: .02em; vertical-align: 1px;
  background: #fdf3e4; color: #b45309; border: 1px solid #f5d4a3;
}
.asset-row-meta[data-dv-level="vencido"]::after { background: #fdecec; color: #b91c1c; border-color: #f5b5b5; }

/* Botones Editar / Eliminar */
.card-head { position: relative; }
.dv-asset-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; align-self: flex-start; }
.dv-plan-actions { display: inline-flex; gap: 8px; margin-left: 8px; flex-wrap: wrap; }
.wo-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dv-btn {
  border: 1px solid transparent; border-radius: 8px; padding: 8px 12px; font-weight: 700; font-size: .85rem;
  cursor: pointer; line-height: 1.1; white-space: nowrap;
}
.dv-btn.primary { background: var(--dv-navy-2); color: #fff; }
.dv-btn.primary:hover { background: var(--dv-blue); }
.dv-btn.primary:disabled { opacity: .6; cursor: wait; }
.dv-btn.ghost { background: #fff; border-color: var(--line); color: var(--text); }
.dv-btn.ghost:hover { border-color: var(--dv-blue); color: var(--dv-blue); }
.dv-btn.danger-ghost { background: #fff; border-color: #f5c2c2; color: #b91c1c; }
.dv-btn.danger-ghost:hover { background: #fdecec; }
.dv-btn.danger { background: #b91c1c; color: #fff; }
.dv-btn.danger:hover { background: #991b1b; }

/* Ventana de edición */
dialog.dv-modal {
  border: 0; border-radius: 14px; padding: 0; width: min(720px, calc(100vw - 24px));
  max-height: calc(100vh - 32px); overflow: auto; color: var(--text);
  box-shadow: 0 30px 70px rgba(7, 20, 42, .35);
}
dialog.dv-modal::backdrop { background: rgba(7, 20, 42, .55); }
dialog.dv-modal form, dialog.dv-confirm { padding: 0; }
.dv-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 22px; border-bottom: 1px solid var(--line); border-top: 4px solid var(--dv-blue);
}
.dv-modal-head h3 { margin: 0; font-size: 1.15rem; }
.dv-modal-x { border: 0; background: none; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.dv-modal-x:hover { background: #f1f4f8; }
.dv-modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 20px 22px 6px; }
.dv-f { display: grid; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.dv-f i { color: var(--dv-red); font-style: normal; }
.dv-f.wide { grid-column: 1 / -1; }
.dv-f input, .dv-f select, .dv-f textarea {
  width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
  font: inherit; font-size: .95rem; font-weight: 400; color: var(--text); background: #fff;
}
.dv-f input:focus, .dv-f select:focus, .dv-f textarea:focus { outline: 2px solid rgba(27, 79, 214, .2); border-color: var(--dv-blue); }
.dv-modal-err { color: #b91c1c; font-size: .88rem; padding: 0 22px; min-height: 8px; }
.dv-modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; }
dialog.dv-confirm { width: min(440px, calc(100vw - 24px)); }
dialog.dv-confirm .dv-modal-head { border-top-color: #b91c1c; }
dialog.dv-confirm p { margin: 0; padding: 16px 22px 4px; color: var(--muted); line-height: 1.5; }
@media (max-width: 620px) { .dv-modal-grid { grid-template-columns: 1fr; } }

.dv-snack {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 10000;
  background: var(--dv-navy-2); color: #fff; padding: 11px 16px; border-radius: 8px; font-size: .9rem; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); max-width: calc(100vw - 32px);
}
.dv-snack.err { background: #b91c1c; }

/* Monitor: la barra superior cuenta también las entregas vencidas */
.dvmon-alert[data-dv-over] {
  font-size: 0 !important;
  border-color: rgba(255, 25, 50, .76);
  color: #ff7777;
  background: linear-gradient(90deg, #71000c70, #2c000a1f 62%, #71000c38);
}
.dvmon-alert[data-dv-over] > * { display: none !important; }
.dvmon-alert[data-dv-over]::after { content: attr(data-dv-text); font-size: 1.45rem; font-weight: 950; letter-spacing: .01em; }

/* Programación de mantenimiento: el contenido se salía de la tarjeta */
.panel-stack .grid-gap, .plan-list { grid-template-columns: minmax(0, 1fr); }
.plan-card { min-width: 0; border-radius: 10px; background: #fff; }
.plan-card .asset-row-meta, .plan-card .list-card-body { white-space: normal; overflow-wrap: anywhere; }
.panel-stack .form-grid > * { min-width: 0; }

/* v5 · Indicador permanente de mantenimiento en la barra superior */
.topbar { gap: 14px; }
.dv-mant-pill { position: relative; margin-left: auto; }
.dv-mant-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid #f5d4a3; background: #fdf3e4; color: #9a4d00;
  border-radius: 8px; padding: 8px 12px; font-weight: 800; font-size: .86rem; cursor: pointer; white-space: nowrap;
}
.dv-mant-pill.vencido .dv-mant-btn {
  border-color: #f5b5b5; background: #fdecec; color: #b91c1c;
  animation: dvPillPulse 2s ease-in-out infinite;
}
@keyframes dvPillPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 37, 42, .35); }
  50% { box-shadow: 0 0 0 5px rgba(217, 37, 42, 0); }
}
.dv-mant-btn .car { font-size: .7rem; opacity: .7; }
.dv-mant-pop {
  display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
  width: min(440px, calc(100vw - 32px)); max-height: 60vh; overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 18px 40px rgba(7, 20, 42, .2); padding: 14px;
}
.dv-mant-pill.open .dv-mant-pop { display: block; }
.dv-mant-pop-h { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.dv-mant-pop ul { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.dv-mant-pop li {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  padding: 8px 10px; border-radius: 8px; background: #f7f9fb; border-left: 4px solid #d97706; font-size: .86rem;
}
.dv-mant-pop li.vencido { border-left-color: #d9252a; }
.dv-mant-pop li .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.dv-mant-pop li .d { font-weight: 800; color: #b45309; white-space: nowrap; font-size: .8rem; }
.dv-mant-pop li.vencido .d { color: #b91c1c; }
.dv-mant-go { width: 100%; }
@media (max-width: 700px) {
  .dv-mant-btn { font-size: .78rem; padding: 7px 9px; white-space: normal; text-align: left; }
}
@media (max-width: 700px) {
  .dv-mant-pill { position: static; }
  .dv-mant-pop { left: 12px; right: 12px; width: auto; top: calc(100% + 4px); }
}

/* v6 · Monitor: vencidas titilando */
.dvmon-alert[data-dv-over] {
  animation: dvOverBlink 1s steps(1, end) infinite;
}
@keyframes dvOverBlink {
  0%  { background: linear-gradient(90deg, #c4001f, #7a0014 62%, #c4001f); color: #ffffff; border-color: #ff4a5f; box-shadow: 0 0 30px 4px rgba(255, 30, 60, .6); }
  50% { background: linear-gradient(90deg, #71000c70, #2c000a1f 62%, #71000c38); color: #ff7777; border-color: rgba(255, 25, 50, .76); box-shadow: none; }
}
.dvmon-card[data-dv-vencida]:not([data-dv-soon]) {
  border-color: #ff2d47 !important;
  animation: dvCardOver 1.2s ease-in-out infinite !important;
}
@keyframes dvCardOver {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255, 45, 71, .45), 0 0 10px rgba(255, 45, 71, .15); }
  50%      { box-shadow: 0 0 0 2px rgba(255, 45, 71, 1), 0 0 34px rgba(255, 45, 71, .55), inset 0 0 40px rgba(255, 45, 71, .12); }
}
.dvmon-card[data-dv-vencida] .dvmon-status-strip { animation: dvStripOver 1.2s ease-in-out infinite; }
@keyframes dvStripOver { 0%, 100% { filter: none; } 50% { filter: brightness(1.7) saturate(1.3); } }
