/* ══════════════════════════════════════════════════════════════════
   panel.css — La trastienda. Misma paleta que el sitio público, en
   una disposición de trabajo: barra lateral + contenido.
   ══════════════════════════════════════════════════════════════════ */

:root {
  --wine:       #571F20;
  --wine-2:     #3A2A24;
  --cream:      #F7F3EE;
  --cream-2:    #F0EBE5;
  --gold:       #E59945;
  --coral:      #D7735B;
  --burnt:      #D85E2D;
  --taupe:      #9A8479;
  --taupe-2:    #7A6459;
  --line:       #D9C7BE;
  --white:      #FFFFFF;
  --ok:         #3E8A5E;
  --warn:       #C77C1F;
  --danger:     #B4402C;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 8px rgba(87,31,32,.07);
  --font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--cream);
  color: var(--wine-2);
  display: flex;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ── Login ─────────────────────────────────────────────────────── */
body.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.login-caja {
  width: 100%;
  max-width: 340px;
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.login-caja img { width: 56px; margin: 0 auto 14px; }
.login-caja h1 { font-size: 1.1rem; color: var(--wine); margin-bottom: 4px; }
.login-caja p.sub { font-size: .82rem; color: var(--taupe-2); margin-bottom: 20px; }
.login-caja input {
  width: 100%;
  font-family: var(--font);
  font-size: 1.4rem;
  letter-spacing: 6px;
  text-align: center;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  margin-bottom: 14px;
}
.login-caja input:focus { outline: none; border-color: var(--burnt); }

/* ── Layout con barra lateral ─────────────────────────────────── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--wine);
  color: var(--cream);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar .marca-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 20px;
}
.sidebar .marca-panel img { width: 34px; height: 34px; }
.sidebar .marca-panel .nombre { font-size: .88rem; font-weight: 700; line-height: 1.2; }
.sidebar .marca-panel .sub { font-size: .68rem; opacity: .75; }

.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 600;
  color: rgba(247,243,238,.8);
}
.sidebar nav a:hover { background: rgba(247,243,238,.08); color: var(--cream); }
.sidebar nav a.activo { background: var(--burnt); color: var(--white); }

.sidebar .salir {
  font-size: .8rem;
  opacity: .7;
  padding: 10px 12px;
  cursor: pointer;
}
.sidebar .salir:hover { opacity: 1; }

.contenido {
  flex: 1;
  padding: 30px 36px;
  max-width: 980px;
}

.contenido h1 { font-size: 1.3rem; color: var(--wine); margin-bottom: 4px; }
.contenido p.sub-pagina { color: var(--taupe-2); font-size: .88rem; margin-bottom: 22px; }

/* ── Tarjetas / cuadrícula de resumen ───────────────────────────── */
.tarjetas-resumen {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px,1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.tarjeta-resumen {
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.tarjeta-resumen .num { font-size: 1.6rem; font-weight: 700; color: var(--wine); }
.tarjeta-resumen .lbl { font-size: .78rem; color: var(--taupe-2); font-weight: 600; }

.caja {
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.caja h2 { font-size: 1rem; color: var(--wine); margin-bottom: 14px; }

/* ── Tablas ──────────────────────────────────────────────────────── */
table.tabla { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.tabla th {
  text-align: left;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--taupe-2);
  padding: 8px 10px;
  border-bottom: 2px solid var(--line);
}
table.tabla td { padding: 10px; border-bottom: 1px solid var(--cream-2); vertical-align: middle; }
table.tabla tr:hover td { background: var(--cream-2); }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
}
.pill.pendiente    { background: #FBEBD3; color: var(--warn); }
.pill.confirmada   { background: #DEEFE2; color: var(--ok); }
.pill.completada   { background: #E4E1EC; color: #5A4A82; }
.pill.cancelada    { background: #F8DFD9; color: var(--danger); }
.pill.reprogramada { background: #F0E3CE; color: #96631D; }
.pill.frecuencia    { background: var(--cream-2); color: var(--wine); }

/* ── Formularios ─────────────────────────────────────────────────── */
.campo { margin-bottom: 16px; }
.campo label { display: block; font-size: .82rem; font-weight: 700; color: var(--wine); margin-bottom: 6px; }
.campo input, .campo select, .campo textarea {
  width: 100%;
  font-family: var(--font);
  font-size: .9rem;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--white);
  color: var(--wine-2);
}
.campo textarea { resize: vertical; min-height: 70px; }
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: none; border-color: var(--burnt); }
.campo-fila { display: flex; gap: 14px; flex-wrap: wrap; }
.campo-fila > .campo { flex: 1; min-width: 140px; }

.sub-label { display: block; font-size: .82rem; font-weight: 700; color: var(--wine); margin-bottom: 8px; }

/* Un botón que vive dentro de una .campo-fila, al lado de otros
   campos con label — se envuelve en un .campo con label invisible
   (misma clase "campo-btn") para que comparta el ancho flexible de
   sus vecinos y, con align-items:end en la fila, su borde inferior
   quede en la misma línea que el de los inputs, sin importar si
   algún label de al lado ocupa una o dos líneas. */
.campo-btn label { visibility: hidden; }
.campo-btn .btn { width: 100%; }

/* ── Calendario mensual de días de atención ─────────────────────── */
.cal-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 12px; }
.cal-mes-label { font-weight: 700; color: var(--wine); font-size: .92rem; min-width: 140px; text-align: center; }
.cal-dow-row { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; margin-bottom: 8px; }
.cal-dow {
  text-align: center; font-size: .78rem; font-weight: 700; padding: 9px 4px;
  border-radius: 8px; cursor: pointer; color: var(--taupe-2); background: var(--cream-2);
}
.cal-dow.activo { background: var(--wine); color: var(--white); }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; }
.cal-dia {
  height: 38px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 8px; font-size: .8rem; font-weight: 600; background: var(--white);
  border: 1.5px solid var(--line); color: var(--wine-2);
}
.cal-dia-num { line-height: 1; }
.cal-dia-puntos { display: flex; align-items: center; justify-content: center; gap: 2px; height: 4px; }
.cal-dia-punto { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.cal-dia.blank { visibility: hidden; }
.cal-dia.dia-activo { background: var(--burnt); border-color: var(--burnt); color: var(--white); }
.cal-dia.dia-inactivo { color: #B9AA9F; background: var(--cream); border-color: var(--cream-2); }
.cal-resumen { font-size: .82rem; color: var(--taupe-2); margin-top: 12px; }

.cal-leyenda {
  display: flex; align-items: center; gap: 8px;
  font-size: .78rem; color: var(--taupe-2); margin-top: 8px;
}
.cal-leyenda-punto {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: var(--gold); display: inline-block;
}
.cal-dia.dia-excepcion {
  position: relative;
  border-style: dashed;
  border-color: var(--gold);
}
.cal-dia.dia-excepcion::after {
  content: '';
  position: absolute; top: 3px; right: 3px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
}

/* ── Horas y duración como botones ───────────────────────────────── */
.hora-grid { display: grid; grid-template-columns: repeat(8,1fr); gap: 8px; }
.hora-btn {
  padding: 9px 4px; text-align: center; border-radius: 9px; border: 1.5px solid var(--line);
  background: var(--white); font-weight: 600; font-size: .82rem; color: var(--wine-2); cursor: pointer;
}
.hora-btn.seleccionado { background: var(--burnt); border-color: var(--burnt); color: var(--white); }
.dur-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.dur-btn {
  padding: 9px 18px; border-radius: 9px; border: 1.5px solid var(--line);
  background: var(--white); font-weight: 600; font-size: .82rem; color: var(--wine-2); cursor: pointer;
}
.dur-btn.seleccionado { background: var(--wine); border-color: var(--wine); color: var(--white); }

@media (max-width: 560px) {
  .hora-grid { grid-template-columns: repeat(4,1fr); }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--burnt);
  color: var(--white);
  font-family: var(--font);
  font-weight: 700;
  font-size: .86rem;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  cursor: pointer;
}
.btn:hover { background: #c65224; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secundario { background: var(--white); color: var(--wine); border: 1.5px solid var(--line); }
.btn.secundario:hover { background: var(--cream-2); }
.btn.chico { padding: 6px 12px; font-size: .78rem; }
.btn.peligro { background: var(--danger); }

.aviso { font-size: .82rem; padding: 10px 14px; border-radius: 10px; margin: 10px 0; }
.aviso.ok    { background: #DEEFE2; color: var(--ok); }
.aviso.error { background: #F8DFD9; color: var(--danger); }
.aviso.info  { background: var(--cream-2); color: var(--taupe-2); }

/* ── Modal ───────────────────────────────────────────────────────── */
.modal-fondo {
  position: fixed; inset: 0; background: rgba(58,42,36,.45);
  display: none; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal-fondo.visible { display: flex; }
.modal {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 460px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
}
.modal h2 { font-size: 1.02rem; color: var(--wine); margin-bottom: 14px; }
.modal .cerrar { float: right; cursor: pointer; color: var(--taupe); font-size: 1.1rem; }

.texto-mensaje {
  white-space: pre-wrap;
  background: var(--cream-2);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: .88rem;
  margin: 12px 0;
  line-height: 1.5;
}

.chip-tipo {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  margin: 0 6px 6px 0;
}
.chip-tipo.activo { background: var(--burnt); border-color: var(--burnt); color: var(--white); }

@media (max-width: 780px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; }
  .sidebar .marca-panel { padding: 6px 12px 6px 0; }
  .sidebar nav { flex-direction: row; }
  .contenido { padding: 20px; }
}
