/* ════════════════════════════════════════════════════════
   GestiónEMP — Hoja de estilos principal
   ════════════════════════════════════════════════════════ */

/* ── Reset & box model ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { max-width: 100%; }
button { cursor: pointer; border: none; background: none; }
a { text-decoration: none; }
ul, ol { list-style: none; }

/* ── Tokens de diseño — tema claro ─────────────────────── */
:root {
  --sidebar-w: 240px;
  --topbar-h: 56px;

  /* Paleta primaria */
  --color-primary:       #4F46E5;
  --color-primary-hover: #4338CA;
  --color-primary-light: #EEF2FF;

  /* Fondos */
  --bg-app:     #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-surface2: #F1F5F9;
  --bg-sidebar: #111827;
  --bg-sidebar-hover: rgba(255,255,255,.07);
  --bg-sidebar-active: rgba(255,255,255,.13);

  /* Texto */
  --text-primary:   #0F172A;
  --text-secondary: #475569;
  --text-muted:     #94A3B8;
  --text-sidebar:   #CBD5E1;
  --text-sidebar-active: #FFFFFF;

  /* Bordes */
  --border:        #E2E8F0;
  --border-strong: #CBD5E1;

  /* Radios */
  --r: 8px;
  --r-lg: 12px;
  --r-full: 9999px;

  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);

  /* Estados */
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-danger:  #EF4444;
  --color-info:    #3B82F6;

  /* Tipografía */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', Consolas, monospace;
  --text-xs:  11px;
  --text-sm:  13px;
  --text-base: 14px;
  --text-lg:  16px;
  --text-xl:  20px;
  --text-2xl: 24px;
}

/* ── Tema oscuro ───────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-app:      #0B0F1A;
    --bg-surface:  #141927;
    --bg-surface2: #1E2535;
    --bg-sidebar:  #0B0F1A;
    --text-primary:   #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted:     #64748B;
    --border:        #1E293B;
    --border-strong: #334155;
    --color-primary-light: #1E1B4B;
  }
}
:root[data-theme="dark"] {
  --bg-app:      #0B0F1A;
  --bg-surface:  #141927;
  --bg-surface2: #1E2535;
  --bg-sidebar:  #0B0F1A;
  --text-primary:   #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted:     #64748B;
  --border:        #1E293B;
  --border-strong: #334155;
  --color-primary-light: #1E1B4B;
}

/* ── Base ──────────────────────────────────────────────── */
html { font-size: 14px; }
body {
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-app);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Layout principal ──────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.main-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-w);
  transition: margin-left .2s;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  transition: transform .25s;
}

.sidebar-header {
  padding: 18px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}
.sidebar-brand-icon {
  width: 30px; height: 30px;
  background: var(--color-primary);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 0;
  display: flex;
  flex-direction: column;
}
.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-section-bottom { margin-top: auto; padding-bottom: 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--text-sidebar);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--bg-sidebar-hover); color: #fff; }
.nav-item.active { background: var(--bg-sidebar-active); color: var(--text-sidebar-active); }
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user-avatar {
  width: 28px; height: 28px;
  background: var(--color-primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff;
  flex-shrink: 0;
}
.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar-username  { font-size: 12px; font-weight: 600; color: #fff; truncate; overflow: hidden; white-space: nowrap; }
.sidebar-role      { font-size: 11px; color: var(--text-muted); }

.sidebar-actions {
  display: flex;
  gap: 4px;
}
.icon-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  color: var(--text-sidebar);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg-sidebar-hover); color: #fff; }

/* Icono luna/sol según tema */
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun  { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun  { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* ── Top bar ───────────────────────────────────────────── */
.top-bar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.menu-toggle          { display: none; color: var(--text-secondary); }
.search-toggle        { display: none; color: var(--text-secondary); }
.search-close         { display: none; color: var(--text-muted); }
.topbar-mobile-brand  { display: none; }

.global-search {
  flex: 1;
  max-width: 460px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 12px;
  height: 36px;
  transition: border-color .15s;
}
.global-search:focus-within { border-color: var(--color-primary); }
.global-search .search-icon { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.global-search input {
  flex: 1; border: none; background: none;
  font-size: var(--text-sm); color: var(--text-primary);
  outline: none;
}
.global-search input::placeholder { color: var(--text-muted); }

.top-bar-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* ── Content area ──────────────────────────────────────── */
.content-area {
  flex: 1;
  padding: 24px;
  max-width: 1280px;
  width: 100%;
}

/* ── Flash messages ────────────────────────────────────── */
/* ── Toast notifications ────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
  max-width: min(380px, calc(100vw - 32px));
}
.toast {
  pointer-events: all;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px 14px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: 0 4px 20px rgba(0,0,0,.12);
  font-size: var(--text-sm); font-weight: 500;
  position: relative; overflow: hidden;
  animation: toastIn .3s cubic-bezier(.34,1.56,.64,1) both;
}
.toast-hiding { animation: toastOut .3s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform: translateX(40px) scale(.95) } to { opacity:1; transform:none } }
@keyframes toastOut { to   { opacity:0; transform: translateX(40px) scale(.95) } }

.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast-msg  { flex: 1; line-height: 1.5; }
.toast-close { flex-shrink: 0; opacity: .5; padding: 2px; margin-top: -1px; }
.toast-close:hover { opacity: 1; }

.toast-progress {
  position: absolute; bottom: 0; left: 0; height: 3px;
  width: 100%; transform-origin: left;
}
.toast-progress-running {
  animation: toastTimer linear forwards;
}
@keyframes toastTimer { from { transform: scaleX(1) } to { transform: scaleX(0) } }

.toast-success .toast-icon { color: #10b981; }
.toast-success .toast-progress { background: #10b981; }
.toast-error   .toast-icon { color: #ef4444; }
.toast-error   .toast-progress { background: #ef4444; }
.toast-warning .toast-icon { color: #f59e0b; }
.toast-warning .toast-progress { background: #f59e0b; }
.toast-info    .toast-icon { color: var(--accent); }
.toast-info    .toast-progress { background: var(--accent); }

[data-theme="dark"] .toast { box-shadow: 0 4px 20px rgba(0,0,0,.4); }

/* ── Page header ───────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-title   { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -.4px; line-height: 1.2; }
.page-subtitle { font-size: var(--text-sm); color: var(--text-muted); margin-top: 2px; }
.page-actions  { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ── Breadcrumb ────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: 16px;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--color-primary); }
.bc-sep { color: var(--text-muted); opacity: .5; }

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: var(--text-base); font-weight: 600; }
.card-link  { font-size: var(--text-sm); color: var(--color-primary); }
.card-link:hover { text-decoration: underline; }
.card-body  { padding: 16px 18px; }
.card-body.p-0 { padding: 0; }
.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface2);
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-ghost    { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover  { background: var(--bg-surface2); border-color: var(--border-strong); }
.btn-danger   { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-sm       { padding: 6px 10px; font-size: 12px; }
.btn-block    { width: 100%; justify-content: center; margin-bottom: 6px; }
.btn-icon     { width: 15px; height: 15px; flex-shrink: 0; }

/* ── Forms ─────────────────────────────────────────────── */
.form-layout { max-width: 820px; }
.form-group  { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.form-row    { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-label  { font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary); }
.req         { color: var(--color-danger); }
.form-control {
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: var(--text-sm);
  color: var(--text-primary);
  font-family: var(--font);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  width: 100%;
}
.form-control:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.form-control::placeholder { color: var(--text-muted); }
.form-textarea    { resize: vertical; min-height: 100px; }
.form-textarea-lg { min-height: 200px; }
.form-hint  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.form-submit-bar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 20px 0;
}

/* Formulario inline (admin) */
.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.inline-form.hidden { display: none; }
.form-control-sm {
  padding: 6px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: var(--text-sm);
  color: var(--text-primary);
  font-family: var(--font);
  outline: none;
}
.form-control-sm:focus { border-color: var(--color-primary); }
.form-select-sm {
  padding: 6px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: var(--text-sm);
  color: var(--text-primary);
  font-family: var(--font);
  outline: none;
  cursor: pointer;
}
.form-select-sm:focus { border-color: var(--color-primary); }
.form-input-sm {
  padding: 6px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: var(--text-sm);
  color: var(--text-primary);
  font-family: var(--font);
  outline: none;
  max-width: 160px;
}
.color-input {
  width: 36px; height: 32px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  background: var(--bg-surface);
}
.form-check { flex-direction: row; align-items: center; gap: 8px; }
.check-input { width: 16px; height: 16px; accent-color: var(--color-primary); cursor: pointer; }
.check-label { font-size: var(--text-sm); color: var(--text-secondary); cursor: pointer; }

/* ── Tables ────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table-row-link { cursor: pointer; transition: background .1s; }
.table-row-link:hover td { background: var(--bg-surface2); }
.table-title { font-weight: 500; color: var(--text-primary); }
.table-title:hover { color: var(--color-primary); }
.td-type  { width: 140px; }
.td-date  { width: 110px; }
.td-badge { width: 100px; white-space: nowrap; }
.td-actions { width: 90px; text-align: right; white-space: nowrap; }

/* ── Filter bar ────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 12px;
  height: 36px;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
  transition: border-color .15s;
}
.search-box:focus-within { border-color: var(--color-primary); }
.search-icon { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }
.search-input {
  flex: 1; border: none; background: none;
  font-size: var(--text-sm); color: var(--text-primary);
  outline: none;
}

/* ── Action buttons (en tabla) ─────────────────────────── */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: background .15s, color .15s;
  font-size: 12px;
}
.action-btn:hover { background: var(--bg-surface2); color: var(--text-primary); }
.action-btn-danger:hover { background: #FEF2F2; color: var(--color-danger); }
[data-theme="dark"] .action-btn-danger:hover { background: #2d0a0a; color: #fca5a5; }

/* ── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-neutral   { background: var(--bg-surface2); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-role-admin { background: #EDE9FE; color: #5B21B6; }
[data-theme="dark"] .badge-role-admin { background: #2e1065; color: #c4b5fd; }

/* Estado */
.badge-status-borrador  { background: #F3F4F6; color: #6B7280; }
.badge-status-activo    { background: #ECFDF5; color: #065F46; }
.badge-status-pendiente { background: #FFFBEB; color: #92400E; }
.badge-status-resuelto  { background: #EDE9FE; color: #5B21B6; }
.badge-status-cerrado   { background: #F9FAFB; color: #374151; }
.badge-status-archivado { background: #F3F4F6; color: #9CA3AF; }
[data-theme="dark"] .badge-status-activo    { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge-status-pendiente { background: #431407; color: #fcd34d; }
[data-theme="dark"] .badge-status-resuelto  { background: #2e1065; color: #c4b5fd; }
[data-theme="dark"] .badge-status-cerrado   { background: #1f2937; color: #9ca3af; }

/* Prioridad */
.badge-priority-baja    { background: #ECFDF5; color: #065F46; }
.badge-priority-normal  { background: #EEF2FF; color: #3730A3; }
.badge-priority-alta    { background: #FFFBEB; color: #92400E; }
.badge-priority-urgente { background: #FEF2F2; color: #991B1B; }
[data-theme="dark"] .badge-priority-baja    { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge-priority-normal  { background: #1e1b4b; color: #a5b4fc; }
[data-theme="dark"] .badge-priority-alta    { background: #431407; color: #fcd34d; }
[data-theme="dark"] .badge-priority-urgente { background: #2d0a0a; color: #fca5a5; }

/* Type badge */
.type-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.type-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.type-dot-lg {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Stats dashboard ───────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon-blue   { background: #DBEAFE; color: #1D4ED8; }
.stat-icon-indigo { background: #EDE9FE; color: #4F46E5; }
.stat-icon-amber  { background: #FEF3C7; color: #D97706; }
.stat-icon-red    { background: #FEE2E2; color: #DC2626; }
[data-theme="dark"] .stat-icon-blue   { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .stat-icon-indigo { background: #2e1065; color: #c4b5fd; }
[data-theme="dark"] .stat-icon-amber  { background: #451a03; color: #fcd34d; }
[data-theme="dark"] .stat-icon-red    { background: #450a0a; color: #fca5a5; }
.stat-body   { flex: 1; }
.stat-value  { font-size: 28px; font-weight: 700; line-height: 1; letter-spacing: -.5px; }
.stat-label  { font-size: var(--text-sm); color: var(--text-muted); margin-top: 2px; }
.stat-link   { position: absolute; bottom: 12px; right: 14px; font-size: 12px; color: var(--color-primary); }
.stat-link:hover { text-decoration: underline; }

/* ── Dashboard grid ────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
}
.dashboard-side { display: flex; flex-direction: column; gap: 20px; }

/* Pending / client / activity items */
.pending-item {
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}
.pending-item:last-child { border-bottom: none; }
.pending-title { font-weight: 500; color: var(--text-primary); font-size: var(--text-sm); }
.pending-title:hover { color: var(--color-primary); }
.pending-meta  { width: 100%; font-size: 12px; margin-top: 2px; }

.client-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
}
.client-item:last-child { border-bottom: none; }
.client-avatar  { width: 32px; height: 32px; border-radius: 50%; background: var(--color-primary); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: #fff; flex-shrink: 0; }
.client-info    { flex: 1; min-width: 0; }
.client-name    { font-weight: 500; color: var(--text-primary); font-size: var(--text-sm); }
.client-name:hover { color: var(--color-primary); }

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--bg-surface2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--text-secondary); flex-shrink: 0; margin-top: 1px; }
.activity-body  { flex: 1; font-size: var(--text-sm); line-height: 1.4; }
.activity-user  { font-weight: 600; }
.activity-action { color: var(--text-secondary); margin: 0 3px; }
.activity-entity { color: var(--text-muted); }
.activity-time  { white-space: nowrap; flex-shrink: 0; }

/* ── Detail layout ─────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}
.detail-main { min-width: 0; }
.detail-side { display: flex; flex-direction: column; }

/* Detalles del documento */
.doc-header-meta { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.doc-meta-line { display: flex; gap: 14px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.doc-meta-line svg { vertical-align: middle; }

.observations-block {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  font-family: var(--font);
}

/* Definition list */
.definition-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: var(--text-sm); }
.definition-list dt { color: var(--text-muted); font-weight: 500; white-space: nowrap; padding-top: 2px; }
.definition-list dd { color: var(--text-primary); }
.definition-list a  { color: var(--color-primary); }
.definition-list a:hover { text-decoration: underline; }

/* Notes */
.notes-block { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.notes-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.notes-text  { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.6; white-space: pre-wrap; }

/* Type stats */
.type-stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.type-stat-name { flex: 1; font-size: var(--text-sm); }

/* ── Timeline ──────────────────────────────────────────── */
.timeline { padding: 8px 0; }
.timeline-item {
  display: flex;
  gap: 14px;
  padding: 12px 18px;
  position: relative;
}
.timeline-item + .timeline-item::before {
  content: '';
  position: absolute;
  top: 0; left: 28px;
  width: 1px;
  height: 12px;
  background: var(--border);
}
.timeline-marker {
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.timeline-content { flex: 1; min-width: 0; }
.timeline-date    { margin-bottom: 4px; }
.timeline-body    { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.timeline-title   { font-weight: 500; color: var(--text-primary); font-size: var(--text-sm); }
.timeline-title:hover { color: var(--color-primary); }
.timeline-badges  { display: flex; gap: 4px; flex-wrap: wrap; }

/* ── Tags ──────────────────────────────────────────────── */
.tags-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid;
  white-space: nowrap;
}
.tags-checkbox-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-checkbox { cursor: pointer; }
.tag-checkbox input { position: absolute; opacity: 0; width: 0; height: 0; }
.tag-checkbox .tag-chip { transition: opacity .15s; }
.tag-checkbox input:not(:checked) + .tag-chip { opacity: .5; }

/* ── Type grid (admin) ─────────────────────────────────── */
.type-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.type-item { display: flex; align-items: center; gap: 6px; }
.type-name { font-size: var(--text-sm); }

/* ── Client detail ─────────────────────────────────────── */
.client-avatar-lg {
  width: 52px; height: 52px;
  border-radius: 12px;
  background: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.client-avatar-sm {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff;
  flex-shrink: 0;
}

/* ── Empty states ──────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-icon { color: var(--border-strong); margin-bottom: 16px; }
.empty-state h3 { font-size: var(--text-lg); margin-bottom: 8px; }
.empty-state p  { color: var(--text-muted); margin-bottom: 20px; }
.empty-state-sm {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.empty-state-sm p { margin-bottom: 10px; }

/* ── Pagination ────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; align-items: center; margin-top: 20px; justify-content: center; }
.page-btn {
  display: flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 8px;
  border-radius: var(--r);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  transition: background .1s, border-color .1s;
}
.page-btn:hover { background: var(--bg-surface2); }
.page-btn-active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.page-ellipsis { padding: 0 4px; color: var(--text-muted); }

/* ── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity:0; transform: scale(.95) } to { opacity:1; transform:none } }
.modal-title   { font-size: var(--text-lg); font-weight: 600; margin-bottom: 10px; }
.modal-body    { color: var(--text-secondary); font-size: var(--text-sm); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ── Sidebar overlay (móvil) ───────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 90;
}

/* ── Danger zone ───────────────────────────────────────── */
.danger-zone { border-color: #FCA5A5; }
[data-theme="dark"] .danger-zone { border-color: #7f1d1d; }

/* ── Login ─────────────────────────────────────────────── */
.login-body { background: var(--bg-app); display: flex; flex-direction: column; min-height: 100vh; align-items: center; justify-content: center; padding: 20px; }
.login-container { width: 100%; max-width: 380px; }
.login-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 36px 32px; box-shadow: var(--shadow-md); }
.login-header { text-align: center; margin-bottom: 28px; }
.login-logo { width: 48px; height: 48px; border-radius: 12px; background: var(--color-primary); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; color: #fff; margin: 0 auto 14px; }
.login-title { font-size: 20px; font-weight: 700; }
.login-subtitle { font-size: var(--text-sm); color: var(--text-muted); margin-top: 4px; }
.btn-block { display: flex; width: 100%; justify-content: center; }
.login-footer { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 16px; }

.alert { padding: 10px 14px; border-radius: var(--r); font-size: var(--text-sm); }
.alert-error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FCA5A5; }
.alert-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }

/* ── Helpers ───────────────────────────────────────────── */
.text-sm     { font-size: var(--text-sm); }
.text-xs     { font-size: var(--text-xs); }
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--color-danger); }
.text-primary-color { color: var(--color-primary); }
.flex-cell   { display: flex; align-items: center; gap: 10px; }
.gap-md      { gap: 14px; }
.mr-2        { margin-right: 6px; }
.link        { color: var(--color-primary); }
.link:hover  { text-decoration: underline; }
.link-subtle { color: inherit; }
.link-subtle:hover { color: var(--color-primary); }
.hidden      { display: none !important; }
.action-list { display: flex; flex-direction: column; gap: 0; }

/* ── Relations ─────────────────────────────────────────── */
.relations-list { display: flex; flex-direction: column; gap: 8px; }
.relation-item {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px;
  padding: 10px 12px; background: var(--bg-2); border-radius: var(--radius);
  position: relative;
}
.relation-meta { display: flex; align-items: center; gap: 6px; width: 100%; }
.relation-type-label { font-size: 0.75rem; color: var(--text-muted); font-style: italic; }
.relation-title { font-weight: 500; color: var(--text); text-decoration: none; flex: 1 1 100%; }
.relation-title:hover { color: var(--accent); }
.relation-notes { font-size: 0.8rem; flex: 1 1 100%; }
.relation-remove { position: absolute; top: 8px; right: 8px; }
.type-badge-xs { font-size: 0.7rem; padding: 1px 6px; border-radius: 4px; }

/* Modal relaciones */
.modal-lg { max-width: 560px; width: 95%; }
.relation-search-results {
  max-height: 220px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-top: 6px;
}
.relation-result-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.relation-result-item:last-child { border-bottom: none; }
.relation-result-item:hover,
.relation-result-item.selected { background: var(--accent-bg); }
.relation-result-title { font-weight: 500; }
.relation-selected-doc {
  background: var(--accent-bg); border-radius: var(--radius);
  padding: 8px 12px; margin-top: 8px;
  display: flex; align-items: center; gap: 8px;
}

/* ── Search page ────────────────────────────────────────── */
.search-page-form { margin-bottom: 24px; }
.search-box-lg { max-width: 700px; display: flex; align-items: center; gap: 8px; }
.search-box-lg .search-input { flex: 1; font-size: 1rem; }
.search-hints { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.hint-chip {
  font-size: 0.8rem; padding: 3px 10px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 20px; color: var(--text-muted);
}
.hint-chip-link {
  font-size: 0.8rem; padding: 3px 10px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 20px; color: var(--text-muted);
  text-decoration: none; transition: background .15s;
}
.hint-chip-link:hover { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }

.parse-result {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 14px; background: var(--accent-bg);
  border: 1px solid var(--accent); border-radius: var(--radius);
  margin-bottom: 20px; font-size: 0.85rem;
}
.parse-label { color: var(--text-muted); }
.parse-token {
  padding: 2px 8px; border-radius: 12px; font-size: 0.8rem; font-weight: 500;
}
.parse-type     { background: #6366f122; color: #6366f1; }
.parse-status   { background: #10b98122; color: #10b981; }
.parse-priority { background: #f59e0b22; color: #f59e0b; }
.parse-client   { background: #3b82f622; color: #3b82f6; }
.parse-date     { background: #8b5cf622; color: #8b5cf6; }
.parse-text     { background: var(--bg-3); color: var(--text-muted); }

.search-results-grid {
  display: grid; grid-template-columns: 1fr 280px; gap: 24px; align-items: start;
}
.results-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.results-section-title {
  font-size: 1rem; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.results-list { display: flex; flex-direction: column; gap: 8px; }
.result-card {
  display: block; text-decoration: none; color: var(--text);
  padding: 12px 14px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); transition: border-color .15s, box-shadow .15s;
}
.result-card:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.result-card-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.result-date { margin-left: auto; }
.result-card-title { font-weight: 600; margin-bottom: 4px; }
.result-card-meta { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.result-card-excerpt { line-height: 1.5; }
.result-card-client { align-items: center; }
.flex-cell { display: flex; align-items: center; gap: 10px; }

.search-welcome {
  text-align: center; padding: 60px 24px; max-width: 600px; margin: 0 auto;
}
.search-welcome-icon { margin-bottom: 16px; color: var(--text-muted); }
.search-welcome h2 { margin-bottom: 8px; }
.search-examples { margin-top: 32px; display: flex; flex-direction: column; gap: 16px; text-align: left; }
.example-group { }
.example-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.example-chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Custom fields admin ────────────────────────────────── */
.cf-type-section { margin-bottom: 16px; }
.cf-type-header {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); margin-bottom: 8px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }

@media (max-width: 900px) {
  .search-results-grid { grid-template-columns: 1fr; }
}

/* ── Analysis panel ─────────────────────────────────────── */
.analysis-alerts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.analysis-alert {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 8px 10px; border-radius: var(--radius); font-size: 0.82rem;
  border-left: 3px solid transparent;
}
.analysis-alert svg { flex-shrink: 0; }
.analysis-alert-danger  { background: #ef444418; border-color: #ef4444; color: #ef4444; }
.analysis-alert-warning { background: #f59e0b18; border-color: #f59e0b; color: #b45309; }
.analysis-alert-info    { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }

[data-theme="dark"] .analysis-alert-warning { color: #fbbf24; }

.analysis-section { margin-bottom: 12px; }
.analysis-label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); margin-bottom: 6px;
}
.analysis-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.analysis-chip {
  font-size: 0.78rem; padding: 2px 8px; border-radius: 12px;
  background: var(--bg-3); color: var(--text-muted);
  border: 1px solid var(--border);
}

.analysis-entity-row {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 0.82rem; margin-bottom: 5px; flex-wrap: wrap;
}
.analysis-entity-label {
  flex-shrink: 0; min-width: 72px; color: var(--text-muted);
  font-size: 0.78rem;
}
.analysis-entity-value {
  background: var(--bg-2); padding: 1px 6px; border-radius: 4px;
  color: var(--text); text-decoration: none; font-family: monospace; font-size: 0.8rem;
}
a.analysis-entity-value:hover { color: var(--accent); }

.analysis-stats {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px;
}
.analysis-stat {
  font-size: 0.78rem; color: var(--text-muted);
  background: var(--bg-2); padding: 2px 8px; border-radius: 10px;
}
.analysis-stat-incident { color: #ef4444; background: #ef444418; }

.inline-suggestion-form { display: inline; }
.btn-xs {
  font-size: 0.75rem; padding: 2px 8px; height: auto; line-height: 1.6;
}

/* ── Attachments ─────────────────────────────────────────── */
.attachment-name { display: flex; align-items: center; gap: 8px; }
.attachment-ext {
  display: inline-block; min-width: 36px; text-align: center;
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  padding: 2px 5px; border-radius: 4px;
  background: var(--accent-bg); color: var(--accent);
  border: 1px solid var(--accent);
}
.upload-form { display: flex; align-items: center; gap: 10px; }
.upload-btn { cursor: pointer; }
.upload-hint { font-size: 0.78rem; }

/* ── Export / Backup ─────────────────────────────────────── */
.export-grid { display: flex; flex-wrap: wrap; gap: 24px; }
.export-group { display: flex; align-items: center; gap: 12px; }
.export-label { font-weight: 500; min-width: 70px; }
.export-actions { display: flex; gap: 8px; }

/* ── Audit badges ────────────────────────────────────────── */
.badge-audit-created  { background: #10b98118; color: #10b981; }
.badge-audit-updated  { background: #3b82f618; color: #3b82f6; }
.badge-audit-deleted  { background: #ef444418; color: #ef4444; }
.badge-audit-login    { background: #8b5cf618; color: #8b5cf6; }
.badge-audit-logout   { background: var(--bg-3); color: var(--text-muted); }
.badge-audit-upload   { background: #f59e0b18; color: #f59e0b; }
.badge-audit-backup   { background: #06b6d418; color: #06b6d4; }
.badge-audit-default  { background: var(--bg-3); color: var(--text-muted); }
[class^="badge-audit-"]:not(.badge-audit-created):not(.badge-audit-updated)
  :not(.badge-audit-deleted):not(.badge-audit-login):not(.badge-audit-logout)
  :not(.badge-audit-upload):not(.badge-audit-backup) {
  background: var(--bg-3); color: var(--text-muted);
}

/* ── Bottom navigation (móvil) ──────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-sidebar);
  border-top: 1px solid rgba(255,255,255,.07);
  z-index: 95;
  align-items: stretch;
}

.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: rgba(255,255,255,.4);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .01em;
  padding: 6px 2px;
  transition: color .15s;
  cursor: pointer;
  border: none;
  background: none;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.bnav-item:hover,
.bnav-item.bnav-active { color: #fff; }

.bnav-fab {
  flex: 1;
  position: relative;
  top: -12px;
  justify-content: flex-end;
  padding-bottom: 2px;
  gap: 0;
}
.bnav-fab-circle {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(79,70,229,.5);
  color: #fff;
  transition: transform .15s, box-shadow .15s;
}
.bnav-fab:active .bnav-fab-circle {
  transform: scale(.91);
  box-shadow: 0 2px 8px rgba(79,70,229,.3);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .dashboard-grid  { grid-template-columns: 1fr; }
  .detail-grid     { grid-template-columns: 1fr; }
  .detail-side     { order: -1; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  /* Sidebar */
  .sidebar {
    transform: translateX(-260px);
    width: 260px;
    box-shadow: none;
    transition: transform .25s, box-shadow .25s;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 6px 0 40px rgba(0,0,0,.3);
  }
  .sidebar-overlay.visible { display: block; }
  .main-wrapper { margin-left: 0; }
  .menu-toggle  { display: flex; }
  .hide-mobile  { display: none !important; }

  /* Top bar: marca centrada */
  .top-bar { padding: 0 8px; gap: 4px; }
  .topbar-mobile-brand {
    display: block;
    flex: 1;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.3px;
    color: var(--text-primary);
    pointer-events: none;
  }

  /* Búsqueda: oculta → overlay al abrir */
  .global-search { display: none; }
  .global-search.search-open {
    display: flex;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 200;
    height: var(--topbar-h);
    max-width: none;
    border-radius: 0;
    border: none;
    border-bottom: 2px solid var(--color-primary);
    padding: 0 10px;
    background: var(--bg-surface);
    box-shadow: var(--shadow-md);
    animation: searchExpand .18s ease;
  }
  @keyframes searchExpand {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
  }
  .search-toggle { display: flex; }
  .search-close  { display: flex; }
  .top-bar-actions .btn-ghost,
  .top-bar-actions .btn-primary { display: none; }

  /* Content: espacio para bottom nav */
  .content-area {
    padding: 12px;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  /* Bottom nav */
  .bottom-nav { display: flex; }

  /* Stats: 2 columnas compactas */
  .stats-grid     { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
  .stat-card      { padding: 12px; gap: 10px; }
  .stat-value     { font-size: 22px; }
  .stat-icon      { width: 34px; height: 34px; border-radius: 8px; }

  /* Formularios */
  .form-layout    { max-width: 100%; }
  .form-row       { grid-template-columns: 1fr; }
  .form-submit-bar {
    position: sticky;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-surface);
    padding: 10px 0;
    border-top: 1px solid var(--border);
    margin-top: 8px;
    z-index: 10;
  }

  /* Tablas: scroll horizontal */
  .card-body.p-0 { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table         { min-width: 520px; }

  /* Filter bar: scroll horizontal */
  .filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .filter-bar::-webkit-scrollbar { display: none; }
  .search-box     { min-width: 140px; max-width: 220px; }

  /* Page header */
  .page-header    { margin-bottom: 14px; }
  .page-title     { font-size: var(--text-xl); }

  /* Targets táctiles ≥ 40px */
  .nav-item       { min-height: 44px; }
  .btn            { min-height: 40px; }
  .btn-sm         { min-height: 36px; }
  .action-btn     { width: 36px; height: 36px; }
  .page-btn       { min-width: 40px; height: 40px; }
  .icon-btn       { width: 40px; height: 40px; }

  /* Modal: bottom-sheet */
  .modal-overlay  { align-items: flex-end; padding: 0; }
  .modal {
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    max-width: 100%;
    width: 100%;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    animation: modalSlideUp .22s ease;
  }
  @keyframes modalSlideUp {
    from { transform: translateY(100%); opacity: .8; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  /* Toast + back-to-top: encima del bottom nav */
  .toast-container { bottom: calc(66px + env(safe-area-inset-bottom, 0px)); right: 12px; left: 12px; }
  .back-to-top     { bottom: calc(70px + env(safe-area-inset-bottom, 0px)); right: 16px; }
  .card            { margin-bottom: 12px; }
}

@media (max-width: 480px) {
  html           { font-size: 15px; }
  .stats-grid    { gap: 8px; }
  .stat-value    { font-size: 20px; }
  .page-header   { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-actions  { display: flex; gap: 6px; width: 100%; }
  .page-actions .btn { flex: 1; justify-content: center; }
  .content-area  { padding: 10px; padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .card-header   { padding: 12px 14px 10px; }
  .card-body     { padding: 12px 14px; }
  .card-footer   { padding: 10px 14px; }
}

/* ── Sidebar nav badge ───────────────────────────────────── */
.nav-badge {
  margin-left: auto; min-width: 20px; height: 18px;
  padding: 0 5px; border-radius: 9px;
  font-size: 0.7rem; font-weight: 700; line-height: 18px; text-align: center;
  background: rgba(255,255,255,.18); color: rgba(255,255,255,.9);
  flex-shrink: 0;
}
.nav-badge-urgent {
  background: #ef4444; color: #fff;
  animation: pulse-badge 2s ease infinite;
}
@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50%       { opacity: .7; }
}

/* ── Back to top ─────────────────────────────────────────── */
.back-to-top {
  position: fixed; bottom: 90px; right: 24px; z-index: 900;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  transform: translateY(10px);
}
.back-to-top.visible { opacity: 1; pointer-events: all; transform: none; }
.back-to-top:hover { background: var(--accent-hover, var(--accent)); transform: translateY(-2px); }

/* ── Char counter ────────────────────────────────────────── */
.char-counter {
  margin-top: 5px; font-size: 0.75rem; text-align: right;
}

/* ── Textarea auto-grow ──────────────────────────────────── */
.form-textarea { resize: vertical; overflow: hidden; }

/* ── Content fade-in ─────────────────────────────────────── */
.content-area { animation: pageFadeIn .18s ease both; }
@keyframes pageFadeIn { from { opacity: .6 } to { opacity: 1 } }

/* ══════════════════════════════════════════════════════════
   EFECTOS VISUALES AVANZADOS — Vue 3 + micro-interacciones
   ══════════════════════════════════════════════════════════ */

/* ── Tokens de gradiente y glow ──────────────────────────── */
:root {
  --gradient-primary:      linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  --gradient-primary-soft: linear-gradient(135deg, rgba(79,70,229,.1) 0%, rgba(124,58,237,.07) 100%);
  --shadow-primary:        0 4px 16px rgba(79,70,229,.28);
  --shadow-primary-lg:     0 8px 30px rgba(79,70,229,.38);
  --glow-primary:          0 0 0 3px rgba(79,70,229,.14);
  --ease-bounce:           cubic-bezier(.34,1.56,.64,1);
  --ease-out-expo:         cubic-bezier(.16,1,.3,1);
}

/* ── Scrollbar personalizado ─────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Orbes de gradiente de fondo ─────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 5% 10%, rgba(79,70,229,.045) 0%, transparent 45%),
    radial-gradient(ellipse at 95% 90%, rgba(124,58,237,.04) 0%, transparent 45%);
  pointer-events: none;
  z-index: 0;
}
[data-theme="dark"] body::before,
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body::before {
    background:
      radial-gradient(ellipse at 5% 10%, rgba(79,70,229,.09) 0%, transparent 45%),
      radial-gradient(ellipse at 95% 90%, rgba(124,58,237,.08) 0%, transparent 45%);
  }
}

/* ── Sidebar: gradiente + marca mejorada ─────────────────── */
.sidebar {
  background: linear-gradient(175deg, #0d1117 0%, #111827 55%, #0c1526 100%);
  border-right: 1px solid rgba(255,255,255,.04);
}
.sidebar-brand-icon {
  background: var(--gradient-primary);
  box-shadow: 0 4px 14px rgba(79,70,229,.45);
  transition: transform .22s var(--ease-bounce), box-shadow .22s;
}
.sidebar-brand:hover .sidebar-brand-icon {
  transform: rotate(-8deg) scale(1.12);
  box-shadow: 0 6px 20px rgba(79,70,229,.6);
}

/* ── Nav item: indicador animado izquierda ───────────────── */
.nav-item {
  position: relative;
  overflow: hidden;
  transition: color .15s, background .15s;
}
.nav-item::before {
  content: '';
  position: absolute;
  left: 0; top: 18%; bottom: 18%;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--color-primary);
  opacity: 0;
  transform: scaleY(.3);
  transition: opacity .2s, transform .22s var(--ease-bounce);
  pointer-events: none;
}
.nav-item.active::before { opacity: 1; transform: scaleY(1); }
.nav-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 50%, rgba(255,255,255,.05) 0%, transparent 65%);
  opacity: 0;
  transition: opacity .18s;
  pointer-events: none;
}
.nav-item:hover::after { opacity: 1; }

/* ── Top-bar: glassmorphism ──────────────────────────────── */
.top-bar {
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  box-shadow: 0 1px 0 var(--border), 0 2px 16px rgba(0,0,0,.05);
}
[data-theme="dark"] .top-bar {
  background: rgba(13,17,23,.86);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .top-bar {
    background: rgba(13,17,23,.86);
  }
}

/* ── Botón primario: gradiente + glow ────────────────────── */
.btn-primary {
  background: var(--gradient-primary);
  box-shadow: var(--shadow-primary);
  border: none;
  transition: transform .18s var(--ease-bounce), box-shadow .18s, filter .18s;
}
.btn-primary:hover {
  box-shadow: var(--shadow-primary-lg);
  transform: translateY(-2px);
  filter: brightness(1.06);
}
.btn-primary:active {
  transform: translateY(0) scale(.97);
  box-shadow: 0 2px 8px rgba(79,70,229,.22);
  filter: brightness(.97);
}
.btn-primary:focus-visible { box-shadow: var(--glow-primary); }

/* ── Ripple CSS ──────────────────────────────────────────── */
@keyframes ripple-expand {
  to { transform: scale(4); opacity: 0; }
}
.ripple-dot {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: ripple-expand .55s var(--ease-out-expo) forwards;
  pointer-events: none;
}

/* ── Cards: hover lift + borde de color ──────────────────── */
.card {
  transition: transform .22s var(--ease-bounce), box-shadow .22s, border-color .22s;
  will-change: transform;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 36px rgba(0,0,0,.1);
  border-color: rgba(79,70,229,.22);
}
[data-theme="dark"] .card:hover,
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .card:hover {
    box-shadow: 0 12px 36px rgba(0,0,0,.38);
    border-color: rgba(99,102,241,.28);
  }
}

/* ── Stat cards: gradiente en iconos ─────────────────────── */
.stat-icon-blue   { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); }
.stat-icon-indigo { background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%); }
.stat-icon-amber  { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); }
.stat-icon-red    { background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%); }
[data-theme="dark"] .stat-icon-blue   { background: linear-gradient(135deg, #1e3a5f, #1e40af22); }
[data-theme="dark"] .stat-icon-indigo { background: linear-gradient(135deg, #2e1065, #4c1d9522); }
[data-theme="dark"] .stat-icon-amber  { background: linear-gradient(135deg, #451a03, #92400e22); }
[data-theme="dark"] .stat-icon-red    { background: linear-gradient(135deg, #450a0a, #991b1b22); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .stat-icon-blue   { background: linear-gradient(135deg, #1e3a5f, #1e40af22); }
  :root:not([data-theme="light"]) .stat-icon-indigo { background: linear-gradient(135deg, #2e1065, #4c1d9522); }
  :root:not([data-theme="light"]) .stat-icon-amber  { background: linear-gradient(135deg, #451a03, #92400e22); }
  :root:not([data-theme="light"]) .stat-icon-red    { background: linear-gradient(135deg, #450a0a, #991b1b22); }
}

.stat-card {
  transition: transform .22s var(--ease-bounce), box-shadow .22s;
  overflow: hidden;
}
.stat-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,.12));
}

/* ── Stat value: números tabulares ───────────────────────── */
.stat-value {
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

/* ── Stagger fade-in animaciones ─────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slideInRow {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: none; }
}

/* Stat cards en dashboard */
.stats-grid .stat-card {
  animation: fadeInScale .42s var(--ease-bounce) both;
}
.stats-grid .stat-card:nth-child(1) { animation-delay: .06s; }
.stats-grid .stat-card:nth-child(2) { animation-delay: .11s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: .16s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: .21s; }

/* Cards del grid principal */
.dashboard-grid > .card,
.dashboard-side > .card {
  animation: fadeInUp .38s var(--ease-out-expo) both;
}
.dashboard-grid > .card:nth-child(1) { animation-delay: .12s; }
.dashboard-grid > .card:nth-child(2) { animation-delay: .08s; }
.dashboard-side > .card:nth-child(1) { animation-delay: .14s; }
.dashboard-side > .card:nth-child(2) { animation-delay: .19s; }
.dashboard-side > .card:nth-child(3) { animation-delay: .24s; }
.dashboard-side > .card:nth-child(4) { animation-delay: .29s; }

/* Filas de tabla */
.table tbody tr {
  animation: slideInRow .3s var(--ease-out-expo) both;
}
.table tbody tr:nth-child(1)  { animation-delay: .04s; }
.table tbody tr:nth-child(2)  { animation-delay: .08s; }
.table tbody tr:nth-child(3)  { animation-delay: .12s; }
.table tbody tr:nth-child(4)  { animation-delay: .16s; }
.table tbody tr:nth-child(5)  { animation-delay: .20s; }
.table tbody tr:nth-child(6)  { animation-delay: .24s; }
.table tbody tr:nth-child(7)  { animation-delay: .28s; }
.table tbody tr:nth-child(n+8){ animation-delay: .30s; }

/* ── Badge urgente: pulso sutil ──────────────────────────── */
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.35); }
  50%      { box-shadow: 0 0 0 5px rgba(239,68,68,0);  }
}
.badge-priority-urgente {
  animation: pulse-red 2.2s ease infinite;
}

/* ── Nav badge urgente ───────────────────────────────────── */
.nav-badge-urgent {
  animation: pulse-red 2s ease infinite;
}

/* ── Form focus mejorado ─────────────────────────────────── */
.form-control:focus,
.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: var(--glow-primary);
  outline: none;
}

/* ── Search box focus ────────────────────────────────────── */
.global-search:focus-within {
  border-color: var(--color-primary);
  box-shadow: var(--glow-primary);
}

/* ── Modal: transición de entrada ───────────────────────── */
.modal-overlay.active .modal,
.modal-overlay[style*="flex"] .modal {
  animation: fadeInScale .28s var(--ease-bounce) both;
}

/* ── Bottom nav: glassmorphism ───────────────────────────── */
.bottom-nav {
  background: rgba(17,24,39,.92) !important;
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-top: 1px solid rgba(255,255,255,.07) !important;
}

/* ── FAB mejorado ────────────────────────────────────────── */
.bnav-fab-circle {
  background: var(--gradient-primary) !important;
  box-shadow: var(--shadow-primary) !important;
  transition: transform .22s var(--ease-bounce), box-shadow .22s !important;
}
.bnav-fab:hover .bnav-fab-circle {
  transform: scale(1.1) !important;
  box-shadow: var(--shadow-primary-lg) !important;
}

/* ── Transición de salida de página ─────────────────────── */
@keyframes pageExit {
  to { opacity: 0; transform: translateY(-6px); }
}
.page-exit .content-area {
  animation: pageExit .15s ease forwards;
}

/* ── Login card mejorada ─────────────────────────────────── */
.login-card {
  box-shadow: 0 20px 60px rgba(0,0,0,.13), 0 0 0 1px var(--border);
  transition: box-shadow .3s, transform .15s;
  transform-style: preserve-3d;
}
.login-logo {
  background: var(--gradient-primary);
  box-shadow: var(--shadow-primary);
  transition: transform .3s var(--ease-bounce), box-shadow .3s;
}
.login-card:hover .login-logo {
  transform: scale(1.05) rotate(-3deg);
  box-shadow: var(--shadow-primary-lg);
}
.login-body {
  position: relative;
  overflow: hidden;
}
.login-body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(79,70,229,.14) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(124,58,237,.12) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
  animation: loginOrbFloat 8s ease-in-out infinite alternate;
}
@keyframes loginOrbFloat {
  from { transform: scale(1) translate(0,0); }
  to   { transform: scale(1.08) translate(-12px, 8px); }
}
.login-container { position: relative; z-index: 1; }

/* ── Botones genéricos: hover sutil ──────────────────────── */
.btn-ghost:hover {
  transform: translateY(-1px);
  transition: transform .18s var(--ease-bounce), background .15s, color .15s;
}
.btn-danger:hover {
  transform: translateY(-1px);
  transition: transform .18s var(--ease-bounce), background .15s;
}

/* ── Skeleton shimmer (estado de carga) ──────────────────── */
@keyframes shimmer {
  from { background-position: -400px 0; }
  to   { background-position:  400px 0; }
}
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-surface2) 25%,
    var(--bg-surface)  50%,
    var(--bg-surface2) 75%
  );
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 4px;
  color: transparent !important;
}

/* ── Avatares: hover scale ───────────────────────────────── */
.client-avatar, .activity-avatar, .sidebar-user-avatar {
  transition: transform .22s var(--ease-bounce);
}
.client-item:hover .client-avatar,
.activity-item:hover .activity-avatar {
  transform: scale(1.12);
}

/* ── Pending items hover ─────────────────────────────────── */
.pending-item {
  transition: background .15s, padding-left .15s;
}
.pending-item:hover {
  background: var(--gradient-primary-soft);
  padding-left: 18px;
}

/* ── Client items hover ──────────────────────────────────── */
.client-item {
  transition: background .15s, padding-left .15s;
}
.client-item:hover {
  background: var(--gradient-primary-soft);
}

/* ── Vue 3 Toast TransitionGroup ─────────────────────────── */
.toast-slide-enter-active { transition: all .28s cubic-bezier(.16,1,.3,1); }
.toast-slide-leave-active { transition: all .2s ease; position: absolute; width: 100%; }
.toast-slide-enter-from   { opacity: 0; transform: translateX(28px) scale(.96); }
.toast-slide-leave-to     { opacity: 0; transform: translateX(28px) scale(.96); }
.toast-slide-move         { transition: transform .28s ease; }
.toast-inner              { position: relative; display: flex; flex-direction: column; gap: 8px; }

/* ── Print styles ────────────────────────────────────────── */
@media print {
  .sidebar, .top-bar, .page-actions, .btn, .card-footer,
  .action-list, .back-to-top, .toast-container,
  #deleteModal, #confirmModal, #addRelationModal { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .content-area { padding: 0 !important; }
  .detail-grid { grid-template-columns: 1fr !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
  body { background: #fff !important; color: #000 !important; }
}

/* (toast/back-to-top responsive ya incluido en la sección mobile de arriba) */

/* ══════════════════════════════════════════════════════════
   KANBAN BOARD
   ══════════════════════════════════════════════════════════ */
.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 24px;
  align-items: flex-start;
}
.kanban-col {
  flex: 0 0 240px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 180px);
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 1;
}
.kanban-col-title {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-secondary);
}
.kanban-cards {
  padding: 10px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}
.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: grab;
  transition: box-shadow .15s, opacity .15s;
}
.kanban-card:hover { box-shadow: var(--shadow-md); }
.kanban-card.dragging { opacity: .45; box-shadow: var(--shadow-lg); }
.kanban-card-header {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.kanban-card-title {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1.35;
  display: block;
  margin-bottom: 4px;
}
.kanban-card-title:hover { color: var(--color-primary); }
.kanban-card-client { margin-bottom: 4px; }
.kanban-card-footer { margin-top: 4px; }
.kanban-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 10px;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius);
  min-height: 60px;
}

/* ══════════════════════════════════════════════════════════
   CHECKLIST / TASKS
   ══════════════════════════════════════════════════════════ */
.task-progress {
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}
.task-progress-bar {
  height: 100%;
  background: var(--color-success);
  border-radius: 3px;
  transition: width .3s ease;
}
.task-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background .12s;
}
.task-item:hover { background: var(--bg-secondary); }
.task-item:hover .task-delete { opacity: 1; }
.task-check {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--color-success);
  cursor: pointer;
}
.task-label {
  flex: 1;
  font-size: .875rem;
  color: var(--text-primary);
  line-height: 1.4;
}
.task-done .task-label {
  text-decoration: line-through;
  color: var(--text-muted);
}
.task-delete {
  opacity: 0;
  transition: opacity .15s;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.task-delete:hover { color: var(--color-danger); }
.task-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}
.task-add-input {
  flex: 1;
  padding: 6px 10px;
  font-size: .875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
}
.task-add-input:focus { outline: none; border-color: var(--color-primary); }

/* ══════════════════════════════════════════════════════════
   COMMENTS
   ══════════════════════════════════════════════════════════ */
.comment-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.comment-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.comment-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.comment-bubble {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 8px 12px;
}
.comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.comment-author {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-primary);
}
.comment-time { font-size: .75rem; color: var(--text-muted); }
.comment-body {
  font-size: .875rem;
  color: var(--text-primary);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.comment-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  line-height: 1;
  opacity: 0;
  transition: opacity .15s;
}
.comment-item:hover .comment-delete { opacity: 1; }
.comment-delete:hover { color: var(--color-danger); }
.comment-add-row { display: flex; flex-direction: column; gap: 8px; }
.comment-textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: .875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  resize: vertical;
  min-height: 72px;
  font-family: inherit;
  box-sizing: border-box;
}
.comment-textarea:focus { outline: none; border-color: var(--color-primary); }

/* ══════════════════════════════════════════════════════════
   IMPORT PAGE
   ══════════════════════════════════════════════════════════ */
.import-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 768px) { .import-grid { grid-template-columns: 1fr; } }
.import-hint {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: .825rem;
  color: var(--text-secondary);
}
.import-cols {
  font-size: .8rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.7;
}
.import-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.import-file-row input[type=file] { flex: 1; font-size: .875rem; }

/* ══════════════════════════════════════════════════════════
   CHARTS GRID (dashboard)
   ══════════════════════════════════════════════════════════ */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-top: 20px;
}
@media (max-width: 900px) { .charts-grid { grid-template-columns: 1fr; } }
.charts-grid canvas { max-height: 220px; }

/* ══════════════════════════════════════════════════════════
   REMINDER CARD accent
   ══════════════════════════════════════════════════════════ */
.reminder-card { border-left: 3px solid var(--color-warning); }

/* ── show-mobile (opuesto a hide-mobile) ─────────────────── */
.show-mobile { display: none; }
@media (max-width: 768px) { .show-mobile { display: inline; } }

/* ── Dashboard: ajustes móvil ────────────────────────────── */
@media (max-width: 768px) {
  /* Panel urgentes/pendientes aparece PRIMERO */
  .dashboard-side { order: -1; }

  /* Stat-link: inline bajo el valor en lugar de absoluto */
  .stat-link {
    position: static;
    display: block;
    margin-top: 4px;
    font-size: 11px;
  }
  .stat-card { padding-bottom: 14px; }
}

/* ── Tabla registros recientes → 2 columnas en móvil ──────── */
@media (max-width: 640px) {
  .dashboard-recent-table { min-width: 0 !important; }

  /* Ocultar: tipo (col 1), prioridad (col 4), fecha (col 5) */
  .dashboard-recent-table td:nth-child(1),
  .dashboard-recent-table td:nth-child(4),
  .dashboard-recent-table td:nth-child(5) { display: none; }

  .dashboard-recent-table .td-badge { width: 76px; }
}
