* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f4f5f7;
  color: #1a1a1a;
}

.topbar {
  background: #1a1a2e;
  padding: 18px 24px;
}
.logo {
  color: #fff;
  font-size: 22px;
  font-weight: 700;
}
.logo span { color: #8a8fa3; font-weight: 400; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  background: #fff;
  border-bottom: 1px solid #e0e0e6;
}
.tab {
  flex: 0 0 auto;
  padding: 8px 14px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #8a8fa3;
  cursor: pointer;
}
.tab.activa {
  color: #1a1a2e;
  border-bottom: 3px solid #1a1a2e;
}

main { max-width: 680px; margin: 0 auto; padding: 20px 16px 60px; }
main:has(#panel-calendario:not(.oculto)) { max-width: 1500px; width: 96%; }

.panel.oculto { display: none; }

.fila-casilla {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.fila-casilla input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid #d5d7e0;
  border-radius: 8px;
  font-size: 15px;
}
.fila-casilla button {
  padding: 12px 18px;
  border: none;
  border-radius: 8px;
  background: #1a1a2e;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.fila-casilla button:hover { background: #2a2a4a; }

.aviso {
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #fff3cd;
  color: #7a5c00;
  margin-bottom: 12px;
}
.aviso.error { background: #fde2e2; color: #8a1f1f; }

.lista-mails { display: flex; flex-direction: column; gap: 8px; }

.fila-mail {
  background: #fff;
  border: 1px solid #e0e0e6;
  border-radius: 8px;
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.fila-mail:hover { border-color: #1a1a2e; }
.fila-mail .asunto { font-weight: 600; }
.fila-mail .remitente { color: #8a8fa3; font-size: 13px; }
.btn-borrar-mail {
  flex: 0 0 auto;
  align-self: flex-start;
  border: none;
  background: none;
  color: #d9382e;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}
.btn-borrar-mail:hover { color: #a0241c; }

.estado-vacio {
  text-align: center;
  color: #8a8fa3;
  padding: 40px 0;
}

.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.overlay.oculto { display: none; }
.caja-detalle {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  max-width: 460px;
  width: 100%;
  position: relative;
}
.caja-detalle .cerrar {
  position: absolute; top: 10px; right: 14px;
  border: none; background: none; font-size: 22px; cursor: pointer;
}
.caja-detalle dl { margin: 0; }
.caja-detalle dt { color: #8a8fa3; font-size: 12px; margin-top: 10px; }
.caja-detalle dd { margin: 2px 0 0; font-size: 15px; }

.detalle-texto, .detalle-adjuntos { margin-top: 10px; }
.detalle-texto dt, .detalle-adjuntos dt { color: #8a8fa3; font-size: 12px; }
.detalle-texto p {
  margin: 4px 0 0;
  font-size: 13px;
  white-space: pre-wrap;
  max-height: 160px;
  overflow-y: auto;
  background: #f4f5f7;
  border-radius: 8px;
  padding: 10px 12px;
}
.detalle-adjuntos .sin-adjuntos { margin: 4px 0 0; font-size: 13px; color: #8a8fa3; }
.fila-adjunto {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: #1a1a2e;
  text-decoration: none;
  background: #f4f5f7;
  border-radius: 8px;
  padding: 8px 12px;
}
.fila-adjunto:hover { background: #e8e9f5; }

.caja-password h3 { margin: 0 0 14px; font-size: 16px; }
.caja-password #input-password {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d5d7e0;
  border-radius: 8px;
  font-size: 15px;
  margin-bottom: 10px;
}
.caja-password #btn-confirmar-password {
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: 8px;
  background: #1a1a2e;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.caja-password #btn-confirmar-password:hover { background: #2a2a4a; }
.caja-password .aviso { margin: 0 0 10px; }

.badge-cita {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
}
.badge-confirmada { background: #e3f6e8; color: #1f7a3d; }
.badge-rechazada { background: #fde2e2; color: #8a1f1f; }

.cal-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}
.cal-header h2 {
  margin: 0;
  font-size: 22px;
  text-transform: capitalize;
  min-width: 200px;
  text-align: center;
}
.cal-header button {
  border: none;
  background: #1a1a2e;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
}
.cal-header button:hover { background: #2a2a4a; }

.cal-dias-semana {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #8a8fa3;
  margin-bottom: 6px;
}

.cal-grilla {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-dia {
  background: #fff;
  border: 1px solid #e0e0e6;
  border-radius: 8px;
  min-height: 170px;
  padding: 10px;
  cursor: pointer;
  overflow: hidden;
}
.cal-dia:hover { border-color: #1a1a2e; }
.cal-dia-vacio { background: transparent; border: none; cursor: default; }
.cal-dia-hoy { border-color: #1a1a2e; border-width: 2px; }
.cal-dia-numero { font-size: 17px; font-weight: 600; margin-bottom: 6px; }

.cal-chip {
  font-size: 13px;
  background: #e8e9f5;
  color: #1a1a2e;
  border-radius: 4px;
  padding: 3px 6px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-chip-mas { font-size: 11px; color: #8a8fa3; }

.lista-citas-dia { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; max-height: 50vh; overflow-y: auto; }
.fila-cita-dia { display: flex; gap: 10px; border: 1px solid #e0e0e6; border-radius: 8px; padding: 10px 12px; }
.fila-cita-dia .hora-cita { font-weight: 700; flex: 0 0 auto; }
.fila-cita-dia .nota-cita { font-size: 13px; color: #555; margin-top: 2px; }
.fila-cita-dia .origen-cita { font-size: 11px; color: #8a8fa3; margin-top: 2px; }

.btn-agregar-cita {
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: 8px;
  background: #1a1a2e;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.btn-agregar-cita:hover { background: #2a2a4a; }

.form-cita { display: flex; flex-direction: column; gap: 10px; }
.form-cita label { font-size: 12px; color: #8a8fa3; display: flex; flex-direction: column; gap: 4px; }
.form-cita input, .form-cita textarea {
  padding: 10px 12px;
  border: 1px solid #d5d7e0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #1a1a1a;
}
.form-cita button[type="submit"] {
  padding: 12px 14px;
  border: none;
  border-radius: 8px;
  background: #1a1a2e;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.form-cita button[type="submit"]:hover { background: #2a2a4a; }
