/* Extensionmania — hoja de estilos única, sin frameworks ni compilación.
   Pensada para el PC del mostrador: tipografía algo mayor y zonas de clic amplias,
   porque se usa de pie y con prisa. */

:root {
  /* Colores de la marca, tomados de extensionmania.com: negro, dorado y blanco. */
  --primary: #9e8b66;
  --primary-dark: #85734f;
  --primary-soft: #f7f4ed;

  --ink: #171717;          /* negro de la barra lateral */
  --ink-2: #232323;        /* negro de los textos de marca */

  --bg: #f6f5f3;
  --surface: #ffffff;
  --surface-2: #faf9f7;
  --border: #e8e5e0;
  --border-strong: #d6d1c8;

  --text: #232323;
  --muted: #6b665e;
  --faint: #9b958a;

  --green: #16a34a;
  --green-soft: #e9f8ef;
  --amber: #d97706;
  --amber-soft: #fef4e6;
  --red: #dc2626;
  --red-soft: #fdeceb;
  --purple: #7c3aed;
  --blue: #2563eb;
  --blue-soft: #eaf1fe;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(29, 26, 32, .06);
  --shadow: 0 4px 14px rgba(29, 26, 32, .08);
  --shadow-lg: 0 12px 32px rgba(29, 26, 32, .14);

  --sidebar-w: 232px;
  /* La web usa Poppins y Open Sans. Aquí no se cargan fuentes de fuera: en el PC
     de una tienda sin internet la aplicación tiene que verse igual de bien. */
  --font: "Poppins", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--font); font-size: 15.5px; line-height: 1.55;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 25px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p { margin: 0 0 1em; }

/* ------------------------------------------------------------------ layout */
.app { display: flex; min-height: 100vh; }

/* Barra lateral en negro con acentos dorados: es la imagen de la marca. */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--ink); border-right: 1px solid #000;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}

.brand { display: block; padding: 18px 16px 14px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand img { display: block; width: 100%; height: auto; max-height: 44px; object-fit: contain; }

/* Logotipo escrito, mientras no haya fichero: EXTENSION en blanco y mania en dorado. */
.wordmark {
  font-size: 19px; line-height: 1.05; letter-spacing: .01em;
  text-transform: none; white-space: nowrap;
}
.wordmark .a { font-weight: 300; color: #fff; letter-spacing: .04em; }
.wordmark .b { font-weight: 700; color: var(--primary); }
.brand .sede { font-size: 11px; color: #8b857b; letter-spacing: .09em; text-transform: uppercase; margin-top: 3px; }

.tienda-switch { padding: 0 12px 12px; }
.tienda-switch select {
  width: 100%; font-size: 13.5px; padding: 8px 9px;
  border: 1px solid #3a3a3a; border-radius: var(--radius-sm);
  background: #262626; color: #fff; cursor: pointer; font-weight: 600;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239e8b66' d='M6 8.5 1.8 4.3l.9-.9L6 6.7l3.3-3.3.9.9z'/%3E%3C/svg%3E");
}
/* Dónde estás metido: es un cartel, no una opción del menú.
   Nada de relleno dorado — ése es el de `.nav a.active` y hacía que pareciera
   pulsado. Aquí manda el filete dorado del lateral. */
.contexto {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: #1d1d1d; border: 1px solid #333; border-left: 3px solid var(--primary);
}
.contexto .ico { width: 16px; height: 16px; flex: 0 0 16px; color: var(--primary); }
.contexto .texto { min-width: 0; line-height: 1.25; }
.contexto .que {
  display: block; font-size: 9.5px; font-weight: 700; color: #7d776d;
  text-transform: uppercase; letter-spacing: .11em;
}
.contexto .quien {
  display: block; font-size: 13.5px; font-weight: 650; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* En central el filete es más ancho: se ve de un vistazo que no se está
   dentro de ningún salón. */
.contexto-central { border-left-width: 4px; background: #212121; }
.contexto-central .quien { color: var(--primary); letter-spacing: .04em; }

/* Doble clase: `.btn` se declara más abajo y, a igual especificidad, ganaría. */
.btn.volver-central {
  background: #262626; color: #d8d4cd; border-color: #3a3a3a;
}
.btn.volver-central:hover { background: #303030; color: #fff; border-color: #4a4a4a; }

.nav { padding: 4px 8px 10px; flex: 1; }
.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  color: #7d776d; font-weight: 700; padding: 14px 10px 5px;
}
.nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: #d8d4cd; font-size: 14.5px; font-weight: 500; margin-bottom: 1px;
}
.nav a:hover { background: #262626; color: #fff; text-decoration: none; }
.nav a.active { background: var(--primary); color: #fff; font-weight: 650; }
.nav a .ico { width: 17px; height: 17px; flex: 0 0 17px; opacity: .75; }
.nav a:hover .ico, .nav a.active .ico { opacity: 1; }
.nav a .count {
  margin-left: auto; font-size: 11px; font-weight: 700; color: #fff;
  background: var(--red); border-radius: 20px; padding: 0 6px; min-width: 18px; text-align: center;
}
.nav a .count.soft { background: #2f2f2f; color: #a9a49a; border: 1px solid #3a3a3a; }
.nav a.active .count.soft { background: rgba(0,0,0,.25); color: #fff; border-color: transparent; }

.sidebar-foot { border-top: 1px solid #2d2d2d; padding: 10px; }

/* Botón del usuario: una fila limpia, no un enlace suelto con texto encima. */
.usuario-boton {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 9px; border-radius: var(--radius-sm); color: #d8d4cd;
}
.usuario-boton:hover { background: #262626; text-decoration: none; }
.usuario-boton .quien { min-width: 0; flex: 1; line-height: 1.25; }
.usuario-boton .nombre {
  display: block; font-size: 13.5px; font-weight: 600; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.usuario-boton .rol { display: block; font-size: 11.5px; color: #8b857b; }
.usuario-boton .flecha { color: #6f6a62; }
.ico-mini { width: 9px; height: 9px; }

/* Doble clase a propósito: `.menu` se declara más abajo y, a igual
   especificidad, ganaría por orden de aparición. */
.menu.menu-usuario {
  /* La barra lateral tiene overflow:auto, así que un menú más ancho que ella
     se recortaría o sacaría barra horizontal. Se ajusta a su ancho. */
  left: 0; right: 0; top: auto; bottom: calc(100% + 8px);
  min-width: 0; padding: 6px;
}
.menu.menu-usuario .ficha-usuario {
  display: flex; gap: 11px; align-items: center; padding: 11px 10px 12px;
}
.menu.menu-usuario .ico { width: 15px; height: 15px; flex: 0 0 15px; color: var(--muted); }
.menu.menu-usuario .salir { color: var(--red); font-weight: 600; }
.menu.menu-usuario .salir:hover { background: var(--red-soft); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 58px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  position: sticky; top: 0; z-index: 40;
}
.topbar .search { flex: 1; max-width: 400px; position: relative; }
.topbar .search input {
  width: 100%; padding: 8px 11px 8px 32px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 20px; background: var(--surface-2);
}
.topbar .search input:focus { background: var(--surface); }
.topbar .search .mag { position: absolute; left: 11px; top: 8px; color: var(--faint); font-size: 13px; }
.topbar .spacer { flex: 1; }

.content { padding: 22px 24px 60px; max-width: 1400px; width: 100%; }
.content.wide { max-width: none; }

.page-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .grow { flex: 1; min-width: 240px; }
.page-head .sub { color: var(--muted); font-size: 14px; margin: 2px 0 0; }

/* ------------------------------------------------------------------ botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; font-size: 14.5px; font-weight: 550; font-family: inherit;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: background .12s, border-color .12s; white-space: nowrap;
  text-decoration: none; line-height: 1.4;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn-ok:hover { background: #15803d; border-color: #15803d; }
.btn-danger { color: var(--red); border-color: #f3c9c7; background: var(--surface); }
.btn-danger:hover { background: var(--red-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-lg { padding: 12px 22px; font-size: 16px; font-weight: 650; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; cursor: pointer; font-size: 16px; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); }

/* ------------------------------------------------------------------ tarjetas */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 16px 18px; }
.card-head { padding: 13px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card-head h3 { margin: 0; font-size: 15px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-metrics { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }

.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.metric .n { font-size: 27px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.metric .l { font-size: 13px; color: var(--muted); margin-top: 2px; }
.metric.alert .n { color: var(--red); }
.metric.warn .n { color: var(--amber); }
.metric.ok .n { color: var(--green); }
.metric a { color: inherit; }
.metric a:hover { text-decoration: none; }

/* ------------------------------------------------------------------ etiquetas */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 9px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
  white-space: nowrap;
}
.badge-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.badge-ok { background: var(--green-soft); color: #15803d; border-color: #c4ecd3; }
.badge-warn { background: var(--amber-soft); color: #b45309; border-color: #fbe0b6; }
.badge-alert { background: var(--red-soft); color: #b91c1c; border-color: #f7cdcb; }
.badge-info { background: var(--blue-soft); color: #1d4ed8; border-color: #cddffc; }
.badge-solid { color: #fff; border: none; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 550;
  padding: 2px 10px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted);
}

.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px;
  display: grid; place-items: center; color: #fff;
  font-size: 11.5px; font-weight: 700; user-select: none;
}
.avatar-sm { width: 23px; height: 23px; flex-basis: 23px; font-size: 9.5px; }
.avatar-lg { width: 46px; height: 46px; flex-basis: 46px; font-size: 17px; }

/* ------------------------------------------------------------------ formularios */
.field { margin-bottom: 14px; }
.field label, .lbl { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=search], input[type=tel], select, textarea {
  width: 100%; padding: 9px 11px; font-size: 14.5px; font-family: inherit; color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(158, 139, 102, .22);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.55; }
select {
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6472' d='M6 8.5 1.8 4.3l.9-.9L6 6.7l3.3-3.3.9.9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px;
}
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; margin-bottom: 9px; cursor: pointer; }
.check input { margin: 3px 0 0; width: 16px; height: 16px; flex: 0 0 16px; cursor: pointer; accent-color: var(--primary); }
.check span.hint { display: block; font-size: 12.5px; color: var(--muted); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 150px; }
.inline-form { display: inline; }
fieldset { border: none; padding: 0; margin: 0 0 6px; }
legend { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 0 0 8px; }

/* ------------------------------------------------------------------ avisos */
.alert {
  padding: 11px 14px; border-radius: var(--radius-sm); font-size: 14px;
  border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 14px;
  display: flex; gap: 9px; align-items: flex-start;
}
.alert-success { background: var(--green-soft); border-color: #c4ecd3; color: #14532d; }
.alert-error { background: var(--red-soft); border-color: #f7cdcb; color: #7f1d1d; }
.alert-warning { background: var(--amber-soft); border-color: #fbe0b6; color: #78350f; }
.alert-info { background: var(--blue-soft); border-color: #cddffc; color: #1e3a8a; }

.flashes { position: fixed; top: 68px; right: 20px; z-index: 200; max-width: 380px; }
.flashes .alert { box-shadow: var(--shadow-lg); animation: slide-in .22s ease-out; }
@keyframes slide-in { from { opacity: 0; transform: translateX(16px); } }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { margin-bottom: 10px; }
.ico-grande { width: 34px; height: 34px; stroke-width: 1.3; color: var(--faint); }
.empty h3 { color: var(--text); }

/* ------------------------------------------------------------------ tablas */
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 700; padding: 9px 12px;
  border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { font-variant-numeric: tabular-nums; text-align: right; }
.table-wrap { overflow-x: auto; }
.table input, .table select { padding: 5px 8px; font-size: 13.5px; }

.ref { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }

/* ------------------------------------------------------------------ filtros */
.filters {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 9px 12px; margin-bottom: 16px;
}
.filters select, .filters input { width: auto; min-width: 130px; padding: 6px 9px; font-size: 13.5px; }
.filters .grow { flex: 1; min-width: 180px; }

/* Cuántas filas quedan a la vista mientras se escribe. */
.filtro-aviso { margin-top: 4px; font-size: 12.5px; white-space: nowrap; }
.filtro-aviso.vacio { color: var(--amber); }

.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 9px 14px; font-size: 14.5px; font-weight: 550; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg a { padding: 6px 12px; font-size: 13.5px; font-weight: 550; color: var(--muted); background: var(--surface); }
.seg a + a { border-left: 1px solid var(--border); }
.seg a.active { background: var(--primary-soft); color: var(--primary-dark); }
.seg a:hover { text-decoration: none; background: var(--surface-2); }

/* ------------------------------------------------------------------ agenda */
.agenda-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.agenda { display: flex; min-width: min-content; position: relative; }

.agenda-horas { flex: 0 0 58px; border-right: 1px solid var(--border); background: var(--surface-2); position: relative; }
.agenda-horas .cab { height: 46px; border-bottom: 1px solid var(--border); }
.agenda-horas .h {
  position: absolute; left: 0; width: 100%; text-align: right; padding-right: 8px;
  font-size: 11.5px; color: var(--faint); font-weight: 600; transform: translateY(-7px);
}

.agenda-col { flex: 1 0 210px; border-right: 1px solid var(--border); position: relative; }
.agenda-col:last-child { border-right: none; }
.agenda-col .cab {
  height: 46px; border-bottom: 1px solid var(--border); padding: 6px 10px;
  display: flex; align-items: center; gap: 8px; position: sticky; top: 0; background: var(--surface); z-index: 5;
}
.agenda-col .cab .n { font-size: 14px; font-weight: 650; line-height: 1.15; }
.agenda-col .cab .e { font-size: 11.5px; color: var(--faint); }
.agenda-pista { position: relative; }
.agenda-linea { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); }
.agenda-linea.media { border-top-style: dotted; opacity: .6; }

.agenda-ahora { position: absolute; left: 0; right: 0; border-top: 2px solid var(--red); z-index: 8; }
.agenda-ahora::before {
  content: ''; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px;
  background: var(--red); border-radius: 50%;
}

.cita {
  position: absolute; left: 4px; right: 4px; border-radius: var(--radius-sm);
  padding: 5px 8px; overflow: hidden; color: #fff; font-size: 12.5px;
  box-shadow: var(--shadow-sm); border-left: 3px solid rgba(0, 0, 0, .18); z-index: 6;
}
.cita:hover { text-decoration: none; filter: brightness(1.06); box-shadow: var(--shadow); }
.cita .q { font-weight: 700; font-size: 13px; line-height: 1.2; }
.cita .s { opacity: .92; line-height: 1.3; overflow: hidden; }
.cita .t { opacity: .8; font-size: 11.5px; }

.agenda-vacia { padding: 40px; text-align: center; color: var(--muted); }

/* ------------------------------------------------------------------ TPV */
.tpv { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .tpv { grid-template-columns: 1fr; } }

.catalogo { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 8px; }
.cat-btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm);
  padding: 10px; text-align: left; cursor: pointer; font-family: inherit; font-size: 13.5px;
  display: flex; flex-direction: column; gap: 3px; min-height: 62px;
}
.cat-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.cat-btn .n { font-weight: 600; line-height: 1.25; }
.cat-btn .p { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.cat-btn .st { font-size: 11.5px; color: var(--faint); }
.cat-btn.sin-stock { opacity: .55; }

.ticket-lineas { min-height: 120px; }
.ticket-linea { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.ticket-linea:last-child { border-bottom: none; }
.ticket-linea .d { flex: 1; min-width: 0; font-size: 14px; }
.ticket-linea .d small { display: block; color: var(--faint); font-size: 11.5px; }
.ticket-linea input.cant { width: 58px; text-align: center; padding: 5px; }
.ticket-linea input.prec { width: 84px; text-align: right; padding: 5px; }
.ticket-linea .quitar { color: var(--faint); background: none; border: none; cursor: pointer; font-size: 17px; padding: 0 4px; }
.ticket-linea .quitar:hover { color: var(--red); }

.total-caja { font-size: 34px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pendiente { font-size: 14px; font-weight: 600; }
.pendiente.ok { color: var(--green); }
.pendiente.falta { color: var(--red); }

.pago-row { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.pago-row label { flex: 0 0 88px; font-size: 13.5px; font-weight: 600; margin: 0; }
.pago-row input { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ ficha de clienta */
.ficha-cab { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.ficha-cab .datos { flex: 1; min-width: 240px; }

.ext-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; background: var(--surface); }
.ext-card.activa { border-left: 3px solid var(--primary); }
.ext-card.retrasada { border-left: 3px solid var(--red); background: #fffafa; }
.ext-card .cab { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 6px; }
.ext-datos { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.ext-datos b { color: var(--text); font-weight: 650; }

.formula { border-left: 3px solid var(--purple); padding: 8px 12px; background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-bottom: 8px; }
.formula .tonos { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; font-weight: 600; }

/* ------------------------------------------------------------------ mensajería */
tr.sin-leer { background: var(--primary-soft); }
tr.sin-leer b { font-weight: 750; }

/* ------------------------------------------------------------------ permisos por persona */
.miembro { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; }
.miembro > summary { padding: 10px 12px; cursor: pointer; list-style: none; }
.miembro > summary::-webkit-details-marker { display: none; }
.miembro > summary::before { content: '▸'; color: var(--faint); margin-right: 6px; }
.miembro[open] > summary::before { content: '▾'; }
.miembro[open] > summary { border-bottom: 1px solid var(--border); background: var(--surface-2); }
.miembro .modulos { padding: 10px 14px 14px; }
.miembro .modulos .check { margin-bottom: 6px; }

/* ------------------------------------------------------------------ barras de informe */
.barras { display: flex; align-items: flex-end; gap: 3px; height: 130px; padding-top: 8px; }
.barras .b { flex: 1; background: var(--primary-soft); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.barras .b > i { display: block; background: var(--primary); border-radius: 3px 3px 0 0; width: 100%; height: 100%; }

.barra-fila { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 14px; }
.barra-fila .et { flex: 0 0 165px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra-fila .pista { flex: 1; background: var(--surface-2); border-radius: 4px; height: 20px; overflow: hidden; border: 1px solid var(--border); }
.barra-fila .pista > i { display: block; height: 100%; background: var(--primary); }
.barra-fila .v { flex: 0 0 96px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ------------------------------------------------------------------ factura */
.factura-cab {
  display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 22px 24px; border-bottom: 1px solid var(--border);
}
.factura-destinatario {
  padding: 16px 24px; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.factura-pie {
  display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap;
  padding: 18px 24px; border-top: 1px solid var(--border); background: var(--surface-2);
}
.factura-pie .qr { flex: 0 0 auto; line-height: 0; }
.factura-pie .qr svg { width: 120px; height: 120px; }
.factura tfoot th { background: var(--surface); }
.factura tfoot tr:last-child th { border-top: 2px solid var(--border-strong); }

/* ------------------------------------------------------------------ ticket impreso */
.recibo {
  max-width: 320px; margin: 0 auto; background: #fff; padding: 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.5;
}
.recibo h2 { text-align: center; font-family: var(--font); margin-bottom: 2px; }
.recibo .sep { border-top: 1px dashed #999; margin: 9px 0; }
.recibo .l { display: flex; justify-content: space-between; gap: 10px; }
.recibo .tot { font-size: 15px; font-weight: 700; }

@media print {
  .sidebar, .topbar, .no-print, .flashes { display: none !important; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .recibo { max-width: none; }
}

/* ------------------------------------------------------------------ portal de la clienta */
body.portal { background: var(--bg); }
.portal-top {
  background: var(--ink); padding: 0 20px; height: 62px;
  display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30;
}
.portal-top .wordmark { font-size: 18px; }
.portal-top .wordmark:hover { text-decoration: none; }
.portal-top .small.muted { color: #a9a49a; }
.portal-shell { max-width: 720px; margin: 0 auto; padding: 26px 18px 40px; }
.portal-shell h1 { font-size: 26px; }
.portal-shell h2 { font-size: 17px; color: var(--muted); font-weight: 650; }
.portal-pie {
  max-width: 720px; margin: 0 auto; padding: 20px 18px 40px;
  font-size: 12.5px; color: var(--faint); text-align: center;
}

/* ------------------------------------------------------------------ reserva online */
.huecos { display: flex; flex-wrap: wrap; gap: 8px; }
.hueco {
  padding: 10px 16px; font-size: 15px; font-weight: 600; font-family: inherit;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); cursor: pointer; min-width: 76px;
}
.hueco:hover { border-color: var(--primary); background: var(--primary-soft); }
.hueco.elegido { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ------------------------------------------------------------------ firma */
.firma-caja { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: #fff; }
.firma-caja canvas { display: block; width: 100%; height: 150px; touch-action: none; cursor: crosshair; }
.firma-guardada img { max-width: 260px; border: 1px solid var(--border); border-radius: var(--radius-sm); background:#fff; }

/* ------------------------------------------------------------------ auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 30px 18px; background: var(--ink); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .card { padding: 26px 26px 22px; box-shadow: var(--shadow-lg); }
.auth-logo { text-align: center; margin-bottom: 22px; }
.auth-logo img { max-width: 240px; height: auto; margin: 0 auto; display: block; }
.auth-logo .wordmark { font-size: 27px; }
.auth-logo .lema { font-size: 12px; color: #8b857b; letter-spacing: .16em; text-transform: uppercase; margin-top: 6px; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 13.5px; color: #8b857b; }

/* ------------------------------------------------------------------ menús */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 5px; z-index: 90; display: none;
}
.menu.open { display: block; }
.menu a, .menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: var(--radius-sm); font-size: 14px;
  color: var(--text); background: none; border: none; cursor: pointer; font-family: inherit;
}
.menu a:hover, .menu button:hover { background: var(--surface-2); text-decoration: none; }
.menu .sep { height: 1px; background: var(--border); margin: 5px 2px; }
.menu .head { padding: 8px 10px 5px; font-size: 12px; color: var(--faint); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }

/* ------------------------------------------------------------------ util */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 650; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.flex { display: flex; align-items: center; gap: 9px; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { display: flex; flex-direction: column; gap: 9px; }
.spacer { flex: 1; }
.mt0 { margin-top: 0; } .mt1 { margin-top: 8px; } .mt2 { margin-top: 16px; } .mt3 { margin-top: 24px; }
.mb0 { margin-bottom: 0; } .mb1 { margin-bottom: 8px; } .mb2 { margin-bottom: 16px; } .mb3 { margin-bottom: 24px; }
.hide { display: none; }
/* Un correo largo no debe ensanchar el menú: se parte por donde haga falta. */
.break { overflow-wrap: anywhere; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.rojo { color: var(--red); font-weight: 600; }
.verde { color: var(--green); font-weight: 600; }
.ambar { color: var(--amber); font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.num { font-variant-numeric: tabular-nums; }

/* Desplegable de salones dentro del menú negro. */
.nav-desplegable { padding: 2px 10px 6px; }
.nav-desplegable select {
  width: 100%; font-size: 13.5px; padding: 7px 9px;
  border: 1px solid #3a3a3a; border-radius: var(--radius-sm);
  background: #262626; color: #d8d4cd; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239e8b66' d='M6 8.5 1.8 4.3l.9-.9L6 6.7l3.3-3.3.9.9z'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------------ móvil */
/* Botón de menú y velo: sólo existen en pantalla pequeña. */
.menu-movil {
  display: none; width: 38px; height: 38px; border: none; background: none;
  cursor: pointer; padding: 9px 8px; flex-direction: column; justify-content: space-between;
}
.menu-movil span { display: block; height: 2px; background: var(--text); border-radius: 2px; }
.velo {
  display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 45;
}
.velo.abierto { display: block; }

@media (max-width: 900px) {
  .menu-movil { display: flex; }

  /* La barra lateral pasa a ser un cajón que entra desde la izquierda. */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.abierto { transform: translateX(0); }

  .content { padding: 16px 12px 60px; }
  .topbar { padding: 0 10px; gap: 8px; }
  .topbar .search { max-width: none; }

  /* En el móvil los títulos y las cifras enormes no caben. */
  h1 { font-size: 21px; }
  .metric .n { font-size: 22px; }
  .total-caja { font-size: 27px; }
  .page-head { gap: 10px; margin-bottom: 14px; }
  .page-head .grow { min-width: 100%; }

  /* Rejillas de dos columnas a una sola. */
  .grid-2, .grid-3, .detail, .tpv { grid-template-columns: 1fr !important; }
  .grid { gap: 12px; }
  .grid-metrics { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

  /* Las tablas anchas se desplazan dentro de su caja, no rompen la página. */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table th, .table td { padding: 9px 10px; }

  /* Dedos, no ratón: más alto y sin zoom automático al enfocar en iOS.
     Los 16px no son estéticos: por debajo de eso, Safari hace zoom solo al
     tocar un campo y descoloca la pantalla entera. */
  .btn { padding: 10px 15px; }
  .btn-sm { padding: 7px 11px; }
  input, select, textarea,
  .topbar .search input,
  .filters input, .filters select,
  .table input, .table select { font-size: 16px; }
  .hueco { min-width: 84px; padding: 12px 16px; }
  .cat-btn { min-height: 68px; }

  /* La agenda se mira en horizontal; se estrechan las columnas para que quepan. */
  .agenda-col { flex-basis: 150px; }

  .flashes { left: 12px; right: 12px; max-width: none; top: 62px; }
  .recibo { max-width: none; }
}

@media (max-width: 520px) {
  .grid-metrics { grid-template-columns: repeat(2, 1fr); }
  .page-head .btn { flex: 1; }
}


/* Etiquetas pegables de las plantillas de correo */
.plantilla .etiquetas {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: -4px;
}
.etiqueta {
  font-family: var(--mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: 11.5px; line-height: 1;
  padding: 5px 8px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--primary-dark);
  cursor: pointer; transition: background .12s, border-color .12s, transform .12s;
}
.etiqueta:hover { background: #fff; border-color: var(--primary); }
.etiqueta.puesta {
  background: var(--primary); border-color: var(--primary); color: #fff;
  transform: scale(.94);
}
