/* ============================================================
   CESDIA Inspección — Sistema de Inspecciones Vehiculares
   NOM-068-SCT-2-2014
   webroot/css/cesdia.css
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Barlow+Condensed:wght@600;700&display=swap');

/* ── Variables ───────────────────────────────────────────── */
:root {
  /* Verde marca (compatibilidad con templates existentes) */
  --g1:      #1A6B35;
  --g2:      #22883F;
  --g3:      #4cbf68;
  --g4:      #E8F5ED;
  --gd:      #0d4a1c;
  --gtext:   #141C18;
  --gmuted:  #6B7D72;
  --gborder: #DDE8E1;
  --gbg:     #F4F7F5;

  /* Paleta nueva */
  --g:       #1A6B35;
  --g-light: #E8F5ED;
  --g-mid:   #A8D5B5;
  --dark:    #141C18;
  --mid:     #3D4D43;
  --subtle:  #6B7D72;
  --border:  #DDE8E1;
  --bg:      #F4F7F5;
  --card:    #FFFFFF;

  /* Semáforo */
  --amber:    #B07A00;
  --amber-bg: #FEF4E6;
  --red:      #A32D2D;
  --red-bg:   #FCEBEB;
  --blue:     #185FA5;
  --blue-bg:  #E6F1FB;

  /* Coherencia con layout de login (área interna) */
  --app-slate: #0f172a;
  --app-slate-mid: #1e293b;
  --app-emerald: #059669;
  --app-emerald-bright: #10b981;
  --app-emerald-soft: rgba(16, 185, 129, 0.14);
  --app-content-bg: #f8fafc;
  --app-card-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 28px rgba(15, 23, 42, 0.06);
  --app-radius-lg: 14px;
  --app-radius-md: 10px;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--app-content-bg);
  color: var(--dark);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout principal ────────────────────────────────────── */
.cesdia-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.cesdia-sidebar {
  width: 220px;
  background:
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0L60 30L30 60L0 30Z' fill='%23ffffff' fill-opacity='0.03'/%3E%3C/svg%3E") repeat,
    linear-gradient(160deg, #064e3b 0%, var(--app-slate) 55%, var(--app-slate-mid) 100%);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

/* Logo */
.cesdia-sidebar .sb-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.cesdia-sidebar .sb-logo-mark {
  width: 38px;
  height: 38px;
  border-radius: var(--app-radius-md);
  background: linear-gradient(145deg, var(--app-emerald-bright) 0%, var(--g) 100%);
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cesdia-sidebar .sb-logo-mark svg {
  width: 20px;
  height: 20px;
}

.cesdia-sidebar .sb-logo-mark .sb-logo-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
}

.cesdia-sidebar .sb-logo-mark .sb-logo-img.sb-logo-img--mono {
  filter: brightness(0) invert(1);
}

/* Logo en encabezado del dashboard */
.dash-header-logo {
  height: 48px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  flex-shrink: 0;
}

.login-rt-logo {
  height: 26px;
  width: auto;
  max-width: 96px;
  object-fit: contain;
  display: block;
}

.cesdia-sidebar .sb-brand-text {
  display: flex;
  flex-direction: column;
}

.cesdia-sidebar .sb-brand-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .5px;
  line-height: 1.1;
}

.cesdia-sidebar .sb-brand-sub {
  font-size: 10px;
  font-weight: 400;
  color: rgba(255,255,255,.4);
  letter-spacing: .03em;
  margin-top: 1px;
}

/* Secciones */
.cesdia-sidebar .sb-section {
  padding: 18px 12px 4px;
  font-size: 9.5px;
  font-weight: 600;
  color: rgba(255,255,255,.3);
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* Links */
.cesdia-sidebar .sb-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  margin: 1px 6px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 400;
  color: rgba(255,255,255,.55);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.cesdia-sidebar .sb-link .sb-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: .7;
}

.cesdia-sidebar .sb-link:hover {
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.9);
}

.cesdia-sidebar .sb-link:hover .sb-icon { opacity: 1; }

.cesdia-sidebar .sb-link.active {
  background: linear-gradient(90deg, var(--app-emerald) 0%, var(--g2) 100%);
  color: #fff;
  box-shadow: 0 2px 10px rgba(5, 150, 105, 0.25);
}

.cesdia-sidebar .sb-link.active .sb-icon { opacity: 1; }

/* Tooltip flotante (solo iconos: menú contraído o pantalla estrecha) */
.cesdia-sb-tip {
  position: fixed;
  z-index: 10001;
  display: none;
  max-width: min(280px, calc(100vw - 16px));
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  color: #f8fafc;
  background: var(--app-slate);
  border-radius: var(--app-radius-md);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
  white-space: normal;
}

/* Footer de sidebar */
.cesdia-sidebar .sb-foot {
  margin-top: auto;
  padding: 12px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.cesdia-sidebar .sb-uname {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,.85);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cesdia-sidebar .sb-urole {
  font-size: 10px;
  color: rgba(255,255,255,.35);
  margin-top: 1px;
}

.sb-uinfo { flex: 1; min-width: 0; }

.sb-logout-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.4);
  text-decoration: none;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}

.sb-logout-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.4;
  stroke-linecap: round;
}

.sb-logout-btn:hover {
  background: rgba(239,68,68,.15);
  border-color: rgba(239,68,68,.3);
  color: #f87171;
}

/* Cerrar menú (solo visible en vista móvil / drawer) */
.cesdia-sidebar-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-left: auto;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.cesdia-sidebar-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.cesdia-sidebar-close:focus-visible {
  outline: 2px solid var(--app-emerald-bright);
  outline-offset: 2px;
}

.cesdia-sidebar-close svg {
  display: block;
}

/* ── Área de contenido ───────────────────────────────────── */
.cesdia-main {
  margin-left: 220px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--app-content-bg);
  position: relative;
}

/* Overlay al abrir el menú en móvil (controlado por .cesdia-shell--nav-open) */
.cesdia-nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 160;
  background: rgba(15, 23, 42, 0.48);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.cesdia-shell--nav-open .cesdia-nav-backdrop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.cesdia-mobile-nav-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .cesdia-nav-backdrop,
  .cesdia-sidebar {
    transition: none !important;
  }
}

/* ── Topbar ──────────────────────────────────────────────── */
.cesdia-topbar {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  height: 54px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 170;
}

.cesdia-topbar .topbar-left { display: flex; align-items: center; gap: 10px; }

.cesdia-topbar .topbar-bc {
  font-size: 12px;
  color: var(--subtle);
}

.cesdia-topbar .topbar-bc strong {
  color: var(--app-slate);
  font-weight: 600;
}

.cesdia-topbar .topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Botón contraer / expandir menú (solo escritorio; ver media query) */
.cesdia-sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border-radius: var(--app-radius-md);
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: #fff;
  color: var(--mid);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.cesdia-sidebar-toggle:hover {
  background: var(--g-light);
  border-color: var(--gborder);
  color: var(--dark);
}

.cesdia-sidebar-toggle__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
}

.cesdia-sidebar-toggle__desk {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cesdia-sidebar-toggle__icon--hamburger {
  display: none;
}

.cesdia-sidebar-toggle__icon--expand {
  display: none;
}

.cesdia-shell--sidebar-collapsed .cesdia-sidebar-toggle__icon--collapse {
  display: none;
}

.cesdia-shell--sidebar-collapsed .cesdia-sidebar-toggle__icon--expand {
  display: block;
}

.cesdia-sidebar-toggle__text {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .cesdia-sidebar-toggle__text {
    display: none;
  }

  .cesdia-sidebar-toggle {
    padding: 0 9px;
  }
}

/* Menú solo iconos (preferencia en pantallas anchas) */
@media (min-width: 961px) {
  .cesdia-shell--sidebar-collapsed .cesdia-sidebar {
    width: 68px;
  }

  .cesdia-shell--sidebar-collapsed .cesdia-main {
    margin-left: 68px;
  }

  .cesdia-shell--sidebar-collapsed .cesdia-sidebar .sb-brand-text,
  .cesdia-shell--sidebar-collapsed .cesdia-sidebar .sb-section,
  .cesdia-shell--sidebar-collapsed .cesdia-sidebar .sb-link > span {
    display: none;
  }

  .cesdia-shell--sidebar-collapsed .cesdia-sidebar .sb-foot .sb-uinfo {
    display: none;
  }

  .cesdia-shell--sidebar-collapsed .cesdia-sidebar .sb-logo {
    justify-content: center;
    padding: 16px 8px;
  }

  .cesdia-shell--sidebar-collapsed .cesdia-sidebar .sb-logo-mark {
    margin: 0;
  }

  .cesdia-shell--sidebar-collapsed .cesdia-sidebar .sb-link {
    justify-content: center;
    padding: 0.55rem;
    margin: 1px 6px;
  }

  .cesdia-shell--sidebar-collapsed .cesdia-sidebar .sb-foot {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 12px 8px;
  }

  .cesdia-shell--sidebar-collapsed .cesdia-sidebar .sb-logout-btn {
    display: flex;
  }
}

/* ── Avatar ──────────────────────────────────────────────── */
.cesdia-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--app-emerald-bright) 0%, var(--g) 100%);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Contenido interior ──────────────────────────────────── */
.cesdia-content {
  padding: 24px;
  flex: 1;
  background:
    radial-gradient(1000px 520px at 0% -5%, rgba(16, 185, 129, 0.07), transparent 52%),
    radial-gradient(880px 420px at 100% 0%, rgba(5, 150, 105, 0.06), transparent 48%),
    var(--app-content-bg);
}

/* ── Footer ──────────────────────────────────────────────── */
.cesdia-footer {
  padding: 12px 24px;
  border-top: 1px solid rgba(226, 232, 240, 0.95);
  font-size: 11px;
  color: var(--subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ── Encabezado de página ────────────────────────────────── */
.cesdia-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 22px;
}

.cesdia-page-header h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 30px;
  font-weight: 700;
  color: var(--app-slate);
  letter-spacing: -0.02em;
  line-height: 1;
}

.cesdia-page-header--with-lead {
  align-items: flex-start;
  gap: 1rem 1.25rem;
}

.cesdia-page-header__intro {
  flex: 1;
  min-width: 0;
}

.cesdia-page-header__lead {
  font-size: 13px;
  color: var(--gmuted);
  margin: 0.55rem 0 0;
  line-height: 1.45;
  max-width: 56ch;
}

.cesdia-page-header__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-top: 2px;
}

.dash-subtitle {
  font-size: 12px;
  color: var(--subtle);
  margin-bottom: 4px;
}

/* ── Cards ───────────────────────────────────────────────── */
.cesdia-card {
  background: var(--card);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-card-shadow);
  overflow: hidden;
}

.cesdia-card .card-header {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cesdia-card .card-header-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 7px;
}

.cesdia-card .card-header-title svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--app-emerald);
  stroke-width: 2;
  stroke-linecap: round;
}

.cesdia-card .card-body { padding: 16px; }

/*
 * Encabezados de tarjetas con tabla de datos (listados):
 * mismo tono que el sidebar + acento verde en borde inferior.
 */
.cesdia-card:has(table.cesdia-table) > .card-header {
  background: linear-gradient(180deg, #1e2a22 0%, var(--dark) 55%, #121a15 100%);
  border-bottom: 2px solid var(--g2);
  padding-top: 13px;
  padding-bottom: 13px;
}

.cesdia-card:has(table.cesdia-table) > .card-header .card-header-title {
  color: rgba(255, 255, 255, 0.96);
}

.cesdia-card:has(table.cesdia-table) > .card-header .card-header-title svg,
.cesdia-card:has(table.cesdia-table) > .card-header .cesdia-card-header-icon {
  stroke: rgba(255, 255, 255, 0.88);
  color: rgba(255, 255, 255, 0.88);
}

.cesdia-card:has(table.cesdia-table) > .card-header a:not(.btn-cesdia) {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 500;
}

.cesdia-card:has(table.cesdia-table) > .card-header a:not(.btn-cesdia):hover {
  color: #fff;
}

.cesdia-card:has(table.cesdia-table) > .card-header .cesdia-users-meta {
  color: rgba(255, 255, 255, 0.55);
  font-weight: 500;
}

/* ── KPI Cards ───────────────────────────────────────────── */
.cesdia-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.cesdia-kpi {
  background: var(--card);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-card-shadow);
  padding: 16px 16px 16px 20px;
  position: relative;
  overflow: hidden;
}

/* Acento izquierdo por color */
.cesdia-kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  border-radius: var(--app-radius-lg) 0 0 var(--app-radius-lg);
}

.kpi-accent-green::before  { background: var(--g); }
.kpi-accent-amber::before  { background: var(--amber); }
.kpi-accent-red::before    { background: var(--red); }
.kpi-accent-blue::before   { background: var(--blue); }

/* Compatibilidad con nombres anteriores */
.kpi-accent-blue::before   { background: var(--blue); }
.kpi-accent-yellow::before { background: var(--amber); }

.cesdia-kpi .kpi-label {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--subtle);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 8px;
}

.cesdia-kpi .kpi-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--dark);
  letter-spacing: -.5px;
  line-height: 1;
}

.cesdia-kpi .kpi-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.cesdia-kpi .kpi-trend {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
}

.cesdia-kpi .kpi-trend.up     { background: #E8F5ED; color: var(--g); }
.cesdia-kpi .kpi-trend.down   { background: var(--red-bg); color: var(--red); }
.cesdia-kpi .kpi-trend.neutral { background: var(--amber-bg); color: var(--amber); }

/* Sparkline canvas */
.kpi-spark {
  height: 28px;
  width: 60px;
  position: relative;
  flex-shrink: 0;
}

/* ── Botones ─────────────────────────────────────────────── */
.btn-cesdia {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--app-radius-md);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: background .15s, box-shadow .15s, transform .12s;
  font-family: inherit;
}

.btn-cesdia svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.btn-cesdia-primary {
  background: linear-gradient(145deg, var(--app-emerald-bright) 0%, var(--app-emerald) 45%, var(--g) 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.28);
}
.btn-cesdia-primary:hover {
  background: linear-gradient(145deg, #34d399 0%, var(--app-emerald) 50%, var(--g2) 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.32);
}
.btn-cesdia-primary:active { transform: translateY(1px); }

.btn-cesdia-secondary {
  background: var(--card);
  color: var(--mid);
  border: 1px solid var(--border);
}
.btn-cesdia-secondary:hover { background: var(--g-light); }

.btn-cesdia-danger {
  background: var(--red);
  color: #fff;
}
.btn-cesdia-danger:hover { background: #8b1c1c; }

.btn-cesdia-sm {
  height: 28px;
  padding: 0 12px;
  font-size: 11px;
  border-radius: 7px;
}

/* ── Formularios ─────────────────────────────────────────── */
.cesdia-form-group { margin-bottom: 1rem; }

.cesdia-form-group label,
.cesdia-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--g);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 5px;
}

.cesdia-input,
.cesdia-select,
.cesdia-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--app-radius-md);
  padding: 0 12px;
  font-size: 13px;
  background: var(--bg);
  color: var(--dark);
  transition: border-color .15s, background .15s;
  font-family: inherit;
}

.cesdia-input,
.cesdia-select { height: 36px; }

.cesdia-textarea {
  padding: 8px 12px;
  resize: vertical;
  min-height: 80px;
}

.cesdia-input:focus,
.cesdia-select:focus,
.cesdia-textarea:focus {
  outline: none;
  border-color: var(--app-emerald);
  background: #fff;
  box-shadow: 0 0 0 3px var(--app-emerald-soft);
}

.cesdia-input.is-invalid,
.cesdia-select.is-invalid {
  border-color: var(--red);
  background: var(--red-bg);
}

.cesdia-field-error {
  font-size: 11px;
  color: var(--red);
  margin-top: 4px;
}

/* ── Grids de formulario ─────────────────────────────────── */
.cesdia-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cesdia-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.cesdia-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* ── Formularios de alta/edición (presentación formal) ───── */
.cesdia-form-card {
  width: 100%;
  box-sizing: border-box;
}

.cesdia-form-card > .card-body {
  padding: 20px 24px 24px;
}

.cesdia-form-card > .card-header {
  background: linear-gradient(180deg, rgba(5, 150, 105, 0.08) 0%, var(--card) 55%);
}

.cesdia-form-section {
  margin-bottom: 1.35rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.cesdia-form-section:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.cesdia-form-section__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--dark);
  margin: 0 0 4px;
}

.cesdia-form-section__hint {
  font-size: 12px;
  color: var(--gmuted);
  line-height: 1.5;
  margin: 0 0 14px;
  max-width: 70ch;
}

.cesdia-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.cesdia-form-actions__right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.cesdia-form-checkbox .input.checkbox {
  margin-bottom: 0;
}

.cesdia-form-checkbox .input.checkbox label {
  display: inline;
  font-size: 13px;
  font-weight: 500;
  color: var(--dark);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
  vertical-align: middle;
}

.cesdia-form-checkbox .input.checkbox input {
  vertical-align: middle;
}

/* ── Tabla ───────────────────────────────────────────────── */
.cesdia-table-wrapper {
  background: var(--card);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: var(--app-radius-lg);
  overflow: hidden;
  box-shadow: var(--app-card-shadow);
}

.cesdia-table-wrapper--scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.cesdia-card > .cesdia-table-wrapper--inset {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.cesdia-pagination--card {
  padding: 0.65rem 1rem 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 0;
}

.cesdia-table-empty {
  text-align: center !important;
  padding: 1.5rem 1rem !important;
  color: var(--gmuted) !important;
  font-size: 13px;
  font-weight: 400 !important;
}

.cesdia-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.cesdia-table thead tr {
  background: linear-gradient(180deg, #f6f9f7 0%, #eef4f0 100%);
  border-bottom: 2px solid var(--gborder);
}

.cesdia-table th {
  padding: 7px 10px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  color: var(--mid);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: none;
  white-space: nowrap;
}

.cesdia-table th:first-child {
  padding-left: 12px;
}

.cesdia-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eef2ef;
  color: var(--dark);
  vertical-align: middle;
  line-height: 1.35;
}

.cesdia-table td:first-child {
  padding-left: 12px;
  font-weight: 500;
}

.cesdia-table tbody tr:nth-child(even) td {
  background: #fbfcfb;
}

.cesdia-table tbody tr:last-child td {
  border-bottom: none;
}

.cesdia-table tbody tr:hover td {
  background: #f1faf4 !important;
}

.cesdia-table tbody tr.cesdia-table-row--self td {
  box-shadow: inset 3px 0 0 0 var(--g2);
}

.cesdia-table tbody tr.cesdia-table-row--self:hover td {
  background: #e8f6ed !important;
}

/* Etiqueta de rol en tablas de usuarios */
.cesdia-role-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.cesdia-role-tag--admin {
  color: #1e3a5f;
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #93c5fd;
}

.cesdia-role-tag--tec {
  color: #14532d;
  background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #86efac;
}

/* ── Usuarios — tabla refinada ───────────────────────────── */
.cesdia-card--users-table {
  box-shadow: 0 2px 14px rgba(20, 28, 24, 0.06);
}

.cesdia-card-header-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  stroke: var(--g);
}

.cesdia-users-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--gmuted);
  letter-spacing: 0.02em;
}

.cesdia-table--users tbody tr {
  transition: background-color 0.14s ease;
}

.cesdia-table--users thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef4f0;
  box-shadow: 0 1px 0 var(--gborder);
}

.cesdia-table--users thead tr {
  background: #eef4f0;
}

.cesdia-table--users .cesdia-table-th--activity {
  min-width: 168px;
}

.cesdia-table--users .cesdia-table-th--actions,
.cesdia-table--users .cesdia-table-td--actions {
  text-align: center;
  width: 148px;
}

.cesdia-table-usercell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cesdia-table-usercell__avatar {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--g2) 0%, var(--g1) 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(26, 107, 53, 0.25);
}

.cesdia-table-usercell__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.cesdia-table-usercell__name {
  font-weight: 600;
  color: var(--dark);
  line-height: 1.25;
  word-break: break-word;
}

.cesdia-table-usercell__you {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--g1);
  background: var(--g4);
  padding: 1px 6px;
  border-radius: 4px;
}

.cesdia-table-muted {
  color: var(--gmuted);
  font-size: 12.5px;
}

a.cesdia-table-email {
  color: var(--g1);
  font-size: 12.5px;
  text-decoration: none;
  word-break: break-all;
  border-bottom: 1px solid transparent;
  transition: border-color 0.12s, color 0.12s;
}

a.cesdia-table-email:hover {
  color: var(--gd);
  border-bottom-color: rgba(26, 107, 53, 0.35);
}

.cesdia-table-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

a.cesdia-table-action,
button.cesdia-table-action,
input.cesdia-table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--gborder);
  background: var(--card);
  color: var(--mid);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

a.cesdia-table-action--edit:hover,
button.cesdia-table-action--edit:hover {
  background: var(--g4);
  border-color: var(--g-mid);
  color: var(--g1);
}

a.cesdia-table-action--delete,
button.cesdia-table-action--delete {
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.28);
  background: #fff;
}

a.cesdia-table-action--delete:hover,
button.cesdia-table-action--delete:hover {
  background: var(--red-bg);
  border-color: rgba(185, 28, 28, 0.45);
  color: #991b1b;
}

.cesdia-table-empty a {
  color: var(--g1);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(26, 107, 53, 0.35);
  margin-left: 4px;
}

.cesdia-table-empty a:hover {
  color: var(--gd);
}

.cesdia-table .folio-link {
  color: var(--g);
  font-weight: 600;
  text-decoration: none;
}
.cesdia-table .folio-link:hover { text-decoration: underline; }

/* ── Badges ──────────────────────────────────────────────── */
.badge-cesdia {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 500;
}

.badge-aprobado  { background: #E8F5ED; color: #1A6B35; }
.badge-rechazado { background: var(--red-bg); color: var(--red); }
.badge-cancelado { background: var(--amber-bg); color: var(--amber); }
.badge-info      { background: var(--bg); color: var(--mid); border: 1px solid var(--border); }

/* Pills */
.pill { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 10.5px; font-weight: 500; }
.p-ok   { background: #E8F5ED; color: #1A6B35; }
.p-no   { background: var(--red-bg); color: var(--red); }
.p-ca   { background: var(--amber-bg); color: var(--amber); }
.p-prog { background: var(--blue-bg); color: var(--blue); }

/* ── Iconos de acción en tabla (historial inspecciones, etc.) ─ */
.tbl-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: none;
  padding: 4px 6px;
  border-radius: 10px;
  background: rgba(26, 107, 42, 0.04);
  border: 1px solid rgba(26, 107, 42, 0.12);
}

.tbl-actions__sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  flex-shrink: 0;
  margin: 0 2px;
}

/* Columna acciones: no comprimir hasta invisible */
#tabla-inspecciones th:last-child,
#tabla-inspecciones td:last-child {
  min-width: 280px;
  width: 1%;
  white-space: normal;
  vertical-align: middle;
}

/* Botón de texto explícito: plantilla remolque (historial) */
.tbl-action-template {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  margin-left: 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #145a28;
  text-decoration: none;
  white-space: nowrap;
  border-radius: 8px;
  border: 1px solid rgba(26, 107, 42, 0.4);
  background: linear-gradient(180deg, #f4fbf6 0%, #e8f5ed 100%);
  box-shadow: 0 1px 2px rgba(20, 28, 24, 0.06);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tbl-action-template:hover {
  background: #dff3e5;
  border-color: #1a6b2a;
  color: #0d3d17;
}

.tbl-pdf-orden {
  font-size: 11px;
  font-weight: 600;
  color: var(--g);
  text-decoration: none;
  white-space: nowrap;
}
.tbl-pdf-orden:hover { text-decoration: underline; }

.tbl-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 28, 24, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  color: var(--subtle);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  flex-shrink: 0;
}

.tbl-action-btn:focus-visible {
  outline: 2px solid var(--g);
  outline-offset: 2px;
}

.tbl-action-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tbl-action-btn:hover {
  background: var(--g-light);
  color: var(--g);
  border-color: rgba(26, 107, 42, 0.25);
  box-shadow: 0 2px 6px rgba(26, 107, 42, 0.08);
}

.tbl-action-btn--pdf:hover {
  background: #e8f5ed;
  color: #1a6b2a;
  border-color: rgba(26, 107, 42, 0.35);
}

.tbl-action-btn.danger:hover { background: var(--red-bg); color: var(--red); }

/* ── Paginación ──────────────────────────────────────────── */
.cesdia-pagination {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card);
}

.cesdia-pagination .pag-info {
  font-size: 11px;
  color: var(--subtle);
}

.cesdia-pagination .pag-pages,
.cesdia-pagination .pag-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
}

.cesdia-pagination a,
.cesdia-pagination .pag-pages a,
.cesdia-pagination .pag-btns .pb {
  min-width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 12px;
  color: var(--subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  margin: 0 1px;
  transition: background .15s;
}

.cesdia-pagination a:hover,
.cesdia-pagination .pag-pages a:hover,
.cesdia-pagination .pag-btns .pb:hover,
.cesdia-pagination .pag-btns a.pb.current {
  background: var(--g);
  color: #fff;
  border-color: var(--g);
}

/* ── Filtros ─────────────────────────────────────────────── */
.cesdia-filters {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.cesdia-filters .filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── Wizard ──────────────────────────────────────────────── */
.cesdia-wizard {
  display: flex;
  gap: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.cesdia-wizard-steps {
  width: 175px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: .9rem .7rem;
}

.cesdia-wizard-step {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 7px 9px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 3px;
}

.cesdia-wizard-step.done   { background: #E8F5ED; }
.cesdia-wizard-step.active { background: var(--g-light); border: 1px solid var(--border); }

.cesdia-wizard-step .step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.cesdia-wizard-step.done   .step-num { background: var(--g2); color: #fff; }
.cesdia-wizard-step.active .step-num { background: var(--g); color: #fff; }
.cesdia-wizard-step:not(.done):not(.active) .step-num {
  background: #f0f0f0; color: #bbb; border: 1px solid #ddd;
}

.cesdia-wizard-step .step-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--dark);
  line-height: 1.3;
}
.cesdia-wizard-step:not(.done):not(.active) .step-label { color: #bbb; }

.cesdia-wizard-step .step-sub {
  font-size: 9px;
  color: var(--subtle);
  margin-top: 1px;
}
.cesdia-wizard-step:not(.done):not(.active) .step-sub { color: #ccc; }

.cesdia-wizard-form {
  flex: 1;
  padding: 1rem;
  background: var(--bg);
  overflow: auto;
}

/* ── Sección de formulario ───────────────────────────────── */
.cesdia-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: .9rem;
}

.cesdia-section .sec-head {
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cesdia-section .sec-head svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--g);
  stroke-width: 2;
  stroke-linecap: round;
}

.cesdia-section .sec-head-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--g);
}

.cesdia-section .sec-body { padding: .9rem 1rem; }

/* ── Llanta box ──────────────────────────────────────────── */
.cesdia-llanta-box {
  background: var(--g-light);
  border: 1px solid var(--g-mid);
  border-radius: 9px;
  padding: .7rem;
}

.cesdia-llanta-box .llanta-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--g);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ── Alertas ─────────────────────────────────────────────── */
.cesdia-alert {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: .8rem;
}

.cesdia-alert svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  flex-shrink: 0;
}

.cesdia-alert-success { background: #E8F5ED; color: #1A6B35; border: 1px solid var(--g-mid); }
.cesdia-alert-danger  { background: var(--red-bg); color: var(--red); border: 1px solid #f09595; }
.cesdia-alert-warning { background: var(--amber-bg); color: var(--amber); border: 1px solid #f5d98a; }
.cesdia-alert-info    { background: var(--blue-bg); color: var(--blue); border: 1px solid #85b7eb; }

.cesdia-horario-candado {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 4px;
}
.cesdia-horario-candado__icon {
  flex-shrink: 0;
  font-size: 1.1rem;
  line-height: 1.35;
}
.cesdia-input--bloqueado {
  border-color: var(--red) !important;
  background: var(--red-bg) !important;
}

.cesdia-input--prof-limitada {
  border-color: var(--g2);
  background: var(--g4);
}

/* ── Wizard footer ───────────────────────────────────────── */
.cesdia-wizard-footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: .75rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cesdia-progress { display: flex; align-items: center; gap: 3px; }

.cesdia-progress .prog-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d1d5db;
}

.cesdia-progress .prog-dot.done   { background: var(--g2); }
.cesdia-progress .prog-dot.active { background: var(--g); width: 20px; border-radius: 3px; }

.cesdia-progress-info {
  font-size: 11px;
  color: var(--subtle);
  margin-left: 10px;
}

/* ── Login ───────────────────────────────────────────────── */
.cesdia-login-wrap {
  min-height: 100vh;
  background: var(--g);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cesdia-login-card {
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  width: 100%;
  max-width: 820px;
  display: flex;
  box-shadow: 0 4px 32px rgba(10,50,20,.18);
}

.cesdia-login-left {
  width: 220px;
  background: var(--dark);
  padding: 2rem 1.4rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.cesdia-login-left-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin-bottom: 1rem;
  border-radius: 10px;
}

.cesdia-login-right {
  flex: 1;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.cesdia-login-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 4px;
}

.cesdia-login-sub {
  font-size: 13px;
  color: var(--subtle);
  margin-bottom: 2rem;
}

.cesdia-login-logo {
  text-align: center;
  margin-bottom: 1rem;
}
.cesdia-login-logo img {
  max-width: 140px;
  max-height: 56px;
  object-fit: contain;
}

/* ── Tarjeta detalle inspección ──────────────────────────── */
.cesdia-result-banner {
  padding: 10px 16px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.2rem;
}

.cesdia-result-banner svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  flex-shrink: 0;
}

.cesdia-result-banner.aprobado  { background: #E8F5ED; color: #1A6B35; border: 1px solid var(--g-mid); }
.cesdia-result-banner.rechazado { background: var(--red-bg); color: var(--red); border: 1px solid #f09595; }
.cesdia-result-banner.cancelado { background: var(--amber-bg); color: var(--amber); border: 1px solid #f5d98a; }

/* ── Section summary ─────────────────────────────────────── */
.cesdia-section-summary {
  text-align: center;
  padding: .8rem .5rem;
  border-radius: 9px;
  font-size: 11px;
}

.cesdia-section-summary.ok  { background: #f0fdf4; color: #1A6B35; }
.cesdia-section-summary.err { background: #fef2f2; color: var(--red); }

.cesdia-section-summary svg {
  width: 22px;
  height: 22px;
  display: block;
  margin: 0 auto 4px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ── Data table simple ───────────────────────────────────── */
.cesdia-data-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}

.cesdia-data-table th {
  width: 45%;
  font-weight: 400;
  color: var(--subtle);
  padding: 5px 0;
  text-align: left;
  vertical-align: top;
}

.cesdia-data-table td {
  padding: 5px 0;
  color: var(--dark);
}

/* ── Flash messages CakePHP ──────────────────────────────── */
.message.success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid rgba(5, 150, 105, 0.22);
  border-left: 3px solid var(--app-emerald);
  padding: 12px 16px;
  border-radius: var(--app-radius-md);
  margin-bottom: .8rem;
  font-size: 13px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}
.message.error {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(163, 45, 45, 0.15);
  border-left: 3px solid var(--red);
  padding: 12px 16px;
  border-radius: var(--app-radius-md);
  margin-bottom: .8rem;
  font-size: 13px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}
.message.warning {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid rgba(176, 122, 0, 0.18);
  border-left: 3px solid var(--amber);
  padding: 12px 16px;
  border-radius: var(--app-radius-md);
  margin-bottom: .8rem;
  font-size: 13px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

/* ── Usuarios — presencia (en línea / reciente) ───────────── */
.cesdia-user-actividad {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.cesdia-user-actividad__fecha {
  font-size: 12px;
  color: var(--dark);
  line-height: 1.3;
}

.cesdia-user-actividad__hace {
  font-size: 11px;
  color: var(--gmuted);
  font-weight: 400;
}

.cesdia-user-sin-actividad {
  color: var(--gmuted);
  font-size: 12px;
}

.cesdia-presence {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
}

.cesdia-presence--online {
  color: #14532d;
  background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
  border: 1px solid #6ee7b7;
  box-shadow: 0 1px 2px rgba(20, 83, 45, 0.08);
}

.cesdia-presence--reciente {
  color: #92400e;
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
  box-shadow: 0 1px 2px rgba(146, 64, 14, 0.06);
}

.cesdia-presence__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.35);
  animation: cesdia-presence-pulse 2s ease-in-out infinite;
}

.cesdia-presence__dot--reciente {
  background: #d97706;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.3);
  animation: none;
}

.cesdia-presence__label {
  white-space: nowrap;
}

@keyframes cesdia-presence-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.35);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.12);
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.15);
  }
}

/* ── Firma técnico — avisos a ancho del área de contenido ─────────────── */
.cesdia-firma-status-banda {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-bottom: 1rem;
  margin-left: auto;
  margin-right: auto;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}

.cesdia-firma-status-banda--ok {
  border: 1px solid #86efac;
  background: #f0fdf4;
  color: #14532d;
}

.cesdia-firma-status-banda--pendiente {
  margin-bottom: 1.25rem;
  border: 1px solid #fcd34d;
  background: #fffbeb;
  color: #78350f;
}

.cesdia-firma-status-banda__sub {
  display: block;
  font-size: 13px;
  margin-top: 4px;
  opacity: 0.95;
}

.cesdia-firma-status-banda__sub--p {
  display: block;
  margin: 8px 0 0;
  line-height: 1.5;
}

/* ── Firma técnico — modos a ancho completo (encima de las dos columnas) ── */
.cesdia-firma-modos-banda {
  margin-bottom: 0;
}

.cesdia-firma-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  justify-content: center;
  border-bottom: 2px solid var(--gborder);
  margin-bottom: 1.25rem;
  max-width: 100%;
}

.cesdia-firma-tab {
  appearance: none;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  margin: 0;
  cursor: pointer;
  color: var(--gmuted);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  margin-bottom: -2px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.cesdia-firma-tab:hover {
  color: var(--dark);
  background: rgba(26, 107, 53, 0.06);
}

.cesdia-firma-tab.is-active,
.cesdia-firma-tab.is-active:hover {
  color: var(--g1);
  font-weight: 600;
  background: var(--card);
  border-color: var(--gborder);
  border-bottom-color: var(--card);
  box-shadow: 0 -1px 0 var(--card);
  z-index: 1;
  position: relative;
}

.cesdia-firma-tab:focus-visible {
  outline: 2px solid var(--g2);
  outline-offset: 2px;
}

/* ── Firma técnico — editor (izq.) / vista previa (der.) ───── */
.cesdia-firma-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.cesdia-firma-col {
  flex: 1 1 calc(50% - 0.625rem);
  min-width: min(100%, 300px);
  box-sizing: border-box;
}
.cesdia-firma-col--editor {
  max-width: 100%;
}
.cesdia-firma-col--preview .cesdia-card {
  position: sticky;
  top: 1rem;
}

/* ── Extras heredados ────────────────────────────────────── */
.cesdia-card-header-row { flex-wrap: wrap; gap: 10px; }
.cesdia-sin-defaults-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--subtle);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.cesdia-sin-defaults-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--g);
}

/* ── Dashboard — layout ──────────────────────────────────── */
.dash-main-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 14px;
  margin-bottom: 14px;
}

.dash-right-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Tabs del gráfico */
.dash-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border-radius: 8px;
  padding: 3px;
}

.dash-tab {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--subtle);
  font-weight: 500;
  border: none;
  background: transparent;
  font-family: inherit;
}

.dash-tab.on {
  background: var(--card);
  color: var(--dark);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* ── Dashboard — filas de estado ─────────────────────────── */
.dash-status-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.dash-status-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dash-status-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dash-status-label {
  font-size: 12px;
  color: var(--mid);
  flex: 1;
}

.dash-status-count {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px;
  font-weight: 700;
}

/* ── Dashboard — feed de actividad ──────────────────────── */
.dash-feed {
  display: flex;
  flex-direction: column;
}

.dash-feed-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--bg);
}

.dash-feed-row:last-child { border-bottom: none; }

.feed-dot-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 3px;
  flex-shrink: 0;
}

.feed-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.feed-line {
  width: 1.5px;
  flex: 1;
  background: var(--border);
  margin-top: 3px;
  min-height: 18px;
}

.dash-feed-row:last-child .feed-line { display: none; }

.feed-body { flex: 1; min-width: 0; }

.feed-text {
  font-size: 12px;
  color: var(--mid);
  line-height: 1.45;
}

.feed-text strong {
  color: var(--dark);
  font-weight: 500;
}

.feed-time {
  font-size: 10px;
  color: var(--subtle);
  margin-top: 2px;
}

/* ── Dashboard — top técnicos ────────────────────────────── */
.dash-tecnico-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.dash-tecnico-row:last-child { margin-bottom: 0; }

.tecnico-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.tecnico-info { flex: 1; min-width: 0; }

.tecnico-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.tecnico-bar-wrap {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.tecnico-bar {
  height: 100%;
  border-radius: 2px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 960px) {
  /* Menú móvil: cajón lateral + overlay (patrón habitual) */
  .cesdia-sidebar-toggle__desk {
    display: none;
  }

  .cesdia-sidebar-toggle__icon--hamburger {
    display: block;
  }

  .cesdia-sidebar-toggle {
    display: inline-flex;
  }

  .cesdia-sidebar {
    width: min(288px, 86vw);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }

  .cesdia-shell--nav-open .cesdia-sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 36px rgba(0, 0, 0, 0.28);
  }

  .cesdia-main {
    margin-left: 0;
  }

  .cesdia-sidebar .sb-logo {
    align-items: center;
  }

  .cesdia-sidebar-close {
    display: inline-flex;
  }

  .cesdia-kpis { grid-template-columns: repeat(2, 1fr); }
  .dash-main-grid { grid-template-columns: 1fr; }
}

@media (min-width: 961px) {
  .cesdia-sidebar-close {
    display: none !important;
  }
}

@media (max-width: 600px) {
  .cesdia-content { padding: 14px; }
  .cesdia-kpis { grid-template-columns: 1fr 1fr; }
  .cesdia-grid-2,
  .cesdia-grid-3,
  .cesdia-grid-4 { grid-template-columns: 1fr; }
  .cesdia-form-card > .card-body {
    padding: 16px 16px 18px;
  }
  .cesdia-filters { flex-direction: column; align-items: stretch; }
  .dash-main-grid { grid-template-columns: 1fr; }
}
