/* ═══════════════════════════════════════════════════════════════
   OfiSAT — Design System v4.1
   Holded-inspired sidebar layout · Temas: Legacy, Premium Dark, Claro Profesional
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. Custom Properties (Legacy — tema por defecto) ── */
:root {
  /* Backgrounds */
  --bg-body:       #0d1117;
  --bg-surface:    #161b22;
  --bg-elevated:   #1c2128;
  --bg-overlay:    #21262d;
  --bg-hover:      #262c36;

  /* Borders */
  --border:        #30363d;
  --border-muted:  #21262d;
  --border-focus:  #388bfd;

  /* Text */
  --txt-primary:   #e6edf3;
  --txt-secondary: #c9d1d9;
  --txt-muted:     #8b949e;
  --txt-dim:       #484f58;

  /* Accent — blue (Holded-inspired) */
  --accent:        #58a6ff;
  --accent-dark:   #1f6feb;
  --accent-hover:  #388bfd;
  --accent-subtle: rgba(56,139,253,0.1);

  /* Success */
  --success:       #3fb950;
  --success-dark:  #196c2e;
  --success-hover: #238636;

  /* Warning */
  --warning:       #e3a400;
  --warning-dark:  #7d4e00;

  /* Danger */
  --danger:        #f78166;
  --danger-dark:   #6e1c1c;

  /* Badges */
  --badge-pendiente-bg: #2d1f00;
  --badge-pendiente-border: #5c3d00;
  --badge-en-curso-bg: #001433;
  --badge-en-curso-border: #003182;
  --badge-cerrada-bg: #0f2d1a;
  --badge-cerrada-border: var(--success-dark);
  --badge-vencido-bg: #1c0a0a;
  --badge-vencido-border: var(--danger-dark);

  /* Toasts */
  --toast-shadow: rgba(0,0,0,0.5);
  --toast-error-bg: rgba(218,54,51,0.25);
  --toast-warning-bg: rgba(227,164,0,0.2);

  /* Scrollbar */
  --scrollbar-track: var(--bg-body);
  --scrollbar-thumb: var(--bg-overlay);
  --scrollbar-thumb-hover: var(--txt-dim);

  /* Hover backgrounds */
  --hover-slate: rgba(33,38,45,0.7);

  /* Design tokens */
  --radius:        8px;
  --radius-lg:     12px;
  --shadow:        0 1px 4px rgba(0,0,0,0.3), 0 2px 12px rgba(0,0,0,0.2);
  --shadow-lg:     0 4px 24px rgba(0,0,0,0.5);
  --transition:    0.15s ease;

  /* Layout */
  --sidebar-width:     220px;
  --sidebar-collapsed: 60px;
  --topbar-height:     50px;
  --input-height:      38px;
}

/* ── 1b. Tema Premium Dark — oscuro refinado estilo Vercel/Linear ── */
[data-theme="premium-dark"] {
  /* Fondos — negros neutros, sin tinte azul */
  --bg-body:       #09090b;
  --bg-surface:    #111113;
  --bg-elevated:   #19191c;
  --bg-overlay:    #202024;
  --bg-hover:      #27272b;

  /* Bordes */
  --border:        #2e2e33;
  --border-muted:  #1e1e22;
  --border-focus:  #7c3aed;

  /* Texto — contraste suave */
  --txt-primary:   #fafafa;
  --txt-secondary: #a1a1aa;
  --txt-muted:     #71717a;
  --txt-dim:       #52525b;

  /* Acento — violeta (Linear-inspired) */
  --accent:        #a78bfa;
  --accent-dark:   #7c3aed;
  --accent-hover:  #8b5cf6;
  --accent-subtle: rgba(124,58,237,0.12);

  /* Success */
  --success:       #4ade80;
  --success-dark:  #166534;
  --success-hover: #22c55e;

  /* Warning */
  --warning:       #facc15;
  --warning-dark:  #854d0e;

  /* Danger */
  --danger:        #f87171;
  --danger-dark:   #7f1d1d;

  /* Badges */
  --badge-pendiente-bg: #271a00;
  --badge-pendiente-border: #854d0e;
  --badge-en-curso-bg: #1a0a3e;
  --badge-en-curso-border: #5b21b6;
  --badge-cerrada-bg: #052e16;
  --badge-cerrada-border: var(--success-dark);
  --badge-vencido-bg: #1c0808;
  --badge-vencido-border: var(--danger-dark);

  /* Toasts */
  --toast-shadow: rgba(0,0,0,0.6);
  --toast-error-bg: rgba(248,113,113,0.15);
  --toast-warning-bg: rgba(250,204,21,0.12);

  /* Scrollbar */
  --scrollbar-track: var(--bg-body);
  --scrollbar-thumb: var(--bg-overlay);
  --scrollbar-thumb-hover: var(--txt-dim);

  /* Hover */
  --hover-slate: rgba(39,39,43,0.7);

  /* Sombras */
  --shadow:    0 1px 3px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.6);
}

/* ── 1c. Tema Claro Profesional — limpio y corporativo ── */
[data-theme="light"] {
  /* Fondos */
  --bg-body:       #f4f5f7;
  --bg-surface:    #ffffff;
  --bg-elevated:   #f0f1f3;
  --bg-overlay:    #e5e7eb;
  --bg-hover:      #ebedf0;

  /* Bordes */
  --border:        #d1d5db;
  --border-muted:  #e5e7eb;
  --border-focus:  #2563eb;

  /* Texto */
  --txt-primary:   #111827;
  --txt-secondary: #374151;
  --txt-muted:     #6b7280;
  --txt-dim:       #9ca3af;

  /* Acento — azul corporativo */
  --accent:        #2563eb;
  --accent-dark:   #1d4ed8;
  --accent-hover:  #3b82f6;
  --accent-subtle: rgba(37,99,235,0.08);

  /* Success */
  --success:       #16a34a;
  --success-dark:  #15803d;
  --success-hover: #22c55e;

  /* Warning */
  --warning:       #d97706;
  --warning-dark:  #b45309;

  /* Danger */
  --danger:        #dc2626;
  --danger-dark:   #b91c1c;

  /* Badges */
  --badge-pendiente-bg: #fef3c7;
  --badge-pendiente-border: #f59e0b;
  --badge-en-curso-bg: #dbeafe;
  --badge-en-curso-border: #3b82f6;
  --badge-cerrada-bg: #dcfce7;
  --badge-cerrada-border: #22c55e;
  --badge-vencido-bg: #fee2e2;
  --badge-vencido-border: #ef4444;

  /* Toasts */
  --toast-shadow: rgba(0,0,0,0.1);
  --toast-error-bg: #fef2f2;
  --toast-warning-bg: #fffbeb;

  /* Scrollbar */
  --scrollbar-track: #f4f5f7;
  --scrollbar-thumb: #d1d5db;
  --scrollbar-thumb-hover: #9ca3af;

  /* Hover */
  --hover-slate: rgba(229,231,235,0.7);

  /* Sombras — mas suaves */
  --shadow:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
}

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

/* ── 3. Base ── */
body {
  background-color: var(--bg-body);
  color: var(--txt-primary);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 0.9rem;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a               { color: var(--accent); text-decoration: none; }
a:hover         { text-decoration: underline; }
button          { font-family: inherit; font-size: inherit; }

/* ── 4. Scrollbar ── */
::-webkit-scrollbar              { width: 8px; height: 8px; }
::-webkit-scrollbar-track        { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb        { background: var(--scrollbar-thumb); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover  { background: var(--scrollbar-thumb-hover); }

/* ── 5. Divider ── */
hr { border: none; border-top: 1px solid var(--border-muted); margin: 16px 0; }


/* ══════════════════════════════════════════════════════════════
   SIDEBAR — fixed left navigation
   ══════════════════════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 60;
  transition: width 0.2s ease;
  overflow: hidden;
}

.sidebar-brand {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-muted);
  flex-shrink: 0;
}
.sidebar-brand a {
  color: var(--accent);
  font-weight: 800;
  font-size: 1.1rem;
  text-decoration: none;
  letter-spacing: -0.5px;
  white-space: nowrap;
}
.sidebar-brand a:hover { color: var(--accent-hover); text-decoration: none; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
}

.nav-group {
  padding: 4px 0;
}
.nav-group + .nav-group {
  border-top: 1px solid var(--border-muted);
}

.nav-group-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--txt-dim);
  padding: 10px 18px 4px;
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  color: var(--txt-muted);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  border-left: 3px solid transparent;
  margin: 1px 0;
}
.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--txt-primary);
  text-decoration: none;
}
.nav-item.active {
  background: var(--accent-subtle);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.nav-icon {
  font-size: 1rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

/* Collapsed sidebar */
body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed);
}
body.sidebar-collapsed .sidebar-brand a span,
body.sidebar-collapsed .nav-group-label,
body.sidebar-collapsed .nav-item span:not(.nav-icon) {
  display: none;
}
body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
}
body.sidebar-collapsed .nav-icon {
  width: auto;
}
body.sidebar-collapsed .sidebar-brand {
  text-align: center;
  padding: 16px 8px;
}
body.sidebar-collapsed .app-main {
  margin-left: var(--sidebar-collapsed);
}


/* ══════════════════════════════════════════════════════════════
   APP MAIN — content area beside sidebar
   ══════════════════════════════════════════════════════════════ */
.app-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.2s ease;
}


/* ══════════════════════════════════════════════════════════════
   TOP BAR — slim horizontal bar
   ══════════════════════════════════════════════════════════════ */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--txt-muted);
  font-size: 1.15rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: all var(--transition);
  line-height: 1;
}
.sidebar-toggle:hover {
  background: var(--bg-elevated);
  color: var(--txt-primary);
}

/* Top bar search */
.topbar-search {
  position: relative;
  flex: 1;
  max-width: 420px;
}
.topbar-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 1;
}
.topbar-search input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--txt-secondary) !important;
  font-size: 0.82rem;
  min-height: auto;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.topbar-search input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56,139,253,0.18);
  outline: none;
}
.topbar-search input::placeholder {
  color: var(--txt-dim) !important;
}

/* Search dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 340px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 420px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}
.search-dropdown.visible { display: block; }

.search-result {
  display: block;
  padding: 10px 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--border-muted);
  transition: background var(--transition);
  font-size: 0.85rem;
}
.search-result:hover { background: var(--bg-elevated); text-decoration: none; }
.search-result-type {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-right: 6px;
}
.type-incidencia { background: var(--toast-error-bg); color: var(--danger); }
.type-cliente    { background: var(--accent-subtle); color: var(--accent); }
.type-equipo     { background: var(--badge-cerrada-bg); color: var(--success); }

/* Top bar user */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  flex-shrink: 0;
}
.topbar-user-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--txt-secondary);
}
.topbar-logout {
  font-size: 0.78rem;
  color: var(--txt-dim);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--radius);
  transition: all var(--transition);
}
.topbar-logout:hover {
  background: var(--bg-elevated);
  color: var(--danger);
  text-decoration: none;
}


/* ── Main content ── */
.main-content {
  padding: 28px 32px;
  max-width: 1600px;
  flex: 1;
}


/* ══════════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-header-title { font-weight: 700; color: var(--txt-primary); font-size: 0.9rem; }


/* ══════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.3;
  font-family: inherit;
  min-height: 36px;
}
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn:active { transform: scale(0.98); }

.btn-primary            { background: var(--accent-dark); color: #fff; }
.btn-primary:hover      { background: var(--accent-hover); }
.btn-secondary          { background: var(--bg-elevated); color: var(--txt-secondary); border-color: var(--border); }
.btn-secondary:hover    { background: var(--bg-hover); color: var(--txt-primary); }
.btn-success            { background: var(--success-dark); color: #fff; }
.btn-success:hover      { background: var(--success-hover); }
.btn-danger             { background: var(--danger-dark); color: #fff; }
.btn-danger:hover       { background: var(--danger-dark); filter: brightness(1.15); }
.btn-warning            { background: var(--warning-dark); color: #fff; }
.btn-warning:hover      { background: var(--warning-dark); filter: brightness(1.15); }

/* Text-only action buttons */
.btn-link-primary { background: none; border: none; cursor: pointer; color: var(--accent); padding: 2px 4px; font-size: inherit; }
.btn-link-primary:hover { color: var(--accent-hover); text-decoration: underline; }
.btn-link-danger  { background: none; border: none; cursor: pointer; color: var(--danger); padding: 2px 4px; font-size: inherit; }
.btn-link-danger:hover  { color: var(--danger); text-decoration: underline; filter: brightness(1.2); }
.btn-link-muted   { background: none; border: none; cursor: pointer; color: var(--txt-dim); padding: 2px 4px; font-size: inherit; }
.btn-link-muted:hover   { color: var(--txt-muted); }


/* ══════════════════════════════════════════════════════════════
   FORM INPUTS
   ══════════════════════════════════════════════════════════════ */
.input,
input[type="text"], input[type="number"], input[type="date"],
input[type="time"], input[type="email"], input[type="password"],
input[type="month"], input[type="search"],
select, textarea {
  width: 100%;
  background: var(--bg-body) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--txt-primary) !important;
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  font-family: inherit;
  line-height: 1.4;
  min-height: var(--input-height);
}
.input:focus,
input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56,139,253,0.18);
}
select option   { background: var(--bg-surface); color: var(--txt-primary); }
::placeholder   { color: var(--txt-dim) !important; }
select          { cursor: pointer; padding-right: 28px; }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
textarea        { resize: vertical; min-height: 70px; }

.label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--txt-muted);
  margin-bottom: 6px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}


/* ══════════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════════ */
.tabla { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

.tabla thead th {
  background: var(--bg-elevated);
  color: var(--txt-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 11px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.tabla tbody tr              { border-bottom: 1px solid var(--border-muted); transition: background var(--transition); }
.tabla tbody tr:hover        { background: var(--bg-hover); }
.tabla tbody td              { padding: 12px 18px; color: var(--txt-secondary); vertical-align: middle; }
.tabla tbody tr:last-child   { border-bottom: none; }
.tabla tfoot td              { padding: 14px 18px; }

/* Clickable rows */
.tabla tbody tr.clickable    { cursor: pointer; }
.tabla tbody tr.clickable:hover { background: var(--accent-subtle); }


/* ══════════════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}
.badge::before { content: '●'; font-size: 0.5rem; opacity: 0.85; }

.badge-pendiente { background: var(--badge-pendiente-bg); color: var(--warning);  border: 1px solid var(--badge-pendiente-border); }
.badge-en_curso  { background: var(--badge-en-curso-bg); color: var(--accent);   border: 1px solid var(--badge-en-curso-border); }
.badge-cerrada   { background: var(--badge-cerrada-bg); color: var(--success);  border: 1px solid var(--badge-cerrada-border); }
.badge-entregado { background: var(--badge-cerrada-bg); color: var(--success);  border: 1px solid var(--badge-cerrada-border); }
.badge-facturado { background: var(--bg-elevated); color: var(--txt-dim); border: 1px solid var(--border); }
.badge-activo    { background: var(--badge-cerrada-bg); color: var(--success);  border: 1px solid var(--badge-cerrada-border); }
.badge-inactivo  { background: var(--bg-elevated); color: var(--txt-dim); border: 1px solid var(--border-muted); }
.badge-mant      { background: var(--badge-en-curso-bg); color: var(--accent);   border: 1px solid var(--badge-en-curso-border); }
.badge-vencido   { background: var(--badge-vencido-bg); color: var(--danger);   border: 1px solid var(--badge-vencido-border); }


/* ══════════════════════════════════════════════════════════════
   TYPOGRAPHY & SECTION TITLES
   ══════════════════════════════════════════════════════════════ */
.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--txt-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.page-title      { font-size: 1.5rem; font-weight: 700; color: var(--txt-primary); margin: 0; line-height: 1.3; }
.page-title-mono { font-size: 1.5rem; font-weight: 700; font-family: monospace; color: var(--accent); margin: 0; }
.page-subtitle   { color: var(--txt-muted); font-size: 0.88rem; margin-top: 4px; }

.code {
  font-family: 'Cascadia Code', 'Fira Code', 'SF Mono', Consolas, monospace;
  font-weight: 700;
  color: var(--accent);
}


/* ══════════════════════════════════════════════════════════════
   PAGE LAYOUT
   ══════════════════════════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header-left  { display: flex; align-items: center; gap: 16px; }
.page-header-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.detail-layout      { display: grid; grid-template-columns: 300px 1fr;  gap: 24px; align-items: start; }
.detail-layout-wide { display: grid; grid-template-columns: 1fr 400px;  gap: 24px; align-items: start; }
.detail-layout-sym  { display: grid; grid-template-columns: 1fr 360px;  gap: 24px; align-items: start; }

.sidebar-col { display: flex; flex-direction: column; gap: 16px; }
.main-col    { display: flex; flex-direction: column; gap: 20px; }
.sticky-top  { position: sticky; top: 80px; }


/* ══════════════════════════════════════════════════════════════
   COMPONENTS
   ══════════════════════════════════════════════════════════════ */

/* Empty state */
.empty-state { padding: 48px 24px; text-align: center; color: var(--txt-dim); font-size: 0.9rem; }

/* Stat row */
.stat-row            { display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; }
.stat-row + .stat-row { margin-top: 10px; }
.stat-row-sep        { border-top: 1px solid var(--border-muted); padding-top: 10px; margin-top: 4px; }

/* Work part card */
.parte-card {
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}
.parte-card + .parte-card { margin-top: 12px; }
.parte-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }

/* Stats bar (inside parte) */
.stats-bar {
  display: flex; gap: 24px; flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--bg-body);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.stats-bar-label {
  display: block;
  font-size: 0.7rem; color: var(--txt-muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.stats-bar-value { display: block; font-family: monospace; font-weight: 700; margin-top: 2px; font-size: 0.95rem; }

/* Agrupacion item */
.agrupacion-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px;
  background: var(--bg-body);
  border-radius: var(--radius);
  border: 1px solid var(--border-muted);
}

/* Informe card */
.informe-card { display: block; text-decoration: none; }
.informe-card:hover { text-decoration: none; }
.informe-card .card {
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.informe-card:hover .card {
  border-color: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.informe-card-icon  { font-size: 2rem; margin-bottom: 12px; line-height: 1; }
.informe-card-title { font-size: 1.05rem; font-weight: 700; color: var(--txt-primary); margin-bottom: 8px; }
.informe-card-desc  { color: var(--txt-muted); font-size: 0.88rem; line-height: 1.5; }

/* Selected device (in forms) */
.selected-device {
  background: var(--bg-body);
  border: 2px solid var(--accent-dark);
  border-radius: 10px;
  padding: 14px 18px;
}
.selected-device-label {
  font-size: 0.72rem; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px;
}

/* Counter input group (contadores) */
.counter-group        { text-align: center; }
.counter-group-code   { font-family: monospace; color: var(--accent); font-weight: 700; font-size: 0.88rem; display: block; }
.counter-group-name   { color: var(--txt-muted); font-size: 0.75rem; margin-bottom: 4px; display: block; }
.counter-group input  { text-align: right; font-family: monospace; font-size: 0.9rem; }

/* Lectura mini row */
.lectura-row { font-size: 0.85rem; border-bottom: 1px solid var(--border-muted); padding-bottom: 8px; }
.lectura-row:last-child { border-bottom: none; }

/* Toner color dots */
.toner-k { color: #adb5bd; }
.toner-c { color: var(--accent); }
.toner-m { color: var(--danger); }
.toner-y { color: var(--warning); }


/* ══════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ══════════════════════════════════════════════════════════════ */

/* --- Display --- */
.block        { display: block; }
.inline-block { display: inline-block; }
.inline       { display: inline; }
.hidden       { display: none; }
.contents     { display: contents; }

/* --- Flex --- */
.flex         { display: flex; }
.inline-flex  { display: inline-flex; }
.flex-col     { flex-direction: column; }
.flex-wrap    { flex-wrap: wrap; }
.flex-1       { flex: 1; }
.flex-shrink-0{ flex-shrink: 0; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.items-end    { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.justify-center  { justify-content: center; }
.self-end        { align-self: flex-end; }

/* --- Grid --- */
.grid          { display: grid; }
.grid-cols-1   { grid-template-columns: 1fr; }
.grid-cols-2   { grid-template-columns: 1fr 1fr; }
.grid-cols-3   { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4   { grid-template-columns: repeat(4, 1fr); }
.grid-cols-5   { grid-template-columns: repeat(5, 1fr); }
.grid-auto     { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.col-span-2    { grid-column: span 2; }
.col-span-3    { grid-column: span 3; }

/* Responsive aliases */
.lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.lg\:col-span-2  { grid-column: span 2; }
.md\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* --- Gap --- */
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }
.gap-6 { gap: 24px; }

/* --- Spacing --- */
.p-3  { padding: 12px; }
.p-4  { padding: 18px; }
.p-5  { padding: 22px; }
.p-6  { padding: 28px; }
.px-2 { padding-left: 8px;  padding-right: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 18px; padding-right: 18px; }
.py-3 { padding-top: 12px;  padding-bottom: 12px; }
.py-8 { padding-top: 32px;  padding-bottom: 32px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4  { margin-top: 16px; }
.mt-10 { margin-top: 40px; }
.gap-10{ gap: 40px; }

/* --- Widths --- */
.w-24   { width: 96px; }
.w-32   { width: 128px; }
.w-48   { width: 192px; }
.w-full { width: 100%; }

/* --- Max widths --- */
.max-w-3xl { max-width: 760px; }
.max-w-4xl { max-width: 900px; }

/* --- Overflow --- */
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }

/* --- Text sizes --- */
.text-xs   { font-size: 0.75rem; }
.text-sm   { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg   { font-size: 1.125rem; }
.text-xl   { font-size: 1.25rem; }
.text-2xl  { font-size: 1.5rem; }
.text-3xl  { font-size: 1.875rem; }

/* --- Font weight --- */
.font-normal    { font-weight: 400; }
.font-semibold  { font-weight: 600; }
.font-bold      { font-weight: 700; }
.font-extrabold { font-weight: 800; }

/* --- Font family --- */
.font-mono { font-family: 'Cascadia Code', 'Fira Code', 'SF Mono', Consolas, monospace; }

/* --- Text transform & spacing --- */
.uppercase     { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.025em; }

/* --- Text colors --- */
.text-white      { color: var(--txt-primary); }
.text-primary    { color: var(--txt-primary); }
.text-secondary  { color: var(--txt-secondary); }
.text-muted      { color: var(--txt-muted); }
.text-dim        { color: var(--txt-dim); }
.text-accent     { color: var(--accent); }
.text-success    { color: var(--success); }
.text-danger     { color: var(--danger); }
.text-warning    { color: var(--warning); }

/* Tailwind aliases */
.text-slate-200  { color: var(--txt-secondary); }
.text-slate-300  { color: #b1bac4; }
.text-slate-400  { color: var(--txt-muted); }
.text-slate-500  { color: var(--txt-dim); }
.text-blue-400   { color: var(--accent); }
.text-blue-300   { color: #79c0ff; }
.text-red-400    { color: #f85149; }
.text-red-300    { color: #ffa198; }
.text-green-400  { color: var(--success); }
.text-yellow-400 { color: var(--warning); }

.hover\:text-white:hover    { color: var(--txt-primary); }
.hover\:text-blue-300:hover { color: #79c0ff; }
.hover\:text-red-300:hover  { color: #ffa198; }

/* --- Background colors --- */
.bg-slate-700 { background-color: var(--bg-elevated); }

/* --- Text alignment --- */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-left   { text-align: left; }

/* --- White-space --- */
.whitespace-nowrap   { white-space: nowrap; }
.whitespace-pre-wrap { white-space: pre-wrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* --- Misc --- */
.resize-none    { resize: none; }
.cursor-pointer { cursor: pointer; }
.cursor-help    { cursor: help; }
.min-h-screen   { min-height: 100vh; }

/* --- Transition --- */
.transition-colors { transition: background-color var(--transition), color var(--transition); }

/* --- Space-y --- */
.space-y-2 > * + * { margin-top: 8px; }
.space-y-4 > * + * { margin-top: 16px; }
.space-y-6 > * + * { margin-top: 24px; }

/* --- Divide --- */
.divide-y > * + *          { border-top: 1px solid var(--border); }
.divide-slate-700 > * + *  { border-top: 1px solid var(--border); }

/* --- Hover backgrounds --- */
.hover\:bg-slate-700\/50:hover { background-color: var(--hover-slate); }


/* ══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed; top: 68px; right: 24px; z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 12px 20px; border-radius: var(--radius);
  font-size: 0.88rem; font-weight: 500;
  box-shadow: 0 4px 20px var(--toast-shadow);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 3.5s forwards;
  max-width: 400px;
}
.toast-success { background: var(--success-dark); color: #fff; border-left: 4px solid var(--success); }
.toast-error   { background: var(--toast-error-bg); color: var(--danger); border-left: 4px solid var(--danger); }
.toast-warning { background: var(--toast-warning-bg); color: var(--warning); border-left: 4px solid var(--warning); }
.toast-info    { background: var(--bg-elevated); color: var(--accent); border-left: 4px solid var(--accent); }
@keyframes toastIn  { from { opacity:0; transform:translateX(40px); } to { opacity:1; transform:translateX(0); } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; transform:translateY(-10px); } }

/* ══════════════════════════════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════════════════════════════ */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  padding: 20px 0;
}
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 10px;
  border-radius: var(--radius); font-size: 0.85rem; font-weight: 500;
  text-decoration: none; transition: all var(--transition);
}
.pagination a { color: var(--txt-muted); background: var(--bg-elevated); }
.pagination a:hover { color: var(--txt-primary); background: var(--bg-hover); }
.pagination .active { background: var(--accent-dark); color: #fff; pointer-events: none; }
.pagination .disabled { color: var(--txt-dim); pointer-events: none; opacity: 0.4; }
.pagination .info { color: var(--txt-dim); font-size: 0.82rem; margin: 0 8px; }

/* ══════════════════════════════════════════════════════════════
   COLLAPSIBLE SECTIONS
   ══════════════════════════════════════════════════════════════ */
.collapsible-header {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; padding: 10px 0; user-select: none;
  font-size: 0.85rem; font-weight: 600; color: var(--txt-muted);
}
.collapsible-header:hover { color: var(--txt-secondary); }
.collapsible-header::after {
  content: '▸'; font-size: 0.8rem; color: var(--txt-dim);
  transition: transform 0.2s;
}
.collapsible-header.open::after { transform: rotate(90deg); }
.collapsible-header .chevron {
  transition: transform 0.2s; font-size: 0.8rem; color: var(--txt-dim);
}
.collapsible-header.open .chevron { transform: rotate(90deg); }
.collapsible-body { display: none; }
.collapsible-body.open { display: block; }

/* ══════════════════════════════════════════════════════════════
   KPI CARDS
   ══════════════════════════════════════════════════════════════ */
.card.p-4.text-center,
a.card.p-4.text-center {
  transition: border-color var(--transition), transform var(--transition);
}
a.card:hover {
  border-color: var(--accent-dark);
  transform: translateY(-1px);
  text-decoration: none;
}

/* ══════════════════════════════════════════════════════════════
   THEME SELECTOR
   ══════════════════════════════════════════════════════════════ */
.theme-selector {
  position: relative;
}
.theme-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--txt-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: var(--radius);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  white-space: nowrap;
}
.theme-btn:hover {
  background: var(--bg-elevated);
  color: var(--txt-primary);
  border-color: var(--border-focus);
}
.theme-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: none;
  overflow: hidden;
}
.theme-dropdown.visible { display: block; }
.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--txt-secondary);
  cursor: pointer;
  transition: background var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.theme-option:hover { background: var(--bg-hover); color: var(--txt-primary); }
.theme-option.active { color: var(--accent); font-weight: 700; }
.theme-option-icon { font-size: 1rem; width: 20px; text-align: center; }
.theme-option-label { flex: 1; }
.theme-option-check { font-size: 0.7rem; color: var(--accent); }

/* Tema claro: ajustes especificos para contraste de botones */
[data-theme="light"] .toast-success { color: #fff; }
[data-theme="light"] .btn-primary { color: #fff; }
[data-theme="light"] .btn-success { color: #fff; }
[data-theme="light"] .btn-danger { color: #fff; }
[data-theme="light"] .btn-warning { color: #fff; }
[data-theme="light"] .topbar-user-avatar { color: #fff; }
[data-theme="light"] .pagination .active { color: #fff; }

/* ══════════════════════════════════════════════════════════════
   PRINT STYLES
   ══════════════════════════════════════════════════════════════ */
@media print {
  .no-print, .sidebar, .topbar { display: none !important; }
  .app-main { margin-left: 0 !important; }
  body    { background: white !important; color: black !important; }
  .card   { border: 1px solid #ccc !important; background: white !important; box-shadow: none !important; }
  .main-content { padding: 0 !important; max-width: 100% !important; }
  .print-alb { display: block !important; }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .detail-layout      { grid-template-columns: 260px 1fr; gap: 16px; }
  .detail-layout-wide { grid-template-columns: 1fr 340px; gap: 16px; }
  .main-content       { padding: 20px; }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .app-main { margin-left: 0; }
  .detail-layout,
  .detail-layout-wide,
  .detail-layout-sym { grid-template-columns: 1fr; }
  .main-content { padding: 16px; }
}
