/* ==========================================================================
   MarcaOne CRM — Design System
   Verde MarcaOne + sidebar grafito
   Incluye tokens, reset, componentes y layout del dashboard.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  /* Marca */
  --brand-50:  #ECFDF3;
  --brand-100: #D1FAE5;
  --brand-200: #A7F3D0;
  --brand-400: #34D399;
  --brand-500: #22C55E;
  --brand-600: #1A6B3C;
  --brand-700: #14532D;
  --brand-800: #0F3D22;

  /* Neutros */
  --ink-900: #0B1511;
  --ink-800: #14211B;
  --ink-700: #1F2D26;
  --ink-600: #3D4F46;
  --ink-500: #5C6F65;
  --ink-400: #84968C;
  --line:        #E4EAE6;
  --line-strong: #D3DDD7;
  --surface:   #FFFFFF;
  --surface-2: #F7FAF8;
  --bg:        #F3F6F4;

  /* Semánticos */
  --success: #16A34A;
  --danger:  #DC2626;
  --warning: #D97706;
  --info:    #0EA5E9;

  /* Alias heredados (las plantillas antiguas usan estos nombres) */
  --primary:      var(--brand-600);
  --primary-dark: var(--brand-700);
  --secondary:    var(--brand-500);
  --light:        var(--surface-2);
  --dark:         var(--ink-900);
  --gray:         var(--ink-500);
  --border:       var(--line);

  /* Layout */
  --sidebar-w: 264px;
  --header-h: 64px;

  /* Formas y sombras */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-xs: 0 1px 2px rgba(11, 21, 17, .05);
  --shadow-sm: 0 1px 3px rgba(11, 21, 17, .07), 0 1px 2px rgba(11, 21, 17, .04);
  --shadow-md: 0 10px 28px rgba(11, 21, 17, .09);
  --shadow-lg: 0 24px 60px rgba(11, 21, 17, .18);
  --ring: 0 0 0 3px rgba(26, 107, 60, .18);
  --ring-danger: 0 0 0 3px rgba(220, 38, 38, .15);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- 2. Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-700);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 .4em;
  color: var(--ink-900);
  font-weight: 700;
  letter-spacing: -.015em;
  line-height: 1.25;
}
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
h4 { font-size: 15px; }

p { margin: 0 0 1em; }

a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }

img, svg { max-width: 100%; }

::selection { background: var(--brand-100); color: var(--brand-800); }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

/* Scrollbars discretos */
* { scrollbar-width: thin; scrollbar-color: #C6D2CB transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #C6D2CB; border: 3px solid transparent; background-clip: content-box; border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: #A9B8AF; background-clip: content-box; }

/* ---------- 3. Layout ---------- */
/* El sidebar fluye con la pagina: no tiene scroll propio.
   Un unico scrollbar, el del documento.
   Se activa con la clase .crm-app o, si el HTML es antiguo, con :has(). */
body:has(> .sidebar),
body.crm-app {
  display: flex;
  align-items: stretch;
}

.sidebar {
  position: relative;
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  height: auto;
  min-height: 100vh;
  padding: 18px 14px;
  overflow: visible;
  color: #E6EFEA;
  background: linear-gradient(180deg, #0B1511 0%, #0E1B15 55%, #0B1511 100%);
  border-right: 1px solid rgba(255, 255, 255, .06);
  z-index: 200;
  transition: transform .28s cubic-bezier(.4, 0, .2, 1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 4px 6px 24px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: #FFFFFF;
}
.sidebar-logo span:first-child {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 11px;
  font-size: 16px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  box-shadow: 0 8px 20px rgba(34, 197, 94, .28);
}
.sidebar-logo span:last-child { font-size: 15px; }

.nav-menu { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.nav-item { margin: 0; }

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  color: #A6B8AE;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .18s ease, color .18s ease;
  user-select: none;
}
.nav-link span:first-child {
  width: 19px;
  flex: 0 0 19px;
  text-align: center;
  font-size: 14px;
  opacity: .85;
  filter: grayscale(.25);
}
.nav-link:hover { background: rgba(255, 255, 255, .065); color: #FFFFFF; }
.nav-link:focus-visible { box-shadow: 0 0 0 2px var(--brand-500); }

.nav-link.active {
  color: #FFFFFF;
  background: linear-gradient(90deg, rgba(34, 197, 94, .22), rgba(34, 197, 94, .05));
}
.nav-link.active span:first-child { opacity: 1; filter: none; }
.nav-link.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--brand-500);
}

.nav-admin-link {
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, .13);
  background: rgba(255, 255, 255, .035);
}

.main-content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
  padding: 10px 28px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.header-right { display: flex; align-items: center; gap: 14px; }

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  color: #FFFFFF;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  box-shadow: 0 0 0 3px rgba(26, 107, 60, .12);
  cursor: pointer;
}

.hamburger {
  display: none;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-700);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.hamburger:hover { background: var(--surface-2); }

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(8, 15, 12, .5);
  backdrop-filter: blur(2px);
}
.overlay.active { display: block; }

.content { flex: 1; padding: 26px 28px 40px; }

.page-content { animation: fadeUp .28s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.page-header h2 { margin: 0; font-size: 19px; }

/* ---------- 4. Cards ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.card-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.card-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  font-size: 17px;
  background: var(--brand-50);
  color: var(--brand-700);
}
.card-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--ink-900);
  line-height: 1.15;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.card-footer { font-size: 11.5px; color: var(--ink-400); }

/* ---------- 5. Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-700);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .06s ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--brand-600); color: #FFFFFF; box-shadow: 0 1px 2px rgba(20, 83, 45, .28); }
.btn-primary:hover { background: var(--brand-700); color: #FFFFFF; }

.btn-secondary { background: var(--surface); color: var(--ink-700); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-2); border-color: #C2D0C7; color: var(--ink-900); }

.btn-success { background: var(--success); color: #FFFFFF; }
.btn-success:hover { background: #15803D; color: #FFFFFF; }

.btn-danger { background: var(--danger); color: #FFFFFF; }
.btn-danger:hover { background: #B91C1C; color: #FFFFFF; }

.btn-info { background: var(--info); color: #FFFFFF; }
.btn-info:hover { background: #0284C7; color: #FFFFFF; }

.btn-ghost { background: transparent; color: var(--ink-600); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink-900); }

.btn-small { padding: 6px 11px; font-size: 12px; border-radius: 8px; }

.btn-remove-line {
  padding: 2px 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--danger);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.btn-remove-line:hover { background: rgba(220, 38, 38, .08); }

/* ---------- 6. Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.badge-success { background: rgba(22, 163, 74, .12); color: #15803D; }
.badge-warning { background: rgba(217, 119, 6, .13); color: #B45309; }
.badge-danger  { background: rgba(220, 38, 38, .12); color: #B91C1C; }
.badge-info    { background: rgba(14, 165, 233, .12); color: #0369A1; }
.badge-neutral { background: var(--surface-2); color: var(--ink-500); }

/* ---------- 7. Tablas ---------- */
.table-container {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  margin-bottom: 20px;
}
.table-scroll { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; min-width: 480px; }

.table thead th {
  position: sticky;
  top: 0;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--ink-500);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
.table td {
  padding: 13px 16px;
  border-bottom: 1px solid #EEF2EF;
  font-size: 13px;
  color: var(--ink-700);
  vertical-align: middle;
}
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table td:first-child, .table th:first-child { padding-left: 20px; }
.table td:last-child, .table th:last-child { padding-right: 20px; }

/* ---------- 8. Formularios ---------- */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-700);
}
.form-group input,
.form-group textarea,
.form-group select,
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-900);
  font-family: inherit;
  font-size: 13.5px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-group input::placeholder,
.form-group textarea::placeholder,
.form-control::placeholder { color: var(--ink-400); }

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.form-control:focus {
  outline: none;
  border-color: var(--brand-600);
  box-shadow: var(--ring);
}
.form-group textarea { min-height: 84px; resize: vertical; }
.form-group small { display: block; margin-top: 4px; font-size: 11.5px; color: var(--ink-400); }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* ---------- 9. Modales ---------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(8, 15, 12, .55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.modal.active { display: flex; }

.modal-content {
  width: 100%;
  max-width: 620px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 26px 28px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: modalIn .22s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.modal-header h2, .modal-header h3 { margin: 0; font-size: 17px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.close-btn, .modal-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-500);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.close-btn:hover, .modal-close:hover { background: var(--surface-2); color: var(--ink-900); }

/* ---------- 10. Alertas ---------- */
.alert {
  display: none;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 10px;
  border-left: 4px solid transparent;
  font-size: 13px;
}
.alert.show { display: block; }
.alert-success { background: rgba(22, 163, 74, .09);  color: #15803D; border-left-color: var(--success); }
.alert-danger  { background: rgba(220, 38, 38, .08);  color: #B91C1C; border-left-color: var(--danger); }
.alert-warning { background: rgba(217, 119, 6, .1);   color: #B45309; border-left-color: var(--warning); }
.alert-info    { background: rgba(14, 165, 233, .09); color: #0369A1; border-left-color: var(--info); }

/* ---------- 11. Spinner / vacío ---------- */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(26, 107, 60, .18);
  border-top-color: var(--brand-600);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  padding: 44px 20px;
  text-align: center;
  color: var(--ink-400);
  font-size: 13.5px;
}

/* ---------- 12. Búsqueda / toggle de vista ---------- */
.search-bar { position: relative; }
.search-bar input {
  width: 220px;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font-family: inherit;
  font-size: 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search-bar input:focus { outline: none; border-color: var(--brand-600); box-shadow: var(--ring); }
.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-400);
  font-size: 13px;
  pointer-events: none;
}

.view-toggle { display: flex; gap: 3px; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.view-btn {
  padding: 6px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-500);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.view-btn:hover { background: rgba(255, 255, 255, .7); color: var(--ink-900); }
.view-btn.active { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow-xs); }

/* ---------- 13. Etiquetas de categoría ---------- */
.cat-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.cat-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--brand-50);
  color: var(--brand-700);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.cat-tag:hover { background: var(--brand-100); }
.cat-tag.active { background: var(--brand-600); color: #FFFFFF; }

/* ---------- 14. Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.kanban-col {
  min-width: 170px;
  min-height: 200px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.kanban-col-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--ink-500);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.kanban-card {
  margin-bottom: 9px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  font-size: 13px;
  transition: box-shadow .16s ease, transform .16s ease;
}
.kanban-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.kanban-card .kc-name { margin-bottom: 3px; font-weight: 600; color: var(--ink-900); }
.kanban-card .kc-sub { color: var(--ink-500); font-size: 11.5px; }
.kanban-card .kc-actions { display: flex; gap: 5px; margin-top: 9px; }

/* ---------- 15. Líneas de invoice ---------- */
.invoice-line {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.invoice-line input, .invoice-line select {
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  font-family: inherit;
  font-size: 12.5px;
}
.invoice-line input:focus, .invoice-line select:focus {
  outline: none;
  border-color: var(--brand-600);
  box-shadow: var(--ring);
}
.invoice-line .line-total { font-size: 13px; font-weight: 700; color: var(--brand-700); font-variant-numeric: tabular-nums; }

/* ---------- 16. Reportes ---------- */
.reporte-card {
  margin-bottom: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.reporte-stat {
  display: inline-block;
  margin: 6px;
  padding: 12px 20px;
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
}
.reporte-stat-val { font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: var(--brand-700); font-variant-numeric: tabular-nums; }
.reporte-stat-label { margin-top: 2px; font-size: 11px; color: var(--ink-500); }

/* ---------- 17. Mosaico de artículos ---------- */
.mosaic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.mosaic-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.mosaic-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.mosaic-card .mc-sku { margin-bottom: 4px; font-size: 11px; color: var(--ink-400); }
.mosaic-card .mc-title { margin-bottom: 6px; font-size: 14px; font-weight: 700; color: var(--ink-900); }
.mosaic-card .mc-price { margin-bottom: 4px; font-size: 18px; font-weight: 800; color: var(--brand-700); font-variant-numeric: tabular-nums; }
.mosaic-card .mc-stock { margin-bottom: 10px; font-size: 12px; color: var(--ink-500); }
.mosaic-card .mc-actions { display: flex; gap: 6px; }

/* ---------- 18. Tabs de administración ---------- */
.admin-tab {
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-600);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.admin-tab:hover { background: var(--surface-2); }
.admin-tab.active { border-color: var(--brand-600); background: var(--brand-600); color: #FFFFFF; }

/* ---------- 19. Subida de logo ---------- */
.logo-upload-area {
  padding: 20px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease;
}
.logo-upload-area:hover { border-color: var(--brand-500); background: var(--brand-50); }
.logo-preview { display: block; max-width: 160px; max-height: 70px; margin: 10px auto; object-fit: contain; }

/* ---------- 20. Utilidades ---------- */
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.w-100 { width: 100%; }
.hide { display: none !important; }
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.flex-gap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-title { font-size: 18px; font-weight: 700; letter-spacing: -.015em; color: var(--ink-900); }
.muted { color: var(--ink-400); }
.nowrap { white-space: nowrap; }

/* ---------- 21. Idiomas ---------- */
.lang-es .en { display: none !important; }
.lang-en .es { display: none !important; }

/* ---------- 22. Responsive ---------- */
@media (max-width: 900px) {
  /* En movil el sidebar vuelve a ser un panel off-canvas con su propio scroll */
  .crm-app { display: block; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    height: 100vh;
    overflow-y: auto;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: inline-flex; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(3, 1fr); }
  .invoice-line { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 600px) {
  .content { padding: 18px 16px 32px; }
  .header { padding: 10px 16px; }
  .header h1 { font-size: 16px; }
  .cards-grid { grid-template-columns: 1fr 1fr; }
  .card { padding: 15px; }
  .card-value { font-size: 22px; }
  .card-icon { width: 32px; height: 32px; flex-basis: 32px; font-size: 15px; }
  .search-bar input { width: 150px; }
  .kanban { grid-template-columns: repeat(2, 1fr); }
  .invoice-line { grid-template-columns: 1fr 1fr; }
  .modal-content { padding: 20px; border-radius: var(--radius-lg); }
}

@media (max-width: 400px) {
  .cards-grid { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
}

/* ---------- 23. Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
